!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AttachAddon=e():t.AttachAddon=e()}(self,(function(){return(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.AttachAddon=void 0;var s=function(){function t(t,e){this._disposables=[],this._socket=t,this._socket.binaryType="arraybuffer",this._bidirectional=!(e&&!1===e.bidirectional)}return t.prototype.activate=function(t){var e=this;this._disposables.push(o(this._socket,"message",(function(e){var s=e.data;t.write("string"==typeof s?s:new Uint8Array(s))}))),this._bidirectional&&(this._disposables.push(t.onData((function(t){return e._sendData(t)}))),this._disposables.push(t.onBinary((function(t){return e._sendBinary(t)})))),this._disposables.push(o(this._socket,"close",(function(){return e.dispose()}))),this._disposables.push(o(this._socket,"error",(function(){return e.dispose()})))},t.prototype.dispose=function(){for(var t=0,e=this._disposables;t<e.length;t++)e[t].dispose()},t.prototype._sendData=function(t){1===this._socket.readyState&&this._socket.send(t)},t.prototype._sendBinary=function(t){if(1===this._socket.readyState){for(var e=new Uint8Array(t.length),s=0;s<t.length;++s)e[s]=255&t.charCodeAt(s);this._socket.send(e)}},t}();function o(t,e,s){return t.addEventListener(e,s),{dispose:function(){s&&t.removeEventListener(e,s)}}}e.AttachAddon=s})(),t})()}));
//# sourceMappingURL=xterm-addon-attach.js.map