!function(t){function e(e){for(var r,u,a=e[0],l=e[1],c=e[2],d=0,s=[];d<a.length;d++)u=a[d],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(t[r]=l[r]);for(f&&f(e);s.length;)s.shift()();return i.push.apply(i,c||[]),n()}function n(){for(var t,e=0;e<i.length;e++){for(var n=i[e],r=!0,a=1;a<n.length;a++){var l=n[a];0!==o[l]&&(r=!1)}r&&(i.splice(e--,1),t=u(u.s=n[0]))}return t}var r={},o={16:0},i=[];function u(e){if(r[e])return r[e].exports;var n=r[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=t,u.c=r,u.d=function(t,e,n){u.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},u.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},u.t=function(t,e){if(1&e&&(t=u(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)u.d(n,r,function(e){return t[e]}.bind(null,r));return n},u.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return u.d(e,"a",e),e},u.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},u.p="/dist/";var a=window.webpackJsonp=window.webpackJsonp||[],l=a.push.bind(a);a.push=e,a=a.slice();for(var c=0;c<a.length;c++)e(a[c]);var f=l;i.push([115,0]),n()}({115:function(t,e,n){"use strict";function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=t[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==a.return||a.return()}finally{if(o)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function o(t,e,n,r,o,i,u){try{var a=t[i](u),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(r,o)}function i(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var u=t.apply(e,n);function a(t){o(u,r,i,a,l,"next",t)}function l(t){o(u,r,i,a,l,"throw",t)}a(void 0)})}}var u=n(4).promisify,a=n(6),l=n(8);n(176);var c,f,d,s=n(2),p=n(5),y=n(11),h=n(1),v=u(p.parallel),m=y.Dialog,C=CloudCmd,g=C.Key,w=C.config;CloudCmd.TerminalRun=e;var b=l(),P=function(){var t=i(function*(){var t=CloudCmd.prefix,e=CloudCmd.prefix+"/gritty",n="".concat(e,"/gritty.js"),o="".concat(t,"/dist/terminal.css"),i=r(yield a(v,[n,o]),1)[0];if(i){var u=i.target.src.replace(window.location.href,"");return m.alert("file ".concat(u," could not be loaded"))}c=!0});return function(){return t.apply(this,arguments)}}();function x(){CloudCmd.View.hide()}function S(t){var e=t.cwd,n=void 0===e?y.getCurrentDirPath():e,r=t.command,o=t.autoClose,i=t.closeMessage,u=void 0===i?"Press any key to close Terminal...":i,a={cwd:n,env:{ACTIVE_DIR:y.getCurrentDirPath,PASSIVE_DIR:y.getNotCurrentDirPath,CURRENT_NAME:y.getCurrentName,CURRENT_PATH:y.getCurrentPath},prefix:CloudCmd.prefixSocket+"/gritty",socketPath:CloudCmd.prefix,fontFamily:"Droid Sans Mono",command:r,autoRestart:!1},l=!1,c=gritty(document.body,a),p=c.socket,h=c.terminal;d=p,(f=h).on("key",function(t,e){var n=e.keyCode,r=e.shiftKey;l&&x(),r&&n===g.ESC&&x()}),d.on("exit",function(t){if(b(t),o)return x();h.write("\n".concat(u)),l=!0}),d.on("connect",s.with(j,p))}function j(t){t.emit("auth",w("username"),w("password")),t.on("reject",function(){m.alert("Wrong credentials!")})}t.exports.init=i(function*(){w("terminal")&&(h.show.load("top"),yield CloudCmd.View(),yield P())}),t.exports.show=u(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;c&&w("terminal")&&(S(t),CloudCmd.View.show(f.element,{afterShow:function(){f.focus()},afterClose:function(){e(null,b())}}))}),t.exports.hide=x}});
//# sourceMappingURL=terminal-run.js.map