vare,t;(function(){vare;e=classextendsthis.OS.GUI.BaseApplication{constructor(e){super("wTerm",e)}main(){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.term.onKey(e=>{if(this.socket)returnthis.socket.send("i"+e.key)}),this.socket=void0,this.on("focus",()=>this.term.focus()),this.mterm.contextmenuHandle=(e,t)=>(t.set("items",[{text:"__(Copy)",id:"copy"},{text:"__(Paste)",id:"paste"}]),t.set("onmenuselect",e=>{if(e)returnthis.mctxHandle(e.data.item.get("data"))}),t.show(e)),this.resizeContent(),this.openSession(),this.systemsetting.desktop.menu[this.name]||(this.systemsetting.desktop.menu[this.name]={text:"__(Open terminal)",app:"wTerm"}),this.on("hboxchange",e=>this.resizeContent())}mctxHandle(e){vart;switch(e.id){case"paste":returnthis._api.getClipboard().then(e=>{vart,r,i,n;if(e&&""!==e){for(i=[],t=0,r=e.length;t<r;t++)n=e[t],i.push(this.socket.send("i"+n));returni}}).catch(e=>this.error(__("Unable to paste"),e));case"copy":if(!(t=this.term.getSelection())||""===t)return;returnthis._api.setClipboard(t)}}resizeContent(){vare,t;if(this.fitAddon.fit(),e=this.term.cols,t=this.term.rows,this.socket)returnthis.socket.send(`s${e}:${t}`)}openSession(){returnthis.term.clear(),this.term.focus(),console.log(this.setting.uri),this.setting.uri?(this.socket=newWebSocket(this.setting.uri),this.socket.onopen=()=>(this.resizeContent($(this.mterm).width(),$(this.mterm).height()),this.term.focus()),this.socket.onerror=e=>(this.error(__("Unable to connect to: {0}",this.setting.uri),e),this.socket=void0),this.socket.onmessage=e=>{if(this.term&&e.data)returnthis.term.write(e.data)},this.socket.onclose=()=>(this.socket=void0,this.notify(__("Terminal connection closed")))):this.configure()}cleanup(e){if(this.socket)returnthis.socket.close()}menu(){return{text:"__(Edit)",child:[{text:"__(Terminal URI)",dataid:this.name+"-termuri"}],onchildselect:e=>this.configure()}}configure(){returnthis.socket&&this.socket.close(),this.openDialog("PromptDialog",{title:"__(Please enter terminal URI)",label:"__(URI)",value:this.setting.uri||"wss://lxsang.me/wterm"}).then(e=>{if(e&&""!==e)returnthis.setting.uri=e,this.openSession()})}},this.OS.register("wTerm",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.getComputedStyle(this._terminal.element.parentElement),r=parseInt(t.getPropertyValue("height")),i=Math.max(0,parseInt(t.getPropertyValue("width"))),n=window.getComputedStyl