@zigbang/honeyfarm-node
Version:
## Raspberry Pi HoneyFarm Node ### Setup && Run
23 lines (21 loc) • 658 kB
JavaScript
!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.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"!=typeof Symbol&&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)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=71)}([function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return n})),r.d(t,"__assign",(function(){return o})),r.d(t,"__rest",(function(){return s})),r.d(t,"__decorate",(function(){return a})),r.d(t,"__param",(function(){return c})),r.d(t,"__metadata",(function(){return l})),r.d(t,"__awaiter",(function(){return u})),r.d(t,"__generator",(function(){return h})),r.d(t,"__createBinding",(function(){return d})),r.d(t,"__exportStar",(function(){return f})),r.d(t,"__values",(function(){return p})),r.d(t,"__read",(function(){return _})),r.d(t,"__spread",(function(){return v})),r.d(t,"__spreadArrays",(function(){return m})),r.d(t,"__await",(function(){return y})),r.d(t,"__asyncGenerator",(function(){return g})),r.d(t,"__asyncDelegator",(function(){return S})),r.d(t,"__asyncValues",(function(){return E})),r.d(t,"__makeTemplateObject",(function(){return b})),r.d(t,"__importStar",(function(){return C})),r.d(t,"__importDefault",(function(){return w})),r.d(t,"__classPrivateFieldGet",(function(){return T})),r.d(t,"__classPrivateFieldSet",(function(){return A}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function n(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var o=function(){return(o=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function s(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}function a(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,i){return new(r||(r=Promise))((function(n,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function h(e,t){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function d(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function f(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(_(arguments[t]));return e}function m(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var i=Array(e),n=0;for(t=0;t<r;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,n++)i[n]=o[s];return i}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function g(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){n[e]&&(i[e]=function(t){return new Promise((function(r,i){o.push([e,t,r,i])>1||a(e,t)}))})}function a(e,t){try{(r=n[e](t)).value instanceof y?Promise.resolve(r.value.v).then(c,l):u(o[0][2],r)}catch(e){u(o[0][3],e)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function S(e){var t,r;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:y(e[i](t)),done:"return"===i}:n?n(t):t}:n}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}function b(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function C(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function w(e){return e&&e.__esModule?e:{default:e}}function T(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function A(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.filterTrailingZeroes=function(e){var t=0;return e.reverse().filter((function(e){return t||(t=e)})).reverse()},e.prettyBytes=function(t){for(var r=0;t>=512;)r++,t/=1024;return""+t.toFixed(r?1:0)+e.SUFFIX[r]},e.escapeUdid=function(e){return"udid_"+e.replace(/[. :]/g,"_")},e.parseBooleanEnv=function(e){return"boolean"==typeof e?e:void 0!==e?(Array.isArray(e)&&(e=e[e.length-1]),"1"===e||"true"===e.toLowerCase()):void 0},e.parseStringEnv=function(e){return void 0===e?"":(Array.isArray(e)&&(e=e[e.length-1]),e)},e.parseIntEnv=function(e){if("number"==typeof e)return e;if(void 0!==e){Array.isArray(e)&&(e=e[e.length-1]);var t=parseInt(e,10);if(!isNaN(t))return t}},e.utf8ByteArrayToString=function(e){for(var t=[],r=0,i=0;r<e.length;){var n=e[r++];if(n<128)t[i++]=String.fromCharCode(n);else if(n>191&&n<224){var o=e[r++];t[i++]=String.fromCharCode((31&n)<<6|63&o)}else if(n>239&&n<365){var s=((7&n)<<18|(63&(o=e[r++]))<<12|(63&(a=e[r++]))<<6|63&e[r++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{o=e[r++];var a=e[r++];t[i++]=String.fromCharCode((15&n)<<12|(63&o)<<6|63&a)}}return t.join("")},e.supportsPassive=function(){if("boolean"==typeof e.supportsPassiveValue)return e.supportsPassiveValue;var t=!1;try{var r=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,r),window.removeEventListener("testPassive",null,r)}catch(e){}return e.supportsPassiveValue=t},e.SUFFIX={0:"B",1:"KiB",2:"MiB",3:"GiB",4:"TiB"},e.stringToUtf8ByteArray=function(e){for(var t=[],r=0,i=0;i<e.length;i++){var n=e.charCodeAt(i);n<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(n=65536+((1023&n)<<10)+(1023&e.charCodeAt(++i)),t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128)}return Uint8Array.from(t)},e}();t.default=i},function(e,t,r){"use strict";(function(e){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var i=r(78),n=r(79),o=r(80);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,r){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return l(this,e,t,r)}function l(e,t,r,i){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,i){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===i?new Uint8Array(t):void 0===i?new Uint8Array(t,r):new Uint8Array(t,r,i);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=d(e,t);return e}(e,t,r,i):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!c.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|p(t,r),n=(e=a(e,i)).write(t,r);n!==i&&(e=e.slice(0,n));return e}(e,t,r):function(e,t){if(c.isBuffer(t)){var r=0|f(t.length);return 0===(e=a(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?a(e,0):d(e,t);if("Buffer"===t.type&&o(t.data))return d(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(u(t),e=a(e,t<0?0:0|f(t)),!c.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function d(e,t){var r=t.length<0?0:0|f(t.length);e=a(e,r);for(var i=0;i<r;i+=1)e[i]=255&t[i];return e}function f(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(i)return H(e).length;t=(""+t).toLowerCase(),i=!0}}function _(e,t,r){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return L(this,t,r);case"utf8":case"utf-8":return A(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return D(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function v(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function m(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=c.from(t,i)),c.isBuffer(t))return 0===t.length?-1:y(e,t,r,i,n);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,i,n){var o,s=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(n){var u=-1;for(o=r;o<a;o++)if(l(e,o)===l(t,-1===u?0:o-u)){if(-1===u&&(u=o),o-u+1===c)return u*s}else-1!==u&&(o-=o-u),u=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var h=!0,d=0;d<c;d++)if(l(e,o+d)!==l(t,d)){h=!1;break}if(h)return o}return-1}function g(e,t,r,i){r=Number(r)||0;var n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function S(e,t,r,i){return Y(H(t,e.length-r),e,r,i)}function E(e,t,r,i){return Y(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function b(e,t,r,i){return E(e,t,r,i)}function C(e,t,r,i){return Y(K(t),e,r,i)}function w(e,t,r,i){return Y(function(e,t){for(var r,i,n,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}(t,e.length-r),e,r,i)}function T(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function A(e,t,r){r=Math.min(e.length,r);for(var i=[],n=t;n<r;){var o,s,a,c,l=e[n],u=null,h=l>239?4:l>223?3:l>191?2:1;if(n+h<=r)switch(h){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[n+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[n+1],s=e[n+2],128==(192&o)&&128==(192&s)&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[n+1],s=e[n+2],a=e[n+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),n+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=4096));return r}(i)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=s(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,r){return l(null,e,t,r)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,r){return function(e,t,r,i){return u(t),t<=0?a(e,t):void 0!==r?"string"==typeof i?a(e,t).fill(r,i):a(e,t).fill(r):a(e,t)}(null,e,t,r)},c.allocUnsafe=function(e){return h(null,e)},c.allocUnsafeSlow=function(e){return h(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!o(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var i=c.allocUnsafe(t),n=0;for(r=0;r<e.length;++r){var s=e[r];if(!c.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,n),n+=s.length}return i},c.byteLength=p,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)v(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?A(this,0,e):_.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,r,i,n){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(i,n),u=e.slice(t,r),h=0;h<a;++h)if(l[h]!==u[h]){o=l[h],s=u[h];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},c.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return S(this,e,t,r);case"ascii":return E(this,e,t,r);case"latin1":case"binary":return b(this,e,t,r);case"base64":return C(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function D(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function L(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var n="",o=t;o<r;++o)n+=U(e[o]);return n}function R(e,t,r){for(var i=e.slice(t,r),n="",o=0;o<i.length;o+=2)n+=String.fromCharCode(i[o]+256*i[o+1]);return n}function I(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,i,n,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function M(e,t,r,i){t<0&&(t=65535+t+1);for(var n=0,o=Math.min(e.length-r,2);n<o;++n)e[r+n]=(t&255<<8*(i?n:1-n))>>>8*(i?n:1-n)}function x(e,t,r,i){t<0&&(t=4294967295+t+1);for(var n=0,o=Math.min(e.length-r,4);n<o;++n)e[r+n]=t>>>8*(i?n:3-n)&255}function k(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(e,t,r,i,o){return o||k(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function N(e,t,r,i,o){return o||k(e,0,r,8),n.write(e,t,r,i,52,8),r+8}c.prototype.slice=function(e,t){var r,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(t=void 0===t?i:~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=c.prototype;else{var n=t-e;r=new c(n,void 0);for(var o=0;o<n;++o)r[o]=this[o+e]}return r},c.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i},c.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var i=this[e+--t],n=1;t>0&&(n*=256);)i+=this[e+--t]*n;return i},c.prototype.readUInt8=function(e,t){return t||I(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||I(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||I(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var i=this[e],n=1,o=0;++o<t&&(n*=256);)i+=this[e+o]*n;return i>=(n*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||I(e,t,this.length);for(var i=t,n=1,o=this[e+--i];i>0&&(n*=256);)o+=this[e+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||I(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||I(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||I(e,4,this.length),n.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||I(e,4,this.length),n.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||I(e,8,this.length),n.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||I(e,8,this.length),n.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[t]=255&e;++o<r&&(n*=256);)this[t+o]=e/n&255;return t+r},c.prototype.writeUIntBE=function(e,t,r,i){(e=+e,t|=0,r|=0,i)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[t+n]=255&e;--n>=0&&(o*=256);)this[t+n]=e/o&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):x(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):x(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t|=0,!i){var n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):x(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):x(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return B(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return B(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,i){if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var n,o=i-r;if(this===e&&r<t&&t<i)for(n=o-1;n>=0;--n)e[n+t]=this[n+r];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(n=0;n<o;++n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},c.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===e.length){var n=e.charCodeAt(0);n<256&&(e=n)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!c.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=c.isBuffer(e)?e:H(new c(e,i).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var F=/[^+\/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function H(e,t){var r;t=t||1/0;for(var i=e.length,n=null,o=[],s=0;s<i;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function K(e){return i.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,r,i){for(var n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}}).call(this,r(25))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){this.width=e,this.height=t,this.w=e,this.h=t}return e.equals=function(e,t){return!e&&!t||!!e&&!!t&&e.equals(t)},e.copy=function(t){return t?new e(t.width,t.height):null},e.prototype.length=function(){return this.w*this.h},e.prototype.rotate=function(){return new e(this.height,this.width)},e.prototype.equals=function(e){return this===e||!!e&&(this.width===e.width&&this.height===e.height)},e.prototype.intersect=function(t){if(!t)return this;var r=Math.min(this.height,t.height);return new e(Math.min(this.width,t.width),r)},e.prototype.getHalfSize=function(){return new e(this.width>>>1,this.height>>>1)},e.prototype.toString=function(){return"Size{width="+this.width+", height="+this.height+"}"},e.prototype.toJSON=function(){return{width:this.width,height:this.height}},e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ACTION=void 0,function(e){e.LIST_HOSTS="list-hosts",e.APPL_DEVICE_LIST="appl-device-list",e.GOOG_DEVICE_LIST="goog-device-list",e.MULTIPLEX="multiplex",e.SHELL="shell",e.PROXY_WS="proxy-ws",e.PROXY_ADB="proxy-adb",e.DEVTOOLS="devtools",e.STREAM_SCRCPY="stream",e.STREAM_WS_QVH="stream-qvh",e.PROXY_WDA="proxy-wda",e.FILE_LISTING="list-files"}(t.ACTION||(t.ACTION={}))},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=i.__importDefault(r(10)),o=i.__importDefault(r(3)),s=i.__importDefault(r(1)),a=function(){function t(e,r){void 0===r&&(r=t.BASE_BUFFER_LENGTH),this.bytesLength=r,this.crop=null,this.bitrate=0,this.bounds=null,this.maxFps=0,this.iFrameInterval=0,this.sendFrameMeta=!1,this.lockedVideoOrientation=-1,this.displayId=0,e&&(this.crop=e.crop,this.bitrate=e.bitrate,this.bounds=e.bounds,this.maxFps=e.maxFps,this.iFrameInterval=e.iFrameInterval,this.sendFrameMeta=e.sendFrameMeta||!1,this.lockedVideoOrientation=e.lockedVideoOrientation||-1,"number"==typeof e.displayId&&!isNaN(e.displayId)&&e.displayId>=0&&(this.displayId=e.displayId),e.codecOptions&&(this.codecOptions=e.codecOptions.trim()),e.encoderName&&(this.encoderName=e.encoderName.trim()))}return t.fromBuffer=function(e){var r=0,i=e.readInt32BE(r);r+=4;var a=e.readInt32BE(r);r+=4;var c=e.readInt8(r);r+=1;var l=e.readInt16BE(r);r+=2;var u=e.readInt16BE(r);r+=2;var h=e.readInt16BE(r);r+=2;var d=e.readInt16BE(r);r+=2;var f=e.readInt16BE(r);r+=2;var p=e.readInt16BE(r);r+=2;var _=!!e.readInt8(r);r+=1;var v=e.readInt8(r);r+=1;var m=e.readInt32BE(r);r+=4;var y,g,S=null,E=null;0!==l&&0!==u&&(S=new o.default(l,u)),(h||d||f||p)&&(E=new n.default(h,d,f,p));var b=e.readInt32BE(r);if(r+=4,b){var C=e.slice(r,r+b);r+=b,y=s.default.utf8ByteArrayToString(C)}var w=e.readInt32BE(r);if(r+=4,w){var T=e.slice(r,r+w);r+=w,g=s.default.utf8ByteArrayToString(T)}return new t({crop:E,bitrate:i,bounds:S,maxFps:a,iFrameInterval:c,lockedVideoOrientation:v,displayId:m,sendFrameMeta:_,codecOptions:y,encoderName:g},r)},t.copy=function(e){return new t({bitrate:e.bitrate,crop:n.default.copy(e.crop),bounds:o.default.copy(e.bounds),maxFps:e.maxFps,iFrameInterval:e.iFrameInterval,lockedVideoOrientation:e.lockedVideoOrientation,displayId:e.displayId,sendFrameMeta:e.sendFrameMeta,codecOptions:e.codecOptions,encoderName:e.encoderName},e.bytesLength)},t.prototype.equals=function(e){return!!e&&(this.encoderName===e.encoderName&&this.codecOptions===e.codecOptions&&n.default.equals(this.crop,e.crop)&&this.lockedVideoOrientation===e.lockedVideoOrientation&&this.displayId===e.displayId&&o.default.equals(this.bounds,e.bounds)&&this.bitrate===e.bitrate&&this.maxFps===e.maxFps&&this.iFrameInterval===e.iFrameInterval)},t.prototype.toBuffer=function(){var r,i,n=0;this.codecOptions&&(n+=(r=s.default.stringToUtf8ByteArray(this.codecOptions)).length),this.encoderName&&(n+=(i=s.default.stringToUtf8ByteArray(this.encoderName)).length);var o=new e(t.BASE_BUFFER_LENGTH+n),a=this.bounds||{},c=a.width,l=void 0===c?0:c,u=a.height,h=void 0===u?0:u,d=this.crop||{},f=d.left,p=void 0===f?0:f,_=d.top,v=void 0===_?0:_,m=d.right,y=void 0===m?0:m,g=d.bottom,S=void 0===g?0:g,E=0;return E=o.writeInt32BE(this.bitrate,E),E=o.writeInt32BE(this.maxFps,E),E=o.writeInt8(this.iFrameInterval,E),E=o.writeInt16BE(l,E),E=o.writeInt16BE(h,E),E=o.writeInt16BE(p,E),E=o.writeInt16BE(v,E),E=o.writeInt16BE(y,E),E=o.writeInt16BE(S,E),E=o.writeInt8(this.sendFrameMeta?1:0,E),E=o.writeInt8(this.lockedVideoOrientation,E),E=o.writeInt32BE(this.displayId,E),r?(E=o.writeInt32BE(r.length,E),o.fill(r,E),E+=r.length):E=o.writeInt32BE(0,E),i?(E=o.writeInt32BE(i.length,E),o.fill(i,E),E+=i.length):o.writeInt32BE(0,E),o},t.prototype.toString=function(){return"VideoSettings{bitrate="+this.bitrate+", maxFps="+this.maxFps+", iFrameInterval="+this.iFrameInterval+", bounds="+this.bounds+", crop="+this.crop+", metaFrame="+this.sendFrameMeta+", lockedVideoOrientation="+this.lockedVideoOrientation+", displayId="+this.displayId+", codecOptions="+this.codecOptions+", encoderName="+this.encoderName+"}"},t.prototype.toJSON=function(){return{bitrate:this.bitrate,maxFps:this.maxFps,iFrameInterval:this.iFrameInterval,bounds:this.bounds,crop:this.crop,sendFrameMeta:this.sendFrameMeta,lockedVideoOrientation:this.lockedVideoOrientation,displayId:this.displayId,codecOptions:this.codecOptions,encoderName:this.encoderName}},t.BASE_BUFFER_LENGTH=35,t}();t.default=a}).call(this,r(2).Buffer)},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.ManagerClient=void 0;var i=r(0),n=r(16),o=r(4),s=i.__importDefault(r(1)),a=r(48),c=function(t){function r(e){var r=t.call(this,e)||this;return r.destroyed=!1,r.action=s.default.parseStringEnv(e.action),r.url=r.buildWebSocketUrl(),r}return i.__extends(r,t),r.start=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];throw Error("Not implemented")},r.prototype.hasConnection=function(){return!(!this.ws||this.ws.readyState!==this.ws.OPEN)},r.prototype.openNewConnection=function(){this.ws&&this.ws.readyState===this.ws.OPEN&&(this.ws.close(),delete this.ws);var e=this.url.toString();if(this.supportMultiplexing()){var t=r.sockets.get(e);if(!t){var i=new WebSocket(e);i.addEventListener("close",(function(){r.sockets.delete(e)}));var n=a.Multiplexer.wrap(i);n.on("empty",(function(){n.close()})),r.sockets.set(e,n),t=n}(o=t.createChannel(this.getChannelInitData())).addEventListener("open",this.onSocketOpen.bind(this)),o.addEventListener("message",this.onSocketMessage.bind(this)),o.addEventListener("close",this.onSocketClose.bind(this)),this.ws=o}else{var o;(o=new WebSocket(e)).addEventListener("open",this.onSocketOpen.bind(this)),o.addEventListener("message",this.onSocketMessage.bind(this)),o.addEventListener("close",this.onSocketClose.bind(this)),this.ws=o}return this.ws},r.prototype.destroy=function(){this.destroyed?console.error(new Error("Already disposed")):(this.destroyed=!0,this.ws&&this.ws.readyState===this.ws.OPEN&&this.ws.close())},r.prototype.buildWebSocketUrl=function(){var e=this.buildDirectWebSocketUrl();return this.params.useProxy&&!this.supportMultiplexing()?this.wrapInProxy(e):e},r.prototype.buildDirectWebSocketUrl=function(){var e,t=this.params,r=t.hostname,i=t.port,n=t.secure,s=t.action;"string"==typeof r&&"number"==typeof i?e=(n?"wss:":"ws:")+"//"+r+":"+i:e=""+("https:"===location.protocol?"wss:":"ws:")+location.host;var a=new URL(e);return this.supportMultiplexing()?a.searchParams.set("action",o.ACTION.MULTIPLEX):s&&a.searchParams.set("action",s),a},r.prototype.wrapInProxy=function(e){var t="https:"===location.protocol?"wss:":"ws:",r=new URL(t+"//"+location.host);return r.searchParams.set("action",o.ACTION.PROXY_WS),r.searchParams.set("ws",e.toString()),r},r.prototype.supportMultiplexing=function(){return!1},r.prototype.getChannelInitData=function(){return e.from(r.CODE)},r.ACTION="unknown",r.CODE="NONE",r.sockets=new Map,r}(n.BaseClient);t.ManagerClient=c}).call(this,r(2).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BasePlayer=void 0;var i=r(0),n=i.__importDefault(r(5)),o=i.__importDefault(r(10)),s=i.__importDefault(r(3)),a=i.__importDefault(r(1)),c=r(17),l=r(26),u=function(e){function t(r,i,n,o,s){void 0===n&&(n="BasePlayer"),void 0===o&&(o="Dummy"),void 0===s&&(s=document.createElement("div"));var a=e.call(this)||this;a.udid=r,a.displayInfo=i,a.name=n,a.storageKeyPrefix=o,a.tag=s,a.inputBytes=[],a.bounds=null,a.totalStats={decodedFrames:0,droppedFrames:0,inputFrames:0,inputBytes:0,timestamp:0},a.totalStatsCounter=0,a.dirtyStatsWidth=0,a.state=t.STATE.STOPPED,a.showQualityStats=t.DEFAULT_SHOW_QUALITY_STATS,a.receivedFirstFrame=!1,a.statLines=[],a.supportsScreenshot=!1,a.updateQualityStats=function(){var e=Date.now(),r=e-1e3;a.calculateMomentumStats(),a.momentumQualityStats&&(a.totalStats.timestamp<r&&(a.totalStats={timestamp:e,decodedFrames:a.totalStats.decodedFrames+a.momentumQualityStats.decodedFrames,droppedFrames:a.totalStats.droppedFrames+a.momentumQualityStats.droppedFrames,inputFrames:a.totalStats.inputFrames+a.momentumQualityStats.inputFrames,inputBytes:a.totalStats.inputBytes+a.momentumQualityStats.inputBytes},0!==a.totalStatsCounter&&(a.perSecondQualityStats={avgDecoded:a.totalStats.decodedFrames/a.totalStatsCounter,avgDropped:a.totalStats.droppedFrames/a.totalStatsCounter,avgInput:a.totalStats.inputFrames/a.totalStatsCounter,avgSize:a.totalStats.inputBytes/a.totalStatsCounter}),a.totalStatsCounter++),a.drawStats(),a.state!==t.STATE.STOPPED&&(a.qualityAnimationId=requestAnimationFrame(a.updateQualityStats)))},a.touchableCanvas=document.createElement("canvas"),a.touchableCanvas.className="touch-layer",a.touchableCanvas.oncontextmenu=function(e){e.preventDefault()};var c=a.getPreferredVideoSetting();return a.videoSettings=t.getVideoSettingFromStorage(c,a.storageKeyPrefix,r,i),a}return i.__extends(t,e),t.isIFrame=function(e){return e&&e.length>4&&5==(31&e[4])},t.getStorageKey=function(e,t){var r=window.innerHeight;return e+":"+t+":"+window.innerWidth+"x"+r},t.getFullStorageKey=function(e,t,r){var i=window.innerHeight,n=e+":"+t+":"+window.innerWidth+"x"+i;if(r){var o=r.displayId,s=r.size;n=n+":"+o+":"+s.width+"x"+s.height}return n},t.getFromStorageCompat=function(e,t,r){var i=this.getStorageKey(e,t),n=window.localStorage.getItem(i);if(!r)return n;var o=r.displayId===l.DisplayInfo.DEFAULT_DISPLAY,s=this.getFullStorageKey(e,t,r),a=window.localStorage.getItem(s);return a?(n&&o&&window.localStorage.removeItem(i),a):o?n:null},t.getFitToScreenFromStorage=function(e,t,r){if(!window.localStorage)return!1;var i=!1,n=this.getFullStorageKey(e,t,r)+":fit",o=window.localStorage.getItem(n);if(!o)return!1;try{i=JSON.parse(o)}catch(e){console.error("["+this.name+"]","Failed to parse",o)}return i},t.getVideoSettingFromStorage=function(e,t,r,i){if(!window.localStorage)return e;var a=this.getFromStorageCompat(t,r,i);if(!a)return e;var c=JSON.parse(a),l=c.displayId,u=c.crop,h=c.bitrate,d=c.iFrameInterval,f=c.sendFrameMeta,p=c.lockedVideoOrientation,_=c.codecOptions,v=c.encoderName,m=isNaN(c.maxFps)?c.frameRate:c.maxFps,y=null;return"object"!=typeof c.bounds||isNaN(c.bounds.width)||isNaN(c.bounds.height)?isNaN(c.maxSize)||(y=new s.default(c.maxSize,c.maxSize)):y=new s.default(c.bounds.width,c.bounds.height),new n.default({displayId:"number"==typeof l?l:0,crop:u?new o.default(u.left,u.top,u.right,u.bottom):e.crop,bitrate:isNaN(h)?e.bitrate:h,bounds:null!==y?y:e.bounds,maxFps:isNaN(m)?e.maxFps:m,iFrameInterval:isNaN(d)?e.iFrameInterval:d,sendFrameMeta:"boolean"==typeof f?f:e.sendFrameMeta,lockedVideoOrientation:isNaN(p)?e.lockedVideoOrientation:p,codecOptions:_,encoderName:v})},t.putVideoSettingsToStorage=function(e,t,r,i,n){if(window.localStorage){var o=this.getFullStorageKey(e,t,n);window.localStorage.setItem(o,JSON.stringify(r));var s=o+":fit";window.localStorage.setItem(s,JSON.stringify(i))}},t.prototype.createScreenshot=function(e){var t=document.createElement("a");t.href=this.getImageDataURL(),t.download=e+" "+(new Date).toLocaleString()+".png",t.click()},t.prototype.play=function(){this.needScreenInfoBeforePlay()&&!this.screenInfo||(this.state=t.STATE.PLAYING)},t.prototype.pause=function(){this.state=t.STATE.PAUSED},t.prototype.stop=function(){this.state=t.STATE.STOPPED},t.prototype.getState=function(){return this.state},t.prototype.pushFrame=function(e){this.receivedFirstFrame||(this.receivedFirstFrame=!0,"number"!=typeof this.qualityAnimationId&&(this.qualityAnimationId=requestAnimationFrame(this.updateQualityStats))),this.inputBytes.push({timestamp:Date.now(),bytes:e.byteLength})},t.prototype.getTouchableElement=function(){return this.touchableCanvas},t.prototype.setParent=function(e){this.parentElement=e,e.appendChild(this.tag),e.appendChild(this.touchableCanvas)},t.prototype.needScreenInfoBeforePlay=function(){return!0},t.prototype.getVideoSettings=function(){return this.videoSettings},t.prototype.setVideoSettings=function(e,r,i){this.videoSettings=e,i&&t.putVideoSettingsToStorage(this.storageKeyPrefix,this.udid,e,r,this.displayInfo),this.resetStats(),this.emit("video-settings",n.default.copy(e))},t.prototype.getScreenInfo=function(){return this.screenInfo},t.prototype.setScreenInfo=function(e){this.needScreenInfoBeforePlay()&&this.pause(),this.receivedFirstFrame=!1,this.screenInfo=e;var t=e.videoSize,r=t.width,i=t.height;this.touchableCanvas.width=r,this.touchableCanvas.height=i,this.parentElement&&(this.parentElement.style.height=i+"px",this.parentElement.style.width=r+"px");var n=new s.default(r,i);this.emit("video-view-resize",n)},t.prototype.getName=function(){return this.name},t.prototype.resetStats=function(){this.receivedFirstFrame=!1,this.totalStatsCounter=0,this.totalStats={droppedFrames:0,decodedFrames:0,inputFrames:0,inputBytes:0,timestamp:0},this.perSecondQualityStats={avgDecoded:0,avgDropped:0,avgInput:0,avgSize:0}},t.prototype.drawStats=function(){if(this.showQualityStats&&this.touchableCanvas.getContext("2d")){var e=[];if(this.perSecondQualityStats&&this.momentumQualityStats){var t=this.momentumQualityStats,r=t.decodedFrames,i=t.droppedFrames,n=t.inputBytes,o=t.inputFrames,s=this.perSecondQualityStats,c=s.avgDecoded,l=s.avgDropped,u=s.avgSize,h=s.avgInput,d=o.toString().padStart(3," "),f=r.toString().padStart(3," "),p=i.toString().padStart(3," "),_=c.toFixed(1).padStart(5," "),v=l.toFixed(1).padStart(5," "),m=h.toFixed(1).padStart(5," "),y=a.default.prettyBytes(n).padStart(8," "),g=a.default.prettyBytes(u).padStart(8," ");e.push("Input bytes: "+y+" (avg: "+g+"/s)"),e.push("Input FPS: "+d+" (avg: "+m+")"),e.push("Dropped FPS: "+p+" (avg: "+v+")"),e.push("Decoded FPS: "+f+" (avg: "+_+")")}else e.push("Not supported");for(var S=this.statLines.length!==e.length,E=0;!S&&E++<e.length;)e[E]!==this.statLines[E]&&(S=!0);S&&(this.statLines=e,this.updateCanvas(!1))}},t.prototype.updateCanvas=function(e){var r=this,i=this.touchableCanvas.getContext("2d");if(i){var n=this.touchableCanvas.height,o=t.STATS_HEIGHT,s=this.statLines.length,a=o/2,c=2*a,l=o*s+a*(s+1);i.clearRect(0,n-l,this.dirtyStatsWidth+c,l),this.dirtyStatsWidth=0,e||(i.save(),i.font=o+"px monospace",this.statLines.forEach((function(e){var t=i.measureText(e),n=Math.abs(t.actualBoundingBoxLeft)+Math.abs(t.actualBoundingBoxRight);r.dirtyStatsWidth=Math.max(n,r.dirtyStatsWidth)})),i.fillStyle=t.STAT_BACKGROUND,i.fillRect(0,n-l,this.dirtyStatsWidth+c,l),i.fillStyle=t.STAT_TEXT_COLOR,this.statLines.forEach((function(e,t){i.fillText(e,a,n-a-t*(o+a))})),i.restore())}},t.prototype.setShowQualityStats=function(e){this.showQualityStats=e,e?this.drawStats():this.updateCanvas(!0)},t.prototype.getShowQualityStats=function(){return this.showQualityStats},t.prototype.setBounds=function(e){this.bounds=s.default.copy(e)},t.prototype.getDisplayInfo=function(){return this.displayInfo},t.prototype.setDisplayInfo=function(e){this.displayInfo=e},t.loadVideoSettings=function(e,t){return this.getVideoSettingFromStorage(this.preferredVideoSettings,this.storageKeyPrefix,e,t)},t.getFitToScreenStatus=function(e,t){return this.getFitToScreenFromStorage(this.storageKeyPrefix,e,t)},t.getPreferredVideoSetting=function(){return this.preferredVideoSettings},t.saveVideoSettings=function(e,t,r,i){this.putVideoSettingsToStorage(this.storageKeyPrefix,e,t,r,i)},t.STAT_BACKGROUND="rgba(0, 0, 0, 0.5)",t.STAT_TEXT_COLOR="hsl(24, 85%, 50%)",t.DEFAULT_SHOW_QUALITY_STATS=!1,t.STATE={PLAYING:1,PAUSED:2,STOPPED:3},t.STATS_HEIGHT=12,t.storageKeyPrefix="BaseDecoder",t.playerFullName="BasePlayer",t.playerCodeName="baseplayer",t.preferredVideoSettings=new n.default({lockedVideoOrientation:-1,bitrate:524288,maxFps:24,iFrameInterval:5,bounds:new s.default(480,480),sendFrameMeta:!1}),t}(c.TypedEmitter);t.BasePlayer=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ControlMessage=void 0;var i=function(){function e(e){this.type=e}return e.prototype.toBuffer=function(){throw Error("Not implemented")},e.prototype.toString=function(){return"ControlMessage"},e.prototype.toJSON=function(){return{type:this.type}},e.TYPE_KEYCODE=0,e.TYPE_TEXT=1,e.TYPE_TOUCH=2,e.TYPE_SCROLL=3,e.TYPE_BACK_OR_SCREEN_ON=4,e.TYPE_EXPAND_NOTIFICATION_PANEL=5,e.TYPE_EXPAND_SETTINGS_PANEL=6,e.TYPE_COLLAPSE_PANELS=7,e.TYPE_GET_CLIPBOARD=8,e.TYPE_SET_CLIPBOARD=9,e.TYPE_SET_SCREEN_POWER_MODE=10,e.TYPE_ROTATE_DEVICE=11,e.TYPE_CHANGE_STREAM_PARAMETERS=101,e.TYPE_PUSH_FILE=102,e}();t.ControlMessage=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Icon=void 0;var i,n=r(0),o=n.__importDefault(r(83)),s=n.__importDefault(r(84)),a=n.__importDefault(r(85)),c=n.__importDefault(r(86)),l=n.__importDefault(r(87)),u=n.__importDefault(r(88)),h=n.__importDefault(r(89)),d=n.__importDefault(r(90)),f=n.__importDefault(r(91)),p=n.__importDefault(r(92)),_=n.__importDefault(r(93)),v=n.__importDefault(r(94)),m=n.__importDefault(r(95)),y=n.__importDefault(r(96)),g=n.__importDefault(r(97)),S=n.__importDefault(r(98)),E=n.__importDefault(r(99));!function(e){e[e.BACK=0]="BACK",e[e.HOME=1]="HOME",e[e.OVERVIEW=2]="OVERVIEW",e[e.POWER=3]="POWER",e[e.VOLUME_UP=4]="VOLUME_UP",e[e.VOLUME_DOWN=5]="VOLUME_DOWN",e[e.MORE=6]="MORE",e[e.CAMERA=7]="CAMERA",e[e.KEYBOARD=8]="KEYBOARD",e[e.CANCEL=9]="CANCEL",e[e.OFFLINE=10]="OFFLINE",e[e.REFRESH=11]="REFRESH",e[e.SETTINGS=12]="SETTINGS",e[e.MENU=13]="MENU",e[e.ARROW_BACK=14]="ARROW_BACK",e[e.TOGGLE_ON=15]="TOGGLE_ON",e[e.TOGGLE_OFF=16]="TOGGLE_OFF"}(i=t.Icon||(t.Icon={}));var b=function(){function e(){}return e.getSvgString=function(e){switch(e){case i.KEYBOARD:return o.default;case i.MORE:return s.default;case i.CAMERA:return a.default;case i.POWER:return c.default;case i.VOLUME_DOWN:return l.default;case i.VOLUME_UP:return u.default;case i.BACK:return h.default;case i.HOME:return d.default;case i.OVERVIEW:return f.default;case i.CANCEL:return p.default;case i.OFFLINE:return _.default;case i.REFRESH:return v.default;case i.SETTINGS:return m.default;case i.MENU:return y.default;case i.ARROW_BACK:return g.default;case i.TOGGLE_ON:return S.default;case i.TOGGLE_OFF:return E.default;default:return""}},e.create=function(e){var t=document.createElement("div");t.innerHTML=this.getSvgString(e);for(var r=t.children[0],i=r.getElementsByTagName("title"),n=0,o=i.length;n<o;n++)r.removeChild(i[n]);return r},e.Icon=i,e}();t.default=b},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t,r,i){this.left=e,this.top=t,this.right=r,this.bottom=i,this.left=e,this.top=t,this.right=r,this.bottom=i}return e.equals=function(e,t){return!e&&!t||!!e&&!!t&&e.equals(t)},e.copy=function(t){return t?new e(t.left,t.top,t.right,t.bottom):null},e.prototype.equals=function(e){return this===e||!!e&&(this.left===e.left&&this.top===e.top&&this.right===e.right&