From 2bb0b25c04e313a80c1202a0a7c5294907509d14 Mon Sep 17 00:00:00 2001 From: Yury Korolev Date: Mon, 28 Aug 2023 15:33:32 +0300 Subject: [PATCH] Fix ctrl-] in Dvorak layout. Refs #1833 --- Resources/hterm_all.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/hterm_all.min.js b/Resources/hterm_all.min.js index a077c6371..0e4ed1816 100644 --- a/Resources/hterm_all.min.js +++ b/Resources/hterm_all.min.js @@ -19,4 +19,4 @@ object-assign * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var o=r(3),n=r(2),i=r(4),s=r(5),a="function"==typeof Symbol&&Symbol.for,l=a?Symbol.for("react.element"):60103,c=a?Symbol.for("react.portal"):60106,u=a?Symbol.for("react.fragment"):60107,h=a?Symbol.for("react.strict_mode"):60108,d=a?Symbol.for("react.profiler"):60114,p=a?Symbol.for("react.provider"):60109,f=a?Symbol.for("react.context"):60110,g=a?Symbol.for("react.async_mode"):60111,m=a?Symbol.for("react.forward_ref"):60112;a&&Symbol.for("react.timeout");var b="function"==typeof Symbol&&Symbol.iterator;function _(e){for(var t=arguments.length-1,r="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=0;oE.length&&E.push(e)}function N(e,t,r,o){var n=typeof e;"undefined"!==n&&"boolean"!==n||(e=null);var i=!1;if(null===e)i=!0;else switch(n){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case l:case c:i=!0}}if(i)return r(o,e,""===t?"."+I(e,0):t),1;if(i=0,t=""===t?".":t+":",Array.isArray(e))for(var s=0;sString.fromCharCode(e.charCodeAt(0)-64),g={keyCode:0,keyCap:"[Unidentified]",normal:s,ctrl:s,alt:s,meta:s};class m{constructor(e){this._defs={},this._reverseDefs={},this._onCtrlNum=(e,t)=>{switch(t.keyCap.substr(0,1)){case"1":return"1";case"2":return f("@");case"3":return f("[");case"4":return f("\\");case"5":return f("]");case"6":return f("^");case"7":return f("_");case"8":return p;case"9":return"9";default:return s}},this._onAltNum=(e,t)=>i,this._onSel=(e,t)=>{let{ArrowDown:r,ArrowLeft:o,ArrowRight:i,ArrowUp:s,Escape:a,h:l,j:u,k:h,l:d,o:p,b:f,f:g,n:m,p:b,w:_,x:y,y:w}=this._reverseDefs;const v=e=>c("selection",e),C={command:"copy"};if(t===o||t===l){v({dir:"left",gran:e.shift?"word":"character"})}else if(t===i||t===d){v({dir:"right",gran:e.shift?"word":"character"})}else t===s||t===h?v({dir:"left",gran:"line"}):t===r||t===u?v({dir:"right",gran:"line"}):t===p||t===y?v({command:"change"}):t===m&&e.ctrl?v({dir:"right",gran:"line"}):t===b?e.ctrl?v({dir:"left",gran:"line"}):e.shift||e.alt||e.meta||v({command:"paste"}):t===f?e.ctrl?v({dir:"left",gran:"character"}):(e.alt,v({dir:"left",gran:"word"})):t===_?e.alt?v(C):v({dir:"right",gran:"word"}):t===g?e.ctrl?v({dir:"right",gran:"character"}):e.alt&&v({dir:"right",gran:"word"}):t===w?v(C):t===a&&v({command:"cancel"});return n},this._keyboard=e,this.reset()}getKeyDef(e){var t=this._defs[e];return t||(console.warn(`No definition for (keyCode ${e})`),t=g,this.addKeyDef(e,t),t)}addKeyDef(e,t){if(e in this._defs&&console.warn("Dup keyCode: ",e),this._defs[e]=t,/^\[\w+\]$/.test(t.keyCap)){let e=t.keyCap.replace(/\W/g,"");this._reverseDefs[e]=t}else{var r=t.keyCap[0];this._reverseDefs[r]=t,/0-9/.test(r)?this._reverseDefs["Digit"+r]=t:/[a-z]/.test(r)&&(this._reverseDefs["Key"+r.toUpperCase()]=t)}}reset(){this._defs={};const e=(e,t,r)=>"function"==typeof e?e.call(this,t,r):e,t=(t,r)=>(o,n)=>{let i=o.shift||o.ctrl||o.alt||o.meta?r:t;return e(i,o,n)},r=(t,r)=>(o,n)=>{let i=o.shift?r:t;return o.shift=!1,e(i,o,n)},o=(e,t)=>e,n=(t,r)=>(o,n)=>{let i=o.alt?t:r;return e(i,o,n)},l=(t,r)=>(o,n)=>{let i=o.shift||o.ctrl||o.alt||o.meta?t:r;return e(i,o,n)},c=t=>(r,o)=>{let n=this._keyboard.hasSelection?this._onSel:t;return e(n,r,o)},m=e=>this.addKeyDef(e.keyCode,e);m(g),m({keyCode:27,keyCap:"[Escape]",normal:c(h),ctrl:i,alt:i,meta:i}),m({keyCode:112,keyCap:"[F1]",normal:t(u+"P",d+"P"),ctrl:i,alt:d+"23~",meta:i}),m({keyCode:113,keyCap:"[F2]",normal:t(u+"Q",d+"Q"),ctrl:i,alt:d+"24~",meta:i}),m({keyCode:114,keyCap:"[F3]",normal:t(u+"R",d+"R"),ctrl:i,alt:d+"25~",meta:i}),m({keyCode:115,keyCap:"[F4]",normal:t(u+"S",d+"S"),ctrl:i,alt:d+"26~",meta:i}),m({keyCode:116,keyCap:"[F5]",normal:d+"15~",ctrl:i,alt:d+"28~",meta:i}),m({keyCode:117,keyCap:"[F6]",normal:d+"17~",ctrl:i,alt:d+"29~",meta:i}),m({keyCode:118,keyCap:"[F7]",normal:d+"18~",ctrl:i,alt:d+"31~",meta:i}),m({keyCode:119,keyCap:"[F8]",normal:d+"19~",ctrl:i,alt:d+"32~",meta:i}),m({keyCode:120,keyCap:"[F9]",normal:d+"20~",ctrl:i,alt:d+"33~",meta:i}),m({keyCode:121,keyCap:"[F10]",normal:d+"21~",ctrl:i,alt:d+"34~",meta:i}),m({keyCode:122,keyCap:"[F11]",normal:d+"23~",ctrl:i,alt:d+"42~",meta:i}),m({keyCode:123,keyCap:"[F12]",normal:d+"24~",ctrl:i,alt:d+"43~",meta:i});const b=this._onCtrlNum,_=this._onAltNum;m({keyCode:192,keyCap:"`~",normal:i,ctrl:r(f("@"),f("^")),alt:i,meta:i}),m({keyCode:49,keyCap:"1!",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:50,keyCap:"2@",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:51,keyCap:"3#",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:52,keyCap:"4$",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:53,keyCap:"5%",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:54,keyCap:"6^",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:55,keyCap:"7&",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:56,keyCap:"8*",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:57,keyCap:"9(",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:48,keyCap:"0)",normal:i,ctrl:i,alt:_,meta:i}),m({keyCode:189,keyCap:"-_",normal:i,ctrl:f("_"),alt:i,meta:i}),m({keyCode:187,keyCap:"=+",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:8,keyCap:"[Backspace]",normal:o(p),ctrl:o("\b"),alt:i,meta:i}),m({keyCode:9,keyCap:"[Tab]",normal:r("\t",d+"Z"),ctrl:a,alt:a,meta:i}),m({keyCode:81,keyCap:"qQ",normal:i,ctrl:f("Q"),alt:i,meta:i}),m({keyCode:87,keyCap:"wW",normal:c(i),ctrl:f("W"),alt:c(i),meta:i}),m({keyCode:69,keyCap:"eE",normal:i,ctrl:f("E"),alt:i,meta:i}),m({keyCode:82,keyCap:"rR",normal:i,ctrl:f("R"),alt:i,meta:i}),m({keyCode:84,keyCap:"tT",normal:i,ctrl:f("T"),alt:i,meta:i}),m({keyCode:89,keyCap:"yY",normal:c(i),ctrl:f("Y"),alt:i,meta:i}),m({keyCode:85,keyCap:"uU",normal:i,ctrl:f("U"),alt:i,meta:i}),m({keyCode:73,keyCap:"iI",normal:i,ctrl:f("I"),alt:i,meta:i}),m({keyCode:79,keyCap:"oO",normal:c(i),ctrl:f("O"),alt:i,meta:i}),m({keyCode:80,keyCap:"pP",normal:c(i),ctrl:c(f("P")),alt:i,meta:i}),m({keyCode:219,keyCap:"[{",normal:i,ctrl:f("["),alt:i,meta:i}),m({keyCode:221,keyCap:"]}",normal:i,ctrl:f("]"),alt:i,meta:i}),m({keyCode:220,keyCap:"\\|",normal:i,ctrl:f("\\"),alt:i,meta:i}),m({keyCode:20,keyCap:"[CapsLock]",normal:s,ctrl:s,alt:s,meta:i}),m({keyCode:65,keyCap:"aA",normal:i,ctrl:f("A"),alt:i,meta:i}),m({keyCode:83,keyCap:"sS",normal:i,ctrl:f("S"),alt:i,meta:i}),m({keyCode:68,keyCap:"dD",normal:i,ctrl:f("D"),alt:i,meta:i}),m({keyCode:70,keyCap:"fF",normal:i,ctrl:c(f("F")),alt:c(i),meta:i}),m({keyCode:71,keyCap:"gG",normal:i,ctrl:f("G"),alt:i,meta:i}),m({keyCode:72,keyCap:"hH",normal:c(i),ctrl:f("H"),alt:i,meta:i}),m({keyCode:74,keyCap:"jJ",normal:c(i),ctrl:f("J"),alt:i,meta:i}),m({keyCode:75,keyCap:"kK",normal:c(i),ctrl:f("K"),alt:i,meta:i}),m({keyCode:76,keyCap:"lL",normal:c(i),ctrl:f("L"),alt:i,meta:i}),m({keyCode:186,keyCap:";:",normal:i,ctrl:a,alt:i,meta:i}),m({keyCode:222,keyCap:"'\"",normal:i,ctrl:a,alt:i,meta:i}),m({keyCode:13,keyCap:"[Enter]",normal:"\r",ctrl:i,alt:i,meta:i}),m({keyCode:16,keyCap:"[Shift]",normal:s,ctrl:s,alt:s,meta:i}),m({keyCode:90,keyCap:"zZ",normal:i,ctrl:f("Z"),alt:i,meta:i}),m({keyCode:88,keyCap:"xX",normal:c(i),ctrl:c(f("X")),alt:i,meta:i}),m({keyCode:67,keyCap:"cC",normal:i,ctrl:f("C"),alt:i,meta:i}),m({keyCode:86,keyCap:"vV",normal:i,ctrl:f("V"),alt:i,meta:i}),m({keyCode:66,keyCap:"bB",normal:c(i),ctrl:c(f("B")),alt:c(i),meta:i}),m({keyCode:78,keyCap:"nN",normal:i,ctrl:c(f("N")),alt:i,meta:i}),m({keyCode:77,keyCap:"mM",normal:i,ctrl:f("M"),alt:i,meta:i}),m({keyCode:188,keyCap:",<",normal:i,ctrl:n(a,s),alt:i,meta:i}),m({keyCode:190,keyCap:".>",normal:i,ctrl:n(a,s),alt:i,meta:i}),m({keyCode:191,keyCap:"/?",normal:i,ctrl:r(f("_"),f("?")),alt:i,meta:i}),m({keyCode:17,keyCap:"[Control]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:18,keyCap:"[Alt]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:91,keyCap:"[Meta]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:32,keyCap:" ",normal:i,ctrl:f("@"),alt:i,meta:i}),m({keyCode:93,keyCap:"[Meta]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:42,keyCap:"[PRTSCR]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:145,keyCap:"[SCRLK]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:19,keyCap:"[BREAK]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:45,keyCap:"[Insert]",normal:d+"2~",ctrl:i,alt:i,meta:i}),m({keyCode:36,keyCap:"[Home]",normal:h+"OH",ctrl:i,alt:i,meta:i}),m({keyCode:33,keyCap:"[PageUp]",normal:d+"5~",ctrl:i,alt:i,meta:i}),m({keyCode:46,keyCap:"[DEL]",normal:d+"3~",ctrl:i,alt:i,meta:i}),m({keyCode:35,keyCap:"[End]",normal:h+"OF",ctrl:i,alt:i,meta:i}),m({keyCode:34,keyCap:"[PageDown]",normal:d+"6~",ctrl:i,alt:i,meta:i}),m({keyCode:38,keyCap:"[ArrowUp]",normal:c(l(d+"A",u+"A")),ctrl:i,alt:i,meta:i}),m({keyCode:40,keyCap:"[ArrowDown]",normal:c(l(d+"B",u+"B")),ctrl:i,alt:i,meta:i}),m({keyCode:39,keyCap:"[ArrowRight]",normal:c(l(d+"C",u+"C")),ctrl:i,alt:i,meta:i}),m({keyCode:37,keyCap:"[ArrowLeft]",normal:c(l(d+"D",u+"D")),ctrl:i,alt:i,meta:i}),m({keyCode:144,keyCap:"[NumLock]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:12,keyCap:"[Clear]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:96,keyCap:"[Numpad0]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:97,keyCap:"[Numpad1]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:98,keyCap:"[Numpad2]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:99,keyCap:"[Numpad3]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:100,keyCap:"[Numpad4]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:101,keyCap:"[Numpad5]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:102,keyCap:"[Numpad6]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:103,keyCap:"[Numpad7]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:104,keyCap:"[Numpad8]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:105,keyCap:"[Numpad9]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:107,keyCap:"[NumpadAdd]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:109,keyCap:"[NumpadSubtract]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:106,keyCap:"[NumpadMultiply]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:111,keyCap:"[NumpadDivide]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:110,keyCap:"[NumpadDicimal]",normal:i,ctrl:i,alt:i,meta:i}),this._reverseDefs.Backqoute=this._defs[192],this._reverseDefs.BracketLeft=this._defs[229],this._reverseDefs.BracketRight=this._defs[221],this._reverseDefs.Slash=this._defs[191],this._reverseDefs.Space=this._defs[32]}keyCode(e){let t=this._reverseDefs[e];return t?t.keyCode:0}key(e){let t=this._defs[e];if(!t)return"";let r=t.keyCap;return/^\[\w+\]$/.test(r)?r.substr(1,r.length-2):r.substr(0,1)}}const b=65536,_=1<<17,y=1<<18,w=1<<19,v=1<<20;function C(e){return{shift:(e&_)==_,alt:(e&w)==w,ctrl:(e&y)==y,meta:(e&v)==v}}class S{constructor(){this._map={},this.expandFn=e=>{if(0===e.keys.length)return;let t=[{keyCode:121,key:"F10",code:"F10",id:"121:0"},{keyCode:112,key:"F1",code:"F1",id:"112:0"},{keyCode:113,key:"F2",code:"F2",id:"113:0"},{keyCode:114,key:"F3",code:"F3",id:"114:0"},{keyCode:115,key:"F4",code:"F4",id:"115:0"},{keyCode:116,key:"F5",code:"F5",id:"116:0"},{keyCode:117,key:"F6",code:"F6",id:"117:0"},{keyCode:118,key:"F7",code:"F7",id:"118:0"},{keyCode:119,key:"F8",code:"F8",id:"119:0"},{keyCode:120,key:"F9",code:"F9",id:"120:0"}],r=e.keys.slice();for(var o=0;o<10;o++){let n=o+48+":0",i=t[o];e.keys=r.slice(),e.keys.push(n),e.action={type:"press",key:i,mods:0},this.expandBinding(e)}},this.expandCursor=e=>{if(0==e.keys.length)return;let t=[{keyCode:36,key:"HOME",code:"HOME",id:"36:0"},{keyCode:33,key:"PGUP",code:"PGUP",id:"33:0"},{keyCode:35,key:"END",code:"END",id:"35:0"},{keyCode:34,key:"PGDOWN",code:"PGDOWN",id:"34:0"}],r=["37:0","38:0","39:0","40:0"],o=e.keys.slice();for(var n=0;n{var t=e.keys.map(e=>e.split("-")[0]);if(0==t.length)return;var r=[t.sort()],o=0;var n=[{idLeft:"16:1",idRight:"16:2",loc:e.shiftLoc},{idLeft:"17:1",idRight:"17:2",loc:e.controlLoc},{idLeft:"18:1",idRight:"18:2",loc:e.optionLoc},{idLeft:"91:1",idRight:"93:2",loc:e.commandLoc}];for(let e of n)for(o=r.length-1;o>=0;o--){var i=r[o];let t=i.indexOf(e.idLeft);if(t<0&&(t=i.indexOf(e.idRight)),t<0)continue;if(1==e.loc){i[t]=e.idLeft;continue}if(2==e.loc){i[t]=e.idRight;continue}i[t]=e.idLeft;let n=i.slice();n[t]=e.idRight,r.push(n)}for(let t of r){let r=t.sort().join(":");this._map[r]=e.action}}}reset(){this._map={}}match(e){let t=e.sort().join(":");return this._map[t]}}const k=l.CANCEL,T=l.DEFAULT,P=l.PASS,x=l.STRIP;function A(e){let t="",r=e.length;for(let o=0;o{let t=e.code;if(this._capsLockRemapped){let r;c("mods",{mods:r="keyup"==e.type&&"CapsLock"==t?0:function(e,t=!0){let r=0;return e.shiftKey&&(r|=_),e.ctrlKey&&(r|=y),e.altKey&&(r|=w),e.metaKey&&(r|=v),t&&(r|=b),r}(e)})}"AltLeft"!=t&&"AltRight"!=t||this._ignoreAccents[t]&&("keydown"==e.type?c("guard-ime-on",{}):c("guard-ime-off",{}),V(e))},this._downKeysIds=()=>{let e=Array.from(this._down);return this._mods.Meta.has("tb-meta")&&-1==e.indexOf(I)&&e.push(I),this._mods.Control.has("tb-ctrl")&&-1==e.indexOf(M)&&e.push(M),this._mods.Alt.has("tb-alt")&&-1==e.indexOf(N)&&e.push(N),this._mods.Shift.has("tb-shift")&&-1==e.indexOf(F)&&e.push(F),e},this._onKeyDown=e=>{if(e.isComposing)return void(this._lastKeyDownEvent=null);let t=e;if(229===e.keyCode){if(!this._lastKeyDownEvent)return;t=this._lastKeyDownEvent}else this._lastKeyDownEvent=e;let r=O(t);this._down.add(r);let o=this._bindings.match(this._downKeysIds());if(E.has(r)||this._down.delete(r),o)return this._execBinding(o,e),void V(e);let n=this._downMap[r],i=this._mod(this._modsMap[t.code]),s=!1;n&&(i&&(s=!this._mods[i].has(r)),s||(this._handleKeyDownKey(n,e),s=!0)),i&&this._mods[i].add(r),this._upMap[r]&&this._up.add(r),this._updateUIKitModsIfNeeded(t),s||this._handleKeyDown(t.keyCode,e)},this._onBeforeInput=e=>{"dictation"!==this._lang?("insertText"===e.inputType&&(this._output(e.data),this._langWithDeletes&&e.data),"deleteContentBackward"===e.inputType&&this._output(p),V(e)):this._moveCaret(e.data||"")},this._onInput=e=>V(e),this._onKeyUp=e=>{this._lastKeyDownEvent=null;let t=O(e);this._down.delete(t);let r=this._mod(this._modsMap[e.code]);r&&this._mods[r].delete(t),this._updateUIKitModsIfNeeded(e);let o=this._upMap[t];o&&this._up.has(t)&&this._handleKeyDownKey(o,null),V(e)},this._handleKeyDown=(e,t)=>{let r={keyCode:e,key:"",code:"Unidentified"};t&&(r.code=t.code,r.key=t.key),this._handleKeyDownKey(r,t)},this._handleKeyDownKey=(e,t)=>{let r=this._keyMap,o=this._mods.Alt.size>0,n=this._mods.Control.size>0,i=this._mods.Meta.size>0,s=this._mods.Shift.size>0,a=e.code,l=e.key,c=function(e,t,r,o){if(!o)return e;if(o.ctrlKey){let r=o.key.toLowerCase(),n=o.keyCode;if(8===n&&"h"===r||9===n&&"i"===r||13===n&&"c"===r||13===n&&"m"===r||27===n&&"["===r)return e.keyCode=t.keyCode(r)||e.keyCode,e;let i=o.code;if(8===n&&"KeyH"===i||9===n&&"KeyI"===i||13===n&&"KeyC"===i||13===n&&"KeyM"===i||27===n&&"BracketLeft"===i)return e.keyCode=t.keyCode(i)||e.keyCode,e}if(!r){let t=o.key.toLowerCase();return(/^[~!@#$%^&*()_+{}|:"<>?]$/.test(t)||/^\w$/.test(t)&&t!==o.key)&&(e.shift=!0),e}return e}({key:l,code:a,keyCode:e.keyCode,alt:o,ctrl:n,meta:i,shift:s},this._keyMap,this._isHKB,t),u=r.getKeyDef(c.keyCode);var p=null;function f(e){p=e;var t=u[e];return"function"==typeof t&&(t=t.call(r,c,u)),t===T&&"normal"!==e&&(t=f("normal")),t}let g;if(g=f(n?"ctrl":o?"alt":i?"meta":"normal"),!this._langWithDeletes||"[Backspace]"!==u.keyCap){if(!this.hasSelection&&(g===P||g===T&&!(n||o||i))){if(g===P&&!e.src)return;if(/^\[\w+\]$/.test(u.keyCap)){if(!e.src)return void(this._removeAccents=!1)}else if(this._langWithDeletes)return;if(!this._isHKB)return this._output(l),void V(t);let r=this._removeAccents?function(e){let t=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),r=t.replace(/^[\u02c6\u00a8\u00b4\u02dc\u0060]/,"");return r&&(t=r),t}(l):l;return this._removeAccents=!1,this._capsLockRemapped||this._shiftRemapped?this._output(s?r.toUpperCase():r.toLowerCase()):this._output(r),void V(t)}if(this._removeAccents=!1,g===x&&(o=n=!1,"function"==typeof(g=u.normal)&&(g=g.call(r,c,u)),g===T&&2===u.keyCap.length&&(g=u.keyCap.substr(s?1:0,1))),V(t),g!==k&&!this.hasSelection)if(g===T||"string"==typeof g){if("ctrl"===p?n=!1:"alt"===p?o=!1:"meta"===p&&(i=!1),s=c.shift,(o||n||s||i)&&"string"==typeof g&&g.substr(0,2)===d){let e=1;s&&(e+=1),o&&(e+=2),n&&(e+=4),i&&(e+=8);let t=";"+e;g=3==g.length?d+"1"+t+g.substr(2,1):g.substr(0,g.length-1)+t+g.substr(g.length-1)}else{if(g===T&&(g=u.keyCap.substr(s?1:0,1),n)){let e=u.keyCap.substr(0,1).charCodeAt(0);e>=64&&e<=95&&(g=String.fromCharCode(e-64))}let e=g.toString();if(o&&"8-bit"==this._altSendsWhat&&1==e.length){let t=e.charCodeAt(0)+128;g=String.fromCharCode(t)}(o&&"escape"==this._altSendsWhat||i&&this._metaSendsEscape)&&(g=h+e)}"string"==typeof g?this._output(g):console.warn("action is not a string",g)}else console.log("Invalid action: "+JSON.stringify(g))}},this._onIME=e=>{let t=e.type,r=e.data||"";c("ime",{type:t,data:r}),this._moveCaret(r),"compositionend"==t&&this._output(r)},this._output=e=>{this._up.clear(),this.caret.innerHTML="⁠",e&&c("out",{data:e})},this._stateReset=e=>{this._down.clear(),this._up.clear(),this._mods={Shift:new Set,Alt:new Set,Meta:new Set,Control:new Set},this.caret.innerHTML="⁠",this.hasSelection=e},this._configKey=e=>{let t=e.code,r=R(e.down);r&&(this._downMap[t.id]=r);let o=this._mod(e.mod);o&&(this._modsMap[t.code]=e.mod);let n=R(e.up);n&&(this._upMap[t.id]=n),"AltRight"!==t.code&&"AltLeft"!==t.code||(this._ignoreAccents[t.code]=e.ignoreAccents&&(!!o||!!n||!!r))},this._config=e=>{this._reset(),this._bindings.reset(),this._configKey(e.capsLock),this._configKey(e.command.left),this._configKey(e.command.right),this._configKey(e.control.left),this._configKey(e.control.right),this._configKey(e.option.left),this._configKey(e.option.right),this._configKey(e.shift.left),this._configKey(e.shift.right),this._bindings.expandFn(e.fn),this._bindings.expandCursor(e.cursor);for(let t of e.shortcuts){let e={keys:this._keysFromShortcut(t.input,t.modifiers),action:t.action,shiftLoc:0,controlLoc:0,optionLoc:0,commandLoc:0};this._bindings.expandBinding(e)}this._updateRemappingFlags()},this._onToolbarMods=e=>{let t=C(e);t.alt?this._mods.Alt.add("tb-alt"):this._mods.Alt.delete("tb-alt"),t.ctrl?this._mods.Control.add("tb-ctrl"):this._mods.Control.delete("tb-ctrl"),t.shift?this._mods.Shift.add("tb-shift"):this._mods.Shift.delete("tb-shift"),t.meta?this._mods.Meta.add("tb-meta"):this._mods.Meta.delete("tb-meta")},this._execPress=(e,t,r)=>{let o=e.split(/:/g),n=this._mods;this._mods={Shift:new Set(n.Shift),Alt:new Set,Meta:new Set,Control:new Set};let i=parseInt(o[0],10),s=C(i);s.shift&&this._mods.Shift.add("tb-shift"),s.ctrl&&this._mods.Control.add("tb-ctrl"),s.alt&&this._mods.Alt.add("tb-alt"),s.meta&&this._mods.Meta.add("tb-meta");let a=parseInt(o[1],10),l=""==o[3]?":":o[3]||this._keyMap.key(a)||"",c={keyCode:a,key:l,code:"",src:"toolbar"};if(!r&&i>0){let e=c.keyCode+":"+o[2]+(0==a?":"+l:"");this._down.add(e);let t=this._bindings.match(this._downKeysIds());if(this._down.delete(e),t)return this._execBinding(t,null),void(this._mods=n)}this._handleKeyDownKey(c,t),this._mods=n,this._removeAccents=!0},this.onKB=(e,t)=>{switch(e){case"mods-down":this._handleCapsLockDown(!0);break;case"mods-up":this._handleCapsLockDown(!1);break;case"guard-up":this._handleGuard(!0,t);break;case"guard-down":this._handleGuard(!1,t);break;case"selection":this.hasSelection=t;break;case"lang":this._handleLang(t);break;case"toolbar-mods":this._onToolbarMods(t);break;case"toolbar-press":this._execPress(t,null,!1);break;case"press":this._execPress(t,null,!0);break;case"state-reset":this._stateReset(t);break;case"focus":this.focus(t);break;case"hex":this._output(A(t)),this._removeAccents=!0;break;case"config":this._config(t)}},this._t=e,this.element=t||document.createElement("div");let r=this.element;this.caret.innerHTML="⁠";var o=document.getElementById("hterm:row-nodes");null==o||o.append(this.caret),this.caret.style.position="absolute",this.caret.style.zIndex="1000",r.addEventListener("focus",this._onFocus),r.addEventListener("blur",this._onBlur),r.setAttribute("autocomplete","off"),r.setAttribute("spellcheck","false"),r.setAttribute("autocorrect","off"),r.setAttribute("autocapitalize","none"),r.setAttribute("contenteditable","plaintext-only"),r.addEventListener("keydown",this._onKeyDown),r.addEventListener("keyup",this._onKeyUp),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),r.addEventListener("compositionstart",this._onIME),r.addEventListener("compositionupdate",this._onIME),r.addEventListener("compositionend",this._onIME),r.addEventListener("beforeinput",this._onBeforeInput),r.addEventListener("input",this._onInput),this._updateRemappingFlags()}_updateRemappingFlags(){this._capsLockRemapped=null!=this._modsMap.CapsLock||null!=this._downMap[D]||null!=this._upMap[D],this._shiftRemapped=null!=this._modsMap.ShiftLeft&&"Shift"!==this._modsMap.ShiftLeft||null!=this._modsMap.ShiftRight&&"Shift"!==this._modsMap.ShiftRight}_mod(e){switch(e){case"Escape":return this._altSendsWhat="escape","Alt";case"8-bit":return this._altSendsWhat="8-bit","Alt";case"Shift":return"Shift";case"Control":return"Control";case"Meta":return this._metaSendsEscape=!1,"Meta";case"Meta-Escape":return this._metaSendsEscape=!0,"Meta";default:return null}}focus(e){var t,r,o;e?(this.element.focus(),null===(t=window.getSelection())||void 0===t||t.collapse(this.caret),null===(r=this._t)||void 0===r||r.onFocusChange__(!0)):(this.element.blur(),null===(o=this._t)||void 0===o||o.onFocusChange__(!1))}_onFocus(e){var t;null===(t=this._t)||void 0===t||t.onFocusChange__(!0)}_onBlur(e){var t;null===(t=this._t)||void 0===t||t.onFocusChange__(!1)}_moveCaret(e){var r=this._t.scrollPort_;let o=this.caret;o.style.backgroundColor=lib.colors.setAlpha(t.getCursorColor(),1),o.style.color=r.getBackgroundColor();const n=this._t.screenSize.width,i=this._t.screenSize.height,s=this._t.screen_.cursorPosition.column,a=this._t.screen_.cursorPosition.row;var l=lib.wc.strWidth(e);o.style.bottom="auto",o.style.top="auto",o.style.left="auto",o.style.right="auto",0!=l&&(l>=n?(o.style.left="0px",o.style.right="0px",o.style.top=a<.8*i?`calc(var(--hterm-charsize-height) * ${a+1})`:`calc(var(--hterm-charsize-height) * ${a-Math.floor(l/(n+1))-1})`):s+l<=n?(o.style.left=`calc(var(--hterm-charsize-width) * ${s})`,o.style.top=`calc(var(--hterm-charsize-height) * ${a})`,o.style.right="auto"):0==a?(o.style.top=`calc(var(--hterm-charsize-height) * ${a+1})`,o.style.left="auto",o.style.right="0px"):(o.style.top=`calc(var(--hterm-charsize-height) * ${a-1}`,o.style.left="auto",o.style.right="0px"))}_handleCapsLockDown(e){let t=this._modsMap.CapsLock;if(e){this._down.add(D);let e=this._downMap[D];return!e||t&&this._mods[t].has(D)||this._handleKeyDownKey(e,null),t&&this._mods[t].add(D),void(this._upMap[D]&&this._up.add(D))}this._down.delete(D),t&&this._mods[t].delete(D);let r=this._upMap[D];r&&this._up.has(D)&&this._handleKeyDownKey(r,null)}_handleLang(e){let t=e.split(":");this._lang=t[0],this._isHKB="hw"===t[1],this._langWithDeletes="ko-KR"===this._lang||"vi-VN"===this._lang,this._stateReset(this.hasSelection),"dictation"!==this._lang&&this._moveCaret("")}_handleGuard(e,t){let r=this._keyMap.keyCode(t),o=`${r}:0`;if(e)return this._down.delete(o),void(this._removeAccents=!0);this._down.add(o),this._handleKeyDown(r,null)}_reset(){this.hasSelection=!1,this._removeAccents=!1,this._modsMap={},this._downMap={},this._upMap={},this._up.clear(),this._down.clear(),this._mods={Shift:new Set,Alt:new Set,Meta:new Set,Control:new Set},this._ignoreAccents={AltLeft:!0,AltRight:!0}}_keysFromShortcut(e,t){var r=[];let o=C(t);o.shift&&r.push(F),o.alt&&r.push(N),o.ctrl&&r.push(M),o.meta&&r.push(I);let n=this._keyMap.keyCode(e);return n?r.push(n+":0"):r.push("0:0-"+e),r}_execBinding(e,t){switch(e.type){case"command":c("command",{command:e.value});break;case"press":this._execPress(`${e.mods}:${e.key.id}`,t,!0);break;case"hex":this._output(A(e.value)),this._removeAccents=!0}}}if(void 0!==L)throw new Error('Global "lib" object already exists.');var L={runtimeDependencies_:{},initCallbacks_:[],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>>0},L.array.uint32ToArrayBigEndian=function(e){return[e>>>24&255,e>>>16&255,e>>>8&255,e>>>0&255]},L.array.concatTyped=function(...e){let t=0;for(const r of e)t+=r.length;const r=new e[0].constructor(t);let o=0;for(const t of e)r.set(t,o),o+=t.length;return r},L.array.compare=function(e,t){if(null===e||null===t)return null===e&&null===t;if(e.length!==t.length)return!1;for(let r=0;r>4*(t-2)})))},L.colors.x11ToCSS=function(e){var t=e.match(L.colors.re_.x11rgb);return t?(t.splice(0,1),L.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("#")?L.colors.x11HexToCSS(e):L.colors.nameToRGB(e)},L.colors.hexToRGB=function(e){var t=L.colors.re_.hex16,r=L.colors.re_.hex24;function o(e){4==e.length&&(e=e.replace(t,(function(e,t,r,o){return"#"+t+t+r+r+o+o})));var o=e.match(r);return o?"rgb("+parseInt(o[1],16)+", "+parseInt(o[2],16)+", "+parseInt(o[3],16)+")":null}if(e instanceof Array)for(var n=0;n":">","&":"&",'"':""","'":"'"};return e.replace(/[<>&\"\']/g,e=>t[e])}},L.f.parseQuery=function(e){e.startsWith("?")&&(e=e.substr(1));for(var t={},r=e.split("&"),o=0;or?r:e},L.f.zpad=function(e,t){return String(e).padStart(t,"0")},L.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)},L.f.alarm=function(e,t){var r,o,n=t||5e3,i=L.f.getStack(1);return r=setTimeout((function(){var t="string"==typeof e?t:e.name;t=t?": "+t:"",console.warn("lib.f.alarm: timeout expired: "+n/1e3+"s"+t),console.log(i),r=null}),n),o=function(e){return function(){return r&&(clearTimeout(r),r=null),e.apply(null,arguments)}},"string"==typeof e?o:o(e)},L.f.getStack=function(e=0,t){const r=(new Error).stack.split("\n");e+=2;const o=r.length-e;t=void 0===t?o:L.f.clamp(t,0,o);const n=new Array;for(let o=e;oe.os);if(window.chrome&&chrome.runtime&&chrome.runtime.getPlatformInfo)return new Promise((e,t)=>chrome.runtime.getPlatformInfo(t=>e(t.os)));if(window.navigator&&navigator.userAgent){const e=navigator.userAgent;if(e.includes("Mac OS X"))return Promise.resolve("mac");if(e.includes("CrOS"))return Promise.resolve("cros");if(e.includes("Linux"))return Promise.resolve("linux");if(e.includes("Android"))return Promise.resolve("android");if(e.includes("Windows"))return Promise.resolve("windows")}return Promise.reject(null)},L.f.getChromeMilestone=function(){if(window.navigator&&navigator.userAgent){const e=navigator.userAgent.match(/\sChrome\/(\d+)/);if(e)return parseInt(e[1])}return NaN},L.f.lastError=function(e=null){let t;return window.browser&&browser.runtime?t=browser.runtime.lastError:window.chrome&&chrome.runtime&&(t=chrome.runtime.lastError),t&&t.message?t.message:e},L.i18n={},L.i18n.browser_=window.browser&&browser.i18n?browser.i18n:window.chrome&&chrome.i18n?chrome.i18n:null,L.i18n.getAcceptLanguages=function(e){L.i18n.browser_?L.i18n.browser_.getAcceptLanguages(e):setTimeout((function(){e([navigator.language.replace(/-/g,"_")])}),0)},L.i18n.getMessage=function(e,t=[],r=""){if(L.i18n.browser_){const r=L.i18n.browser_.getMessage(e,t);if(r)return r}return L.i18n.replaceReferences(r,t)},L.i18n.replaceReferences=function(e,t=[]){return null===t&&(t=[]),t instanceof Array||(t=[t]),e.replace(/\$(\d+)/g,(e,r)=>r<=t.length?t[r-1]:"")},L.MessageManager=function(e){this.languages_=e.map(e=>e.replace(/-/g,"_")),-1==this.languages_.indexOf("en")&&this.languages_.unshift("en"),this.messages={}},L.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}},L.MessageManager.prototype.findAndLoadMessages=function(e,t){var r=this.languages_.concat(),o=[],n=[];function i(e){e?o=r.shift():n=r.shift(),r.length?s():t(o,n)}var s=function(){this.loadMessages(this.replaceReferences(e,r),i.bind(this,!0),i.bind(this,!1))}.bind(this);s()},L.MessageManager.prototype.loadMessages=function(e,t,r){var o=new XMLHttpRequest;o.onload=()=>{this.addMessages(JSON.parse(o.responseText)),t()},r&&(o.onerror=()=>r(o)),o.open("GET",e),o.send()},L.MessageManager.prototype.replaceReferences=L.i18n.replaceReferences,L.MessageManager.prototype.get=function(e,t,r){let o=L.i18n.getMessage(e,t);return o||((o=this.messages[e])||(console.warn("Unknown message: "+e),o=void 0===r?e:r,this.messages[e]=o),this.replaceReferences(o,t))},L.MessageManager.prototype.processI18nAttributes=function(e){for(var t=e.querySelectorAll("[i18n]"),r=0;re.replace(/-/g,"_").toUpperCase();var r=e.getAttribute("i18n");if(r){try{r=JSON.parse(r)}catch(t){throw console.error("Can't parse "+e.tagName+"#"+e.id+": "+r),t}for(var o in r){var n=o,i=r[o];i.startsWith("=")&&(o=i.substr(1),i=r[o]),i.startsWith("$")&&(i=t(e.getAttribute(i.substr(1))+"_"+o));var s=this.get(i);"_"==n?e.textContent=s:e.setAttribute(n,s)}}},L.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.isImportingJson_=!1,this.prefRecords_={},this.globalObservers_=[],this.childFactories_={},this.childLists_={}},L.PreferenceManager.prototype.DEFAULT_VALUE=L.f.createEnum("DEFAULT"),L.PreferenceManager.Record=function(e,t){this.name=e,this.defaultValue=t,this.currentValue=this.DEFAULT_VALUE,this.observers=[]},L.PreferenceManager.Record.prototype.DEFAULT_VALUE=L.PreferenceManager.prototype.DEFAULT_VALUE,L.PreferenceManager.Record.prototype.addObserver=function(e){this.observers.push(e)},L.PreferenceManager.Record.prototype.removeObserver=function(e){var t=this.observers.indexOf(e);t>=0&&this.observers.splice(t,1)},L.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},L.PreferenceManager.prototype.deactivate=function(){if(!this.isActive_)throw new Error("Not activated");this.isActive_=!1,this.storage.removeObserver(this.storageObserver_)},L.PreferenceManager.prototype.activate=function(){if(this.isActive_)throw new Error("Already activated");this.isActive_=!0,this.storage.addObserver(this.storageObserver_)},L.PreferenceManager.prototype.readStorage=function(e){var t=0;function r(){0==--t&&e&&e()}var o=Object.keys(this.prefRecords_).map(e=>this.prefix+e);this.trace&&console.log("Preferences read: "+this.prefix),this.storage.getItems(o,function(o){var n=this.prefix.length;for(var i in o){var s=o[i],a=i.substr(n),l=a in this.childLists_&&JSON.stringify(s)!=JSON.stringify(this.prefRecords_[a].currentValue);this.prefRecords_[a].currentValue=s,l&&(t++,this.syncChildList(a,r))}0==t&&e&&setTimeout(e)}.bind(this))},L.PreferenceManager.prototype.definePreference=function(e,t,r){var o=this.prefRecords_[e];o?this.changeDefault(e,t):o=this.prefRecords_[e]=new L.PreferenceManager.Record(e,t),r&&o.addObserver(r)},L.PreferenceManager.prototype.definePreferences=function(e){for(var t=0;t=0&&i.splice(l,1),!this.childLists_[e][a]){var c=this.childFactories_[e](this,a);if(!c){console.warn("Unable to restore child: "+e+": "+a);continue}c.trace=this.trace,this.childLists_[e][a]=c,r++,c.readStorage(o)}}for(s=0;s{if(--r<1){t&&t();for(let t in e)t in this.childLists_&&this.set(t,this.get(t));this.isImportingJson_=!1}};for(var n in e)if(n in this.childLists_)for(var i=e[n],s=0;s{const n=L.f.lastError();if(n){if(n.indexOf("MAX_WRITE_OPERATIONS"))return console.warn(`Will retry save of ${e} after exceeding quota: ${n}`),void setTimeout(()=>this.setItem(e,t,o),1e3);console.error(`Unknown runtime error: ${n}`)}r&&r()};var n={};n[e]=t,this.storage_.set(n,o)},L.Storage.Chrome.prototype.setItems=function(e,t){this.storage_.set(e,t)},L.Storage.Chrome.prototype.removeItem=function(e,t){this.storage_.remove(e,t)},L.Storage.Chrome.prototype.removeItems=function(e,t){this.storage_.remove(e,t)},L.Storage.Local=function(){this.observers_=[],this.storage_=window.localStorage,window.addEventListener("storage",this.onStorage_.bind(this))},L.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 n=0;n=0;o--){var n=e[o],i=this.storage_.getItem(n);if("string"==typeof i)try{r[n]=JSON.parse(i)}catch(e){r[n]=i}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},L.Storage.Local.prototype.setItem=function(e,t,r){this.storage_.setItem(e,JSON.stringify(t)),r&&setTimeout(r,0)},L.Storage.Local.prototype.setItems=function(e,t){for(var r in e)this.storage_.setItem(r,JSON.stringify(e[r]));t&&setTimeout(t,0)},L.Storage.Local.prototype.removeItem=function(e,t){this.storage_.removeItem(e),t&&setTimeout(t,0)},L.Storage.Local.prototype.removeItems=function(e,t){for(var r=0;r=0;o--){var n=e[o],i=this.storage_[n];if("string"==typeof i)try{r[n]=JSON.parse(i)}catch(e){r[n]=i}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},L.Storage.Memory.prototype.setItem=function(e,t,r){var o=this.storage_[e];this.storage_[e]=JSON.stringify(t);var n={};n[e]={oldValue:o,newValue:t},setTimeout(function(){for(var e=0;e1114111?t+="�":n<65536?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>>10&1023),56320+(1023&n)))}}else t+="�",this.bytesLeft=0,r--}return t},L.decodeUTF8=function(e){return(new L.UTF8Decoder).decode(e)},L.encodeUTF8=function(e){for(var t="",r=0;r>>6),o=1):n<=65535?(t+=String.fromCharCode(224|n>>>12),o=2):(t+=String.fromCharCode(240|n>>>18),o=3);o>0;)o--,t+=String.fromCharCode(128|n>>>6*o&63)}return t},L.wc={},L.wc.nulWidth=0,L.wc.controlWidth=0,L.wc.regardCjkAmbiguous=!1,L.wc.cjkAmbiguousWidth=2,L.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],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,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],[2558,2558],[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],[2901,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[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],[3457,3457],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,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,6848],[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],[43052,43052],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[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],[68900,68903],[69291,69292],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70095,70095],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[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],[71727,71735],[71737,71738],[71995,71996],[71998,71998],[72003,72003],[72148,72151],[72154,72155],[72160,72160],[72193,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],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[94180,94180],[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],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],L.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,94180],[94192,94193],[94208,101589],[101632,101640],[110592,110895],[110928,110930],[110948,110951],[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],[128725,128727],[128747,128748],[128756,128764],[128992,129003],[129292,129338],[129340,129349],[129351,129400],[129402,129483],[129485,129535],[129648,129652],[129656,129658],[129664,129670],[129680,129704],[129712,129718],[129728,129730],[129744,129750],[131072,196605],[196608,262141],[917760,917999],[983040,1048573],[1048576,1114109]],L.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,94180],[94192,94193],[94208,101589],[101632,101640],[110592,110895],[110928,110930],[110948,110951],[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],[128725,128727],[128747,128748],[128756,128764],[128992,129003],[129292,129338],[129340,129349],[129351,129400],[129402,129483],[129485,129535],[129648,129652],[129656,129658],[129664,129670],[129680,129704],[129712,129718],[129728,129730],[129744,129750],[131072,196605],[196608,262141]],L.wc.binaryTableSearch_=function(e,t){var r,o=0,n=t.length-1;if(et[n][1])return!1;for(;n>=o;)if(e>t[r=Math.floor((o+n)/2)][1])o=r+1;else{if(!(e=32?1:0==e?L.wc.nulWidth:L.wc.controlWidth:e<160?L.wc.controlWidth:L.wc.isSpace(e)?0:L.wc.binaryTableSearch_(e,L.wc.unambiguous)?2:1},L.wc.charWidthRegardAmbiguous=function(e){return L.wc.isCjkAmbiguous(e)?L.wc.cjkAmbiguousWidth:L.wc.charWidthDisregardAmbiguous(e)},L.wc.strWidth=function(e){for(var t,r=0,o=0;ot)break;i+=r<=65535?1:2}if(null!=r){for(o=i,n=0;or)break;o+=t<=65535?1:2}return e.substring(i,o)}return e.substr(i)},L.wc.substring=function(e,t,r){return L.wc.substr(e,t,r-t)},L.rtdep("lib.Storage");var U={windowType:null,os:null,zoomWarningMessage:"ZOOM != 100%",notifyCopyMessage:"✂",desktopNotificationTitle:"♪ %(title) ♪",testDeps:["hterm.AccessibilityReader.Tests","hterm.ScrollPort.Tests","hterm.Screen.Tests","hterm.Terminal.Tests","hterm.VT.Tests","hterm.VT.CannedTests"]};L.registerInit("hterm",(function(e){function t(t){U.os=t,e()}function r(){L.i18n.getAcceptLanguages(e=>{U.messageManager||(U.messageManager=new L.MessageManager(e)),L.f.getOs().then(t).catch(t)})}function o(e){U.windowType=e.type,r()}U.defaultStorage||(window.chrome&&chrome.storage&&chrome.storage.sync?U.defaultStorage=new L.Storage.Chrome(chrome.storage.sync):U.defaultStorage=new L.Storage.Local);var n=!1;if(window.chrome&&chrome.runtime&&chrome.runtime.getManifest){var i=chrome.runtime.getManifest();n=i.app&&i.app.background}n?setTimeout(o.bind(null,{type:"popup"}),0):window.chrome&&chrome.tabs?chrome.tabs.getCurrent((function(e){e&&window.chrome?chrome.windows.get(e.windowId,null,o):(U.windowType="normal",r())})):setTimeout(o.bind(null,{type:"normal"}),0)})),U.getClientSize=function(e){return e.getBoundingClientRect()},U.getClientWidth=function(e){return e.getBoundingClientRect().width},U.getClientHeight=function(e){return e.getBoundingClientRect().height},U.copySelectionToClipboard=function(e){try{e.execCommand("copy")}catch(e){}},U.pasteFromClipboard=function(e){try{return e.execCommand("paste")}catch(e){return!1}},U.msg=function(e,t=[],r){return U.messageManager.get("HTERM_"+e,t,r)},U.notify=function(e){var t=(e,t)=>void 0!==e?e:t;null==e&&(e={});var r={body:e.body,icon:t(e.icon,L.resource.getDataUrl("hterm/images/icon-96"))},o=t(e.title,window.document.title);o||(o="hterm"),o=L.f.replaceVars(U.desktopNotificationTitle,{title:o});var n=new Notification(o,r);return n.onclick=function(){window.focus(),this.close()},n},U.openUrl=function(e){if(window.chrome&&chrome.browser&&chrome.browser.openTab)chrome.browser.openTab({url:e});else{window.open(e,"_blank").focus()}},U.Size=function(e,t){this.width=e,this.height=t},U.Size.prototype.resize=function(e,t){this.width=e,this.height=t},U.Size.prototype.clone=function(){return new U.Size(this.width,this.height)},U.Size.prototype.setTo=function(e){this.width=e.width,this.height=e.height},U.Size.prototype.equals=function(e){return this.width==e.width&&this.height==e.height},U.Size.prototype.toString=function(){return"[hterm.Size: "+this.width+", "+this.height+"]"},U.RowCol=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},U.RowCol.prototype.move=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},U.RowCol.prototype.clone=function(){return new U.RowCol(this.row,this.column,this.overflow)},U.RowCol.prototype.setTo=function(e){this.row=e.row,this.column=e.column,this.overflow=e.overflow},U.RowCol.prototype.equals=function(e){return this.row==e.row&&this.column==e.column&&this.overflow==e.overflow},U.RowCol.prototype.toString=function(){return"[hterm.RowCol: "+this.row+", "+this.column+", "+this.overflow+"]"},U.AccessibilityReader=function(e){this.document_=e.ownerDocument;const t=this.document_.createElement("div");t.id="hterm:accessibility-live-region",t.style.cssText="position: absolute;\n width: 0; height: 0;\n overflow: hidden;\n left: 0; top: 0;",e.appendChild(t),this.accessibilityEnabled=!1,this.liveElement_=this.document_.createElement("p"),this.liveElement_.setAttribute("aria-live","polite"),this.liveElement_.setAttribute("aria-label",""),t.appendChild(this.liveElement_),this.assertiveLiveElement_=this.document_.createElement("p"),this.assertiveLiveElement_.setAttribute("aria-live","assertive"),this.assertiveLiveElement_.setAttribute("aria-label",""),t.appendChild(this.assertiveLiveElement_),this.queue_=[],this.nextReadTimer_=null,this.cursorIsChanging_=!1,this.cursorChangeQueue_=[],this.lastCursorRowString_=null,this.lastCursorRow_=null,this.lastCursorColumn_=null,this.hasUserGesture=!1},U.AccessibilityReader.DELAY=50,U.AccessibilityReader.prototype.setAccessibilityEnabled=function(e){e||this.clear(),this.accessibilityEnabled=e},U.AccessibilityReader.prototype.decorate=function(e){["keydown","keypress","keyup","textInput"].forEach(t=>{e.addEventListener(t,()=>{this.hasUserGesture=!0})})},U.AccessibilityReader.prototype.beforeCursorChange=function(e,t,r){this.accessibilityEnabled&&this.hasUserGesture&&!this.cursorIsChanging_&&(this.cursorIsChanging_=!0,this.lastCursorRowString_=e,this.lastCursorRow_=t,this.lastCursorColumn_=r)},U.AccessibilityReader.prototype.afterCursorChange=function(e,t,r){if(this.cursorIsChanging_){if(this.cursorIsChanging_=!1,!this.announceAction_(e,t,r))for(let e=0;e0)this.queue_.push("");else{if(0==this.queue_.length)this.queue_.push(e);else{let t="";0!=this.queue_[this.queue_.length-1].length&&(t=" "),this.queue_[this.queue_.length-1]+=t+e}if(!this.nextReadTimer_){if(1!=this.queue_.length)throw new Error("Expected only one item in queue_ or nextReadTimer_ to be running.");this.nextReadTimer_=setTimeout(this.addToLiveRegion_.bind(this),U.AccessibilityReader.DELAY)}}},U.AccessibilityReader.prototype.assertiveAnnounce=function(e){this.hasUserGesture&&" "==e&&(e=U.msg("SPACE_CHARACTER",[],"Space")),(e=e.trim())==this.assertiveLiveElement_.getAttribute("aria-label")&&(e="\n"+e),this.clear(),this.assertiveLiveElement_.setAttribute("aria-label",e)},U.AccessibilityReader.prototype.newLine=function(){this.announce("\n")},U.AccessibilityReader.prototype.clear=function(){this.liveElement_.setAttribute("aria-label",""),this.assertiveLiveElement_.setAttribute("aria-label",""),clearTimeout(this.nextReadTimer_),this.nextReadTimer_=null,this.queue_=[],this.cursorIsChanging_=!1,this.cursorChangeQueue_=[],this.lastCursorRowString_=null,this.lastCursorRow_=null,this.lastCursorColumn_=null,this.hasUserGesture=!1},U.AccessibilityReader.prototype.announceAction_=function(e,t,r){if(this.lastCursorRow_!=t)return!1;if(this.lastCursorRowString_==e){if(this.lastCursorColumn_!=r&&""==this.cursorChangeQueue_.join("").trim()){const e=Math.min(this.lastCursorColumn_,r),t=Math.abs(r-this.lastCursorColumn_);return this.assertiveAnnounce(L.wc.substr(this.lastCursorRowString_,e,t)),!0}return!1}if(this.lastCursorRowString_!=e){if(this.lastCursorColumn_+1==r&&" "==L.wc.substr(e,r-1,1)&&this.cursorChangeQueue_.length>0&&" "==this.cursorChangeQueue_[0])return this.assertiveAnnounce(" "),!0;const t=r;if(L.wc.strWidth(e)<=L.wc.strWidth(this.lastCursorRowString_)&&L.wc.substr(this.lastCursorRowString_,0,t)==L.wc.substr(e,0,t)){let r=L.wc.strWidth(e);for(;r>0&&(r!=t&&" "==L.wc.substr(e,r-1,1));--r);const o=L.wc.strWidth(this.lastCursorRowString_)-r,n=r-t;if(L.wc.substr(this.lastCursorRowString_,t+o,n)==L.wc.substr(e,t,n)){const e=L.wc.substr(this.lastCursorRowString_,t,o);if(""!=e)return this.assertiveAnnounce(e),!0}}return!1}return!1},U.AccessibilityReader.prototype.addToLiveRegion_=function(){this.nextReadTimer_=null;let e=this.queue_.join("\n").trim();e==this.liveElement_.getAttribute("aria-label")&&(e="\n"+e),this.liveElement_.setAttribute("aria-label",e),this.queue_=[]},L.rtdep("hterm.Keyboard.KeyMap"),U.Keyboard=function(e){this.terminal=e,this.keyboardElement_=null,this.handlers_=[],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},U.Keyboard.KeyActions={CANCEL:L.f.createEnum("CANCEL"),DEFAULT:L.f.createEnum("DEFAULT"),PASS:L.f.createEnum("PASS"),STRIP:L.f.createEnum("STRIP")},U.Keyboard.prototype.encode=function(e){return"utf-8"==this.characterEncoding?this.terminal.vt.encodeUTF8(e):e},U.Keyboard.prototype.installKeyboard=function(e){if(e!=this.keyboardElement_){e&&this.keyboardElement_&&this.installKeyboard(null);for(var t=0;t{this.definePreference(e,t.default)})},U.PreferenceManager.prefix_="/hterm/profiles/",U.PreferenceManager.listProfiles=function(e){U.defaultStorage.getItems(null,t=>{const r={};for(let e of Object.keys(t))if(e.startsWith(U.PreferenceManager.prefix_)){r[e.slice(U.PreferenceManager.prefix_.length).split("/",1)[0]]=!0}e(Object.keys(r))})},U.PreferenceManager.categories={},U.PreferenceManager.categories.Keyboard="Keyboard",U.PreferenceManager.categories.Appearance="Appearance",U.PreferenceManager.categories.CopyPaste="CopyPaste",U.PreferenceManager.categories.Sounds="Sounds",U.PreferenceManager.categories.Scrolling="Scrolling",U.PreferenceManager.categories.Encoding="Encoding",U.PreferenceManager.categories.Extensions="Extensions",U.PreferenceManager.categories.Miscellaneous="Miscellaneous",U.PreferenceManager.categoryDefinitions=[{id:U.PreferenceManager.categories.Appearance,text:"Appearance (fonts, colors, images)"},{id:U.PreferenceManager.categories.CopyPaste,text:"Copy & Paste"},{id:U.PreferenceManager.categories.Encoding,text:"Encoding"},{id:U.PreferenceManager.categories.Keyboard,text:"Keyboard"},{id:U.PreferenceManager.categories.Scrolling,text:"Scrolling"},{id:U.PreferenceManager.categories.Sounds,text:"Sounds"},{id:U.PreferenceManager.categories.Extensions,text:"Extensions"},{id:U.PreferenceManager.categories.Miscellaneous,text:"Miscellaneous"}],U.PreferenceManager.definePref_=function(e,t,r,o){return{category:e,default:t,type:r,help:o}},U.PreferenceManager.defaultPreferences={"alt-gr-mode":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,[null,"none","ctrl-alt","left-alt","right-alt"],"Select an AltGr detection heuristic.\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."),"alt-backspace-is-meta-backspace":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","Whether the Alt key acts as a Meta key or as a distinct Alt key."),"alt-sends-what":U.PreferenceManager.definePref_(U.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 typed 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 browser\n performs a default action for some Alt sequences.)"),"audible-bell-sound":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Sounds,"lib-resource:hterm/audio/bell","url","URL of the terminal bell sound. Empty string for no audible bell."),"desktop-notification-bell":U.PreferenceManager.definePref_(U.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. Browsers may not show this permission request if it was not triggered by a user action.\n\nChrome extensions with the "notifications" permission have permission to display notifications.'),"background-color":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"rgb(16, 16, 16)","color","The background color for text with no other color attributes."),"background-image":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","string","CSS value of the background image size."),"background-position":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","string","CSS value of the background image position.\n\nFor example:\n 10% 10%\n center"),"backspace-sends-backspace":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,!0,"bool","Whether to close the window when the command finishes executing."),"cursor-blink":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,!1,"bool","Whether the text cursor blinks by default. This can be toggled at runtime via terminal escape sequences."),"cursor-blink-cycle":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,[1e3,500],"value","The text cursor blink rate in milliseconds.\n\nA two element array, the first of which is how long the text cursor should be on, second is how long it should be off."),"cursor-color":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"rgba(255, 0, 0, 0.5)","color","The color of the visible text cursor."),"color-palette-overrides":U.PreferenceManager.definePref_(U.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 standard 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.\n\nFor example, these both set color index 1 to blue:\n {1: "#0000ff"}\n [null, "#0000ff"]'),"copy-on-select":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Automatically copy mouse selection to the clipboard."),"use-default-window-copy":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!1,"bool","Whether to use the default browser/OS's copy behavior.\n\nAllow the browser/OS to handle the copy event directly which might improve compatibility with some systems (where copying doesn't work at all), but makes the text selection less robust.\n\nFor example, long lines that were automatically line wrapped will be copied with the newlines still in them."),"clear-selection-after-copy":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Whether to clear the selection after copying."),"ctrl-plus-minus-zero-zoom":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","Whether East Asian Ambiguous characters have two column width."),"enable-8-bit-control":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,null,"tristate","If true, 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,!0,"bool","If true, use bright colors (8-15 on a 16 color palette) for any text with the bold attribute. False otherwise."),"enable-blink":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,!0,"bool","If true, respect the blink attribute. False to ignore it."),"enable-clipboard-notice":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Whether to show a message in the terminal when the host writes to the clipboard."),"enable-clipboard-write":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Allow the remote host to write directly to the local system clipboard.\nRead access is never granted regardless of this setting.\n\nThis is used to control access to features like OSC-52."),"enable-dec12":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,!1,"bool","Respect the host's attempt to change the text cursor blink status using DEC Private Mode 12."),"enable-csi-j-3":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,!0,"bool","Whether CSI-J (Erase Display) mode 3 may clear the terminal scrollback buffer.\n\nEnabling this by default is safe."),environment:U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,{NCURSES_NO_UTF8_ACS:"1",TERM:"xterm-256color",COLORTERM:"truecolor"},"value","The initial set of environment variables, as an object."),"font-family":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,'"DejaVu Sans Mono", "Noto Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace',"string","Default font family for the terminal text."),"font-size":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,15,"int","The default font size in pixels."),"font-smoothing":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"antialiased","string","CSS font-smoothing property."),"foreground-color":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"rgb(240, 240, 240)","color","The foreground color for text with no other color attributes."),"hide-mouse-while-typing":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether to automatically hide the mouse cursor when typing. By default, autodetect whether the platform/OS handles this.\n\nNote: Some operating systems may override this setting and thus you might not be able to always disable it."),"home-keys-scroll":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","If true, Home/End controls the terminal scrollbar and Shift-Home/Shift-End are sent to the remote host. If false, then Home/End are sent to the remote host and Shift-Home/Shift-End scrolls."),keybindings:U.PreferenceManager.definePref_(U.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 as 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": "clearTerminal",\n "Ctrl-Shift-L": "PASS",\n "Ctrl-H": "\'Hello World\'"\n}'),"media-keys-are-fkeys":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!0,"bool","Send an ESC prefix when pressing a key while holding the Meta key.\n\nFor example, when enabled, pressing Meta-K will send ^[k as if you typed Escape then k. When disabled, only k will be sent."),"mouse-right-click-paste":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool",'Paste on right mouse button clicks.\n\nThis option is independent of the "mouse-paste-button" setting.\n\nNote: This will handle left & right handed mice correctly.'),"mouse-paste-button":U.PreferenceManager.definePref_(U.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 independent of the setting for right-click paste.\n\nNote: This will handle left & right handed mice correctly."),"word-break-match-left":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","If true, Page Up/Page Down controls the terminal scrollbar and Shift-Page Up/Shift-Page Down are sent to the remote host. If false, then Page Up/Page Down are sent to the remote host and Shift-Page Up/Shift-Page Down scrolls."),"pass-alt-number":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether Alt-1..9 is passed 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether Ctrl-1..9 is passed 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether Meta-1..9 is passed 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!0,"bool","Whether Meta-V gets passed to host."),"paste-on-drop":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","If true, Drag and dropped text will paste into terminal.\nIf false, dropped text will be ignored."),"receive-encoding":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the expected encoding for data received from the host.\nIf the encodings do not match, visual bugs are likely to be observed.\n\nValid values are 'utf-8' and 'raw'."),"scroll-on-keystroke":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,!0,"bool","Whether to scroll to the bottom on any keystroke."),"scroll-on-output":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,!1,"bool","Whether to scroll to the bottom on terminal output."),"scrollbar-visible":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,!0,"bool","The vertical scrollbar mode."),"scroll-wheel-may-send-arrow-keys":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,1,"int","The multiplier for scroll wheel events when measured in pixels.\n\nAlters how fast the page scrolls."),"send-encoding":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the encoding for data sent to host."),"terminal-encoding":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Encoding,"utf-8",["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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!0,"bool","Whether Shift-Insert is used for pasting or is sent to the remote host."),"user-css":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","url","URL of user stylesheet to include in the terminal document."),"user-css-text":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","multiline-string","Custom CSS text for styling the terminal."),"allow-images-inline":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Extensions,null,"tristate","Whether to allow the remote host to display images in the terminal.\n\nBy default, we prompt until a choice is made.")},U.PreferenceManager.prototype=Object.create(L.PreferenceManager.prototype),U.PreferenceManager.constructor=U.PreferenceManager,U.PubSub=function(){this.observers_={}},U.PubSub.addBehavior=function(e){var t=new U.PubSub;for(var r in U.PubSub.prototype)e[r]=U.PubSub.prototype[r].bind(t)},U.PubSub.prototype.subscribe=function(e,t){e in this.observers_||(this.observers_[e]=[]),this.observers_[e].push(t)},U.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)},U.PubSub.prototype.publish=function(e,t,r){var o=this.observers_[e];o&&(o=[].concat(o)),r&&(o?o.push(r):o=[r]),o&&setTimeout((function e(r){r=e&&this.setCursorPosition(this.cursorPosition.row,e-1)},U.Screen.prototype.shiftRow=function(){return this.shiftRows(1)[0]},U.Screen.prototype.shiftRows=function(e){return this.rowsArray.splice(0,e)},U.Screen.prototype.unshiftRow=function(e){this.rowsArray.splice(0,0,e)},U.Screen.prototype.unshiftRows=function(e){this.rowsArray.unshift.apply(this.rowsArray,e)},U.Screen.prototype.pushRow=function(e){this.rowsArray.push(e)},U.Screen.prototype.pushRows=function(e){e.push.apply(this.rowsArray,e)},U.Screen.prototype.insertRow=function(e,t){this.rowsArray.splice(e,0,t)},U.Screen.prototype.insertRows=function(e,t){for(var r=0;r=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=U.TextAttributes.nodeWidth(this.cursorNode_),this.cursorOffset_U.TextAttributes.nodeWidth(e);){if(!e.hasAttribute("line-overflow")||!e.nextSibling)return-1;t-=U.TextAttributes.nodeWidth(e),e=e.nextSibling}return this.getNodeAndOffsetWithinRow_(e,t)},U.Screen.prototype.getNodeAndOffsetWithinRow_=function(e,t){for(var r=0;ra)){var p=L.wc.substring(c,a,L.wc.strWidth(c)),f=new RegExp("^"+o+r),g=p.match(f);if(g){var m=a+L.wc.strWidth(g[0]);-1==m||m\"'\\^!@#$%&*,;:`]","[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:~.`]","[^\\s\\[\\](){}<>\"'\\^]*")},U.Screen.prototype.saveCursorAndState=function(e){this.cursorState_.save(e)},U.Screen.prototype.restoreCursorAndState=function(e){this.cursorState_.restore(e)},U.Screen.CursorState=function(e){this.screen_=e,this.cursor=null,this.textAttributes=null,this.GL=this.GR=this.G0=this.G1=this.G2=this.G3=null},U.Screen.CursorState.prototype.save=function(e){this.cursor=e.terminal.saveCursor(),this.textAttributes=this.screen_.textAttributes.clone(),this.GL=e.GL,this.GR=e.GR,this.G0=e.G0,this.G1=e.G1,this.G2=e.G2,this.G3=e.G3},U.Screen.CursorState.prototype.restore=function(e){e.terminal.restoreCursor(this.cursor);const t=this.textAttributes.clone();t.colorPalette=this.screen_.textAttributes.colorPalette,t.syncColors(),this.screen_.textAttributes=t,e.GL=this.GL,e.GR=this.GR,e.G0=this.G0,e.G1=this.G1,e.G2=this.G2,e.G3=this.G3},L.rtdep("lib.f","hterm.PubSub","hterm.Size"),U.ScrollPort=function(e){U.PubSub.addBehavior(this),this.rowProvider_=e,this.characterSize=new U.Size(10,10),this.ruler_=null,this.selection=new U.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.pasteOnDrop=!0,this.div_=null,this.document_=null,this.timeouts_={},this.observers_={},this.DEBUG_=!1},U.ScrollPort.Selection=function(e){this.scrollPort_=e,this.startRow=null,this.endRow=null,this.isMultiline=null,this.isCollapsed=null},U.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},U.ScrollPort.prototype.setAccessibilityReader=function(e){this.accessibilityReader_=e},U.ScrollPort.prototype.scrollPageUp=function(){if(0==this.getTopRowIndex())return;const e=this.getTopRowIndex();this.scrollRowToTop(e-this.visibleRowCount+1),this.assertiveAnnounce_()},U.ScrollPort.prototype.scrollPageDown=function(){if(this.isScrolledEnd)return;const e=this.getTopRowIndex();this.scrollRowToTop(e+this.visibleRowCount-1),this.assertiveAnnounce_()},U.ScrollPort.prototype.setFontFamily=function(e,t){this.screen_.style.fontFamily=e,this.screen_.style.webkitFontSmoothing=t||"",this.syncCharacterSize()},U.ScrollPort.prototype.getFontFamily=function(){return this.screen_.style.fontFamily},U.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_)},U.ScrollPort.prototype.setUserCssText=function(e){this.userCssText_.textContent=e},U.ScrollPort.prototype.focus=function(){this.iframe_.focus(),this.screen_.focus(),this.publish("focus")},U.ScrollPort.prototype.getForegroundColor=function(){return this.screen_.style.color},U.ScrollPort.prototype.setForegroundColor=function(e){this.screen_.style.color=e,this.scrollUpButton_.style.backgroundColor=e,this.scrollDownButton_.style.backgroundColor=e},U.ScrollPort.prototype.getBackgroundColor=function(){return this.screen_.style.backgroundColor},U.ScrollPort.prototype.setBackgroundColor=function(e){this.screen_.style.backgroundColor=e,this.scrollUpButton_.style.color=e,this.scrollDownButton_.style.color=e},U.ScrollPort.prototype.setBackgroundImage=function(e){this.screen_.style.backgroundImage=e},U.ScrollPort.prototype.setBackgroundSize=function(e){this.screen_.style.backgroundSize=e},U.ScrollPort.prototype.setBackgroundPosition=function(e){this.screen_.style.backgroundPosition=e},U.ScrollPort.prototype.setCtrlVPaste=function(e){this.ctrlVPaste=e},U.ScrollPort.prototype.setPasteOnDrop=function(e){this.pasteOnDrop=e},U.ScrollPort.prototype.getScreenSize=function(){var e=U.getClientSize(this.screen_);return{height:e.height,width:e.width-this.currentScrollbarWidthPx}},U.ScrollPort.prototype.getScreenWidth=function(){return this.getScreenSize().width},U.ScrollPort.prototype.getScreenHeight=function(){return this.getScreenSize().height},U.ScrollPort.prototype.getDocument=function(){return this.document_},U.ScrollPort.prototype.getScreenNode=function(){return this.screen_},U.ScrollPort.prototype.resetCache=function(){this.currentRowNodeCache_=null,this.previousRowNodeCache_={}},U.ScrollPort.prototype.setRowProvider=function(e){this.resetCache(),this.rowProvider_=e,this.scheduleRedraw()},U.ScrollPort.prototype.setFontSize=function(e){this.screen_.style.fontSize=e+"px",this.syncCharacterSize()},U.ScrollPort.prototype.getFontSize=function(){return parseInt(this.screen_.style.fontSize)},U.ScrollPort.prototype.syncCharacterSize=function(){this.characterSize=this.measureCharacterSize(),this.resize()},U.ScrollPort.prototype.assertiveAnnounce_=function(){if(!this.accessibilityReader_)return;const e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);let r=100*e/Math.max(1,this.rowProvider_.getRowCount()-this.visibleRowCount);r=Math.min(100,Math.round(r));let o=U.msg("ANNOUNCE_CURRENT_SCREEN_HEADER",[r],"$1% scrolled,");o+="\n";for(let r=e;r<=t;++r){o+=this.fetchRowNode_(r).textContent+"\n"}this.accessibilityReader_.assertiveAnnounce(o)},U.ScrollPort.prototype.syncScrollHeight=function(){this.lastRowCount_=this.rowProvider_.getRowCount(),this.scrollArea_.style.height=this.characterSize.height*this.lastRowCount_+this.visibleRowTopMargin+this.visibleRowBottomMargin+"px"},U.ScrollPort.prototype.scheduleRedraw=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout((function(){delete e.timeouts_.redraw,e.redraw_()}),0)}},U.ScrollPort.prototype.updateScrollButtonState_=function(){const e=(e,t)=>{e.setAttribute("aria-disabled",t?"true":"false"),e.style.opacity=t?.5:1};e(this.scrollUpButton_,0==this.getTopRowIndex()),e(this.scrollDownButton_,this.isScrolledEnd)},U.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)}},U.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)}},U.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_))},U.ScrollPort.prototype.cacheRowNode_=function(e){this.currentRowNodeCache_[e.rowIndex]=e},U.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},U.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()},U.ScrollPort.prototype.getScrollMax_=function(e){return U.getClientHeight(this.scrollArea_)+this.visibleRowTopMargin+this.visibleRowBottomMargin-U.getClientHeight(this.screen_)},U.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())},U.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)},U.ScrollPort.prototype.getTopRowIndex=function(){return Math.round(this.screen_.scrollTop/this.characterSize.height)},U.ScrollPort.prototype.getBottomRowIndex=function(e){return e+this.visibleRowCount-1},U.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()},U.ScrollPort.prototype.onScrollWheel=function(e){},U.ScrollPort.prototype.onScrollWheel_=function(e){if(this.onScrollWheel(e),e.defaultPrevented)return;const t=this.scrollWheelDelta(e);let r=this.screen_.scrollTop-t.y;r<0&&(r=0);var o=this.getScrollMax_();r>o&&(r=o),r!=this.screen_.scrollTop&&(this.screen_.scrollTop=r,e.preventDefault())},U.ScrollPort.prototype.scrollWheelDelta=function(e){const t={x:0,y:0};switch(e.deltaMode){case WheelEvent.DOM_DELTA_PIXEL:t.x=e.deltaX*this.scrollWheelMultiplier_,t.y=e.deltaY*this.scrollWheelMultiplier_;break;case WheelEvent.DOM_DELTA_LINE:t.x=e.deltaX*this.characterSize.width,t.y=e.deltaY*this.characterSize.height;break;case WheelEvent.DOM_DELTA_PAGE:t.x=e.deltaX*this.characterSize.width*this.screen_.getWidth(),t.y=e.deltaY*this.characterSize.height*this.screen_.getHeight()}return t.y*=-1,t},U.ScrollPort.prototype.onTouch=function(e){},U.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;ts&&(i=s),i!=this.screen_.scrollTop&&(this.screen_.scrollTop=i)}e.preventDefault()}},U.ScrollPort.prototype.onResize_=function(e){this.syncCharacterSize()},U.ScrollPort.prototype.onCopy=function(e){},U.ScrollPort.prototype.onCopy_=function(e){if(this.onCopy(e),!(e.defaultPrevented||(this.resetSelectBags_(),this.selection.sync(),this.selection.isCollapsed||this.selection.endRow.rowIndex-this.selection.startRow.rowIndex<2))){var t,r,o=this.getTopRowIndex(),n=this.getBottomRowIndex(o);if(this.selection.startRow.rowIndexn)r=this.selection.startRow.rowIndex>n?this.selection.startRow.rowIndex+1:this.bottomFold_.previousSibling.rowIndex+1,this.bottomSelectBag_.textContent=this.rowProvider_.getRowsText(r,this.selection.endRow.rowIndex),this.rowNodes_.insertBefore(this.bottomSelectBag_,this.selection.endRow)}},U.ScrollPort.prototype.onBodyKeyDown_=function(e){this.ctrlVPaste&&(e.ctrlKey||e.metaKey)&&118==e.keyCode&&this.pasteTarget_.focus()},U.ScrollPort.prototype.onPaste_=function(e){this.pasteTarget_.focus();var t=this;setTimeout((function(){t.publish("paste",{text:t.pasteTarget_.value}),t.pasteTarget_.value="",t.focus()}),0)},U.ScrollPort.prototype.handlePasteTargetTextInput_=function(e){e.stopPropagation()},U.ScrollPort.prototype.onDragAndDrop_=function(e){if(!this.pasteOnDrop)return;let t,r;e.preventDefault(),e.shiftKey&&(e.dataTransfer.types.forEach(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})},U.ScrollPort.prototype.setScrollbarVisible=function(e){this.screen_.style.overflowY=e?"scroll":"hidden"},U.ScrollPort.prototype.setScrollWheelMoveMultipler=function(e){this.scrollWheelMultiplier_=e},L.rtdep("lib.colors","lib.PreferenceManager","lib.resource","lib.wc","lib.f","hterm.AccessibilityReader","hterm.Keyboard","hterm.Options","hterm.PreferenceManager","hterm.Screen","hterm.ScrollPort","hterm.Size","hterm.TextAttributes","hterm.VT"),U.Terminal=function(e){this.profileId_=null,this.primaryScreen_=new U.Screen,this.alternateScreen_=new U.Screen,this.screen_=this.primaryScreen_,this.screenSize=new U.Size(0,0),this.scrollPort_=new U.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_.subscribe("focus",this.onScrollportFocus_.bind(this)),this.scrollPort_.onCopy=this.onCopy_.bind(this),this.div_=null,this.document_=window.document,this.primaryScrollbackRows_=[],this.alternateScrollbackRows_=[],this.scrollbackRows_=this.primaryScrollbackRows_,this.tabStops_=[],this.defaultTabStops=!0,this.vtScrollTop_=null,this.vtScrollBottom_=null,this.cursorNode_=null,this.cursorShape_=U.Terminal.cursorShape.BLOCK,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.setAutomaticMouseHiding(),this.mouseHideDelay_=null,this.bellAudio_=this.document_.createElement("audio"),this.bellAudio_.id="hterm:bell-audio",this.bellAudio_.setAttribute("preload","auto"),this.accessibilityReader_=null,this.bellNotificationList_=[],this.desktopNotificationBell_=!1,this.savedOptions_={},this.options_=new U.Options,this.timeouts_={},this.vt=new U.VT(this),this.saveCursorAndState(!0),this.keyboard=new U.Keyboard(this),this.io=new U.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.allowImagesInline=null,this.reportFocus=!1,this.setProfile(e||"default",function(){this.onTerminalReady()}.bind(this))},U.Terminal.cursorShape={BLOCK:"BLOCK",BEAM:"BEAM",UNDERLINE:"UNDERLINE"},U.Terminal.prototype.onTerminalReady=function(){},U.Terminal.prototype.tabWidth=8,U.Terminal.prototype.setProfile=function(e,t){this.profileId_=e.replace(/\//g,"");var r=this;this.prefs_&&this.prefs_.deactivate(),this.prefs_=new U.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",L.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(L.colors.colorPalette=L.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 n=L.colors.normalizeCSS(e[o]);n&&(L.colors.colorPalette[o]=n)}}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)},"paste-on-drop":function(e){r.scrollPort_.setPasteOnDrop(e)},"east-asian-ambiguous-as-two-column":function(e){L.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.setTextBlink(!!e)},"enable-clipboard-write":function(e){r.vt.enableClipboardWrite=!!e},"enable-dec12":function(e){r.vt.enableDec12=!!e},"enable-csi-j-3":function(e){r.vt.enableCsiJ3=!!e},"font-family":function(e){r.syncFontFamily()},"font-size":function(e){(e=parseInt(e))<=0?console.error(`Invalid font size: ${e}`):r.setFontSize(e)},"font-smoothing":function(e){r.syncFontFamily()},"foreground-color":function(e){r.setForegroundColor(e)},"hide-mouse-while-typing":function(e){r.setAutomaticMouseHiding(e)},"home-keys-scroll":function(e){r.keyboard.homeKeysScroll=e},keybindings:function(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="mac"!=U.os&&"popup"!=U.windowType),r.passAltNumber=e},"pass-ctrl-number":function(e){null==e&&(e="mac"!=U.os&&"popup"!=U.windowType),r.passCtrlNumber=e},"pass-meta-number":function(e){null==e&&(e="mac"==U.os&&"popup"!=U.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},"allow-images-inline":function(e){r.allowImagesInline=e}}),this.prefs_.readStorage(function(){this.prefs_.notifyAll(),t&&t()}.bind(this))},U.Terminal.prototype.getPrefs=function(){return this.prefs_},U.Terminal.prototype.setBracketedPaste=function(e){this.options_.bracketedPaste=e},U.Terminal.prototype.setCursorColor=function(e){void 0===e&&(e=this.prefs_.get("cursor-color")),this.setCssVar("cursor-color",e)},U.Terminal.prototype.getCursorColor=function(){return this.getCssVar("cursor-color")},U.Terminal.prototype.setSelectionEnabled=function(e){this.enableMouseDragScroll=e},U.Terminal.prototype.setBackgroundColor=function(e){void 0===e&&(e=this.prefs_.get("background-color")),this.backgroundColor_=L.colors.normalizeCSS(e),this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.scrollPort_.setBackgroundColor(e)},U.Terminal.prototype.getBackgroundColor=function(){return this.backgroundColor_},U.Terminal.prototype.setForegroundColor=function(e){void 0===e&&(e=this.prefs_.get("foreground-color")),this.foregroundColor_=L.colors.normalizeCSS(e),this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.scrollPort_.setForegroundColor(e)},U.Terminal.prototype.getForegroundColor=function(){return this.foregroundColor_},U.Terminal.prototype.runCommandClass=function(e,t){var r=this.prefs_.get("environment");"object"==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()},U.Terminal.prototype.isPrimaryScreen=function(){return this.screen_==this.primaryScreen_},U.Terminal.prototype.installKeyboard=function(){this.keyboard.installKeyboard(this.scrollPort_.getDocument().body)},U.Terminal.prototype.uninstallKeyboard=function(){this.keyboard.installKeyboard(null)},U.Terminal.prototype.setCssVar=function(e,t,r="--hterm-"){this.document_.documentElement.style.setProperty(`${r}${e}`,t)},U.Terminal.prototype.getCssVar=function(e,t="--hterm-"){return this.document_.documentElement.style.getPropertyValue(`${t}${e}`)},U.Terminal.prototype.setFontSize=function(e){e<=0&&(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")},U.Terminal.prototype.getFontSize=function(){return this.scrollPort_.getFontSize()},U.Terminal.prototype.getFontFamily=function(){return this.scrollPort_.getFontFamily()},U.Terminal.prototype.syncFontFamily=function(){this.scrollPort_.setFontFamily(this.prefs_.get("font-family"),this.prefs_.get("font-smoothing")),this.syncBoldSafeState()},U.Terminal.prototype.syncMousePasteButton=function(){var e=this.prefs_.get("mouse-paste-button");"number"!=typeof e?"linux"!=U.os?this.mousePasteButton=1:this.mousePasteButton=2:this.mousePasteButton=e},U.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},U.Terminal.prototype.setTextBlink=function(e){void 0===e&&(e=this.prefs_.get("enable-blink")),this.setCssVar("blink-node-duration",e?"0.7s":"0")},U.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)")},U.Terminal.prototype.saveCursor=function(){return this.screen_.cursorPosition.clone()},U.Terminal.prototype.getTextAttributes=function(){return this.screen_.textAttributes},U.Terminal.prototype.setTextAttributes=function(e){this.screen_.textAttributes=e},U.Terminal.prototype.getZoomFactor=function(){return this.scrollPort_.characterSize.zoomFactor},U.Terminal.prototype.setWindowTitle=function(e){window.document.title=e},U.Terminal.prototype.restoreCursor=function(e){var t=L.f.clamp(e.row,0,this.screenSize.height-1),r=L.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)},U.Terminal.prototype.clearCursorOverflow=function(){this.screen_.cursorPosition.overflow=!1},U.Terminal.prototype.saveCursorAndState=function(e){e?(this.primaryScreen_.saveCursorAndState(this.vt),this.alternateScreen_.saveCursorAndState(this.vt)):this.screen_.saveCursorAndState(this.vt)},U.Terminal.prototype.restoreCursorAndState=function(e){e?(this.primaryScreen_.restoreCursorAndState(this.vt),this.alternateScreen_.restoreCursorAndState(this.vt)):this.screen_.restoreCursorAndState(this.vt)},U.Terminal.prototype.setCursorShape=function(e){this.cursorShape_=e,this.restyleCursor_()},U.Terminal.prototype.getCursorShape=function(){return this.cursorShape_},U.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%"},U.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%"},U.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)},U.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]0){if(t<=this.scrollbackRows_.length){var i=Math.min(t,this.scrollbackRows_.length),s=this.scrollbackRows_.splice(this.scrollbackRows_.length-i,i);this.screen_.unshiftRows(s),t-=i,r.row+=i}t&&this.appendRows_(t)}this.setVTScrollRegion(null,null),this.restoreCursor(r)},U.Terminal.prototype.scrollHome=function(){this.scrollPort_.scrollRowToTop(0)},U.Terminal.prototype.scrollEnd=function(){this.scrollPort_.scrollRowToBottom(this.getRowCount())},U.Terminal.prototype.scrollPageUp=function(){this.scrollPort_.scrollPageUp()},U.Terminal.prototype.scrollPageDown=function(){this.scrollPort_.scrollPageDown()},U.Terminal.prototype.scrollLineUp=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e-1)},U.Terminal.prototype.scrollLineDown=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e+1)},U.Terminal.prototype.wipeContents=function(){this.clearHome(this.primaryScreen_),this.clearHome(this.alternateScreen_),this.clearScrollback()},U.Terminal.prototype.clearScrollback=function(){this.scrollEnd(),this.scrollbackRows_.length=0,this.primaryScrollbackRows_.length=0,this.alternateScrollbackRows_.length=0,this.scrollPort_.resetCache(),[this.primaryScreen_,this.alternateScreen_].forEach(e=>{const t=e.getHeight();this.renumberRows_(0,t,e)}),this.syncCursorPosition_(),this.scrollPort_.invalidate()},U.Terminal.prototype.reset=function(){this.vt.reset(),this.clearAllTabStops(),this.setDefaultTabStops();const e=e=>{e.textAttributes.reset(),e.textAttributes.resetColorPalette(),this.clearHome(e),e.saveCursorAndState(this.vt)};e(this.primaryScreen_),e(this.alternateScreen_),this.options_=new U.Options,this.setCursorBlink(!!this.prefs_.get("cursor-blink")),this.setVTScrollRegion(null,null),this.setCursorVisible(!0)},U.Terminal.prototype.softReset=function(){this.vt.reset(),this.options_=new U.Options,this.options_.cursorBlink=!!this.timeouts_.cursorBlink;const e=e=>{e.textAttributes.reset(),e.textAttributes.resetColorPalette(),e.saveCursorAndState(this.vt)};e(this.primaryScreen_),e(this.alternateScreen_),this.setVTScrollRegion(null,null),this.setCursorVisible(!0)},U.Terminal.prototype.forwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=0;te)return void this.setCursorColumn(this.tabStops_[t]);var r=this.screen_.cursorPosition.overflow;this.setCursorColumn(this.screenSize.width-1),this.screen_.cursorPosition.overflow=r},U.Terminal.prototype.backwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=this.tabStops_.length-1;t>=0;t--)if(this.tabStops_[t]=0;t--){if(this.tabStops_[t]==e)return;if(this.tabStops_[t] to your HTML to fix."),this.div_=e,this.accessibilityReader_=new U.AccessibilityReader(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.scrollPort_.setAccessibilityReader(this.accessibilityReader_),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.accessibilityReader_.decorate(this.document_);var r=this.onMouse_.bind(this),o=this.scrollPort_.getScreenNode();o.addEventListener("mousedown",r),o.addEventListener("mouseup",r),o.addEventListener("mousemove",r),this.scrollPort_.onScrollWheel=r,o.addEventListener("keydown",this.onKeyboardActivity_.bind(this)),o.addEventListener("focus",this.onFocusChange_.bind(this,!0)),o.addEventListener("mousedown",function(){setTimeout(this.onFocusChange_.bind(this,!0))}.bind(this)),o.addEventListener("blur",this.onFocusChange_.bind(this,!1));var n=this.document_.createElement("style");n.textContent='.cursor-node[focus="false"] { box-sizing: border-box; background-color: transparent !important; border-width: 2px; border-style: solid;}menu { margin: 0; padding: 0; cursor: var(--hterm-mouse-cursor-pointer);}menuitem { white-space: nowrap; border-bottom: 1px dashed; display: block; padding: 0.3em 0.3em 0 0.3em;}menuitem.separator { border-bottom: none; height: 0.5em; padding: 0;}menuitem:hover { color: var(--hterm-cursor-color);}.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);}.uri-node:hover { text-decoration: underline; cursor: var(--hterm-mouse-cursor-pointer), pointer;}@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.insertBefore(n,this.document_.head.firstChild),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: "+(this.options_.cursorVisible?"":"none")+";width: var(--hterm-charsize-width);height: var(--hterm-charsize-height);background-color: var(--hterm-cursor-color);border-color: var(--hterm-cursor-color);-webkit-transition: opacity, background-color 100ms linear;-moz-transition: opacity, background-color 100ms linear;",this.setCursorColor(),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_.setAttribute("aria-hidden","true"),this.scrollBlockerNode_.style.cssText="position: absolute;top: -99px;display: block;width: 10px;height: 10px;",this.document_.body.appendChild(this.scrollBlockerNode_),this.scrollPort_.onScrollWheel=r,["mousedown","mouseup","mousemove","click","dblclick"].forEach(function(e){this.scrollBlockerNode_.addEventListener(e,r),this.cursorNode_.addEventListener(e,r),this.document_.addEventListener(e,r)}.bind(this)),this.cursorNode_.addEventListener("mousedown",function(){setTimeout(this.focus.bind(this))}.bind(this)),this.setReverseVideo(!1),this.scrollPort_.focus(),this.scrollPort_.scheduleRedraw()},U.Terminal.prototype.getDocument=function(){return this.document_},U.Terminal.prototype.focus=function(){this.scrollPort_.focus()},U.Terminal.prototype.getRowNode=function(e){if(e=this.screenSize.width&&(i=!0,n=this.screenSize.width-this.screen_.cursorPosition.column),i&&!this.options_.wraparound?(o=L.wc.substr(e,t,n-1)+L.wc.substr(e,r-1),n=r):o=L.wc.substr(e,t,n);for(var s=U.TextAttributes.splitWidecharString(o),a=0;at)return this.setCssVar("cursor-offset-row","-1"),!1;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 n=this.document_.getSelection();return n&&(n.isCollapsed||o)&&this.screen_.syncSelectionCaret(n),!0},U.Terminal.prototype.restyleCursor_=function(){var e=this.cursorShape_;"false"==this.cursorNode_.getAttribute("focus")&&(e=U.Terminal.cursorShape.BLOCK);var t=this.cursorNode_.style;switch(e){case U.Terminal.cursorShape.BEAM:t.height="var(--hterm-charsize-height)",t.backgroundColor="transparent",t.borderBottomStyle=null,t.borderLeftStyle="solid";break;case U.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="var(--hterm-cursor-color)",t.borderBottomStyle=null,t.borderLeftStyle=null}},U.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=L.MessageManager.replaceReferences(U.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_)},U.Terminal.prototype.showOverlay=function(e,t){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 r=U.getClientSize(this.div_),o=U.getClientSize(this.overlayNode_);this.overlayNode_.style.top=(r.height-o.height)/2+"px",this.overlayNode_.style.left=(r.width-o.width-this.scrollPort_.currentScrollbarWidthPx)/2+"px",this.overlayTimeout_&&clearTimeout(this.overlayTimeout_),this.accessibilityReader_.assertiveAnnounce(e),null!==t&&(this.overlayTimeout_=setTimeout(()=>{this.overlayNode_.style.opacity="0",this.overlayTimeout_=setTimeout(()=>this.hideOverlay(),200)},t||1500))},U.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"},U.Terminal.prototype.paste=function(){return U.pasteFromClipboard(this.document_)},U.Terminal.prototype.copyStringToClipboard=function(e){this.prefs_.get("enable-clipboard-notice")&&setTimeout(this.showOverlay.bind(this,U.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,n=r.anchorOffset,i=r.focusNode,s=r.focusOffset;try{r.selectAllChildren(t)}catch(e){}U.copySelectionToClipboard(this.document_),r.extend&&(r.collapse(o,n),r.extend(i,s)),t.parentNode.removeChild(t)},U.Terminal.prototype.displayImage=function(e,t,r){if(void 0!==e.uri){if(e.name||(e.name=""),!0!==this.allowImagesInline){this.newLine();const e=this.getRowNode(this.scrollbackRows_.length+this.getCursorRow()-1);if(!1===this.allowImagesInline)return void(e.textContent=U.msg("POPUP_INLINE_IMAGE_DISABLED",[],"Inline Images Disabled"));let t;const r=this.document_.createElement("span");return r.innerText=U.msg("POPUP_INLINE_IMAGE",[],"Inline Images"),r.style.fontWeight="bold",r.style.borderWidth="1px",r.style.borderStyle="dashed",(t=this.document_.createElement("span")).innerText=U.msg("BUTTON_BLOCK",[],"block"),t.style.marginLeft="1em",t.style.borderWidth="1px",t.style.borderStyle="solid",t.addEventListener("click",()=>{this.prefs_.set("allow-images-inline",!1)}),r.appendChild(t),(t=this.document_.createElement("span")).innerText=U.msg("BUTTON_ALLOW_SESSION",[],"allow this session"),t.style.marginLeft="1em",t.style.borderWidth="1px",t.style.borderStyle="solid",t.addEventListener("click",()=>{this.allowImagesInline=!0}),r.appendChild(t),(t=this.document_.createElement("span")).innerText=U.msg("BUTTON_ALLOW_ALWAYS",[],"always allow"),t.style.marginLeft="1em",t.style.borderWidth="1px",t.style.borderStyle="solid",t.addEventListener("click",()=>{this.prefs_.set("allow-images-inline",!0)}),r.appendChild(t),void e.appendChild(r)}if(e.inline){const o=this.io.push();o.showOverlay(U.msg("LOADING_RESOURCE_START",[e.name],"Loading $1 ..."),null),o.onVTKeystroke=o.sendString=()=>{};const n=this.document_.createElement("img");n.src=e.uri,n.title=n.alt=e.name,this.document_.body.appendChild(n),n.onload=()=>{n.style.objectFit=e.preserveAspectRatio?"scale-down":"fill",n.style.maxWidth=`${this.document_.body.clientWidth}px`,n.style.maxHeight=`${this.document_.body.clientHeight}px`;const r=(e,t,r)=>{if(!e||"auto"==e)return"";const o=e.match(/^([0-9]+)(px|%)?$/);return o?"%"==o[2]?t*parseInt(o[1])/100+"px":"px"==o[2]?e:`calc(${e} * var(${r}))`:""};n.style.width=r(e.width,this.document_.body.clientWidth,"--hterm-charsize-width"),n.style.height=r(e.height,this.document_.body.clientHeight,"--hterm-charsize-height");const i=Math.ceil(n.clientHeight/this.scrollPort_.characterSize.height);for(let e=0;e{this.document_.body.removeChild(n),o.showOverlay(U.msg("LOADING_RESOURCE_FAILED",[e.name],"Loading $1 failed")),o.pop(),r&&r(t)}}else{const t=this.document_.createElement("a");t.href=e.uri,t.download=e.name,this.document_.body.appendChild(t),t.click(),t.remove()}}},U.Terminal.prototype.getSelectionText=function(){var e=this.scrollPort_.selection;if(e.sync(),e.isCollapsed)return null;var t=e.startOffset,r=e.startNode;if(!r)return null;if("X-ROW"!=r.nodeName)for("#text"==r.nodeName&&"SPAN"==r.parentNode.nodeName&&(r=r.parentNode);r.previousSibling;)r=r.previousSibling,t+=U.TextAttributes.nodeWidth(r);var o=U.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+=U.TextAttributes.nodeWidth(r);var n=this.getRowsText(e.startRow.rowIndex,e.endRow.rowIndex+1);return L.wc.substring(n,t,L.wc.strWidth(n)-o)},U.Terminal.prototype.copySelectionToClipboard=function(){var e=this.getSelectionText();null!=e&&this.copyStringToClipboard(e)},U.Terminal.prototype.overlaySize=function(){this.showOverlay(this.screenSize.width+"x"+this.screenSize.height)},U.Terminal.prototype.onVTKeystroke=function(e){this.scrollOnKeystroke_&&this.scrollPort_.scrollRowToBottom(this.getRowCount()),this.io.onVTKeystroke(this.keyboard.encode(e))},U.Terminal.prototype.openSelectedUrl_=function(){var e=this.getSelectionText();if((null!=e||(this.screen_.expandSelectionForUrl(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}U.openUrl(e)}},U.Terminal.prototype.setAutomaticMouseHiding=function(e=null){null===e&&(e="cros"!=U.os&&"mac"!=U.os),this.mouseHideWhileTyping_=!!e},U.Terminal.prototype.onKeyboardActivity_=function(e){this.mouseHideWhileTyping_&&!this.mouseHideDelay_&&this.setCssVar("mouse-cursor-style","none")},U.Terminal.prototype.onMouse_=function(e){if(!e.processedByTerminalHandler_){e.button>2&&e.preventDefault();var t=!this.defeatMouseReports_&&this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED;if(e.processedByTerminalHandler_=!0,this.mouseHideWhileTyping_&&!this.mouseHideDelay_&&(this.syncMouseStyle(),this.mouseHideDelay_=setTimeout(()=>this.mouseHideDelay_=null,1e3)),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.screen_.expandSelection(this.document_.getSelection()),this.copyOnSelect&&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&&(e.ctrlKey&&2==e.button?e.preventDefault():(e.button==this.mousePasteButton||this.mouseRightClickPaste&&2==e.button)&&(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){const t=this.scrollPort_.scrollWheelDelta(e),r=(e,t,r,o)=>{if(0==e)return"";const n=L.f.smartFloorDivide(Math.abs(e),t);return("O"+(e<0?o:r)).repeat(n)};this.io.sendString(r(t.y,this.scrollPort_.characterSize.height,"A","B")+r(t.x,this.scrollPort_.characterSize.width,"C","D")),e.preventDefault()}}"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.defeatMouseReports_=!1)}}},U.Terminal.prototype.onMouse=function(e){},U.Terminal.prototype.onFocusChange_=function(e){this.cursorNode_.setAttribute("focus",e),this.restyleCursor_(),this.reportFocus&&this.io.sendString(!0===e?"":""),!0===e&&this.closeBellNotifications_()},U.Terminal.prototype.onScroll_=function(){this.scheduleSyncCursorPosition_()},U.Terminal.prototype.onPaste_=function(e){var t=e.text.replace(/\n/gm,"\r");if(t=this.keyboard.encode(t),this.options_.bracketedPaste){const e=e=>e.replace(/[\x00-\x07\x0b-\x0c\x0e-\x1f]/g,"");t="[200~"+e(t)+"[201~"}this.io.sendString(t)},U.Terminal.prototype.onCopy_=function(e){this.useDefaultWindowCopy||(e.preventDefault(),setTimeout(this.copySelectionToClipboard.bind(this),0))},U.Terminal.prototype.onResize_=function(){var e=Math.floor(this.scrollPort_.getScreenWidth()/this.scrollPort_.characterSize.width)||0,t=L.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_()}},U.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},U.Terminal.prototype.setScrollbarVisible=function(e){this.scrollPort_.setScrollbarVisible(e)},U.Terminal.prototype.setScrollWheelMoveMultipler=function(e){this.scrollPort_.setScrollWheelMoveMultipler(e)},U.Terminal.prototype.closeBellNotifications_=function(){this.bellNotificationList_.forEach((function(e){e.close()})),this.bellNotificationList_.length=0},U.Terminal.prototype.onScrollportFocus_=function(){const e=this.scrollPort_.getTopRowIndex(),t=this.scrollPort_.getBottomRowIndex(e),r=this.document_.getSelection();!this.syncCursorPosition_()&&r&&r.collapse(this.getRowNode(t))},L.rtdep("lib.encodeUTF8"),U.Terminal.IO=function(e){this.terminal_=e,this.previousIO_=null,this.buffered_=""},U.Terminal.IO.prototype.showOverlay=function(e,t){this.terminal_.showOverlay(e,t)},U.Terminal.IO.prototype.hideOverlay=function(){this.terminal_.hideOverlay()},U.Terminal.IO.prototype.createFrame=function(e,t){return new U.Frame(this.terminal_,e,t)},U.Terminal.IO.prototype.setTerminalProfile=function(e){this.terminal_.setProfile(e)},U.Terminal.IO.prototype.push=function(){var e=new U.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},U.Terminal.IO.prototype.pop=function(){this.terminal_.io=this.previousIO_,this.previousIO_.flush()},U.Terminal.IO.prototype.flush=function(){this.buffered_&&(this.terminal_.interpret(this.buffered_),this.buffered_="")},U.Terminal.IO.prototype.sendString=function(e){console.log("Unhandled sendString: "+e)},U.Terminal.IO.prototype.onVTKeystroke=function(e){console.log("Unobserverd VT keystroke: "+JSON.stringify(e))},U.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)},U.Terminal.IO.prototype.onTerminalResize=function(e,t){},U.Terminal.IO.prototype.writeUTF8=function(e){this.terminal_.io==this?this.terminal_.interpret(e):this.buffered_+=e},U.Terminal.IO.prototype.writelnUTF8=function(e){this.writeUTF8(e+"\r\n")},U.Terminal.IO.prototype.print=U.Terminal.IO.prototype.writeUTF16=function(e){this.writeUTF8(L.encodeUTF8(e))},U.Terminal.IO.prototype.println=U.Terminal.IO.prototype.writelnUTF16=function(e){this.writelnUTF8(L.encodeUTF8(e))},L.rtdep("lib.colors"),U.TextAttributes=function(e){this.document_=e,this.foregroundSource=this.SRC_DEFAULT,this.backgroundSource=this.SRC_DEFAULT,this.underlineSource=this.SRC_DEFAULT,this.foreground=this.DEFAULT_COLOR,this.background=this.DEFAULT_COLOR,this.underlineColor=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.uri=null,this.uriId=null,this.colorPalette=null,this.resetColorPalette()},U.TextAttributes.prototype.enableBold=!0,U.TextAttributes.prototype.enableBoldAsBright=!0,U.TextAttributes.prototype.DEFAULT_COLOR=L.f.createEnum(""),U.TextAttributes.prototype.SRC_DEFAULT="default",U.TextAttributes.prototype.setDocument=function(e){this.document_=e},U.TextAttributes.prototype.clone=function(){var e=new U.TextAttributes(null);for(var t in this)e[t]=this[t];return e.colorPalette=this.colorPalette.concat(),e},U.TextAttributes.prototype.reset=function(){this.foregroundSource=this.SRC_DEFAULT,this.backgroundSource=this.SRC_DEFAULT,this.underlineSource=this.SRC_DEFAULT,this.foreground=this.DEFAULT_COLOR,this.background=this.DEFAULT_COLOR,this.underlineColor=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,this.uri=null,this.uriId=null},U.TextAttributes.prototype.resetColorPalette=function(){this.colorPalette=L.colors.colorPalette.concat(),this.syncColors()},U.TextAttributes.prototype.resetColor=function(e){e=parseInt(e,10),isNaN(e)||e>=this.colorPalette.length||(this.colorPalette[e]=L.colors.stockColorPalette[e],this.syncColors())},U.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&&null==this.uri},U.TextAttributes.prototype.createContainer=function(e){if(this.isDefault()){const t=this.document_.createTextNode(e);return t.asciiNode=!0,t}var t=this.document_.createElement("span"),r=t.style,o=[];this.foreground!=this.DEFAULT_COLOR&&(r.color=this.foreground),this.background!=this.DEFAULT_COLOR&&(r.backgroundColor=this.background),this.enableBold&&this.bold&&(r.fontWeight="bold"),this.faint&&(t.faint=!0),this.italic&&(r.fontStyle="italic"),this.blink&&(o.push("blink-node"),t.blinkNode=!0);let n="";return t.underline=this.underline,this.underline&&(n+=" underline",r.textDecorationStyle=this.underline),this.underlineSource!=this.SRC_DEFAULT&&(r.textDecorationColor=this.underlineColor),this.strikethrough&&(n+=" line-through",t.strikethrough=!0),n&&(r.textDecorationLine=n),this.wcNode&&(o.push("wc-node"),t.wcNode=!0),t.asciiNode=this.asciiNode,null!=this.tileData&&(o.push("tile"),o.push("tile_"+this.tileData),t.tileNode=!0),e&&(t.textContent=e),this.uri&&(o.push("uri-node"),t.uriId=this.uriId,t.title=this.uri,t.addEventListener("click",U.openUrl.bind(this,this.uri))),o.length&&(t.className=o.join(" ")),t},U.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.uriId!=e.uriId||this.foreground!=t.color||this.background!=t.backgroundColor||this.underlineColor!=t.textDecorationColor||(this.enableBold&&this.bold)!=!!t.fontWeight||this.blink!=!!e.blinkNode||this.italic!=!!t.fontStyle||this.underline!=e.underline||!!this.strikethrough!=!!e.strikethrough)},U.TextAttributes.prototype.setDefaults=function(e,t){this.defaultForeground=e,this.defaultBackground=t,this.syncColors()},U.TextAttributes.prototype.syncColors=function(){const e=(e,t)=>e==this.DEFAULT_COLOR?t:e;var t,r=this.foregroundSource,o=this.backgroundSource;if(this.enableBoldAsBright&&this.bold&&Number.isInteger(r)&&(r=(t=r)<8?t+8:t),r==this.SRC_DEFAULT?this.foreground=this.DEFAULT_COLOR:Number.isInteger(r)?this.foreground=this.colorPalette[r]:this.foreground=r,this.faint){const t=e(this.foreground,this.defaultForeground);this.foreground=L.colors.mix(t,"rgb(0, 0, 0)",.3333)}if(o==this.SRC_DEFAULT?this.background=this.DEFAULT_COLOR:Number.isInteger(o)?this.background=this.colorPalette[o]:this.background=o,this.inverse){const t=e(this.foreground,this.defaultForeground);this.foreground=e(this.background,this.defaultBackground),this.background=t}this.invisible&&(this.foreground=this.background),this.underlineSource==this.SRC_DEFAULT?this.underlineColor="":Number.isInteger(this.underlineSource)?this.underlineColor=this.colorPalette[this.underlineSource]:this.underlineColor=this.underlineSource},U.TextAttributes.containersMatch=function(e,t){if("string"==typeof e)return U.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.backgroundColor==o.backgroundColor&&r.fontWeight==o.fontWeight&&r.fontStyle==o.fontStyle&&r.textDecoration==o.textDecoration&&r.textDecorationColor==o.textDecorationColor&&r.textDecorationStyle==o.textDecorationStyle&&r.textDecorationLine==o.textDecorationLine},U.TextAttributes.containerIsDefault=function(e){return"string"==typeof e||e.nodeType==Node.TEXT_NODE},U.TextAttributes.nodeWidth=function(e){return e.asciiNode?e.textContent.length:L.wc.strWidth(e.textContent)},U.TextAttributes.nodeSubstr=function(e,t,r){return e.asciiNode?e.textContent.substr(t,r):L.wc.substr(e.textContent,t,r)},U.TextAttributes.nodeSubstring=function(e,t,r){return e.asciiNode?e.textContent.substring(t,r):L.wc.substring(e.textContent,t,r)},U.TextAttributes.splitWidecharString=function(e){for(var t,r=[],o=0,n=0,i=0,s=!0,a=0;a0?0:1),s|=r,t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${s};${o};${n}M`:""+String.fromCharCode(s+32)+o+n,e.preventDefault();break;case"mousedown":var s=Math.min(e.button,2);this.mouseCoordinates!=this.MOUSE_COORDINATES_SGR&&(s+=32),s|=r,t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${s};${o};${n}M`:""+String.fromCharCode(s)+o+n;break;case"mouseup":this.mouseReport!=this.MOUSE_REPORT_PRESS&&(t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${e.button};${o};${n}m`:"#"+o+n);break;case"mousemove":this.mouseReport==this.MOUSE_REPORT_DRAG&&e.buttons&&(s=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?0:32,1&e.buttons?s+=0:4&e.buttons?s+=1:2&e.buttons?s+=2:s+=3,s+=32,s|=r,t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${s};${o};${n}M`:""+String.fromCharCode(s)+o+n,this.lastMouseDragResponse_==t?t="":this.lastMouseDragResponse_=t);break;case"click":case"dblclick":break;default:console.error("Unknown mouse event: "+e.type,e)}t&&this.terminal.io.sendString(t)},U.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!"}},U.VT.prototype.decode=function(e){return"utf-8"==this.characterEncoding?this.decodeUTF8(e):e},U.VT.prototype.encodeUTF8=function(e){return L.encodeUTF8(e)},U.VT.prototype.decodeUTF8=function(e){return this.utf8Decoder_.decode(e)},U.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_()},U.VT.prototype.updateEncodingState_=function(){var e=Object.keys(U.VT.CC1).filter(e=>!this.codingSystemUtf8_||e.charCodeAt()<128).map(e=>"\\x"+L.f.zpad(e.charCodeAt().toString(16),2)).join("");this.cc1Pattern_=new RegExp(`[${e}]`)},U.VT.prototype.parseUnknown_=function(e){var t=this;function r(e){!t.codingSystemUtf8_&&t[t.GL].GL&&(e=t[t.GL].GL(e)),t.terminal.print(e)}var o=e.peekRemainingBuf(),n=o.search(this.cc1Pattern_);return 0==n?(this.dispatch("CC1",o.substr(0,1),e),void e.advance(1)):-1==n?(r(o),void e.reset()):(r(o.substr(0,n)),this.dispatch("CC1",o.substr(n,1),e),void e.advance(n+1))},U.VT.prototype.parseCSI_=function(e){var t=e.peekChar(),r=e.args;const o=()=>{e.resetArguments(),e.subargs=null,e.resetParseFunction()};t>="@"&&t<="~"?(this.dispatch("CSI",this.leadingModifier_+this.trailingModifier_+t,e),o()):";"==t?this.trailingModifier_?o():(r.length||r.push(""),r.push("")):t>="0"&&t<="9"||":"==t?this.trailingModifier_?o():(r.length?r[r.length-1]+=t:r[0]=t,":"==t&&e.argSetSubargs(r.length-1)):t>=" "&&t<="?"?r.length?this.trailingModifier_+=t:this.leadingModifier_+=t:this.cc1Pattern_.test(t)?this.dispatch("CC1",t,e):o(),e.advance(1)},U.VT.prototype.parseUntilStringTerminator_=function(e){var t=e.peekRemainingBuf(),r=e.args;let 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);const n=t.search(/[\x1b\x07]/),i=t[n];let s;var a;return(s=(""!=i||"\\"==t[n+1])&&-1!=n)?(r[0]+=t.substr(0,n),e.resetParseFunction(),e.advance(n+(""==i?2:1)-o),!0):(r[0]+=t,""==i&&n!=t.length-1&&(a="embedded escape: "+n),new Date-r[1]>this.oscTimeLimit_&&(a="timeout expired: "+(new Date-r[1])),a?(this.warnUnimplemented&&console.log("parseUntilStringTerminator_: aborting: "+a,r[0]),e.reset(r[0]),!1):(e.advance(t.length-o),!0))},U.VT.prototype.dispatch=function(e,t,r){var o=U.VT[e][t];o?o!=U.VT.ignore?!r.subargs||o.supportsSubargs?"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 w/subargs: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t))},U.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)},U.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 9:this.mouseReport=t?this.MOUSE_REPORT_PRESS:this.MOUSE_REPORT_DISABLED,this.terminal.syncMouseStyle();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 1005:this.mouseCoordinates=t?this.MOUSE_COORDINATES_UTF8:this.MOUSE_COORDINATES_X10;break;case 1006:this.mouseCoordinates=t?this.MOUSE_COORDINATES_SGR:this.MOUSE_COORDINATES_X10;break;case 1007:this.terminal.scrollWheelArrowKeys_=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:t?this.terminal.saveCursorAndState():this.terminal.restoreCursorAndState();break;case 1049:t?(this.terminal.saveCursorAndState(),this.terminal.setAlternateMode(t),this.terminal.clear()):(this.terminal.setAlternateMode(t),this.terminal.restoreCursorAndState());break;case 2004:this.terminal.setBracketedPaste(t);break;default:this.warnUnimplemented&&console.warn("Unimplemented DEC Private Mode: "+e)}},U.VT.ignore=function(){},U.VT.CC1={},U.VT.ESC={},U.VT.CSI={},U.VT.OSC={},U.VT.VT52={},U.VT.CC1["\0"]=U.VT.ignore,U.VT.CC1[""]=U.VT.ignore,U.VT.CC1[""]=function(){this.terminal.ringBell()},U.VT.CC1["\b"]=function(){this.terminal.cursorLeft(1)},U.VT.CC1["\t"]=function(){this.terminal.forwardTabStop()},U.VT.CC1["\n"]=function(){this.terminal.formFeed()},U.VT.CC1["\v"]=U.VT.CC1["\n"],U.VT.CC1["\f"]=U.VT.CC1["\n"],U.VT.CC1["\r"]=function(){this.terminal.setCursorColumn(0)},U.VT.CC1[""]=function(){this.GL="G1"},U.VT.CC1[""]=function(){this.GL="G0"},U.VT.CC1[""]=U.VT.ignore,U.VT.CC1[""]=U.VT.ignore,U.VT.CC1[""]=function(e){"G1"==this.GL&&(this.GL="G0"),e.resetParseFunction(),this.terminal.print("?")},U.VT.CC1[""]=U.VT.CC1[""],U.VT.CC1[""]=function(e){e.func=function e(t){var r=t.consumeChar();""!=r&&(this.dispatch("ESC",r,t),t.func==e&&t.resetParseFunction())}},U.VT.CC1[""]=U.VT.ignore,U.VT.CC1["„"]=U.VT.ESC.D=function(){this.terminal.lineFeed()},U.VT.CC1["…"]=U.VT.ESC.E=function(){this.terminal.setCursorColumn(0),this.terminal.cursorDown(1)},U.VT.CC1["ˆ"]=U.VT.ESC.H=function(){this.terminal.setTabStop(this.terminal.getCursorColumn())},U.VT.CC1[""]=U.VT.ESC.M=function(){this.terminal.reverseLineFeed()},U.VT.CC1["Ž"]=U.VT.ESC.N=U.VT.ignore,U.VT.CC1[""]=U.VT.ESC.O=U.VT.ignore,U.VT.CC1[""]=U.VT.ESC.P=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},U.VT.CC1["–"]=U.VT.ESC.V=U.VT.ignore,U.VT.CC1["—"]=U.VT.ESC.W=U.VT.ignore,U.VT.CC1["˜"]=U.VT.ESC.X=U.VT.ignore,U.VT.CC1["š"]=U.VT.ESC.Z=function(){this.terminal.io.sendString("[?1;2c")},U.VT.CC1["›"]=U.VT.ESC["["]=function(e){e.resetArguments(),this.leadingModifier_="",this.trailingModifier_="",e.func=this.parseCSI_},U.VT.CC1["œ"]=U.VT.ESC["\\"]=U.VT.ignore,U.VT.CC1[""]=U.VT.ESC["]"]=function(e){e.resetArguments(),e.func=function e(t){if(this.parseUntilStringTerminator_(t)&&t.func!=e){var r=t.args[0].match(/^(\d+);(.*)$/);r?(t.args[0]=r[2],this.dispatch("OSC",r[1],t)):console.warn("Invalid OSC: "+JSON.stringify(t.args[0])),t.resetArguments()}}},U.VT.CC1["ž"]=U.VT.ESC["^"]=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},U.VT.CC1["Ÿ"]=U.VT.ESC._=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},U.VT.ESC[" "]=function(e){e.func=function(e){var t=e.consumeChar();this.warnUnimplemented&&console.warn("Unimplemented sequence: ESC 0x20 "+t),e.resetParseFunction()}},U.VT.ESC["#"]=function(e){e.func=function(e){"8"==e.consumeChar()&&(this.terminal.setCursorPosition(0,0),this.terminal.fill("E")),e.resetParseFunction()}},U.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()}},U.VT.ESC["("]=U.VT.ESC[")"]=U.VT.ESC["*"]=U.VT.ESC["+"]=U.VT.ESC["-"]=U.VT.ESC["."]=U.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()}},U.VT.ESC[6]=U.VT.ignore,U.VT.ESC[7]=function(){this.terminal.saveCursorAndState()},U.VT.ESC[8]=function(){this.terminal.restoreCursorAndState()},U.VT.ESC[9]=U.VT.ignore,U.VT.ESC["="]=function(){this.terminal.keyboard.applicationKeypad=!0},U.VT.ESC[">"]=function(){this.terminal.keyboard.applicationKeypad=!1},U.VT.ESC.F=U.VT.ignore,U.VT.ESC.c=function(){this.terminal.reset()},U.VT.ESC.l=U.VT.ESC.m=U.VT.ignore,U.VT.ESC.n=function(){this.GL="G2"},U.VT.ESC.o=function(){this.GL="G3"},U.VT.ESC["|"]=function(){this.GR="G3"},U.VT.ESC["}"]=function(){this.GR="G2"},U.VT.ESC["~"]=function(){this.GR="G1"},U.VT.OSC[0]=function(e){this.terminal.setWindowTitle(e.args[0])},U.VT.OSC[2]=U.VT.OSC[0],U.VT.OSC[4]=function(e){for(var t=e.args[0].split(";"),r=parseInt(t.length/2),o=this.terminal.getTextAttributes().colorPalette,n=[],i=0;i=o.length||("?"!=a?(a=L.colors.x11ToCSS(a))&&(o[s]=a):(a=L.colors.rgbToX11(o[s]))&&n.push(s+";"+a))}n.length&&this.terminal.io.sendString("]4;"+n.join(";")+"")},U.VT.OSC[8]=function(e){const t=e.args[0].split(";");let r=null,o=null;if(2!=t.length||0==t[1].length);else{const e=t[0].split(":");r="",e.forEach(e=>{const t=e.indexOf("=");if(-1==t)return;const o=e.slice(0,t),n=e.slice(t+1);switch(o){case"id":r=n}}),o=t[1]}const n=this.terminal.getTextAttributes();n.uri=o,n.uriId=r},U.VT.OSC[9]=function(e){U.notify({body:e.args[0]})},U.VT.OSC[10]=function(e){var t=e.args[0].split(";");if(t){var r=L.colors.x11ToCSS(t.shift());r&&this.terminal.setForegroundColor(r),t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[11].apply(this,[e]))}},U.VT.OSC[11]=function(e){var t=e.args[0].split(";");if(t){var r=L.colors.x11ToCSS(t.shift());r&&this.terminal.setBackgroundColor(r),t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[12].apply(this,[e]))}},U.VT.OSC[12]=function(e){var t=e.args[0].split(";");if(t){var r=L.colors.x11ToCSS(t.shift());r&&this.terminal.setCursorColor(r)}},U.VT.OSC[50]=function(e){var t=e.args[0].match(/CursorShape=(.)/i);if(t)switch(t[1]){case"1":this.terminal.setCursorShape(U.Terminal.cursorShape.BEAM);break;case"2":this.terminal.setCursorShape(U.Terminal.cursorShape.UNDERLINE);break;default:this.terminal.setCursorShape(U.Terminal.cursorShape.BLOCK)}else console.warn("Could not parse OSC 50 args: "+e.args[0])},U.VT.OSC[52]=function(e){if(this.enableClipboardWrite){var t=e.args[0].match(/^[cps01234567]*;(.*)/);if(t){var r=window.atob(t[1]);r&&this.terminal.copyStringToClipboard(this.decode(r))}}},U.VT.OSC[104]=function(e){const t=this.terminal.getTextAttributes();e.args[0]?e.args[0].split(";").forEach(e=>t.resetColor(e)):t.resetColorPalette()},U.VT.OSC[110]=function(e){this.terminal.setForegroundColor()},U.VT.OSC[111]=function(e){this.terminal.setBackgroundColor()},U.VT.OSC[112]=function(e){this.terminal.setCursorColor()},U.VT.OSC[1337]=function(e){let t=e.args[0].match(/^File=([^:]*):([\s\S]*)$/m);if(!t)return void(this.warnUnimplemented&&console.log(`iTerm2 1337: unsupported sequence: ${t[1]}`));const r={name:"",size:0,preserveAspectRatio:!0,inline:!1,width:"auto",height:"auto",align:"left",uri:"data:application/octet-stream;base64,"+t[2].replace(/[\n\r]+/gm,"")};if(t[1].split(";").forEach(e=>{const t=e.match(/^([^=]+)=(.*)$/m);if(t)switch(t[1]){case"name":try{r.name=window.atob(t[2])}catch(e){}break;case"size":try{r.size=parseInt(t[2])}catch(e){}break;case"width":r.width=t[2];break;case"height":r.height=t[2];break;case"preserveAspectRatio":r.preserveAspectRatio=!("0"==t[2]);break;case"inline":r.inline=!("0"==t[2]);break;case"align":r.align=t[2]}}),r.inline){const t=this.terminal.io,o=e.peekRemainingBuf();e.advance(o.length),this.terminal.displayImage(r),t.writeUTF8(o)}else this.terminal.displayImage(r)},U.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]),U.notify({title:r,body:o});break;default:console.warn("Unknown urxvt module: "+e.args[0])}},U.VT.CSI["@"]=function(e){this.terminal.insertSpace(e.iarg(0,1))},U.VT.CSI.A=function(e){this.terminal.cursorUp(e.iarg(0,1))},U.VT.CSI.B=function(e){this.terminal.cursorDown(e.iarg(0,1))},U.VT.CSI.C=function(e){this.terminal.cursorRight(e.iarg(0,1))},U.VT.CSI.D=function(e){this.terminal.cursorLeft(e.iarg(0,1))},U.VT.CSI.E=function(e){this.terminal.cursorDown(e.iarg(0,1)),this.terminal.setCursorColumn(0)},U.VT.CSI.F=function(e){this.terminal.cursorUp(e.iarg(0,1)),this.terminal.setCursorColumn(0)},U.VT.CSI.G=function(e){this.terminal.setCursorColumn(e.iarg(0,1)-1)},U.VT.CSI.H=function(e){this.terminal.setCursorPosition(e.iarg(0,1)-1,e.iarg(1,1)-1)},U.VT.CSI.I=function(e){var t=e.iarg(0,1);t=L.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;rT"]=U.VT.ignore,U.VT.CSI.X=function(e){this.terminal.eraseToRight(e.iarg(0,1))},U.VT.CSI.Z=function(e){var t=e.iarg(0,1);t=L.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;rc"]=function(e){this.terminal.io.sendString("[>0;256;0c")},U.VT.CSI.d=function(e){this.terminal.setAbsoluteCursorRow(e.iarg(0,1)-1)},U.VT.CSI.f=U.VT.CSI.H,U.VT.CSI.g=function(e){e.args[0]&&0!=e.args[0]?3==e.args[0]&&this.terminal.clearAllTabStops():this.terminal.clearTabStopAtCursor(!1)},U.VT.CSI.h=function(e){for(var t=0;t=90&&n<=97?t.foregroundSource=n-90+8:n>=100&&n<=107&&(t.backgroundSource=n-100+8)}t.setDefaults(this.terminal.getForegroundColor(),this.terminal.getBackgroundColor())}else t.reset()},U.VT.CSI.m.supportsSubargs=!0,U.VT.CSI[">m"]=U.VT.ignore,U.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")}},U.VT.CSI[">n"]=U.VT.ignore,U.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")},U.VT.CSI[">p"]=U.VT.ignore,U.VT.CSI["!p"]=function(){this.terminal.softReset()},U.VT.CSI.$p=U.VT.ignore,U.VT.CSI["?$p"]=U.VT.ignore,U.VT.CSI['"p']=U.VT.ignore,U.VT.CSI.q=U.VT.ignore,U.VT.CSI[" q"]=function(e){var t=e.args[0];0==t||1==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BLOCK),this.terminal.setCursorBlink(!0)):2==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BLOCK),this.terminal.setCursorBlink(!1)):3==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.UNDERLINE),this.terminal.setCursorBlink(!0)):4==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.UNDERLINE),this.terminal.setCursorBlink(!1)):5==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BEAM),this.terminal.setCursorBlink(!0)):6==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BEAM),this.terminal.setCursorBlink(!1)):console.warn("Unknown cursor style: "+t)},U.VT.CSI['"q']=U.VT.ignore,U.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)},U.VT.CSI["?r"]=U.VT.ignore,U.VT.CSI.$r=U.VT.ignore,U.VT.CSI.s=function(){this.terminal.saveCursorAndState()},U.VT.CSI["?s"]=U.VT.ignore,U.VT.CSI.t=U.VT.ignore,U.VT.CSI.$t=U.VT.ignore,U.VT.CSI[">t"]=U.VT.ignore,U.VT.CSI[" t"]=U.VT.ignore,U.VT.CSI.u=function(){this.terminal.restoreCursorAndState()},U.VT.CSI[" u"]=U.VT.ignore,U.VT.CSI.$v=U.VT.ignore,U.VT.CSI["'w"]=U.VT.ignore,U.VT.CSI.x=U.VT.ignore,U.VT.CSI["*x"]=U.VT.ignore,U.VT.CSI.$x=U.VT.ignore,U.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)}},U.VT.CSI["'z"]=U.VT.ignore,U.VT.CSI.$z=U.VT.ignore,U.VT.CSI["'{"]=U.VT.ignore,U.VT.CSI["'|"]=U.VT.ignore,U.VT.CSI["'}"]=U.VT.ignore,U.VT.CSI["'~"]=U.VT.ignore,L.rtdep("lib.f"),U.VT.CharacterMap=function(e,t){this.description=e,this.GL=null,this.glmapBase_=t,this.sync_()},U.VT.CharacterMap.prototype.sync_=function(e){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 t=Object.keys(this.glmap_).map(e=>"\\x"+L.f.zpad(e.charCodeAt(0).toString(16)));this.glre_=new RegExp("["+t.join("")+"]","g"),this.GL=e=>e.replace(this.glre_,e=>this.glmap_[e])},U.VT.CharacterMap.prototype.reset=function(){this.glmap_!==this.glmapBase_&&this.sync_()},U.VT.CharacterMap.prototype.setOverrides=function(e){this.sync_(e)},U.VT.CharacterMap.prototype.clone=function(){var e=new U.VT.CharacterMap(this.description,this.glmapBase_);return this.glmap_!==this.glmapBase_&&e.setOverrides(this.glmap_),e},U.VT.CharacterMaps=function(){this.maps_=U.VT.CharacterMaps.DefaultMaps,this.mapsBase_=this.maps_},U.VT.CharacterMaps.prototype.getMap=function(e){return this.maps_.hasOwnProperty(e)?this.maps_[e]:void 0},U.VT.CharacterMaps.prototype.addMap=function(e,t){this.maps_===this.mapsBase_&&(this.maps_=Object.assign({},this.mapsBase_)),this.maps_[e]=t},U.VT.CharacterMaps.prototype.reset=function(){this.maps_!==U.VT.CharacterMaps.DefaultMaps&&(this.maps_=U.VT.CharacterMaps.DefaultMaps)},U.VT.CharacterMaps.prototype.setOverrides=function(e){for(var t in this.maps_===this.mapsBase_&&(this.maps_=Object.assign({},this.mapsBase_)),e){var r=this.getMap(t);void 0!==r?(this.maps_[t]=r.clone(),this.maps_[t].setOverrides(e[t])):this.addMap(t,new U.VT.CharacterMap("user "+t,e[t]))}},U.VT.CharacterMaps.DefaultMaps={},U.VT.CharacterMaps.DefaultMaps[0]=new U.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:"≥","{":"π","|":"≠","}":"£","~":"·"}),U.VT.CharacterMaps.DefaultMaps.A=new U.VT.CharacterMap("british",{"#":"£"}),U.VT.CharacterMaps.DefaultMaps.B=new U.VT.CharacterMap("us",null),U.VT.CharacterMaps.DefaultMaps[4]=new U.VT.CharacterMap("dutch",{"#":"£","@":"¾","[":"IJ","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"}),U.VT.CharacterMaps.DefaultMaps.C=U.VT.CharacterMaps.DefaultMaps[5]=new U.VT.CharacterMap("finnish",{"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),U.VT.CharacterMaps.DefaultMaps.R=new U.VT.CharacterMap("french",{"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"}),U.VT.CharacterMaps.DefaultMaps.Q=new U.VT.CharacterMap("french canadian",{"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"}),U.VT.CharacterMaps.DefaultMaps.K=new U.VT.CharacterMap("german",{"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"}),U.VT.CharacterMaps.DefaultMaps.Y=new U.VT.CharacterMap("italian",{"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"}),U.VT.CharacterMaps.DefaultMaps.E=U.VT.CharacterMaps.DefaultMaps[6]=new U.VT.CharacterMap("norwegian/danish",{"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"}),U.VT.CharacterMaps.DefaultMaps.Z=new U.VT.CharacterMap("spanish",{"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"}),U.VT.CharacterMaps.DefaultMaps[7]=U.VT.CharacterMaps.DefaultMaps.H=new U.VT.CharacterMap("swedish",{"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),U.VT.CharacterMaps.DefaultMaps["="]=new U.VT.CharacterMap("swiss",{"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}),L.resource.add("hterm/images/icon-96","image/png;base64","iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAStklEQVR42u1dBXjrupL+RzIGmjIfvAcu42NmZub3lpmZmZmZmRkuMzPDYaYyJG0Sa9b2p2z1eQtp7bzefpv/nKnkkSw7Gg1IshNsDtpoo4022mijDWp/tlTgzbpJSqYvMoFTC9vjRD5JLb9RYaRkpk22SS28P8pacAaPdZ41KYMCI89YB6wN3JzQJM3UIGqurfTlKQTAZtqENid5SlNdU804VmbbWQtA6HMkAAdADsBeAJ7mxwIhIhFSXJ9iRPw4JYDEcqmGWEp1HhCI8gAtpXF7scB1ZRH9E3HObANCNy1AoGTegNDnCdE41tfQDH2t+CINQEpJ9Xp97oUDh3+nXK48DYAMIWQmANIkNTn6vP69e3d/zctfeu0nXNexmVn3F0gDAMxMlBoHuht0qnsEEekC42SdGHmNxgVjgk4bPN04Yui8bhc534cQBH35RKrPN9sGdLnB1/Wuv+HW4f+6/tZvBHAaAJvmKr0AjJGvyQMw8pLrrvqeT378Ax8UwrKeevoFgEhfjcGGO2JO+iuTt1SW5DHzyraDExyTlWwHjCQ/CAJcecU+XHn5xWDmVCGQFAKljsLbx8Ynvv3Bhx7/EQCzurimU04jADLsvK3r73/7W1//g1/6hU++uVqt0X/dcBcKxRIsy9Ji34DPow2et6FzgcXFKk6fOY83vu4VEFKkDiYHB3roSz73sc+Oj08eOHzk+B9oMyQABGk0gCIyOt9xHPvaD3/wnT/5VV/+meumpmbwD/98A0qdvVEBNhvMDCJaVXtM01GtVlEs+LBtC1ngzW98tX/m7Llv/emf+83HarX6vbrfGECQRgBmlLP9Ix961499+zd/5XVj45P407/8FxQ7uiGlQK1Ww1ZCvR6gXq3AsgQ8zwYzUkMIgXe+/Q1Dd9x5/6duv/P+R7QjprQaIHQd/8orLvnCJz/2/pfmcj7+6rf+DK5XgOu6sT3dQtBawqjW6lhYXIRlSTAjE/T39eLSS/ZeEwqgE8CiYUV4vQIgTULTyFve9Or3WJZN/3n9HTh3fgrFjhJmZmawFaGUwkJlEffc9xh83wMYqcFg7Noxinw+l9OBikirAabz7eju6sxJKTE7W4bn5+D7PrYmtI/gAFJasCwb4IzaBMHzXE8LgBJC4I1GQRKAa4Xo6upEsZiH53nIRYLeolDMCIIq+nq70dFRAGckgFKpAD+UgBaAgfRRkGvbliwUcoh8ABHFYSfWMnBrxOzL12PwKufzSvV55Tpmi5a0IASBQCgWcujs7ABn5AQic+b5rhNlAVAmTliTEwnA990wIxEEdUQYnxjHidMnAUIcBYABRqNDdC7BM8t0VtfTnGRd8FKdRIjJcVlCsAbPPA5UAK4rXLJjP7aNbkO9XoPrOrEQWHEm69Kua0caYEspvCBQ5toSp9EASCkt27ZF1PlCxBOZOPo5feY0Xpg8jHe/7V3YNjhqjDRac3mMVl1Oo40vtREtW+2FYwdw/S03YHJ6EkODQ1hcXIQUcaeBlUIWsCwZ+QDLdZxcubKAtBpgNmzZliUa6yLMKiRGoBR279yN6666FlJYABgvRhAIncUSHn/iCdQrAZjjSAiKFQQRVEhZIRJASJEACICmlAKQUtqhBETjw5ijuFqr4oWjBwHmF7/jVUHc6aRNXxAoZA3PdYXruvlldJfTaIATaQA4KU/CzNwMDp84DOYXf+hZXiijhJz+DK0QAEd+RYTOOAcgMw0g24oskNYAIoCXxDpbnsOxM8fB5qacwKZD+3WQcS+VxQrYYXNVNGMhI1odiIRQSHb8BmbCpgZYjmVLYi0ANmxQNKpOj50FFOB3WnDzEpOnFkGbuOXPimG5Ap0jLqZOLiKoMyIsVhfB9lLEpFSQ+S26jh2Fo/n0YagRCUlLRhpAAIMIyWl9vBinAkbfoIPXf+0wnrlxAs/dPInKVB1CUOsFkdhD6Nnp49oP98EvWfjvnzqGak0hVlwwFJsaoADK9vq2Y0eOOKUGJLTAjjQgFgBAy/gTvbGIyXC0nX66jJd+YgC7X1nCo39/AccfmUVQU1F5y0d9rsvGJW/txuXv7oGqMx7+2/OoVxWIzE5SOkfaBBGyhGPHc4G8YYjT+wDLDgUgJbQPWDGuL0/VcefvnMLRB2dw3Uf78dZv345D90zjsX++gPGjC7peC8yNI7DjpSVcE476rlEPB++awmP/dCEaEMtqbAP1Fqzkhn0VaUAegMzABJkaIMG8epNEiE3R0funce75Mi4NR+MV7+3B6NUFPPnvY3jupslISJkKoW9PDld/sA+7Xt6B8SMV3Pjzx3Di0TkENQaJ5A1qM8VRljKPgpg58pcNHyCz0ADSTnhNDTBBglCZruPhvz+PY4/M4Jqwg6772AB2vqwDd/zmKYwdWQAJpMalb+vGSz81AA6Ah/76HJ69KfI7tej6K7RPUKwaWQT1FmiAlJEJykXZZh5cE02FoaEJkpYEwGsKwNQGAnDhQAUP/915TJ5YwPCleZSG3WwWvwgYvryAYr8Tm5wn/2Mc5cm481c9RzXWobQPyBpSikgDGgJAVvMARzY0AARwc7Y5Ckn3vK4TV7+/D5YncN+fnsWpJ+cgsnDICnj0n85DSOCSUBO6Rl088g8XcObZ+VgjSKweKRG1xgcIEQnA9QE46aMgwwlHAmBuOFFepeMRd8rI1cU4FBzYn8exh2bw6D9ewNihCjgrR0wI21vAzb9yIrT/pfha7/y+nXj+5gk8EWrDzJlF/WxQUgMUwEtREGW/5RlpgJdaABq0pAGicYFVFaBzxMGV7+vFvtd3YfpsFbf+6ok4KqovxqFoph+YBBAsMg7cPonTT83jsnd247J39IQRUUcceR28cxrVcrBUX2sAa1Nar7dCAwhevCkDN7UADB9gSyEBaBVYYeT37PTw9u/aAbcg8Pi/XMAz109gfqLhFAktgX46LbrOg395DscemAnD0X68+suGQ+3L4Y7fOhVHRA00nDBRa3wAEGuAA8DbqABIkyEA2xFSrBHHM2xf4Ozz82HIOb5kbgSh1TDv69wLZdz0S8dxUTgRHLwkD2HRkgCIdBi6NBPmVpggL7krBkrnA6xIA0Qjfl4x9Bw7XInDzHo1hblJbZYoNkvP3zqFw/fPIKgqGNC7aNoEtUQDEJkg23Ecv1qtrhkFiWYeTYzCUCEEeI15QDTSgjpnMerTmyUB1CsKrGACyvABQb1VAnAt13V8NAHRxGqotEMIQUbJFgGtMhNuqQa4Ui9HbEgDKFknioKIhC4kbGUwFBhsOGHO/AqhCxAh5dOsBZFBMoqCGhpARJv7ihul35oEt84E6U0ZCv1APp0T1tACsIhEpquZQhJsT2C9UAGjtqA2vDnPzOD/NUEqymcOJ94TcPJZzYSFHYKIjHlA+iXk/kvyeO1XDENYtK6J16kn53H375+OBbFukBkFtWoewHAdJ1qQKwAQWcyEtQaQ4QPSmk6KZ6gXDlVAcn0x9vTpxTSjdhkBcOYmSO+KNTZlKK0GWHYoASJkZoJIABPHFnDbb5zEFxtshqEtMkG2rfcEtAZsJAoimBpgGRqg062KVmsAmBH2V2NfWKZ1woxYAyIBwFABXma+nE30wytV4rU/OK9xLWaGUmpJAHE+awEDUsrGnoCERsooyJYALfPaOEHNByBl7BGwKQsy8kYLUZ1kOTXyZprgUYJHSBzrctLHDZ6huflCLt61qtWDWAMawsgOWgCe5+v+JYN4vT6AtAbIpSCIGuEcRoaG8TrXRcwzCeZ7u2gcm4QIZn0QEudC5wGYdYxUt2PyjRSAyWsc6mvW6hW0CnpXzAdgQ6NZAdByJsgKBQAQGCp+oQFQ8ePdhUIBxWJxXfrJYKQHNRUMMK9kuwhzc3O4eO+eeLQqpbLfFfMaAgAnhdDccrSpAZYtAUApxujIEN725lfg3//7bvT19cOyLJhg44/ZCTo1y40yI79qmT4/5un2jTx0+XLtmAOAlUJXVx6ve83LdFkrdsWMTZkUTpikjFyAJUxHFr6oDc918cDDT6KyMB8xzVFpmBpAGGZHiCgVZgoRphSlQkCQTvXxEhFklMolXnyseY28NMtlIjXaCzsHO7aPoFDIQ6nWCMDzXS2AdJvybMl4HiaSLyK89S2vxRte/wrU6vXGIFrzOxdWTZcaMNtCgq15a9vNtWyTMjUncwEguSu2ISesO3vp3YDkE2ZSypiyQMO0JO331gTFryoJIXylVLrFOCtEpAHmaG5jbQ3Qb8r45XKFN2qCOCJpSUsxi/n5SlOP8rXB0WpoUgC8HgGwQYqI7AMHj1G9zk2Ea20wgI5iPhqs8dMk6/26GrOyiqharc16nlffvn3EaWtAc/BcBw8+/Ojc+PjkKaMvuWkNME+YnZ17+rnnDxweHOi9iCM+gzbLOXLrG8piu46JIO5/4NHD9XpwbEPfEqjJ01R0XecDYcz8lvhFMSEkwJIBaU76AZA+SsST5oHOmidqvsHQieYk6ya/ucysT/pPon6yLum/5tXN4uV45ocAKHEeWFdQYcpKKb4wNnH/xMTUjwGYArBofLHfuhfjeO+eXbu+/ms+946JyWl16NAxWmV80AZGImW+M0z/dxWUNbvJNQzaqNK4ro13v/NN9C//doP4gz/+mxKAWWNQb2hHzL/s0n1XDfT3W3fe8wRAVmLytCE56HM3LL/E+bRqb+niFZ9rSvD0nnHzd2Y+M3vs5Ckwc/S9QQMABgGc0cvS9fU8migi0uUDey7asfvQ4eMQlouuzs74Am0sL4TZQhHHTpzG8FB/qdRR3DU9M/sUgJqmphfjhJaa9H1v9/Ztw/1PPn0QtWoNs7OzWBltATiOixMnzuCS/bvtgTBwCQXg6s5fNLdTmnkuSAKww0WrS7q6St7E5Ax6egbWWHpow3EcnDs/EX8v6fDw4J4XDhzxASwAEOvSAF2Wu2j3jssAQqVSQ6+ULTQ/W3+pQy/dYHauEi9Sbhsd2gGgqB2xBEDN+gCpy3rCCGjP5OQ0FHO0idGeDTexHRkoxvjEJHZsGxkE0APgnO5TYc6x1hKAIKJtu3dtGzp1+hyKxY5oB6wpDWibIRenTp3D6OhQl5RyMAiC5w0TRCtpACW+rM8aGR7cPzTYX3ziqQPw/dzmm4gtYOaYGZ7n4cTJs3jVK67xw++l23723AVtURLhaFIDEuGnG47+S33fo8mpWZQ6XUxPT6ONtfeD7dgRj6NQyNHQ0MCOUAA2ANmMBpAhhGJo//eFy6lgFsjn823zsw6cnhyHUhw74kcfe8ozfMCKAkjOAYb27tk5cubsBTiuF3v35h1w2xwpRmgxZrBj+/AIgA4AY7pfsZYGyIi6uzv3hHOArocefQbMwNTUVFsDmjdDIUmcDgfv6OhwH4CIjie0gJfVAF3J2bVjWzgB65TnL0ygs7NrnROwthZUqzWcPHUOV1y2txiuJA/Pzc0/spYJEob5ye/Zs/NiZka5XEVPr4821gfP9xAN3nA9yB4c6Nt+cG5eLvPGDCdNUKNS7769u3ZGX1NfqwfR+s//C/PDnH5TRq+kxun8fBkdxQJGhgd2Hjx01BBAwgQl7L/I5fyd4RJE3+TUdNjIPKSc0AJg/T+JxNNnK5Uly3VuterJOpzh3hmts5DWKExy3/j6l2J4eAAjI4PbjG9UF6YQrMaBWRCufu4fHRn0Bvp7USzkUS4vmD9as+IP3cSHWL5eXGTUizk6v/IDubodM7+++qs+ENbsg2RxLlE/5pr1Ew8H25aFnp6u2CFvGx0e0JHQGdMEJTWgkTo7d4xe3NfXg1KpiLe86TWg9ONtc3eKuVX3yatei5m1AIa6pRT9QaCeb2YporBzx7Zd0chnRkgKbaSLsMLZcK6/rzecU53n5TSAEkw/HPkFy86BpJtq3LRBIK6jq7NDhPOqPi0A0+cuuxq6EMas5bGJaVQWFWgTbrqVTdEX9f4ZvmfB9/3Il5bW2hNmnZbDB4omLpw/h7n5RYCa+3E0ToY4Jp9XiGSYk/WMvHmlxDEn7yN5ffN4mTzrM808G+0leJqVbG81njbfjFJHHr4no4lZ3fjRT06GoWxQ+eFHn7rTz/1Tv5QSrBQpZrAmfVMaQJyNOXHOPESjztJfs54uxFJWl5q1zYuZRzD+RzAPEufoJFln2TyMv8axwUheJPGRVSMFEHe4ZckqMy8cOXLin5f7xVUyyPypwhKAHp13IjJCVW4iHGAz30Q5mmx3I+dwyvbWE36x0ck1AFW9Gb+g06qmWkMQVuLEQEtuVldyjR/vFJqyjxNb6+mTA6DV96HMvkx0ej2pAZZxoBL5QJ8oDKIW3jxnfA5twj1xUhPMjjd9wGpOOEgIgUzaxFG8RZ4FTgxos9N1atajtd+S1LytA26p8NKbQE7/0+BtpNakNtpoo4022vgf7lRPtKCE39oAAAAASUVORK5CYII="),L.resource.add("hterm/concat/date","text/plain","Mon, 26 Nov 2018 08:50:10 +0000"),L.resource.add("hterm/changelog/version","text/plain","2018-10-24"),L.resource.add("hterm/changelog/date","text/plain","1.82"),L.resource.add("hterm/git/HEAD","text/plain","03ee0980444a38a97ef947b2272e44fdb3bdf5f5");var z=/(?:\x1b)([`0-9\-=~!@#$%^&*\(\)_+\[\]\\{}|;':",.//<>?a-zA-Z])/,W=new RegExp("^"+z.source+"$"),K=new RegExp("(?:+)(O|N|\\[|\\[\\[)(?:"+["(\\d+)(?:;(\\d+))?([~^$])","(?:M([@ #!a`])(.)(.))","(?:1;)?(\\d+)?([a-zA-Z])"].join("|")+")"),H=new RegExp("^"+K.source),j=new RegExp([K.source,z.source,/\x1b./.source].join("|"));function G(e,t){if(!function(e){return/\x1b\[M/.test(e)||/\x1b\[M([\x00\u0020-\uffff]{3})/.test(e)||/\x1b\[(\d+;\d+;\d+)M/.test(e)||/\x1b\[<(\d+;\d+;\d+)([mM])/.test(e)||/\x1b\[<(\d+;\d+;\d+;\d+)&w/.test(e)||/\x1b\[24([0135])~\[(\d+),(\d+)\]\r/.test(e)||/\x1b\[(O|I)/.test(e)}(e)){for(var r,o=[];r=j.exec(e);)(o=o.concat(e.slice(0,r.index).split(""))).push(r[0]),e=e.slice(r.index+r[0].length);(o=o.concat(e.split(""))).forEach((function(e){var r,o={sequence:e,name:null,ctrl:!1,meta:!1,shift:!1,fullName:"",code:null,ch:null};if("\r"===e)o.name="return";else if("\n"===e)o.name="linefeed";else if("\t"===e)o.name="tab";else if("\b"===e||""===e||""===e||"\b"===e)o.name="backspace",o.meta=""===e.charAt(0);else if(""===e||""===e)o.name="escape",o.meta=2===e.length;else if(" "===e||" "===e)o.name="space",o.meta=2===e.length;else if(1===e.length&&e<="")o.name=String.fromCharCode(e.charCodeAt(0)+64).toLowerCase(),o.ctrl=!0;else if(1===e.length&&e>="a"&&e<="z")o.name=e;else if(1===e.length&&e>="A"&&e<="Z")o.name=e.toLowerCase(),o.shift=!0;else if(r=W.exec(e))o.name=r[1].toLowerCase(),o.meta=!0,o.shift=/^[A-Z]$/.test(r[1]);else if(r=H.exec(e)){var n=(r[1]||"")+(r[2]||"")+(r[4]||"")+(r[9]||""),i=(r[3]||r[8]||1)-1;switch(o.ctrl=!!(4&i),o.meta=!!(10&i),o.shift=!!(1&i),o.code=n,n){case"OP":o.name="f1";break;case"OQ":o.name="f2";break;case"OR":o.name="f3";break;case"OS":o.name="f4";break;case"[11~":o.name="f1";break;case"[12~":o.name="f2";break;case"[13~":o.name="f3";break;case"[14~":o.name="f4";break;case"[[A":o.name="f1";break;case"[[B":o.name="f2";break;case"[[C":o.name="f3";break;case"[[D":o.name="f4";break;case"[[E":case"[15~":o.name="f5";break;case"[17~":o.name="f6";break;case"[18~":o.name="f7";break;case"[19~":o.name="f8";break;case"[20~":o.name="f9";break;case"[21~":o.name="f10";break;case"[23~":o.name="f11";break;case"[24~":o.name="f12";break;case"[A":o.name="up";break;case"[B":o.name="down";break;case"[C":o.name="right";break;case"[D":o.name="left";break;case"[E":o.name="clear";break;case"[F":o.name="end";break;case"[H":o.name="home";break;case"OA":o.name="up";break;case"OB":o.name="down";break;case"OC":o.name="right";break;case"OD":o.name="left";break;case"OE":o.name="clear";break;case"OF":o.name="end";break;case"OH":case"[1~":o.name="home";break;case"[2~":o.name="insert";break;case"[3~":o.name="delete";break;case"[4~":o.name="end";break;case"[5~":o.name="pageup";break;case"[6~":o.name="pagedown";break;case"[[5~":o.name="pageup";break;case"[[6~":o.name="pagedown";break;case"[7~":o.name="home";break;case"[8~":o.name="end";break;case"[a":o.name="up",o.shift=!0;break;case"[b":o.name="down",o.shift=!0;break;case"[c":o.name="right",o.shift=!0;break;case"[d":o.name="left",o.shift=!0;break;case"[e":o.name="clear",o.shift=!0;break;case"[2$":o.name="insert",o.shift=!0;break;case"[3$":o.name="delete",o.shift=!0;break;case"[5$":o.name="pageup",o.shift=!0;break;case"[6$":o.name="pagedown",o.shift=!0;break;case"[7$":o.name="home",o.shift=!0;break;case"[8$":o.name="end",o.shift=!0;break;case"Oa":o.name="up",o.ctrl=!0;break;case"Ob":o.name="down",o.ctrl=!0;break;case"Oc":o.name="right",o.ctrl=!0;break;case"Od":o.name="left",o.ctrl=!0;break;case"Oe":o.name="clear",o.ctrl=!0;break;case"[2^":o.name="insert",o.ctrl=!0;break;case"[3^":o.name="delete",o.ctrl=!0;break;case"[5^":o.name="pageup",o.ctrl=!0;break;case"[6^":o.name="pagedown",o.ctrl=!0;break;case"[7^":o.name="home",o.ctrl=!0;break;case"[8^":o.name="end",o.ctrl=!0;break;case"[Z":o.name="tab",o.shift=!0;break;default:o.name=null}}1===e.length&&(o.ch=e);let s=o.name||"";o.shift&&(s="S-"+s),o.meta&&(s="M-"+s),o.ctrl&&(s="C-"+s),o.fullName=s,t(o)}))}}const q={keyStrokeDelay:200,lingerDelay:1e3,fadeDuration:1e3,bezelColor:"#000",textColor:"#fff",position:"top-right"};let Q={right:"→",left:"←",up:"↑",down:"↓",space:"␣",enter:"↩",return:"↩",linefeed:"C-j",shift:"S-",ctrl:"C-",tab:"⇥",escape:"⎋",pagedown:"⇟",pageup:"⇞",home:"↖",end:"↘",delete:"⌦",backspace:"⌫",meta:"M-"};var $=new class{constructor(){this.initialized=!1,this.container=null,this.style=null,this.options=q,this.currentChunk=null,this._onKey=e=>{if(!this.container)return;this.currentChunk||(this.currentChunk=document.createElement("li"),0===this.options.position.indexOf("top")?this.container.insertBefore(this.currentChunk,this.container.childNodes[0]):this.container.appendChild(this.currentChunk));var t="";e.ctrl&&(t+=Q.ctrl),e.meta&&(t+=Q.meta),e.shift&&(t+=Q.shift);let r=(e.name||"").replace(/^[CMS]-/,"");this.currentChunk.textContent+=t+(Q[r]||r||e.ch);var o=this.options;clearTimeout(this.keyStrokeTimeout),this.keyStrokeTimeout=setTimeout(()=>{!function(e){setTimeout(()=>{e.style.opacity=0,setTimeout(()=>{e.parentNode.removeChild(e)},o.fadeDuration)},o.lingerDelay)}(this.currentChunk),this.currentChunk=null},o.keyStrokeDelay)}}cleanUp(){function e(e){e&&e.parentNode&&e.parentNode.removeChild(e)}e(this.container),e(this.style),clearTimeout(this.keyStrokeTimeout),this.currentChunk=null,this.container=this.style=null}injectComponents(){this.container=document.createElement("ul");let e=document.querySelector("x-screen");e&&e.appendChild(this.container),this.container.className="keystrokes";const t={"bottom-left":"bottom: 0;","bottom-right":"bottom: 0; direction: rtl;","top-left":"top: 0;","top-right":"top: 0; direction: rtl;"};t[this.options.position]||(console.warn(`Invalid position '${this.options.position}', using default 'bottom-left'. Valid positions: `,Object.keys(t)),this.options.position="bottom-left"),this.style=document.createElement("style"),this.style.innerHTML=`\n ul.keystrokes {\n padding: 0 10px;\n position: fixed;\n left: 0;\n right: 0;\n ${t[this.options.position]}\n }\n\n ul.keystrokes li {\n direction: ltr;\n background-color: ${this.options.bezelColor};\n opacity: 0.9;\n color: ${this.options.textColor};\n padding: 5px 10px;\n margin-bottom: 5px;\n border-radius: 15px;\n opacity: 1;\n display: table;\n -webkit-transition: opacity ${this.options.fadeDuration}ms linear;\n transition: opacity ${this.options.fadeDuration}ms linear;\n }`,document.body.appendChild(this.style)}processInput(e){G(e,this._onKey)}enable(e){this.cleanUp(),this.options=Object.assign({},q,e||this.options),this.injectComponents()}disable(){this.cleanUp()}},J=o(1),X=o.n(J),Y=/[\x1b\x07]/;function Z(e,t){!e.codingSystemUtf8_&&e[e.GL].GL&&(t=e[e.GL].GL(t)),e.terminal.print(t)}U.VT.prototype.parseUntilStringTerminator_=function(e){var t=e.peekRemainingBuf(),r=e.args;let 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);const n=t.search(Y),i=t.charAt(n);let s;var a;return(s=(""!=i||"\\"===t.charAt(n+1))&&-1!==n)?(r[0]+=t.substr(0,n),e.resetParseFunction(),e.advance(n+(""==i?2:1)-o),!0):(r[0]+=t,""==i&&n!=t.length-1&&(a="embedded escape: "+n),new Date-r[1]>this.oscTimeLimit_&&(a="timeout expired: "+(new Date-r[1])),a?(this.warnUnimplemented&&console.log("parseUntilStringTerminator_: aborting: "+a,r[0]),e.reset(r[0]),!1):(e.advance(t.length-o),!0))},U.VT.prototype.dispatch=function(e,t,r){var o=ae.get(e).get(t);o?o!==U.VT.ignore?!r.subargs||o.supportsSubargs?"CC1"===e&&t>""&&!this.enable8BitControl?console.warn("Ignoring 8-bit control code: 0x"+t.charCodeAt(0).toString(16)):o.call(this,r,t):this.warnUnimplemented&&console.warn("Ignored "+e+" code w/subargs: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t))},U.VT.ParseState.prototype.peekRemainingBuf=function(){return this.buf.substr(this.pos)},U.VT.ParseState.prototype.peekChar=function(){return this.buf.charAt(this.pos)},U.VT.ParseState.prototype.consumeChar=function(){return this.buf.charAt(this.pos++)},U.VT.prototype.parseUnknown_=function(e){var t=e.peekRemainingBuf(),r=t.search(this.cc1Pattern_);return 0===r?(this.dispatch("CC1",t.charAt(0),e),void e.advance(1)):-1===r?(Z(this,t),void e.reset()):(Z(this,t.substr(0,r)),this.dispatch("CC1",t.charAt(r),e),void e.advance(r+1))};var ee,te=[],re=null,oe=!1;function ne(){X.a.unstable_deferredUpdates(ie)}function ie(){for(var e=ee,t=Date.now()+10;;){if(null===re){if(null==(n=te.shift()))break;e.parseState_.resetBuf(n),re=e.parseState_}for(;!re.isComplete();){var r=e.parseState_.func,o=e.parseState_.pos,n=e.parseState_.buf;if(e.parseState_.func.call(e,e.parseState_),e.parseState_.func==r&&e.parseState_.pos==o&&e.parseState_.buf==n)throw oe=!1,re=null,"Parser did not alter the state!";if(t="@"&&t<="~"?(this.dispatch("CSI",this.leadingModifier_+this.trailingModifier_+t,e),se(e)):";"===t?this.trailingModifier_?se(e):(r.length||r.push(""),r.push("")):t>="0"&&t<="9"||":"===t?this.trailingModifier_?se(e):(r.length?r[r.length-1]+=t:r[0]=t,":"===t&&e.argSetSubargs(r.length-1)):t>=" "&&t<="?"?r.length?this.trailingModifier_+=t:this.leadingModifier_+=t:this.cc1Pattern_.test(t)?this.dispatch("CC1",t,e):se(e),e.advance(1)};var ae=new Map;function le(e){var t=e.consumeChar();""!=t&&(this.dispatch("ESC",t,e),e.func==le&&e.resetParseFunction())}U.VT.ParseState.prototype.resetArguments=function(){this.args=[]},U.VT.ParseState.prototype.parseInt=function(e,t){if(e){const r=parseInt(e,10);return 0===r?(void 0===t&&(t=0),t):r}return void 0===t&&(t=0),t},U.VT.prototype.parseSgrExtendedColors=function(e,t,r){let o,n;if(e.argHasSubargs(t))(o=e.args[t].split(":")).shift(),n=!0;else{if(e.argHasSubargs(t+1))return{skipCount:0};if(5===parseInt(e.args[t+1],10))return function(e,t,r){if(e.length-t+1<2)return{skipCount:0};const o=parseInt(e[t+2],10);return o{const t=e.match(/^([^=]+)=(.*)$/m);if(t)switch(t[1]){case"name":try{o.name=window.atob(t[2])}catch(e){}break;case"size":try{o.size=parseInt(t[2])}catch(e){}break;case"width":o.width=t[2];break;case"height":o.height=t[2];break;case"preserveAspectRatio":o.preserveAspectRatio=!("0"==t[2]);break;case"inline":o.inline=!("0"==t[2]);break;case"align":o.align=t[2]}}),o.inline){const t=this.terminal.io,r=e.peekRemainingBuf();e.advance(r.length),this.terminal.displayImage(o),t.writeUTF8(r)}else this.terminal.displayImage(o)},U.VT.OSC[4]=function(e){for(var t=e.args[0].split(";"),r=parseInt(t.length/2),o=this.terminal.getTextAttributes().colorPalette,n=[],i=0;i=o.length||("?"!=a?(a=L.colors.x11ToCSS(a))&&(o[s]=a):(a=L.colors.rgbToX11(o[s]))&&n.push(s+";"+a))}n.length&&this.terminal.io.sendString("]4;"+n.join(";")+""),this.terminal.getTextAttributes().refreshCSSPalette()},U.VT.OSC[10]=function(e){var t=e.args[0].split(";");if(t){var r=t.shift();if("?"==r){var o=L.colors.rgbToX11(this.terminal.getForegroundColor());o&&this.terminal.io.sendString("]10;"+o+"\\")}else{var n=L.colors.x11ToCSS(r);n&&this.terminal.setForegroundColor(n),this.terminal.getTextAttributes().refreshCSSPalette()}t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[11].apply(this,[e]))}},U.VT.OSC[11]=function(e){var t=e.args[0].split(";");if(t){var r=t.shift();if("?"==r){var o=L.colors.rgbToX11(this.terminal.getBackgroundColor());o&&this.terminal.io.sendString("]11;"+o+"\\")}else{var n=L.colors.x11ToCSS(r);n&&this.terminal.setBackgroundColor(n),this.terminal.getTextAttributes().refreshCSSPalette()}t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[12].apply(this,[e]))}},["CC1","ESC","CSI","OSC","VT52"].forEach(e=>{var t=new Map,r=U.VT[e];Object.keys(r).map(e=>{t.set(e,r[e])}),ae.set(e,t)});var ce=o(0),ue=o.n(ce);const he=300;for(var de=new Array(256),pe=new Array(256),fe=new Array(256),ge="b",me="i",be="blink-node",_e="u",ye="s",we="us",ve={solid:"u1",double:"u2",wavy:"u3",dotted:"u4",dashed:"u5"},Ce=0;Ce<256;Ce++)de[Ce]="c"+Ce,pe[Ce]="bc"+Ce,fe[Ce]="uc"+Ce;const Se=/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/;class ke extends ue.a.Component{constructor(){super(...arguments),this._v=-1}render(){const e=this.props.node,t=e.attrs;if(this._v=e.v,t.isDefault)return e.txt;let r=[];var o=null;t.fci>=0?r.push(de[t.fci]):void 0!==t.fcs&&((o=o||{}).color=t.fcs),t.bci>=0?r.push(pe[t.bci]):void 0!==t.bcs&&((o=o||{}).backgroundColor=t.bcs),t.uci>=0?r.push(fe[t.uci]):void 0!==t.ucs&&((o=o||{}).textDecorationColor=t.ucs),t.bold&&r.push(ge),t.italic&&r.push(me),t.blink&&r.push(be),t.underline?(t.strikethrough?r.push(we):r.push(_e),r.push(ve[t.underline])):t.strikethrough&&r.push(ye),t.asciiNode||(t.wcNode?Se.test(e.txt)?r.push("wc wc-node emoji"):r.push("wc wc-node"):e.wcwi.rowIndex)r();else if(o.focusNode==o.anchorNode)o.anchorOffset{this.allowScrollButtonsToDisplay_=!0},500),this.document_.addEventListener("selectionchange",()=>{if(this.selection.sync(),!this.allowScrollButtonsToDisplay_)return;const e=this.accessibilityReader_&&this.accessibilityReader_.accessibilityEnabled,t=this.document_.getSelection();let r;t.anchorNode&&t.anchorNode.parentElement&&(r=t.anchorNode.parentElement),e&&r==this.scrollUpButton_?this.scrollUpButton_.style.top="0px":this.scrollUpButton_.style.top="-32px",e&&r==this.scrollDownButton_?this.scrollDownButton_.style.bottom="0px":this.scrollDownButton_.style.bottom="-32px"}),this.screen_.appendChild(this.scrollUpButton_),this.rowNodes_=e.createElement("div"),this.rowNodes_.id="hterm:row-nodes",this.rowNodes_.style.cssText="display: block;position: absolute;top: 0;left: 0;right: 0;bottom: 0;background-color: inherit;overflow: hidden;-webkit-user-select: text;-moz-user-select: text;",this.screen_.appendChild(this.rowNodes_),this.topSelectBag_=e.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_=e.createElement("x-fold"),this.topFold_.id="hterm:top-fold-for-row-selection",this.topFold_.style.cssText="display: block;",this.rowNodes_.appendChild(this.topFold_),this._renderDom=e.createElement("div"),this._renderDom.id="hterm:renderer",this.rowNodes_.appendChild(this._renderDom),this.renderRef=X.a.render(ue.a.createElement(Pe),this._renderDom),this.bottomFold_=this.topFold_.cloneNode(),this.bottomFold_.id="hterm:bottom-fold-for-row-selection",this.rowNodes_.appendChild(this.bottomFold_);var o=this;Re=U.getClientSize(this.screen_),this.scroller_=new Ae((function(e,t,r){Ee!==t&&(Ee=t||0,o.onScroll_())}),window.t),this.scroller_.setDimensions(Re.width,Re.height,Re.width,Re.height);var n="http://www.w3.org/2000/svg";this.svg_=window.document.createElementNS(n,"svg"),this.svg_.id="hterm:zoom-detector",this.svg_.setAttribute("xmlns",n),this.svg_.setAttribute("version","1.1"),this.svg_.style.cssText="position: absolute;top: 0;left: 0;visibility: hidden",this.pasteTarget_=e.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()},U.ScrollPort.prototype.on_touchstart_=function(e){},U.ScrollPort.prototype.on_touchmove_=function(e){},U.ScrollPort.prototype.on_touchend_=function(e){},U.ScrollPort.prototype.on_touchcancel_=function(e){},U.ScrollPort.prototype.focus=function(){},U.ScrollPort.prototype.getScreenSize=function(){return Re},U.ScrollPort.prototype.resetCache=function(){},U.ScrollPort.prototype.setRowProvider=function(e){this.resetCache(),this.rowProvider_=e,this.scheduleRedraw()},U.ScrollPort.prototype.invalidate=function(){var e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);this.drawVisibleRows_(e,t)},U.ScrollPort.prototype.scheduleInvalidate=function(){if(!this.timeouts_.invalidate){var e=this;this.timeouts_.invalidate=setTimeout((function(){e.timeouts_.invalidate=0,e.invalidate()}),0)}};var Me="";U.ScrollPort.prototype.syncRowNodesDimensions_=function(){var e=this.getScreenSize();this.lastScreenWidth_=e.width,this.lastScreenHeight_=e.height,this.visibleRowCount=L.f.smartFloorDivide(e.height,this.characterSize.height);var t=this.visibleRowCount*this.characterSize.height;this.visibleRowTopMargin=0,this.visibleRowBottomMargin=e.height-t;var r="";Ee<0&&(r="translate3d(0, "+-Ee+"px, 0)"),r!==Me&&(Me=r,this.rowNodes_.style.transform=r,this.rowProvider_.cursorOverlayNode_&&(this.rowProvider_.cursorOverlayNode_.style.transform=r))};var Ne=0;U.ScrollPort.prototype.syncScrollHeight=function(){this.lastRowCount_=this.rowProvider_.getRowCount();var e=this.characterSize.height*this.lastRowCount_+this.visibleRowTopMargin+this.visibleRowBottomMargin;Ne!==e&&(Ne=e,this.scroller_.setDimensions(Re.width,Re.height,Re.width,Ne))},U.ScrollPort.prototype.scheduleRedraw=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=requestAnimationFrame((function(){e.timeouts_.redraw=0,e.redraw_()}))}},U.ScrollPort.prototype.redraw_=function(){this.syncScrollHeight();var e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);this.drawVisibleRows_(e,t),this.syncRowNodesDimensions_(),this.isScrolledEnd=this.getTopRowIndex()+this.visibleRowCount>=this.lastRowCount_},U.ScrollPort.prototype.drawVisibleRows_=function(e,t){for(var r=Math.min(this.visibleRowCount,this.rowProvider_.getRowCount()),o=[],n=0;n=this.lastRowCount_;var t=e*this.characterSize.height+this.visibleRowTopMargin,r=this.getScrollMax_();t>r&&(t=r),Ee!==t&&(this.scroller_.scrollTo(0,t),this.scheduleRedraw())},U.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),Ee!==t&&this.scroller_.scrollTo(0,t)},U.ScrollPort.prototype.scrollToBottom=function(){this.syncScrollHeight(),this.scroller_.scrollTo(0,Ne-Re.height,!1)},U.ScrollPort.prototype.getTopRowIndex=function(){var e=Math.round(Ee/this.characterSize.height);return e<0?0:e};var Ie=-1,De=-1;function Oe(e,t){var r=(Oe.canvas||(Oe.canvas=document.createElement("canvas"))).getContext("2d");r.font=t;var o=r.measureText(e);return{width:o.width,height:o.fontBoundingBoxAscent+o.fontBoundingBoxDescent}}U.ScrollPort.prototype.onScroll_=function(e){var t=this.getScreenSize();if(t.width==this.lastScreenWidth_&&t.height==this.lastScreenHeight_){var r=Math.round(Ee/this.characterSize.height),o=this.getBottomRowIndex(r);Ie===r&&De===o||(Ie=r,De=o,this.redraw_(),this.publish("scroll",{scrollPort:this}))}else this.resize()},U.ScrollPort.prototype.onScrollWheel=function(e){},U.ScrollPort.prototype.onResize_=function(e){Re=U.getClientSize(this.screen_),this.scroller_.setDimensions(Re.width,Re.height,null,Ne),this.syncCharacterSize()},U.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,r,o=this.getTopRowIndex(),n=this.getBottomRowIndex(o);if(this.selection.startRow.rowIndexn)r=this.selection.startRow.rowIndex>n?this.selection.startRow.rowIndex+1:this.bottomFold_.previousSibling.rowIndex+1,this.bottomSelectBag_.textContent=this.rowProvider_.getRowsText(r,this.selection.endRow.rowIndex),this.rowNodes_.insertBefore(this.bottomSelectBag_,this.selection.endRow)}},U.ScrollPort.prototype.measureCharacterSize=function(e){var t,r="canvas"!==window.fontSizeDetectionMethod;if(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;",r&&(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.rulerBaseline_.id="hterm:ruler-baseline",this.rulerBaseline_.style.fontSize="0px",this.rulerBaseline_.textContent="X"),this.rulerSpan_&&(this.rulerSpan_.style.fontWeight=e||""),this.rowNodes_.appendChild(this.ruler_),r){var o=U.getClientSize(this.rulerSpan_);t=new U.Size(o.width/100,o.height/100)}else{var n=this.screen_.style.font;0==n.length&&(n=`${this.screen_.style.fontWeight} ${this.screen_.style.fontSize} ${this.screen_.style.fontFamily}`);var i=Oe("QWER1YUIOX".repeat(10),n);t=new U.Size(i.width/100,i.height)}return this.ruler_.insertBefore(this.rulerBaseline_,this.ruler_.childNodes[0]),t.baseline=this.rulerBaseline_.offsetTop,this.ruler_.removeChild(this.rulerBaseline_),this.rowNodes_.removeChild(this.ruler_),this.div_.ownerDocument.body.appendChild(this.svg_),t.zoomFactor=this.svg_.currentScale,this.div_.ownerDocument.body.removeChild(this.svg_),t},U.ScrollPort.prototype.resize=function(e=!1){this.currentScrollbarWidthPx=U.getClientWidth(this.screen_)-this.screen_.clientWidth,this.syncScrollHeight(),this.syncRowNodesDimensions_();var t=this;this.publish("resize",{scrollPort:this},(function(){t.scroller_.setDimensions(Re.width,Re.height,Re.width,Ne);var r=Ne-Re.height;r<0&&(r=0),t.scroller_.scrollTo(0,r,!1,e),t.scheduleRedraw()}))},U.ScrollPort.prototype.updateScrollButtonState_=function(){};let Ve=0;function Be(e){e.v=(e.v+1)%1e6}function Le(){return Ve++%1e6}function Ue(e,t,r){return e.attrs.asciiNode?e.txt.substr(t,r):L.wc.substr(e.txt,t,r)}function ze(e){let t=0;const r=e.nodes,o=r.length;for(var n=0;nt)break;i+=r<=65535?1:2}if(null!=r){for(o=i,n=0;or)break;o+=t<=65535?1:2}return e.substring(i,o)}return e.substr(i)},L.wc.strWidth=function(e){var t,r=e.length,o=0,n=e.search(Xe);if(n<0)return r;var i=n;for(o=n;i2e4&&(Ye=new Map),Ye.set(e,t)),t},U.Screen.prototype.invalidateCursorPosition=function(){this.cursorPosition.move(0,0),this.cursorRowIdx_=0,this.cursorNodeIdx_=0,this.cursorOffset_=0},U.Screen.prototype.clearCursorRow=function(){var e;this.cursorOffset_=0,this.cursorPosition.column=0,this.cursorPosition.overflow=!1,e=this.textAttributes.isDefault()?"":L.f.getWhitespace(this.columnCount_);var t=this.textAttributes.inverse;this.textAttributes.inverse=!1,this.textAttributes.syncColors();var r=$e(this.textAttributes.attrs(),e,e.length),o=this.rowsArray[this.cursorRowIdx_];o.nodes=[r],o.o=!1,o.img&&(o.img=null),Be(o),this.cursorNodeIdx_=0,this.textAttributes.inverse=t,this.textAttributes.syncColors()},U.Screen.prototype.commitLineOverflow=function(){var e=this.rowsArray[this.cursorRowIdx_];e.o=!0,Be(e)},U.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=0,n=r.nodes[0];n||(n=Qe("",0),r.nodes=[n],Be(r));var i=0;if(e===this.cursorRowIdx_?t>=this.cursorPosition.column-this.cursorOffset_&&(o=this.cursorNodeIdx_,n=r.nodes[o],i=this.cursorPosition.column-this.cursorOffset_):this.cursorRowIdx_=e,this.cursorPosition.move(e,t),0===t)return this.cursorNodeIdx_=0,void(this.cursorOffset_=0);for(;n;){var s=t-i;if(!r.nodes[o+1]||n.wcw>s)return this.cursorNodeIdx_=o,void(this.cursorOffset_=s);i+=n.wcw,n=r.nodes[++o]}}else console.warn("Attempt to set cursor position on empty screen.")},U.Screen.prototype.syncSelectionCaret=function(e){let t=window._kb.caret;if(t){if(e.isCollapsed&&e.focusNode===t&&0===e.focusOffset)return;e.collapse(t,0)}},U.Screen.prototype.cursorRow=function(){return this.rowsArray[this.cursorRowIdx_]},U.Screen.prototype.maybeClipCurrentRow=function(){var e=this.cursorRow(),t=ze(e);if(t<=this.columnCount_)this.cursorPosition.column>=this.columnCount_&&(this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1),this.cursorPosition.overflow=!0);else{var r=this.cursorPosition.column;this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1);var o=this.rowsArray[this.cursorRowIdx_].nodes[this.cursorNodeIdx_];t=o.wcw,this.cursorOffset_=0||n.attrs.bcs||n.attrs.underline||n.attrs.strikethrough))je(n,s+=c,n.wcw-l);else{var u=qe(c,-l);this.cursorNodeIdx_++,o.nodes.splice(this.cursorNodeIdx_,0,u),n=u,this.cursorOffset_=a=-l,s=c}l=0}if(Je(n,r)){if(0===l)Ge(r,n,s+e),o.nodes[this.cursorNodeIdx_+1]||(i=0);else if(0===a){const s=t-n.wcw;s>=0?(Ge(r,n,e,t),i=o.nodes[this.cursorNodeIdx_+1]?s:0):(Ge(r,n,e+Ue(n,t)),i=0)}else{const o=t+a-n.wcw;if(o>=0)Ge(r,n,Ue(n,0,a)+e),i=o;else Ge(r,n,Ue(n,0,a)+e+Ue(n,a+t)),i=0}return this.cursorOffset_+=t,i}if(0===a){var h=o.nodes[this.cursorNodeIdx_-1];if(h&&Je(h,r)){Ge(r,h,h.txt+e);const s=t-n.wcw;return s>=0?(o.nodes.splice(this.cursorNodeIdx_,1),i=s):n.attrs.wcNode||(je(n,Ue(n,t)),i=0),this.cursorNodeIdx_=this.cursorNodeIdx_-1,this.cursorOffset_=h.wcw,i}var d=$e(r,e,t);this.cursorOffset_=t;const s=t-n.wcw;return s>=0?(o.nodes.splice(this.cursorNodeIdx_,1,d),i=s):(o.nodes.splice(this.cursorNodeIdx_,0,d),je(n,Ue(n,t)),i=0),i}if(0===l){var p=o.nodes[this.cursorNodeIdx_+1];if(p&&Je(p,r)){const o=t-p.wcw;return o>=0?(Ge(r,p,e,t),i=o):(Ge(r,p,e+Ue(p,t)),i=0),this.cursorNodeIdx_++,this.cursorOffset_=t,i}return d=$e(r,e,t),o.nodes.splice(this.cursorNodeIdx_+1,0,d),this.cursorNodeIdx_++,p||(i=0),this.cursorOffset_=d.wcw,i}const f=a+t-n.wcw;if(f>=0){je(n,Ue(n,0,a));d=$e(r,e,t);return this.cursorNodeIdx_++,o.nodes.splice(this.cursorNodeIdx_,0,d),this.cursorOffset_=t,i=f}var g=et(n,a,d=$e(r,e,t)),m=g.length;return 1===m?o.nodes.splice(this.cursorNodeIdx_,1,g[0]):2===m?o.nodes.splice(this.cursorNodeIdx_,1,g[0],g[1]):3===m&&(o.nodes.splice(this.cursorNodeIdx_,1,g[0],g[1],g[2]),this.cursorNodeIdx_++),this.cursorNodeIdx_++,this.cursorOffset_=0,i},U.Screen.prototype.insertString=function(e,t){var r=this.rowsArray[this.cursorRowIdx_],o=r.nodes[this.cursorNodeIdx_],n=o.txt;const i=this.textAttributes.attrs();r.o=!1,this.cursorPosition.column+=t;var s=this.cursorOffset_,a=o.wcw-s;if(a<0){var l=L.f.getWhitespace(-a);if(o.attrs.isDefault||!(!o.attrs.asciiNode||o.attrs.wcNode||o.attrs.bci>=0||o.attrs.bcs||o.attrs.underline||o.attrs.strikethrough))je(o,n+=l,o.wcw-a);else{var c=qe(l,-a);this.cursorNodeIdx_++,r.nodes.splice(this.cursorNodeIdx_,0,c),o=c,this.cursorOffset_=s=-a,n=l}a=0}if(Je(o,i)){if(0===a)Ge(i,o,n+e);else if(0===s)Ge(i,o,e+n);else{Ge(i,o,Ue(o,0,s)+e+Ue(o,s))}this.cursorOffset_+=t}else{if(0===s){var u=r.nodes[this.cursorNodeIdx_-1];if(u&&Je(u,i))return Ge(i,u,u.txt+e),this.cursorNodeIdx_=this.cursorNodeIdx_-1,void(this.cursorOffset_=u.wcw);var h=$e(i,e,t);return r.nodes.splice(this.cursorNodeIdx_,0,h),void(this.cursorOffset_=t)}if(0===a){var d=r.nodes[this.cursorNodeIdx_+1];return d&&Je(d,i)?(Ge(i,d,e+d.txt),this.cursorNodeIdx_++,void(this.cursorOffset_=t)):(h=$e(i,e,t),r.nodes.splice(this.cursorNodeIdx_+1,0,h),this.cursorNodeIdx_++,void(this.cursorOffset_=h.wcw))}var p=et(o,s,h=$e(i,e,t)),f=p.length;1===f?r.nodes.splice(this.cursorNodeIdx_,1,p[0]):2===f?r.nodes.splice(this.cursorNodeIdx_,1,p[0],p[1]):3===f&&(r.nodes.splice(this.cursorNodeIdx_,1,p[0],p[1],p[2]),this.cursorNodeIdx_++),this.cursorNodeIdx_++,this.cursorOffset_=0}},U.Screen.prototype.overwriteString=function(e,t){if(!(this.columnCount_-this.cursorPosition.column))return[e];var r=this.rowsArray[this.cursorRowIdx_],o=r.nodes[this.cursorNodeIdx_],n=this.textAttributes.attrs(),i=this.cursorOffset_;const s=t+i-o.wcw;if(s<=0&&Je(o,n)){if(this.cursorOffset_+=t,this.cursorPosition.column+=t,0===s&&o.txt.substr(i)===e)return;return Ge(n,o,0===s?Ue(o,0,i)+e:Ue(o,0,i)+e+Ue(o,i+t)),void Be(r)}var a=this.overwriteNode(e,t,n);a>0&&this.deleteChars(a),function(e,t){for(var r=0,o=e.nodes[t],n=o.txt,i=o.wcw,s=o.attrs,a=t+1,l=e.nodes[a];l&&Je(l,s);)n+=l.txt,i+=l.wcw,l.attrs.asciiNode||(s=l.attrs),r++,a++,l=e.nodes[a];r>0&&(Ge(s,o,n,i),e.nodes.splice(t+1,r),Be(e))}(r,this.cursorNodeIdx_),Be(r)},U.Screen.prototype.deleteChars=function(e){for(var t=this.rowsArray[this.cursorRowIdx_],r=this.cursorNodeIdx_,o=0,n=this.cursorOffset_,i=t.nodes.length,s=e,a=this.cursorNodeIdx_;a0){if(c-n===e)return je(l,Ue(l,0,n)),s;if(c-n>e)return je(l,Ue(l,0,n)+Ue(l,n+e)),s;if(je(l,Ue(l,0,n)),!t.nodes[a+1])return s;e-=c-n,n=0,r++}else{if(!(c<=e)){if(je(l,Ue(l,e)),l.attrs.wcNode&&c===l.wcw){var u=Qe(" ",1);e-=1,t.nodes.splice(a,1,u)}break}o++,e-=c}}return 0===o?s:(t.nodes.splice(r,o),r>this.cursorNodeIdx_?s:0===(i=t.nodes.length)?(t.nodes=[Qe("",0)],this.cursorNodeIdx_=0,this.cursorOffset_=0,s):i<=this.cursorNodeIdx_?(this.cursorNodeIdx_=i-1,this.cursorOffset_=t.nodes[i-1].wcw,s):(this.cursorOffset_=0,s))},U.Screen.prototype.popRow=function(){return this.rowsArray.pop()},U.Screen.prototype.popRows=function(e){return this.rowsArray.splice(this.rowsArray.length-e,e)},U.Screen.prototype.pushRow=function(e){this.rowsArray[this.rowsArray.length]=e},U.Screen.prototype.setRow=function(e,t){this.rowsArray[t]=e},U.Screen.prototype.pushRows=function(e){for(var t=0,r=this.rowsArray.length,o=e.length;t{e.addEventListener(t,()=>{this.hasUserGesture=!0})})},U.AccessibilityReader.prototype.beforeCursorChange=function(e,t,r){this.accessibilityEnabled&&this.hasUserGesture&&!this.cursorIsChanging_&&(this.cursorIsChanging_=!0,this.lastCursorRowString_=e,this.lastCursorRow_=t,this.lastCursorColumn_=r)},U.AccessibilityReader.prototype.afterCursorChange=function(e,t,r){if(this.cursorIsChanging_){if(this.cursorIsChanging_=!1,!this.announceAction_(e,t,r))for(let e=0;e0)this.queue_.push("");else{if(0==this.queue_.length)this.queue_.push(e);else{let t="";0!=this.queue_[this.queue_.length-1].length&&(t=" "),this.queue_[this.queue_.length-1]+=t+e}if(!this.nextReadTimer_){if(1!=this.queue_.length)throw new Error("Expected only one item in queue_ or nextReadTimer_ to be running.");this.nextReadTimer_=setTimeout(this.addToLiveRegion_.bind(this),U.AccessibilityReader.DELAY)}}},U.AccessibilityReader.prototype.assertiveAnnounce=function(e){this.hasUserGesture&&" "==e&&(e=U.msg("SPACE_CHARACTER",[],"Space")),(e=(e||"").trim())==this.assertiveLiveElement_.innerText&&(e="\n"+e),this.clear(),this.assertiveLiveElement_.innerText=e},U.AccessibilityReader.prototype.newLine=function(){this.announce("\n")},U.AccessibilityReader.prototype.clear=function(){this.liveElement_.innerText="",this.assertiveLiveElement_.innerText="",clearTimeout(this.nextReadTimer_),this.nextReadTimer_=null,this.queue_=[],this.cursorIsChanging_=!1,this.cursorChangeQueue_=[],this.lastCursorRowString_=null,this.lastCursorRow_=null,this.lastCursorColumn_=null,this.hasUserGesture=!1},U.AccessibilityReader.prototype.announceAction_=function(e,t,r){if(this.lastCursorRow_!=t)return!1;if(this.lastCursorRowString_==e){if(this.lastCursorColumn_!=r&&""==this.cursorChangeQueue_.join("").trim()){const e=Math.min(this.lastCursorColumn_,r),t=Math.abs(r-this.lastCursorColumn_);return this.assertiveAnnounce(L.wc.substr(this.lastCursorRowString_,e,t)),!0}return!1}if(this.lastCursorRowString_!=e){if(this.lastCursorColumn_+1==r&&" "==L.wc.substr(e,r-1,1)&&this.cursorChangeQueue_.length>0&&" "==this.cursorChangeQueue_[0])return this.assertiveAnnounce(" "),!0;const t=r;if(L.wc.strWidth(e)<=L.wc.strWidth(this.lastCursorRowString_)&&L.wc.substr(this.lastCursorRowString_,0,t)==L.wc.substr(e,0,t)){let r=L.wc.strWidth(e);for(;r>0&&(r!=t&&" "==L.wc.substr(e,r-1,1));--r);const o=L.wc.strWidth(this.lastCursorRowString_)-r,n=r-t;if(L.wc.substr(this.lastCursorRowString_,t+o,n)==L.wc.substr(e,t,n)){const e=L.wc.substr(this.lastCursorRowString_,t,o);if(""!=e)return this.assertiveAnnounce(e),!0}}return!1}return!1},U.AccessibilityReader.prototype.addToLiveRegion_=function(){this.nextReadTimer_=null;let e=this.queue_.join("\n").trim();e==this.liveElement_.innertText&&(e="\n"+e),this.liveElement_.innerText=e,this.queue_=[]};const tt=/^\W*\w+/,rt=/\w+\W*$/,ot=8;class nt{constructor(e){this._cursor=-1,this._lastValue="",this._lastPrompt=[""],this._call=null,this._lines=[],this._total=0,this._found=0,this._response=null,this._prompt=e,this._lastValue=e._value,this._lastPrompt=e._prompt}enter(){let e=this._cursor,t=this._lines.find((function(t){return t.num==e}));t&&(this._prompt._value=t.val,this._prompt._cursor=L.wc.strWidth(t.val),this._prompt._render())}search(){this._cancelCall(),this._response&&this._response.pattern==this._prompt._value||(this._cursor=-1,this._call=window.term_apiRequest("history.search",{pattern:this._prompt._value,before:ot,after:0,cursor:this._cursor}),this._call.then(e=>{if(!e)return;this._response=e,this._lines=e.lines,this._total=e.total,this._found=e.found;let t=e.lines[e.lines.length-1];t&&(this._cursor=t.num),this.render()}))}_cancelCall(){this._call&&this._call.cancel(),this._call=null}prev(e){if(this._cancelCall(),e){let e=this._cursor,t=this._lines.findIndex((function(t){return t.num==e}));t>0?(this._cursor=this._lines[t-1].num,this._prompt._render()):(this._call=window.term_apiRequest("history.search",{pattern:this._prompt._value,before:1,after:0,cursor:this._cursor}),this._call.then(e=>{if(!e)return;let t=e.lines[0];t?(this._lines.splice(-1,1),this._lines.splice(0,0,t),this._cursor=t.num,this.render()):this._prompt._term.ringBell()}))}else this._call=window.term_apiRequest("history.search",{pattern:this._lastValue,before:1,after:0,cursor:this._cursor}),this._call.then(e=>{if(!e)return;let t=e.lines[0];t?(this._cursor=t.num,this._prompt._value=t.val,this._prompt._cursor=L.wc.strWidth(t.val),this._prompt._render()):this._prompt._term.ringBell()})}next(e){if(e){let e=this._cursor,t=this._lines.findIndex((function(t){return t.num==e}));t{if(!e)return;let t=e.lines[1];t?(this._lines.splice(0,1),this._lines.push(t),this._cursor=t.num,this.render()):this._prompt._term.ringBell()}))}else{if(this._cancelCall(),-1==this._cursor)return this._prompt._term.ringBell(),void(this._prompt._history=null);this._call=window.term_apiRequest("history.search",{pattern:this._lastValue,before:0,after:2,cursor:this._cursor}),this._call.then(e=>{if(!e)return;let t=e.lines[1];if(!t)return this._prompt._value=this._lastValue,this._prompt._cursor=L.wc.strWidth(this._lastValue),this._prompt._term.ringBell(),void(this._prompt._history=null);this._cursor=t.num,this._prompt._value=t.val,this._prompt._cursor=L.wc.strWidth(t.val),this._prompt._render()})}}reset(){this._cancelCall()}render(){let e=this._prompt._term,t=e.screen_.columnCount_;e.setCursorVisible(!1),e.setCursorPosition(this._prompt._startRow,this._prompt._startCol),e.eraseBelow();let r=L.wc.strWidth(this._prompt._value),o="📖 👀";r>0&&(o="📖 🔍",0==this._lines.length&&(o+=" 🤷")),o=(""+this._found).padStart(6," ")+" of "+this._total+" "+o;e.print(o,!1);let n=r+L.wc.strWidth("> "),i=n/t|0,s=n%t,a=Math.min(ot,this._lines.length),l=a+this._prompt._startRow+i+2-e.screenSize.height;l>0&&(e.appendRows_(l),this._prompt._startRow-=l,e.setCursorPosition(this._prompt._startRow,this._prompt._startCol));for(var c=0;c ",!1),e.print(this._prompt._value,!1),i=(n=this._prompt._cursor+L.wc.strWidth("> "))/t|0,s=n%t,e.setCursorPosition(this._prompt._startRow+i+a+1,s),e.setCursorVisible(!0)}}class it{constructor(e){this._cursor=-1,this._lastValue="",this._call=null,this._response=null,this._n=0,this._lastCursor=-1,this._checkValue=null,this._checkCursor=-1,this._prompt=e,this._lastValue=e._value}complete(e){this._cancelCall();let t=this._prompt._cursor,r=this._prompt._value||"";if(!r.trim()){this._prompt._value="",this._prompt._cursor=L.wc.strWidth(this._prompt._value),this._prompt._hint="",this._prompt._render(),this._prompt._term.interpret("\r\n");let e="line",t={text:"help list-commands"};return void window.webkit.messageHandlers.interOp.postMessage({op:e,data:t})}let o=t,n=r,i=this._n;this._checkCursor==t&&this._checkValue==r?(i+=e,t=this._lastCursor,r=this._lastValue):(i=0,this._lastCursor=t,this._lastValue=r),this._call=window.term_apiRequest("completion.for",{cursor:t,input:r,n:i}),this._call.then(e=>{if(!e)return;if(o!=this._prompt._cursor||n!=this._prompt._value)return;let t=e.result;if(t){let o=r.substr(0,e.pos+e.len);o=r.substr(0,e.pos)+t;let n=L.wc.strWidth(o),s=r.substring(e.pos+e.len);this._prompt._value=[o,s].join(""),this._prompt._cursor=n,this._checkCursor=this._prompt._cursor,this._checkValue=this._prompt._value,this._n=i}else this._checkCursor=-1,this._checkValue=null,this._n=0;if(this._response.hint){let t=r.substr(0,e.start);this._prompt._hintPos=L.wc.strWidth(t),this._prompt._hint=e.hint}else this._prompt._hintPos=0,this._prompt._hint="";this.hint()})}hint(){this._cancelCall();let e=this._prompt._value,t=this._prompt._cursor;this._response&&this._response.input==e||(this._call=window.term_apiRequest("completion.for",{cursor:t,input:this._prompt._value,n:0}),this._call.then(r=>{if(!r)return;if(t!=this._prompt._cursor||e!=this._prompt._value)return;if(this._response=r,this._response.hint){let t=e.substr(0,r.start);this._prompt._hintPos=L.wc.strWidth(t),this._prompt._hint=r.hint}else this._prompt._hintPos=0,this._prompt._hint="";this._prompt._render()}))}_cancelCall(){this._call&&this._call.cancel(),this._call=null}}class st{constructor(e){this._prompt=[""],this._promptLastLine="",this._shell=!1,this._secure=!1,this._cursor=0,this._row=0,this._value="",this._history=null,this._complete=null,this._startCol=0,this._startRow=0,this._historySearchMode=!1,this._hint="",this._hintPos=0,this._onKey=e=>{let t=this._term;switch(e.fullName){case"tab":return void this._completeIfNeeded();case"S-tab":return void this._completeBackIfNeeded();case"M-f":case"M-right":this._forwardWord();break;case"M-b":case"M-left":this._backWord();break;case"C-w":this._deleteBackWord();break;case"M-d":this._deleteForwardWord();break;case"M-u":this._uppercaseForwardWord();break;case"home":case"C-a":this._cursor=0;break;case"end":case"C-e":this._cursor=L.wc.strWidth(this._value);break;case"C-u":this._value=L.wc.substr(this._value,this._cursor),this._cursor=0;break;case"C-l":this._term.reset(),this._resetHistory(),this._startRow=0,this._term.setAutoCarriageReturn(!0);break;case"C-r":this._shell?(this._historySearchMode=!0,this._resetHistory()):t.ringBell();break;case"C-c":this._cursor=0,this._value="";break;case"backspace":if(0==this._cursor)t.ringBell();else{let e=L.wc.substring(this._value,0,this._cursor-1),t=L.wc.substr(this._value,this._cursor);this._value=[e,t].join(""),this._cursor=L.wc.strWidth(e),this._resetHistory()}break;case"C-d":{let e=L.wc.substring(this._value,0,this._cursor),t=L.wc.substr(this._value,this._cursor+1);this._value=[e,t].join("")}break;case"C-b":case"left":this._moveLeft();break;case"C-f":case"right":this._moveRight();break;case"C-k":if(!this._historySearchMode){this._value=L.wc.substring(this._value,0,this._cursor),this._cursor=L.wc.strWidth(this._value),this._resetHistory();break}case"C-p":case"up":return this._moveUp();case"C-n":case"down":return this._moveDown();case"escape":this._historySearchMode=!1;break;case"linefeed":case"C-j":if(this._historySearchMode)return this._moveDown();case"return":case"enter":if(this._historySearchMode)return this._getHistory().enter(),this._historySearchMode=!1,this._resetHistory(),void this._render();this._cursor=L.wc.strWidth(this._value),this._hint="",this._render(),this._term.interpret("\r\n");let r="line",o={text:this._value||""};return void window.webkit.messageHandlers.interOp.postMessage({op:r,data:o});default:if(e.ch){let r=L.wc.strWidth(e.ch),o=L.wc.substring(this._value,0,this._cursor),n=L.wc.substr(this._value,this._cursor);t.accessibilityReader_.assertiveAnnounce(e.ch),this._value=[o,e.ch,n].join(""),this._cursor+=r,this._resetHistory()}}this._searchIfNeeded(),this._hintIfNeeded(),this._render()},this._term=e}_promptRowsAndCols(e,t){if(1==this._prompt.length){let r=e+this._valueStartCol(),o=r/t|0,n=r%t;return n>0&&(o+=1),[o,n]}let r=this._prompt,o=r.length,n=this._startCol+L.wc.strWidth(r[0]),i=n/t|0;n%t>0&&(i+=1);for(var s=1;s0&&(i+=1)}i+=(n=e+L.wc.strWidth(r[o-1]))/t|0;let a=n%t;return a>0&&(i+=1),[i,a]}_valueStartCol(){return this._startCol+L.wc.strWidth(this._promptLastLine)}_searchIfNeeded(){this._shell&&this._historySearchMode&&this._getHistory().search()}_completeIfNeeded(){this._shell&&!this._historySearchMode&&this._getComplete().complete(1)}_completeBackIfNeeded(){this._shell&&!this._historySearchMode&&this._getComplete().complete(-1)}_hintIfNeeded(){this._shell&&!this._historySearchMode?this._getComplete().hint():this._hint=""}_moveLeft(){if(this._cursor<0)return this._cursor=0,void this._term.ringBell();var e,t,r=0;do{r+=1,e=L.wc.substring(this._value,0,this._cursor-r),t=L.wc.strWidth(e)}while(t>=this._cursor&&r<5);this._cursor=t}_moveRight(){let e=L.wc.strWidth(this._value);if(this._cursor>=e)return this._cursor=e,void this._term.ringBell();var t,r,o=0;do{o+=1,t=L.wc.substring(this._value,0,this._cursor+o),r=L.wc.strWidth(t)}while(r<=this._cursor&&o<5);this._cursor=r}_moveUp(){let e=this._term,t=this._term.screen_;if(((this._cursor+this._valueStartCol())/t.columnCount_|0)>0)this._cursor-=t.columnCount_,this._cursor<0&&(this._cursor=0);else{if(this._shell)return this._hint="",this._getHistory().prev(this._historySearchMode);e.ringBell()}this._render()}_moveDown(){let e=this._term,t=this._term.screen_,r=L.wc.strWidth(this._value);if(((this._cursor+this._valueStartCol())/t.columnCount_|0)<(r/t.columnCount_|0))this._cursor+=t.columnCount_,this._cursor>r&&(this._cursor=r);else{if(this._shell)return this._hint="",this._getHistory().next(this._historySearchMode);e.ringBell()}this._render()}_getHistory(){return this._history||(this._history=new nt(this)),this._history}_getComplete(){return this._complete||(this._complete=new it(this)),this._complete}_resetHistory(){this._historySearchMode?this._getHistory().search():this._history&&(this._history.reset(),this._history=null)}_forwardWord(){let e=L.wc.substr(this._value,this._cursor),t=tt.exec(e);t&&(this._cursor+=L.wc.strWidth(t[0]))}_backWord(){let e=L.wc.substring(this._value,0,this._cursor),t=rt.exec(e);t&&(this._cursor-=L.wc.strWidth(t[0]),this._cursor<0&&(this._cursor=0))}_deleteBackWord(){0==this._cursor&&this._term.ringBell();var e=L.wc.substring(this._value,0,this._cursor);let t=L.wc.substr(this._value,this._cursor),r=rt.exec(e);if(!r)return;let o=L.wc.strWidth(r[0]);e=L.wc.substring(this._value,0,this._cursor-o),this._value=[e,t].join(""),this._cursor=Math.max(0,this._cursor-o),this._resetHistory()}_deleteForwardWord(){let e=L.wc.substring(this._value,0,this._cursor);var t=L.wc.substr(this._value,this._cursor);let r=tt.exec(t);if(!r)return;let o=L.wc.strWidth(r[0]);t=L.wc.substr(t,o),this._value=[e,t].join(""),this._resetHistory()}_uppercaseForwardWord(){let e=L.wc.substring(this._value,0,this._cursor);var t=L.wc.substr(this._value,this._cursor);let r=tt.exec(t);if(!r)return;let o=r[0].toUpperCase(),n=L.wc.strWidth(o);t=L.wc.substr(t,n),this._value=[e,o,t].join(""),this._cursor+=n,this._resetHistory()}_render(){if(this._historySearchMode)return void this._getHistory().render();let e=this._term,t=e.screen_.columnCount_;e.setCursorVisible(!1),e.setCursorPosition(this._startRow,this._startCol),e.eraseBelow();let r=this._hintPos+L.wc.strWidth(this._hint),o=L.wc.strWidth(this._value);o=Math.max(r,o),this._secure&&(o=0,r=0);let[n,i]=this._promptRowsAndCols(o,t),s=this._startRow+n-e.screenSize.height;s>0&&(e.appendRows_(s),this._startRow-=s,e.setCursorPosition(this._startRow,this._startCol));for(var a=0;a0?this._moveUp():this._moveDown(),!0)))}promptB64(e){this.reset(),this._term.setAutoCarriageReturn(!0);let t=JSON.parse(window.atob(e));this._prompt=(t.prompt||"").split(/\n/),this._promptLastLine=this._prompt[this._prompt.length-1],this._secure=t.secure,this._shell=t.shell,this._value="",this._hint="",this._hintPos=0,this._cursor=0,this._startCol=0,this._startRow=this._term.getCursorRow(),this._render(),this._term.accessibilityReader_.announce(this._prompt)}reset(){-1!=this._startCol&&(this._history=null,this._complete=null,this._prompt=[""],this._promptLastLine="",this._startCol=-1,this._secure=!1,this._shell=!1,this._hint="",this._hintPos=0,this._historySearchMode=!1)}resize(){this._startCol<0||this._render()}}U.Terminal.prototype.decorate=function(e){this.div_=document.body,this.accessibilityReader_=new U.AccessibilityReader(this.div_),this.scrollPort_.decorate(e),this.scrollPort_.setUserCssUrl(this.prefs_.get("user-css")),this.scrollPort_.setUserCssText(this.prefs_.get("user-css-text")),this.scrollPort_.setAccessibilityReader(this.accessibilityReader_),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;let o=this.onFocusChange_.bind(this,!0);r.addEventListener("focus",o),r.addEventListener("mousedown",function(){setTimeout(o)}.bind(this)),r.addEventListener("blur",this.onFocusChange_.bind(this,!1));var n=this.document_.createElement("style");n.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);}.uri-node:hover { text-decoration: underline; cursor: pointer;}@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(n),this.cursorOverlayNode_=this.document_.createElement("div"),this.cursorOverlayNode_.id="hterm:terminal-overlay-cursor",this.cursorOverlayNode_.style.cssText="position: absolute;left: 0;top: 0;bottom: 0;right: 0;pointer-events: none;",this.document_.body.appendChild(this.cursorOverlayNode_),this.cursorNode_=this.document_.createElement("div"),this.cursorNode_.id="hterm:terminal-cursor",this.cursorNode_.className="cursor-node",this.cursorNode_.style.cssText="position: absolute;display: "+(this.options_.cursorVisible?"":"none")+";width: var(--hterm-charsize-width);height: var(--hterm-charsize-height);background-color: var(--hterm-cursor-color);border-color: var(--hterm-cursor-color); isolatation: isolate; transform: translate3d(calc(var(--hterm-charsize-width) * var(--hterm-cursor-offset-col)), calc(var(--hterm-charsize-height) * var(--hterm-cursor-offset-row)), 0);-webkit-transition: opacity, background-color 100ms linear;-moz-transition: opacity, background-color 100ms linear;",this.setCursorColor(),this.setCursorBlink(!!this.prefs_.get("cursor-blink")),this.restyleCursor_(),this.cursorOverlayNode_.appendChild(this.cursorNode_),this.ime_=this.document_.createElement("ime"),this.cursorOverlayNode_.appendChild(this.ime_),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(e=>{this.scrollBlockerNode_.addEventListener(e,t),this.cursorNode_.addEventListener(e,t),this.document_.addEventListener(e,t)}),this.cursorNode_.addEventListener("mousedown",()=>{setTimeout(this.focus.bind(this))}),this.setReverseVideo(!1),this.scrollPort_.focus(),this.scrollPort_.scheduleRedraw(),this.prompt=new st(this)},U.Terminal.prototype.syncCursorPosition_=function(){var e=this.scrollPort_.getTopRowIndex(),t=this.scrollPort_.getBottomRowIndex(e),r=this.scrollbackRows_.length+this.screen_.cursorPosition.row;let o=!1;if(this.accessibilityReader_.accessibilityEnabled){const e=this.screen_.cursorPosition.column;const t=We(this.getRowNode(this.screen_.cursorPosition.row));o=this.accessibilityReader_.hasUserGesture,this.accessibilityReader_.afterCursorChange(t,r,e)}if(r>t)this.setCssCursorPos({row:-1,col:-1});else{this.options_.cursorVisible&&"none"==this.cursorNode_.style.display&&(this.cursorNode_.style.display=""),this.setCssCursorPos({row:r-e+this.scrollPort_.visibleRowTopMargin,col:this.screen_.cursorPosition.column});var n=this.document_.getSelection();n&&(n.isCollapsed||o)&&this.screen_.syncSelectionCaret(n)}};var at={row:-1,col:-1};U.Terminal.prototype.setCssCursorPos=function(e){at.row===e.row&&at.col===e.col||-1===at.row&&-1===e.row||(at.row!==e.row&&this.setCursorCssVar("cursor-offset-row",e.row+""),at.col!==e.col&&this.setCursorCssVar("cursor-offset-col",e.col+""),this.blinkCursorPos=e,at=e)},U.Terminal.prototype.setCursorCssVar=function(e,t,r="--hterm-"){this.cursorOverlayNode_.style.setProperty(`${r}${e}`,t)},U.Terminal.prototype.scheduleSyncCursorPosition_=function(){if(!this.timeouts_.syncCursor){var e=this;this.timeouts_.syncCursor=setTimeout((function(){requestAnimationFrame((function(){e.syncCursorPosition_(),e.timeouts_.syncCursor=0}))}),0)}},U.Terminal.prototype.scheduleRedraw_=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout((function(){e.timeouts_.redraw=0,e.scrollPort_.redraw_()}),0)}},U.Terminal.prototype.scheduleScrollDown_=function(){if(!this.timeouts_.scrollDown){var e=this;this.timeouts_.scrollDown=setTimeout((function(){e.timeouts_.scrollDown=0,e.scrollPort_.scrollToBottom()}),20)}},U.Terminal.prototype.renumberRows_=function(e,t,r){for(var o=r||this.screen_,n=this.scrollbackRows_.length,i=o.rowsArray,s=e;s6e3&&(this.scrollbackRows_.splice(0,2e3),t=!0);for(var r=this.screen_.rowsArray.length,o=this.scrollbackRows_.length+r,n=0;n0){var a=this.screen_.shiftRows(s);Array.prototype.push.apply(this.scrollbackRows_,a),this.scrollPort_.isScrolledEnd&&this.scheduleScrollDown_()}t&&(this.scrollPort_.syncScrollHeight(),this.scheduleScrollDown_()),r>=this.screen_.rowsArray.length&&(r=this.screen_.rowsArray.length-1),this.setAbsoluteCursorPosition(r,0)},U.Terminal.prototype.moveRows_=function(e,t,r){var o,n,i=this.screen_.removeRows(e,t);this.screen_.insertRows(r,i),e=0;n--)this.setAbsoluteCursorPosition(t+n,0),this.screen_.clearCursorRow(),this.scrollPort_.renderRef.touchRow(this.screen_.cursorRow())},U.Terminal.prototype.deleteLines=function(e){var t=this.saveCursor(),r=t.row,o=this.getVTScrollBottom(),n=o-r+1,i=o-(e=Math.min(e,n))+1;e!=n&&this.moveRows_(r,e,i);for(var s=0;s=this.screenSize.width&&(s=!0,i=this.screenSize.width-this.screen_.cursorPosition.column),s&&!this.options_.wraparound?(n=L.wc.substr(e,r,i-1)+L.wc.substr(e,o-1),i=o):n=L.wc.substr(e,r,i);for(var a=this.screen_.textAttributes,l=U.TextAttributes.splitWidecharString(n),c=l.length,u=0;u{};const r=this.document_.createElement("img");r.src=e.uri,r.title=r.alt=e.name,this.document_.body.appendChild(r),r.onload=()=>{const o=(e,t,r)=>{if(!e||"auto"==e)return"";const o=e.match(/^([0-9]+)(px|%)?$/);return o?"%"==o[2]?t*parseInt(o[1])/100+"px":"px"==o[2]?e:`calc(${e} * var(${r}))`:""};r.style.width=o(e.width,this.document_.body.clientWidth,"--hterm-charsize-width"),r.style.height=o(e.height,this.document_.body.clientHeight,"--hterm-charsize-height");var n=Math.ceil(r.clientHeight/this.scrollPort_.characterSize.height);const i=Math.round(2*this.scrollPort_.visibleRowCount)/3;n>i&&(n=i);for(let e=0;e{this.document_.body.removeChild(r),t.showOverlay(U.msg("LOADING_RESOURCE_FAILED",[e.name],"Loading $1 failed ...")),t.pop()}}},U.Terminal.prototype.getRowsText=function(e,t){for(var r=[],o=e;o0){if(t<=this.scrollbackRows_.length){var i=Math.min(t,this.scrollbackRows_.length),s=this.scrollbackRows_.splice(this.scrollbackRows_.length-i,i);this.screen_.unshiftRows(s),t-=i,r.row+=i}t&&this.appendRows_(t)}this.setVTScrollRegion(null,null),this.restoreCursor(r)},U.Terminal.prototype.onMouse_Blink=function(e){if(!e.processedByTerminalHandler_){e.button>2&&e.preventDefault();var t=!this.defeatMouseReports_&&this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED;if(e.processedByTerminalHandler_=!0,this.mouseHideWhileTyping_&&!this.mouseHideDelay_&&(this.syncMouseStyle(),this.mouseHideDelay_=setTimeout(()=>this.mouseHideDelay_=null,1e3)),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&&(this.contextMenu.hide(e),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.screen_.expandSelection(this.document_.getSelection()),this.copyOnSelect&&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&&(e.ctrlKey&&2==e.button?(e.preventDefault(),this.contextMenu.show(e,this)):(e.button==this.mousePasteButton||this.mouseRightClickPaste&&2==e.button)&&(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){const t=this.scrollPort_.scrollWheelDelta(e),r=(e,t,r,o)=>{if(0==e)return"";const n=L.f.smartFloorDivide(Math.abs(e),t);return("O"+(e<0?o:r)).repeat(n)};this.io.sendString(r(-t.y,this.scrollPort_.characterSize.height,"A","B")+r(t.x,this.scrollPort_.characterSize.width,"C","D")),e.preventDefault()}}"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.defeatMouseReports_=!1)}}},window.hterm=U,window.lib=L,window.KeystrokeVisualizer=$,window.installKB=function(e,t){const r=new B(e,t);t||document.body.append(r.element),r.focus(!0),window._onKB=r.onKB,window._kb=r}}]); \ No newline at end of file + */var o=r(3),n=r(2),i=r(4),s=r(5),a="function"==typeof Symbol&&Symbol.for,l=a?Symbol.for("react.element"):60103,c=a?Symbol.for("react.portal"):60106,u=a?Symbol.for("react.fragment"):60107,h=a?Symbol.for("react.strict_mode"):60108,d=a?Symbol.for("react.profiler"):60114,p=a?Symbol.for("react.provider"):60109,f=a?Symbol.for("react.context"):60110,g=a?Symbol.for("react.async_mode"):60111,m=a?Symbol.for("react.forward_ref"):60112;a&&Symbol.for("react.timeout");var b="function"==typeof Symbol&&Symbol.iterator;function _(e){for(var t=arguments.length-1,r="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=0;oE.length&&E.push(e)}function N(e,t,r,o){var n=typeof e;"undefined"!==n&&"boolean"!==n||(e=null);var i=!1;if(null===e)i=!0;else switch(n){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case l:case c:i=!0}}if(i)return r(o,e,""===t?"."+I(e,0):t),1;if(i=0,t=""===t?".":t+":",Array.isArray(e))for(var s=0;sString.fromCharCode(e.charCodeAt(0)-64),g={keyCode:0,keyCap:"[Unidentified]",normal:s,ctrl:s,alt:s,meta:s};class m{constructor(e){this._defs={},this._reverseDefs={},this._onCtrlNum=(e,t)=>{switch(t.keyCap.substr(0,1)){case"1":return"1";case"2":return f("@");case"3":return f("[");case"4":return f("\\");case"5":return f("]");case"6":return f("^");case"7":return f("_");case"8":return p;case"9":return"9";default:return s}},this._onAltNum=(e,t)=>i,this._onSel=(e,t)=>{let{ArrowDown:r,ArrowLeft:o,ArrowRight:i,ArrowUp:s,Escape:a,h:l,j:u,k:h,l:d,o:p,b:f,f:g,n:m,p:b,w:_,x:y,y:w}=this._reverseDefs;const v=e=>c("selection",e),C={command:"copy"};if(t===o||t===l){v({dir:"left",gran:e.shift?"word":"character"})}else if(t===i||t===d){v({dir:"right",gran:e.shift?"word":"character"})}else t===s||t===h?v({dir:"left",gran:"line"}):t===r||t===u?v({dir:"right",gran:"line"}):t===p||t===y?v({command:"change"}):t===m&&e.ctrl?v({dir:"right",gran:"line"}):t===b?e.ctrl?v({dir:"left",gran:"line"}):e.shift||e.alt||e.meta||v({command:"paste"}):t===f?e.ctrl?v({dir:"left",gran:"character"}):(e.alt,v({dir:"left",gran:"word"})):t===_?e.alt?v(C):v({dir:"right",gran:"word"}):t===g?e.ctrl?v({dir:"right",gran:"character"}):e.alt&&v({dir:"right",gran:"word"}):t===w?v(C):t===a&&v({command:"cancel"});return n},this._keyboard=e,this.reset()}getKeyDef(e){var t=this._defs[e];return t||(console.warn(`No definition for (keyCode ${e})`),t=g,this.addKeyDef(e,t),t)}addKeyDef(e,t){if(e in this._defs&&console.warn("Dup keyCode: ",e),this._defs[e]=t,/^\[\w+\]$/.test(t.keyCap)){let e=t.keyCap.replace(/\W/g,"");this._reverseDefs[e]=t}else{var r=t.keyCap[0];this._reverseDefs[r]=t,/0-9/.test(r)?this._reverseDefs["Digit"+r]=t:/[a-z]/.test(r)&&(this._reverseDefs["Key"+r.toUpperCase()]=t)}}reset(){this._defs={};const e=(e,t,r)=>"function"==typeof e?e.call(this,t,r):e,t=(t,r)=>(o,n)=>{let i=o.shift||o.ctrl||o.alt||o.meta?r:t;return e(i,o,n)},r=(t,r)=>(o,n)=>{let i=o.shift?r:t;return o.shift=!1,e(i,o,n)},o=(e,t)=>e,n=(t,r)=>(o,n)=>{let i=o.alt?t:r;return e(i,o,n)},l=(t,r)=>(o,n)=>{let i=o.shift||o.ctrl||o.alt||o.meta?t:r;return e(i,o,n)},c=t=>(r,o)=>{let n=this._keyboard.hasSelection?this._onSel:t;return e(n,r,o)},m=e=>this.addKeyDef(e.keyCode,e);m(g),m({keyCode:27,keyCap:"[Escape]",normal:c(h),ctrl:i,alt:i,meta:i}),m({keyCode:112,keyCap:"[F1]",normal:t(u+"P",d+"P"),ctrl:i,alt:d+"23~",meta:i}),m({keyCode:113,keyCap:"[F2]",normal:t(u+"Q",d+"Q"),ctrl:i,alt:d+"24~",meta:i}),m({keyCode:114,keyCap:"[F3]",normal:t(u+"R",d+"R"),ctrl:i,alt:d+"25~",meta:i}),m({keyCode:115,keyCap:"[F4]",normal:t(u+"S",d+"S"),ctrl:i,alt:d+"26~",meta:i}),m({keyCode:116,keyCap:"[F5]",normal:d+"15~",ctrl:i,alt:d+"28~",meta:i}),m({keyCode:117,keyCap:"[F6]",normal:d+"17~",ctrl:i,alt:d+"29~",meta:i}),m({keyCode:118,keyCap:"[F7]",normal:d+"18~",ctrl:i,alt:d+"31~",meta:i}),m({keyCode:119,keyCap:"[F8]",normal:d+"19~",ctrl:i,alt:d+"32~",meta:i}),m({keyCode:120,keyCap:"[F9]",normal:d+"20~",ctrl:i,alt:d+"33~",meta:i}),m({keyCode:121,keyCap:"[F10]",normal:d+"21~",ctrl:i,alt:d+"34~",meta:i}),m({keyCode:122,keyCap:"[F11]",normal:d+"23~",ctrl:i,alt:d+"42~",meta:i}),m({keyCode:123,keyCap:"[F12]",normal:d+"24~",ctrl:i,alt:d+"43~",meta:i});const b=this._onCtrlNum,_=this._onAltNum;m({keyCode:192,keyCap:"`~",normal:i,ctrl:r(f("@"),f("^")),alt:i,meta:i}),m({keyCode:49,keyCap:"1!",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:50,keyCap:"2@",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:51,keyCap:"3#",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:52,keyCap:"4$",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:53,keyCap:"5%",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:54,keyCap:"6^",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:55,keyCap:"7&",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:56,keyCap:"8*",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:57,keyCap:"9(",normal:i,ctrl:b,alt:_,meta:i}),m({keyCode:48,keyCap:"0)",normal:i,ctrl:i,alt:_,meta:i}),m({keyCode:189,keyCap:"-_",normal:i,ctrl:f("_"),alt:i,meta:i}),m({keyCode:187,keyCap:"=+",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:8,keyCap:"[Backspace]",normal:o(p),ctrl:o("\b"),alt:i,meta:i}),m({keyCode:9,keyCap:"[Tab]",normal:r("\t",d+"Z"),ctrl:a,alt:a,meta:i}),m({keyCode:81,keyCap:"qQ",normal:i,ctrl:f("Q"),alt:i,meta:i}),m({keyCode:87,keyCap:"wW",normal:c(i),ctrl:f("W"),alt:c(i),meta:i}),m({keyCode:69,keyCap:"eE",normal:i,ctrl:f("E"),alt:i,meta:i}),m({keyCode:82,keyCap:"rR",normal:i,ctrl:f("R"),alt:i,meta:i}),m({keyCode:84,keyCap:"tT",normal:i,ctrl:f("T"),alt:i,meta:i}),m({keyCode:89,keyCap:"yY",normal:c(i),ctrl:f("Y"),alt:i,meta:i}),m({keyCode:85,keyCap:"uU",normal:i,ctrl:f("U"),alt:i,meta:i}),m({keyCode:73,keyCap:"iI",normal:i,ctrl:f("I"),alt:i,meta:i}),m({keyCode:79,keyCap:"oO",normal:c(i),ctrl:f("O"),alt:i,meta:i}),m({keyCode:80,keyCap:"pP",normal:c(i),ctrl:c(f("P")),alt:i,meta:i}),m({keyCode:219,keyCap:"[{",normal:i,ctrl:f("["),alt:i,meta:i}),m({keyCode:221,keyCap:"]}",normal:i,ctrl:f("]"),alt:i,meta:i}),m({keyCode:220,keyCap:"\\|",normal:i,ctrl:f("\\"),alt:i,meta:i}),m({keyCode:20,keyCap:"[CapsLock]",normal:s,ctrl:s,alt:s,meta:i}),m({keyCode:65,keyCap:"aA",normal:i,ctrl:f("A"),alt:i,meta:i}),m({keyCode:83,keyCap:"sS",normal:i,ctrl:f("S"),alt:i,meta:i}),m({keyCode:68,keyCap:"dD",normal:i,ctrl:f("D"),alt:i,meta:i}),m({keyCode:70,keyCap:"fF",normal:i,ctrl:c(f("F")),alt:c(i),meta:i}),m({keyCode:71,keyCap:"gG",normal:i,ctrl:f("G"),alt:i,meta:i}),m({keyCode:72,keyCap:"hH",normal:c(i),ctrl:f("H"),alt:i,meta:i}),m({keyCode:74,keyCap:"jJ",normal:c(i),ctrl:f("J"),alt:i,meta:i}),m({keyCode:75,keyCap:"kK",normal:c(i),ctrl:f("K"),alt:i,meta:i}),m({keyCode:76,keyCap:"lL",normal:c(i),ctrl:f("L"),alt:i,meta:i}),m({keyCode:186,keyCap:";:",normal:i,ctrl:a,alt:i,meta:i}),m({keyCode:222,keyCap:"'\"",normal:i,ctrl:a,alt:i,meta:i}),m({keyCode:13,keyCap:"[Enter]",normal:"\r",ctrl:i,alt:i,meta:i}),m({keyCode:16,keyCap:"[Shift]",normal:s,ctrl:s,alt:s,meta:i}),m({keyCode:90,keyCap:"zZ",normal:i,ctrl:f("Z"),alt:i,meta:i}),m({keyCode:88,keyCap:"xX",normal:c(i),ctrl:c(f("X")),alt:i,meta:i}),m({keyCode:67,keyCap:"cC",normal:i,ctrl:f("C"),alt:i,meta:i}),m({keyCode:86,keyCap:"vV",normal:i,ctrl:f("V"),alt:i,meta:i}),m({keyCode:66,keyCap:"bB",normal:c(i),ctrl:c(f("B")),alt:c(i),meta:i}),m({keyCode:78,keyCap:"nN",normal:i,ctrl:c(f("N")),alt:i,meta:i}),m({keyCode:77,keyCap:"mM",normal:i,ctrl:f("M"),alt:i,meta:i}),m({keyCode:188,keyCap:",<",normal:i,ctrl:n(a,s),alt:i,meta:i}),m({keyCode:190,keyCap:".>",normal:i,ctrl:n(a,s),alt:i,meta:i}),m({keyCode:191,keyCap:"/?",normal:i,ctrl:r(f("_"),f("?")),alt:i,meta:i}),m({keyCode:17,keyCap:"[Control]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:18,keyCap:"[Alt]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:91,keyCap:"[Meta]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:32,keyCap:" ",normal:i,ctrl:f("@"),alt:i,meta:i}),m({keyCode:93,keyCap:"[Meta]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:42,keyCap:"[PRTSCR]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:145,keyCap:"[SCRLK]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:19,keyCap:"[BREAK]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:45,keyCap:"[Insert]",normal:d+"2~",ctrl:i,alt:i,meta:i}),m({keyCode:36,keyCap:"[Home]",normal:h+"OH",ctrl:i,alt:i,meta:i}),m({keyCode:33,keyCap:"[PageUp]",normal:d+"5~",ctrl:i,alt:i,meta:i}),m({keyCode:46,keyCap:"[DEL]",normal:d+"3~",ctrl:i,alt:i,meta:i}),m({keyCode:35,keyCap:"[End]",normal:h+"OF",ctrl:i,alt:i,meta:i}),m({keyCode:34,keyCap:"[PageDown]",normal:d+"6~",ctrl:i,alt:i,meta:i}),m({keyCode:38,keyCap:"[ArrowUp]",normal:c(l(d+"A",u+"A")),ctrl:i,alt:i,meta:i}),m({keyCode:40,keyCap:"[ArrowDown]",normal:c(l(d+"B",u+"B")),ctrl:i,alt:i,meta:i}),m({keyCode:39,keyCap:"[ArrowRight]",normal:c(l(d+"C",u+"C")),ctrl:i,alt:i,meta:i}),m({keyCode:37,keyCap:"[ArrowLeft]",normal:c(l(d+"D",u+"D")),ctrl:i,alt:i,meta:i}),m({keyCode:144,keyCap:"[NumLock]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:12,keyCap:"[Clear]",normal:s,ctrl:s,alt:s,meta:s}),m({keyCode:96,keyCap:"[Numpad0]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:97,keyCap:"[Numpad1]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:98,keyCap:"[Numpad2]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:99,keyCap:"[Numpad3]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:100,keyCap:"[Numpad4]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:101,keyCap:"[Numpad5]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:102,keyCap:"[Numpad6]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:103,keyCap:"[Numpad7]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:104,keyCap:"[Numpad8]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:105,keyCap:"[Numpad9]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:107,keyCap:"[NumpadAdd]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:109,keyCap:"[NumpadSubtract]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:106,keyCap:"[NumpadMultiply]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:111,keyCap:"[NumpadDivide]",normal:i,ctrl:i,alt:i,meta:i}),m({keyCode:110,keyCap:"[NumpadDicimal]",normal:i,ctrl:i,alt:i,meta:i}),this._reverseDefs.Backqoute=this._defs[192],this._reverseDefs.BracketLeft=this._defs[229],this._reverseDefs.BracketRight=this._defs[221],this._reverseDefs.Slash=this._defs[191],this._reverseDefs.Space=this._defs[32]}keyCode(e){let t=this._reverseDefs[e];return t?t.keyCode:0}key(e){let t=this._defs[e];if(!t)return"";let r=t.keyCap;return/^\[\w+\]$/.test(r)?r.substr(1,r.length-2):r.substr(0,1)}}const b=65536,_=1<<17,y=1<<18,w=1<<19,v=1<<20;function C(e){return{shift:(e&_)==_,alt:(e&w)==w,ctrl:(e&y)==y,meta:(e&v)==v}}class S{constructor(){this._map={},this.expandFn=e=>{if(0===e.keys.length)return;let t=[{keyCode:121,key:"F10",code:"F10",id:"121:0"},{keyCode:112,key:"F1",code:"F1",id:"112:0"},{keyCode:113,key:"F2",code:"F2",id:"113:0"},{keyCode:114,key:"F3",code:"F3",id:"114:0"},{keyCode:115,key:"F4",code:"F4",id:"115:0"},{keyCode:116,key:"F5",code:"F5",id:"116:0"},{keyCode:117,key:"F6",code:"F6",id:"117:0"},{keyCode:118,key:"F7",code:"F7",id:"118:0"},{keyCode:119,key:"F8",code:"F8",id:"119:0"},{keyCode:120,key:"F9",code:"F9",id:"120:0"}],r=e.keys.slice();for(var o=0;o<10;o++){let n=o+48+":0",i=t[o];e.keys=r.slice(),e.keys.push(n),e.action={type:"press",key:i,mods:0},this.expandBinding(e)}},this.expandCursor=e=>{if(0==e.keys.length)return;let t=[{keyCode:36,key:"HOME",code:"HOME",id:"36:0"},{keyCode:33,key:"PGUP",code:"PGUP",id:"33:0"},{keyCode:35,key:"END",code:"END",id:"35:0"},{keyCode:34,key:"PGDOWN",code:"PGDOWN",id:"34:0"}],r=["37:0","38:0","39:0","40:0"],o=e.keys.slice();for(var n=0;n{var t=e.keys.map(e=>e.split("-")[0]);if(0==t.length)return;var r=[t.sort()],o=0;var n=[{idLeft:"16:1",idRight:"16:2",loc:e.shiftLoc},{idLeft:"17:1",idRight:"17:2",loc:e.controlLoc},{idLeft:"18:1",idRight:"18:2",loc:e.optionLoc},{idLeft:"91:1",idRight:"93:2",loc:e.commandLoc}];for(let e of n)for(o=r.length-1;o>=0;o--){var i=r[o];let t=i.indexOf(e.idLeft);if(t<0&&(t=i.indexOf(e.idRight)),t<0)continue;if(1==e.loc){i[t]=e.idLeft;continue}if(2==e.loc){i[t]=e.idRight;continue}i[t]=e.idLeft;let n=i.slice();n[t]=e.idRight,r.push(n)}for(let t of r){let r=t.sort().join(":");this._map[r]=e.action}}}reset(){this._map={}}match(e){let t=e.sort().join(":");return this._map[t]}}const k=l.CANCEL,T=l.DEFAULT,P=l.PASS,x=l.STRIP;function A(e){let t="",r=e.length;for(let o=0;o{let t=e.code;if(this._capsLockRemapped){let r;c("mods",{mods:r="keyup"==e.type&&"CapsLock"==t?0:function(e,t=!0){let r=0;return e.shiftKey&&(r|=_),e.ctrlKey&&(r|=y),e.altKey&&(r|=w),e.metaKey&&(r|=v),t&&(r|=b),r}(e)})}"AltLeft"!=t&&"AltRight"!=t||this._ignoreAccents[t]&&("keydown"==e.type?c("guard-ime-on",{}):c("guard-ime-off",{}),V(e))},this._downKeysIds=()=>{let e=Array.from(this._down);return this._mods.Meta.has("tb-meta")&&-1==e.indexOf(I)&&e.push(I),this._mods.Control.has("tb-ctrl")&&-1==e.indexOf(M)&&e.push(M),this._mods.Alt.has("tb-alt")&&-1==e.indexOf(N)&&e.push(N),this._mods.Shift.has("tb-shift")&&-1==e.indexOf(F)&&e.push(F),e},this._onKeyDown=e=>{if(e.isComposing)return void(this._lastKeyDownEvent=null);let t=e;if(229===e.keyCode){if(!this._lastKeyDownEvent)return;t=this._lastKeyDownEvent}else this._lastKeyDownEvent=e;let r=O(t);this._down.add(r);let o=this._bindings.match(this._downKeysIds());if(E.has(r)||this._down.delete(r),o)return this._execBinding(o,e),void V(e);let n=this._downMap[r],i=this._mod(this._modsMap[t.code]),s=!1;n&&(i&&(s=!this._mods[i].has(r)),s||(this._handleKeyDownKey(n,e),s=!0)),i&&this._mods[i].add(r),this._upMap[r]&&this._up.add(r),this._updateUIKitModsIfNeeded(t),s||this._handleKeyDown(t.keyCode,e)},this._onBeforeInput=e=>{"dictation"!==this._lang?("insertText"===e.inputType&&(this._output(e.data),this._langWithDeletes&&e.data),"deleteContentBackward"===e.inputType&&this._output(p),V(e)):this._moveCaret(e.data||"")},this._onInput=e=>V(e),this._onKeyUp=e=>{this._lastKeyDownEvent=null;let t=O(e);this._down.delete(t);let r=this._mod(this._modsMap[e.code]);r&&this._mods[r].delete(t),this._updateUIKitModsIfNeeded(e);let o=this._upMap[t];o&&this._up.has(t)&&this._handleKeyDownKey(o,null),V(e)},this._handleKeyDown=(e,t)=>{let r={keyCode:e,key:"",code:"Unidentified"};t&&(r.code=t.code,r.key=t.key),this._handleKeyDownKey(r,t)},this._handleKeyDownKey=(e,t)=>{let r=this._keyMap,o=this._mods.Alt.size>0,n=this._mods.Control.size>0,i=this._mods.Meta.size>0,s=this._mods.Shift.size>0,a=e.code,l=e.key,c=function(e,t,r,o){if(!o)return e;if(o.ctrlKey){let r=o.key.toLowerCase(),n=o.keyCode;if(8===n&&"h"===r||9===n&&"i"===r||13===n&&"c"===r||13===n&&"m"===r||27===n&&"["===r||187===n&&"]"===r)return e.keyCode=t.keyCode(r)||e.keyCode,e;let i=o.code;if(8===n&&"KeyH"===i||9===n&&"KeyI"===i||13===n&&"KeyC"===i||13===n&&"KeyM"===i||27===n&&"BracketLeft"===i)return e.keyCode=t.keyCode(i)||e.keyCode,e}if(!r){let t=o.key.toLowerCase();return(/^[~!@#$%^&*()_+{}|:"<>?]$/.test(t)||/^\w$/.test(t)&&t!==o.key)&&(e.shift=!0),e}return e}({key:l,code:a,keyCode:e.keyCode,alt:o,ctrl:n,meta:i,shift:s},this._keyMap,this._isHKB,t),u=r.getKeyDef(c.keyCode);var p=null;function f(e){p=e;var t=u[e];return"function"==typeof t&&(t=t.call(r,c,u)),t===T&&"normal"!==e&&(t=f("normal")),t}let g;if(g=f(n?"ctrl":o?"alt":i?"meta":"normal"),!this._langWithDeletes||"[Backspace]"!==u.keyCap){if(!this.hasSelection&&(g===P||g===T&&!(n||o||i))){if(g===P&&!e.src)return;if(/^\[\w+\]$/.test(u.keyCap)){if(!e.src)return void(this._removeAccents=!1)}else if(this._langWithDeletes)return;if(!this._isHKB)return this._output(l),void V(t);let r=this._removeAccents?function(e){let t=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),r=t.replace(/^[\u02c6\u00a8\u00b4\u02dc\u0060]/,"");return r&&(t=r),t}(l):l;return this._removeAccents=!1,this._capsLockRemapped||this._shiftRemapped?this._output(s?r.toUpperCase():r.toLowerCase()):this._output(r),void V(t)}if(this._removeAccents=!1,g===x&&(o=n=!1,"function"==typeof(g=u.normal)&&(g=g.call(r,c,u)),g===T&&2===u.keyCap.length&&(g=u.keyCap.substr(s?1:0,1))),V(t),g!==k&&!this.hasSelection)if(g===T||"string"==typeof g){if("ctrl"===p?n=!1:"alt"===p?o=!1:"meta"===p&&(i=!1),s=c.shift,(o||n||s||i)&&"string"==typeof g&&g.substr(0,2)===d){let e=1;s&&(e+=1),o&&(e+=2),n&&(e+=4),i&&(e+=8);let t=";"+e;g=3==g.length?d+"1"+t+g.substr(2,1):g.substr(0,g.length-1)+t+g.substr(g.length-1)}else{if(g===T&&(g=u.keyCap.substr(s?1:0,1),n)){let e=u.keyCap.substr(0,1).charCodeAt(0);e>=64&&e<=95&&(g=String.fromCharCode(e-64))}let e=g.toString();if(o&&"8-bit"==this._altSendsWhat&&1==e.length){let t=e.charCodeAt(0)+128;g=String.fromCharCode(t)}(o&&"escape"==this._altSendsWhat||i&&this._metaSendsEscape)&&(g=h+e)}"string"==typeof g?this._output(g):console.warn("action is not a string",g)}else console.log("Invalid action: "+JSON.stringify(g))}},this._onIME=e=>{let t=e.type,r=e.data||"";c("ime",{type:t,data:r}),this._moveCaret(r),"compositionend"==t&&this._output(r)},this._output=e=>{this._up.clear(),this.caret.innerHTML="⁠",e&&c("out",{data:e})},this._stateReset=e=>{this._down.clear(),this._up.clear(),this._mods={Shift:new Set,Alt:new Set,Meta:new Set,Control:new Set},this.caret.innerHTML="⁠",this.hasSelection=e},this._configKey=e=>{let t=e.code,r=R(e.down);r&&(this._downMap[t.id]=r);let o=this._mod(e.mod);o&&(this._modsMap[t.code]=e.mod);let n=R(e.up);n&&(this._upMap[t.id]=n),"AltRight"!==t.code&&"AltLeft"!==t.code||(this._ignoreAccents[t.code]=e.ignoreAccents&&(!!o||!!n||!!r))},this._config=e=>{this._reset(),this._bindings.reset(),this._configKey(e.capsLock),this._configKey(e.command.left),this._configKey(e.command.right),this._configKey(e.control.left),this._configKey(e.control.right),this._configKey(e.option.left),this._configKey(e.option.right),this._configKey(e.shift.left),this._configKey(e.shift.right),this._bindings.expandFn(e.fn),this._bindings.expandCursor(e.cursor);for(let t of e.shortcuts){let e={keys:this._keysFromShortcut(t.input,t.modifiers),action:t.action,shiftLoc:0,controlLoc:0,optionLoc:0,commandLoc:0};this._bindings.expandBinding(e)}this._updateRemappingFlags()},this._onToolbarMods=e=>{let t=C(e);t.alt?this._mods.Alt.add("tb-alt"):this._mods.Alt.delete("tb-alt"),t.ctrl?this._mods.Control.add("tb-ctrl"):this._mods.Control.delete("tb-ctrl"),t.shift?this._mods.Shift.add("tb-shift"):this._mods.Shift.delete("tb-shift"),t.meta?this._mods.Meta.add("tb-meta"):this._mods.Meta.delete("tb-meta")},this._execPress=(e,t,r)=>{let o=e.split(/:/g),n=this._mods;this._mods={Shift:new Set(n.Shift),Alt:new Set,Meta:new Set,Control:new Set};let i=parseInt(o[0],10),s=C(i);s.shift&&this._mods.Shift.add("tb-shift"),s.ctrl&&this._mods.Control.add("tb-ctrl"),s.alt&&this._mods.Alt.add("tb-alt"),s.meta&&this._mods.Meta.add("tb-meta");let a=parseInt(o[1],10),l=""==o[3]?":":o[3]||this._keyMap.key(a)||"",c={keyCode:a,key:l,code:"",src:"toolbar"};if(!r&&i>0){let e=c.keyCode+":"+o[2]+(0==a?":"+l:"");this._down.add(e);let t=this._bindings.match(this._downKeysIds());if(this._down.delete(e),t)return this._execBinding(t,null),void(this._mods=n)}this._handleKeyDownKey(c,t),this._mods=n,this._removeAccents=!0},this.onKB=(e,t)=>{switch(e){case"mods-down":this._handleCapsLockDown(!0);break;case"mods-up":this._handleCapsLockDown(!1);break;case"guard-up":this._handleGuard(!0,t);break;case"guard-down":this._handleGuard(!1,t);break;case"selection":this.hasSelection=t;break;case"lang":this._handleLang(t);break;case"toolbar-mods":this._onToolbarMods(t);break;case"toolbar-press":this._execPress(t,null,!1);break;case"press":this._execPress(t,null,!0);break;case"state-reset":this._stateReset(t);break;case"focus":this.focus(t);break;case"hex":this._output(A(t)),this._removeAccents=!0;break;case"config":this._config(t)}},this._t=e,this.element=t||document.createElement("div");let r=this.element;this.caret.innerHTML="⁠";var o=document.getElementById("hterm:row-nodes");null==o||o.append(this.caret),this.caret.style.position="absolute",this.caret.style.zIndex="1000",r.addEventListener("focus",this._onFocus),r.addEventListener("blur",this._onBlur),r.setAttribute("autocomplete","off"),r.setAttribute("spellcheck","false"),r.setAttribute("autocorrect","off"),r.setAttribute("autocapitalize","none"),r.setAttribute("contenteditable","plaintext-only"),r.addEventListener("keydown",this._onKeyDown),r.addEventListener("keyup",this._onKeyUp),window.addEventListener("keydown",this._onKeyDown),window.addEventListener("keyup",this._onKeyUp),r.addEventListener("compositionstart",this._onIME),r.addEventListener("compositionupdate",this._onIME),r.addEventListener("compositionend",this._onIME),r.addEventListener("beforeinput",this._onBeforeInput),r.addEventListener("input",this._onInput),this._updateRemappingFlags()}_updateRemappingFlags(){this._capsLockRemapped=null!=this._modsMap.CapsLock||null!=this._downMap[D]||null!=this._upMap[D],this._shiftRemapped=null!=this._modsMap.ShiftLeft&&"Shift"!==this._modsMap.ShiftLeft||null!=this._modsMap.ShiftRight&&"Shift"!==this._modsMap.ShiftRight}_mod(e){switch(e){case"Escape":return this._altSendsWhat="escape","Alt";case"8-bit":return this._altSendsWhat="8-bit","Alt";case"Shift":return"Shift";case"Control":return"Control";case"Meta":return this._metaSendsEscape=!1,"Meta";case"Meta-Escape":return this._metaSendsEscape=!0,"Meta";default:return null}}focus(e){var t,r,o;e?(this.element.focus(),null===(t=window.getSelection())||void 0===t||t.collapse(this.caret),null===(r=this._t)||void 0===r||r.onFocusChange__(!0)):(this.element.blur(),null===(o=this._t)||void 0===o||o.onFocusChange__(!1))}_onFocus(e){var t;null===(t=this._t)||void 0===t||t.onFocusChange__(!0)}_onBlur(e){var t;null===(t=this._t)||void 0===t||t.onFocusChange__(!1)}_moveCaret(e){var r=this._t.scrollPort_;let o=this.caret;o.style.backgroundColor=lib.colors.setAlpha(t.getCursorColor(),1),o.style.color=r.getBackgroundColor();const n=this._t.screenSize.width,i=this._t.screenSize.height,s=this._t.screen_.cursorPosition.column,a=this._t.screen_.cursorPosition.row;var l=lib.wc.strWidth(e);o.style.bottom="auto",o.style.top="auto",o.style.left="auto",o.style.right="auto",0!=l&&(l>=n?(o.style.left="0px",o.style.right="0px",o.style.top=a<.8*i?`calc(var(--hterm-charsize-height) * ${a+1})`:`calc(var(--hterm-charsize-height) * ${a-Math.floor(l/(n+1))-1})`):s+l<=n?(o.style.left=`calc(var(--hterm-charsize-width) * ${s})`,o.style.top=`calc(var(--hterm-charsize-height) * ${a})`,o.style.right="auto"):0==a?(o.style.top=`calc(var(--hterm-charsize-height) * ${a+1})`,o.style.left="auto",o.style.right="0px"):(o.style.top=`calc(var(--hterm-charsize-height) * ${a-1}`,o.style.left="auto",o.style.right="0px"))}_handleCapsLockDown(e){let t=this._modsMap.CapsLock;if(e){this._down.add(D);let e=this._downMap[D];return!e||t&&this._mods[t].has(D)||this._handleKeyDownKey(e,null),t&&this._mods[t].add(D),void(this._upMap[D]&&this._up.add(D))}this._down.delete(D),t&&this._mods[t].delete(D);let r=this._upMap[D];r&&this._up.has(D)&&this._handleKeyDownKey(r,null)}_handleLang(e){let t=e.split(":");this._lang=t[0],this._isHKB="hw"===t[1],this._langWithDeletes="ko-KR"===this._lang||"vi-VN"===this._lang,this._stateReset(this.hasSelection),"dictation"!==this._lang&&this._moveCaret("")}_handleGuard(e,t){let r=this._keyMap.keyCode(t),o=`${r}:0`;if(e)return this._down.delete(o),void(this._removeAccents=!0);this._down.add(o),this._handleKeyDown(r,null)}_reset(){this.hasSelection=!1,this._removeAccents=!1,this._modsMap={},this._downMap={},this._upMap={},this._up.clear(),this._down.clear(),this._mods={Shift:new Set,Alt:new Set,Meta:new Set,Control:new Set},this._ignoreAccents={AltLeft:!0,AltRight:!0}}_keysFromShortcut(e,t){var r=[];let o=C(t);o.shift&&r.push(F),o.alt&&r.push(N),o.ctrl&&r.push(M),o.meta&&r.push(I);let n=this._keyMap.keyCode(e);return n?r.push(n+":0"):r.push("0:0-"+e),r}_execBinding(e,t){switch(e.type){case"command":c("command",{command:e.value});break;case"press":this._execPress(`${e.mods}:${e.key.id}`,t,!0);break;case"hex":this._output(A(e.value)),this._removeAccents=!0}}}if(void 0!==L)throw new Error('Global "lib" object already exists.');var L={runtimeDependencies_:{},initCallbacks_:[],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>>0},L.array.uint32ToArrayBigEndian=function(e){return[e>>>24&255,e>>>16&255,e>>>8&255,e>>>0&255]},L.array.concatTyped=function(...e){let t=0;for(const r of e)t+=r.length;const r=new e[0].constructor(t);let o=0;for(const t of e)r.set(t,o),o+=t.length;return r},L.array.compare=function(e,t){if(null===e||null===t)return null===e&&null===t;if(e.length!==t.length)return!1;for(let r=0;r>4*(t-2)})))},L.colors.x11ToCSS=function(e){var t=e.match(L.colors.re_.x11rgb);return t?(t.splice(0,1),L.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("#")?L.colors.x11HexToCSS(e):L.colors.nameToRGB(e)},L.colors.hexToRGB=function(e){var t=L.colors.re_.hex16,r=L.colors.re_.hex24;function o(e){4==e.length&&(e=e.replace(t,(function(e,t,r,o){return"#"+t+t+r+r+o+o})));var o=e.match(r);return o?"rgb("+parseInt(o[1],16)+", "+parseInt(o[2],16)+", "+parseInt(o[3],16)+")":null}if(e instanceof Array)for(var n=0;n":">","&":"&",'"':""","'":"'"};return e.replace(/[<>&\"\']/g,e=>t[e])}},L.f.parseQuery=function(e){e.startsWith("?")&&(e=e.substr(1));for(var t={},r=e.split("&"),o=0;or?r:e},L.f.zpad=function(e,t){return String(e).padStart(t,"0")},L.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)},L.f.alarm=function(e,t){var r,o,n=t||5e3,i=L.f.getStack(1);return r=setTimeout((function(){var t="string"==typeof e?t:e.name;t=t?": "+t:"",console.warn("lib.f.alarm: timeout expired: "+n/1e3+"s"+t),console.log(i),r=null}),n),o=function(e){return function(){return r&&(clearTimeout(r),r=null),e.apply(null,arguments)}},"string"==typeof e?o:o(e)},L.f.getStack=function(e=0,t){const r=(new Error).stack.split("\n");e+=2;const o=r.length-e;t=void 0===t?o:L.f.clamp(t,0,o);const n=new Array;for(let o=e;oe.os);if(window.chrome&&chrome.runtime&&chrome.runtime.getPlatformInfo)return new Promise((e,t)=>chrome.runtime.getPlatformInfo(t=>e(t.os)));if(window.navigator&&navigator.userAgent){const e=navigator.userAgent;if(e.includes("Mac OS X"))return Promise.resolve("mac");if(e.includes("CrOS"))return Promise.resolve("cros");if(e.includes("Linux"))return Promise.resolve("linux");if(e.includes("Android"))return Promise.resolve("android");if(e.includes("Windows"))return Promise.resolve("windows")}return Promise.reject(null)},L.f.getChromeMilestone=function(){if(window.navigator&&navigator.userAgent){const e=navigator.userAgent.match(/\sChrome\/(\d+)/);if(e)return parseInt(e[1])}return NaN},L.f.lastError=function(e=null){let t;return window.browser&&browser.runtime?t=browser.runtime.lastError:window.chrome&&chrome.runtime&&(t=chrome.runtime.lastError),t&&t.message?t.message:e},L.i18n={},L.i18n.browser_=window.browser&&browser.i18n?browser.i18n:window.chrome&&chrome.i18n?chrome.i18n:null,L.i18n.getAcceptLanguages=function(e){L.i18n.browser_?L.i18n.browser_.getAcceptLanguages(e):setTimeout((function(){e([navigator.language.replace(/-/g,"_")])}),0)},L.i18n.getMessage=function(e,t=[],r=""){if(L.i18n.browser_){const r=L.i18n.browser_.getMessage(e,t);if(r)return r}return L.i18n.replaceReferences(r,t)},L.i18n.replaceReferences=function(e,t=[]){return null===t&&(t=[]),t instanceof Array||(t=[t]),e.replace(/\$(\d+)/g,(e,r)=>r<=t.length?t[r-1]:"")},L.MessageManager=function(e){this.languages_=e.map(e=>e.replace(/-/g,"_")),-1==this.languages_.indexOf("en")&&this.languages_.unshift("en"),this.messages={}},L.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}},L.MessageManager.prototype.findAndLoadMessages=function(e,t){var r=this.languages_.concat(),o=[],n=[];function i(e){e?o=r.shift():n=r.shift(),r.length?s():t(o,n)}var s=function(){this.loadMessages(this.replaceReferences(e,r),i.bind(this,!0),i.bind(this,!1))}.bind(this);s()},L.MessageManager.prototype.loadMessages=function(e,t,r){var o=new XMLHttpRequest;o.onload=()=>{this.addMessages(JSON.parse(o.responseText)),t()},r&&(o.onerror=()=>r(o)),o.open("GET",e),o.send()},L.MessageManager.prototype.replaceReferences=L.i18n.replaceReferences,L.MessageManager.prototype.get=function(e,t,r){let o=L.i18n.getMessage(e,t);return o||((o=this.messages[e])||(console.warn("Unknown message: "+e),o=void 0===r?e:r,this.messages[e]=o),this.replaceReferences(o,t))},L.MessageManager.prototype.processI18nAttributes=function(e){for(var t=e.querySelectorAll("[i18n]"),r=0;re.replace(/-/g,"_").toUpperCase();var r=e.getAttribute("i18n");if(r){try{r=JSON.parse(r)}catch(t){throw console.error("Can't parse "+e.tagName+"#"+e.id+": "+r),t}for(var o in r){var n=o,i=r[o];i.startsWith("=")&&(o=i.substr(1),i=r[o]),i.startsWith("$")&&(i=t(e.getAttribute(i.substr(1))+"_"+o));var s=this.get(i);"_"==n?e.textContent=s:e.setAttribute(n,s)}}},L.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.isImportingJson_=!1,this.prefRecords_={},this.globalObservers_=[],this.childFactories_={},this.childLists_={}},L.PreferenceManager.prototype.DEFAULT_VALUE=L.f.createEnum("DEFAULT"),L.PreferenceManager.Record=function(e,t){this.name=e,this.defaultValue=t,this.currentValue=this.DEFAULT_VALUE,this.observers=[]},L.PreferenceManager.Record.prototype.DEFAULT_VALUE=L.PreferenceManager.prototype.DEFAULT_VALUE,L.PreferenceManager.Record.prototype.addObserver=function(e){this.observers.push(e)},L.PreferenceManager.Record.prototype.removeObserver=function(e){var t=this.observers.indexOf(e);t>=0&&this.observers.splice(t,1)},L.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},L.PreferenceManager.prototype.deactivate=function(){if(!this.isActive_)throw new Error("Not activated");this.isActive_=!1,this.storage.removeObserver(this.storageObserver_)},L.PreferenceManager.prototype.activate=function(){if(this.isActive_)throw new Error("Already activated");this.isActive_=!0,this.storage.addObserver(this.storageObserver_)},L.PreferenceManager.prototype.readStorage=function(e){var t=0;function r(){0==--t&&e&&e()}var o=Object.keys(this.prefRecords_).map(e=>this.prefix+e);this.trace&&console.log("Preferences read: "+this.prefix),this.storage.getItems(o,function(o){var n=this.prefix.length;for(var i in o){var s=o[i],a=i.substr(n),l=a in this.childLists_&&JSON.stringify(s)!=JSON.stringify(this.prefRecords_[a].currentValue);this.prefRecords_[a].currentValue=s,l&&(t++,this.syncChildList(a,r))}0==t&&e&&setTimeout(e)}.bind(this))},L.PreferenceManager.prototype.definePreference=function(e,t,r){var o=this.prefRecords_[e];o?this.changeDefault(e,t):o=this.prefRecords_[e]=new L.PreferenceManager.Record(e,t),r&&o.addObserver(r)},L.PreferenceManager.prototype.definePreferences=function(e){for(var t=0;t=0&&i.splice(l,1),!this.childLists_[e][a]){var c=this.childFactories_[e](this,a);if(!c){console.warn("Unable to restore child: "+e+": "+a);continue}c.trace=this.trace,this.childLists_[e][a]=c,r++,c.readStorage(o)}}for(s=0;s{if(--r<1){t&&t();for(let t in e)t in this.childLists_&&this.set(t,this.get(t));this.isImportingJson_=!1}};for(var n in e)if(n in this.childLists_)for(var i=e[n],s=0;s{const n=L.f.lastError();if(n){if(n.indexOf("MAX_WRITE_OPERATIONS"))return console.warn(`Will retry save of ${e} after exceeding quota: ${n}`),void setTimeout(()=>this.setItem(e,t,o),1e3);console.error(`Unknown runtime error: ${n}`)}r&&r()};var n={};n[e]=t,this.storage_.set(n,o)},L.Storage.Chrome.prototype.setItems=function(e,t){this.storage_.set(e,t)},L.Storage.Chrome.prototype.removeItem=function(e,t){this.storage_.remove(e,t)},L.Storage.Chrome.prototype.removeItems=function(e,t){this.storage_.remove(e,t)},L.Storage.Local=function(){this.observers_=[],this.storage_=window.localStorage,window.addEventListener("storage",this.onStorage_.bind(this))},L.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 n=0;n=0;o--){var n=e[o],i=this.storage_.getItem(n);if("string"==typeof i)try{r[n]=JSON.parse(i)}catch(e){r[n]=i}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},L.Storage.Local.prototype.setItem=function(e,t,r){this.storage_.setItem(e,JSON.stringify(t)),r&&setTimeout(r,0)},L.Storage.Local.prototype.setItems=function(e,t){for(var r in e)this.storage_.setItem(r,JSON.stringify(e[r]));t&&setTimeout(t,0)},L.Storage.Local.prototype.removeItem=function(e,t){this.storage_.removeItem(e),t&&setTimeout(t,0)},L.Storage.Local.prototype.removeItems=function(e,t){for(var r=0;r=0;o--){var n=e[o],i=this.storage_[n];if("string"==typeof i)try{r[n]=JSON.parse(i)}catch(e){r[n]=i}else e.splice(o,1)}setTimeout(t.bind(null,r),0)},L.Storage.Memory.prototype.setItem=function(e,t,r){var o=this.storage_[e];this.storage_[e]=JSON.stringify(t);var n={};n[e]={oldValue:o,newValue:t},setTimeout(function(){for(var e=0;e1114111?t+="�":n<65536?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode(55296+(n>>>10&1023),56320+(1023&n)))}}else t+="�",this.bytesLeft=0,r--}return t},L.decodeUTF8=function(e){return(new L.UTF8Decoder).decode(e)},L.encodeUTF8=function(e){for(var t="",r=0;r>>6),o=1):n<=65535?(t+=String.fromCharCode(224|n>>>12),o=2):(t+=String.fromCharCode(240|n>>>18),o=3);o>0;)o--,t+=String.fromCharCode(128|n>>>6*o&63)}return t},L.wc={},L.wc.nulWidth=0,L.wc.controlWidth=0,L.wc.regardCjkAmbiguous=!1,L.wc.cjkAmbiguousWidth=2,L.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],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,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],[2558,2558],[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],[2901,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[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],[3457,3457],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,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,6848],[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],[43052,43052],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[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],[68900,68903],[69291,69292],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70095,70095],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[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],[71727,71735],[71737,71738],[71995,71996],[71998,71998],[72003,72003],[72148,72151],[72154,72155],[72160,72160],[72193,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],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[94180,94180],[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],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],L.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,94180],[94192,94193],[94208,101589],[101632,101640],[110592,110895],[110928,110930],[110948,110951],[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],[128725,128727],[128747,128748],[128756,128764],[128992,129003],[129292,129338],[129340,129349],[129351,129400],[129402,129483],[129485,129535],[129648,129652],[129656,129658],[129664,129670],[129680,129704],[129712,129718],[129728,129730],[129744,129750],[131072,196605],[196608,262141],[917760,917999],[983040,1048573],[1048576,1114109]],L.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,94180],[94192,94193],[94208,101589],[101632,101640],[110592,110895],[110928,110930],[110948,110951],[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],[128725,128727],[128747,128748],[128756,128764],[128992,129003],[129292,129338],[129340,129349],[129351,129400],[129402,129483],[129485,129535],[129648,129652],[129656,129658],[129664,129670],[129680,129704],[129712,129718],[129728,129730],[129744,129750],[131072,196605],[196608,262141]],L.wc.binaryTableSearch_=function(e,t){var r,o=0,n=t.length-1;if(et[n][1])return!1;for(;n>=o;)if(e>t[r=Math.floor((o+n)/2)][1])o=r+1;else{if(!(e=32?1:0==e?L.wc.nulWidth:L.wc.controlWidth:e<160?L.wc.controlWidth:L.wc.isSpace(e)?0:L.wc.binaryTableSearch_(e,L.wc.unambiguous)?2:1},L.wc.charWidthRegardAmbiguous=function(e){return L.wc.isCjkAmbiguous(e)?L.wc.cjkAmbiguousWidth:L.wc.charWidthDisregardAmbiguous(e)},L.wc.strWidth=function(e){for(var t,r=0,o=0;ot)break;i+=r<=65535?1:2}if(null!=r){for(o=i,n=0;or)break;o+=t<=65535?1:2}return e.substring(i,o)}return e.substr(i)},L.wc.substring=function(e,t,r){return L.wc.substr(e,t,r-t)},L.rtdep("lib.Storage");var U={windowType:null,os:null,zoomWarningMessage:"ZOOM != 100%",notifyCopyMessage:"✂",desktopNotificationTitle:"♪ %(title) ♪",testDeps:["hterm.AccessibilityReader.Tests","hterm.ScrollPort.Tests","hterm.Screen.Tests","hterm.Terminal.Tests","hterm.VT.Tests","hterm.VT.CannedTests"]};L.registerInit("hterm",(function(e){function t(t){U.os=t,e()}function r(){L.i18n.getAcceptLanguages(e=>{U.messageManager||(U.messageManager=new L.MessageManager(e)),L.f.getOs().then(t).catch(t)})}function o(e){U.windowType=e.type,r()}U.defaultStorage||(window.chrome&&chrome.storage&&chrome.storage.sync?U.defaultStorage=new L.Storage.Chrome(chrome.storage.sync):U.defaultStorage=new L.Storage.Local);var n=!1;if(window.chrome&&chrome.runtime&&chrome.runtime.getManifest){var i=chrome.runtime.getManifest();n=i.app&&i.app.background}n?setTimeout(o.bind(null,{type:"popup"}),0):window.chrome&&chrome.tabs?chrome.tabs.getCurrent((function(e){e&&window.chrome?chrome.windows.get(e.windowId,null,o):(U.windowType="normal",r())})):setTimeout(o.bind(null,{type:"normal"}),0)})),U.getClientSize=function(e){return e.getBoundingClientRect()},U.getClientWidth=function(e){return e.getBoundingClientRect().width},U.getClientHeight=function(e){return e.getBoundingClientRect().height},U.copySelectionToClipboard=function(e){try{e.execCommand("copy")}catch(e){}},U.pasteFromClipboard=function(e){try{return e.execCommand("paste")}catch(e){return!1}},U.msg=function(e,t=[],r){return U.messageManager.get("HTERM_"+e,t,r)},U.notify=function(e){var t=(e,t)=>void 0!==e?e:t;null==e&&(e={});var r={body:e.body,icon:t(e.icon,L.resource.getDataUrl("hterm/images/icon-96"))},o=t(e.title,window.document.title);o||(o="hterm"),o=L.f.replaceVars(U.desktopNotificationTitle,{title:o});var n=new Notification(o,r);return n.onclick=function(){window.focus(),this.close()},n},U.openUrl=function(e){if(window.chrome&&chrome.browser&&chrome.browser.openTab)chrome.browser.openTab({url:e});else{window.open(e,"_blank").focus()}},U.Size=function(e,t){this.width=e,this.height=t},U.Size.prototype.resize=function(e,t){this.width=e,this.height=t},U.Size.prototype.clone=function(){return new U.Size(this.width,this.height)},U.Size.prototype.setTo=function(e){this.width=e.width,this.height=e.height},U.Size.prototype.equals=function(e){return this.width==e.width&&this.height==e.height},U.Size.prototype.toString=function(){return"[hterm.Size: "+this.width+", "+this.height+"]"},U.RowCol=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},U.RowCol.prototype.move=function(e,t,r){this.row=e,this.column=t,this.overflow=!!r},U.RowCol.prototype.clone=function(){return new U.RowCol(this.row,this.column,this.overflow)},U.RowCol.prototype.setTo=function(e){this.row=e.row,this.column=e.column,this.overflow=e.overflow},U.RowCol.prototype.equals=function(e){return this.row==e.row&&this.column==e.column&&this.overflow==e.overflow},U.RowCol.prototype.toString=function(){return"[hterm.RowCol: "+this.row+", "+this.column+", "+this.overflow+"]"},U.AccessibilityReader=function(e){this.document_=e.ownerDocument;const t=this.document_.createElement("div");t.id="hterm:accessibility-live-region",t.style.cssText="position: absolute;\n width: 0; height: 0;\n overflow: hidden;\n left: 0; top: 0;",e.appendChild(t),this.accessibilityEnabled=!1,this.liveElement_=this.document_.createElement("p"),this.liveElement_.setAttribute("aria-live","polite"),this.liveElement_.setAttribute("aria-label",""),t.appendChild(this.liveElement_),this.assertiveLiveElement_=this.document_.createElement("p"),this.assertiveLiveElement_.setAttribute("aria-live","assertive"),this.assertiveLiveElement_.setAttribute("aria-label",""),t.appendChild(this.assertiveLiveElement_),this.queue_=[],this.nextReadTimer_=null,this.cursorIsChanging_=!1,this.cursorChangeQueue_=[],this.lastCursorRowString_=null,this.lastCursorRow_=null,this.lastCursorColumn_=null,this.hasUserGesture=!1},U.AccessibilityReader.DELAY=50,U.AccessibilityReader.prototype.setAccessibilityEnabled=function(e){e||this.clear(),this.accessibilityEnabled=e},U.AccessibilityReader.prototype.decorate=function(e){["keydown","keypress","keyup","textInput"].forEach(t=>{e.addEventListener(t,()=>{this.hasUserGesture=!0})})},U.AccessibilityReader.prototype.beforeCursorChange=function(e,t,r){this.accessibilityEnabled&&this.hasUserGesture&&!this.cursorIsChanging_&&(this.cursorIsChanging_=!0,this.lastCursorRowString_=e,this.lastCursorRow_=t,this.lastCursorColumn_=r)},U.AccessibilityReader.prototype.afterCursorChange=function(e,t,r){if(this.cursorIsChanging_){if(this.cursorIsChanging_=!1,!this.announceAction_(e,t,r))for(let e=0;e0)this.queue_.push("");else{if(0==this.queue_.length)this.queue_.push(e);else{let t="";0!=this.queue_[this.queue_.length-1].length&&(t=" "),this.queue_[this.queue_.length-1]+=t+e}if(!this.nextReadTimer_){if(1!=this.queue_.length)throw new Error("Expected only one item in queue_ or nextReadTimer_ to be running.");this.nextReadTimer_=setTimeout(this.addToLiveRegion_.bind(this),U.AccessibilityReader.DELAY)}}},U.AccessibilityReader.prototype.assertiveAnnounce=function(e){this.hasUserGesture&&" "==e&&(e=U.msg("SPACE_CHARACTER",[],"Space")),(e=e.trim())==this.assertiveLiveElement_.getAttribute("aria-label")&&(e="\n"+e),this.clear(),this.assertiveLiveElement_.setAttribute("aria-label",e)},U.AccessibilityReader.prototype.newLine=function(){this.announce("\n")},U.AccessibilityReader.prototype.clear=function(){this.liveElement_.setAttribute("aria-label",""),this.assertiveLiveElement_.setAttribute("aria-label",""),clearTimeout(this.nextReadTimer_),this.nextReadTimer_=null,this.queue_=[],this.cursorIsChanging_=!1,this.cursorChangeQueue_=[],this.lastCursorRowString_=null,this.lastCursorRow_=null,this.lastCursorColumn_=null,this.hasUserGesture=!1},U.AccessibilityReader.prototype.announceAction_=function(e,t,r){if(this.lastCursorRow_!=t)return!1;if(this.lastCursorRowString_==e){if(this.lastCursorColumn_!=r&&""==this.cursorChangeQueue_.join("").trim()){const e=Math.min(this.lastCursorColumn_,r),t=Math.abs(r-this.lastCursorColumn_);return this.assertiveAnnounce(L.wc.substr(this.lastCursorRowString_,e,t)),!0}return!1}if(this.lastCursorRowString_!=e){if(this.lastCursorColumn_+1==r&&" "==L.wc.substr(e,r-1,1)&&this.cursorChangeQueue_.length>0&&" "==this.cursorChangeQueue_[0])return this.assertiveAnnounce(" "),!0;const t=r;if(L.wc.strWidth(e)<=L.wc.strWidth(this.lastCursorRowString_)&&L.wc.substr(this.lastCursorRowString_,0,t)==L.wc.substr(e,0,t)){let r=L.wc.strWidth(e);for(;r>0&&(r!=t&&" "==L.wc.substr(e,r-1,1));--r);const o=L.wc.strWidth(this.lastCursorRowString_)-r,n=r-t;if(L.wc.substr(this.lastCursorRowString_,t+o,n)==L.wc.substr(e,t,n)){const e=L.wc.substr(this.lastCursorRowString_,t,o);if(""!=e)return this.assertiveAnnounce(e),!0}}return!1}return!1},U.AccessibilityReader.prototype.addToLiveRegion_=function(){this.nextReadTimer_=null;let e=this.queue_.join("\n").trim();e==this.liveElement_.getAttribute("aria-label")&&(e="\n"+e),this.liveElement_.setAttribute("aria-label",e),this.queue_=[]},L.rtdep("hterm.Keyboard.KeyMap"),U.Keyboard=function(e){this.terminal=e,this.keyboardElement_=null,this.handlers_=[],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},U.Keyboard.KeyActions={CANCEL:L.f.createEnum("CANCEL"),DEFAULT:L.f.createEnum("DEFAULT"),PASS:L.f.createEnum("PASS"),STRIP:L.f.createEnum("STRIP")},U.Keyboard.prototype.encode=function(e){return"utf-8"==this.characterEncoding?this.terminal.vt.encodeUTF8(e):e},U.Keyboard.prototype.installKeyboard=function(e){if(e!=this.keyboardElement_){e&&this.keyboardElement_&&this.installKeyboard(null);for(var t=0;t{this.definePreference(e,t.default)})},U.PreferenceManager.prefix_="/hterm/profiles/",U.PreferenceManager.listProfiles=function(e){U.defaultStorage.getItems(null,t=>{const r={};for(let e of Object.keys(t))if(e.startsWith(U.PreferenceManager.prefix_)){r[e.slice(U.PreferenceManager.prefix_.length).split("/",1)[0]]=!0}e(Object.keys(r))})},U.PreferenceManager.categories={},U.PreferenceManager.categories.Keyboard="Keyboard",U.PreferenceManager.categories.Appearance="Appearance",U.PreferenceManager.categories.CopyPaste="CopyPaste",U.PreferenceManager.categories.Sounds="Sounds",U.PreferenceManager.categories.Scrolling="Scrolling",U.PreferenceManager.categories.Encoding="Encoding",U.PreferenceManager.categories.Extensions="Extensions",U.PreferenceManager.categories.Miscellaneous="Miscellaneous",U.PreferenceManager.categoryDefinitions=[{id:U.PreferenceManager.categories.Appearance,text:"Appearance (fonts, colors, images)"},{id:U.PreferenceManager.categories.CopyPaste,text:"Copy & Paste"},{id:U.PreferenceManager.categories.Encoding,text:"Encoding"},{id:U.PreferenceManager.categories.Keyboard,text:"Keyboard"},{id:U.PreferenceManager.categories.Scrolling,text:"Scrolling"},{id:U.PreferenceManager.categories.Sounds,text:"Sounds"},{id:U.PreferenceManager.categories.Extensions,text:"Extensions"},{id:U.PreferenceManager.categories.Miscellaneous,text:"Miscellaneous"}],U.PreferenceManager.definePref_=function(e,t,r,o){return{category:e,default:t,type:r,help:o}},U.PreferenceManager.defaultPreferences={"alt-gr-mode":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,[null,"none","ctrl-alt","left-alt","right-alt"],"Select an AltGr detection heuristic.\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."),"alt-backspace-is-meta-backspace":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","Whether the Alt key acts as a Meta key or as a distinct Alt key."),"alt-sends-what":U.PreferenceManager.definePref_(U.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 typed 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 browser\n performs a default action for some Alt sequences.)"),"audible-bell-sound":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Sounds,"lib-resource:hterm/audio/bell","url","URL of the terminal bell sound. Empty string for no audible bell."),"desktop-notification-bell":U.PreferenceManager.definePref_(U.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. Browsers may not show this permission request if it was not triggered by a user action.\n\nChrome extensions with the "notifications" permission have permission to display notifications.'),"background-color":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"rgb(16, 16, 16)","color","The background color for text with no other color attributes."),"background-image":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","string","CSS value of the background image size."),"background-position":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","string","CSS value of the background image position.\n\nFor example:\n 10% 10%\n center"),"backspace-sends-backspace":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,!0,"bool","Whether to close the window when the command finishes executing."),"cursor-blink":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,!1,"bool","Whether the text cursor blinks by default. This can be toggled at runtime via terminal escape sequences."),"cursor-blink-cycle":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,[1e3,500],"value","The text cursor blink rate in milliseconds.\n\nA two element array, the first of which is how long the text cursor should be on, second is how long it should be off."),"cursor-color":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"rgba(255, 0, 0, 0.5)","color","The color of the visible text cursor."),"color-palette-overrides":U.PreferenceManager.definePref_(U.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 standard 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.\n\nFor example, these both set color index 1 to blue:\n {1: "#0000ff"}\n [null, "#0000ff"]'),"copy-on-select":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Automatically copy mouse selection to the clipboard."),"use-default-window-copy":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!1,"bool","Whether to use the default browser/OS's copy behavior.\n\nAllow the browser/OS to handle the copy event directly which might improve compatibility with some systems (where copying doesn't work at all), but makes the text selection less robust.\n\nFor example, long lines that were automatically line wrapped will be copied with the newlines still in them."),"clear-selection-after-copy":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Whether to clear the selection after copying."),"ctrl-plus-minus-zero-zoom":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","Whether East Asian Ambiguous characters have two column width."),"enable-8-bit-control":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,null,"tristate","If true, 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,!0,"bool","If true, use bright colors (8-15 on a 16 color palette) for any text with the bold attribute. False otherwise."),"enable-blink":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,!0,"bool","If true, respect the blink attribute. False to ignore it."),"enable-clipboard-notice":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Whether to show a message in the terminal when the host writes to the clipboard."),"enable-clipboard-write":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","Allow the remote host to write directly to the local system clipboard.\nRead access is never granted regardless of this setting.\n\nThis is used to control access to features like OSC-52."),"enable-dec12":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,!1,"bool","Respect the host's attempt to change the text cursor blink status using DEC Private Mode 12."),"enable-csi-j-3":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,!0,"bool","Whether CSI-J (Erase Display) mode 3 may clear the terminal scrollback buffer.\n\nEnabling this by default is safe."),environment:U.PreferenceManager.definePref_(U.PreferenceManager.categories.Miscellaneous,{NCURSES_NO_UTF8_ACS:"1",TERM:"xterm-256color",COLORTERM:"truecolor"},"value","The initial set of environment variables, as an object."),"font-family":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,'"DejaVu Sans Mono", "Noto Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace',"string","Default font family for the terminal text."),"font-size":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,15,"int","The default font size in pixels."),"font-smoothing":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"antialiased","string","CSS font-smoothing property."),"foreground-color":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"rgb(240, 240, 240)","color","The foreground color for text with no other color attributes."),"hide-mouse-while-typing":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether to automatically hide the mouse cursor when typing. By default, autodetect whether the platform/OS handles this.\n\nNote: Some operating systems may override this setting and thus you might not be able to always disable it."),"home-keys-scroll":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","If true, Home/End controls the terminal scrollbar and Shift-Home/Shift-End are sent to the remote host. If false, then Home/End are sent to the remote host and Shift-Home/Shift-End scrolls."),keybindings:U.PreferenceManager.definePref_(U.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 as 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": "clearTerminal",\n "Ctrl-Shift-L": "PASS",\n "Ctrl-H": "\'Hello World\'"\n}'),"media-keys-are-fkeys":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!0,"bool","Send an ESC prefix when pressing a key while holding the Meta key.\n\nFor example, when enabled, pressing Meta-K will send ^[k as if you typed Escape then k. When disabled, only k will be sent."),"mouse-right-click-paste":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool",'Paste on right mouse button clicks.\n\nThis option is independent of the "mouse-paste-button" setting.\n\nNote: This will handle left & right handed mice correctly.'),"mouse-paste-button":U.PreferenceManager.definePref_(U.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 independent of the setting for right-click paste.\n\nNote: This will handle left & right handed mice correctly."),"word-break-match-left":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!1,"bool","If true, Page Up/Page Down controls the terminal scrollbar and Shift-Page Up/Shift-Page Down are sent to the remote host. If false, then Page Up/Page Down are sent to the remote host and Shift-Page Up/Shift-Page Down scrolls."),"pass-alt-number":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether Alt-1..9 is passed 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether Ctrl-1..9 is passed 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,null,"tristate","Whether Meta-1..9 is passed 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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!0,"bool","Whether Meta-V gets passed to host."),"paste-on-drop":U.PreferenceManager.definePref_(U.PreferenceManager.categories.CopyPaste,!0,"bool","If true, Drag and dropped text will paste into terminal.\nIf false, dropped text will be ignored."),"receive-encoding":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the expected encoding for data received from the host.\nIf the encodings do not match, visual bugs are likely to be observed.\n\nValid values are 'utf-8' and 'raw'."),"scroll-on-keystroke":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,!0,"bool","Whether to scroll to the bottom on any keystroke."),"scroll-on-output":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,!1,"bool","Whether to scroll to the bottom on terminal output."),"scrollbar-visible":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,!0,"bool","The vertical scrollbar mode."),"scroll-wheel-may-send-arrow-keys":U.PreferenceManager.definePref_(U.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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Scrolling,1,"int","The multiplier for scroll wheel events when measured in pixels.\n\nAlters how fast the page scrolls."),"send-encoding":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Encoding,"utf-8",["utf-8","raw"],"Set the encoding for data sent to host."),"terminal-encoding":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Encoding,"utf-8",["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":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Keyboard,!0,"bool","Whether Shift-Insert is used for pasting or is sent to the remote host."),"user-css":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","url","URL of user stylesheet to include in the terminal document."),"user-css-text":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Appearance,"","multiline-string","Custom CSS text for styling the terminal."),"allow-images-inline":U.PreferenceManager.definePref_(U.PreferenceManager.categories.Extensions,null,"tristate","Whether to allow the remote host to display images in the terminal.\n\nBy default, we prompt until a choice is made.")},U.PreferenceManager.prototype=Object.create(L.PreferenceManager.prototype),U.PreferenceManager.constructor=U.PreferenceManager,U.PubSub=function(){this.observers_={}},U.PubSub.addBehavior=function(e){var t=new U.PubSub;for(var r in U.PubSub.prototype)e[r]=U.PubSub.prototype[r].bind(t)},U.PubSub.prototype.subscribe=function(e,t){e in this.observers_||(this.observers_[e]=[]),this.observers_[e].push(t)},U.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)},U.PubSub.prototype.publish=function(e,t,r){var o=this.observers_[e];o&&(o=[].concat(o)),r&&(o?o.push(r):o=[r]),o&&setTimeout((function e(r){r=e&&this.setCursorPosition(this.cursorPosition.row,e-1)},U.Screen.prototype.shiftRow=function(){return this.shiftRows(1)[0]},U.Screen.prototype.shiftRows=function(e){return this.rowsArray.splice(0,e)},U.Screen.prototype.unshiftRow=function(e){this.rowsArray.splice(0,0,e)},U.Screen.prototype.unshiftRows=function(e){this.rowsArray.unshift.apply(this.rowsArray,e)},U.Screen.prototype.pushRow=function(e){this.rowsArray.push(e)},U.Screen.prototype.pushRows=function(e){e.push.apply(this.rowsArray,e)},U.Screen.prototype.insertRow=function(e,t){this.rowsArray.splice(e,0,t)},U.Screen.prototype.insertRows=function(e,t){for(var r=0;r=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=U.TextAttributes.nodeWidth(this.cursorNode_),this.cursorOffset_U.TextAttributes.nodeWidth(e);){if(!e.hasAttribute("line-overflow")||!e.nextSibling)return-1;t-=U.TextAttributes.nodeWidth(e),e=e.nextSibling}return this.getNodeAndOffsetWithinRow_(e,t)},U.Screen.prototype.getNodeAndOffsetWithinRow_=function(e,t){for(var r=0;ra)){var p=L.wc.substring(c,a,L.wc.strWidth(c)),f=new RegExp("^"+o+r),g=p.match(f);if(g){var m=a+L.wc.strWidth(g[0]);-1==m||m\"'\\^!@#$%&*,;:`]","[^\\s\\[\\](){}<>\"'\\^!@#$%&*,;:~.`]","[^\\s\\[\\](){}<>\"'\\^]*")},U.Screen.prototype.saveCursorAndState=function(e){this.cursorState_.save(e)},U.Screen.prototype.restoreCursorAndState=function(e){this.cursorState_.restore(e)},U.Screen.CursorState=function(e){this.screen_=e,this.cursor=null,this.textAttributes=null,this.GL=this.GR=this.G0=this.G1=this.G2=this.G3=null},U.Screen.CursorState.prototype.save=function(e){this.cursor=e.terminal.saveCursor(),this.textAttributes=this.screen_.textAttributes.clone(),this.GL=e.GL,this.GR=e.GR,this.G0=e.G0,this.G1=e.G1,this.G2=e.G2,this.G3=e.G3},U.Screen.CursorState.prototype.restore=function(e){e.terminal.restoreCursor(this.cursor);const t=this.textAttributes.clone();t.colorPalette=this.screen_.textAttributes.colorPalette,t.syncColors(),this.screen_.textAttributes=t,e.GL=this.GL,e.GR=this.GR,e.G0=this.G0,e.G1=this.G1,e.G2=this.G2,e.G3=this.G3},L.rtdep("lib.f","hterm.PubSub","hterm.Size"),U.ScrollPort=function(e){U.PubSub.addBehavior(this),this.rowProvider_=e,this.characterSize=new U.Size(10,10),this.ruler_=null,this.selection=new U.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.pasteOnDrop=!0,this.div_=null,this.document_=null,this.timeouts_={},this.observers_={},this.DEBUG_=!1},U.ScrollPort.Selection=function(e){this.scrollPort_=e,this.startRow=null,this.endRow=null,this.isMultiline=null,this.isCollapsed=null},U.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},U.ScrollPort.prototype.setAccessibilityReader=function(e){this.accessibilityReader_=e},U.ScrollPort.prototype.scrollPageUp=function(){if(0==this.getTopRowIndex())return;const e=this.getTopRowIndex();this.scrollRowToTop(e-this.visibleRowCount+1),this.assertiveAnnounce_()},U.ScrollPort.prototype.scrollPageDown=function(){if(this.isScrolledEnd)return;const e=this.getTopRowIndex();this.scrollRowToTop(e+this.visibleRowCount-1),this.assertiveAnnounce_()},U.ScrollPort.prototype.setFontFamily=function(e,t){this.screen_.style.fontFamily=e,this.screen_.style.webkitFontSmoothing=t||"",this.syncCharacterSize()},U.ScrollPort.prototype.getFontFamily=function(){return this.screen_.style.fontFamily},U.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_)},U.ScrollPort.prototype.setUserCssText=function(e){this.userCssText_.textContent=e},U.ScrollPort.prototype.focus=function(){this.iframe_.focus(),this.screen_.focus(),this.publish("focus")},U.ScrollPort.prototype.getForegroundColor=function(){return this.screen_.style.color},U.ScrollPort.prototype.setForegroundColor=function(e){this.screen_.style.color=e,this.scrollUpButton_.style.backgroundColor=e,this.scrollDownButton_.style.backgroundColor=e},U.ScrollPort.prototype.getBackgroundColor=function(){return this.screen_.style.backgroundColor},U.ScrollPort.prototype.setBackgroundColor=function(e){this.screen_.style.backgroundColor=e,this.scrollUpButton_.style.color=e,this.scrollDownButton_.style.color=e},U.ScrollPort.prototype.setBackgroundImage=function(e){this.screen_.style.backgroundImage=e},U.ScrollPort.prototype.setBackgroundSize=function(e){this.screen_.style.backgroundSize=e},U.ScrollPort.prototype.setBackgroundPosition=function(e){this.screen_.style.backgroundPosition=e},U.ScrollPort.prototype.setCtrlVPaste=function(e){this.ctrlVPaste=e},U.ScrollPort.prototype.setPasteOnDrop=function(e){this.pasteOnDrop=e},U.ScrollPort.prototype.getScreenSize=function(){var e=U.getClientSize(this.screen_);return{height:e.height,width:e.width-this.currentScrollbarWidthPx}},U.ScrollPort.prototype.getScreenWidth=function(){return this.getScreenSize().width},U.ScrollPort.prototype.getScreenHeight=function(){return this.getScreenSize().height},U.ScrollPort.prototype.getDocument=function(){return this.document_},U.ScrollPort.prototype.getScreenNode=function(){return this.screen_},U.ScrollPort.prototype.resetCache=function(){this.currentRowNodeCache_=null,this.previousRowNodeCache_={}},U.ScrollPort.prototype.setRowProvider=function(e){this.resetCache(),this.rowProvider_=e,this.scheduleRedraw()},U.ScrollPort.prototype.setFontSize=function(e){this.screen_.style.fontSize=e+"px",this.syncCharacterSize()},U.ScrollPort.prototype.getFontSize=function(){return parseInt(this.screen_.style.fontSize)},U.ScrollPort.prototype.syncCharacterSize=function(){this.characterSize=this.measureCharacterSize(),this.resize()},U.ScrollPort.prototype.assertiveAnnounce_=function(){if(!this.accessibilityReader_)return;const e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);let r=100*e/Math.max(1,this.rowProvider_.getRowCount()-this.visibleRowCount);r=Math.min(100,Math.round(r));let o=U.msg("ANNOUNCE_CURRENT_SCREEN_HEADER",[r],"$1% scrolled,");o+="\n";for(let r=e;r<=t;++r){o+=this.fetchRowNode_(r).textContent+"\n"}this.accessibilityReader_.assertiveAnnounce(o)},U.ScrollPort.prototype.syncScrollHeight=function(){this.lastRowCount_=this.rowProvider_.getRowCount(),this.scrollArea_.style.height=this.characterSize.height*this.lastRowCount_+this.visibleRowTopMargin+this.visibleRowBottomMargin+"px"},U.ScrollPort.prototype.scheduleRedraw=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout((function(){delete e.timeouts_.redraw,e.redraw_()}),0)}},U.ScrollPort.prototype.updateScrollButtonState_=function(){const e=(e,t)=>{e.setAttribute("aria-disabled",t?"true":"false"),e.style.opacity=t?.5:1};e(this.scrollUpButton_,0==this.getTopRowIndex()),e(this.scrollDownButton_,this.isScrolledEnd)},U.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)}},U.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)}},U.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_))},U.ScrollPort.prototype.cacheRowNode_=function(e){this.currentRowNodeCache_[e.rowIndex]=e},U.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},U.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()},U.ScrollPort.prototype.getScrollMax_=function(e){return U.getClientHeight(this.scrollArea_)+this.visibleRowTopMargin+this.visibleRowBottomMargin-U.getClientHeight(this.screen_)},U.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())},U.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)},U.ScrollPort.prototype.getTopRowIndex=function(){return Math.round(this.screen_.scrollTop/this.characterSize.height)},U.ScrollPort.prototype.getBottomRowIndex=function(e){return e+this.visibleRowCount-1},U.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()},U.ScrollPort.prototype.onScrollWheel=function(e){},U.ScrollPort.prototype.onScrollWheel_=function(e){if(this.onScrollWheel(e),e.defaultPrevented)return;const t=this.scrollWheelDelta(e);let r=this.screen_.scrollTop-t.y;r<0&&(r=0);var o=this.getScrollMax_();r>o&&(r=o),r!=this.screen_.scrollTop&&(this.screen_.scrollTop=r,e.preventDefault())},U.ScrollPort.prototype.scrollWheelDelta=function(e){const t={x:0,y:0};switch(e.deltaMode){case WheelEvent.DOM_DELTA_PIXEL:t.x=e.deltaX*this.scrollWheelMultiplier_,t.y=e.deltaY*this.scrollWheelMultiplier_;break;case WheelEvent.DOM_DELTA_LINE:t.x=e.deltaX*this.characterSize.width,t.y=e.deltaY*this.characterSize.height;break;case WheelEvent.DOM_DELTA_PAGE:t.x=e.deltaX*this.characterSize.width*this.screen_.getWidth(),t.y=e.deltaY*this.characterSize.height*this.screen_.getHeight()}return t.y*=-1,t},U.ScrollPort.prototype.onTouch=function(e){},U.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;ts&&(i=s),i!=this.screen_.scrollTop&&(this.screen_.scrollTop=i)}e.preventDefault()}},U.ScrollPort.prototype.onResize_=function(e){this.syncCharacterSize()},U.ScrollPort.prototype.onCopy=function(e){},U.ScrollPort.prototype.onCopy_=function(e){if(this.onCopy(e),!(e.defaultPrevented||(this.resetSelectBags_(),this.selection.sync(),this.selection.isCollapsed||this.selection.endRow.rowIndex-this.selection.startRow.rowIndex<2))){var t,r,o=this.getTopRowIndex(),n=this.getBottomRowIndex(o);if(this.selection.startRow.rowIndexn)r=this.selection.startRow.rowIndex>n?this.selection.startRow.rowIndex+1:this.bottomFold_.previousSibling.rowIndex+1,this.bottomSelectBag_.textContent=this.rowProvider_.getRowsText(r,this.selection.endRow.rowIndex),this.rowNodes_.insertBefore(this.bottomSelectBag_,this.selection.endRow)}},U.ScrollPort.prototype.onBodyKeyDown_=function(e){this.ctrlVPaste&&(e.ctrlKey||e.metaKey)&&118==e.keyCode&&this.pasteTarget_.focus()},U.ScrollPort.prototype.onPaste_=function(e){this.pasteTarget_.focus();var t=this;setTimeout((function(){t.publish("paste",{text:t.pasteTarget_.value}),t.pasteTarget_.value="",t.focus()}),0)},U.ScrollPort.prototype.handlePasteTargetTextInput_=function(e){e.stopPropagation()},U.ScrollPort.prototype.onDragAndDrop_=function(e){if(!this.pasteOnDrop)return;let t,r;e.preventDefault(),e.shiftKey&&(e.dataTransfer.types.forEach(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})},U.ScrollPort.prototype.setScrollbarVisible=function(e){this.screen_.style.overflowY=e?"scroll":"hidden"},U.ScrollPort.prototype.setScrollWheelMoveMultipler=function(e){this.scrollWheelMultiplier_=e},L.rtdep("lib.colors","lib.PreferenceManager","lib.resource","lib.wc","lib.f","hterm.AccessibilityReader","hterm.Keyboard","hterm.Options","hterm.PreferenceManager","hterm.Screen","hterm.ScrollPort","hterm.Size","hterm.TextAttributes","hterm.VT"),U.Terminal=function(e){this.profileId_=null,this.primaryScreen_=new U.Screen,this.alternateScreen_=new U.Screen,this.screen_=this.primaryScreen_,this.screenSize=new U.Size(0,0),this.scrollPort_=new U.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_.subscribe("focus",this.onScrollportFocus_.bind(this)),this.scrollPort_.onCopy=this.onCopy_.bind(this),this.div_=null,this.document_=window.document,this.primaryScrollbackRows_=[],this.alternateScrollbackRows_=[],this.scrollbackRows_=this.primaryScrollbackRows_,this.tabStops_=[],this.defaultTabStops=!0,this.vtScrollTop_=null,this.vtScrollBottom_=null,this.cursorNode_=null,this.cursorShape_=U.Terminal.cursorShape.BLOCK,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.setAutomaticMouseHiding(),this.mouseHideDelay_=null,this.bellAudio_=this.document_.createElement("audio"),this.bellAudio_.id="hterm:bell-audio",this.bellAudio_.setAttribute("preload","auto"),this.accessibilityReader_=null,this.bellNotificationList_=[],this.desktopNotificationBell_=!1,this.savedOptions_={},this.options_=new U.Options,this.timeouts_={},this.vt=new U.VT(this),this.saveCursorAndState(!0),this.keyboard=new U.Keyboard(this),this.io=new U.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.allowImagesInline=null,this.reportFocus=!1,this.setProfile(e||"default",function(){this.onTerminalReady()}.bind(this))},U.Terminal.cursorShape={BLOCK:"BLOCK",BEAM:"BEAM",UNDERLINE:"UNDERLINE"},U.Terminal.prototype.onTerminalReady=function(){},U.Terminal.prototype.tabWidth=8,U.Terminal.prototype.setProfile=function(e,t){this.profileId_=e.replace(/\//g,"");var r=this;this.prefs_&&this.prefs_.deactivate(),this.prefs_=new U.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",L.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(L.colors.colorPalette=L.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 n=L.colors.normalizeCSS(e[o]);n&&(L.colors.colorPalette[o]=n)}}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)},"paste-on-drop":function(e){r.scrollPort_.setPasteOnDrop(e)},"east-asian-ambiguous-as-two-column":function(e){L.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.setTextBlink(!!e)},"enable-clipboard-write":function(e){r.vt.enableClipboardWrite=!!e},"enable-dec12":function(e){r.vt.enableDec12=!!e},"enable-csi-j-3":function(e){r.vt.enableCsiJ3=!!e},"font-family":function(e){r.syncFontFamily()},"font-size":function(e){(e=parseInt(e))<=0?console.error(`Invalid font size: ${e}`):r.setFontSize(e)},"font-smoothing":function(e){r.syncFontFamily()},"foreground-color":function(e){r.setForegroundColor(e)},"hide-mouse-while-typing":function(e){r.setAutomaticMouseHiding(e)},"home-keys-scroll":function(e){r.keyboard.homeKeysScroll=e},keybindings:function(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="mac"!=U.os&&"popup"!=U.windowType),r.passAltNumber=e},"pass-ctrl-number":function(e){null==e&&(e="mac"!=U.os&&"popup"!=U.windowType),r.passCtrlNumber=e},"pass-meta-number":function(e){null==e&&(e="mac"==U.os&&"popup"!=U.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},"allow-images-inline":function(e){r.allowImagesInline=e}}),this.prefs_.readStorage(function(){this.prefs_.notifyAll(),t&&t()}.bind(this))},U.Terminal.prototype.getPrefs=function(){return this.prefs_},U.Terminal.prototype.setBracketedPaste=function(e){this.options_.bracketedPaste=e},U.Terminal.prototype.setCursorColor=function(e){void 0===e&&(e=this.prefs_.get("cursor-color")),this.setCssVar("cursor-color",e)},U.Terminal.prototype.getCursorColor=function(){return this.getCssVar("cursor-color")},U.Terminal.prototype.setSelectionEnabled=function(e){this.enableMouseDragScroll=e},U.Terminal.prototype.setBackgroundColor=function(e){void 0===e&&(e=this.prefs_.get("background-color")),this.backgroundColor_=L.colors.normalizeCSS(e),this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.scrollPort_.setBackgroundColor(e)},U.Terminal.prototype.getBackgroundColor=function(){return this.backgroundColor_},U.Terminal.prototype.setForegroundColor=function(e){void 0===e&&(e=this.prefs_.get("foreground-color")),this.foregroundColor_=L.colors.normalizeCSS(e),this.primaryScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.alternateScreen_.textAttributes.setDefaults(this.foregroundColor_,this.backgroundColor_),this.scrollPort_.setForegroundColor(e)},U.Terminal.prototype.getForegroundColor=function(){return this.foregroundColor_},U.Terminal.prototype.runCommandClass=function(e,t){var r=this.prefs_.get("environment");"object"==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()},U.Terminal.prototype.isPrimaryScreen=function(){return this.screen_==this.primaryScreen_},U.Terminal.prototype.installKeyboard=function(){this.keyboard.installKeyboard(this.scrollPort_.getDocument().body)},U.Terminal.prototype.uninstallKeyboard=function(){this.keyboard.installKeyboard(null)},U.Terminal.prototype.setCssVar=function(e,t,r="--hterm-"){this.document_.documentElement.style.setProperty(`${r}${e}`,t)},U.Terminal.prototype.getCssVar=function(e,t="--hterm-"){return this.document_.documentElement.style.getPropertyValue(`${t}${e}`)},U.Terminal.prototype.setFontSize=function(e){e<=0&&(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")},U.Terminal.prototype.getFontSize=function(){return this.scrollPort_.getFontSize()},U.Terminal.prototype.getFontFamily=function(){return this.scrollPort_.getFontFamily()},U.Terminal.prototype.syncFontFamily=function(){this.scrollPort_.setFontFamily(this.prefs_.get("font-family"),this.prefs_.get("font-smoothing")),this.syncBoldSafeState()},U.Terminal.prototype.syncMousePasteButton=function(){var e=this.prefs_.get("mouse-paste-button");"number"!=typeof e?"linux"!=U.os?this.mousePasteButton=1:this.mousePasteButton=2:this.mousePasteButton=e},U.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},U.Terminal.prototype.setTextBlink=function(e){void 0===e&&(e=this.prefs_.get("enable-blink")),this.setCssVar("blink-node-duration",e?"0.7s":"0")},U.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)")},U.Terminal.prototype.saveCursor=function(){return this.screen_.cursorPosition.clone()},U.Terminal.prototype.getTextAttributes=function(){return this.screen_.textAttributes},U.Terminal.prototype.setTextAttributes=function(e){this.screen_.textAttributes=e},U.Terminal.prototype.getZoomFactor=function(){return this.scrollPort_.characterSize.zoomFactor},U.Terminal.prototype.setWindowTitle=function(e){window.document.title=e},U.Terminal.prototype.restoreCursor=function(e){var t=L.f.clamp(e.row,0,this.screenSize.height-1),r=L.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)},U.Terminal.prototype.clearCursorOverflow=function(){this.screen_.cursorPosition.overflow=!1},U.Terminal.prototype.saveCursorAndState=function(e){e?(this.primaryScreen_.saveCursorAndState(this.vt),this.alternateScreen_.saveCursorAndState(this.vt)):this.screen_.saveCursorAndState(this.vt)},U.Terminal.prototype.restoreCursorAndState=function(e){e?(this.primaryScreen_.restoreCursorAndState(this.vt),this.alternateScreen_.restoreCursorAndState(this.vt)):this.screen_.restoreCursorAndState(this.vt)},U.Terminal.prototype.setCursorShape=function(e){this.cursorShape_=e,this.restyleCursor_()},U.Terminal.prototype.getCursorShape=function(){return this.cursorShape_},U.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%"},U.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%"},U.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)},U.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]0){if(t<=this.scrollbackRows_.length){var i=Math.min(t,this.scrollbackRows_.length),s=this.scrollbackRows_.splice(this.scrollbackRows_.length-i,i);this.screen_.unshiftRows(s),t-=i,r.row+=i}t&&this.appendRows_(t)}this.setVTScrollRegion(null,null),this.restoreCursor(r)},U.Terminal.prototype.scrollHome=function(){this.scrollPort_.scrollRowToTop(0)},U.Terminal.prototype.scrollEnd=function(){this.scrollPort_.scrollRowToBottom(this.getRowCount())},U.Terminal.prototype.scrollPageUp=function(){this.scrollPort_.scrollPageUp()},U.Terminal.prototype.scrollPageDown=function(){this.scrollPort_.scrollPageDown()},U.Terminal.prototype.scrollLineUp=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e-1)},U.Terminal.prototype.scrollLineDown=function(){var e=this.scrollPort_.getTopRowIndex();this.scrollPort_.scrollRowToTop(e+1)},U.Terminal.prototype.wipeContents=function(){this.clearHome(this.primaryScreen_),this.clearHome(this.alternateScreen_),this.clearScrollback()},U.Terminal.prototype.clearScrollback=function(){this.scrollEnd(),this.scrollbackRows_.length=0,this.primaryScrollbackRows_.length=0,this.alternateScrollbackRows_.length=0,this.scrollPort_.resetCache(),[this.primaryScreen_,this.alternateScreen_].forEach(e=>{const t=e.getHeight();this.renumberRows_(0,t,e)}),this.syncCursorPosition_(),this.scrollPort_.invalidate()},U.Terminal.prototype.reset=function(){this.vt.reset(),this.clearAllTabStops(),this.setDefaultTabStops();const e=e=>{e.textAttributes.reset(),e.textAttributes.resetColorPalette(),this.clearHome(e),e.saveCursorAndState(this.vt)};e(this.primaryScreen_),e(this.alternateScreen_),this.options_=new U.Options,this.setCursorBlink(!!this.prefs_.get("cursor-blink")),this.setVTScrollRegion(null,null),this.setCursorVisible(!0)},U.Terminal.prototype.softReset=function(){this.vt.reset(),this.options_=new U.Options,this.options_.cursorBlink=!!this.timeouts_.cursorBlink;const e=e=>{e.textAttributes.reset(),e.textAttributes.resetColorPalette(),e.saveCursorAndState(this.vt)};e(this.primaryScreen_),e(this.alternateScreen_),this.setVTScrollRegion(null,null),this.setCursorVisible(!0)},U.Terminal.prototype.forwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=0;te)return void this.setCursorColumn(this.tabStops_[t]);var r=this.screen_.cursorPosition.overflow;this.setCursorColumn(this.screenSize.width-1),this.screen_.cursorPosition.overflow=r},U.Terminal.prototype.backwardTabStop=function(){for(var e=this.screen_.cursorPosition.column,t=this.tabStops_.length-1;t>=0;t--)if(this.tabStops_[t]=0;t--){if(this.tabStops_[t]==e)return;if(this.tabStops_[t] to your HTML to fix."),this.div_=e,this.accessibilityReader_=new U.AccessibilityReader(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.scrollPort_.setAccessibilityReader(this.accessibilityReader_),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.accessibilityReader_.decorate(this.document_);var r=this.onMouse_.bind(this),o=this.scrollPort_.getScreenNode();o.addEventListener("mousedown",r),o.addEventListener("mouseup",r),o.addEventListener("mousemove",r),this.scrollPort_.onScrollWheel=r,o.addEventListener("keydown",this.onKeyboardActivity_.bind(this)),o.addEventListener("focus",this.onFocusChange_.bind(this,!0)),o.addEventListener("mousedown",function(){setTimeout(this.onFocusChange_.bind(this,!0))}.bind(this)),o.addEventListener("blur",this.onFocusChange_.bind(this,!1));var n=this.document_.createElement("style");n.textContent='.cursor-node[focus="false"] { box-sizing: border-box; background-color: transparent !important; border-width: 2px; border-style: solid;}menu { margin: 0; padding: 0; cursor: var(--hterm-mouse-cursor-pointer);}menuitem { white-space: nowrap; border-bottom: 1px dashed; display: block; padding: 0.3em 0.3em 0 0.3em;}menuitem.separator { border-bottom: none; height: 0.5em; padding: 0;}menuitem:hover { color: var(--hterm-cursor-color);}.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);}.uri-node:hover { text-decoration: underline; cursor: var(--hterm-mouse-cursor-pointer), pointer;}@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.insertBefore(n,this.document_.head.firstChild),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: "+(this.options_.cursorVisible?"":"none")+";width: var(--hterm-charsize-width);height: var(--hterm-charsize-height);background-color: var(--hterm-cursor-color);border-color: var(--hterm-cursor-color);-webkit-transition: opacity, background-color 100ms linear;-moz-transition: opacity, background-color 100ms linear;",this.setCursorColor(),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_.setAttribute("aria-hidden","true"),this.scrollBlockerNode_.style.cssText="position: absolute;top: -99px;display: block;width: 10px;height: 10px;",this.document_.body.appendChild(this.scrollBlockerNode_),this.scrollPort_.onScrollWheel=r,["mousedown","mouseup","mousemove","click","dblclick"].forEach(function(e){this.scrollBlockerNode_.addEventListener(e,r),this.cursorNode_.addEventListener(e,r),this.document_.addEventListener(e,r)}.bind(this)),this.cursorNode_.addEventListener("mousedown",function(){setTimeout(this.focus.bind(this))}.bind(this)),this.setReverseVideo(!1),this.scrollPort_.focus(),this.scrollPort_.scheduleRedraw()},U.Terminal.prototype.getDocument=function(){return this.document_},U.Terminal.prototype.focus=function(){this.scrollPort_.focus()},U.Terminal.prototype.getRowNode=function(e){if(e=this.screenSize.width&&(i=!0,n=this.screenSize.width-this.screen_.cursorPosition.column),i&&!this.options_.wraparound?(o=L.wc.substr(e,t,n-1)+L.wc.substr(e,r-1),n=r):o=L.wc.substr(e,t,n);for(var s=U.TextAttributes.splitWidecharString(o),a=0;at)return this.setCssVar("cursor-offset-row","-1"),!1;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 n=this.document_.getSelection();return n&&(n.isCollapsed||o)&&this.screen_.syncSelectionCaret(n),!0},U.Terminal.prototype.restyleCursor_=function(){var e=this.cursorShape_;"false"==this.cursorNode_.getAttribute("focus")&&(e=U.Terminal.cursorShape.BLOCK);var t=this.cursorNode_.style;switch(e){case U.Terminal.cursorShape.BEAM:t.height="var(--hterm-charsize-height)",t.backgroundColor="transparent",t.borderBottomStyle=null,t.borderLeftStyle="solid";break;case U.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="var(--hterm-cursor-color)",t.borderBottomStyle=null,t.borderLeftStyle=null}},U.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=L.MessageManager.replaceReferences(U.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_)},U.Terminal.prototype.showOverlay=function(e,t){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 r=U.getClientSize(this.div_),o=U.getClientSize(this.overlayNode_);this.overlayNode_.style.top=(r.height-o.height)/2+"px",this.overlayNode_.style.left=(r.width-o.width-this.scrollPort_.currentScrollbarWidthPx)/2+"px",this.overlayTimeout_&&clearTimeout(this.overlayTimeout_),this.accessibilityReader_.assertiveAnnounce(e),null!==t&&(this.overlayTimeout_=setTimeout(()=>{this.overlayNode_.style.opacity="0",this.overlayTimeout_=setTimeout(()=>this.hideOverlay(),200)},t||1500))},U.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"},U.Terminal.prototype.paste=function(){return U.pasteFromClipboard(this.document_)},U.Terminal.prototype.copyStringToClipboard=function(e){this.prefs_.get("enable-clipboard-notice")&&setTimeout(this.showOverlay.bind(this,U.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,n=r.anchorOffset,i=r.focusNode,s=r.focusOffset;try{r.selectAllChildren(t)}catch(e){}U.copySelectionToClipboard(this.document_),r.extend&&(r.collapse(o,n),r.extend(i,s)),t.parentNode.removeChild(t)},U.Terminal.prototype.displayImage=function(e,t,r){if(void 0!==e.uri){if(e.name||(e.name=""),!0!==this.allowImagesInline){this.newLine();const e=this.getRowNode(this.scrollbackRows_.length+this.getCursorRow()-1);if(!1===this.allowImagesInline)return void(e.textContent=U.msg("POPUP_INLINE_IMAGE_DISABLED",[],"Inline Images Disabled"));let t;const r=this.document_.createElement("span");return r.innerText=U.msg("POPUP_INLINE_IMAGE",[],"Inline Images"),r.style.fontWeight="bold",r.style.borderWidth="1px",r.style.borderStyle="dashed",(t=this.document_.createElement("span")).innerText=U.msg("BUTTON_BLOCK",[],"block"),t.style.marginLeft="1em",t.style.borderWidth="1px",t.style.borderStyle="solid",t.addEventListener("click",()=>{this.prefs_.set("allow-images-inline",!1)}),r.appendChild(t),(t=this.document_.createElement("span")).innerText=U.msg("BUTTON_ALLOW_SESSION",[],"allow this session"),t.style.marginLeft="1em",t.style.borderWidth="1px",t.style.borderStyle="solid",t.addEventListener("click",()=>{this.allowImagesInline=!0}),r.appendChild(t),(t=this.document_.createElement("span")).innerText=U.msg("BUTTON_ALLOW_ALWAYS",[],"always allow"),t.style.marginLeft="1em",t.style.borderWidth="1px",t.style.borderStyle="solid",t.addEventListener("click",()=>{this.prefs_.set("allow-images-inline",!0)}),r.appendChild(t),void e.appendChild(r)}if(e.inline){const o=this.io.push();o.showOverlay(U.msg("LOADING_RESOURCE_START",[e.name],"Loading $1 ..."),null),o.onVTKeystroke=o.sendString=()=>{};const n=this.document_.createElement("img");n.src=e.uri,n.title=n.alt=e.name,this.document_.body.appendChild(n),n.onload=()=>{n.style.objectFit=e.preserveAspectRatio?"scale-down":"fill",n.style.maxWidth=`${this.document_.body.clientWidth}px`,n.style.maxHeight=`${this.document_.body.clientHeight}px`;const r=(e,t,r)=>{if(!e||"auto"==e)return"";const o=e.match(/^([0-9]+)(px|%)?$/);return o?"%"==o[2]?t*parseInt(o[1])/100+"px":"px"==o[2]?e:`calc(${e} * var(${r}))`:""};n.style.width=r(e.width,this.document_.body.clientWidth,"--hterm-charsize-width"),n.style.height=r(e.height,this.document_.body.clientHeight,"--hterm-charsize-height");const i=Math.ceil(n.clientHeight/this.scrollPort_.characterSize.height);for(let e=0;e{this.document_.body.removeChild(n),o.showOverlay(U.msg("LOADING_RESOURCE_FAILED",[e.name],"Loading $1 failed")),o.pop(),r&&r(t)}}else{const t=this.document_.createElement("a");t.href=e.uri,t.download=e.name,this.document_.body.appendChild(t),t.click(),t.remove()}}},U.Terminal.prototype.getSelectionText=function(){var e=this.scrollPort_.selection;if(e.sync(),e.isCollapsed)return null;var t=e.startOffset,r=e.startNode;if(!r)return null;if("X-ROW"!=r.nodeName)for("#text"==r.nodeName&&"SPAN"==r.parentNode.nodeName&&(r=r.parentNode);r.previousSibling;)r=r.previousSibling,t+=U.TextAttributes.nodeWidth(r);var o=U.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+=U.TextAttributes.nodeWidth(r);var n=this.getRowsText(e.startRow.rowIndex,e.endRow.rowIndex+1);return L.wc.substring(n,t,L.wc.strWidth(n)-o)},U.Terminal.prototype.copySelectionToClipboard=function(){var e=this.getSelectionText();null!=e&&this.copyStringToClipboard(e)},U.Terminal.prototype.overlaySize=function(){this.showOverlay(this.screenSize.width+"x"+this.screenSize.height)},U.Terminal.prototype.onVTKeystroke=function(e){this.scrollOnKeystroke_&&this.scrollPort_.scrollRowToBottom(this.getRowCount()),this.io.onVTKeystroke(this.keyboard.encode(e))},U.Terminal.prototype.openSelectedUrl_=function(){var e=this.getSelectionText();if((null!=e||(this.screen_.expandSelectionForUrl(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}U.openUrl(e)}},U.Terminal.prototype.setAutomaticMouseHiding=function(e=null){null===e&&(e="cros"!=U.os&&"mac"!=U.os),this.mouseHideWhileTyping_=!!e},U.Terminal.prototype.onKeyboardActivity_=function(e){this.mouseHideWhileTyping_&&!this.mouseHideDelay_&&this.setCssVar("mouse-cursor-style","none")},U.Terminal.prototype.onMouse_=function(e){if(!e.processedByTerminalHandler_){e.button>2&&e.preventDefault();var t=!this.defeatMouseReports_&&this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED;if(e.processedByTerminalHandler_=!0,this.mouseHideWhileTyping_&&!this.mouseHideDelay_&&(this.syncMouseStyle(),this.mouseHideDelay_=setTimeout(()=>this.mouseHideDelay_=null,1e3)),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.screen_.expandSelection(this.document_.getSelection()),this.copyOnSelect&&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&&(e.ctrlKey&&2==e.button?e.preventDefault():(e.button==this.mousePasteButton||this.mouseRightClickPaste&&2==e.button)&&(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){const t=this.scrollPort_.scrollWheelDelta(e),r=(e,t,r,o)=>{if(0==e)return"";const n=L.f.smartFloorDivide(Math.abs(e),t);return("O"+(e<0?o:r)).repeat(n)};this.io.sendString(r(t.y,this.scrollPort_.characterSize.height,"A","B")+r(t.x,this.scrollPort_.characterSize.width,"C","D")),e.preventDefault()}}"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.defeatMouseReports_=!1)}}},U.Terminal.prototype.onMouse=function(e){},U.Terminal.prototype.onFocusChange_=function(e){this.cursorNode_.setAttribute("focus",e),this.restyleCursor_(),this.reportFocus&&this.io.sendString(!0===e?"":""),!0===e&&this.closeBellNotifications_()},U.Terminal.prototype.onScroll_=function(){this.scheduleSyncCursorPosition_()},U.Terminal.prototype.onPaste_=function(e){var t=e.text.replace(/\n/gm,"\r");if(t=this.keyboard.encode(t),this.options_.bracketedPaste){const e=e=>e.replace(/[\x00-\x07\x0b-\x0c\x0e-\x1f]/g,"");t="[200~"+e(t)+"[201~"}this.io.sendString(t)},U.Terminal.prototype.onCopy_=function(e){this.useDefaultWindowCopy||(e.preventDefault(),setTimeout(this.copySelectionToClipboard.bind(this),0))},U.Terminal.prototype.onResize_=function(){var e=Math.floor(this.scrollPort_.getScreenWidth()/this.scrollPort_.characterSize.width)||0,t=L.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_()}},U.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},U.Terminal.prototype.setScrollbarVisible=function(e){this.scrollPort_.setScrollbarVisible(e)},U.Terminal.prototype.setScrollWheelMoveMultipler=function(e){this.scrollPort_.setScrollWheelMoveMultipler(e)},U.Terminal.prototype.closeBellNotifications_=function(){this.bellNotificationList_.forEach((function(e){e.close()})),this.bellNotificationList_.length=0},U.Terminal.prototype.onScrollportFocus_=function(){const e=this.scrollPort_.getTopRowIndex(),t=this.scrollPort_.getBottomRowIndex(e),r=this.document_.getSelection();!this.syncCursorPosition_()&&r&&r.collapse(this.getRowNode(t))},L.rtdep("lib.encodeUTF8"),U.Terminal.IO=function(e){this.terminal_=e,this.previousIO_=null,this.buffered_=""},U.Terminal.IO.prototype.showOverlay=function(e,t){this.terminal_.showOverlay(e,t)},U.Terminal.IO.prototype.hideOverlay=function(){this.terminal_.hideOverlay()},U.Terminal.IO.prototype.createFrame=function(e,t){return new U.Frame(this.terminal_,e,t)},U.Terminal.IO.prototype.setTerminalProfile=function(e){this.terminal_.setProfile(e)},U.Terminal.IO.prototype.push=function(){var e=new U.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},U.Terminal.IO.prototype.pop=function(){this.terminal_.io=this.previousIO_,this.previousIO_.flush()},U.Terminal.IO.prototype.flush=function(){this.buffered_&&(this.terminal_.interpret(this.buffered_),this.buffered_="")},U.Terminal.IO.prototype.sendString=function(e){console.log("Unhandled sendString: "+e)},U.Terminal.IO.prototype.onVTKeystroke=function(e){console.log("Unobserverd VT keystroke: "+JSON.stringify(e))},U.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)},U.Terminal.IO.prototype.onTerminalResize=function(e,t){},U.Terminal.IO.prototype.writeUTF8=function(e){this.terminal_.io==this?this.terminal_.interpret(e):this.buffered_+=e},U.Terminal.IO.prototype.writelnUTF8=function(e){this.writeUTF8(e+"\r\n")},U.Terminal.IO.prototype.print=U.Terminal.IO.prototype.writeUTF16=function(e){this.writeUTF8(L.encodeUTF8(e))},U.Terminal.IO.prototype.println=U.Terminal.IO.prototype.writelnUTF16=function(e){this.writelnUTF8(L.encodeUTF8(e))},L.rtdep("lib.colors"),U.TextAttributes=function(e){this.document_=e,this.foregroundSource=this.SRC_DEFAULT,this.backgroundSource=this.SRC_DEFAULT,this.underlineSource=this.SRC_DEFAULT,this.foreground=this.DEFAULT_COLOR,this.background=this.DEFAULT_COLOR,this.underlineColor=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.uri=null,this.uriId=null,this.colorPalette=null,this.resetColorPalette()},U.TextAttributes.prototype.enableBold=!0,U.TextAttributes.prototype.enableBoldAsBright=!0,U.TextAttributes.prototype.DEFAULT_COLOR=L.f.createEnum(""),U.TextAttributes.prototype.SRC_DEFAULT="default",U.TextAttributes.prototype.setDocument=function(e){this.document_=e},U.TextAttributes.prototype.clone=function(){var e=new U.TextAttributes(null);for(var t in this)e[t]=this[t];return e.colorPalette=this.colorPalette.concat(),e},U.TextAttributes.prototype.reset=function(){this.foregroundSource=this.SRC_DEFAULT,this.backgroundSource=this.SRC_DEFAULT,this.underlineSource=this.SRC_DEFAULT,this.foreground=this.DEFAULT_COLOR,this.background=this.DEFAULT_COLOR,this.underlineColor=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,this.uri=null,this.uriId=null},U.TextAttributes.prototype.resetColorPalette=function(){this.colorPalette=L.colors.colorPalette.concat(),this.syncColors()},U.TextAttributes.prototype.resetColor=function(e){e=parseInt(e,10),isNaN(e)||e>=this.colorPalette.length||(this.colorPalette[e]=L.colors.stockColorPalette[e],this.syncColors())},U.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&&null==this.uri},U.TextAttributes.prototype.createContainer=function(e){if(this.isDefault()){const t=this.document_.createTextNode(e);return t.asciiNode=!0,t}var t=this.document_.createElement("span"),r=t.style,o=[];this.foreground!=this.DEFAULT_COLOR&&(r.color=this.foreground),this.background!=this.DEFAULT_COLOR&&(r.backgroundColor=this.background),this.enableBold&&this.bold&&(r.fontWeight="bold"),this.faint&&(t.faint=!0),this.italic&&(r.fontStyle="italic"),this.blink&&(o.push("blink-node"),t.blinkNode=!0);let n="";return t.underline=this.underline,this.underline&&(n+=" underline",r.textDecorationStyle=this.underline),this.underlineSource!=this.SRC_DEFAULT&&(r.textDecorationColor=this.underlineColor),this.strikethrough&&(n+=" line-through",t.strikethrough=!0),n&&(r.textDecorationLine=n),this.wcNode&&(o.push("wc-node"),t.wcNode=!0),t.asciiNode=this.asciiNode,null!=this.tileData&&(o.push("tile"),o.push("tile_"+this.tileData),t.tileNode=!0),e&&(t.textContent=e),this.uri&&(o.push("uri-node"),t.uriId=this.uriId,t.title=this.uri,t.addEventListener("click",U.openUrl.bind(this,this.uri))),o.length&&(t.className=o.join(" ")),t},U.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.uriId!=e.uriId||this.foreground!=t.color||this.background!=t.backgroundColor||this.underlineColor!=t.textDecorationColor||(this.enableBold&&this.bold)!=!!t.fontWeight||this.blink!=!!e.blinkNode||this.italic!=!!t.fontStyle||this.underline!=e.underline||!!this.strikethrough!=!!e.strikethrough)},U.TextAttributes.prototype.setDefaults=function(e,t){this.defaultForeground=e,this.defaultBackground=t,this.syncColors()},U.TextAttributes.prototype.syncColors=function(){const e=(e,t)=>e==this.DEFAULT_COLOR?t:e;var t,r=this.foregroundSource,o=this.backgroundSource;if(this.enableBoldAsBright&&this.bold&&Number.isInteger(r)&&(r=(t=r)<8?t+8:t),r==this.SRC_DEFAULT?this.foreground=this.DEFAULT_COLOR:Number.isInteger(r)?this.foreground=this.colorPalette[r]:this.foreground=r,this.faint){const t=e(this.foreground,this.defaultForeground);this.foreground=L.colors.mix(t,"rgb(0, 0, 0)",.3333)}if(o==this.SRC_DEFAULT?this.background=this.DEFAULT_COLOR:Number.isInteger(o)?this.background=this.colorPalette[o]:this.background=o,this.inverse){const t=e(this.foreground,this.defaultForeground);this.foreground=e(this.background,this.defaultBackground),this.background=t}this.invisible&&(this.foreground=this.background),this.underlineSource==this.SRC_DEFAULT?this.underlineColor="":Number.isInteger(this.underlineSource)?this.underlineColor=this.colorPalette[this.underlineSource]:this.underlineColor=this.underlineSource},U.TextAttributes.containersMatch=function(e,t){if("string"==typeof e)return U.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.backgroundColor==o.backgroundColor&&r.fontWeight==o.fontWeight&&r.fontStyle==o.fontStyle&&r.textDecoration==o.textDecoration&&r.textDecorationColor==o.textDecorationColor&&r.textDecorationStyle==o.textDecorationStyle&&r.textDecorationLine==o.textDecorationLine},U.TextAttributes.containerIsDefault=function(e){return"string"==typeof e||e.nodeType==Node.TEXT_NODE},U.TextAttributes.nodeWidth=function(e){return e.asciiNode?e.textContent.length:L.wc.strWidth(e.textContent)},U.TextAttributes.nodeSubstr=function(e,t,r){return e.asciiNode?e.textContent.substr(t,r):L.wc.substr(e.textContent,t,r)},U.TextAttributes.nodeSubstring=function(e,t,r){return e.asciiNode?e.textContent.substring(t,r):L.wc.substring(e.textContent,t,r)},U.TextAttributes.splitWidecharString=function(e){for(var t,r=[],o=0,n=0,i=0,s=!0,a=0;a0?0:1),s|=r,t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${s};${o};${n}M`:""+String.fromCharCode(s+32)+o+n,e.preventDefault();break;case"mousedown":var s=Math.min(e.button,2);this.mouseCoordinates!=this.MOUSE_COORDINATES_SGR&&(s+=32),s|=r,t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${s};${o};${n}M`:""+String.fromCharCode(s)+o+n;break;case"mouseup":this.mouseReport!=this.MOUSE_REPORT_PRESS&&(t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${e.button};${o};${n}m`:"#"+o+n);break;case"mousemove":this.mouseReport==this.MOUSE_REPORT_DRAG&&e.buttons&&(s=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?0:32,1&e.buttons?s+=0:4&e.buttons?s+=1:2&e.buttons?s+=2:s+=3,s+=32,s|=r,t=this.mouseCoordinates==this.MOUSE_COORDINATES_SGR?`[<${s};${o};${n}M`:""+String.fromCharCode(s)+o+n,this.lastMouseDragResponse_==t?t="":this.lastMouseDragResponse_=t);break;case"click":case"dblclick":break;default:console.error("Unknown mouse event: "+e.type,e)}t&&this.terminal.io.sendString(t)},U.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!"}},U.VT.prototype.decode=function(e){return"utf-8"==this.characterEncoding?this.decodeUTF8(e):e},U.VT.prototype.encodeUTF8=function(e){return L.encodeUTF8(e)},U.VT.prototype.decodeUTF8=function(e){return this.utf8Decoder_.decode(e)},U.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_()},U.VT.prototype.updateEncodingState_=function(){var e=Object.keys(U.VT.CC1).filter(e=>!this.codingSystemUtf8_||e.charCodeAt()<128).map(e=>"\\x"+L.f.zpad(e.charCodeAt().toString(16),2)).join("");this.cc1Pattern_=new RegExp(`[${e}]`)},U.VT.prototype.parseUnknown_=function(e){var t=this;function r(e){!t.codingSystemUtf8_&&t[t.GL].GL&&(e=t[t.GL].GL(e)),t.terminal.print(e)}var o=e.peekRemainingBuf(),n=o.search(this.cc1Pattern_);return 0==n?(this.dispatch("CC1",o.substr(0,1),e),void e.advance(1)):-1==n?(r(o),void e.reset()):(r(o.substr(0,n)),this.dispatch("CC1",o.substr(n,1),e),void e.advance(n+1))},U.VT.prototype.parseCSI_=function(e){var t=e.peekChar(),r=e.args;const o=()=>{e.resetArguments(),e.subargs=null,e.resetParseFunction()};t>="@"&&t<="~"?(this.dispatch("CSI",this.leadingModifier_+this.trailingModifier_+t,e),o()):";"==t?this.trailingModifier_?o():(r.length||r.push(""),r.push("")):t>="0"&&t<="9"||":"==t?this.trailingModifier_?o():(r.length?r[r.length-1]+=t:r[0]=t,":"==t&&e.argSetSubargs(r.length-1)):t>=" "&&t<="?"?r.length?this.trailingModifier_+=t:this.leadingModifier_+=t:this.cc1Pattern_.test(t)?this.dispatch("CC1",t,e):o(),e.advance(1)},U.VT.prototype.parseUntilStringTerminator_=function(e){var t=e.peekRemainingBuf(),r=e.args;let 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);const n=t.search(/[\x1b\x07]/),i=t[n];let s;var a;return(s=(""!=i||"\\"==t[n+1])&&-1!=n)?(r[0]+=t.substr(0,n),e.resetParseFunction(),e.advance(n+(""==i?2:1)-o),!0):(r[0]+=t,""==i&&n!=t.length-1&&(a="embedded escape: "+n),new Date-r[1]>this.oscTimeLimit_&&(a="timeout expired: "+(new Date-r[1])),a?(this.warnUnimplemented&&console.log("parseUntilStringTerminator_: aborting: "+a,r[0]),e.reset(r[0]),!1):(e.advance(t.length-o),!0))},U.VT.prototype.dispatch=function(e,t,r){var o=U.VT[e][t];o?o!=U.VT.ignore?!r.subargs||o.supportsSubargs?"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 w/subargs: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t))},U.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)},U.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 9:this.mouseReport=t?this.MOUSE_REPORT_PRESS:this.MOUSE_REPORT_DISABLED,this.terminal.syncMouseStyle();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 1005:this.mouseCoordinates=t?this.MOUSE_COORDINATES_UTF8:this.MOUSE_COORDINATES_X10;break;case 1006:this.mouseCoordinates=t?this.MOUSE_COORDINATES_SGR:this.MOUSE_COORDINATES_X10;break;case 1007:this.terminal.scrollWheelArrowKeys_=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:t?this.terminal.saveCursorAndState():this.terminal.restoreCursorAndState();break;case 1049:t?(this.terminal.saveCursorAndState(),this.terminal.setAlternateMode(t),this.terminal.clear()):(this.terminal.setAlternateMode(t),this.terminal.restoreCursorAndState());break;case 2004:this.terminal.setBracketedPaste(t);break;default:this.warnUnimplemented&&console.warn("Unimplemented DEC Private Mode: "+e)}},U.VT.ignore=function(){},U.VT.CC1={},U.VT.ESC={},U.VT.CSI={},U.VT.OSC={},U.VT.VT52={},U.VT.CC1["\0"]=U.VT.ignore,U.VT.CC1[""]=U.VT.ignore,U.VT.CC1[""]=function(){this.terminal.ringBell()},U.VT.CC1["\b"]=function(){this.terminal.cursorLeft(1)},U.VT.CC1["\t"]=function(){this.terminal.forwardTabStop()},U.VT.CC1["\n"]=function(){this.terminal.formFeed()},U.VT.CC1["\v"]=U.VT.CC1["\n"],U.VT.CC1["\f"]=U.VT.CC1["\n"],U.VT.CC1["\r"]=function(){this.terminal.setCursorColumn(0)},U.VT.CC1[""]=function(){this.GL="G1"},U.VT.CC1[""]=function(){this.GL="G0"},U.VT.CC1[""]=U.VT.ignore,U.VT.CC1[""]=U.VT.ignore,U.VT.CC1[""]=function(e){"G1"==this.GL&&(this.GL="G0"),e.resetParseFunction(),this.terminal.print("?")},U.VT.CC1[""]=U.VT.CC1[""],U.VT.CC1[""]=function(e){e.func=function e(t){var r=t.consumeChar();""!=r&&(this.dispatch("ESC",r,t),t.func==e&&t.resetParseFunction())}},U.VT.CC1[""]=U.VT.ignore,U.VT.CC1["„"]=U.VT.ESC.D=function(){this.terminal.lineFeed()},U.VT.CC1["…"]=U.VT.ESC.E=function(){this.terminal.setCursorColumn(0),this.terminal.cursorDown(1)},U.VT.CC1["ˆ"]=U.VT.ESC.H=function(){this.terminal.setTabStop(this.terminal.getCursorColumn())},U.VT.CC1[""]=U.VT.ESC.M=function(){this.terminal.reverseLineFeed()},U.VT.CC1["Ž"]=U.VT.ESC.N=U.VT.ignore,U.VT.CC1[""]=U.VT.ESC.O=U.VT.ignore,U.VT.CC1[""]=U.VT.ESC.P=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},U.VT.CC1["–"]=U.VT.ESC.V=U.VT.ignore,U.VT.CC1["—"]=U.VT.ESC.W=U.VT.ignore,U.VT.CC1["˜"]=U.VT.ESC.X=U.VT.ignore,U.VT.CC1["š"]=U.VT.ESC.Z=function(){this.terminal.io.sendString("[?1;2c")},U.VT.CC1["›"]=U.VT.ESC["["]=function(e){e.resetArguments(),this.leadingModifier_="",this.trailingModifier_="",e.func=this.parseCSI_},U.VT.CC1["œ"]=U.VT.ESC["\\"]=U.VT.ignore,U.VT.CC1[""]=U.VT.ESC["]"]=function(e){e.resetArguments(),e.func=function e(t){if(this.parseUntilStringTerminator_(t)&&t.func!=e){var r=t.args[0].match(/^(\d+);(.*)$/);r?(t.args[0]=r[2],this.dispatch("OSC",r[1],t)):console.warn("Invalid OSC: "+JSON.stringify(t.args[0])),t.resetArguments()}}},U.VT.CC1["ž"]=U.VT.ESC["^"]=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},U.VT.CC1["Ÿ"]=U.VT.ESC._=function(e){e.resetArguments(),e.func=this.parseUntilStringTerminator_},U.VT.ESC[" "]=function(e){e.func=function(e){var t=e.consumeChar();this.warnUnimplemented&&console.warn("Unimplemented sequence: ESC 0x20 "+t),e.resetParseFunction()}},U.VT.ESC["#"]=function(e){e.func=function(e){"8"==e.consumeChar()&&(this.terminal.setCursorPosition(0,0),this.terminal.fill("E")),e.resetParseFunction()}},U.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()}},U.VT.ESC["("]=U.VT.ESC[")"]=U.VT.ESC["*"]=U.VT.ESC["+"]=U.VT.ESC["-"]=U.VT.ESC["."]=U.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()}},U.VT.ESC[6]=U.VT.ignore,U.VT.ESC[7]=function(){this.terminal.saveCursorAndState()},U.VT.ESC[8]=function(){this.terminal.restoreCursorAndState()},U.VT.ESC[9]=U.VT.ignore,U.VT.ESC["="]=function(){this.terminal.keyboard.applicationKeypad=!0},U.VT.ESC[">"]=function(){this.terminal.keyboard.applicationKeypad=!1},U.VT.ESC.F=U.VT.ignore,U.VT.ESC.c=function(){this.terminal.reset()},U.VT.ESC.l=U.VT.ESC.m=U.VT.ignore,U.VT.ESC.n=function(){this.GL="G2"},U.VT.ESC.o=function(){this.GL="G3"},U.VT.ESC["|"]=function(){this.GR="G3"},U.VT.ESC["}"]=function(){this.GR="G2"},U.VT.ESC["~"]=function(){this.GR="G1"},U.VT.OSC[0]=function(e){this.terminal.setWindowTitle(e.args[0])},U.VT.OSC[2]=U.VT.OSC[0],U.VT.OSC[4]=function(e){for(var t=e.args[0].split(";"),r=parseInt(t.length/2),o=this.terminal.getTextAttributes().colorPalette,n=[],i=0;i=o.length||("?"!=a?(a=L.colors.x11ToCSS(a))&&(o[s]=a):(a=L.colors.rgbToX11(o[s]))&&n.push(s+";"+a))}n.length&&this.terminal.io.sendString("]4;"+n.join(";")+"")},U.VT.OSC[8]=function(e){const t=e.args[0].split(";");let r=null,o=null;if(2!=t.length||0==t[1].length);else{const e=t[0].split(":");r="",e.forEach(e=>{const t=e.indexOf("=");if(-1==t)return;const o=e.slice(0,t),n=e.slice(t+1);switch(o){case"id":r=n}}),o=t[1]}const n=this.terminal.getTextAttributes();n.uri=o,n.uriId=r},U.VT.OSC[9]=function(e){U.notify({body:e.args[0]})},U.VT.OSC[10]=function(e){var t=e.args[0].split(";");if(t){var r=L.colors.x11ToCSS(t.shift());r&&this.terminal.setForegroundColor(r),t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[11].apply(this,[e]))}},U.VT.OSC[11]=function(e){var t=e.args[0].split(";");if(t){var r=L.colors.x11ToCSS(t.shift());r&&this.terminal.setBackgroundColor(r),t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[12].apply(this,[e]))}},U.VT.OSC[12]=function(e){var t=e.args[0].split(";");if(t){var r=L.colors.x11ToCSS(t.shift());r&&this.terminal.setCursorColor(r)}},U.VT.OSC[50]=function(e){var t=e.args[0].match(/CursorShape=(.)/i);if(t)switch(t[1]){case"1":this.terminal.setCursorShape(U.Terminal.cursorShape.BEAM);break;case"2":this.terminal.setCursorShape(U.Terminal.cursorShape.UNDERLINE);break;default:this.terminal.setCursorShape(U.Terminal.cursorShape.BLOCK)}else console.warn("Could not parse OSC 50 args: "+e.args[0])},U.VT.OSC[52]=function(e){if(this.enableClipboardWrite){var t=e.args[0].match(/^[cps01234567]*;(.*)/);if(t){var r=window.atob(t[1]);r&&this.terminal.copyStringToClipboard(this.decode(r))}}},U.VT.OSC[104]=function(e){const t=this.terminal.getTextAttributes();e.args[0]?e.args[0].split(";").forEach(e=>t.resetColor(e)):t.resetColorPalette()},U.VT.OSC[110]=function(e){this.terminal.setForegroundColor()},U.VT.OSC[111]=function(e){this.terminal.setBackgroundColor()},U.VT.OSC[112]=function(e){this.terminal.setCursorColor()},U.VT.OSC[1337]=function(e){let t=e.args[0].match(/^File=([^:]*):([\s\S]*)$/m);if(!t)return void(this.warnUnimplemented&&console.log(`iTerm2 1337: unsupported sequence: ${t[1]}`));const r={name:"",size:0,preserveAspectRatio:!0,inline:!1,width:"auto",height:"auto",align:"left",uri:"data:application/octet-stream;base64,"+t[2].replace(/[\n\r]+/gm,"")};if(t[1].split(";").forEach(e=>{const t=e.match(/^([^=]+)=(.*)$/m);if(t)switch(t[1]){case"name":try{r.name=window.atob(t[2])}catch(e){}break;case"size":try{r.size=parseInt(t[2])}catch(e){}break;case"width":r.width=t[2];break;case"height":r.height=t[2];break;case"preserveAspectRatio":r.preserveAspectRatio=!("0"==t[2]);break;case"inline":r.inline=!("0"==t[2]);break;case"align":r.align=t[2]}}),r.inline){const t=this.terminal.io,o=e.peekRemainingBuf();e.advance(o.length),this.terminal.displayImage(r),t.writeUTF8(o)}else this.terminal.displayImage(r)},U.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]),U.notify({title:r,body:o});break;default:console.warn("Unknown urxvt module: "+e.args[0])}},U.VT.CSI["@"]=function(e){this.terminal.insertSpace(e.iarg(0,1))},U.VT.CSI.A=function(e){this.terminal.cursorUp(e.iarg(0,1))},U.VT.CSI.B=function(e){this.terminal.cursorDown(e.iarg(0,1))},U.VT.CSI.C=function(e){this.terminal.cursorRight(e.iarg(0,1))},U.VT.CSI.D=function(e){this.terminal.cursorLeft(e.iarg(0,1))},U.VT.CSI.E=function(e){this.terminal.cursorDown(e.iarg(0,1)),this.terminal.setCursorColumn(0)},U.VT.CSI.F=function(e){this.terminal.cursorUp(e.iarg(0,1)),this.terminal.setCursorColumn(0)},U.VT.CSI.G=function(e){this.terminal.setCursorColumn(e.iarg(0,1)-1)},U.VT.CSI.H=function(e){this.terminal.setCursorPosition(e.iarg(0,1)-1,e.iarg(1,1)-1)},U.VT.CSI.I=function(e){var t=e.iarg(0,1);t=L.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;rT"]=U.VT.ignore,U.VT.CSI.X=function(e){this.terminal.eraseToRight(e.iarg(0,1))},U.VT.CSI.Z=function(e){var t=e.iarg(0,1);t=L.f.clamp(t,1,this.terminal.screenSize.width);for(var r=0;rc"]=function(e){this.terminal.io.sendString("[>0;256;0c")},U.VT.CSI.d=function(e){this.terminal.setAbsoluteCursorRow(e.iarg(0,1)-1)},U.VT.CSI.f=U.VT.CSI.H,U.VT.CSI.g=function(e){e.args[0]&&0!=e.args[0]?3==e.args[0]&&this.terminal.clearAllTabStops():this.terminal.clearTabStopAtCursor(!1)},U.VT.CSI.h=function(e){for(var t=0;t=90&&n<=97?t.foregroundSource=n-90+8:n>=100&&n<=107&&(t.backgroundSource=n-100+8)}t.setDefaults(this.terminal.getForegroundColor(),this.terminal.getBackgroundColor())}else t.reset()},U.VT.CSI.m.supportsSubargs=!0,U.VT.CSI[">m"]=U.VT.ignore,U.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")}},U.VT.CSI[">n"]=U.VT.ignore,U.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")},U.VT.CSI[">p"]=U.VT.ignore,U.VT.CSI["!p"]=function(){this.terminal.softReset()},U.VT.CSI.$p=U.VT.ignore,U.VT.CSI["?$p"]=U.VT.ignore,U.VT.CSI['"p']=U.VT.ignore,U.VT.CSI.q=U.VT.ignore,U.VT.CSI[" q"]=function(e){var t=e.args[0];0==t||1==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BLOCK),this.terminal.setCursorBlink(!0)):2==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BLOCK),this.terminal.setCursorBlink(!1)):3==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.UNDERLINE),this.terminal.setCursorBlink(!0)):4==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.UNDERLINE),this.terminal.setCursorBlink(!1)):5==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BEAM),this.terminal.setCursorBlink(!0)):6==t?(this.terminal.setCursorShape(U.Terminal.cursorShape.BEAM),this.terminal.setCursorBlink(!1)):console.warn("Unknown cursor style: "+t)},U.VT.CSI['"q']=U.VT.ignore,U.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)},U.VT.CSI["?r"]=U.VT.ignore,U.VT.CSI.$r=U.VT.ignore,U.VT.CSI.s=function(){this.terminal.saveCursorAndState()},U.VT.CSI["?s"]=U.VT.ignore,U.VT.CSI.t=U.VT.ignore,U.VT.CSI.$t=U.VT.ignore,U.VT.CSI[">t"]=U.VT.ignore,U.VT.CSI[" t"]=U.VT.ignore,U.VT.CSI.u=function(){this.terminal.restoreCursorAndState()},U.VT.CSI[" u"]=U.VT.ignore,U.VT.CSI.$v=U.VT.ignore,U.VT.CSI["'w"]=U.VT.ignore,U.VT.CSI.x=U.VT.ignore,U.VT.CSI["*x"]=U.VT.ignore,U.VT.CSI.$x=U.VT.ignore,U.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)}},U.VT.CSI["'z"]=U.VT.ignore,U.VT.CSI.$z=U.VT.ignore,U.VT.CSI["'{"]=U.VT.ignore,U.VT.CSI["'|"]=U.VT.ignore,U.VT.CSI["'}"]=U.VT.ignore,U.VT.CSI["'~"]=U.VT.ignore,L.rtdep("lib.f"),U.VT.CharacterMap=function(e,t){this.description=e,this.GL=null,this.glmapBase_=t,this.sync_()},U.VT.CharacterMap.prototype.sync_=function(e){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 t=Object.keys(this.glmap_).map(e=>"\\x"+L.f.zpad(e.charCodeAt(0).toString(16)));this.glre_=new RegExp("["+t.join("")+"]","g"),this.GL=e=>e.replace(this.glre_,e=>this.glmap_[e])},U.VT.CharacterMap.prototype.reset=function(){this.glmap_!==this.glmapBase_&&this.sync_()},U.VT.CharacterMap.prototype.setOverrides=function(e){this.sync_(e)},U.VT.CharacterMap.prototype.clone=function(){var e=new U.VT.CharacterMap(this.description,this.glmapBase_);return this.glmap_!==this.glmapBase_&&e.setOverrides(this.glmap_),e},U.VT.CharacterMaps=function(){this.maps_=U.VT.CharacterMaps.DefaultMaps,this.mapsBase_=this.maps_},U.VT.CharacterMaps.prototype.getMap=function(e){return this.maps_.hasOwnProperty(e)?this.maps_[e]:void 0},U.VT.CharacterMaps.prototype.addMap=function(e,t){this.maps_===this.mapsBase_&&(this.maps_=Object.assign({},this.mapsBase_)),this.maps_[e]=t},U.VT.CharacterMaps.prototype.reset=function(){this.maps_!==U.VT.CharacterMaps.DefaultMaps&&(this.maps_=U.VT.CharacterMaps.DefaultMaps)},U.VT.CharacterMaps.prototype.setOverrides=function(e){for(var t in this.maps_===this.mapsBase_&&(this.maps_=Object.assign({},this.mapsBase_)),e){var r=this.getMap(t);void 0!==r?(this.maps_[t]=r.clone(),this.maps_[t].setOverrides(e[t])):this.addMap(t,new U.VT.CharacterMap("user "+t,e[t]))}},U.VT.CharacterMaps.DefaultMaps={},U.VT.CharacterMaps.DefaultMaps[0]=new U.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:"≥","{":"π","|":"≠","}":"£","~":"·"}),U.VT.CharacterMaps.DefaultMaps.A=new U.VT.CharacterMap("british",{"#":"£"}),U.VT.CharacterMaps.DefaultMaps.B=new U.VT.CharacterMap("us",null),U.VT.CharacterMaps.DefaultMaps[4]=new U.VT.CharacterMap("dutch",{"#":"£","@":"¾","[":"IJ","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"}),U.VT.CharacterMaps.DefaultMaps.C=U.VT.CharacterMaps.DefaultMaps[5]=new U.VT.CharacterMap("finnish",{"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),U.VT.CharacterMaps.DefaultMaps.R=new U.VT.CharacterMap("french",{"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"}),U.VT.CharacterMaps.DefaultMaps.Q=new U.VT.CharacterMap("french canadian",{"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"}),U.VT.CharacterMaps.DefaultMaps.K=new U.VT.CharacterMap("german",{"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"}),U.VT.CharacterMaps.DefaultMaps.Y=new U.VT.CharacterMap("italian",{"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"}),U.VT.CharacterMaps.DefaultMaps.E=U.VT.CharacterMaps.DefaultMaps[6]=new U.VT.CharacterMap("norwegian/danish",{"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"}),U.VT.CharacterMaps.DefaultMaps.Z=new U.VT.CharacterMap("spanish",{"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"}),U.VT.CharacterMaps.DefaultMaps[7]=U.VT.CharacterMaps.DefaultMaps.H=new U.VT.CharacterMap("swedish",{"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"}),U.VT.CharacterMaps.DefaultMaps["="]=new U.VT.CharacterMap("swiss",{"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}),L.resource.add("hterm/images/icon-96","image/png;base64","iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAStklEQVR42u1dBXjrupL+RzIGmjIfvAcu42NmZub3lpmZmZmZmRkuMzPDYaYyJG0Sa9b2p2z1eQtp7bzefpv/nKnkkSw7Gg1IshNsDtpoo4022mijDWp/tlTgzbpJSqYvMoFTC9vjRD5JLb9RYaRkpk22SS28P8pacAaPdZ41KYMCI89YB6wN3JzQJM3UIGqurfTlKQTAZtqENid5SlNdU804VmbbWQtA6HMkAAdADsBeAJ7mxwIhIhFSXJ9iRPw4JYDEcqmGWEp1HhCI8gAtpXF7scB1ZRH9E3HObANCNy1AoGTegNDnCdE41tfQDH2t+CINQEpJ9Xp97oUDh3+nXK48DYAMIWQmANIkNTn6vP69e3d/zctfeu0nXNexmVn3F0gDAMxMlBoHuht0qnsEEekC42SdGHmNxgVjgk4bPN04Yui8bhc534cQBH35RKrPN9sGdLnB1/Wuv+HW4f+6/tZvBHAaAJvmKr0AjJGvyQMw8pLrrvqeT378Ax8UwrKeevoFgEhfjcGGO2JO+iuTt1SW5DHzyraDExyTlWwHjCQ/CAJcecU+XHn5xWDmVCGQFAKljsLbx8Ynvv3Bhx7/EQCzurimU04jADLsvK3r73/7W1//g1/6hU++uVqt0X/dcBcKxRIsy9Ji34DPow2et6FzgcXFKk6fOY83vu4VEFKkDiYHB3roSz73sc+Oj08eOHzk+B9oMyQABGk0gCIyOt9xHPvaD3/wnT/5VV/+meumpmbwD/98A0qdvVEBNhvMDCJaVXtM01GtVlEs+LBtC1ngzW98tX/m7Llv/emf+83HarX6vbrfGECQRgBmlLP9Ix961499+zd/5XVj45P407/8FxQ7uiGlQK1Ww1ZCvR6gXq3AsgQ8zwYzUkMIgXe+/Q1Dd9x5/6duv/P+R7QjprQaIHQd/8orLvnCJz/2/pfmcj7+6rf+DK5XgOu6sT3dQtBawqjW6lhYXIRlSTAjE/T39eLSS/ZeEwqgE8CiYUV4vQIgTULTyFve9Or3WJZN/3n9HTh3fgrFjhJmZmawFaGUwkJlEffc9xh83wMYqcFg7Noxinw+l9OBikirAabz7eju6sxJKTE7W4bn5+D7PrYmtI/gAFJasCwb4IzaBMHzXE8LgBJC4I1GQRKAa4Xo6upEsZiH53nIRYLeolDMCIIq+nq70dFRAGckgFKpAD+UgBaAgfRRkGvbliwUcoh8ABHFYSfWMnBrxOzL12PwKufzSvV55Tpmi5a0IASBQCgWcujs7ABn5AQic+b5rhNlAVAmTliTEwnA990wIxEEdUQYnxjHidMnAUIcBYABRqNDdC7BM8t0VtfTnGRd8FKdRIjJcVlCsAbPPA5UAK4rXLJjP7aNbkO9XoPrOrEQWHEm69Kua0caYEspvCBQ5toSp9EASCkt27ZF1PlCxBOZOPo5feY0Xpg8jHe/7V3YNjhqjDRac3mMVl1Oo40vtREtW+2FYwdw/S03YHJ6EkODQ1hcXIQUcaeBlUIWsCwZ+QDLdZxcubKAtBpgNmzZliUa6yLMKiRGoBR279yN6666FlJYABgvRhAIncUSHn/iCdQrAZjjSAiKFQQRVEhZIRJASJEACICmlAKQUtqhBETjw5ijuFqr4oWjBwHmF7/jVUHc6aRNXxAoZA3PdYXruvlldJfTaIATaQA4KU/CzNwMDp84DOYXf+hZXiijhJz+DK0QAEd+RYTOOAcgMw0g24oskNYAIoCXxDpbnsOxM8fB5qacwKZD+3WQcS+VxQrYYXNVNGMhI1odiIRQSHb8BmbCpgZYjmVLYi0ANmxQNKpOj50FFOB3WnDzEpOnFkGbuOXPimG5Ap0jLqZOLiKoMyIsVhfB9lLEpFSQ+S26jh2Fo/n0YagRCUlLRhpAAIMIyWl9vBinAkbfoIPXf+0wnrlxAs/dPInKVB1CUOsFkdhD6Nnp49oP98EvWfjvnzqGak0hVlwwFJsaoADK9vq2Y0eOOKUGJLTAjjQgFgBAy/gTvbGIyXC0nX66jJd+YgC7X1nCo39/AccfmUVQU1F5y0d9rsvGJW/txuXv7oGqMx7+2/OoVxWIzE5SOkfaBBGyhGPHc4G8YYjT+wDLDgUgJbQPWDGuL0/VcefvnMLRB2dw3Uf78dZv345D90zjsX++gPGjC7peC8yNI7DjpSVcE476rlEPB++awmP/dCEaEMtqbAP1Fqzkhn0VaUAegMzABJkaIMG8epNEiE3R0funce75Mi4NR+MV7+3B6NUFPPnvY3jupslISJkKoW9PDld/sA+7Xt6B8SMV3Pjzx3Di0TkENQaJ5A1qM8VRljKPgpg58pcNHyCz0ADSTnhNDTBBglCZruPhvz+PY4/M4Jqwg6772AB2vqwDd/zmKYwdWQAJpMalb+vGSz81AA6Ah/76HJ69KfI7tej6K7RPUKwaWQT1FmiAlJEJykXZZh5cE02FoaEJkpYEwGsKwNQGAnDhQAUP/915TJ5YwPCleZSG3WwWvwgYvryAYr8Tm5wn/2Mc5cm481c9RzXWobQPyBpSikgDGgJAVvMARzY0AARwc7Y5Ckn3vK4TV7+/D5YncN+fnsWpJ+cgsnDICnj0n85DSOCSUBO6Rl088g8XcObZ+VgjSKweKRG1xgcIEQnA9QE46aMgwwlHAmBuOFFepeMRd8rI1cU4FBzYn8exh2bw6D9ewNihCjgrR0wI21vAzb9yIrT/pfha7/y+nXj+5gk8EWrDzJlF/WxQUgMUwEtREGW/5RlpgJdaABq0pAGicYFVFaBzxMGV7+vFvtd3YfpsFbf+6ok4KqovxqFoph+YBBAsMg7cPonTT83jsnd247J39IQRUUcceR28cxrVcrBUX2sAa1Nar7dCAwhevCkDN7UADB9gSyEBaBVYYeT37PTw9u/aAbcg8Pi/XMAz109gfqLhFAktgX46LbrOg395DscemAnD0X68+suGQ+3L4Y7fOhVHRA00nDBRa3wAEGuAA8DbqABIkyEA2xFSrBHHM2xf4Ozz82HIOb5kbgSh1TDv69wLZdz0S8dxUTgRHLwkD2HRkgCIdBi6NBPmVpggL7krBkrnA6xIA0Qjfl4x9Bw7XInDzHo1hblJbZYoNkvP3zqFw/fPIKgqGNC7aNoEtUQDEJkg23Ecv1qtrhkFiWYeTYzCUCEEeI15QDTSgjpnMerTmyUB1CsKrGACyvABQb1VAnAt13V8NAHRxGqotEMIQUbJFgGtMhNuqQa4Ui9HbEgDKFknioKIhC4kbGUwFBhsOGHO/AqhCxAh5dOsBZFBMoqCGhpARJv7ihul35oEt84E6U0ZCv1APp0T1tACsIhEpquZQhJsT2C9UAGjtqA2vDnPzOD/NUEqymcOJ94TcPJZzYSFHYKIjHlA+iXk/kvyeO1XDENYtK6J16kn53H375+OBbFukBkFtWoewHAdJ1qQKwAQWcyEtQaQ4QPSmk6KZ6gXDlVAcn0x9vTpxTSjdhkBcOYmSO+KNTZlKK0GWHYoASJkZoJIABPHFnDbb5zEFxtshqEtMkG2rfcEtAZsJAoimBpgGRqg062KVmsAmBH2V2NfWKZ1woxYAyIBwFABXma+nE30wytV4rU/OK9xLWaGUmpJAHE+awEDUsrGnoCERsooyJYALfPaOEHNByBl7BGwKQsy8kYLUZ1kOTXyZprgUYJHSBzrctLHDZ6huflCLt61qtWDWAMawsgOWgCe5+v+JYN4vT6AtAbIpSCIGuEcRoaG8TrXRcwzCeZ7u2gcm4QIZn0QEudC5wGYdYxUt2PyjRSAyWsc6mvW6hW0CnpXzAdgQ6NZAdByJsgKBQAQGCp+oQFQ8ePdhUIBxWJxXfrJYKQHNRUMMK9kuwhzc3O4eO+eeLQqpbLfFfMaAgAnhdDccrSpAZYtAUApxujIEN725lfg3//7bvT19cOyLJhg44/ZCTo1y40yI79qmT4/5un2jTx0+XLtmAOAlUJXVx6ve83LdFkrdsWMTZkUTpikjFyAJUxHFr6oDc918cDDT6KyMB8xzVFpmBpAGGZHiCgVZgoRphSlQkCQTvXxEhFklMolXnyseY28NMtlIjXaCzsHO7aPoFDIQ6nWCMDzXS2AdJvybMl4HiaSLyK89S2vxRte/wrU6vXGIFrzOxdWTZcaMNtCgq15a9vNtWyTMjUncwEguSu2ISesO3vp3YDkE2ZSypiyQMO0JO331gTFryoJIXylVLrFOCtEpAHmaG5jbQ3Qb8r45XKFN2qCOCJpSUsxi/n5SlOP8rXB0WpoUgC8HgGwQYqI7AMHj1G9zk2Ea20wgI5iPhqs8dMk6/26GrOyiqharc16nlffvn3EaWtAc/BcBw8+/Ojc+PjkKaMvuWkNME+YnZ17+rnnDxweHOi9iCM+gzbLOXLrG8piu46JIO5/4NHD9XpwbEPfEqjJ01R0XecDYcz8lvhFMSEkwJIBaU76AZA+SsST5oHOmidqvsHQieYk6ya/ucysT/pPon6yLum/5tXN4uV45ocAKHEeWFdQYcpKKb4wNnH/xMTUjwGYArBofLHfuhfjeO+eXbu+/ms+946JyWl16NAxWmV80AZGImW+M0z/dxWUNbvJNQzaqNK4ro13v/NN9C//doP4gz/+mxKAWWNQb2hHzL/s0n1XDfT3W3fe8wRAVmLytCE56HM3LL/E+bRqb+niFZ9rSvD0nnHzd2Y+M3vs5Ckwc/S9QQMABgGc0cvS9fU8migi0uUDey7asfvQ4eMQlouuzs74Am0sL4TZQhHHTpzG8FB/qdRR3DU9M/sUgJqmphfjhJaa9H1v9/Ztw/1PPn0QtWoNs7OzWBltATiOixMnzuCS/bvtgTBwCQXg6s5fNLdTmnkuSAKww0WrS7q6St7E5Ax6egbWWHpow3EcnDs/EX8v6fDw4J4XDhzxASwAEOvSAF2Wu2j3jssAQqVSQ6+ULTQ/W3+pQy/dYHauEi9Sbhsd2gGgqB2xBEDN+gCpy3rCCGjP5OQ0FHO0idGeDTexHRkoxvjEJHZsGxkE0APgnO5TYc6x1hKAIKJtu3dtGzp1+hyKxY5oB6wpDWibIRenTp3D6OhQl5RyMAiC5w0TRCtpACW+rM8aGR7cPzTYX3ziqQPw/dzmm4gtYOaYGZ7n4cTJs3jVK67xw++l23723AVtURLhaFIDEuGnG47+S33fo8mpWZQ6XUxPT6ONtfeD7dgRj6NQyNHQ0MCOUAA2ANmMBpAhhGJo//eFy6lgFsjn823zsw6cnhyHUhw74kcfe8ozfMCKAkjOAYb27tk5cubsBTiuF3v35h1w2xwpRmgxZrBj+/AIgA4AY7pfsZYGyIi6uzv3hHOArocefQbMwNTUVFsDmjdDIUmcDgfv6OhwH4CIjie0gJfVAF3J2bVjWzgB65TnL0ygs7NrnROwthZUqzWcPHUOV1y2txiuJA/Pzc0/spYJEob5ye/Zs/NiZka5XEVPr4821gfP9xAN3nA9yB4c6Nt+cG5eLvPGDCdNUKNS7769u3ZGX1NfqwfR+s//C/PDnH5TRq+kxun8fBkdxQJGhgd2Hjx01BBAwgQl7L/I5fyd4RJE3+TUdNjIPKSc0AJg/T+JxNNnK5Uly3VuterJOpzh3hmts5DWKExy3/j6l2J4eAAjI4PbjG9UF6YQrMaBWRCufu4fHRn0Bvp7USzkUS4vmD9as+IP3cSHWL5eXGTUizk6v/IDubodM7+++qs+ENbsg2RxLlE/5pr1Ew8H25aFnp6u2CFvGx0e0JHQGdMEJTWgkTo7d4xe3NfXg1KpiLe86TWg9ONtc3eKuVX3yatei5m1AIa6pRT9QaCeb2YporBzx7Zd0chnRkgKbaSLsMLZcK6/rzecU53n5TSAEkw/HPkFy86BpJtq3LRBIK6jq7NDhPOqPi0A0+cuuxq6EMas5bGJaVQWFWgTbrqVTdEX9f4ZvmfB9/3Il5bW2hNmnZbDB4omLpw/h7n5RYCa+3E0ToY4Jp9XiGSYk/WMvHmlxDEn7yN5ffN4mTzrM808G+0leJqVbG81njbfjFJHHr4no4lZ3fjRT06GoWxQ+eFHn7rTz/1Tv5QSrBQpZrAmfVMaQJyNOXHOPESjztJfs54uxFJWl5q1zYuZRzD+RzAPEufoJFln2TyMv8axwUheJPGRVSMFEHe4ZckqMy8cOXLin5f7xVUyyPypwhKAHp13IjJCVW4iHGAz30Q5mmx3I+dwyvbWE36x0ck1AFW9Gb+g06qmWkMQVuLEQEtuVldyjR/vFJqyjxNb6+mTA6DV96HMvkx0ej2pAZZxoBL5QJ8oDKIW3jxnfA5twj1xUhPMjjd9wGpOOEgIgUzaxFG8RZ4FTgxos9N1atajtd+S1LytA26p8NKbQE7/0+BtpNakNtpoo4022vgf7lRPtKCE39oAAAAASUVORK5CYII="),L.resource.add("hterm/concat/date","text/plain","Mon, 26 Nov 2018 08:50:10 +0000"),L.resource.add("hterm/changelog/version","text/plain","2018-10-24"),L.resource.add("hterm/changelog/date","text/plain","1.82"),L.resource.add("hterm/git/HEAD","text/plain","03ee0980444a38a97ef947b2272e44fdb3bdf5f5");var z=/(?:\x1b)([`0-9\-=~!@#$%^&*\(\)_+\[\]\\{}|;':",.//<>?a-zA-Z])/,W=new RegExp("^"+z.source+"$"),K=new RegExp("(?:+)(O|N|\\[|\\[\\[)(?:"+["(\\d+)(?:;(\\d+))?([~^$])","(?:M([@ #!a`])(.)(.))","(?:1;)?(\\d+)?([a-zA-Z])"].join("|")+")"),H=new RegExp("^"+K.source),j=new RegExp([K.source,z.source,/\x1b./.source].join("|"));function G(e,t){if(!function(e){return/\x1b\[M/.test(e)||/\x1b\[M([\x00\u0020-\uffff]{3})/.test(e)||/\x1b\[(\d+;\d+;\d+)M/.test(e)||/\x1b\[<(\d+;\d+;\d+)([mM])/.test(e)||/\x1b\[<(\d+;\d+;\d+;\d+)&w/.test(e)||/\x1b\[24([0135])~\[(\d+),(\d+)\]\r/.test(e)||/\x1b\[(O|I)/.test(e)}(e)){for(var r,o=[];r=j.exec(e);)(o=o.concat(e.slice(0,r.index).split(""))).push(r[0]),e=e.slice(r.index+r[0].length);(o=o.concat(e.split(""))).forEach((function(e){var r,o={sequence:e,name:null,ctrl:!1,meta:!1,shift:!1,fullName:"",code:null,ch:null};if("\r"===e)o.name="return";else if("\n"===e)o.name="linefeed";else if("\t"===e)o.name="tab";else if("\b"===e||""===e||""===e||"\b"===e)o.name="backspace",o.meta=""===e.charAt(0);else if(""===e||""===e)o.name="escape",o.meta=2===e.length;else if(" "===e||" "===e)o.name="space",o.meta=2===e.length;else if(1===e.length&&e<="")o.name=String.fromCharCode(e.charCodeAt(0)+64).toLowerCase(),o.ctrl=!0;else if(1===e.length&&e>="a"&&e<="z")o.name=e;else if(1===e.length&&e>="A"&&e<="Z")o.name=e.toLowerCase(),o.shift=!0;else if(r=W.exec(e))o.name=r[1].toLowerCase(),o.meta=!0,o.shift=/^[A-Z]$/.test(r[1]);else if(r=H.exec(e)){var n=(r[1]||"")+(r[2]||"")+(r[4]||"")+(r[9]||""),i=(r[3]||r[8]||1)-1;switch(o.ctrl=!!(4&i),o.meta=!!(10&i),o.shift=!!(1&i),o.code=n,n){case"OP":o.name="f1";break;case"OQ":o.name="f2";break;case"OR":o.name="f3";break;case"OS":o.name="f4";break;case"[11~":o.name="f1";break;case"[12~":o.name="f2";break;case"[13~":o.name="f3";break;case"[14~":o.name="f4";break;case"[[A":o.name="f1";break;case"[[B":o.name="f2";break;case"[[C":o.name="f3";break;case"[[D":o.name="f4";break;case"[[E":case"[15~":o.name="f5";break;case"[17~":o.name="f6";break;case"[18~":o.name="f7";break;case"[19~":o.name="f8";break;case"[20~":o.name="f9";break;case"[21~":o.name="f10";break;case"[23~":o.name="f11";break;case"[24~":o.name="f12";break;case"[A":o.name="up";break;case"[B":o.name="down";break;case"[C":o.name="right";break;case"[D":o.name="left";break;case"[E":o.name="clear";break;case"[F":o.name="end";break;case"[H":o.name="home";break;case"OA":o.name="up";break;case"OB":o.name="down";break;case"OC":o.name="right";break;case"OD":o.name="left";break;case"OE":o.name="clear";break;case"OF":o.name="end";break;case"OH":case"[1~":o.name="home";break;case"[2~":o.name="insert";break;case"[3~":o.name="delete";break;case"[4~":o.name="end";break;case"[5~":o.name="pageup";break;case"[6~":o.name="pagedown";break;case"[[5~":o.name="pageup";break;case"[[6~":o.name="pagedown";break;case"[7~":o.name="home";break;case"[8~":o.name="end";break;case"[a":o.name="up",o.shift=!0;break;case"[b":o.name="down",o.shift=!0;break;case"[c":o.name="right",o.shift=!0;break;case"[d":o.name="left",o.shift=!0;break;case"[e":o.name="clear",o.shift=!0;break;case"[2$":o.name="insert",o.shift=!0;break;case"[3$":o.name="delete",o.shift=!0;break;case"[5$":o.name="pageup",o.shift=!0;break;case"[6$":o.name="pagedown",o.shift=!0;break;case"[7$":o.name="home",o.shift=!0;break;case"[8$":o.name="end",o.shift=!0;break;case"Oa":o.name="up",o.ctrl=!0;break;case"Ob":o.name="down",o.ctrl=!0;break;case"Oc":o.name="right",o.ctrl=!0;break;case"Od":o.name="left",o.ctrl=!0;break;case"Oe":o.name="clear",o.ctrl=!0;break;case"[2^":o.name="insert",o.ctrl=!0;break;case"[3^":o.name="delete",o.ctrl=!0;break;case"[5^":o.name="pageup",o.ctrl=!0;break;case"[6^":o.name="pagedown",o.ctrl=!0;break;case"[7^":o.name="home",o.ctrl=!0;break;case"[8^":o.name="end",o.ctrl=!0;break;case"[Z":o.name="tab",o.shift=!0;break;default:o.name=null}}1===e.length&&(o.ch=e);let s=o.name||"";o.shift&&(s="S-"+s),o.meta&&(s="M-"+s),o.ctrl&&(s="C-"+s),o.fullName=s,t(o)}))}}const q={keyStrokeDelay:200,lingerDelay:1e3,fadeDuration:1e3,bezelColor:"#000",textColor:"#fff",position:"top-right"};let Q={right:"→",left:"←",up:"↑",down:"↓",space:"␣",enter:"↩",return:"↩",linefeed:"C-j",shift:"S-",ctrl:"C-",tab:"⇥",escape:"⎋",pagedown:"⇟",pageup:"⇞",home:"↖",end:"↘",delete:"⌦",backspace:"⌫",meta:"M-"};var $=new class{constructor(){this.initialized=!1,this.container=null,this.style=null,this.options=q,this.currentChunk=null,this._onKey=e=>{if(!this.container)return;this.currentChunk||(this.currentChunk=document.createElement("li"),0===this.options.position.indexOf("top")?this.container.insertBefore(this.currentChunk,this.container.childNodes[0]):this.container.appendChild(this.currentChunk));var t="";e.ctrl&&(t+=Q.ctrl),e.meta&&(t+=Q.meta),e.shift&&(t+=Q.shift);let r=(e.name||"").replace(/^[CMS]-/,"");this.currentChunk.textContent+=t+(Q[r]||r||e.ch);var o=this.options;clearTimeout(this.keyStrokeTimeout),this.keyStrokeTimeout=setTimeout(()=>{!function(e){setTimeout(()=>{e.style.opacity=0,setTimeout(()=>{e.parentNode.removeChild(e)},o.fadeDuration)},o.lingerDelay)}(this.currentChunk),this.currentChunk=null},o.keyStrokeDelay)}}cleanUp(){function e(e){e&&e.parentNode&&e.parentNode.removeChild(e)}e(this.container),e(this.style),clearTimeout(this.keyStrokeTimeout),this.currentChunk=null,this.container=this.style=null}injectComponents(){this.container=document.createElement("ul");let e=document.querySelector("x-screen");e&&e.appendChild(this.container),this.container.className="keystrokes";const t={"bottom-left":"bottom: 0;","bottom-right":"bottom: 0; direction: rtl;","top-left":"top: 0;","top-right":"top: 0; direction: rtl;"};t[this.options.position]||(console.warn(`Invalid position '${this.options.position}', using default 'bottom-left'. Valid positions: `,Object.keys(t)),this.options.position="bottom-left"),this.style=document.createElement("style"),this.style.innerHTML=`\n ul.keystrokes {\n padding: 0 10px;\n position: fixed;\n left: 0;\n right: 0;\n ${t[this.options.position]}\n }\n\n ul.keystrokes li {\n direction: ltr;\n background-color: ${this.options.bezelColor};\n opacity: 0.9;\n color: ${this.options.textColor};\n padding: 5px 10px;\n margin-bottom: 5px;\n border-radius: 15px;\n opacity: 1;\n display: table;\n -webkit-transition: opacity ${this.options.fadeDuration}ms linear;\n transition: opacity ${this.options.fadeDuration}ms linear;\n }`,document.body.appendChild(this.style)}processInput(e){G(e,this._onKey)}enable(e){this.cleanUp(),this.options=Object.assign({},q,e||this.options),this.injectComponents()}disable(){this.cleanUp()}},J=o(1),X=o.n(J),Y=/[\x1b\x07]/;function Z(e,t){!e.codingSystemUtf8_&&e[e.GL].GL&&(t=e[e.GL].GL(t)),e.terminal.print(t)}U.VT.prototype.parseUntilStringTerminator_=function(e){var t=e.peekRemainingBuf(),r=e.args;let 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);const n=t.search(Y),i=t.charAt(n);let s;var a;return(s=(""!=i||"\\"===t.charAt(n+1))&&-1!==n)?(r[0]+=t.substr(0,n),e.resetParseFunction(),e.advance(n+(""==i?2:1)-o),!0):(r[0]+=t,""==i&&n!=t.length-1&&(a="embedded escape: "+n),new Date-r[1]>this.oscTimeLimit_&&(a="timeout expired: "+(new Date-r[1])),a?(this.warnUnimplemented&&console.log("parseUntilStringTerminator_: aborting: "+a,r[0]),e.reset(r[0]),!1):(e.advance(t.length-o),!0))},U.VT.prototype.dispatch=function(e,t,r){var o=ae.get(e).get(t);o?o!==U.VT.ignore?!r.subargs||o.supportsSubargs?"CC1"===e&&t>""&&!this.enable8BitControl?console.warn("Ignoring 8-bit control code: 0x"+t.charCodeAt(0).toString(16)):o.call(this,r,t):this.warnUnimplemented&&console.warn("Ignored "+e+" code w/subargs: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Ignored "+e+" code: "+JSON.stringify(t)):this.warnUnimplemented&&console.warn("Unknown "+e+" code: "+JSON.stringify(t))},U.VT.ParseState.prototype.peekRemainingBuf=function(){return this.buf.substr(this.pos)},U.VT.ParseState.prototype.peekChar=function(){return this.buf.charAt(this.pos)},U.VT.ParseState.prototype.consumeChar=function(){return this.buf.charAt(this.pos++)},U.VT.prototype.parseUnknown_=function(e){var t=e.peekRemainingBuf(),r=t.search(this.cc1Pattern_);return 0===r?(this.dispatch("CC1",t.charAt(0),e),void e.advance(1)):-1===r?(Z(this,t),void e.reset()):(Z(this,t.substr(0,r)),this.dispatch("CC1",t.charAt(r),e),void e.advance(r+1))};var ee,te=[],re=null,oe=!1;function ne(){X.a.unstable_deferredUpdates(ie)}function ie(){for(var e=ee,t=Date.now()+10;;){if(null===re){if(null==(n=te.shift()))break;e.parseState_.resetBuf(n),re=e.parseState_}for(;!re.isComplete();){var r=e.parseState_.func,o=e.parseState_.pos,n=e.parseState_.buf;if(e.parseState_.func.call(e,e.parseState_),e.parseState_.func==r&&e.parseState_.pos==o&&e.parseState_.buf==n)throw oe=!1,re=null,"Parser did not alter the state!";if(t="@"&&t<="~"?(this.dispatch("CSI",this.leadingModifier_+this.trailingModifier_+t,e),se(e)):";"===t?this.trailingModifier_?se(e):(r.length||r.push(""),r.push("")):t>="0"&&t<="9"||":"===t?this.trailingModifier_?se(e):(r.length?r[r.length-1]+=t:r[0]=t,":"===t&&e.argSetSubargs(r.length-1)):t>=" "&&t<="?"?r.length?this.trailingModifier_+=t:this.leadingModifier_+=t:this.cc1Pattern_.test(t)?this.dispatch("CC1",t,e):se(e),e.advance(1)};var ae=new Map;function le(e){var t=e.consumeChar();""!=t&&(this.dispatch("ESC",t,e),e.func==le&&e.resetParseFunction())}U.VT.ParseState.prototype.resetArguments=function(){this.args=[]},U.VT.ParseState.prototype.parseInt=function(e,t){if(e){const r=parseInt(e,10);return 0===r?(void 0===t&&(t=0),t):r}return void 0===t&&(t=0),t},U.VT.prototype.parseSgrExtendedColors=function(e,t,r){let o,n;if(e.argHasSubargs(t))(o=e.args[t].split(":")).shift(),n=!0;else{if(e.argHasSubargs(t+1))return{skipCount:0};if(5===parseInt(e.args[t+1],10))return function(e,t,r){if(e.length-t+1<2)return{skipCount:0};const o=parseInt(e[t+2],10);return o{const t=e.match(/^([^=]+)=(.*)$/m);if(t)switch(t[1]){case"name":try{o.name=window.atob(t[2])}catch(e){}break;case"size":try{o.size=parseInt(t[2])}catch(e){}break;case"width":o.width=t[2];break;case"height":o.height=t[2];break;case"preserveAspectRatio":o.preserveAspectRatio=!("0"==t[2]);break;case"inline":o.inline=!("0"==t[2]);break;case"align":o.align=t[2]}}),o.inline){const t=this.terminal.io,r=e.peekRemainingBuf();e.advance(r.length),this.terminal.displayImage(o),t.writeUTF8(r)}else this.terminal.displayImage(o)},U.VT.OSC[4]=function(e){for(var t=e.args[0].split(";"),r=parseInt(t.length/2),o=this.terminal.getTextAttributes().colorPalette,n=[],i=0;i=o.length||("?"!=a?(a=L.colors.x11ToCSS(a))&&(o[s]=a):(a=L.colors.rgbToX11(o[s]))&&n.push(s+";"+a))}n.length&&this.terminal.io.sendString("]4;"+n.join(";")+""),this.terminal.getTextAttributes().refreshCSSPalette()},U.VT.OSC[10]=function(e){var t=e.args[0].split(";");if(t){var r=t.shift();if("?"==r){var o=L.colors.rgbToX11(this.terminal.getForegroundColor());o&&this.terminal.io.sendString("]10;"+o+"\\")}else{var n=L.colors.x11ToCSS(r);n&&this.terminal.setForegroundColor(n),this.terminal.getTextAttributes().refreshCSSPalette()}t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[11].apply(this,[e]))}},U.VT.OSC[11]=function(e){var t=e.args[0].split(";");if(t){var r=t.shift();if("?"==r){var o=L.colors.rgbToX11(this.terminal.getBackgroundColor());o&&this.terminal.io.sendString("]11;"+o+"\\")}else{var n=L.colors.x11ToCSS(r);n&&this.terminal.setBackgroundColor(n),this.terminal.getTextAttributes().refreshCSSPalette()}t.length>0&&(e.args[0]=t.join(";"),U.VT.OSC[12].apply(this,[e]))}},["CC1","ESC","CSI","OSC","VT52"].forEach(e=>{var t=new Map,r=U.VT[e];Object.keys(r).map(e=>{t.set(e,r[e])}),ae.set(e,t)});var ce=o(0),ue=o.n(ce);const he=300;for(var de=new Array(256),pe=new Array(256),fe=new Array(256),ge="b",me="i",be="blink-node",_e="u",ye="s",we="us",ve={solid:"u1",double:"u2",wavy:"u3",dotted:"u4",dashed:"u5"},Ce=0;Ce<256;Ce++)de[Ce]="c"+Ce,pe[Ce]="bc"+Ce,fe[Ce]="uc"+Ce;const Se=/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|[\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|[\ud83c[\ude32-\ude3a]|[\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/;class ke extends ue.a.Component{constructor(){super(...arguments),this._v=-1}render(){const e=this.props.node,t=e.attrs;if(this._v=e.v,t.isDefault)return e.txt;let r=[];var o=null;t.fci>=0?r.push(de[t.fci]):void 0!==t.fcs&&((o=o||{}).color=t.fcs),t.bci>=0?r.push(pe[t.bci]):void 0!==t.bcs&&((o=o||{}).backgroundColor=t.bcs),t.uci>=0?r.push(fe[t.uci]):void 0!==t.ucs&&((o=o||{}).textDecorationColor=t.ucs),t.bold&&r.push(ge),t.italic&&r.push(me),t.blink&&r.push(be),t.underline?(t.strikethrough?r.push(we):r.push(_e),r.push(ve[t.underline])):t.strikethrough&&r.push(ye),t.asciiNode||(t.wcNode?Se.test(e.txt)?r.push("wc wc-node emoji"):r.push("wc wc-node"):e.wcwi.rowIndex)r();else if(o.focusNode==o.anchorNode)o.anchorOffset{this.allowScrollButtonsToDisplay_=!0},500),this.document_.addEventListener("selectionchange",()=>{if(this.selection.sync(),!this.allowScrollButtonsToDisplay_)return;const e=this.accessibilityReader_&&this.accessibilityReader_.accessibilityEnabled,t=this.document_.getSelection();let r;t.anchorNode&&t.anchorNode.parentElement&&(r=t.anchorNode.parentElement),e&&r==this.scrollUpButton_?this.scrollUpButton_.style.top="0px":this.scrollUpButton_.style.top="-32px",e&&r==this.scrollDownButton_?this.scrollDownButton_.style.bottom="0px":this.scrollDownButton_.style.bottom="-32px"}),this.screen_.appendChild(this.scrollUpButton_),this.rowNodes_=e.createElement("div"),this.rowNodes_.id="hterm:row-nodes",this.rowNodes_.style.cssText="display: block;position: absolute;top: 0;left: 0;right: 0;bottom: 0;background-color: inherit;overflow: hidden;-webkit-user-select: text;-moz-user-select: text;",this.screen_.appendChild(this.rowNodes_),this.topSelectBag_=e.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_=e.createElement("x-fold"),this.topFold_.id="hterm:top-fold-for-row-selection",this.topFold_.style.cssText="display: block;",this.rowNodes_.appendChild(this.topFold_),this._renderDom=e.createElement("div"),this._renderDom.id="hterm:renderer",this.rowNodes_.appendChild(this._renderDom),this.renderRef=X.a.render(ue.a.createElement(Pe),this._renderDom),this.bottomFold_=this.topFold_.cloneNode(),this.bottomFold_.id="hterm:bottom-fold-for-row-selection",this.rowNodes_.appendChild(this.bottomFold_);var o=this;Re=U.getClientSize(this.screen_),this.scroller_=new Ae((function(e,t,r){Ee!==t&&(Ee=t||0,o.onScroll_())}),window.t),this.scroller_.setDimensions(Re.width,Re.height,Re.width,Re.height);var n="http://www.w3.org/2000/svg";this.svg_=window.document.createElementNS(n,"svg"),this.svg_.id="hterm:zoom-detector",this.svg_.setAttribute("xmlns",n),this.svg_.setAttribute("version","1.1"),this.svg_.style.cssText="position: absolute;top: 0;left: 0;visibility: hidden",this.pasteTarget_=e.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()},U.ScrollPort.prototype.on_touchstart_=function(e){},U.ScrollPort.prototype.on_touchmove_=function(e){},U.ScrollPort.prototype.on_touchend_=function(e){},U.ScrollPort.prototype.on_touchcancel_=function(e){},U.ScrollPort.prototype.focus=function(){},U.ScrollPort.prototype.getScreenSize=function(){return Re},U.ScrollPort.prototype.resetCache=function(){},U.ScrollPort.prototype.setRowProvider=function(e){this.resetCache(),this.rowProvider_=e,this.scheduleRedraw()},U.ScrollPort.prototype.invalidate=function(){var e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);this.drawVisibleRows_(e,t)},U.ScrollPort.prototype.scheduleInvalidate=function(){if(!this.timeouts_.invalidate){var e=this;this.timeouts_.invalidate=setTimeout((function(){e.timeouts_.invalidate=0,e.invalidate()}),0)}};var Me="";U.ScrollPort.prototype.syncRowNodesDimensions_=function(){var e=this.getScreenSize();this.lastScreenWidth_=e.width,this.lastScreenHeight_=e.height,this.visibleRowCount=L.f.smartFloorDivide(e.height,this.characterSize.height);var t=this.visibleRowCount*this.characterSize.height;this.visibleRowTopMargin=0,this.visibleRowBottomMargin=e.height-t;var r="";Ee<0&&(r="translate3d(0, "+-Ee+"px, 0)"),r!==Me&&(Me=r,this.rowNodes_.style.transform=r,this.rowProvider_.cursorOverlayNode_&&(this.rowProvider_.cursorOverlayNode_.style.transform=r))};var Ne=0;U.ScrollPort.prototype.syncScrollHeight=function(){this.lastRowCount_=this.rowProvider_.getRowCount();var e=this.characterSize.height*this.lastRowCount_+this.visibleRowTopMargin+this.visibleRowBottomMargin;Ne!==e&&(Ne=e,this.scroller_.setDimensions(Re.width,Re.height,Re.width,Ne))},U.ScrollPort.prototype.scheduleRedraw=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=requestAnimationFrame((function(){e.timeouts_.redraw=0,e.redraw_()}))}},U.ScrollPort.prototype.redraw_=function(){this.syncScrollHeight();var e=this.getTopRowIndex(),t=this.getBottomRowIndex(e);this.drawVisibleRows_(e,t),this.syncRowNodesDimensions_(),this.isScrolledEnd=this.getTopRowIndex()+this.visibleRowCount>=this.lastRowCount_},U.ScrollPort.prototype.drawVisibleRows_=function(e,t){for(var r=Math.min(this.visibleRowCount,this.rowProvider_.getRowCount()),o=[],n=0;n=this.lastRowCount_;var t=e*this.characterSize.height+this.visibleRowTopMargin,r=this.getScrollMax_();t>r&&(t=r),Ee!==t&&(this.scroller_.scrollTo(0,t),this.scheduleRedraw())},U.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),Ee!==t&&this.scroller_.scrollTo(0,t)},U.ScrollPort.prototype.scrollToBottom=function(){this.syncScrollHeight(),this.scroller_.scrollTo(0,Ne-Re.height,!1)},U.ScrollPort.prototype.getTopRowIndex=function(){var e=Math.round(Ee/this.characterSize.height);return e<0?0:e};var Ie=-1,De=-1;function Oe(e,t){var r=(Oe.canvas||(Oe.canvas=document.createElement("canvas"))).getContext("2d");r.font=t;var o=r.measureText(e);return{width:o.width,height:o.fontBoundingBoxAscent+o.fontBoundingBoxDescent}}U.ScrollPort.prototype.onScroll_=function(e){var t=this.getScreenSize();if(t.width==this.lastScreenWidth_&&t.height==this.lastScreenHeight_){var r=Math.round(Ee/this.characterSize.height),o=this.getBottomRowIndex(r);Ie===r&&De===o||(Ie=r,De=o,this.redraw_(),this.publish("scroll",{scrollPort:this}))}else this.resize()},U.ScrollPort.prototype.onScrollWheel=function(e){},U.ScrollPort.prototype.onResize_=function(e){Re=U.getClientSize(this.screen_),this.scroller_.setDimensions(Re.width,Re.height,null,Ne),this.syncCharacterSize()},U.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,r,o=this.getTopRowIndex(),n=this.getBottomRowIndex(o);if(this.selection.startRow.rowIndexn)r=this.selection.startRow.rowIndex>n?this.selection.startRow.rowIndex+1:this.bottomFold_.previousSibling.rowIndex+1,this.bottomSelectBag_.textContent=this.rowProvider_.getRowsText(r,this.selection.endRow.rowIndex),this.rowNodes_.insertBefore(this.bottomSelectBag_,this.selection.endRow)}},U.ScrollPort.prototype.measureCharacterSize=function(e){var t,r="canvas"!==window.fontSizeDetectionMethod;if(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;",r&&(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.rulerBaseline_.id="hterm:ruler-baseline",this.rulerBaseline_.style.fontSize="0px",this.rulerBaseline_.textContent="X"),this.rulerSpan_&&(this.rulerSpan_.style.fontWeight=e||""),this.rowNodes_.appendChild(this.ruler_),r){var o=U.getClientSize(this.rulerSpan_);t=new U.Size(o.width/100,o.height/100)}else{var n=this.screen_.style.font;0==n.length&&(n=`${this.screen_.style.fontWeight} ${this.screen_.style.fontSize} ${this.screen_.style.fontFamily}`);var i=Oe("QWER1YUIOX".repeat(10),n);t=new U.Size(i.width/100,i.height)}return this.ruler_.insertBefore(this.rulerBaseline_,this.ruler_.childNodes[0]),t.baseline=this.rulerBaseline_.offsetTop,this.ruler_.removeChild(this.rulerBaseline_),this.rowNodes_.removeChild(this.ruler_),this.div_.ownerDocument.body.appendChild(this.svg_),t.zoomFactor=this.svg_.currentScale,this.div_.ownerDocument.body.removeChild(this.svg_),t},U.ScrollPort.prototype.resize=function(e=!1){this.currentScrollbarWidthPx=U.getClientWidth(this.screen_)-this.screen_.clientWidth,this.syncScrollHeight(),this.syncRowNodesDimensions_();var t=this;this.publish("resize",{scrollPort:this},(function(){t.scroller_.setDimensions(Re.width,Re.height,Re.width,Ne);var r=Ne-Re.height;r<0&&(r=0),t.scroller_.scrollTo(0,r,!1,e),t.scheduleRedraw()}))},U.ScrollPort.prototype.updateScrollButtonState_=function(){};let Ve=0;function Be(e){e.v=(e.v+1)%1e6}function Le(){return Ve++%1e6}function Ue(e,t,r){return e.attrs.asciiNode?e.txt.substr(t,r):L.wc.substr(e.txt,t,r)}function ze(e){let t=0;const r=e.nodes,o=r.length;for(var n=0;nt)break;i+=r<=65535?1:2}if(null!=r){for(o=i,n=0;or)break;o+=t<=65535?1:2}return e.substring(i,o)}return e.substr(i)},L.wc.strWidth=function(e){var t,r=e.length,o=0,n=e.search(Xe);if(n<0)return r;var i=n;for(o=n;i2e4&&(Ye=new Map),Ye.set(e,t)),t},U.Screen.prototype.invalidateCursorPosition=function(){this.cursorPosition.move(0,0),this.cursorRowIdx_=0,this.cursorNodeIdx_=0,this.cursorOffset_=0},U.Screen.prototype.clearCursorRow=function(){var e;this.cursorOffset_=0,this.cursorPosition.column=0,this.cursorPosition.overflow=!1,e=this.textAttributes.isDefault()?"":L.f.getWhitespace(this.columnCount_);var t=this.textAttributes.inverse;this.textAttributes.inverse=!1,this.textAttributes.syncColors();var r=$e(this.textAttributes.attrs(),e,e.length),o=this.rowsArray[this.cursorRowIdx_];o.nodes=[r],o.o=!1,o.img&&(o.img=null),Be(o),this.cursorNodeIdx_=0,this.textAttributes.inverse=t,this.textAttributes.syncColors()},U.Screen.prototype.commitLineOverflow=function(){var e=this.rowsArray[this.cursorRowIdx_];e.o=!0,Be(e)},U.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=0,n=r.nodes[0];n||(n=Qe("",0),r.nodes=[n],Be(r));var i=0;if(e===this.cursorRowIdx_?t>=this.cursorPosition.column-this.cursorOffset_&&(o=this.cursorNodeIdx_,n=r.nodes[o],i=this.cursorPosition.column-this.cursorOffset_):this.cursorRowIdx_=e,this.cursorPosition.move(e,t),0===t)return this.cursorNodeIdx_=0,void(this.cursorOffset_=0);for(;n;){var s=t-i;if(!r.nodes[o+1]||n.wcw>s)return this.cursorNodeIdx_=o,void(this.cursorOffset_=s);i+=n.wcw,n=r.nodes[++o]}}else console.warn("Attempt to set cursor position on empty screen.")},U.Screen.prototype.syncSelectionCaret=function(e){let t=window._kb.caret;if(t){if(e.isCollapsed&&e.focusNode===t&&0===e.focusOffset)return;e.collapse(t,0)}},U.Screen.prototype.cursorRow=function(){return this.rowsArray[this.cursorRowIdx_]},U.Screen.prototype.maybeClipCurrentRow=function(){var e=this.cursorRow(),t=ze(e);if(t<=this.columnCount_)this.cursorPosition.column>=this.columnCount_&&(this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1),this.cursorPosition.overflow=!0);else{var r=this.cursorPosition.column;this.setCursorPosition(this.cursorPosition.row,this.columnCount_-1);var o=this.rowsArray[this.cursorRowIdx_].nodes[this.cursorNodeIdx_];t=o.wcw,this.cursorOffset_=0||n.attrs.bcs||n.attrs.underline||n.attrs.strikethrough))je(n,s+=c,n.wcw-l);else{var u=qe(c,-l);this.cursorNodeIdx_++,o.nodes.splice(this.cursorNodeIdx_,0,u),n=u,this.cursorOffset_=a=-l,s=c}l=0}if(Je(n,r)){if(0===l)Ge(r,n,s+e),o.nodes[this.cursorNodeIdx_+1]||(i=0);else if(0===a){const s=t-n.wcw;s>=0?(Ge(r,n,e,t),i=o.nodes[this.cursorNodeIdx_+1]?s:0):(Ge(r,n,e+Ue(n,t)),i=0)}else{const o=t+a-n.wcw;if(o>=0)Ge(r,n,Ue(n,0,a)+e),i=o;else Ge(r,n,Ue(n,0,a)+e+Ue(n,a+t)),i=0}return this.cursorOffset_+=t,i}if(0===a){var h=o.nodes[this.cursorNodeIdx_-1];if(h&&Je(h,r)){Ge(r,h,h.txt+e);const s=t-n.wcw;return s>=0?(o.nodes.splice(this.cursorNodeIdx_,1),i=s):n.attrs.wcNode||(je(n,Ue(n,t)),i=0),this.cursorNodeIdx_=this.cursorNodeIdx_-1,this.cursorOffset_=h.wcw,i}var d=$e(r,e,t);this.cursorOffset_=t;const s=t-n.wcw;return s>=0?(o.nodes.splice(this.cursorNodeIdx_,1,d),i=s):(o.nodes.splice(this.cursorNodeIdx_,0,d),je(n,Ue(n,t)),i=0),i}if(0===l){var p=o.nodes[this.cursorNodeIdx_+1];if(p&&Je(p,r)){const o=t-p.wcw;return o>=0?(Ge(r,p,e,t),i=o):(Ge(r,p,e+Ue(p,t)),i=0),this.cursorNodeIdx_++,this.cursorOffset_=t,i}return d=$e(r,e,t),o.nodes.splice(this.cursorNodeIdx_+1,0,d),this.cursorNodeIdx_++,p||(i=0),this.cursorOffset_=d.wcw,i}const f=a+t-n.wcw;if(f>=0){je(n,Ue(n,0,a));d=$e(r,e,t);return this.cursorNodeIdx_++,o.nodes.splice(this.cursorNodeIdx_,0,d),this.cursorOffset_=t,i=f}var g=et(n,a,d=$e(r,e,t)),m=g.length;return 1===m?o.nodes.splice(this.cursorNodeIdx_,1,g[0]):2===m?o.nodes.splice(this.cursorNodeIdx_,1,g[0],g[1]):3===m&&(o.nodes.splice(this.cursorNodeIdx_,1,g[0],g[1],g[2]),this.cursorNodeIdx_++),this.cursorNodeIdx_++,this.cursorOffset_=0,i},U.Screen.prototype.insertString=function(e,t){var r=this.rowsArray[this.cursorRowIdx_],o=r.nodes[this.cursorNodeIdx_],n=o.txt;const i=this.textAttributes.attrs();r.o=!1,this.cursorPosition.column+=t;var s=this.cursorOffset_,a=o.wcw-s;if(a<0){var l=L.f.getWhitespace(-a);if(o.attrs.isDefault||!(!o.attrs.asciiNode||o.attrs.wcNode||o.attrs.bci>=0||o.attrs.bcs||o.attrs.underline||o.attrs.strikethrough))je(o,n+=l,o.wcw-a);else{var c=qe(l,-a);this.cursorNodeIdx_++,r.nodes.splice(this.cursorNodeIdx_,0,c),o=c,this.cursorOffset_=s=-a,n=l}a=0}if(Je(o,i)){if(0===a)Ge(i,o,n+e);else if(0===s)Ge(i,o,e+n);else{Ge(i,o,Ue(o,0,s)+e+Ue(o,s))}this.cursorOffset_+=t}else{if(0===s){var u=r.nodes[this.cursorNodeIdx_-1];if(u&&Je(u,i))return Ge(i,u,u.txt+e),this.cursorNodeIdx_=this.cursorNodeIdx_-1,void(this.cursorOffset_=u.wcw);var h=$e(i,e,t);return r.nodes.splice(this.cursorNodeIdx_,0,h),void(this.cursorOffset_=t)}if(0===a){var d=r.nodes[this.cursorNodeIdx_+1];return d&&Je(d,i)?(Ge(i,d,e+d.txt),this.cursorNodeIdx_++,void(this.cursorOffset_=t)):(h=$e(i,e,t),r.nodes.splice(this.cursorNodeIdx_+1,0,h),this.cursorNodeIdx_++,void(this.cursorOffset_=h.wcw))}var p=et(o,s,h=$e(i,e,t)),f=p.length;1===f?r.nodes.splice(this.cursorNodeIdx_,1,p[0]):2===f?r.nodes.splice(this.cursorNodeIdx_,1,p[0],p[1]):3===f&&(r.nodes.splice(this.cursorNodeIdx_,1,p[0],p[1],p[2]),this.cursorNodeIdx_++),this.cursorNodeIdx_++,this.cursorOffset_=0}},U.Screen.prototype.overwriteString=function(e,t){if(!(this.columnCount_-this.cursorPosition.column))return[e];var r=this.rowsArray[this.cursorRowIdx_],o=r.nodes[this.cursorNodeIdx_],n=this.textAttributes.attrs(),i=this.cursorOffset_;const s=t+i-o.wcw;if(s<=0&&Je(o,n)){if(this.cursorOffset_+=t,this.cursorPosition.column+=t,0===s&&o.txt.substr(i)===e)return;return Ge(n,o,0===s?Ue(o,0,i)+e:Ue(o,0,i)+e+Ue(o,i+t)),void Be(r)}var a=this.overwriteNode(e,t,n);a>0&&this.deleteChars(a),function(e,t){for(var r=0,o=e.nodes[t],n=o.txt,i=o.wcw,s=o.attrs,a=t+1,l=e.nodes[a];l&&Je(l,s);)n+=l.txt,i+=l.wcw,l.attrs.asciiNode||(s=l.attrs),r++,a++,l=e.nodes[a];r>0&&(Ge(s,o,n,i),e.nodes.splice(t+1,r),Be(e))}(r,this.cursorNodeIdx_),Be(r)},U.Screen.prototype.deleteChars=function(e){for(var t=this.rowsArray[this.cursorRowIdx_],r=this.cursorNodeIdx_,o=0,n=this.cursorOffset_,i=t.nodes.length,s=e,a=this.cursorNodeIdx_;a0){if(c-n===e)return je(l,Ue(l,0,n)),s;if(c-n>e)return je(l,Ue(l,0,n)+Ue(l,n+e)),s;if(je(l,Ue(l,0,n)),!t.nodes[a+1])return s;e-=c-n,n=0,r++}else{if(!(c<=e)){if(je(l,Ue(l,e)),l.attrs.wcNode&&c===l.wcw){var u=Qe(" ",1);e-=1,t.nodes.splice(a,1,u)}break}o++,e-=c}}return 0===o?s:(t.nodes.splice(r,o),r>this.cursorNodeIdx_?s:0===(i=t.nodes.length)?(t.nodes=[Qe("",0)],this.cursorNodeIdx_=0,this.cursorOffset_=0,s):i<=this.cursorNodeIdx_?(this.cursorNodeIdx_=i-1,this.cursorOffset_=t.nodes[i-1].wcw,s):(this.cursorOffset_=0,s))},U.Screen.prototype.popRow=function(){return this.rowsArray.pop()},U.Screen.prototype.popRows=function(e){return this.rowsArray.splice(this.rowsArray.length-e,e)},U.Screen.prototype.pushRow=function(e){this.rowsArray[this.rowsArray.length]=e},U.Screen.prototype.setRow=function(e,t){this.rowsArray[t]=e},U.Screen.prototype.pushRows=function(e){for(var t=0,r=this.rowsArray.length,o=e.length;t{e.addEventListener(t,()=>{this.hasUserGesture=!0})})},U.AccessibilityReader.prototype.beforeCursorChange=function(e,t,r){this.accessibilityEnabled&&this.hasUserGesture&&!this.cursorIsChanging_&&(this.cursorIsChanging_=!0,this.lastCursorRowString_=e,this.lastCursorRow_=t,this.lastCursorColumn_=r)},U.AccessibilityReader.prototype.afterCursorChange=function(e,t,r){if(this.cursorIsChanging_){if(this.cursorIsChanging_=!1,!this.announceAction_(e,t,r))for(let e=0;e0)this.queue_.push("");else{if(0==this.queue_.length)this.queue_.push(e);else{let t="";0!=this.queue_[this.queue_.length-1].length&&(t=" "),this.queue_[this.queue_.length-1]+=t+e}if(!this.nextReadTimer_){if(1!=this.queue_.length)throw new Error("Expected only one item in queue_ or nextReadTimer_ to be running.");this.nextReadTimer_=setTimeout(this.addToLiveRegion_.bind(this),U.AccessibilityReader.DELAY)}}},U.AccessibilityReader.prototype.assertiveAnnounce=function(e){this.hasUserGesture&&" "==e&&(e=U.msg("SPACE_CHARACTER",[],"Space")),(e=(e||"").trim())==this.assertiveLiveElement_.innerText&&(e="\n"+e),this.clear(),this.assertiveLiveElement_.innerText=e},U.AccessibilityReader.prototype.newLine=function(){this.announce("\n")},U.AccessibilityReader.prototype.clear=function(){this.liveElement_.innerText="",this.assertiveLiveElement_.innerText="",clearTimeout(this.nextReadTimer_),this.nextReadTimer_=null,this.queue_=[],this.cursorIsChanging_=!1,this.cursorChangeQueue_=[],this.lastCursorRowString_=null,this.lastCursorRow_=null,this.lastCursorColumn_=null,this.hasUserGesture=!1},U.AccessibilityReader.prototype.announceAction_=function(e,t,r){if(this.lastCursorRow_!=t)return!1;if(this.lastCursorRowString_==e){if(this.lastCursorColumn_!=r&&""==this.cursorChangeQueue_.join("").trim()){const e=Math.min(this.lastCursorColumn_,r),t=Math.abs(r-this.lastCursorColumn_);return this.assertiveAnnounce(L.wc.substr(this.lastCursorRowString_,e,t)),!0}return!1}if(this.lastCursorRowString_!=e){if(this.lastCursorColumn_+1==r&&" "==L.wc.substr(e,r-1,1)&&this.cursorChangeQueue_.length>0&&" "==this.cursorChangeQueue_[0])return this.assertiveAnnounce(" "),!0;const t=r;if(L.wc.strWidth(e)<=L.wc.strWidth(this.lastCursorRowString_)&&L.wc.substr(this.lastCursorRowString_,0,t)==L.wc.substr(e,0,t)){let r=L.wc.strWidth(e);for(;r>0&&(r!=t&&" "==L.wc.substr(e,r-1,1));--r);const o=L.wc.strWidth(this.lastCursorRowString_)-r,n=r-t;if(L.wc.substr(this.lastCursorRowString_,t+o,n)==L.wc.substr(e,t,n)){const e=L.wc.substr(this.lastCursorRowString_,t,o);if(""!=e)return this.assertiveAnnounce(e),!0}}return!1}return!1},U.AccessibilityReader.prototype.addToLiveRegion_=function(){this.nextReadTimer_=null;let e=this.queue_.join("\n").trim();e==this.liveElement_.innertText&&(e="\n"+e),this.liveElement_.innerText=e,this.queue_=[]};const tt=/^\W*\w+/,rt=/\w+\W*$/,ot=8;class nt{constructor(e){this._cursor=-1,this._lastValue="",this._lastPrompt=[""],this._call=null,this._lines=[],this._total=0,this._found=0,this._response=null,this._prompt=e,this._lastValue=e._value,this._lastPrompt=e._prompt}enter(){let e=this._cursor,t=this._lines.find((function(t){return t.num==e}));t&&(this._prompt._value=t.val,this._prompt._cursor=L.wc.strWidth(t.val),this._prompt._render())}search(){this._cancelCall(),this._response&&this._response.pattern==this._prompt._value||(this._cursor=-1,this._call=window.term_apiRequest("history.search",{pattern:this._prompt._value,before:ot,after:0,cursor:this._cursor}),this._call.then(e=>{if(!e)return;this._response=e,this._lines=e.lines,this._total=e.total,this._found=e.found;let t=e.lines[e.lines.length-1];t&&(this._cursor=t.num),this.render()}))}_cancelCall(){this._call&&this._call.cancel(),this._call=null}prev(e){if(this._cancelCall(),e){let e=this._cursor,t=this._lines.findIndex((function(t){return t.num==e}));t>0?(this._cursor=this._lines[t-1].num,this._prompt._render()):(this._call=window.term_apiRequest("history.search",{pattern:this._prompt._value,before:1,after:0,cursor:this._cursor}),this._call.then(e=>{if(!e)return;let t=e.lines[0];t?(this._lines.splice(-1,1),this._lines.splice(0,0,t),this._cursor=t.num,this.render()):this._prompt._term.ringBell()}))}else this._call=window.term_apiRequest("history.search",{pattern:this._lastValue,before:1,after:0,cursor:this._cursor}),this._call.then(e=>{if(!e)return;let t=e.lines[0];t?(this._cursor=t.num,this._prompt._value=t.val,this._prompt._cursor=L.wc.strWidth(t.val),this._prompt._render()):this._prompt._term.ringBell()})}next(e){if(e){let e=this._cursor,t=this._lines.findIndex((function(t){return t.num==e}));t{if(!e)return;let t=e.lines[1];t?(this._lines.splice(0,1),this._lines.push(t),this._cursor=t.num,this.render()):this._prompt._term.ringBell()}))}else{if(this._cancelCall(),-1==this._cursor)return this._prompt._term.ringBell(),void(this._prompt._history=null);this._call=window.term_apiRequest("history.search",{pattern:this._lastValue,before:0,after:2,cursor:this._cursor}),this._call.then(e=>{if(!e)return;let t=e.lines[1];if(!t)return this._prompt._value=this._lastValue,this._prompt._cursor=L.wc.strWidth(this._lastValue),this._prompt._term.ringBell(),void(this._prompt._history=null);this._cursor=t.num,this._prompt._value=t.val,this._prompt._cursor=L.wc.strWidth(t.val),this._prompt._render()})}}reset(){this._cancelCall()}render(){let e=this._prompt._term,t=e.screen_.columnCount_;e.setCursorVisible(!1),e.setCursorPosition(this._prompt._startRow,this._prompt._startCol),e.eraseBelow();let r=L.wc.strWidth(this._prompt._value),o="📖 👀";r>0&&(o="📖 🔍",0==this._lines.length&&(o+=" 🤷")),o=(""+this._found).padStart(6," ")+" of "+this._total+" "+o;e.print(o,!1);let n=r+L.wc.strWidth("> "),i=n/t|0,s=n%t,a=Math.min(ot,this._lines.length),l=a+this._prompt._startRow+i+2-e.screenSize.height;l>0&&(e.appendRows_(l),this._prompt._startRow-=l,e.setCursorPosition(this._prompt._startRow,this._prompt._startCol));for(var c=0;c ",!1),e.print(this._prompt._value,!1),i=(n=this._prompt._cursor+L.wc.strWidth("> "))/t|0,s=n%t,e.setCursorPosition(this._prompt._startRow+i+a+1,s),e.setCursorVisible(!0)}}class it{constructor(e){this._cursor=-1,this._lastValue="",this._call=null,this._response=null,this._n=0,this._lastCursor=-1,this._checkValue=null,this._checkCursor=-1,this._prompt=e,this._lastValue=e._value}complete(e){this._cancelCall();let t=this._prompt._cursor,r=this._prompt._value||"";if(!r.trim()){this._prompt._value="",this._prompt._cursor=L.wc.strWidth(this._prompt._value),this._prompt._hint="",this._prompt._render(),this._prompt._term.interpret("\r\n");let e="line",t={text:"help list-commands"};return void window.webkit.messageHandlers.interOp.postMessage({op:e,data:t})}let o=t,n=r,i=this._n;this._checkCursor==t&&this._checkValue==r?(i+=e,t=this._lastCursor,r=this._lastValue):(i=0,this._lastCursor=t,this._lastValue=r),this._call=window.term_apiRequest("completion.for",{cursor:t,input:r,n:i}),this._call.then(e=>{if(!e)return;if(o!=this._prompt._cursor||n!=this._prompt._value)return;let t=e.result;if(t){let o=r.substr(0,e.pos+e.len);o=r.substr(0,e.pos)+t;let n=L.wc.strWidth(o),s=r.substring(e.pos+e.len);this._prompt._value=[o,s].join(""),this._prompt._cursor=n,this._checkCursor=this._prompt._cursor,this._checkValue=this._prompt._value,this._n=i}else this._checkCursor=-1,this._checkValue=null,this._n=0;if(this._response.hint){let t=r.substr(0,e.start);this._prompt._hintPos=L.wc.strWidth(t),this._prompt._hint=e.hint}else this._prompt._hintPos=0,this._prompt._hint="";this.hint()})}hint(){this._cancelCall();let e=this._prompt._value,t=this._prompt._cursor;this._response&&this._response.input==e||(this._call=window.term_apiRequest("completion.for",{cursor:t,input:this._prompt._value,n:0}),this._call.then(r=>{if(!r)return;if(t!=this._prompt._cursor||e!=this._prompt._value)return;if(this._response=r,this._response.hint){let t=e.substr(0,r.start);this._prompt._hintPos=L.wc.strWidth(t),this._prompt._hint=r.hint}else this._prompt._hintPos=0,this._prompt._hint="";this._prompt._render()}))}_cancelCall(){this._call&&this._call.cancel(),this._call=null}}class st{constructor(e){this._prompt=[""],this._promptLastLine="",this._shell=!1,this._secure=!1,this._cursor=0,this._row=0,this._value="",this._history=null,this._complete=null,this._startCol=0,this._startRow=0,this._historySearchMode=!1,this._hint="",this._hintPos=0,this._onKey=e=>{let t=this._term;switch(e.fullName){case"tab":return void this._completeIfNeeded();case"S-tab":return void this._completeBackIfNeeded();case"M-f":case"M-right":this._forwardWord();break;case"M-b":case"M-left":this._backWord();break;case"C-w":this._deleteBackWord();break;case"M-d":this._deleteForwardWord();break;case"M-u":this._uppercaseForwardWord();break;case"home":case"C-a":this._cursor=0;break;case"end":case"C-e":this._cursor=L.wc.strWidth(this._value);break;case"C-u":this._value=L.wc.substr(this._value,this._cursor),this._cursor=0;break;case"C-l":this._term.reset(),this._resetHistory(),this._startRow=0,this._term.setAutoCarriageReturn(!0);break;case"C-r":this._shell?(this._historySearchMode=!0,this._resetHistory()):t.ringBell();break;case"C-c":this._cursor=0,this._value="";break;case"backspace":if(0==this._cursor)t.ringBell();else{let e=L.wc.substring(this._value,0,this._cursor-1),t=L.wc.substr(this._value,this._cursor);this._value=[e,t].join(""),this._cursor=L.wc.strWidth(e),this._resetHistory()}break;case"C-d":{let e=L.wc.substring(this._value,0,this._cursor),t=L.wc.substr(this._value,this._cursor+1);this._value=[e,t].join("")}break;case"C-b":case"left":this._moveLeft();break;case"C-f":case"right":this._moveRight();break;case"C-k":if(!this._historySearchMode){this._value=L.wc.substring(this._value,0,this._cursor),this._cursor=L.wc.strWidth(this._value),this._resetHistory();break}case"C-p":case"up":return this._moveUp();case"C-n":case"down":return this._moveDown();case"escape":this._historySearchMode=!1;break;case"linefeed":case"C-j":if(this._historySearchMode)return this._moveDown();case"return":case"enter":if(this._historySearchMode)return this._getHistory().enter(),this._historySearchMode=!1,this._resetHistory(),void this._render();this._cursor=L.wc.strWidth(this._value),this._hint="",this._render(),this._term.interpret("\r\n");let r="line",o={text:this._value||""};return void window.webkit.messageHandlers.interOp.postMessage({op:r,data:o});default:if(e.ch){let r=L.wc.strWidth(e.ch),o=L.wc.substring(this._value,0,this._cursor),n=L.wc.substr(this._value,this._cursor);t.accessibilityReader_.assertiveAnnounce(e.ch),this._value=[o,e.ch,n].join(""),this._cursor+=r,this._resetHistory()}}this._searchIfNeeded(),this._hintIfNeeded(),this._render()},this._term=e}_promptRowsAndCols(e,t){if(1==this._prompt.length){let r=e+this._valueStartCol(),o=r/t|0,n=r%t;return n>0&&(o+=1),[o,n]}let r=this._prompt,o=r.length,n=this._startCol+L.wc.strWidth(r[0]),i=n/t|0;n%t>0&&(i+=1);for(var s=1;s0&&(i+=1)}i+=(n=e+L.wc.strWidth(r[o-1]))/t|0;let a=n%t;return a>0&&(i+=1),[i,a]}_valueStartCol(){return this._startCol+L.wc.strWidth(this._promptLastLine)}_searchIfNeeded(){this._shell&&this._historySearchMode&&this._getHistory().search()}_completeIfNeeded(){this._shell&&!this._historySearchMode&&this._getComplete().complete(1)}_completeBackIfNeeded(){this._shell&&!this._historySearchMode&&this._getComplete().complete(-1)}_hintIfNeeded(){this._shell&&!this._historySearchMode?this._getComplete().hint():this._hint=""}_moveLeft(){if(this._cursor<0)return this._cursor=0,void this._term.ringBell();var e,t,r=0;do{r+=1,e=L.wc.substring(this._value,0,this._cursor-r),t=L.wc.strWidth(e)}while(t>=this._cursor&&r<5);this._cursor=t}_moveRight(){let e=L.wc.strWidth(this._value);if(this._cursor>=e)return this._cursor=e,void this._term.ringBell();var t,r,o=0;do{o+=1,t=L.wc.substring(this._value,0,this._cursor+o),r=L.wc.strWidth(t)}while(r<=this._cursor&&o<5);this._cursor=r}_moveUp(){let e=this._term,t=this._term.screen_;if(((this._cursor+this._valueStartCol())/t.columnCount_|0)>0)this._cursor-=t.columnCount_,this._cursor<0&&(this._cursor=0);else{if(this._shell)return this._hint="",this._getHistory().prev(this._historySearchMode);e.ringBell()}this._render()}_moveDown(){let e=this._term,t=this._term.screen_,r=L.wc.strWidth(this._value);if(((this._cursor+this._valueStartCol())/t.columnCount_|0)<(r/t.columnCount_|0))this._cursor+=t.columnCount_,this._cursor>r&&(this._cursor=r);else{if(this._shell)return this._hint="",this._getHistory().next(this._historySearchMode);e.ringBell()}this._render()}_getHistory(){return this._history||(this._history=new nt(this)),this._history}_getComplete(){return this._complete||(this._complete=new it(this)),this._complete}_resetHistory(){this._historySearchMode?this._getHistory().search():this._history&&(this._history.reset(),this._history=null)}_forwardWord(){let e=L.wc.substr(this._value,this._cursor),t=tt.exec(e);t&&(this._cursor+=L.wc.strWidth(t[0]))}_backWord(){let e=L.wc.substring(this._value,0,this._cursor),t=rt.exec(e);t&&(this._cursor-=L.wc.strWidth(t[0]),this._cursor<0&&(this._cursor=0))}_deleteBackWord(){0==this._cursor&&this._term.ringBell();var e=L.wc.substring(this._value,0,this._cursor);let t=L.wc.substr(this._value,this._cursor),r=rt.exec(e);if(!r)return;let o=L.wc.strWidth(r[0]);e=L.wc.substring(this._value,0,this._cursor-o),this._value=[e,t].join(""),this._cursor=Math.max(0,this._cursor-o),this._resetHistory()}_deleteForwardWord(){let e=L.wc.substring(this._value,0,this._cursor);var t=L.wc.substr(this._value,this._cursor);let r=tt.exec(t);if(!r)return;let o=L.wc.strWidth(r[0]);t=L.wc.substr(t,o),this._value=[e,t].join(""),this._resetHistory()}_uppercaseForwardWord(){let e=L.wc.substring(this._value,0,this._cursor);var t=L.wc.substr(this._value,this._cursor);let r=tt.exec(t);if(!r)return;let o=r[0].toUpperCase(),n=L.wc.strWidth(o);t=L.wc.substr(t,n),this._value=[e,o,t].join(""),this._cursor+=n,this._resetHistory()}_render(){if(this._historySearchMode)return void this._getHistory().render();let e=this._term,t=e.screen_.columnCount_;e.setCursorVisible(!1),e.setCursorPosition(this._startRow,this._startCol),e.eraseBelow();let r=this._hintPos+L.wc.strWidth(this._hint),o=L.wc.strWidth(this._value);o=Math.max(r,o),this._secure&&(o=0,r=0);let[n,i]=this._promptRowsAndCols(o,t),s=this._startRow+n-e.screenSize.height;s>0&&(e.appendRows_(s),this._startRow-=s,e.setCursorPosition(this._startRow,this._startCol));for(var a=0;a0?this._moveUp():this._moveDown(),!0)))}promptB64(e){this.reset(),this._term.setAutoCarriageReturn(!0);let t=JSON.parse(window.atob(e));this._prompt=(t.prompt||"").split(/\n/),this._promptLastLine=this._prompt[this._prompt.length-1],this._secure=t.secure,this._shell=t.shell,this._value="",this._hint="",this._hintPos=0,this._cursor=0,this._startCol=0,this._startRow=this._term.getCursorRow(),this._render(),this._term.accessibilityReader_.announce(this._prompt)}reset(){-1!=this._startCol&&(this._history=null,this._complete=null,this._prompt=[""],this._promptLastLine="",this._startCol=-1,this._secure=!1,this._shell=!1,this._hint="",this._hintPos=0,this._historySearchMode=!1)}resize(){this._startCol<0||this._render()}}U.Terminal.prototype.decorate=function(e){this.div_=document.body,this.accessibilityReader_=new U.AccessibilityReader(this.div_),this.scrollPort_.decorate(e),this.scrollPort_.setUserCssUrl(this.prefs_.get("user-css")),this.scrollPort_.setUserCssText(this.prefs_.get("user-css-text")),this.scrollPort_.setAccessibilityReader(this.accessibilityReader_),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;let o=this.onFocusChange_.bind(this,!0);r.addEventListener("focus",o),r.addEventListener("mousedown",function(){setTimeout(o)}.bind(this)),r.addEventListener("blur",this.onFocusChange_.bind(this,!1));var n=this.document_.createElement("style");n.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);}.uri-node:hover { text-decoration: underline; cursor: pointer;}@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(n),this.cursorOverlayNode_=this.document_.createElement("div"),this.cursorOverlayNode_.id="hterm:terminal-overlay-cursor",this.cursorOverlayNode_.style.cssText="position: absolute;left: 0;top: 0;bottom: 0;right: 0;pointer-events: none;",this.document_.body.appendChild(this.cursorOverlayNode_),this.cursorNode_=this.document_.createElement("div"),this.cursorNode_.id="hterm:terminal-cursor",this.cursorNode_.className="cursor-node",this.cursorNode_.style.cssText="position: absolute;display: "+(this.options_.cursorVisible?"":"none")+";width: var(--hterm-charsize-width);height: var(--hterm-charsize-height);background-color: var(--hterm-cursor-color);border-color: var(--hterm-cursor-color); isolatation: isolate; transform: translate3d(calc(var(--hterm-charsize-width) * var(--hterm-cursor-offset-col)), calc(var(--hterm-charsize-height) * var(--hterm-cursor-offset-row)), 0);-webkit-transition: opacity, background-color 100ms linear;-moz-transition: opacity, background-color 100ms linear;",this.setCursorColor(),this.setCursorBlink(!!this.prefs_.get("cursor-blink")),this.restyleCursor_(),this.cursorOverlayNode_.appendChild(this.cursorNode_),this.ime_=this.document_.createElement("ime"),this.cursorOverlayNode_.appendChild(this.ime_),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(e=>{this.scrollBlockerNode_.addEventListener(e,t),this.cursorNode_.addEventListener(e,t),this.document_.addEventListener(e,t)}),this.cursorNode_.addEventListener("mousedown",()=>{setTimeout(this.focus.bind(this))}),this.setReverseVideo(!1),this.scrollPort_.focus(),this.scrollPort_.scheduleRedraw(),this.prompt=new st(this)},U.Terminal.prototype.syncCursorPosition_=function(){var e=this.scrollPort_.getTopRowIndex(),t=this.scrollPort_.getBottomRowIndex(e),r=this.scrollbackRows_.length+this.screen_.cursorPosition.row;let o=!1;if(this.accessibilityReader_.accessibilityEnabled){const e=this.screen_.cursorPosition.column;const t=We(this.getRowNode(this.screen_.cursorPosition.row));o=this.accessibilityReader_.hasUserGesture,this.accessibilityReader_.afterCursorChange(t,r,e)}if(r>t)this.setCssCursorPos({row:-1,col:-1});else{this.options_.cursorVisible&&"none"==this.cursorNode_.style.display&&(this.cursorNode_.style.display=""),this.setCssCursorPos({row:r-e+this.scrollPort_.visibleRowTopMargin,col:this.screen_.cursorPosition.column});var n=this.document_.getSelection();n&&(n.isCollapsed||o)&&this.screen_.syncSelectionCaret(n)}};var at={row:-1,col:-1};U.Terminal.prototype.setCssCursorPos=function(e){at.row===e.row&&at.col===e.col||-1===at.row&&-1===e.row||(at.row!==e.row&&this.setCursorCssVar("cursor-offset-row",e.row+""),at.col!==e.col&&this.setCursorCssVar("cursor-offset-col",e.col+""),this.blinkCursorPos=e,at=e)},U.Terminal.prototype.setCursorCssVar=function(e,t,r="--hterm-"){this.cursorOverlayNode_.style.setProperty(`${r}${e}`,t)},U.Terminal.prototype.scheduleSyncCursorPosition_=function(){if(!this.timeouts_.syncCursor){var e=this;this.timeouts_.syncCursor=setTimeout((function(){requestAnimationFrame((function(){e.syncCursorPosition_(),e.timeouts_.syncCursor=0}))}),0)}},U.Terminal.prototype.scheduleRedraw_=function(){if(!this.timeouts_.redraw){var e=this;this.timeouts_.redraw=setTimeout((function(){e.timeouts_.redraw=0,e.scrollPort_.redraw_()}),0)}},U.Terminal.prototype.scheduleScrollDown_=function(){if(!this.timeouts_.scrollDown){var e=this;this.timeouts_.scrollDown=setTimeout((function(){e.timeouts_.scrollDown=0,e.scrollPort_.scrollToBottom()}),20)}},U.Terminal.prototype.renumberRows_=function(e,t,r){for(var o=r||this.screen_,n=this.scrollbackRows_.length,i=o.rowsArray,s=e;s6e3&&(this.scrollbackRows_.splice(0,2e3),t=!0);for(var r=this.screen_.rowsArray.length,o=this.scrollbackRows_.length+r,n=0;n0){var a=this.screen_.shiftRows(s);Array.prototype.push.apply(this.scrollbackRows_,a),this.scrollPort_.isScrolledEnd&&this.scheduleScrollDown_()}t&&(this.scrollPort_.syncScrollHeight(),this.scheduleScrollDown_()),r>=this.screen_.rowsArray.length&&(r=this.screen_.rowsArray.length-1),this.setAbsoluteCursorPosition(r,0)},U.Terminal.prototype.moveRows_=function(e,t,r){var o,n,i=this.screen_.removeRows(e,t);this.screen_.insertRows(r,i),e=0;n--)this.setAbsoluteCursorPosition(t+n,0),this.screen_.clearCursorRow(),this.scrollPort_.renderRef.touchRow(this.screen_.cursorRow())},U.Terminal.prototype.deleteLines=function(e){var t=this.saveCursor(),r=t.row,o=this.getVTScrollBottom(),n=o-r+1,i=o-(e=Math.min(e,n))+1;e!=n&&this.moveRows_(r,e,i);for(var s=0;s=this.screenSize.width&&(s=!0,i=this.screenSize.width-this.screen_.cursorPosition.column),s&&!this.options_.wraparound?(n=L.wc.substr(e,r,i-1)+L.wc.substr(e,o-1),i=o):n=L.wc.substr(e,r,i);for(var a=this.screen_.textAttributes,l=U.TextAttributes.splitWidecharString(n),c=l.length,u=0;u{};const r=this.document_.createElement("img");r.src=e.uri,r.title=r.alt=e.name,this.document_.body.appendChild(r),r.onload=()=>{const o=(e,t,r)=>{if(!e||"auto"==e)return"";const o=e.match(/^([0-9]+)(px|%)?$/);return o?"%"==o[2]?t*parseInt(o[1])/100+"px":"px"==o[2]?e:`calc(${e} * var(${r}))`:""};r.style.width=o(e.width,this.document_.body.clientWidth,"--hterm-charsize-width"),r.style.height=o(e.height,this.document_.body.clientHeight,"--hterm-charsize-height");var n=Math.ceil(r.clientHeight/this.scrollPort_.characterSize.height);const i=Math.round(2*this.scrollPort_.visibleRowCount)/3;n>i&&(n=i);for(let e=0;e{this.document_.body.removeChild(r),t.showOverlay(U.msg("LOADING_RESOURCE_FAILED",[e.name],"Loading $1 failed ...")),t.pop()}}},U.Terminal.prototype.getRowsText=function(e,t){for(var r=[],o=e;o0){if(t<=this.scrollbackRows_.length){var i=Math.min(t,this.scrollbackRows_.length),s=this.scrollbackRows_.splice(this.scrollbackRows_.length-i,i);this.screen_.unshiftRows(s),t-=i,r.row+=i}t&&this.appendRows_(t)}this.setVTScrollRegion(null,null),this.restoreCursor(r)},U.Terminal.prototype.onMouse_Blink=function(e){if(!e.processedByTerminalHandler_){e.button>2&&e.preventDefault();var t=!this.defeatMouseReports_&&this.vt.mouseReport!=this.vt.MOUSE_REPORT_DISABLED;if(e.processedByTerminalHandler_=!0,this.mouseHideWhileTyping_&&!this.mouseHideDelay_&&(this.syncMouseStyle(),this.mouseHideDelay_=setTimeout(()=>this.mouseHideDelay_=null,1e3)),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&&(this.contextMenu.hide(e),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.screen_.expandSelection(this.document_.getSelection()),this.copyOnSelect&&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&&(e.ctrlKey&&2==e.button?(e.preventDefault(),this.contextMenu.show(e,this)):(e.button==this.mousePasteButton||this.mouseRightClickPaste&&2==e.button)&&(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){const t=this.scrollPort_.scrollWheelDelta(e),r=(e,t,r,o)=>{if(0==e)return"";const n=L.f.smartFloorDivide(Math.abs(e),t);return("O"+(e<0?o:r)).repeat(n)};this.io.sendString(r(-t.y,this.scrollPort_.characterSize.height,"A","B")+r(t.x,this.scrollPort_.characterSize.width,"C","D")),e.preventDefault()}}"mouseup"==e.type&&this.document_.getSelection().isCollapsed&&(this.defeatMouseReports_=!1)}}},window.hterm=U,window.lib=L,window.KeystrokeVisualizer=$,window.installKB=function(e,t){const r=new B(e,t);t||document.body.append(r.element),r.focus(!0),window._onKB=r.onKB,window._kb=r}}]); \ No newline at end of file