vare,t;(function(){vare;e=classextendsthis.OS.application.BaseApplication{constructor(e){super("vTerm",e)}main(){vare;returnthis.mterm=this.find("myterm"),this.term=newTerminal({cursorBlink:!0}),this.fitAddon=newFitAddon.FitAddon,this.term.loadAddon(this.fitAddon),this.term.setOption("fontSize","12"),this.term.open(this.mterm),this.sub=void0,this.term.onKey(e=>{if(this.sub)returnthis.sub.send(Antunnel.Msg.DATA,newTextEncoder("utf-8").encode(e.key))}),this.on("focus",()=>this.term.focus()),this.mterm.contextmenuHandle=(e,t)=>(t.items=[{text:"__(Copy)",id:"copy"},{text:"__(Paste)",id:"paste"}],t.onmenuselect=e=>{if(e)returnthis.mctxHandle(e.data.item.data)},t.show(e)),this.resizeContent(),this.systemsetting.desktop.menu[this.name]||(this.systemsetting.desktop.menu[this.name]={text:"__(Open terminal)",app:"vTerm"}),this.on("hboxchange",e=>this.resizeContent()),e=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):(this.error(__("The Antunnel service is not started, please start it first")),this._gui.pushService("Antunnel/AntunnelService").catch(e=>this.error(e.toString(),e)),this.quit()),window.Antunnel?e():(console.log("require Antunnel"),this._api.requires("pkg://Antunnel/main.js").then(()=>e()).catch(e=>(this.error(__("Unable to load Antunnel: {0}",e.toString()),e),this.quit())))}mctxHandle(e){vart;switch(e.id){case"paste":returnthis._api.getClipboard().then(e=>{if(e&&""!==e)returnthis.sub?this.sub.send(Antunnel.Msg.DATA,newTextEncoder("utf-8").encode(e)):void0}).catch(e=>this.error(__("Unable to paste"),e));case"copy":if(!(t=this.term.getSelection())||""===t)return;returnthis._api.setClipboard(t)}}resizeContent(){vare,t,r;if(this.fitAddon.fit(),t=this.term.cols,r=this.term.rows,this.sub)return(e=newUint8Array(8)).set(Antunnel.Msg.bytes_of(t),0),e.set(Antunnel.Msg.bytes_of(r),4),this.sub.send(Antunnel.Msg.CTRL,e)}openSession(){returnthis.term.clear(),this.term.focus(),this.sub=newAntunnel.Subscriber("vterm"),this.sub.onopen=()=>(console.log("Subscribed"),this.resizeContent($(this.mterm).width(),$(this.mterm).height()),this.term.focus()),this.sub.onerror=e=>(this.error(__("Unable to connect to: vterm"),e),this.sub=void0),this.sub.onmessage=e=>{if(this.term&&e.data)returnthis.term.write(newTextDecoder("utf-8").decode(e.data))},this.sub.onclose=()=>(this.sub=void0,this.notify(__("Terminal connection closed")),this.quit()),this.tunnel.subscribe(this.sub)}cleanup(e){if(this.sub)returnthis.sub.close()}},this.OS.register("vTerm",e)}).call(this),e=window,t=function(){returnfunction(e){vart={};functionr(i){if(t[i])returnt[i].exports;varn=t[i]={i:i,l:!1,exports:{}};returne[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}returnr.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeofSymbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)returne;if(4&t&&"object"==typeofe&&e&&e.__esModule)returne;vari=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeofe)for(varnine)r.d(i,n,function(t){returne[t]}.bind(null,n));returni},r.n=function(e){vart=e&&e.__esModule?function(){returne.default}:function(){returne};returnr.d(t,"a",t),t},r.o=function(e,t){returnObject.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void0;vari=function(){functione(){}returne.prototype.activate=function(e){this._terminal=e},e.prototype.dispose=function(){},e.prototype.fit=function(){vare=this.proposeDimensions();if(e&&this._terminal){vart=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}},e.prototype.proposeDimensions=function(){if(this._terminal&&this._terminal.element&&this._terminal.element.parentElement){vare=this._terminal._core,t=window.getComputedSt