@northflank/js-client 0.5.7 → 0.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api-client.d.ts +527 -108
- package/dist/cjs/api-client.js +1 -1
- package/dist/esm/api-client.d.ts +527 -108
- package/dist/esm/api-client.js +2 -2
- package/package.json +1 -1
package/dist/cjs/api-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("events"),e=require("stream"),n=require("http"),r=require("url"),o=require("punycode"),i=require("https"),s=require("zlib"),a=require("os"),u=require("net"),c=require("child_process"),l=require("fs"),d=require("path"),p=require("tls"),h=require("crypto"),f=require("dgram");function v(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function m(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var b=v(t),y=v(e),g=v(n),w=v(r),_=v(o),j=v(i),E=v(s),S=v(a),x=v(u),A=m(u),C=v(l),O=v(d),k=v(p),I=v(h),U=v(f),D=function(t,e){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},D(t,e)};function P(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}D(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var B=function(){return B=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},B.apply(this,arguments)};function N(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))}function L(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function T(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var R="object"==typeof global&&global&&global.Object===Object&&global,F="object"==typeof self&&self&&self.Object===Object&&self,G=R||F||Function("return this")(),M=G.Symbol,q=Object.prototype,W=q.hasOwnProperty,z=q.toString,$=M?M.toStringTag:void 0;var J=Object.prototype.toString;var H=M?M.toStringTag:void 0;function V(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":H&&H in Object(t)?function(t){var e=W.call(t,$),n=t[$];try{t[$]=void 0;var r=!0}catch(t){}var o=z.call(t);return r&&(e?t[$]=n:delete t[$]),o}(t):function(t){return J.call(t)}(t)}function Y(t){return null!=t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&"[object Symbol]"==V(t)}function K(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}var X=Array.isArray,Q=M?M.prototype:void 0,tt=Q?Q.toString:void 0;function et(t){if("string"==typeof t)return t;if(X(t))return K(t,et)+"";if(Z(t))return tt?tt.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function nt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function rt(t){return t}function ot(t){if(!nt(t))return!1;var e=V(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var it,st=G["__core-js_shared__"],at=(it=/[^.]+$/.exec(st&&st.keys&&st.keys.IE_PROTO||""))?"Symbol(src)_1."+it:"";var ut=Function.prototype.toString;function ct(t){if(null!=t){try{return ut.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var lt=/^\[object .+?Constructor\]$/,dt=Function.prototype,pt=Object.prototype,ht=dt.toString,ft=pt.hasOwnProperty,vt=RegExp("^"+ht.call(ft).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mt(t){return!(!nt(t)||(e=t,at&&at in e))&&(ot(t)?vt:lt).test(ct(t));var e}function bt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return mt(n)?n:void 0}var yt=bt(G,"WeakMap"),gt=Object.create,wt=function(){function t(){}return function(e){if(!nt(e))return{};if(gt)return gt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function _t(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var jt=Date.now;var Et,St,xt,At=function(){try{var t=bt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ct=At,Ot=Ct?function(t,e){return Ct(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:rt,kt=(Et=Ot,St=0,xt=0,function(){var t=jt(),e=16-(t-xt);if(xt=t,e>0){if(++St>=800)return arguments[0]}else St=0;return Et.apply(void 0,arguments)}),It=/^(?:0|[1-9]\d*)$/;function Ut(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&It.test(t))&&t>-1&&t%1==0&&t<e}function Dt(t,e,n){"__proto__"==e&&Ct?Ct(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Pt(t,e){return t===e||t!=t&&e!=e}var Bt=Object.prototype.hasOwnProperty;function Nt(t,e,n){var r=t[e];Bt.call(t,e)&&Pt(r,n)&&(void 0!==n||e in t)||Dt(t,e,n)}var Lt=Math.max;function Tt(t,e){return kt(function(t,e,n){return e=Lt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Lt(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),_t(t,this,a)}}(t,e,rt),t+"")}function Rt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ft(t){return null!=t&&Rt(t.length)&&!ot(t)}var Gt=Object.prototype;function Mt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Gt)}function qt(t){return Y(t)&&"[object Arguments]"==V(t)}var Wt=Object.prototype,zt=Wt.hasOwnProperty,$t=Wt.propertyIsEnumerable,Jt=qt(function(){return arguments}())?qt:function(t){return Y(t)&&zt.call(t,"callee")&&!$t.call(t,"callee")};var Ht="object"==typeof exports&&exports&&!exports.nodeType&&exports,Vt=Ht&&"object"==typeof module&&module&&!module.nodeType&&module,Yt=Vt&&Vt.exports===Ht?G.Buffer:void 0,Zt=(Yt?Yt.isBuffer:void 0)||function(){return!1},Kt={};Kt["[object Float32Array]"]=Kt["[object Float64Array]"]=Kt["[object Int8Array]"]=Kt["[object Int16Array]"]=Kt["[object Int32Array]"]=Kt["[object Uint8Array]"]=Kt["[object Uint8ClampedArray]"]=Kt["[object Uint16Array]"]=Kt["[object Uint32Array]"]=!0,Kt["[object Arguments]"]=Kt["[object Array]"]=Kt["[object ArrayBuffer]"]=Kt["[object Boolean]"]=Kt["[object DataView]"]=Kt["[object Date]"]=Kt["[object Error]"]=Kt["[object Function]"]=Kt["[object Map]"]=Kt["[object Number]"]=Kt["[object Object]"]=Kt["[object RegExp]"]=Kt["[object Set]"]=Kt["[object String]"]=Kt["[object WeakMap]"]=!1;var Xt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qt=Xt&&"object"==typeof module&&module&&!module.nodeType&&module,te=Qt&&Qt.exports===Xt&&R.process,ee=function(){try{var t=Qt&&Qt.require&&Qt.require("util").types;return t||te&&te.binding&&te.binding("util")}catch(t){}}(),ne=ee&&ee.isTypedArray,re=ne?function(t){return function(e){return t(e)}}(ne):function(t){return Y(t)&&Rt(t.length)&&!!Kt[V(t)]},oe=re,ie=Object.prototype.hasOwnProperty;function se(t,e){var n=X(t),r=!n&&Jt(t),o=!n&&!r&&Zt(t),i=!n&&!r&&!o&&oe(t),s=n||r||o||i,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=a.length;for(var c in t)!e&&!ie.call(t,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ut(c,u))||a.push(c);return a}function ae(t,e){return function(n){return t(e(n))}}var ue=ae(Object.keys,Object),ce=Object.prototype.hasOwnProperty;function le(t){return Ft(t)?se(t):function(t){if(!Mt(t))return ue(t);var e=[];for(var n in Object(t))ce.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var de=Object.prototype.hasOwnProperty;function pe(t){if(!nt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=Mt(t),n=[];for(var r in t)("constructor"!=r||!e&&de.call(t,r))&&n.push(r);return n}function he(t){return Ft(t)?se(t,!0):pe(t)}var fe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ve=/^\w*$/;function me(t,e){if(X(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Z(t))||(ve.test(t)||!fe.test(t)||null!=e&&t in Object(e))}var be=bt(Object,"create");var ye=Object.prototype.hasOwnProperty;var ge=Object.prototype.hasOwnProperty;function we(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function _e(t,e){for(var n=t.length;n--;)if(Pt(t[n][0],e))return n;return-1}we.prototype.clear=function(){this.__data__=be?be(null):{},this.size=0},we.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},we.prototype.get=function(t){var e=this.__data__;if(be){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return ye.call(e,t)?e[t]:void 0},we.prototype.has=function(t){var e=this.__data__;return be?void 0!==e[t]:ge.call(e,t)},we.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=be&&void 0===e?"__lodash_hash_undefined__":e,this};var je=Array.prototype.splice;function Ee(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ee.prototype.clear=function(){this.__data__=[],this.size=0},Ee.prototype.delete=function(t){var e=this.__data__,n=_e(e,t);return!(n<0)&&(n==e.length-1?e.pop():je.call(e,n,1),--this.size,!0)},Ee.prototype.get=function(t){var e=this.__data__,n=_e(e,t);return n<0?void 0:e[n][1]},Ee.prototype.has=function(t){return _e(this.__data__,t)>-1},Ee.prototype.set=function(t,e){var n=this.__data__,r=_e(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var Se=bt(G,"Map");function xe(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Ae(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ae.prototype.clear=function(){this.size=0,this.__data__={hash:new we,map:new(Se||Ee),string:new we}},Ae.prototype.delete=function(t){var e=xe(this,t).delete(t);return this.size-=e?1:0,e},Ae.prototype.get=function(t){return xe(this,t).get(t)},Ae.prototype.has=function(t){return xe(this,t).has(t)},Ae.prototype.set=function(t,e){var n=xe(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Ce(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Ce.Cache||Ae),n}Ce.Cache=Ae;var Oe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ke=/\\(\\)?/g,Ie=function(t){var e=Ce(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Oe,(function(t,n,r,o){e.push(r?o.replace(ke,"$1"):n||t)})),e})),Ue=Ie;function De(t){return null==t?"":et(t)}function Pe(t,e){return X(t)?t:me(t,e)?[t]:Ue(De(t))}function Be(t){if("string"==typeof t||Z(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Ne(t,e){for(var n=0,r=(e=Pe(e,t)).length;null!=t&&n<r;)t=t[Be(e[n++])];return n&&n==r?t:void 0}function Le(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}var Te=M?M.isConcatSpreadable:void 0;function Re(t){return X(t)||Jt(t)||!!(Te&&t&&t[Te])}function Fe(t,e,n,r,o){var i=-1,s=t.length;for(n||(n=Re),o||(o=[]);++i<s;){var a=t[i];e>0&&n(a)?e>1?Fe(a,e-1,n,r,o):Le(o,a):r||(o[o.length]=a)}return o}var Ge=ae(Object.getPrototypeOf,Object),Me=Function.prototype,qe=Object.prototype,We=Me.toString,ze=qe.hasOwnProperty,$e=We.call(Object);function Je(t){var e=this.__data__=new Ee(t);this.size=e.size}Je.prototype.clear=function(){this.__data__=new Ee,this.size=0},Je.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Je.prototype.get=function(t){return this.__data__.get(t)},Je.prototype.has=function(t){return this.__data__.has(t)},Je.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Ee){var r=n.__data__;if(!Se||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ae(r)}return n.set(t,e),this.size=n.size,this};var He="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ve=He&&"object"==typeof module&&module&&!module.nodeType&&module,Ye=Ve&&Ve.exports===He?G.Buffer:void 0,Ze=Ye?Ye.allocUnsafe:void 0;var Ke=Object.prototype.propertyIsEnumerable,Xe=Object.getOwnPropertySymbols,Qe=Xe?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}(Xe(t),(function(e){return Ke.call(t,e)})))}:function(){return[]};function tn(t){return function(t,e,n){var r=e(t);return X(t)?r:Le(r,n(t))}(t,le,Qe)}var en=bt(G,"DataView"),nn=bt(G,"Promise"),rn=bt(G,"Set"),on=ct(en),sn=ct(Se),an=ct(nn),un=ct(rn),cn=ct(yt),ln=V;(en&&"[object DataView]"!=ln(new en(new ArrayBuffer(1)))||Se&&"[object Map]"!=ln(new Se)||nn&&"[object Promise]"!=ln(nn.resolve())||rn&&"[object Set]"!=ln(new rn)||yt&&"[object WeakMap]"!=ln(new yt))&&(ln=function(t){var e=V(t),n="[object Object]"==e?t.constructor:void 0,r=n?ct(n):"";if(r)switch(r){case on:return"[object DataView]";case sn:return"[object Map]";case an:return"[object Promise]";case un:return"[object Set]";case cn:return"[object WeakMap]"}return e});var dn=ln,pn=G.Uint8Array;function hn(t,e){var n,r,o=e?(n=t.buffer,r=new n.constructor(n.byteLength),new pn(r).set(new pn(n)),r):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}function fn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Ae;++e<n;)this.add(t[e])}function vn(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}fn.prototype.add=fn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},fn.prototype.has=function(t){return this.__data__.has(t)};function mn(t,e,n,r,o,i){var s=1&n,a=t.length,u=e.length;if(a!=u&&!(s&&u>a))return!1;var c=i.get(t),l=i.get(e);if(c&&l)return c==e&&l==t;var d=-1,p=!0,h=2&n?new fn:void 0;for(i.set(t,e),i.set(e,t);++d<a;){var f=t[d],v=e[d];if(r)var m=s?r(v,f,d,e,t,i):r(f,v,d,t,e,i);if(void 0!==m){if(m)continue;p=!1;break}if(h){if(!vn(e,(function(t,e){if(s=e,!h.has(s)&&(f===t||o(f,t,n,r,i)))return h.push(e);var s}))){p=!1;break}}else if(f!==v&&!o(f,v,n,r,i)){p=!1;break}}return i.delete(t),i.delete(e),p}function bn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function yn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var gn=M?M.prototype:void 0,wn=gn?gn.valueOf:void 0;var _n=Object.prototype.hasOwnProperty;var jn="[object Object]",En=Object.prototype.hasOwnProperty;function Sn(t,e,n,r,o,i){var s=X(t),a=X(e),u=s?"[object Array]":dn(t),c=a?"[object Array]":dn(e),l=(u="[object Arguments]"==u?jn:u)==jn,d=(c="[object Arguments]"==c?jn:c)==jn,p=u==c;if(p&&Zt(t)){if(!Zt(e))return!1;s=!0,l=!1}if(p&&!l)return i||(i=new Je),s||oe(t)?mn(t,e,n,r,o,i):function(t,e,n,r,o,i,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new pn(t),new pn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Pt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=bn;case"[object Set]":var u=1&r;if(a||(a=yn),t.size!=e.size&&!u)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var l=mn(a(t),a(e),r,o,i,s);return s.delete(t),l;case"[object Symbol]":if(wn)return wn.call(t)==wn.call(e)}return!1}(t,e,u,n,r,o,i);if(!(1&n)){var h=l&&En.call(t,"__wrapped__"),f=d&&En.call(e,"__wrapped__");if(h||f){var v=h?t.value():t,m=f?e.value():e;return i||(i=new Je),o(v,m,n,r,i)}}return!!p&&(i||(i=new Je),function(t,e,n,r,o,i){var s=1&n,a=tn(t),u=a.length;if(u!=tn(e).length&&!s)return!1;for(var c=u;c--;){var l=a[c];if(!(s?l in e:_n.call(e,l)))return!1}var d=i.get(t),p=i.get(e);if(d&&p)return d==e&&p==t;var h=!0;i.set(t,e),i.set(e,t);for(var f=s;++c<u;){var v=t[l=a[c]],m=e[l];if(r)var b=s?r(m,v,l,e,t,i):r(v,m,l,t,e,i);if(!(void 0===b?v===m||o(v,m,n,r,i):b)){h=!1;break}f||(f="constructor"==l)}if(h&&!f){var y=t.constructor,g=e.constructor;y==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof g&&g instanceof g||(h=!1)}return i.delete(t),i.delete(e),h}(t,e,n,r,o,i))}function xn(t,e,n,r,o){return t===e||(null==t||null==e||!Y(t)&&!Y(e)?t!=t&&e!=e:Sn(t,e,n,r,xn,o))}function An(t){return t==t&&!nt(t)}function Cn(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function On(t){var e=function(t){for(var e=le(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,An(o)]}return e}(t);return 1==e.length&&e[0][2]?Cn(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,r){var o=n.length,i=o,s=!r;if(null==t)return!i;for(t=Object(t);o--;){var a=n[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var u=(a=n[o])[0],c=t[u],l=a[1];if(s&&a[2]){if(void 0===c&&!(u in t))return!1}else{var d=new Je;if(r)var p=r(c,l,u,t,e,d);if(!(void 0===p?xn(l,c,3,r,d):p))return!1}}return!0}(n,t,e)}}function kn(t,e){return null!=t&&e in Object(t)}function In(t,e){return null!=t&&function(t,e,n){for(var r=-1,o=(e=Pe(e,t)).length,i=!1;++r<o;){var s=Be(e[r]);if(!(i=null!=t&&n(t,s)))break;t=t[s]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&Rt(o)&&Ut(s,o)&&(X(t)||Jt(t))}(t,e,kn)}function Un(t,e){return me(t)&&An(e)?Cn(Be(t),e):function(n){var r=function(t,e,n){var r=null==t?void 0:Ne(t,e);return void 0===r?n:r}(n,t);return void 0===r&&r===e?In(n,t):xn(e,r,3)}}function Dn(t){return me(t)?(e=Be(t),function(t){return null==t?void 0:t[e]}):function(t){return function(e){return Ne(e,t)}}(t);var e}function Pn(t){return"function"==typeof t?t:null==t?rt:"object"==typeof t?X(t)?Un(t[0],t[1]):On(t):Dn(t)}var Bn,Nn=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),s=i.length;s--;){var a=i[Bn?s:++r];if(!1===e(o[a],a,o))break}return t};var Ln=function(t,e){return function(n,r){if(null==n)return n;if(!Ft(n))return t(n,r);for(var o=n.length,i=e?o:-1,s=Object(n);(e?i--:++i<o)&&!1!==r(s[i],i,s););return n}}((function(t,e){return t&&Nn(t,e,le)})),Tn=Ln;function Rn(t,e,n){(void 0!==n&&!Pt(t[e],n)||void 0===n&&!(e in t))&&Dt(t,e,n)}function Fn(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Gn(t){return function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var a=e[i],u=r?r(n[a],t[a],a,n,t):void 0;void 0===u&&(u=t[a]),o?Dt(n,a,u):Nt(n,a,u)}return n}(t,he(t))}function Mn(t,e,n,r,o,i,s){var a=Fn(t,n),u=Fn(e,n),c=s.get(u);if(c)Rn(t,n,c);else{var l,d=i?i(a,u,n+"",t,e,s):void 0,p=void 0===d;if(p){var h=X(u),f=!h&&Zt(u),v=!h&&!f&&oe(u);d=u,h||f||v?X(a)?d=a:Y(l=a)&&Ft(l)?d=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(a):f?(p=!1,d=function(t,e){if(e)return t.slice();var n=t.length,r=Ze?Ze(n):new t.constructor(n);return t.copy(r),r}(u,!0)):v?(p=!1,d=hn(u,!0)):d=[]:function(t){if(!Y(t)||"[object Object]"!=V(t))return!1;var e=Ge(t);if(null===e)return!0;var n=ze.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&We.call(n)==$e}(u)||Jt(u)?(d=a,Jt(a)?d=Gn(a):nt(a)&&!ot(a)||(d=function(t){return"function"!=typeof t.constructor||Mt(t)?{}:wt(Ge(t))}(u))):p=!1}p&&(s.set(u,d),o(d,u,r,i,s),s.delete(u)),Rn(t,n,d)}}function qn(t,e,n,r,o){t!==e&&Nn(e,(function(i,s){if(o||(o=new Je),nt(i))Mn(t,e,s,n,qn,r,o);else{var a=r?r(Fn(t,s),i,s+"",t,e,o):void 0;void 0===a&&(a=i),Rn(t,s,a)}}),he)}var Wn=/[\\^$.*+?()[\]{}|]/g,zn=RegExp(Wn.source);function $n(t,e){var n=-1,r=Ft(t)?Array(t.length):[];return Tn(t,(function(t,o,i){r[++n]=e(t,o,i)})),r}function Jn(t,e){return Fe(function(t,e){return(X(t)?K:$n)(t,Pn(e))}(t,e),1)}function Hn(t,e){return t>e}function Vn(t){return"string"==typeof t||!X(t)&&Y(t)&&"[object String]"==V(t)}function Yn(t,e){return t&&t.length?function(t,e,n){for(var r=-1,o=t.length;++r<o;){var i=t[r],s=e(i);if(null!=s&&(void 0===a?s==s&&!Z(s):n(s,a)))var a=s,u=i}return u}(t,Pn(e),Hn):void 0}var Zn,Kn=(Zn=function(t,e,n){qn(t,e,n)},Tt((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Zn.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!nt(n))return!1;var r=typeof e;return!!("number"==r?Ft(n)&&Ut(e,n.length):"string"==r&&e in n)&&Pt(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var s=e[n];s&&Zn(t,s,n,o)}return t})));function Xn(t,e){return t(e={exports:{}},e.exports),e.exports}var Qn={},tr=Qn;function er(t){return t<0?-1:1}function nr(t,e){e.unsigned||--t;const n=e.unsigned?0:-Math.pow(2,t),r=Math.pow(2,t)-1,o=e.moduloBitLength?Math.pow(2,e.moduloBitLength):Math.pow(2,t),i=e.moduloBitLength?Math.pow(2,e.moduloBitLength-1):Math.pow(2,t-1);return function(t,s){s||(s={});let a=+t;if(s.enforceRange){if(!Number.isFinite(a))throw new TypeError("Argument is not a finite number");if(a=er(a)*Math.floor(Math.abs(a)),a<n||a>r)throw new TypeError("Argument is not in byte range");return a}if(!isNaN(a)&&s.clamp)return a=function(t){return t%1==.5&&0==(1&t)?Math.floor(t):Math.round(t)}(a),a<n&&(a=n),a>r&&(a=r),a;if(!Number.isFinite(a)||0===a)return 0;if(a=er(a)*Math.floor(Math.abs(a)),a%=o,!e.unsigned&&a>=i)return a-o;if(e.unsigned)if(a<0)a+=o;else if(-0===a)return 0;return a}}Qn.void=function(){},Qn.boolean=function(t){return!!t},Qn.byte=nr(8,{unsigned:!1}),Qn.octet=nr(8,{unsigned:!0}),Qn.short=nr(16,{unsigned:!1}),Qn["unsigned short"]=nr(16,{unsigned:!0}),Qn.long=nr(32,{unsigned:!1}),Qn["unsigned long"]=nr(32,{unsigned:!0}),Qn["long long"]=nr(32,{unsigned:!1,moduloBitLength:64}),Qn["unsigned long long"]=nr(32,{unsigned:!0,moduloBitLength:64}),Qn.double=function(t){const e=+t;if(!Number.isFinite(e))throw new TypeError("Argument is not a finite floating-point value");return e},Qn["unrestricted double"]=function(t){const e=+t;if(isNaN(e))throw new TypeError("Argument is NaN");return e},Qn.float=Qn.double,Qn["unrestricted float"]=Qn["unrestricted double"],Qn.DOMString=function(t,e){return e||(e={}),e.treatNullAsEmptyString&&null===t?"":String(t)},Qn.ByteString=function(t,e){const n=String(t);let r;for(let t=0;void 0!==(r=n.codePointAt(t));++t)if(r>255)throw new TypeError("Argument is not a valid bytestring");return n},Qn.USVString=function(t){const e=String(t),n=e.length,r=[];for(let t=0;t<n;++t){const o=e.charCodeAt(t);if(o<55296||o>57343)r.push(String.fromCodePoint(o));else if(56320<=o&&o<=57343)r.push(String.fromCodePoint(65533));else if(t===n-1)r.push(String.fromCodePoint(65533));else{const n=e.charCodeAt(t+1);if(56320<=n&&n<=57343){const e=1023&o,i=1023&n;r.push(String.fromCodePoint(65536+1024*e+i)),++t}else r.push(String.fromCodePoint(65533))}}return r.join("")},Qn.Date=function(t,e){if(!(t instanceof Date))throw new TypeError("Argument is not a Date object");if(!isNaN(t))return t},Qn.RegExp=function(t,e){return t instanceof RegExp||(t=new RegExp(t)),t};var rr=Xn((function(t){t.exports.mixin=function(t,e){const n=Object.getOwnPropertyNames(e);for(let r=0;r<n.length;++r)Object.defineProperty(t,n[r],Object.getOwnPropertyDescriptor(e,n[r]))},t.exports.wrapperSymbol=Symbol("wrapper"),t.exports.implSymbol=Symbol("impl"),t.exports.wrapperForImpl=function(e){return e[t.exports.wrapperSymbol]},t.exports.implForWrapper=function(e){return e[t.exports.implSymbol]}}));rr.mixin,rr.wrapperSymbol,rr.implSymbol,rr.wrapperForImpl,rr.implForWrapper;var or,ir=(or=Object.freeze({__proto__:null}))&&or.default||or,sr={TRANSITIONAL:0,NONTRANSITIONAL:1};function ar(t){return t.split("\0").map((function(t){return t.normalize("NFC")})).join("\0")}function ur(t){for(var e=0,n=ir.length-1;e<=n;){var r=Math.floor((e+n)/2),o=ir[r];if(o[0][0]<=t&&o[0][1]>=t)return o;o[0][0]>t?n=r-1:e=r+1}return null}var cr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;function lr(t){return t.replace(cr,"_").length}var dr=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;function pr(t,e){"xn--"===t.substr(0,4)&&(t=_.default.toUnicode(t));var n=!1;(ar(t)!==t||"-"===t[3]&&"-"===t[4]||"-"===t[0]||"-"===t[t.length-1]||-1!==t.indexOf(".")||0===t.search(dr))&&(n=!0);for(var r=lr(t),o=0;o<r;++o){var i=ur(t.codePointAt(o));if(hr===sr.TRANSITIONAL&&"valid"!==i[1]||hr===sr.NONTRANSITIONAL&&"valid"!==i[1]&&"deviation"!==i[1]){n=!0;break}}return{label:t,error:n}}function hr(t,e,n){var r=function(t,e,n){for(var r=!1,o="",i=lr(t),s=0;s<i;++s){var a=t.codePointAt(s),u=ur(a);switch(u[1]){case"disallowed":r=!0,o+=String.fromCodePoint(a);break;case"ignored":break;case"mapped":o+=String.fromCodePoint.apply(String,u[2]);break;case"deviation":o+=n===sr.TRANSITIONAL?String.fromCodePoint.apply(String,u[2]):String.fromCodePoint(a);break;case"valid":o+=String.fromCodePoint(a);break;case"disallowed_STD3_mapped":e?(r=!0,o+=String.fromCodePoint(a)):o+=String.fromCodePoint.apply(String,u[2]);break;case"disallowed_STD3_valid":e&&(r=!0),o+=String.fromCodePoint(a)}}return{string:o,error:r}}(t,e,n);r.string=ar(r.string);for(var o=r.string.split("."),i=0;i<o.length;++i)try{var s=pr(o[i]);o[i]=s.label,r.error=r.error||s.error}catch(t){r.error=!0}return{string:o.join("."),error:r.error}}var fr={toASCII:function(t,e,n,r){var o=hr(t,e,n),i=o.string.split(".");if(i=i.map((function(t){try{return _.default.toASCII(t)}catch(e){return o.error=!0,t}})),r){var s=i.slice(0,i.length-1).join(".").length;(s.length>253||0===s.length)&&(o.error=!0);for(var a=0;a<i.length;++a)if(i.length>63||0===i.length){o.error=!0;break}}return o.error?null:i.join(".")},toUnicode:function(t,e){var n=hr(t,e,sr.NONTRANSITIONAL);return{domain:n.string,error:n.error}},PROCESSING_OPTIONS:sr},vr=Xn((function(t){const e={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},n=Symbol("failure");function r(t){return _.default.ucs2.decode(t).length}function o(t,e){const n=t[e];return isNaN(n)?void 0:String.fromCodePoint(n)}function i(t){return t>=48&&t<=57}function s(t){return t>=65&&t<=90||t>=97&&t<=122}function a(t){return i(t)||t>=65&&t<=70||t>=97&&t<=102}function u(t){return"."===t||"%2e"===t.toLowerCase()}function c(t){return 2===t.length&&s(t.codePointAt(0))&&(":"===t[1]||"|"===t[1])}function l(t){return void 0!==e[t]}function d(t){return l(t.scheme)}function p(t){let e=t.toString(16).toUpperCase();return 1===e.length&&(e="0"+e),"%"+e}function h(t){return t<=31||t>126}const f=new Set([32,34,35,60,62,63,96,123,125]);function v(t){return h(t)||f.has(t)}const m=new Set([47,58,59,61,64,91,92,93,94,124]);function b(t){return v(t)||m.has(t)}function y(t,e){const n=String.fromCodePoint(t);return e(t)?function(t){const e=new Buffer(t);let n="";for(let t=0;t<e.length;++t)n+=p(e[t]);return n}(n):n}function g(t){let e=10;if(t.length>=2&&"0"===t.charAt(0)&&"x"===t.charAt(1).toLowerCase()?(t=t.substring(2),e=16):t.length>=2&&"0"===t.charAt(0)&&(t=t.substring(1),e=8),""===t)return 0;return(10===e?/[^0-9]/:16===e?/[^0-9A-Fa-f]/:/[^0-7]/).test(t)?n:parseInt(t,e)}function w(t,e){if("["===t[0])return"]"!==t[t.length-1]?n:function(t){const e=[0,0,0,0,0,0,0,0];let r=0,s=null,u=0;if(58===(t=_.default.ucs2.decode(t))[u]){if(58!==t[u+1])return n;u+=2,++r,s=r}for(;u<t.length;){if(8===r)return n;if(58===t[u]){if(null!==s)return n;++u,++r,s=r;continue}let c=0,l=0;for(;l<4&&a(t[u]);)c=16*c+parseInt(o(t,u),16),++u,++l;if(46===t[u]){if(0===l)return n;if(u-=l,r>6)return n;let s=0;for(;void 0!==t[u];){let a=null;if(s>0){if(!(46===t[u]&&s<4))return n;++u}if(!i(t[u]))return n;for(;i(t[u]);){const e=parseInt(o(t,u));if(null===a)a=e;else{if(0===a)return n;a=10*a+e}if(a>255)return n;++u}e[r]=256*e[r]+a,++s,2!==s&&4!==s||++r}if(4!==s)return n;break}if(58===t[u]){if(++u,void 0===t[u])return n}else if(void 0!==t[u])return n;e[r]=c,++r}if(null!==s){let t=r-s;for(r=7;0!==r&&t>0;){const n=e[s+t-1];e[s+t-1]=e[r],e[r]=n,--r,--t}}else if(null===s&&8!==r)return n;return e}(t.substring(1,t.length-1));if(!e)return function(t){if(e=t,-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/))return n;var e;let r="";const o=_.default.ucs2.decode(t);for(let t=0;t<o.length;++t)r+=y(o[t],h);return r}(t);const r=function(t){const e=new Buffer(t),n=[];for(let t=0;t<e.length;++t)37!==e[t]?n.push(e[t]):37===e[t]&&a(e[t+1])&&a(e[t+2])?(n.push(parseInt(e.slice(t+1,t+3).toString(),16)),t+=2):n.push(e[t]);return new Buffer(n).toString()}(t),s=fr.toASCII(r,!1,fr.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===s)return n;if(-1!==s.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/))return n;const u=function(t){const e=t.split(".");if(""===e[e.length-1]&&e.length>1&&e.pop(),e.length>4)return t;const r=[];for(const o of e){if(""===o)return t;const e=g(o);if(e===n)return t;r.push(e)}for(let t=0;t<r.length-1;++t)if(r[t]>255)return n;if(r[r.length-1]>=Math.pow(256,5-r.length))return n;let o=r.pop(),i=0;for(const t of r)o+=t*Math.pow(256,3-i),++i;return o}(s);return"number"==typeof u||u===n?u:s}function j(t){return"number"==typeof t?function(t){let e="",n=t;for(let t=1;t<=4;++t)e=String(n%256)+e,4!==t&&(e="."+e),n=Math.floor(n/256);return e}(t):t instanceof Array?"["+function(t){let e="";const n=function(t){let e=null,n=1,r=null,o=0;for(let i=0;i<t.length;++i)0!==t[i]?(o>n&&(e=r,n=o),r=null,o=0):(null===r&&(r=i),++o);return o>n&&(e=r,n=o),{idx:e,len:n}}(t).idx;let r=!1;for(let o=0;o<=7;++o)r&&0===t[o]||(r&&(r=!1),n!==o?(e+=t[o].toString(16),7!==o&&(e+=":")):(e+=0===o?"::":":",r=!0));return e}(t)+"]":t}function E(t){const e=t.path;var n;0!==e.length&&("file"===t.scheme&&1===e.length&&(n=e[0],/^[A-Za-z]:$/.test(n))||e.pop())}function S(t){return""!==t.username||""!==t.password}function x(t,e,r,o,i){if(this.pointer=0,this.input=t,this.base=e||null,this.encodingOverride=r||"utf-8",this.stateOverride=i,this.url=o,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};const t=function(t){return t.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);t!==this.input&&(this.parseError=!0),this.input=t}const s=function(t){return t.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=_.default.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){const t=this.input[this.pointer],e=isNaN(t)?void 0:String.fromCodePoint(t),r=this["parse "+this.state](t,e);if(!r)break;if(r===n){this.failure=!0;break}}}x.prototype["parse scheme start"]=function(t,e){if(s(t))this.buffer+=e.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,n;this.state="no scheme",--this.pointer}return!0},x.prototype["parse scheme"]=function(t,e){if(function(t){return s(t)||i(t)}(t)||43===t||45===t||46===t)this.buffer+=e.toLowerCase();else if(58===t){if(this.stateOverride){if(d(this.url)&&!l(this.buffer))return!1;if(!d(this.url)&&l(this.buffer))return!1;if((S(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):d(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":d(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,n;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},x.prototype["parse no scheme"]=function(t){return null===this.base||this.base.cannotBeABaseURL&&35!==t?n:(this.base.cannotBeABaseURL&&35===t?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},x.prototype["parse special relative or authority"]=function(t){return 47===t&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},x.prototype["parse path or authority"]=function(t){return 47===t?this.state="authority":(this.state="path",--this.pointer),!0},x.prototype["parse relative"]=function(t){return this.url.scheme=this.base.scheme,isNaN(t)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===t?this.state="relative slash":63===t?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===t?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):d(this.url)&&92===t?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},x.prototype["parse relative slash"]=function(t){return!d(this.url)||47!==t&&92!==t?47===t?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===t&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},x.prototype["parse special authority slashes"]=function(t){return 47===t&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},x.prototype["parse special authority ignore slashes"]=function(t){return 47!==t&&92!==t?(this.state="authority",--this.pointer):this.parseError=!0,!0},x.prototype["parse authority"]=function(t,e){if(64===t){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;const t=r(this.buffer);for(let e=0;e<t;++e){const t=this.buffer.codePointAt(e);if(58===t&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const n=y(t,b);this.passwordTokenSeenFlag?this.url.password+=n:this.url.username+=n}this.buffer=""}else if(isNaN(t)||47===t||63===t||35===t||d(this.url)&&92===t){if(this.atFlag&&""===this.buffer)return this.parseError=!0,n;this.pointer-=r(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=e;return!0},x.prototype["parse hostname"]=x.prototype["parse host"]=function(t,e){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==t||this.arrFlag)if(isNaN(t)||47===t||63===t||35===t||d(this.url)&&92===t){if(--this.pointer,d(this.url)&&""===this.buffer)return this.parseError=!0,n;if(this.stateOverride&&""===this.buffer&&(S(this.url)||null!==this.url.port))return this.parseError=!0,!1;const t=w(this.buffer,d(this.url));if(t===n)return n;if(this.url.host=t,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===t?this.arrFlag=!0:93===t&&(this.arrFlag=!1),this.buffer+=e;else{if(""===this.buffer)return this.parseError=!0,n;const t=w(this.buffer,d(this.url));if(t===n)return n;if(this.url.host=t,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},x.prototype["parse port"]=function(t,r){if(i(t))this.buffer+=r;else{if(!(isNaN(t)||47===t||63===t||35===t||d(this.url)&&92===t||this.stateOverride))return this.parseError=!0,n;if(""!==this.buffer){const t=parseInt(this.buffer);if(t>Math.pow(2,16)-1)return this.parseError=!0,n;this.url.port=t===(o=this.url.scheme,e[o])?null:t,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var o;return!0};const A=new Set([47,92,63,35]);x.prototype["parse file"]=function(t){var e,n;return this.url.scheme="file",47===t||92===t?(92===t&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(t)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===t?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===t?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(e=t,n=this.input[this.pointer+1],!s(e)||58!==n&&124!==n)||this.input.length-this.pointer-1>=2&&!A.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),E(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},x.prototype["parse file slash"]=function(t){var e;return 47===t||92===t?(92===t&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(2===(e=this.base.path[0]).length&&s(e.codePointAt(0))&&":"===e[1]?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},x.prototype["parse file host"]=function(t,e){if(isNaN(t)||47===t||92===t||63===t||35===t)if(--this.pointer,!this.stateOverride&&c(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let t=w(this.buffer,d(this.url));if(t===n)return n;if("localhost"===t&&(t=""),this.url.host=t,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=e;return!0},x.prototype["parse path start"]=function(t){return d(this.url)?(92===t&&(this.parseError=!0),this.state="path",47!==t&&92!==t&&--this.pointer):this.stateOverride||63!==t?this.stateOverride||35!==t?void 0!==t&&(this.state="path",47!==t&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},x.prototype["parse path"]=function(t){if(isNaN(t)||47===t||d(this.url)&&92===t||!this.stateOverride&&(63===t||35===t)){if(d(this.url)&&92===t&&(this.parseError=!0),".."===(e=(e=this.buffer).toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e?(E(this.url),47===t||d(this.url)&&92===t||this.url.path.push("")):!u(this.buffer)||47===t||d(this.url)&&92===t?u(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&c(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===t||63===t||35===t))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===t&&(this.url.query="",this.state="query"),35===t&&(this.url.fragment="",this.state="fragment")}else 37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=y(t,v);var e;return!0},x.prototype["parse cannot-be-a-base-URL path"]=function(t){return 63===t?(this.url.query="",this.state="query"):35===t?(this.url.fragment="",this.state="fragment"):(isNaN(t)||37===t||(this.parseError=!0),37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),isNaN(t)||(this.url.path[0]=this.url.path[0]+y(t,h))),!0},x.prototype["parse query"]=function(t,e){if(isNaN(t)||!this.stateOverride&&35===t){d(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");const e=new Buffer(this.buffer);for(let t=0;t<e.length;++t)e[t]<33||e[t]>126||34===e[t]||35===e[t]||60===e[t]||62===e[t]?this.url.query+=p(e[t]):this.url.query+=String.fromCodePoint(e[t]);this.buffer="",35===t&&(this.url.fragment="",this.state="fragment")}else 37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=e;return!0},x.prototype["parse fragment"]=function(t){return isNaN(t)||(0===t?this.parseError=!0:(37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=y(t,h))),!0},t.exports.serializeURL=function(t,e){let n=t.scheme+":";if(null!==t.host?(n+="//",""===t.username&&""===t.password||(n+=t.username,""!==t.password&&(n+=":"+t.password),n+="@"),n+=j(t.host),null!==t.port&&(n+=":"+t.port)):null===t.host&&"file"===t.scheme&&(n+="//"),t.cannotBeABaseURL)n+=t.path[0];else for(const e of t.path)n+="/"+e;return null!==t.query&&(n+="?"+t.query),e||null===t.fragment||(n+="#"+t.fragment),n},t.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":try{return t.exports.serializeURLOrigin(t.exports.parseURL(e.path[0]))}catch(t){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return function(t){let e=t.scheme+"://";return e+=j(t.host),null!==t.port&&(e+=":"+t.port),e}({scheme:e.scheme,host:e.host,port:e.port});case"file":return"file://";default:return"null"}},t.exports.basicURLParse=function(t,e){void 0===e&&(e={});const n=new x(t,e.baseURL,e.encodingOverride,e.url,e.stateOverride);return n.failure?"failure":n.url},t.exports.setTheUsername=function(t,e){t.username="";const n=_.default.ucs2.decode(e);for(let e=0;e<n.length;++e)t.username+=y(n[e],b)},t.exports.setThePassword=function(t,e){t.password="";const n=_.default.ucs2.decode(e);for(let e=0;e<n.length;++e)t.password+=y(n[e],b)},t.exports.serializeHost=j,t.exports.cannotHaveAUsernamePasswordPort=function(t){return null===t.host||""===t.host||t.cannotBeABaseURL||"file"===t.scheme},t.exports.serializeInteger=function(t){return String(t)},t.exports.parseURL=function(e,n){return void 0===n&&(n={}),t.exports.basicURLParse(e,{baseURL:n.baseURL,encodingOverride:n.encodingOverride})}}));vr.serializeURL,vr.serializeURLOrigin,vr.basicURLParse,vr.setTheUsername,vr.setThePassword,vr.serializeHost,vr.cannotHaveAUsernamePasswordPort,vr.serializeInteger,vr.parseURL;var mr=class{constructor(t){const e=t[0],n=t[1];let r=null;if(void 0!==n&&(r=vr.basicURLParse(n),"failure"===r))throw new TypeError("Invalid base URL");const o=vr.basicURLParse(e,{baseURL:r});if("failure"===o)throw new TypeError("Invalid URL");this._url=o}get href(){return vr.serializeURL(this._url)}set href(t){const e=vr.basicURLParse(t);if("failure"===e)throw new TypeError("Invalid URL");this._url=e}get origin(){return vr.serializeURLOrigin(this._url)}get protocol(){return this._url.scheme+":"}set protocol(t){vr.basicURLParse(t+":",{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(t){vr.cannotHaveAUsernamePasswordPort(this._url)||vr.setTheUsername(this._url,t)}get password(){return this._url.password}set password(t){vr.cannotHaveAUsernamePasswordPort(this._url)||vr.setThePassword(this._url,t)}get host(){const t=this._url;return null===t.host?"":null===t.port?vr.serializeHost(t.host):vr.serializeHost(t.host)+":"+vr.serializeInteger(t.port)}set host(t){this._url.cannotBeABaseURL||vr.basicURLParse(t,{url:this._url,stateOverride:"host"})}get hostname(){return null===this._url.host?"":vr.serializeHost(this._url.host)}set hostname(t){this._url.cannotBeABaseURL||vr.basicURLParse(t,{url:this._url,stateOverride:"hostname"})}get port(){return null===this._url.port?"":vr.serializeInteger(this._url.port)}set port(t){vr.cannotHaveAUsernamePasswordPort(this._url)||(""===t?this._url.port=null:vr.basicURLParse(t,{url:this._url,stateOverride:"port"}))}get pathname(){return this._url.cannotBeABaseURL?this._url.path[0]:0===this._url.path.length?"":"/"+this._url.path.join("/")}set pathname(t){this._url.cannotBeABaseURL||(this._url.path=[],vr.basicURLParse(t,{url:this._url,stateOverride:"path start"}))}get search(){return null===this._url.query||""===this._url.query?"":"?"+this._url.query}set search(t){const e=this._url;if(""===t)return void(e.query=null);const n="?"===t[0]?t.substring(1):t;e.query="",vr.basicURLParse(n,{url:e,stateOverride:"query"})}get hash(){return null===this._url.fragment||""===this._url.fragment?"":"#"+this._url.fragment}set hash(t){if(""===t)return void(this._url.fragment=null);const e="#"===t[0]?t.substring(1):t;this._url.fragment="",vr.basicURLParse(e,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}},br=Xn((function(t){const e=rr.implSymbol;function n(r){if(!this||this[e]||!(this instanceof n))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");if(arguments.length<1)throw new TypeError("Failed to construct 'URL': 1 argument required, but only "+arguments.length+" present.");const o=[];for(let t=0;t<arguments.length&&t<2;++t)o[t]=arguments[t];o[0]=tr.USVString(o[0]),void 0!==o[1]&&(o[1]=tr.USVString(o[1])),t.exports.setup(this,o)}n.prototype.toJSON=function(){if(!this||!t.exports.is(this))throw new TypeError("Illegal invocation");const n=[];for(let t=0;t<arguments.length&&t<0;++t)n[t]=arguments[t];return this[e].toJSON.apply(this[e],n)},Object.defineProperty(n.prototype,"href",{get(){return this[e].href},set(t){t=tr.USVString(t),this[e].href=t},enumerable:!0,configurable:!0}),n.prototype.toString=function(){if(!this||!t.exports.is(this))throw new TypeError("Illegal invocation");return this.href},Object.defineProperty(n.prototype,"origin",{get(){return this[e].origin},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"protocol",{get(){return this[e].protocol},set(t){t=tr.USVString(t),this[e].protocol=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"username",{get(){return this[e].username},set(t){t=tr.USVString(t),this[e].username=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"password",{get(){return this[e].password},set(t){t=tr.USVString(t),this[e].password=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"host",{get(){return this[e].host},set(t){t=tr.USVString(t),this[e].host=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hostname",{get(){return this[e].hostname},set(t){t=tr.USVString(t),this[e].hostname=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"port",{get(){return this[e].port},set(t){t=tr.USVString(t),this[e].port=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pathname",{get(){return this[e].pathname},set(t){t=tr.USVString(t),this[e].pathname=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"search",{get(){return this[e].search},set(t){t=tr.USVString(t),this[e].search=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hash",{get(){return this[e].hash},set(t){t=tr.USVString(t),this[e].hash=t},enumerable:!0,configurable:!0}),t.exports={is:t=>!!t&&t[e]instanceof mr,create(t,e){let r=Object.create(n.prototype);return this.setup(r,t,e),r},setup(t,n,r){r||(r={}),r.wrapper=t,t[e]=new mr(n,r),t[e][rr.wrapperSymbol]=t},interface:n,expose:{Window:{URL:n},Worker:{URL:n}}}}));br.is,br.create,br.setup,br.expose;var yr={URL:br.interface,serializeURL:vr.serializeURL,serializeURLOrigin:vr.serializeURLOrigin,basicURLParse:vr.basicURLParse,setTheUsername:vr.setTheUsername,setThePassword:vr.setThePassword,serializeHost:vr.serializeHost,serializeInteger:vr.serializeInteger,parseURL:vr.parseURL};const gr=y.default.Readable,wr=Symbol("buffer"),_r=Symbol("type");class jr{constructor(){this[_r]="";const t=arguments[0],e=arguments[1],n=[];let r=0;if(t){const e=t,o=Number(e.length);for(let t=0;t<o;t++){const o=e[t];let i;i=o instanceof Buffer?o:ArrayBuffer.isView(o)?Buffer.from(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?Buffer.from(o):o instanceof jr?o[wr]:Buffer.from("string"==typeof o?o:String(o)),r+=i.length,n.push(i)}}this[wr]=Buffer.concat(n);let o=e&&void 0!==e.type&&String(e.type).toLowerCase();o&&!/[^\u0020-\u007E]/.test(o)&&(this[_r]=o)}get size(){return this[wr].length}get type(){return this[_r]}text(){return Promise.resolve(this[wr].toString())}arrayBuffer(){const t=this[wr],e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return Promise.resolve(e)}stream(){const t=new gr;return t._read=function(){},t.push(this[wr]),t.push(null),t}toString(){return"[object Blob]"}slice(){const t=this.size,e=arguments[0],n=arguments[1];let r,o;r=void 0===e?0:e<0?Math.max(t+e,0):Math.min(e,t),o=void 0===n?t:n<0?Math.max(t+n,0):Math.min(n,t);const i=Math.max(o-r,0),s=this[wr].slice(r,r+i),a=new jr([],{type:arguments[2]});return a[wr]=s,a}}function Er(t,e,n){Error.call(this,t),this.message=t,this.type=e,n&&(this.code=this.errno=n.code),Error.captureStackTrace(this,this.constructor)}let Sr;Object.defineProperties(jr.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(jr.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),Er.prototype=Object.create(Error.prototype),Er.prototype.constructor=Er,Er.prototype.name="FetchError";try{Sr=require("encoding").convert}catch(t){}const xr=Symbol("Body internals"),Ar=y.default.PassThrough;function Cr(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.size;let o=void 0===r?0:r;var i=n.timeout;let s=void 0===i?0:i;null==t?t=null:kr(t)?t=Buffer.from(t.toString()):Ir(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof y.default||(t=Buffer.from(String(t)))),this[xr]={body:t,disturbed:!1,error:null},this.size=o,this.timeout=s,t instanceof y.default&&t.on("error",(function(t){const n="AbortError"===t.name?t:new Er(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[xr].error=n}))}function Or(){var t=this;if(this[xr].disturbed)return Cr.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[xr].disturbed=!0,this[xr].error)return Cr.Promise.reject(this[xr].error);let e=this.body;if(null===e)return Cr.Promise.resolve(Buffer.alloc(0));if(Ir(e)&&(e=e.stream()),Buffer.isBuffer(e))return Cr.Promise.resolve(e);if(!(e instanceof y.default))return Cr.Promise.resolve(Buffer.alloc(0));let n=[],r=0,o=!1;return new Cr.Promise((function(i,s){let a;t.timeout&&(a=setTimeout((function(){o=!0,s(new Er(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(o=!0,s(e)):s(new Er(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!o&&null!==e){if(t.size&&r+e.length>t.size)return o=!0,void s(new Er(`content size at ${t.url} over limit: ${t.size}`,"max-size"));r+=e.length,n.push(e)}})),e.on("end",(function(){if(!o){clearTimeout(a);try{i(Buffer.concat(n,r))}catch(e){s(new Er(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function kr(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function Ir(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function Ur(t){let e,n,r=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return r instanceof y.default&&"function"!=typeof r.getBoundary&&(e=new Ar,n=new Ar,r.pipe(e),r.pipe(n),t[xr].body=e,r=n),r}function Dr(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":kr(t)?"application/x-www-form-urlencoded;charset=UTF-8":Ir(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?`multipart/form-data;boundary=${t.getBoundary()}`:t instanceof y.default?null:"text/plain;charset=UTF-8"}function Pr(t){const e=t.body;return null===e?0:Ir(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}Cr.prototype={get body(){return this[xr].body},get bodyUsed(){return this[xr].disturbed},arrayBuffer(){return Or.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return Or.call(this).then((function(e){return Object.assign(new jr([],{type:t.toLowerCase()}),{[wr]:e})}))},json(){var t=this;return Or.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return Cr.Promise.reject(new Er(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return Or.call(this).then((function(t){return t.toString()}))},buffer(){return Or.call(this)},textConverted(){var t=this;return Or.call(this).then((function(e){return function(t,e){if("function"!=typeof Sr)throw new Error("The package `encoding` must be installed to use the textConverted() function");const n=e.get("content-type");let r,o,i="utf-8";n&&(r=/charset=([^;]*)/i.exec(n));o=t.slice(0,1024).toString(),!r&&o&&(r=/<meta.+?charset=(['"])(.+?)\1/i.exec(o));!r&&o&&(r=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o),r||(r=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(o),r&&r.pop()),r&&(r=/charset=(.*)/i.exec(r.pop())));!r&&o&&(r=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o));r&&(i=r.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030"));return Sr(t,"UTF-8",i).toString()}(e,t.headers)}))}},Object.defineProperties(Cr.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),Cr.mixIn=function(t){for(const e of Object.getOwnPropertyNames(Cr.prototype))if(!(e in t)){const n=Object.getOwnPropertyDescriptor(Cr.prototype,e);Object.defineProperty(t,e,n)}},Cr.Promise=global.Promise;const Br=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,Nr=/[^\t\x20-\x7e\x80-\xff]/;function Lr(t){if(t=`${t}`,Br.test(t)||""===t)throw new TypeError(`${t} is not a legal HTTP header name`)}function Tr(t){if(t=`${t}`,Nr.test(t))throw new TypeError(`${t} is not a legal HTTP header value`)}function Rr(t,e){e=e.toLowerCase();for(const n in t)if(n.toLowerCase()===e)return n}const Fr=Symbol("map");class Gr{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[Fr]=Object.create(null),t instanceof Gr){const e=t.raw(),n=Object.keys(e);for(const t of n)for(const n of e[t])this.append(t,n)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const n=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");n.push(Array.from(e))}for(const t of n){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const n=t[e];this.append(e,n)}}}}get(t){Lr(t=`${t}`);const e=Rr(this[Fr],t);return void 0===e?null:this[Fr][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=Mr(this),r=0;for(;r<n.length;){var o=n[r];const i=o[0],s=o[1];t.call(e,s,i,this),n=Mr(this),r++}}set(t,e){e=`${e}`,Lr(t=`${t}`),Tr(e);const n=Rr(this[Fr],t);this[Fr][void 0!==n?n:t]=[e]}append(t,e){e=`${e}`,Lr(t=`${t}`),Tr(e);const n=Rr(this[Fr],t);void 0!==n?this[Fr][n].push(e):this[Fr][t]=[e]}has(t){return Lr(t=`${t}`),void 0!==Rr(this[Fr],t)}delete(t){Lr(t=`${t}`);const e=Rr(this[Fr],t);void 0!==e&&delete this[Fr][e]}raw(){return this[Fr]}keys(){return Wr(this,"key")}values(){return Wr(this,"value")}[Symbol.iterator](){return Wr(this,"key+value")}}function Mr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const n=Object.keys(t[Fr]).sort();return n.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[Fr][e].join(", ")}:function(e){return[e.toLowerCase(),t[Fr][e].join(", ")]})}Gr.prototype.entries=Gr.prototype[Symbol.iterator],Object.defineProperty(Gr.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(Gr.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const qr=Symbol("internal");function Wr(t,e){const n=Object.create(zr);return n[qr]={target:t,kind:e,index:0},n}const zr=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==zr)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[qr];const e=t.target,n=t.kind,r=t.index,o=Mr(e,n);return r>=o.length?{value:void 0,done:!0}:(this[qr].index=r+1,{value:o[r],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function $r(t){const e=Object.assign({__proto__:null},t[Fr]),n=Rr(t[Fr],"Host");return void 0!==n&&(e[n]=e[n][0]),e}Object.defineProperty(zr,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const Jr=Symbol("Response internals"),Hr=g.default.STATUS_CODES;class Vr{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Cr.call(this,t,e);const n=e.status||200,r=new Gr(e.headers);if(null!=t&&!r.has("Content-Type")){const e=Dr(t);e&&r.append("Content-Type",e)}this[Jr]={url:e.url,status:n,statusText:e.statusText||Hr[n],headers:r,counter:e.counter}}get url(){return this[Jr].url||""}get status(){return this[Jr].status}get ok(){return this[Jr].status>=200&&this[Jr].status<300}get redirected(){return this[Jr].counter>0}get statusText(){return this[Jr].statusText}get headers(){return this[Jr].headers}clone(){return new Vr(Ur(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}Cr.mixIn(Vr.prototype),Object.defineProperties(Vr.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const Yr=Symbol("Request internals"),Zr=w.default.URL||yr.URL,Kr=w.default.parse,Xr=w.default.format;function Qr(t){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(t)&&(t=new Zr(t).toString()),Kr(t)}const to="destroy"in y.default.Readable.prototype;function eo(t){return"object"==typeof t&&"object"==typeof t[Yr]}class no{constructor(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eo(t)?e=Qr(t.url):(e=t&&t.href?Qr(t.href):Qr(`${t}`),t={});let r=n.method||t.method||"GET";if(r=r.toUpperCase(),(null!=n.body||eo(t)&&null!==t.body)&&("GET"===r||"HEAD"===r))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=n.body?n.body:eo(t)&&null!==t.body?Ur(t):null;Cr.call(this,o,{timeout:n.timeout||t.timeout||0,size:n.size||t.size||0});const i=new Gr(n.headers||t.headers||{});if(null!=o&&!i.has("Content-Type")){const t=Dr(o);t&&i.append("Content-Type",t)}let s=eo(t)?t.signal:null;if("signal"in n&&(s=n.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[Yr]={method:r,redirect:n.redirect||t.redirect||"follow",headers:i,parsedURL:e,signal:s},this.follow=void 0!==n.follow?n.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==n.compress?n.compress:void 0===t.compress||t.compress,this.counter=n.counter||t.counter||0,this.agent=n.agent||t.agent}get method(){return this[Yr].method}get url(){return Xr(this[Yr].parsedURL)}get headers(){return this[Yr].headers}get redirect(){return this[Yr].redirect}get signal(){return this[Yr].signal}clone(){return new no(this)}}function ro(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}Cr.mixIn(no.prototype),Object.defineProperty(no.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(no.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),ro.prototype=Object.create(Error.prototype),ro.prototype.constructor=ro,ro.prototype.name="AbortError";const oo=w.default.URL||yr.URL,io=y.default.PassThrough;function so(t,e){if(!so.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Cr.Promise=so.Promise,new so.Promise((function(n,r){const o=new no(t,e),i=function(t){const e=t[Yr].parsedURL,n=new Gr(t[Yr].headers);if(n.has("Accept")||n.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof y.default.Readable&&!to)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let r=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(r="0"),null!=t.body){const e=Pr(t);"number"==typeof e&&(r=String(e))}r&&n.set("Content-Length",r),n.has("User-Agent")||n.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!n.has("Accept-Encoding")&&n.set("Accept-Encoding","gzip,deflate");let o=t.agent;return"function"==typeof o&&(o=o(e)),n.has("Connection")||o||n.set("Connection","close"),Object.assign({},e,{method:t.method,headers:$r(n),agent:o})}(o),s=("https:"===i.protocol?j.default:g.default).request,a=o.signal;let u=null;const c=function(){let t=new ro("The user aborted a request.");r(t),o.body&&o.body instanceof y.default.Readable&&o.body.destroy(t),u&&u.body&&u.body.emit("error",t)};if(a&&a.aborted)return void c();const l=function(){c(),h()},d=s(i);let p;function h(){d.abort(),a&&a.removeEventListener("abort",l),clearTimeout(p)}a&&a.addEventListener("abort",l),o.timeout&&d.once("socket",(function(t){p=setTimeout((function(){r(new Er(`network timeout at: ${o.url}`,"request-timeout")),h()}),o.timeout)})),d.on("error",(function(t){r(new Er(`request to ${o.url} failed, reason: ${t.message}`,"system",t)),h()})),d.on("response",(function(t){clearTimeout(p);const e=function(t){const e=new Gr;for(const n of Object.keys(t))if(!Br.test(n))if(Array.isArray(t[n]))for(const r of t[n])Nr.test(r)||(void 0===e[Fr][n]?e[Fr][n]=[r]:e[Fr][n].push(r));else Nr.test(t[n])||(e[Fr][n]=[t[n]]);return e}(t.headers);if(so.isRedirect(t.statusCode)){const i=e.get("Location");let s=null;try{s=null===i?null:new oo(i,o.url).toString()}catch(t){if("manual"!==o.redirect)return r(new Er(`uri requested responds with an invalid redirect URL: ${i}`,"invalid-redirect")),void h()}switch(o.redirect){case"error":return r(new Er(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),void h();case"manual":if(null!==s)try{e.set("Location",s)}catch(t){r(t)}break;case"follow":if(null===s)break;if(o.counter>=o.follow)return r(new Er(`maximum redirect reached at: ${o.url}`,"max-redirect")),void h();const i={headers:new Gr(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:o.body,signal:o.signal,timeout:o.timeout,size:o.size};if(!function(t,e){const n=new oo(e).hostname,r=new oo(t).hostname;return n===r||"."===n[n.length-r.length-1]&&n.endsWith(r)}(o.url,s))for(const t of["authorization","www-authenticate","cookie","cookie2"])i.headers.delete(t);return 303!==t.statusCode&&o.body&&null===Pr(o)?(r(new Er("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void h()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==o.method)||(i.method="GET",i.body=void 0,i.headers.delete("content-length")),n(so(new no(s,i))),void h())}}t.once("end",(function(){a&&a.removeEventListener("abort",l)}));let i=t.pipe(new io);const s={url:o.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:o.size,timeout:o.timeout,counter:o.counter},c=e.get("Content-Encoding");if(!o.compress||"HEAD"===o.method||null===c||204===t.statusCode||304===t.statusCode)return u=new Vr(i,s),void n(u);const d={flush:E.default.Z_SYNC_FLUSH,finishFlush:E.default.Z_SYNC_FLUSH};if("gzip"==c||"x-gzip"==c)return i=i.pipe(E.default.createGunzip(d)),u=new Vr(i,s),void n(u);if("deflate"!=c&&"x-deflate"!=c){if("br"==c&&"function"==typeof E.default.createBrotliDecompress)return i=i.pipe(E.default.createBrotliDecompress()),u=new Vr(i,s),void n(u);u=new Vr(i,s),n(u)}else{t.pipe(new io).once("data",(function(t){i=8==(15&t[0])?i.pipe(E.default.createInflate()):i.pipe(E.default.createInflateRaw()),u=new Vr(i,s),n(u)}))}})),function(t,e){const n=e.body;null===n?t.end():Ir(n)?n.stream().pipe(t):Buffer.isBuffer(n)?(t.write(n),t.end()):n.pipe(t)}(d,o)}))}so.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},so.Promise=global.Promise;var ao=function(){function t(t){this.contextProvider=t}return t.prototype.getServiceDetails=function(t,e){return N(this,void 0,void 0,(function(){return L(this,(function(n){return[2,this.fetch("".concat(this.contextProvider.getCurrentBaseUrl(),"/v1/port-forwarding/info/projects/").concat(t,"/services/").concat(e))]}))}))},t.prototype.getAddonDetails=function(t,e){return N(this,void 0,void 0,(function(){return L(this,(function(n){return[2,this.fetch("".concat(this.contextProvider.getCurrentBaseUrl(),"/v1/port-forwarding/info/projects/").concat(t,"/addons/").concat(e))]}))}))},t.prototype.fetch=function(t,e){return N(this,void 0,void 0,(function(){var n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:return n=Kn({},{headers:{Authorization:"Bearer ".concat(this.contextProvider.getCurrentToken()),"Content-Type":"application/json"}},B({},e)),[4,so(t,n)];case 1:return(r=a.sent()).ok?[3,3]:(o=Error.bind,s=(i=JSON).stringify,[4,r.json()]);case 2:throw new(o.apply(Error,[void 0,s.apply(i,[a.sent()])]));case 3:return[4,r.json()];case 4:return[2,a.sent()]}}))}))},t}(),uo=function(t,e,n){return N(void 0,void 0,void 0,(function(){var r,o,i,s,a;return L(this,(function(u){switch(u.label){case 0:if(r=po(e||"127.0.0.1"),(o=po(n||"127.255.255.255"))<r)throw new Error("Invalid IP range");"darwin"===S.default.platform()&&(i=function(t){return N(void 0,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return e="lo0 alias ".concat(t," up"),[4,lo.apply(void 0,e.split(" "))];case 1:return n.sent(),[2]}}))}))}),s=r,u.label=1;case 1:return s<=o?(a=ho(s),[4,co(t,a)]):[3,6];case 2:return u.sent()?i?[4,i(a)]:[3,4]:[3,5];case 3:u.sent(),u.label=4;case 4:return[2,a];case 5:return s+=1,[3,1];case 6:throw new Error("No ip available")}}))}))},co=function(t,e){return new Promise((function(n){var r=new u.Socket,o=!1;r.on("connect",(function(){o=!0,r.destroy()})),r.setTimeout(400),r.on("timeout",(function(){o=!1,r.destroy()})),r.on("error",(function(){o=!1})),r.on("close",(function(){n(!o)})),e?r.connect(t,e):r.connect(t)}))},lo=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return N(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return"/sbin/ifconfig",[4,fo("/sbin/ifconfig",t).resultPromise];case 1:return[2,e.sent()]}}))}))},po=function(t){var e=t.split(".").reverse();if(4!==e.length)throw new Error("Invalid ip address: ".concat(t));for(var n=0,r=0;r<4;r+=1){var o=Number.parseInt(e[r],10);if(o<0||o>255)throw new Error("Invalid ip address: ".concat(t));n+=o<<8*r}return n},ho=function(t){if(!Number.isSafeInteger(t))throw new Error("Number is not an integer");if(t<0||t>4294967295)throw new Error("Number is out of range 0x0-0xffffffff");for(var e=[],n=0;n<4;n+=1)e.push(t>>8*n&255);return e.reverse().join(".")},fo=function(t,e,n){var r=c.spawn(t,e,B({windowsHide:!0},n)),o=new Promise((function(o,i){var s="",a="";(null===(null==n?void 0:n.stdio)||void 0===(null==n?void 0:n.stdio))&&(r.stdout&&r.stdout.on("data",(function(t){s+=t})),r.stderr&&r.stderr.on("data",(function(t){a+=t}))),r.on("close",(function(n){var r={code:n,stdout:s,stderr:a};if(0!==n){var u="Error during execution of command '".concat(t," ").concat(e.join(" "),"': ").concat(a);i({message:u,result:r})}else o(r)}))}));return{process:r,resultPromise:o}},vo=function(t,e,n){return N(void 0,void 0,void 0,(function(){var r,o;return L(this,(function(i){switch(i.label){case 0:return r=mo(t,10),[4,C.default.promises.writeFile(r,e,n)];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,6]),[4,C.default.promises.rename(r,t)];case 3:return i.sent(),[3,6];case 4:return o=i.sent(),[4,C.default.promises.unlink(r).catch((function(){}))];case 5:throw i.sent(),o;case 6:return[2]}}))}))},mo=function(t,e){for(var n,r=O.default.dirname(t),o=O.default.basename(t),i=0;null===(n=i<e)||void 0===n||n;i+=1){var s=T([],Array(16),!0).map((function(){return Math.floor(16*Math.random()).toString(16)})).join(""),a=".".concat(s,".").concat(o),u=O.default.join(r,a);if(!C.default.existsSync(u))return u}throw new Error("Could not write file to file '".concat(t,"'."))},bo="win32"===process.platform?"\r\n":"\n",yo=function(){function t(t,e){this.nodes=t,this.config=e}return t.prototype.add=function(t,e,n){var r=this;if(0===e.length)return this;var o=this.findOrCreateEntry(t,n);return e.forEach((function(t){if(!o.hosts.find((function(e){return e.host===t}))){var e=1;0===o.hosts.length&&(e=r.config.indent-"".concat(o.ipPrefixWhitespace).concat(o.ip).length),o.hosts.push({whitespace:" ".repeat(e<1?1:e),host:t})}})),this},t.prototype.remove=function(t,e){var n=this;return this.findEntries(t).forEach((function(t){e.forEach((function(e){var r=t.hosts.findIndex((function(t){return t.host===e}));r<0||(0===r&&void 0!==t.hosts[1]&&(t.hosts[1].whitespace=t.hosts[0].whitespace),t.hosts.splice(r,1),0===t.hosts.length&&n.removeEntry(t))}))})),this},t.prototype.removeHosts=function(t){var e=this;xo(this.nodes,"entry").forEach((function(n){e.remove(n.ip,t)}))},t.prototype.removeIps=function(t){var e=this;return t.forEach((function(t){e.findEntries(t).forEach((function(t){return e.removeEntry(t)}))})),this},t.prototype.resolveHosts=function(t){return Jn(this.findEntries(t),(function(t){return t.hosts.map((function(t){return t.host}))}))},t.prototype.resolveIps=function(t){return xo(this.nodes,"entry").filter((function(e){return e.hosts.some((function(e){return e.host===t}))})).map((function(t){return t.ip}))},t.prototype.toString=function(){return jo(this.nodes,this.config.eol)},t.prototype.removeEntry=function(t){var e,n="number"==typeof(e=t)||Y(e)&&"[object Number]"==V(e)?t:this.nodes.findIndex((function(e){return e===t}));n<0||this.nodes.splice(n,1)},t.prototype.findEntries=function(t){return xo(this.nodes,"entry").filter((function(e){return e.ip===t}))},t.prototype.findOrCreateEntry=function(t,e){var n=this.findEntries(t)[0];if(n)return n;var r=this.makeEntry(t);if(e){var o=_o(e),i=this.nodes.findIndex((function(t){return"comment"===t.type&&t.line===o}));if(i>=0)this.insertAt(i+1,r);else{var s="blank"!==this.nodes[this.nodes.length-1].type?[go(),wo(o),r]:[wo(o),r];this.insertAt.apply(this,T([this.nodes.length],s,!1))}}else this.insertAt(this.nodes.length,r);return r},t.prototype.insertAt=function(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(e=this.nodes).splice.apply(e,T([t,0],n,!1))},t.prototype.makeEntry=function(t,e){var n=this.config.ipPrefixWhitespace;return B({type:"entry",ip:t,ipPrefixWhitespace:n,hosts:[]},e)},t.fromNodes=function(e,n){var r,o;return new t(e.filter((function(t){return"eol"!==t.type})),{eol:null!==(r=null==n?void 0:n.eol)&&void 0!==r?r:function(){var t,n=xo(e,"eol").map((function(t){return t.line}));return null!==(t=Ao(n))&&void 0!==t?t:bo}(),indent:null!==(o=null==n?void 0:n.indent)&&void 0!==o?o:function(){var t,n=Jn(xo(e,"entry"),(function(t){var e=t.ipPrefixWhitespace,n=t.ip,r=t.hosts[0];return r?["".concat(e).concat(n).concat(r.whitespace).length]:[]}));return null!==(t=Ao(n))&&void 0!==t?t:17}(),ipPrefixWhitespace:""})},t.parse=function(t,e){return this.fromNodes(Eo(t),e)},t}(),go=function(){return{type:"blank",line:""}},wo=function(t){return{type:"comment",line:_o(t)}},_o=function(t){return t.startsWith("#")?t:"# ".concat(t)},jo=function(t,e){var n=t.map((function(t){switch(t.type){case"entry":var e=t.hosts.map((function(t){var e=t.whitespace,n=t.host;return"".concat(e).concat(n)})).join("");return"".concat(t.ipPrefixWhitespace).concat(t.ip).concat(e);case"blank":case"comment":case"invalid":return t.line;default:return""}}));return n.join(null!=e?e:bo)},Eo=function(t){return t.split(/(\r?\n)/).map((function(t){return function(t){return t.match(/^\s*#.*$/)}(t)?{type:"comment",line:t}:function(t){return t.match(/^(\r?\n)$/)}(t)?{type:"eol",line:t}:function(t){return t.match(/^\s*$/)}(t)?{type:"blank",line:t}:So(t)}))},So=function(t){var e=t.match(/^(\s*)(\S+)(.+)?$/);if(!e)return{type:"invalid",line:t};var n=e[1],r=e[2],o=e.slice(3),i=!1,s=Jn(o.filter((function(t){return void 0!==t})),(function(t){var e=t.match(/(\s+)(\S+)/g);return e?e.map((function(t){var e=t.match(/^(\s+)(\S+)$/);e||(i=!0);var n=null!=e?e:[];return{whitespace:n[1],host:n[2]}})):(i=!0,[])}));return i?{type:"invalid",line:t}:{type:"entry",ipPrefixWhitespace:n,ip:r,hosts:s}},xo=function(t,e){return t.filter((function(t){return t.type===e}))},Ao=function(t){var e=new Map;t.forEach((function(t){var n;e.set(t,(null!==(n=e.get(t))&&void 0!==n?n:0)+1)}));var n=Yn(Array.from(e.entries()),(function(t){return t[1]}));if(n)return n[0]},Co="win32"===process.platform?"C:/Windows/System32/drivers/etc/hosts":"/etc/hosts",Oo=function(){function t(t){this.ast=yo.fromNodes([]);var e={writeMode:"atomic",hostsFile:Co};this.config=B(B({},e),t)}return t.prototype.add=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!Vn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."));return e.forEach((function(t){if(!Vn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.add(t,e,this.config.header),this},t.prototype.remove=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!Vn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."));return e.forEach((function(t){if(!Vn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.remove(t,e),this},t.prototype.removeHosts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.forEach((function(t){if(!Vn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.removeHosts(t),this},t.prototype.removeIps=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.forEach((function(t){if(!Vn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."))})),this.ast.removeIps(t),this},t.prototype.read=function(){return N(this,void 0,void 0,(function(){var t;return L(this,(function(e){switch(e.label){case 0:return[4,C.default.promises.readFile(this.config.hostsFile)];case 1:return t=e.sent(),this.ast=yo.parse(t.toString(),this.config),[2,this]}}))}))},t.prototype.write=function(t){return N(this,void 0,void 0,(function(){var e,n,r,o;return L(this,(function(i){switch(i.label){case 0:switch(e=B(B({},this.config),t),n=e.hostsFile,r=e.writeMode,o=this.ast.toString(),r){case void 0:case"atomic":return[3,1];case"standard":return[3,3];case"disabled":return[3,5]}return[3,5];case 1:return[4,vo(n,o)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,C.default.promises.writeFile(n,o)];case 5:return[3,6];case 6:return[2,this]}}))}))},t.prototype.backup=function(t){return N(this,void 0,void 0,(function(){var e,n,r,o;return L(this,(function(i){switch(i.label){case 0:return C.default.existsSync(this.config.hostsFile)?(e=O.default.dirname(this.config.hostsFile),n=O.default.basename(this.config.hostsFile),r="".concat(n).concat(t.suffix),o=O.default.resolve(e,r),C.default.existsSync(o)&&!t.rewrite?[3,2]:[4,C.default.promises.copyFile(this.config.hostsFile,o)]):[2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.load=function(e){return N(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,new t(e).read()];case 1:return[2,n.sent()]}}))}))},t}(),ko=function(){function t(){this.previousPromise=Promise.resolve()}return t.prototype.enter=function(t){return N(this,void 0,void 0,(function(){var e;return L(this,(function(n){return e=this.previousPromise.then((function(){return t()})).catch((function(){return t()})),this.previousPromise=e,[2,e]}))}))},t}(),Io=function t(e,n){if(e&&n)return t(e)(n);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(t){r[t]=e[t]})),r;function r(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach((function(t){r[t]=o[t]})),r}};var Uo=Io(Po),Do=Io(Bo);function Po(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function Bo(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}Po.proto=Po((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Po(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Bo(this)},configurable:!0})})),Uo.strict=Do;var No=function(){},Lo=function(t,e,n){if("function"==typeof e)return Lo(t,null,e);e||(e={}),n=Uo(n||No);var r=t._writableState,o=t._readableState,i=e.readable||!1!==e.readable&&t.readable,s=e.writable||!1!==e.writable&&t.writable,a=!1,u=function(){t.writable||c()},c=function(){s=!1,i||n.call(t)},l=function(){i=!1,s||n.call(t)},d=function(e){n.call(t,e?new Error("exited with error code: "+e):null)},p=function(e){n.call(t,e)},h=function(){process.nextTick(f)},f=function(){if(!a)return(!i||o&&o.ended&&!o.destroyed)&&(!s||r&&r.ended&&!r.destroyed)?void 0:n.call(t,new Error("premature close"))},v=function(){t.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?s&&!r&&(t.on("end",u),t.on("close",u)):(t.on("complete",c),t.on("abort",h),t.req?v():t.on("request",v)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",d),t.on("end",l),t.on("finish",c),!1!==e.error&&t.on("error",p),t.on("close",h),function(){a=!0,t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",v),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("exit",d),t.removeListener("end",l),t.removeListener("error",p),t.removeListener("close",h)}},To=Lo,Ro=function(){},Fo=/^v?\.0/.test(process.version),Go=function(t){return"function"==typeof t},Mo=function(t,e,n,r){r=Uo(r);var o=!1;t.on("close",(function(){o=!0})),To(t,{readable:e,writable:n},(function(t){if(t)return r(t);o=!0,r()}));var i=!1;return function(e){if(!o&&!i)return i=!0,function(t){return!!Fo&&!!C.default&&(t instanceof(C.default.ReadStream||Ro)||t instanceof(C.default.WriteStream||Ro))&&Go(t.close)}(t)?t.close(Ro):function(t){return t.setHeader&&Go(t.abort)}(t)?t.abort():Go(t.destroy)?t.destroy():void r(e||new Error("stream was destroyed"))}},qo=function(t){t()},Wo=function(t,e){return t.pipe(e)},zo=function(){var t,e=Array.prototype.slice.call(arguments),n=Go(e[e.length-1]||Ro)&&e.pop()||Ro;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map((function(o,i){var s=i<e.length-1;return Mo(o,s,i>0,(function(e){t||(t=e),e&&r.forEach(qo),s||(r.forEach(qo),n(t))}))}));return e.reduce(Wo)};const{Duplex:$o}=y.default;function Jo(t){t.emit("close")}function Ho(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Vo(t){this.removeListener("error",Vo),this.destroy(),0===this.listenerCount("error")&&this.emit("error",t)}var Yo=function(t,e){let n=!0;const r=new $o({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",(function(e,n){const o=!n&&r._readableState.objectMode?e.toString():e;r.push(o)||t.pause()})),t.once("error",(function(t){r.destroyed||(n=!1,r.destroy(t))})),t.once("close",(function(){r.destroyed||r.push(null)})),r._destroy=function(e,o){if(t.readyState===t.CLOSED)return o(e),void process.nextTick(Jo,r);let i=!1;t.once("error",(function(t){i=!0,o(t)})),t.once("close",(function(){i||o(e),process.nextTick(Jo,r)})),n&&t.terminate()},r._final=function(e){t.readyState!==t.CONNECTING?null!==t._socket&&(t._socket._writableState.finished?(e(),r._readableState.endEmitted&&r.destroy()):(t._socket.once("finish",(function(){e()})),t.close())):t.once("open",(function(){r._final(e)}))},r._read=function(){t.isPaused&&t.resume()},r._write=function(e,n,o){t.readyState!==t.CONNECTING?t.send(e,o):t.once("open",(function(){r._write(e,n,o)}))},r.on("end",Ho),r.on("error",Vo),r},Zo={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}},Ko="function"==typeof __webpack_require__?__non_webpack_require__:function(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")},Xo=process.config&&process.config.variables||{},Qo=!!process.env.PREBUILDS_ONLY,ti=process.versions.modules,ei=!(!process.versions||!process.versions.electron)||!!process.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":"node",ni=S.default.arch(),ri=S.default.platform(),oi=process.env.LIBC||(function(t){return"linux"===t&&C.default.existsSync("/etc/alpine-release")}(ri)?"musl":"glibc"),ii=process.env.ARM_VERSION||("arm64"===ni?"8":Xo.arm_version)||"",si=(process.versions.uv||"").split(".")[0],ai=ui;function ui(t){return Ko(ui.path(t))}function ci(t){try{return C.default.readdirSync(t)}catch(t){return[]}}function li(t,e){var n=ci(t).filter(e);return n[0]&&O.default.join(t,n[0])}function di(t){return/\.node$/.test(t)}function pi(t){var e=t.split("-");if(2===e.length){var n=e[0],r=e[1].split("+");if(n&&r.length&&r.every(Boolean))return{name:t,platform:n,architectures:r}}}function hi(t,e){return function(n){return null!=n&&(n.platform===t&&n.architectures.includes(e))}}function fi(t,e){return t.architectures.length-e.architectures.length}function vi(t){var e=t.split("."),n={file:t,specificity:0};if("node"===e.pop()){for(var r=0;r<e.length;r++){var o=e[r];if("node"===o||"electron"===o||"node-webkit"===o)n.runtime=o;else if("napi"===o)n.napi=!0;else if("abi"===o.slice(0,3))n.abi=o.slice(3);else if("uv"===o.slice(0,2))n.uv=o.slice(2);else if("armv"===o.slice(0,4))n.armv=o.slice(4);else{if("glibc"!==o&&"musl"!==o)continue;n.libc=o}n.specificity++}return n}}function mi(t,e){return function(n){return null!=n&&(!(n.runtime!==t&&!function(t){return"node"===t.runtime&&t.napi}(n))&&(!(n.abi!==e&&!n.napi)&&((!n.uv||n.uv===si)&&((!n.armv||n.armv===ii)&&(!n.libc||n.libc===oi)))))}}function bi(t){return function(e,n){return e.runtime!==n.runtime?e.runtime===t?-1:1:e.abi!==n.abi?e.abi?-1:1:e.specificity!==n.specificity?e.specificity>n.specificity?-1:1:0}}ui.path=function(t){t=O.default.resolve(t||".");try{var e=Ko(O.default.join(t,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(t=process.env[e+"_PREBUILD"])}catch(t){}if(!Qo){var n=li(O.default.join(t,"build/Release"),di);if(n)return n;var r=li(O.default.join(t,"build/Debug"),di);if(r)return r}var o=a(t);if(o)return o;var i=a(O.default.dirname(process.execPath));if(i)return i;var s=["platform="+ri,"arch="+ni,"runtime="+ei,"abi="+ti,"uv="+si,ii?"armv="+ii:"","libc="+oi,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"","function"==typeof __webpack_require__?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+s+"\n loaded from: "+t+"\n");function a(t){var e=ci(O.default.join(t,"prebuilds")).map(pi).filter(hi(ri,ni)).sort(fi)[0];if(e){var n=O.default.join(t,"prebuilds",e.name),r=ci(n).map(vi).filter(mi(ei,ti)).sort(bi(ei))[0];return r?O.default.join(n,r.file):void 0}}},ui.parseTags=vi,ui.matchTags=mi,ui.compareTags=bi,ui.parseTuple=pi,ui.matchTuple=hi,ui.compareTuples=fi;var yi={mask:(t,e,n,r,o)=>{for(var i=0;i<o;i++)n[r+i]=t[i]^e[3&i]},unmask:(t,e)=>{const n=t.length;for(var r=0;r<n;r++)t[r]^=e[3&r]}},gi=Xn((function(t){try{t.exports=ai(__dirname)}catch(e){t.exports=yi}})),wi=Xn((function(t){const{EMPTY_BUFFER:e}=Zo;function n(t,n){if(0===t.length)return e;if(1===t.length)return t[0];const r=Buffer.allocUnsafe(n);let o=0;for(let e=0;e<t.length;e++){const n=t[e];r.set(n,o),o+=n.length}return o<n?r.slice(0,o):r}function r(t,e,n,r,o){for(let i=0;i<o;i++)n[r+i]=t[i]^e[3&i]}function o(t,e){for(let n=0;n<t.length;n++)t[n]^=e[3&n]}function i(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function s(t){if(s.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=Buffer.from(t):ArrayBuffer.isView(t)?e=Buffer.from(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),s.readOnly=!1),e}try{const e=gi;t.exports={concat:n,mask(t,n,o,i,s){s<48?r(t,n,o,i,s):e.mask(t,n,o,i,s)},toArrayBuffer:i,toBuffer:s,unmask(t,n){t.length<32?o(t,n):e.unmask(t,n)}}}catch(e){t.exports={concat:n,mask:r,toArrayBuffer:i,toBuffer:s,unmask:o}}}));wi.concat,wi.mask,wi.toArrayBuffer,wi.toBuffer,wi.unmask;const _i=Symbol("kDone"),ji=Symbol("kRun");var Ei=class{constructor(t){this[_i]=()=>{this.pending--,this[ji]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[ji]()}[ji](){if(this.pending!==this.concurrency&&this.jobs.length){const t=this.jobs.shift();this.pending++,t(this[_i])}}};const{kStatusCode:Si}=Zo,xi=Buffer.from([0,0,255,255]),Ai=Symbol("permessage-deflate"),Ci=Symbol("total-length"),Oi=Symbol("callback"),ki=Symbol("buffers"),Ii=Symbol("error");let Ui;var Di=class{constructor(t,e,n){if(this._maxPayload=0|n,this._options=t||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!Ui){const t=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;Ui=new Ei(t)}}static get extensionName(){return"permessage-deflate"}offer(){const t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const t=this._deflate[Oi];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){const e=this._options,n=t.find((t=>!(!1===e.serverNoContextTakeover&&t.server_no_context_takeover||t.server_max_window_bits&&(!1===e.serverMaxWindowBits||"number"==typeof e.serverMaxWindowBits&&e.serverMaxWindowBits>t.server_max_window_bits)||"number"==typeof e.clientMaxWindowBits&&!t.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(n.server_no_context_takeover=!0),e.clientNoContextTakeover&&(n.client_no_context_takeover=!0),"number"==typeof e.serverMaxWindowBits&&(n.server_max_window_bits=e.serverMaxWindowBits),"number"==typeof e.clientMaxWindowBits?n.client_max_window_bits=e.clientMaxWindowBits:!0!==n.client_max_window_bits&&!1!==e.clientMaxWindowBits||delete n.client_max_window_bits,n}acceptAsClient(t){const e=t[0];if(!1===this._options.clientNoContextTakeover&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(e.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(e.client_max_window_bits=this._options.clientMaxWindowBits);return e}normalizeParams(t){return t.forEach((t=>{Object.keys(t).forEach((e=>{let n=t[e];if(n.length>1)throw new Error(`Parameter "${e}" must have only a single value`);if(n=n[0],"client_max_window_bits"===e){if(!0!==n){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}else if("server_max_window_bits"===e){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else{if("client_no_context_takeover"!==e&&"server_no_context_takeover"!==e)throw new Error(`Unknown parameter "${e}"`);if(!0!==n)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}t[e]=n}))})),t}decompress(t,e,n){Ui.add((r=>{this._decompress(t,e,((t,e)=>{r(),n(t,e)}))}))}compress(t,e,n){Ui.add((r=>{this._compress(t,e,((t,e)=>{r(),n(t,e)}))}))}_decompress(t,e,n){const r=this._isServer?"client":"server";if(!this._inflate){const t=`${r}_max_window_bits`,e="number"!=typeof this.params[t]?E.default.Z_DEFAULT_WINDOWBITS:this.params[t];this._inflate=E.default.createInflateRaw({...this._options.zlibInflateOptions,windowBits:e}),this._inflate[Ai]=this,this._inflate[Ci]=0,this._inflate[ki]=[],this._inflate.on("error",Ni),this._inflate.on("data",Bi)}this._inflate[Oi]=n,this._inflate.write(t),e&&this._inflate.write(xi),this._inflate.flush((()=>{const t=this._inflate[Ii];if(t)return this._inflate.close(),this._inflate=null,void n(t);const o=wi.concat(this._inflate[ki],this._inflate[Ci]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ci]=0,this._inflate[ki]=[],e&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),n(null,o)}))}_compress(t,e,n){const r=this._isServer?"server":"client";if(!this._deflate){const t=`${r}_max_window_bits`,e="number"!=typeof this.params[t]?E.default.Z_DEFAULT_WINDOWBITS:this.params[t];this._deflate=E.default.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:e}),this._deflate[Ci]=0,this._deflate[ki]=[],this._deflate.on("data",Pi)}this._deflate[Oi]=n,this._deflate.write(t),this._deflate.flush(E.default.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let t=wi.concat(this._deflate[ki],this._deflate[Ci]);e&&(t=t.slice(0,t.length-4)),this._deflate[Oi]=null,this._deflate[Ci]=0,this._deflate[ki]=[],e&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),n(null,t)}))}};function Pi(t){this[ki].push(t),this[Ci]+=t.length}function Bi(t){this[Ci]+=t.length,this[Ai]._maxPayload<1||this[Ci]<=this[Ai]._maxPayload?this[ki].push(t):(this[Ii]=new RangeError("Max payload size exceeded"),this[Ii].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ii][Si]=1009,this.removeListener("data",Bi),this.reset())}function Ni(t){this[Ai]._inflate=null,t[Si]=1007,this[Oi](t)}var Li=function(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0},Ti=Xn((function(t){try{t.exports=ai(__dirname)}catch(e){t.exports=Li}})),Ri=Xn((function(t){const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function n(t){return t>=1e3&&t<=1014&&1004!==t&&1005!==t&&1006!==t||t>=3e3&&t<=4999}function r(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}try{const o=Ti;t.exports={isValidStatusCode:n,isValidUTF8:t=>t.length<150?r(t):o(t),tokenChars:e}}catch(o){t.exports={isValidStatusCode:n,isValidUTF8:r,tokenChars:e}}}));Ri.isValidStatusCode,Ri.isValidUTF8,Ri.tokenChars;const{Writable:Fi}=y.default,{BINARY_TYPES:Gi,EMPTY_BUFFER:Mi,kStatusCode:qi,kWebSocket:Wi}=Zo,{concat:zi,toArrayBuffer:$i,unmask:Ji}=wi,{isValidStatusCode:Hi,isValidUTF8:Vi}=Ri;var Yi=class extends Fi{constructor(t={}){super(),this._binaryType=t.binaryType||Gi[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=0|t.maxPayload,this._skipUTF8Validation=!!t.skipUTF8Validation,this[Wi]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(t,e,n){if(8===this._opcode&&0==this._state)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){const e=this._buffers[0];return this._buffers[0]=e.slice(t),e.slice(0,t)}const e=Buffer.allocUnsafe(t);do{const n=this._buffers[0],r=e.length-t;t>=n.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(n.buffer,n.byteOffset,t),r),this._buffers[0]=n.slice(t)),t-=n.length}while(t>0);return e}startLoop(t){let e;this._loop=!0;do{switch(this._state){case 0:e=this.getInfo();break;case 1:e=this.getPayloadLength16();break;case 2:e=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:e=this.getData(t);break;default:return void(this._loop=!1)}}while(this._loop);t(e)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(0!=(48&t[0]))return this._loop=!1,Zi(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const e=64==(64&t[0]);if(e&&!this._extensions[Di.extensionName])return this._loop=!1,Zi(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(e)return this._loop=!1,Zi(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,Zi(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,Zi(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=e}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,Zi(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,Zi(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(e)return this._loop=!1,Zi(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,Zi(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&t[1]),this._isServer){if(!this._masked)return this._loop=!1,Zi(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,Zi(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),e=t.readUInt32BE(0);return e>Math.pow(2,21)-1?(this._loop=!1,Zi(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=e*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,Zi(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(t){let e=Mi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);e=this.consume(this._payloadLength),this._masked&&0!=(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&Ji(e,this._mask)}return this._opcode>7?this.controlMessage(e):this._compressed?(this._state=5,void this.decompress(e,t)):(e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage())}decompress(t,e){this._extensions[Di.extensionName].decompress(t,this._fin,((t,n)=>{if(t)return e(t);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return e(Zi(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}const r=this.dataMessage();if(r)return e(r);this.startLoop(e)}))}dataMessage(){if(this._fin){const t=this._messageLength,e=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let n;n="nodebuffer"===this._binaryType?zi(e,t):"arraybuffer"===this._binaryType?$i(zi(e,t)):e,this.emit("message",n,!0)}else{const n=zi(e,t);if(!this._skipUTF8Validation&&!Vi(n))return this._loop=!1,Zi(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",n,!1)}}this._state=0}controlMessage(t){if(8===this._opcode)if(this._loop=!1,0===t.length)this.emit("conclude",1005,Mi),this.end();else{if(1===t.length)return Zi(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const e=t.readUInt16BE(0);if(!Hi(e))return Zi(RangeError,`invalid status code ${e}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const n=t.slice(2);if(!this._skipUTF8Validation&&!Vi(n))return Zi(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",e,n),this.end()}}else 9===this._opcode?this.emit("ping",t):this.emit("pong",t);this._state=0}};function Zi(t,e,n,r,o){const i=new t(n?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(i,Zi),i.code=o,i[qi]=r,i}const{randomFillSync:Ki}=I.default,{EMPTY_BUFFER:Xi}=Zo,{isValidStatusCode:Qi}=Ri,{mask:ts,toBuffer:es}=wi,ns=Symbol("kByteLength"),rs=Buffer.alloc(4);class os{constructor(t,e,n){this._extensions=e||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,e){let n,r,o=!1,i=2,s=!1;e.mask&&(n=e.maskBuffer||rs,e.generateMask?e.generateMask(n):Ki(n,0,4),s=0==(n[0]|n[1]|n[2]|n[3]),i=6),"string"==typeof t?r=e.mask&&!s||void 0===e[ns]?(t=Buffer.from(t)).length:e[ns]:(r=t.length,o=e.mask&&e.readOnly&&!s);let a=r;r>=65536?(i+=8,a=127):r>125&&(i+=2,a=126);const u=Buffer.allocUnsafe(o?r+i:i);return u[0]=e.fin?128|e.opcode:e.opcode,e.rsv1&&(u[0]|=64),u[1]=a,126===a?u.writeUInt16BE(r,2):127===a&&(u[2]=u[3]=0,u.writeUIntBE(r,4,6)),e.mask?(u[1]|=128,u[i-4]=n[0],u[i-3]=n[1],u[i-2]=n[2],u[i-1]=n[3],s?[u,t]:o?(ts(t,n,u,i,r),[u]):(ts(t,n,t,0,r),[u,t])):[u,t]}close(t,e,n,r){let o;if(void 0===t)o=Xi;else{if("number"!=typeof t||!Qi(t))throw new TypeError("First argument must be a valid error code number");if(void 0!==e&&e.length){const n=Buffer.byteLength(e);if(n>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+n),o.writeUInt16BE(t,0),"string"==typeof e?o.write(e,2):o.set(e,2)}else o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0)}const i={[ns]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,o,!1,i,r]):this.sendFrame(os.frame(o,i),r)}ping(t,e,n){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):(r=(t=es(t)).length,o=es.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const i={[ns]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,i,n]):this.sendFrame(os.frame(t,i),n)}pong(t,e,n){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):(r=(t=es(t)).length,o=es.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const i={[ns]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,i,n]):this.sendFrame(os.frame(t,i),n)}send(t,e,n){const r=this._extensions[Di.extensionName];let o,i,s=e.binary?2:1,a=e.compress;if("string"==typeof t?(o=Buffer.byteLength(t),i=!1):(o=(t=es(t)).length,i=es.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=o>=r._threshold),this._compress=a):(a=!1,s=0),e.fin&&(this._firstFragment=!0),r){const r={[ns]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:i,rsv1:a};this._deflating?this.enqueue([this.dispatch,t,this._compress,r,n]):this.dispatch(t,this._compress,r,n)}else this.sendFrame(os.frame(t,{[ns]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:i,rsv1:!1}),n)}dispatch(t,e,n,r){if(!e)return void this.sendFrame(os.frame(t,n),r);const o=this._extensions[Di.extensionName];this._bufferedBytes+=n[ns],this._deflating=!0,o.compress(t,n.fin,((t,e)=>{if(this._socket.destroyed){const t=new Error("The socket was closed while data was being compressed");"function"==typeof r&&r(t);for(let e=0;e<this._queue.length;e++){const n=this._queue[e],r=n[n.length-1];"function"==typeof r&&r(t)}}else this._bufferedBytes-=n[ns],this._deflating=!1,n.readOnly=!1,this.sendFrame(os.frame(e,n),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const t=this._queue.shift();this._bufferedBytes-=t[3][ns],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][ns],this._queue.push(t)}sendFrame(t,e){2===t.length?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}}var is=os;const{kForOnEventAttribute:ss,kListener:as}=Zo,us=Symbol("kCode"),cs=Symbol("kData"),ls=Symbol("kError"),ds=Symbol("kMessage"),ps=Symbol("kReason"),hs=Symbol("kTarget"),fs=Symbol("kType"),vs=Symbol("kWasClean");class ms{constructor(t){this[hs]=null,this[fs]=t}get target(){return this[hs]}get type(){return this[fs]}}Object.defineProperty(ms.prototype,"target",{enumerable:!0}),Object.defineProperty(ms.prototype,"type",{enumerable:!0});class bs extends ms{constructor(t,e={}){super(t),this[us]=void 0===e.code?0:e.code,this[ps]=void 0===e.reason?"":e.reason,this[vs]=void 0!==e.wasClean&&e.wasClean}get code(){return this[us]}get reason(){return this[ps]}get wasClean(){return this[vs]}}Object.defineProperty(bs.prototype,"code",{enumerable:!0}),Object.defineProperty(bs.prototype,"reason",{enumerable:!0}),Object.defineProperty(bs.prototype,"wasClean",{enumerable:!0});class ys extends ms{constructor(t,e={}){super(t),this[ls]=void 0===e.error?null:e.error,this[ds]=void 0===e.message?"":e.message}get error(){return this[ls]}get message(){return this[ds]}}Object.defineProperty(ys.prototype,"error",{enumerable:!0}),Object.defineProperty(ys.prototype,"message",{enumerable:!0});class gs extends ms{constructor(t,e={}){super(t),this[cs]=void 0===e.data?null:e.data}get data(){return this[cs]}}Object.defineProperty(gs.prototype,"data",{enumerable:!0});const ws={addEventListener(t,e,n={}){let r;if("message"===t)r=function(t,n){const r=new gs("message",{data:n?t:t.toString()});r[hs]=this,e.call(this,r)};else if("close"===t)r=function(t,n){const r=new bs("close",{code:t,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[hs]=this,e.call(this,r)};else if("error"===t)r=function(t){const n=new ys("error",{error:t,message:t.message});n[hs]=this,e.call(this,n)};else{if("open"!==t)return;r=function(){const t=new ms("open");t[hs]=this,e.call(this,t)}}r[ss]=!!n[ss],r[as]=e,n.once?this.once(t,r):this.on(t,r)},removeEventListener(t,e){for(const n of this.listeners(t))if(n[as]===e&&!n[ss]){this.removeListener(t,n);break}}};var _s={CloseEvent:bs,ErrorEvent:ys,Event:ms,EventTarget:ws,MessageEvent:gs};const{tokenChars:js}=Ri;function Es(t,e,n){void 0===t[e]?t[e]=[n]:t[e].push(n)}var Ss={format:function(t){return Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>[e].concat(Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>!0===t?e:`${e}=${t}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(t){const e=Object.create(null);let n,r,o=Object.create(null),i=!1,s=!1,a=!1,u=-1,c=-1,l=-1,d=0;for(;d<t.length;d++)if(c=t.charCodeAt(d),void 0===n)if(-1===l&&1===js[c])-1===u&&(u=d);else if(0===d||32!==c&&9!==c){if(59!==c&&44!==c)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d);const r=t.slice(u,l);44===c?(Es(e,r,o),o=Object.create(null)):n=r,u=l=-1}}else-1===l&&-1!==u&&(l=d);else if(void 0===r)if(-1===l&&1===js[c])-1===u&&(u=d);else if(32===c||9===c)-1===l&&-1!==u&&(l=d);else if(59===c||44===c){if(-1===u)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d),Es(o,t.slice(u,l),!0),44===c&&(Es(e,n,o),o=Object.create(null),n=void 0),u=l=-1}else{if(61!==c||-1===u||-1!==l)throw new SyntaxError(`Unexpected character at index ${d}`);r=t.slice(u,d),u=l=-1}else if(s){if(1!==js[c])throw new SyntaxError(`Unexpected character at index ${d}`);-1===u?u=d:i||(i=!0),s=!1}else if(a)if(1===js[c])-1===u&&(u=d);else if(34===c&&-1!==u)a=!1,l=d;else{if(92!==c)throw new SyntaxError(`Unexpected character at index ${d}`);s=!0}else if(34===c&&61===t.charCodeAt(d-1))a=!0;else if(-1===l&&1===js[c])-1===u&&(u=d);else if(-1===u||32!==c&&9!==c){if(59!==c&&44!==c)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d);let s=t.slice(u,l);i&&(s=s.replace(/\\/g,""),i=!1),Es(o,r,s),44===c&&(Es(e,n,o),o=Object.create(null),n=void 0),r=void 0,u=l=-1}}else-1===l&&(l=d);if(-1===u||a||32===c||9===c)throw new SyntaxError("Unexpected end of input");-1===l&&(l=d);const p=t.slice(u,l);return void 0===n?Es(e,p,o):(void 0===r?Es(o,p,!0):Es(o,r,i?p.replace(/\\/g,""):p),Es(e,n,o)),e}};const{randomBytes:xs,createHash:As}=I.default,{URL:Cs}=w.default,{BINARY_TYPES:Os,EMPTY_BUFFER:ks,GUID:Is,kForOnEventAttribute:Us,kListener:Ds,kStatusCode:Ps,kWebSocket:Bs,NOOP:Ns}=Zo,{EventTarget:{addEventListener:Ls,removeEventListener:Ts}}=_s,{format:Rs,parse:Fs}=Ss,{toBuffer:Gs}=wi,Ms=["CONNECTING","OPEN","CLOSING","CLOSED"],qs=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Ws=[8,13];class zs extends b.default{constructor(t,e,n){super(),this._binaryType=Os[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ks,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=zs.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==t?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===e?e=[]:Array.isArray(e)||("object"==typeof e&&null!==e?(n=e,e=[]):e=[e]),Js(this,t,e,n)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){Os.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,n){const r=new Yi({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation});this._sender=new is(t,this._extensions,n.generateMask),this._receiver=r,this._socket=t,r[Bs]=this,t[Bs]=this,r.on("conclude",Xs),r.on("drain",Qs),r.on("error",ta),r.on("message",na),r.on("ping",ra),r.on("pong",oa),t.setTimeout(0),t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",sa),t.on("data",aa),t.on("end",ua),t.on("error",ca),this._readyState=zs.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=zs.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[Di.extensionName]&&this._extensions[Di.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=zs.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==zs.CLOSED){if(this.readyState===zs.CONNECTING){const t="WebSocket was closed before the connection was established";return Zs(this,this._req,t)}this.readyState!==zs.CLOSING?(this._readyState=zs.CLOSING,this._sender.close(t,e,!this._isServer,(t=>{t||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==zs.CONNECTING&&this.readyState!==zs.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,e,n){if(this.readyState===zs.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===zs.OPEN?(void 0===e&&(e=!this._isServer),this._sender.ping(t||ks,e,n)):Ks(this,t,n)}pong(t,e,n){if(this.readyState===zs.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===zs.OPEN?(void 0===e&&(e=!this._isServer),this._sender.pong(t||ks,e,n)):Ks(this,t,n)}resume(){this.readyState!==zs.CONNECTING&&this.readyState!==zs.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,n){if(this.readyState===zs.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof e&&(n=e,e={}),"number"==typeof t&&(t=t.toString()),this.readyState!==zs.OPEN)return void Ks(this,t,n);const r={binary:"string"!=typeof t,mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[Di.extensionName]||(r.compress=!1),this._sender.send(t||ks,r,n)}terminate(){if(this.readyState!==zs.CLOSED){if(this.readyState===zs.CONNECTING){const t="WebSocket was closed before the connection was established";return Zs(this,this._req,t)}this._socket&&(this._readyState=zs.CLOSING,this._socket.destroy())}}}Object.defineProperty(zs,"CONNECTING",{enumerable:!0,value:Ms.indexOf("CONNECTING")}),Object.defineProperty(zs.prototype,"CONNECTING",{enumerable:!0,value:Ms.indexOf("CONNECTING")}),Object.defineProperty(zs,"OPEN",{enumerable:!0,value:Ms.indexOf("OPEN")}),Object.defineProperty(zs.prototype,"OPEN",{enumerable:!0,value:Ms.indexOf("OPEN")}),Object.defineProperty(zs,"CLOSING",{enumerable:!0,value:Ms.indexOf("CLOSING")}),Object.defineProperty(zs.prototype,"CLOSING",{enumerable:!0,value:Ms.indexOf("CLOSING")}),Object.defineProperty(zs,"CLOSED",{enumerable:!0,value:Ms.indexOf("CLOSED")}),Object.defineProperty(zs.prototype,"CLOSED",{enumerable:!0,value:Ms.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((t=>{Object.defineProperty(zs.prototype,t,{enumerable:!0})})),["open","error","close","message"].forEach((t=>{Object.defineProperty(zs.prototype,`on${t}`,{enumerable:!0,get(){for(const e of this.listeners(t))if(e[Us])return e[Ds];return null},set(e){for(const e of this.listeners(t))if(e[Us]){this.removeListener(t,e);break}"function"==typeof e&&this.addEventListener(t,e,{[Us]:!0})}})})),zs.prototype.addEventListener=Ls,zs.prototype.removeEventListener=Ts;var $s=zs;function Js(t,e,n,r){const o={protocolVersion:Ws[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!Ws.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${Ws.join(", ")})`);let i;if(e instanceof Cs)i=e,t._url=e.href;else{try{i=new Cs(e)}catch(t){throw new SyntaxError(`Invalid URL: ${e}`)}t._url=e}const s="wss:"===i.protocol,a="ws+unix:"===i.protocol;let u;if("ws:"===i.protocol||s||a?a&&!i.pathname?u="The URL's pathname is empty":i.hash&&(u="The URL contains a fragment identifier"):u='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',u){const e=new SyntaxError(u);if(0===t._redirects)throw e;return void Hs(t,e)}const c=s?443:80,l=xs(16).toString("base64"),d=s?j.default.get:g.default.get,p=new Set;let h;if(o.createConnection=s?Ys:Vs,o.defaultPort=o.defaultPort||c,o.port=i.port||c,o.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,o.headers={"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket",...o.headers},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(h=new Di(!0!==o.perMessageDeflate?o.perMessageDeflate:{},!1,o.maxPayload),o.headers["Sec-WebSocket-Extensions"]=Rs({[Di.extensionName]:h.offer()})),n.length){for(const t of n){if("string"!=typeof t||!qs.test(t)||p.has(t))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(t)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.password}`),a){const t=o.path.split(":");o.socketPath=t[0],o.path=t[1]}if(o.followRedirects){if(0===t._redirects){t._originalHost=i.host;const e=r&&r.headers;if(r={...r,headers:{}},e)for(const[t,n]of Object.entries(e))r.headers[t.toLowerCase()]=n}else i.host!==t._originalHost&&(delete o.headers.authorization,delete o.headers.cookie,delete o.headers.host,o.auth=void 0);o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64"))}let f=t._req=d(o);o.timeout&&f.on("timeout",(()=>{Zs(t,f,"Opening handshake has timed out")})),f.on("error",(e=>{null===f||f.aborted||(f=t._req=null,Hs(t,e))})),f.on("response",(i=>{const s=i.headers.location,a=i.statusCode;if(s&&o.followRedirects&&a>=300&&a<400){if(++t._redirects>o.maxRedirects)return void Zs(t,f,"Maximum redirects exceeded");let i;f.abort();try{i=new Cs(s,e)}catch(e){const n=new SyntaxError(`Invalid URL: ${s}`);return void Hs(t,n)}Js(t,i,n,r)}else t.emit("unexpected-response",f,i)||Zs(t,f,`Unexpected server response: ${i.statusCode}`)})),f.on("upgrade",((e,n,r)=>{if(t.emit("upgrade",e),t.readyState!==zs.CONNECTING)return;f=t._req=null;const i=As("sha1").update(l+Is).digest("base64");if(e.headers["sec-websocket-accept"]!==i)return void Zs(t,n,"Invalid Sec-WebSocket-Accept header");const s=e.headers["sec-websocket-protocol"];let a;if(void 0!==s?p.size?p.has(s)||(a="Server sent an invalid subprotocol"):a="Server sent a subprotocol but none was requested":p.size&&(a="Server sent no subprotocol"),a)return void Zs(t,n,a);s&&(t._protocol=s);const u=e.headers["sec-websocket-extensions"];if(void 0!==u){if(!h){return void Zs(t,n,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let e;try{e=Fs(u)}catch(e){return void Zs(t,n,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(e);if(1!==r.length||r[0]!==Di.extensionName){return void Zs(t,n,"Server indicated an extension that was not requested")}try{h.accept(e[Di.extensionName])}catch(e){return void Zs(t,n,"Invalid Sec-WebSocket-Extensions header")}t._extensions[Di.extensionName]=h}t.setSocket(n,r,{generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}))}function Hs(t,e){t._readyState=zs.CLOSING,t.emit("error",e),t.emitClose()}function Vs(t){return t.path=t.socketPath,x.default.connect(t)}function Ys(t){return t.path=void 0,t.servername||""===t.servername||(t.servername=x.default.isIP(t.host)?"":t.host),k.default.connect(t)}function Zs(t,e,n){t._readyState=zs.CLOSING;const r=new Error(n);Error.captureStackTrace(r,Zs),e.setHeader?(e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),e.once("abort",t.emitClose.bind(t)),t.emit("error",r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function Ks(t,e,n){if(e){const n=Gs(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(n){n(new Error(`WebSocket is not open: readyState ${t.readyState} (${Ms[t.readyState]})`))}}function Xs(t,e){const n=this[Bs];n._closeFrameReceived=!0,n._closeMessage=e,n._closeCode=t,void 0!==n._socket[Bs]&&(n._socket.removeListener("data",aa),process.nextTick(ia,n._socket),1005===t?n.close():n.close(t,e))}function Qs(){const t=this[Bs];t.isPaused||t._socket.resume()}function ta(t){const e=this[Bs];void 0!==e._socket[Bs]&&(e._socket.removeListener("data",aa),process.nextTick(ia,e._socket),e.close(t[Ps])),e.emit("error",t)}function ea(){this[Bs].emitClose()}function na(t,e){this[Bs].emit("message",t,e)}function ra(t){const e=this[Bs];e.pong(t,!e._isServer,Ns),e.emit("ping",t)}function oa(t){this[Bs].emit("pong",t)}function ia(t){t.resume()}function sa(){const t=this[Bs];let e;this.removeListener("close",sa),this.removeListener("data",aa),this.removeListener("end",ua),t._readyState=zs.CLOSING,this._readableState.endEmitted||t._closeFrameReceived||t._receiver._writableState.errorEmitted||null===(e=t._socket.read())||t._receiver.write(e),t._receiver.end(),this[Bs]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",ea),t._receiver.on("finish",ea))}function aa(t){this[Bs]._receiver.write(t)||this.pause()}function ua(){const t=this[Bs];t._readyState=zs.CLOSING,t._receiver.end(),this.end()}function ca(){const t=this[Bs];this.removeListener("error",ca),this.on("error",Ns),t&&(t._readyState=zs.CLOSING,this.destroy())}var la=function(t){function n(e,n,r,o,i){void 0===i&&(i=5e3);var s=t.call(this)||this;s.endpoint=e,s.headers=n,s.rewriteHostHeader=r,s.bindToAssign=o,s.closeTimeout=i,s.protocol="TCP",s.openConnections=new Set,s.tcpServer=A.createServer(s.handleConnection.bind(s));var a=null==r?void 0:r.altHostnames.map((function(t){return(e=De(e=t))&&zn.test(e)?e.replace(Wn,"\\$&"):e;var e})).join("|");return s.hostRegex=new RegExp("Host: (?:".concat(a,")(:.*$|$)"),"im"),s}return P(n,t),Object.defineProperty(n.prototype,"bindTo",{get:function(){var t;return null!==(t=this.boundTo)&&void 0!==t?t:this.bindToAssign},enumerable:!1,configurable:!0}),n.prototype.open=function(){return N(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){return[2,new Promise((function(e){if(t.bindToAssign){var n=t.bindToAssign,r=n.port,o=n.address;t.tcpServer.listen(r,o,(function(){t.emit("tunnel-open",{address:o,port:r}),e({address:o,port:r})}))}else t.tcpServer.listen(0,(function(){var n=t.tcpServer.address(),r=n.address,o=n.port,i="0.0.0.0"===r||"::"===r?"127.0.0.1":r;t.boundTo={address:i,port:o},t.emit("tunnel-open",t.boundTo),e(t.boundTo)}))}))]}))}))},n.prototype.close=function(){return N(this,void 0,void 0,(function(){var t,e=this;return L(this,(function(n){switch(n.label){case 0:return t=!1,[4,Promise.race([new Promise((function(n){e.tcpServer.close((function(){t=!0,e.emit("tunnel-close"),n()}))})),new Promise((function(n){new Promise((function(t){return setTimeout(t,e.closeTimeout)})).then((function(){t||(e.openConnections.forEach((function(t){t.destroy(),e.openConnections.delete(t)})),n())}))}))])];case 1:return n.sent(),[2]}}))}))},n.prototype.handleConnection=function(t){var e=this;this.openConnections.add(t);var n=new $s(this.endpoint.replace("https:","wss:"),{headers:this.headers}),r=Yo(n),o=this.getHeaderTransform();this.rewriteHostHeader&&o?zo(t,o,r):zo(t,r),zo(r,t),n.on("close",(function(t,n,r){e.emit("connection-close",t,n,r)})),r.on("error",(function(t){e.emit("connection-error",t)})),t.on("error",(function(t){e.emit("connection-error",t)})),this.emit("connection-accept")},n.prototype.getHeaderTransform=function(){if(this.rewriteHostHeader){var t=this.rewriteHostHeader.targetHostname,n=this.hostRegex;return new e.Transform({transform:function(e,r,o){var i=e.toString();if(i.split("\n",1)[0].includes("HTTP")){var s=i.replace(n,"Host: ".concat(t));o(null,Buffer.from(s))}else o(null,e)}})}},n}(t.EventEmitter),da=function(t){function e(e,n,r){var o=t.call(this)||this;return o.endpoint=e,o.headers=n,o.bindToAssign=r,o.protocol="UDP",o.udpSocket=U.default.createSocket("udp4"),o.handleConnection(),o}return P(e,t),Object.defineProperty(e.prototype,"bindTo",{get:function(){return this.boundTo},enumerable:!1,configurable:!0}),e.prototype.open=function(){return N(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){return[2,new Promise((function(e){if(t.bindToAssign){var n=t.bindToAssign,r=n.port,o=n.address;t.udpSocket.bind(r,o,(function(){t.emit("tunnel-open",{address:o,port:r}),e({address:o,port:r})}))}else t.udpSocket.bind(0,(function(){var n=t.udpSocket.address(),r=n.address,o=n.port,i="0.0.0.0"===r||"::"===r?"127.0.0.1":r;t.boundTo={address:i,port:o},t.emit("tunnel-open",t.boundTo),e(t.boundTo)}))}))]}))}))},e.prototype.close=function(){return N(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){t.udpSocket.close((function(){t.emit("tunnel-close"),e()}))}))];case 1:return e.sent(),[2]}}))}))},e.prototype.handleConnection=function(){var t,e=this,n=new $s(this.endpoint.replace("https:","wss:"),{headers:this.headers}),r=Yo(n);this.udpSocket.on("message",(function(e,n){t=n,r.write(e)})),r.on("data",(function(n){t&&e.udpSocket.send(n,t.port,t.address,(function(t){t&&e.emit("connection-error",t)}))})),this.udpSocket.on("error",(function(t){e.emit("connection-error",t)})),r.on("error",(function(t){e.emit("connection-error",t)})),n.on("connection-close",(function(t,n,r){e.emit("connection-close",t,n,r)})),n.on("connection-error",(function(t){e.emit("connection-error",t)})),this.emit("connection-accept")},e}(t.EventEmitter);var pa="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,ha=function(t,e){return N(void 0,void 0,void 0,(function(){var n;return L(this,(function(r){return n=Promise.resolve([]),[2,t.reduce((function(t,n){return t.then((function(t){return e(n).then((function(e){return t.push(e),t}))}))}),n)]}))}))},fa=function(t){function e(e,n,r){var o=t.call(this)||this;return o.contextProvider=e,o.listServices=n,o.listAddons=r,o.connections=[],o.hostsFileMutex=new ko,o.ipAllocationMutex=new ko,o.stopForwarding=function(t){return N(o,void 0,void 0,(function(){var e,n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:return[4,t.tunnel.close()];case 1:return a.sent(),e=t.forwardingContext,n=e.projectId,r=e.type,o=e.id,(i=e.hostnames).length>0?[4,this.unregisterHostnames(null===(s=t.tunnel.bindTo)||void 0===s?void 0:s.address,i)]:[3,3];case 2:a.sent(),a.label=3;case 3:return this.connections.splice(this.connections.findIndex((function(t){var e=t.forwardingContext,i=e.type,s=e.id,a=e.projectId;return s===o&&a===n&&i===r})),1),[2]}}))}))},o.canExecuteWithHostnames=function(){return"win32"!==process.platform?process.getuid&&0!==process.getuid()?{error:!0,message:"You are not running this command with sufficient privileges (uid=".concat(process.getuid(),"). Try running with 'sudo'.")}:{error:!1,type:"unix-admin"}:function(){try{return c.execSync("fsutil dirty query %systemdrive%"),!0}catch(t){if("ENOENT"===t.code)try{return c.execSync("fltmc"),!0}catch(t){return!1}return!1}}()?{error:!1,type:"windows-admin"}:{error:!0,message:"You are not running this command as administrator. Please start command line with admin rights."}},o.assertStartedWithNodejs=function(){if(!pa)throw new Error("Port forwarding only possible when started with nodejs")},o.proxyApiClient=new ao(e),o}return P(e,t),e.prototype.withProjectForwarding=function(t,e,n){return void 0===n&&(n=!0),N(this,void 0,void 0,(function(){var r;return L(this,(function(o){switch(o.label){case 0:return[4,this.forwardProject(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopProjectForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardProject=function(t,e){return void 0===e&&(e=!0),N(this,void 0,void 0,(function(){var n,r,o,i,s,a=this;return L(this,(function(u){switch(u.label){case 0:return this.assertStartedWithNodejs(),n=t.projectId,[4,this.listServices({parameters:{projectId:n}})];case 1:return r=u.sent(),[4,this.listAddons({parameters:{projectId:n}})];case 2:return o=u.sent(),[4,Promise.all(r.data.services.map((function(t){return N(a,void 0,void 0,(function(){return L(this,(function(r){return[2,this.forwardService({projectId:n,serviceId:t.id},e)]}))}))})))];case 3:return i=u.sent(),[4,Promise.all(o.data.addons.map((function(t){return N(a,void 0,void 0,(function(){return L(this,(function(r){switch(r.label){case 0:return[4,this.forwardAddon({projectId:n,addonId:t.id},e)];case 1:return[2,r.sent()]}}))}))})))];case 4:return s=u.sent(),[2,{services:i,addons:s}]}}))}))},e.prototype.withServiceForwarding=function(t,e,n){return void 0===n&&(n=!0),N(this,void 0,void 0,(function(){var r;return L(this,(function(o){switch(o.label){case 0:return[4,this.forwardService(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopServiceForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardService=function(t,e){return void 0===e&&(e=!0),N(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c=this;return L(this,(function(l){switch(l.label){case 0:return this.assertStartedWithNodejs(),n=t.projectId,r=t.serviceId,[4,this.proxyApiClient.getServiceDetails(n,r)];case 1:return o=l.sent(),i=o.namespace,s=o.targetDomain,a=o.instances,u=o.ports,0===a.length?[2,[]]:[4,ha(u,(function(t){var o,u="https://".concat(s,"/tunnel/projects/").concat(n,"/services/").concat(r,"/instance/").concat(a[0].podName,"/port/").concat(t.internalPort),l="".concat(r,".").concat(i,".svc.cluster.local"),d=["".concat(r)];t.name&&d.push("".concat(t.name,".").concat(r)),"HTTP"===t.protocol&&(o={altHostnames:d,targetHostname:l});var p=e?[]:T([l],d,!0);return c.forwardPort(u,t,p,"service",r,n,e,o)}))];case 2:return[2,l.sent()]}}))}))},e.prototype.withAddonForwarding=function(t,e,n){return void 0===n&&(n=!0),N(this,void 0,void 0,(function(){var r;return L(this,(function(o){switch(o.label){case 0:return[4,this.forwardAddon(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopAddonForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardAddon=function(t,e){return void 0===e&&(e=!0),N(this,void 0,void 0,(function(){var n,r,o,i,s=this;return L(this,(function(a){switch(a.label){case 0:return this.assertStartedWithNodejs(),n=t.addonId,r=t.projectId,[4,this.proxyApiClient.getAddonDetails(r,n)];case 1:return o=a.sent(),i=o.instances.map((function(t){var e=t.podName,n=t.internalHostname;return t.ports.map((function(t){return{podName:e,internalHostname:n,port:t}}))})),[4,ha((u=i,null!=u&&u.length?Fe(u,1/0):[]),(function(t){var i=t.podName,a=t.internalHostname,u=t.port;return N(s,void 0,void 0,(function(){var t;return L(this,(function(s){return t="https://".concat(o.targetDomain,"/tunnel/projects/").concat(r,"/addons/").concat(n,"/instance/").concat(i,"/port/").concat(u.internalPort),[2,this.forwardPort(t,u,e?[]:[a],"addon",n,r,e)]}))}))}))];case 2:return[2,a.sent()]}var u}))}))},e.prototype.allocateIpAddress=function(t){return N(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){return[2,this.ipAllocationMutex.enter((function(){return N(e,void 0,void 0,(function(){var e,n,r,o,i;return L(this,(function(s){switch(s.label){case 0:return e="127.24.1.1",n="127.24.255.255",r=null!==(i=this.nextIpAddress)&&void 0!==i?i:e,[4,uo(t,r,n)];case 1:return o=s.sent(),this.nextIpAddress=ho(po(o)+1),po(this.nextIpAddress)>po(n)&&(this.nextIpAddress=e),[2,o]}}))}))}))]}))}))},e.prototype.forwardPort=function(t,e,n,r,o,i,s,a){var u;return void 0===s&&(s=!0),N(this,void 0,void 0,(function(){var c,l,d,p,h,f,v=this;return L(this,(function(m){switch(m.label){case 0:if(c={Authorization:"Bearer ".concat(this.contextProvider.getCurrentToken())},!s&&(l=this.canExecuteWithHostnames()).error)throw new Error("".concat(l.message," Alternatively, you can use the ipOnly mode when port-forwarding (apiClient.forwarding.forwardAddon({ projectId, addonId }, true))"));return[4,this.determineSocketAddress(i,o,r,e,s)];case 1:return d=m.sent(),p="UDP"===e.protocol?new da(t,c,d):new la(t,c,a,d),s?[3,3]:[4,this.registerHostnames(null===(u=p.bindTo)||void 0===u?void 0:u.address,n)];case 2:m.sent(),m.label=3;case 3:return p.on("connection-accept",(function(){return v.emit("connection-accept",p)})),p.on("connection-close",(function(){return N(v,void 0,void 0,(function(){return L(this,(function(t){return[2,this.emit("connection-close",p)]}))}))})),[4,p.open()];case 4:return h=m.sent(),f={projectId:i,id:o,type:r,hostnames:n,port:h.port,address:h.address,protocol:e.protocol,portName:e.name},this.emit("tunnel-open",p,f),p.on("connection-error",(function(t){return v.emit("connection-error",p,f,t)})),p.on("tunnel-close",(function(){return v.emit("tunnel-close",p,f)})),this.connections.push({tunnel:p,forwardingContext:f}),[2,{data:f}]}}))}))},e.prototype.determineSocketAddress=function(t,e,n,r,o){var i;return N(this,void 0,void 0,(function(){var s,a,u;return L(this,(function(c){switch(c.label){case 0:return o?[2,void 0]:(s=this.connections.find((function(r){return r.forwardingContext.projectId===t&&r.forwardingContext.id===e&&r.forwardingContext.type===n})),a=(null===(i=null==s?void 0:s.forwardingContext)||void 0===i?void 0:i.port)!==r.internalPort,s&&a?[2,{address:s.forwardingContext.address,port:r.internalPort}]:(u={},[4,this.allocateIpAddress(r.internalPort)]));case 1:return[2,(u.address=c.sent(),u.port=r.internalPort,u)]}}))}))},e.prototype.registerHostnames=function(t,e){return N(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,this.modifyHostsFile((function(n){n.removeHosts.apply(n,e),n.add.apply(n,T([t],e,!1))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.unregisterHostnames=function(t,e){return N(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,this.modifyHostsFile((function(n){n.remove.apply(n,T([t],e,!1))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.modifyHostsFile=function(t){return N(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,this.hostsFileMutex.enter((function(){return N(e,void 0,void 0,(function(){var e,n=this;return L(this,(function(r){switch(r.label){case 0:return[4,Oo.load({header:"Northflank Proxy"})];case 1:return e=r.sent(),t(e),[4,e.backup({suffix:".backup-pre-northflank"})];case 2:r.sent(),r.label=3;case 3:return r.trys.push([3,5,,7]),[4,va(5)((function(){return N(n,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return[4,e.write({writeMode:"atomic"})];case 1:return t.sent(),[2]}}))}))}))];case 4:return r.sent(),[3,7];case 5:return r.sent(),[4,va(5)((function(){return N(n,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return[4,e.write({writeMode:"standard"})];case 1:return t.sent(),[2]}}))}))}))];case 6:return r.sent(),[3,7];case 7:return[2]}}))}))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopProjectForwarding=function(t){return N(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return e.forwardingContext.projectId===t.projectId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopServiceForwarding=function(t){return N(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return"service"===e.forwardingContext.type&&e.forwardingContext.projectId===t.projectId&&e.forwardingContext.id===t.serviceId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopAddonForwarding=function(t){return N(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return"addon"===e.forwardingContext.type&&e.forwardingContext.projectId===t.projectId&&e.forwardingContext.id===t.addonId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stop=function(){return N(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this.connections.map((function(e){return N(t,void 0,void 0,(function(){return L(this,(function(t){return[2,this.stopForwarding(e)]}))}))})))];case 1:return e.sent(),[2]}}))}))},e}(t.EventEmitter),va=function(t,e){return void 0===e&&(e=50),function(n){var r=t,o=function(){return N(void 0,void 0,void 0,(function(){var t;return L(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,4]),[4,n()];case 1:return[2,i.sent()];case 2:if(t=i.sent(),r<=0)throw t;return r-=1,[4,new Promise((function(t){return setTimeout((function(){return t()}),e)}))];case 3:return i.sent(),[2,o()];case 4:return[2]}}))}))};return o()}},ma=pa?so:window.fetch,ba=function(){if(pa)try{return JSON.parse(C.default.readFileSync(O.default.join(O.default.dirname(r.fileURLToPath("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("api-client.js",document.baseURI).href)),"../../package.json")).toString())}catch(t){return console.log("Failed to check version of northflank CLI (".concat(t.message,")")),{}}return{}},ya=function(){function t(t,e){var n=this;this.opts=e,this.call=function(t){return N(n,void 0,void 0,(function(){var e,n,r,o,i,s,a,u,c,l,d,p,h=this;return L(this,(function(f){switch(f.label){case 0:if(e=this.method,n={method:e,headers:this.getDefaultHeaders()},!(r=null===(p=this.contextProvider)||void 0===p?void 0:p.getCurrentBaseUrl()))throw new Error("Api client context not correctly initialized, please provide a url to the context.");return o="".concat(r).concat(this.endpointUrl(t)),i=this.body(t),s=B(B({url:o},n),{body:i}),[4,ja(o,B(B({},n),{body:i}))];case 1:return[4,(a=f.sent()).text()];case 2:return u=f.sent(),c=function(){if(200!==a.status){var t=null==l?void 0:l.error,e=401===a.status?" (Make sure your API token has sufficient permissions)":"",n="".concat((null==t?void 0:t.message)||"").concat(e);if(h.opts.throwErrorOnHttpErrorCode)throw Error(n);return{status:a.status,message:n,id:null==t?void 0:t.id,details:null==t?void 0:t.details}}},l=function(){try{return JSON.parse(u)}catch(t){throw Error("Failed reading api request result: \n\tStatus: ".concat(a.statusText," (").concat(a.status,")\n\tMessage: ").concat(u))}}(),d=c(),[2,{data:null==l?void 0:l.data,rawResponse:a,request:s,error:d,pagination:null==l?void 0:l.pagination}]}}))}))},this.contextProvider=t}return t.prototype.getDefaultHeaders=function(){var t,e,n=this.contextProvider.getCurrentToken(),r=(null===(t=this.opts)||void 0===t?void 0:t.customUserAgent)?" (".concat(this.opts.customUserAgent,")"):"";return{Authorization:this.withAuth?"Bearer ".concat(n):void 0,"Content-Type":"application/json","User-Agent":"northflank-js-client/".concat(null===(e=ba())||void 0===e?void 0:e.version).concat(r)}},t}(),ga=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="get",e.body=function(){},e}return P(e,t),e}(ya),wa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="post",e}return P(e,t),e}(ya),_a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="delete",e.body=function(){},e}return P(e,t),e}(ya),ja=function(t,e,n,r){return void 0===e&&(e={}),void 0===n&&(n=3),void 0===r&&(r=500),new Promise((function(o,i){var s=function(n){return ma(t,e).then((function(t){o(t)})).catch((function(t){return N(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return n>0?[4,(o=r,new Promise((function(t){setTimeout((function(){t()}),o)})))]:[3,2];case 1:return e.sent(),[2,s(n-1)];case 2:return[2,i(t)]}var o}))}))}))};return s(n)}))},Ea=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists projects for the authenticated user or team.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects".concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Sa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new project.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects"},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),xa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get information about the given project",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId)},e.body=function(){},e}return P(e,t),e}(ga),Aa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Delete the given project. Fails if the project isn't empty.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId)},e.body=function(){},e}return P(e,t),e}(_a),Ca=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of addons belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Oa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),ka=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return P(e,t),e}(ga),Ia=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return P(e,t),e}(_a),Ua=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the credentials for connecting to the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/credentials")},e.body=function(){},e}return P(e,t),e}(ga),Da=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the available addon types",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/addon-types"},e.body=function(){},e}return P(e,t),e}(ga),Pa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the allocated resources for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ba=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the current addon version including available upgrades and upgrade history.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/version")},e.body=function(){},e}return P(e,t),e}(ga),Na=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Upgrades the addon to a new version.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/version")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),La=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the network settings for the addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/network-settings")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the security rules for the addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/security")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ra=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns a list of backups for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Fa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Initiates a backup for the given addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ga=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about a given backup including restore history",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId)},e.body=function(){},e}return P(e,t),e}(ga),Ma=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a given backup",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId)},e.body=function(){},e}return P(e,t),e}(_a),qa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restores the given addon to the given backup state.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/restore")},e.body=function(){},e}return P(e,t),e}(wa),Wa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Imports a database from an external archive or existing live database.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/import")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/containers").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),$a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Pause the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/pause")},e.body=function(){},e}return P(e,t),e}(wa),Ja=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Resume the given addon if it is paused.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/resume")},e.body=function(){},e}return P(e,t),e}(wa),Ha=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restart the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/restart")},e.body=function(){},e}return P(e,t),e}(wa),Va=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the in progress backup.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/abort")},e.body=function(){},e}return P(e,t),e}(wa),Ya=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Generates a temporary download link for downloading the given backup.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/download-link")},e.body=function(){},e}return P(e,t),e}(ga),Za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts an in-progress backup restore.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/abort-restore")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ka=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of jobs belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Xa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId)},e.body=function(){},e}return P(e,t),e}(ga),Qa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId)},e.body=function(){},e}return P(e,t),e}(_a),tu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new manual job that only runs when initiated via the UI, CLI, API or JS client.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/manual")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),eu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new cron job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/cron")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),nu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Fetches run history for the given job",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Starts a new job run for the given job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),ou=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns data about the given job run",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs/").concat(t.parameters.runId)},e.body=function(){},e}return P(e,t),e}(ga),iu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given job run",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs/").concat(t.parameters.runId)},e.body=function(){},e}return P(e,t),e}(_a),su=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates settings for the job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/settings")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),au=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the health checks for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/health-checks")},e.body=function(){},e}return P(e,t),e}(ga),uu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates health checks for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/health-checks")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),cu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists builds for the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),lu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Start a new build for the given job. Given a commit sha, it will build that commit.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),du=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about a build for the job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return P(e,t),e}(ga),pu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given job build",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return P(e,t),e}(_a),hu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the build options for a given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-options")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),fu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the version control source for a given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-source")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),vu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the Docker CMD override for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/cmd-override")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),mu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the build arguments of the given job. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),bu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets build arguments for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),yu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the build arguments accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments/details")},e.body=function(){},e}return P(e,t),e}(ga),gu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the runtime environment for the given job. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runtime-environment").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),wu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the runtime environment for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runtime-environment")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),_u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the runtime environment accessible by the given job. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runtime-environment/details")},e.body=function(){},e}return P(e,t),e}(ga),ju=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the deployment of the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/deployment")},e.body=function(){},e}return P(e,t),e}(ga),Eu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the deployment settings of the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Su=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/containers").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),xu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the branches of the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/branches").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Au=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the pull-requests of the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/pull-requests").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Cu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the container registry credentials saved to this account. Does not display secrets.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/registry-credentials".concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Ou=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Adds a new set of container registry credentials to this account.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials"},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),ku=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Views a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId)},e.body=function(){},e}return P(e,t),e}(ga),Iu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId)},e.body=function(){},e}return P(e,t),e}(_a),Uu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId,"/modify")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Du=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available domains",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/domains".concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Pu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Registers a new domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains"},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Bu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain)},e.body=function(){},e}return P(e,t),e}(ga),Nu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a domain and each of its registered subdomains.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain)},e.body=function(){},e}return P(e,t),e}(_a),Lu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Attempts to verify the domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/verify")},e.body=function(){},e}return P(e,t),e}(wa),Tu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Adds a new subdomain to the domain.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain)},e.body=function(){},e}return P(e,t),e}(ga),Fu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Removes a subdomain from a domain.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain)},e.body=function(){},e}return P(e,t),e}(_a),Gu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/verify")},e.body=function(){},e}return P(e,t),e}(wa),Mu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Assigns a service port to the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/assign")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),qu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Removes a subdomain from its assigned service",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/assign")},e.body=function(){},e}return P(e,t),e}(_a),Wu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available billing plans",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/plans"},e.body=function(){},e}return P(e,t),e}(ga),zu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available project regions",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/regions"},e.body=function(){},e}return P(e,t),e}(ga),$u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the partially random string used when generating host names for the authenticated account.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/dns-id"},e.body=function(){},e}return P(e,t),e}(ga),Ju=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists linked version control providers",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/vcs"},e.body=function(){},e}return P(e,t),e}(ga),Hu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of secrets belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/secrets").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Vu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a secret with the specified payload",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Yu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="View a secret including its contents",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId).concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Zu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Delete a secret",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId)},e.body=function(){},e}return P(e,t),e}(_a),Ku=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Update a secret",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId)},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Xu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="View a secret with details about its linked addons",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/details")},e.body=function(){},e}return P(e,t),e}(ga),Qu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Link an addon to the secret group or edit the settings of the linked addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),tc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about a given addon link.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return P(e,t),e}(ga),ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Unlinks an addon from the secret group.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return P(e,t),e}(_a),nc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of services belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),rc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new combined service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/combined")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),oc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new deployment service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),ic=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new build service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/build")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),sc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId)},e.body=function(){},e}return P(e,t),e}(ga),ac=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId)},e.body=function(){},e}return P(e,t),e}(_a),uc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the scaling settings for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the deployment of the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/deployment")},e.body=function(){},e}return P(e,t),e}(ga),lc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the deployment settings of the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),dc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restarts the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/restart")},e.body=function(){},e}return P(e,t),e}(wa),pc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Pause the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/pause")},e.body=function(){},e}return P(e,t),e}(wa),hc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Resumes the given service. Optionally takes `instances` to resume with a given number of instances.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/resume")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),fc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the ports for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/ports")},e.body=function(){},e}return P(e,t),e}(ga),vc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the list of ports for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/ports")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),mc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the build options for a given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-options")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),bc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the version control source for a given build or combined service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-source")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),yc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the Docker CMD override for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/cmd-override")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),gc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the health checks for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/health-checks")},e.body=function(){},e}return P(e,t),e}(ga),wc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates health checks for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/health-checks")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),_c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the builds for the service",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),jc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Start a new build for the given combined or build service. If given a commit sha, it will build that commit. Otherwise, the most recent relevant commit will be built. If the service provided is a build service, a branch name or pull request to build from is required.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about a build for the service",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return P(e,t),e}(ga),Sc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given service build",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return P(e,t),e}(_a),xc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/containers").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Ac=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the branches of the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/branches").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the pull-requests of the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/pull-requests").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Oc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of repositories accessible to this account",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/vcs/repos".concat(r)},e.body=function(){},e}return P(e,t),e}(ga),kc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of branches for the repo",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/vcs/repos/".concat(t.parameters.vcsService,"/").concat(t.parameters.repositoryOwner,"/").concat(t.parameters.repositoryName,"/branches").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Ic=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of volumes belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes")},e.body=function(){},e}return P(e,t),e}(ga),Uc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a volume with the specified payload",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Dc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Retrieve a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(){},e}return P(e,t),e}(ga),Pc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Update volume mounts and storage size",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Bc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes this volume and its associated data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(){},e}return P(e,t),e}(_a),Nc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Attach a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId,"/attach")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Lc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Detach a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId,"/detach")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Tc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the build arguments of the given service. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Rc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the build arguments for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),Fc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the build arguments accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments/details")},e.body=function(){},e}return P(e,t),e}(ga),Gc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the runtime environment of the given service. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/runtime-environment").concat(r)},e.body=function(){},e}return P(e,t),e}(ga),Mc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the runtime environment for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/runtime-environment")},e.body=function(t){return JSON.stringify(t.data)},e}return P(e,t),e}(wa),qc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the runtime environment accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/runtime-environment/details")},e.body=function(){},e}return P(e,t),e}(ga),Wc=function(){function t(){this.loadContext()}return t.prototype.loadContext=function(){this.contextWrapper=this.loadContextWrapper()},t.prototype.getInfo=function(){return""},t.prototype.storeContext=function(t){return N(this,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return[4,this.writeContext(t)];case 1:return e.sent(),this.contextWrapper=t,[2]}}))}))},t.prototype.addContext=function(t,e){return void 0===e&&(e=!0),N(this,void 0,void 0,(function(){var n,r,o;return L(this,(function(i){switch(i.label){case 0:if(e||void 0===this.findContext(t.name))return[3,1];throw new Error("Context with name ".concat(t.name," already exists"));case 1:return[4,this.removeContext(t.name)];case 2:i.sent(),i.label=3;case 3:return n=B({host:"https://api.northflank.com"},t),r=this.contextWrapper,o={current:n.name,contexts:T(T([],r.contexts,!0),[n],!1),lastUpdateCheck:r.lastUpdateCheck},[4,this.storeContext(o)];case 4:return i.sent(),[2]}}))}))},t.prototype.removeContext=function(t){return N(this,void 0,void 0,(function(){var e,n,r,o;return L(this,(function(i){switch(i.label){case 0:return e=this.contextWrapper,n=e.contexts.filter((function(e){return e.name!==t})),r=e.current===t?void 0:e.current,o={current:r,contexts:T([],n,!0),lastUpdateCheck:e.lastUpdateCheck},[4,this.storeContext(o)];case 1:return i.sent(),[2]}}))}))},t.prototype.getCurrentContext=function(){var t=this.contextWrapper.current;return void 0===t?t:this.findContext(t)},t.prototype.findContext=function(t){return this.contextWrapper.contexts.find((function(e){return e.name===t}))},t.prototype.getCurrentBaseUrl=function(){var t=this.getCurrentContext();return null==t?void 0:t.host},t.prototype.getCurrentProjectName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.project},t.prototype.getCurrentName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.name},t.prototype.getCurrentToken=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.token},t.prototype.getCurrentServiceName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.service},t.prototype.getCurrentJobName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.job},t.prototype.getCurrentPlanId=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.plan},t.prototype.getCurrentRegion=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.region},t.prototype.useContext=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(!this.findContext(t))throw new Error("Context with name ".concat(t," doesn't exist"));return e=this.contextWrapper,n=B(B({},e),{current:t}),[4,this.storeContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateToken=function(t,e){return N(this,void 0,void 0,(function(){var n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:if(n=null!=e?e:this.getCurrentName(),!(r=this.findContext(n)))throw new Error("Context with name ".concat(e," doesn't exist"));return o=this.contextWrapper,i=o.contexts.map((function(e){return e.name===n?B(B({},r),{token:t}):e})),s=B(B({},o),{contexts:i}),[4,this.storeContext(s)];case 1:return a.sent(),[2]}}))}))},t.prototype.useProjectId=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set project id to current context, current context not defined");return n=B(B({},e),{project:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useServiceId=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set service id to current context, current context not defined");return n=B(B({},e),{service:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useJobId=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set job id to current context, current context not defined");return n=B(B({},e),{job:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.usePlanId=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set plan id to current context, current context not defined");return n=B(B({},e),{plan:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useRegion=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set region id to current context, current context not defined");return n=B(B({},e),{region:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.getLastUpdateCheck=function(){return this.contextWrapper.lastUpdateCheck||new Date},t.prototype.setLastUpdateCheck=function(t){return N(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:return e=this.contextWrapper,n=B(B({},e),{lastUpdateCheck:t}),[4,this.storeContext(n)];case 1:return r.sent(),[2]}}))}))},t}(),zc=function(t){function e(e){var n=t.call(this)||this;return n.assertDir=function(t){return N(n,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,C.default.promises.mkdir(t,{recursive:!0})];case 1:return[2,n.sent()];case 2:throw e=n.sent(),console.log("Failed to login, local files could not be created: ".concat(t,", error: ").concat(e.message)),e;case 3:return[2]}}))}))},n.configPath=e||"".concat(S.default.homedir(),"/.northflank"),n.configFile="".concat(n.configPath,"/config.json"),n.loadContext(),n}return P(e,t),e.prototype.loadContextWrapper=function(){try{return JSON.parse(C.default.readFileSync(this.configFile,"utf8"))}catch(t){return{contexts:[],lastUpdateCheck:new Date(0)}}},e.prototype.writeContext=function(t){return N(this,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return[4,this.assertConfigDir()];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,C.default.promises.writeFile(this.configFile,JSON.stringify(t,null,"\t"),{mode:416})];case 3:return n.sent(),[3,5];case 4:throw e=n.sent(),console.log("Failed to persist api context, local files could not be created, error: ".concat(e.message)),e;case 5:return[2]}}))}))},e.prototype.assertConfigDir=function(){return N(this,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return[4,this.assertDir(this.configPath)];case 1:return t.sent(),[2]}}))}))},e.prototype.getInfo=function(){return"Cli config stored in: ".concat(this.configPath)},e}(Wc),$c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.inMemoryContextWrapper={contexts:[],lastUpdateCheck:new Date(0)},e}return P(e,t),e.prototype.loadContextWrapper=function(){return this.inMemoryContextWrapper||(this.inMemoryContextWrapper={contexts:[],lastUpdateCheck:new Date(0)}),this.inMemoryContextWrapper},e.prototype.writeContext=function(t){return N(this,void 0,void 0,(function(){return L(this,(function(e){return this.inMemoryContextWrapper=t,[2]}))}))},e}(Wc),Jc=function(t,e){var n,r=this;void 0===e&&(e={}),this.baseUrl=function(){return r.contextProvider.getCurrentBaseUrl()},this.contextProvider=t,this.forwarding=new fa(t,new nc(t,e).call,new Ca(t,e).call),this.endpoints={list:(n={},n.projects=new Ea(t,e),n.addons=new Ca(t,e),n.jobs=new Ka(t,e),n.registryCredentials=new Cu(t,e),n.domains=new Du(t,e),n.plans=new Wu(t,e),n.regions=new zu(t,e),n.vcs=new Ju(t,e),n.secrets=new Hu(t,e),n.services=new nc(t,e),n.repos=new Oc(t,e),n.branches=new kc(t,e),n.volumes=new Ic(t,e),n),create:function(){var n,r={};return r.project=new Sa(t,e),r.addon=new Oa(t,e),r.job=((n={}).manual=new tu(t,e),n.cron=new eu(t,e),n),r.domain=new Pu(t,e),r.secret=new Vu(t,e),r.service=function(){var n={};return n.combined=new rc(t,e),n.deployment=new oc(t,e),n.build=new ic(t,e),n}(),r.volume=new Uc(t,e),r}(),get:function(){var n,r,o={};return o.project=new xa(t,e),o.addon=((r=new ka(t,e)).credentials=new Ua(t,e),r.types=new Da(t,e),r.version=new Ba(t,e),r.backups=new Ra(t,e),r.backup=((n=new Ga(t,e)).download=new Ya(t,e),n),r.containers=new za(t,e),r),o.job=function(){var n=new Xa(t,e);return n.runs=new nu(t,e),n.run=new ou(t,e),n.healthChecks=new au(t,e),n.builds=new cu(t,e),n.build=new du(t,e),n.buildArguments=new mu(t,e),n.buildArgumentDetails=new yu(t,e),n.runtimeEnvironment=new gu(t,e),n.runtimeEnvironmentDetails=new _u(t,e),n.deployment=new ju(t,e),n.containers=new Su(t,e),n.branches=new xu(t,e),n.pullRequests=new Au(t,e),n}(),o.registryCredentials=new ku(t,e),o.domain=new Bu(t,e),o.subdomain=new Ru(t,e),o.dnsId=new $u(t,e),o.secret=new Yu(t,e),o.secretDetails=new Xu(t,e),o.secretLink=new tc(t,e),o.service=function(){var n=new sc(t,e);return n.deployment=new cc(t,e),n.ports=new fc(t,e),n.healthChecks=new gc(t,e),n.builds=new _c(t,e),n.build=new Ec(t,e),n.containers=new xc(t,e),n.branches=new Ac(t,e),n.pullRequests=new Cc(t,e),n.buildArguments=new Tc(t,e),n.buildArgumentDetails=new Fc(t,e),n.runtimeEnvironment=new Gc(t,e),n.runtimeEnvironmentDetails=new qc(t,e),n}(),o.volume=new Dc(t,e),o}(),delete:function(){var n={};return n.project=new Aa(t,e),n.addon=new Ia(t,e),n.backup=new Ma(t,e),n.job=new Qa(t,e),n.registryCredentials=new Iu(t,e),n.domain=new Nu(t,e),n.subdomain=new Fu(t,e),n.secret=new Zu(t,e),n.secretLink=new ec(t,e),n.service=new ac(t,e),n.volume=new Bc(t,e),n}(),scale:function(){var n={};return n.addon=new Pa(t,e),n.service=new uc(t,e),n}(),update:function(){var n,r={};return r.addon=((n={}).version=new Na(t,e),n.networkSettings=new La(t,e),n.security=new Ta(t,e),n),r.job=function(){var n={};return n.settings=new su(t,e),n.healthChecks=new uu(t,e),n.buildOptions=new hu(t,e),n.buildSource=new fu(t,e),n.cmdOverride=new vu(t,e),n.buildArguments=new bu(t,e),n.runtimeEnvironment=new wu(t,e),n.deployment=new Eu(t,e),n}(),r.registryCredentials=new Uu(t,e),r.secret=new Ku(t,e),r.secretLink=new Qu(t,e),r.service=function(){var n={};return n.deployment=new lc(t,e),n.ports=new vc(t,e),n.buildOptions=new mc(t,e),n.buildSource=new bc(t,e),n.cmdOverride=new yc(t,e),n.healthChecks=new wc(t,e),n.buildArguments=new Rc(t,e),n.runtimeEnvironment=new Mc(t,e),n}(),r.volume=new Pc(t,e),r}(),backup:function(){var n={};return n.addon=new Fa(t,e),n}(),restore:function(){var n,r={};return r.addon=((n={}).backup=new qa(t,e),n),r}(),import:function(){var n,r={};return r.addon=((n={}).backup=new Wa(t,e),n),r}(),pause:function(){var n={};return n.addon=new $a(t,e),n.service=new pc(t,e),n}(),resume:function(){var n={};return n.addon=new Ja(t,e),n.service=new hc(t,e),n}(),restart:function(){var n={};return n.addon=new Ha(t,e),n.service=new dc(t,e),n}(),abort:function(){var n,r={};return r.addon=((n={}).backup=new Va(t,e),n.restore=new Za(t,e),n),r.job=function(){var n={};return n.run=new iu(t,e),n.build=new pu(t,e),n}(),r.service=function(){var n={};return n.build=new Sc(t,e),n}(),r}(),start:function(){var n,r={};return r.job=((n={}).run=new ru(t,e),n.build=new lu(t,e),n),r.service=function(){var n={};return n.build=new jc(t,e),n}(),r}(),add:function(){var n,r={};return r.registryCredentials=new Ou(t,e),r.domain=((n={}).subdomain=new Tu(t,e),n),r}(),verify:function(){var n={};return n.domain=new Lu(t,e),n.subdomain=new Gu(t,e),n}(),assign:function(){var n,r={};return r.subdomain=((n={}).service=new Mu(t,e),n),r}(),unassign:function(){var n={};return n.subdomain=new qu(t,e),n}(),attach:function(){var n={};return n.volume=new Nc(t,e),n}(),detach:function(){var n={};return n.volume=new Lc(t,e),n}()},this.list=function(){var t={};return t.projects=r.endpoints.list.projects.call,t.addons=r.endpoints.list.addons.call,t.jobs=r.endpoints.list.jobs.call,t.registryCredentials=r.endpoints.list.registryCredentials.call,t.domains=r.endpoints.list.domains.call,t.plans=r.endpoints.list.plans.call,t.regions=r.endpoints.list.regions.call,t.vcs=r.endpoints.list.vcs.call,t.secrets=r.endpoints.list.secrets.call,t.services=r.endpoints.list.services.call,t.repos=r.endpoints.list.repos.call,t.branches=r.endpoints.list.branches.call,t.volumes=r.endpoints.list.volumes.call,t}(),this.create=function(){var t,e={};return e.project=r.endpoints.create.project.call,e.addon=r.endpoints.create.addon.call,e.job=((t={}).manual=r.endpoints.create.job.manual.call,t.cron=r.endpoints.create.job.cron.call,t),e.domain=r.endpoints.create.domain.call,e.secret=r.endpoints.create.secret.call,e.service=function(){var t={};return t.combined=r.endpoints.create.service.combined.call,t.deployment=r.endpoints.create.service.deployment.call,t.build=r.endpoints.create.service.build.call,t}(),e.volume=r.endpoints.create.volume.call,e}(),this.get=function(){var t,e,n={};return n.project=r.endpoints.get.project.call,n.addon=((e=r.endpoints.get.addon.call).credentials=r.endpoints.get.addon.credentials.call,e.types=r.endpoints.get.addon.types.call,e.version=r.endpoints.get.addon.version.call,e.backups=r.endpoints.get.addon.backups.call,e.backup=((t=r.endpoints.get.addon.backup.call).download=r.endpoints.get.addon.backup.download.call,t),e.containers=r.endpoints.get.addon.containers.call,e),n.job=function(){var t=r.endpoints.get.job.call;return t.runs=r.endpoints.get.job.runs.call,t.run=r.endpoints.get.job.run.call,t.healthChecks=r.endpoints.get.job.healthChecks.call,t.builds=r.endpoints.get.job.builds.call,t.build=r.endpoints.get.job.build.call,t.buildArguments=r.endpoints.get.job.buildArguments.call,t.buildArgumentDetails=r.endpoints.get.job.buildArgumentDetails.call,t.runtimeEnvironment=r.endpoints.get.job.runtimeEnvironment.call,t.runtimeEnvironmentDetails=r.endpoints.get.job.runtimeEnvironmentDetails.call,t.deployment=r.endpoints.get.job.deployment.call,t.containers=r.endpoints.get.job.containers.call,t.branches=r.endpoints.get.job.branches.call,t.pullRequests=r.endpoints.get.job.pullRequests.call,t}(),n.registryCredentials=r.endpoints.get.registryCredentials.call,n.domain=r.endpoints.get.domain.call,n.subdomain=r.endpoints.get.subdomain.call,n.dnsId=r.endpoints.get.dnsId.call,n.secret=r.endpoints.get.secret.call,n.secretDetails=r.endpoints.get.secretDetails.call,n.secretLink=r.endpoints.get.secretLink.call,n.service=function(){var t=r.endpoints.get.service.call;return t.deployment=r.endpoints.get.service.deployment.call,t.ports=r.endpoints.get.service.ports.call,t.healthChecks=r.endpoints.get.service.healthChecks.call,t.builds=r.endpoints.get.service.builds.call,t.build=r.endpoints.get.service.build.call,t.containers=r.endpoints.get.service.containers.call,t.branches=r.endpoints.get.service.branches.call,t.pullRequests=r.endpoints.get.service.pullRequests.call,t.buildArguments=r.endpoints.get.service.buildArguments.call,t.buildArgumentDetails=r.endpoints.get.service.buildArgumentDetails.call,t.runtimeEnvironment=r.endpoints.get.service.runtimeEnvironment.call,t.runtimeEnvironmentDetails=r.endpoints.get.service.runtimeEnvironmentDetails.call,t}(),n.volume=r.endpoints.get.volume.call,n}(),this.delete=function(){var t={};return t.project=r.endpoints.delete.project.call,t.addon=r.endpoints.delete.addon.call,t.backup=r.endpoints.delete.backup.call,t.job=r.endpoints.delete.job.call,t.registryCredentials=r.endpoints.delete.registryCredentials.call,t.domain=r.endpoints.delete.domain.call,t.subdomain=r.endpoints.delete.subdomain.call,t.secret=r.endpoints.delete.secret.call,t.secretLink=r.endpoints.delete.secretLink.call,t.service=r.endpoints.delete.service.call,t.volume=r.endpoints.delete.volume.call,t}(),this.scale=function(){var t={};return t.addon=r.endpoints.scale.addon.call,t.service=r.endpoints.scale.service.call,t}(),this.update=function(){var t,e={};return e.addon=((t={}).version=r.endpoints.update.addon.version.call,t.networkSettings=r.endpoints.update.addon.networkSettings.call,t.security=r.endpoints.update.addon.security.call,t),e.job=function(){var t={};return t.settings=r.endpoints.update.job.settings.call,t.healthChecks=r.endpoints.update.job.healthChecks.call,t.buildOptions=r.endpoints.update.job.buildOptions.call,t.buildSource=r.endpoints.update.job.buildSource.call,t.cmdOverride=r.endpoints.update.job.cmdOverride.call,t.buildArguments=r.endpoints.update.job.buildArguments.call,t.runtimeEnvironment=r.endpoints.update.job.runtimeEnvironment.call,t.deployment=r.endpoints.update.job.deployment.call,t}(),e.registryCredentials=r.endpoints.update.registryCredentials.call,e.secret=r.endpoints.update.secret.call,e.secretLink=r.endpoints.update.secretLink.call,e.service=function(){var t={};return t.deployment=r.endpoints.update.service.deployment.call,t.ports=r.endpoints.update.service.ports.call,t.buildOptions=r.endpoints.update.service.buildOptions.call,t.buildSource=r.endpoints.update.service.buildSource.call,t.cmdOverride=r.endpoints.update.service.cmdOverride.call,t.healthChecks=r.endpoints.update.service.healthChecks.call,t.buildArguments=r.endpoints.update.service.buildArguments.call,t.runtimeEnvironment=r.endpoints.update.service.runtimeEnvironment.call,t}(),e.volume=r.endpoints.update.volume.call,e}(),this.backup=function(){var t={};return t.addon=r.endpoints.backup.addon.call,t}(),this.restore=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.restore.addon.backup.call,t),e}(),this.import=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.import.addon.backup.call,t),e}(),this.pause=function(){var t={};return t.addon=r.endpoints.pause.addon.call,t.service=r.endpoints.pause.service.call,t}(),this.resume=function(){var t={};return t.addon=r.endpoints.resume.addon.call,t.service=r.endpoints.resume.service.call,t}(),this.restart=function(){var t={};return t.addon=r.endpoints.restart.addon.call,t.service=r.endpoints.restart.service.call,t}(),this.abort=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.abort.addon.backup.call,t.restore=r.endpoints.abort.addon.restore.call,t),e.job=function(){var t={};return t.run=r.endpoints.abort.job.run.call,t.build=r.endpoints.abort.job.build.call,t}(),e.service=function(){var t={};return t.build=r.endpoints.abort.service.build.call,t}(),e}(),this.start=function(){var t,e={};return e.job=((t={}).run=r.endpoints.start.job.run.call,t.build=r.endpoints.start.job.build.call,t),e.service=function(){var t={};return t.build=r.endpoints.start.service.build.call,t}(),e}(),this.add=function(){var t,e={};return e.registryCredentials=r.endpoints.add.registryCredentials.call,e.domain=((t={}).subdomain=r.endpoints.add.domain.subdomain.call,t),e}(),this.verify=function(){var t={};return t.domain=r.endpoints.verify.domain.call,t.subdomain=r.endpoints.verify.subdomain.call,t}(),this.assign=function(){var t,e={};return e.subdomain=((t={}).service=r.endpoints.assign.subdomain.service.call,t),e}(),this.unassign=function(){var t={};return t.subdomain=r.endpoints.unassign.subdomain.call,t}(),this.attach=function(){var t={};return t.volume=r.endpoints.attach.volume.call,t}(),this.detach=function(){var t={};return t.volume=r.endpoints.detach.volume.call,t}()};exports.AbortAddonBackupEndpoint=Va,exports.AbortAddonRestoreEndpoint=Za,exports.AbortJobBuildEndpoint=pu,exports.AbortJobRunEndpoint=iu,exports.AbortServiceBuildEndpoint=Sc,exports.AddDomainSubdomainEndpoint=Tu,exports.AddRegistrycredentialsEndpoint=Ou,exports.ApiClient=Jc,exports.ApiClientContextProvider=Wc,exports.ApiClientFileContextProvider=zc,exports.ApiClientInMemoryContextProvider=$c,exports.ApiEndpoint=ya,exports.AssignSubdomainServiceEndpoint=Mu,exports.AttachVolumeEndpoint=Nc,exports.BackupAddonEndpoint=Fa,exports.CreateAddonEndpoint=Oa,exports.CreateDomainEndpoint=Pu,exports.CreateJobCronEndpoint=eu,exports.CreateJobManualEndpoint=tu,exports.CreateProjectEndpoint=Sa,exports.CreateSecretEndpoint=Vu,exports.CreateServiceBuildEndpoint=ic,exports.CreateServiceCombinedEndpoint=rc,exports.CreateServiceDeploymentEndpoint=oc,exports.CreateVolumeEndpoint=Uc,exports.DeleteAddonEndpoint=Ia,exports.DeleteApiEndpoint=_a,exports.DeleteBackupEndpoint=Ma,exports.DeleteDomainEndpoint=Nu,exports.DeleteJobEndpoint=Qa,exports.DeleteProjectEndpoint=Aa,exports.DeleteRegistrycredentialsEndpoint=Iu,exports.DeleteSecretEndpoint=Zu,exports.DeleteSecretlinkEndpoint=ec,exports.DeleteServiceEndpoint=ac,exports.DeleteSubdomainEndpoint=Fu,exports.DeleteVolumeEndpoint=Bc,exports.DetachVolumeEndpoint=Lc,exports.GetAddonBackupDownloadEndpoint=Ya,exports.GetAddonBackupEndpoint=Ga,exports.GetAddonBackupsEndpoint=Ra,exports.GetAddonContainersEndpoint=za,exports.GetAddonCredentialsEndpoint=Ua,exports.GetAddonEndpoint=ka,exports.GetAddonTypesEndpoint=Da,exports.GetAddonVersionEndpoint=Ba,exports.GetApiEndpoint=ga,exports.GetDnsidEndpoint=$u,exports.GetDomainEndpoint=Bu,exports.GetJobBranchesEndpoint=xu,exports.GetJobBuildEndpoint=du,exports.GetJobBuildargumentdetailsEndpoint=yu,exports.GetJobBuildargumentsEndpoint=mu,exports.GetJobBuildsEndpoint=cu,exports.GetJobContainersEndpoint=Su,exports.GetJobDeploymentEndpoint=ju,exports.GetJobEndpoint=Xa,exports.GetJobHealthchecksEndpoint=au,exports.GetJobPullrequestsEndpoint=Au,exports.GetJobRunEndpoint=ou,exports.GetJobRunsEndpoint=nu,exports.GetJobRuntimeenvironmentEndpoint=gu,exports.GetJobRuntimeenvironmentdetailsEndpoint=_u,exports.GetProjectEndpoint=xa,exports.GetRegistrycredentialsEndpoint=ku,exports.GetSecretEndpoint=Yu,exports.GetSecretdetailsEndpoint=Xu,exports.GetSecretlinkEndpoint=tc,exports.GetServiceBranchesEndpoint=Ac,exports.GetServiceBuildEndpoint=Ec,exports.GetServiceBuildargumentdetailsEndpoint=Fc,exports.GetServiceBuildargumentsEndpoint=Tc,exports.GetServiceBuildsEndpoint=_c,exports.GetServiceContainersEndpoint=xc,exports.GetServiceDeploymentEndpoint=cc,exports.GetServiceEndpoint=sc,exports.GetServiceHealthchecksEndpoint=gc,exports.GetServicePortsEndpoint=fc,exports.GetServicePullrequestsEndpoint=Cc,exports.GetServiceRuntimeenvironmentEndpoint=Gc,exports.GetServiceRuntimeenvironmentdetailsEndpoint=qc,exports.GetSubdomainEndpoint=Ru,exports.GetVolumeEndpoint=Dc,exports.ImportAddonBackupEndpoint=Wa,exports.ListAddonsEndpoint=Ca,exports.ListBranchesEndpoint=kc,exports.ListDomainsEndpoint=Du,exports.ListJobsEndpoint=Ka,exports.ListPlansEndpoint=Wu,exports.ListProjectsEndpoint=Ea,exports.ListRegionsEndpoint=zu,exports.ListRegistrycredentialsEndpoint=Cu,exports.ListReposEndpoint=Oc,exports.ListSecretsEndpoint=Hu,exports.ListServicesEndpoint=nc,exports.ListVcsEndpoint=Ju,exports.ListVolumesEndpoint=Ic,exports.NorthflankPortForwarder=fa,exports.PauseAddonEndpoint=$a,exports.PauseServiceEndpoint=pc,exports.PostApiEndpoint=wa,exports.RestartAddonEndpoint=Ha,exports.RestartServiceEndpoint=dc,exports.RestoreAddonBackupEndpoint=qa,exports.ResumeAddonEndpoint=Ja,exports.ResumeServiceEndpoint=hc,exports.ScaleAddonEndpoint=Pa,exports.ScaleServiceEndpoint=uc,exports.StartJobBuildEndpoint=lu,exports.StartJobRunEndpoint=ru,exports.StartServiceBuildEndpoint=jc,exports.UnassignSubdomainEndpoint=qu,exports.UpdateAddonNetworksettingsEndpoint=La,exports.UpdateAddonSecurityEndpoint=Ta,exports.UpdateAddonVersionEndpoint=Na,exports.UpdateJobBuildargumentsEndpoint=bu,exports.UpdateJobBuildoptionsEndpoint=hu,exports.UpdateJobBuildsourceEndpoint=fu,exports.UpdateJobCmdoverrideEndpoint=vu,exports.UpdateJobDeploymentEndpoint=Eu,exports.UpdateJobHealthchecksEndpoint=uu,exports.UpdateJobRuntimeenvironmentEndpoint=wu,exports.UpdateJobSettingsEndpoint=su,exports.UpdateRegistrycredentialsEndpoint=Uu,exports.UpdateSecretEndpoint=Ku,exports.UpdateSecretlinkEndpoint=Qu,exports.UpdateServiceBuildargumentsEndpoint=Rc,exports.UpdateServiceBuildoptionsEndpoint=mc,exports.UpdateServiceBuildsourceEndpoint=bc,exports.UpdateServiceCmdoverrideEndpoint=yc,exports.UpdateServiceDeploymentEndpoint=lc,exports.UpdateServiceHealthchecksEndpoint=wc,exports.UpdateServicePortsEndpoint=vc,exports.UpdateServiceRuntimeenvironmentEndpoint=Mc,exports.UpdateVolumeEndpoint=Pc,exports.VerifyDomainEndpoint=Lu,exports.VerifySubdomainEndpoint=Gu;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("events"),e=require("stream"),n=require("http"),r=require("url"),o=require("punycode"),i=require("https"),s=require("zlib"),a=require("os"),u=require("net"),c=require("child_process"),l=require("fs"),d=require("path"),p=require("tls"),h=require("crypto"),f=require("dgram");function v(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function m(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var b=v(t),y=v(e),g=m(e),w=v(n),_=v(r),j=v(o),E=v(i),S=v(s),x=v(a),A=v(u),C=m(u),O=v(l),k=v(d),I=v(p),U=v(h),D=v(f),P=function(t,e){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},P(t,e)};function B(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}P(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var N=function(){return N=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},N.apply(this,arguments)};function T(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))}function L(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function R(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}var F="object"==typeof global&&global&&global.Object===Object&&global,G="object"==typeof self&&self&&self.Object===Object&&self,M=F||G||Function("return this")(),z=M.Symbol,q=Object.prototype,W=q.hasOwnProperty,$=q.toString,J=z?z.toStringTag:void 0;var H=Object.prototype.toString;var V=z?z.toStringTag:void 0;function Y(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":V&&V in Object(t)?function(t){var e=W.call(t,J),n=t[J];try{t[J]=void 0;var r=!0}catch(t){}var o=$.call(t);return r&&(e?t[J]=n:delete t[J]),o}(t):function(t){return H.call(t)}(t)}function Z(t){return null!=t&&"object"==typeof t}function K(t){return"symbol"==typeof t||Z(t)&&"[object Symbol]"==Y(t)}function X(t,e){for(var n=-1,r=null==t?0:t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}var Q=Array.isArray,tt=z?z.prototype:void 0,et=tt?tt.toString:void 0;function nt(t){if("string"==typeof t)return t;if(Q(t))return X(t,nt)+"";if(K(t))return et?et.call(t):"";var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function rt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ot(t){return t}function it(t){if(!rt(t))return!1;var e=Y(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var st,at=M["__core-js_shared__"],ut=(st=/[^.]+$/.exec(at&&at.keys&&at.keys.IE_PROTO||""))?"Symbol(src)_1."+st:"";var ct=Function.prototype.toString;function lt(t){if(null!=t){try{return ct.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var dt=/^\[object .+?Constructor\]$/,pt=Function.prototype,ht=Object.prototype,ft=pt.toString,vt=ht.hasOwnProperty,mt=RegExp("^"+ft.call(vt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bt(t){return!(!rt(t)||(e=t,ut&&ut in e))&&(it(t)?mt:dt).test(lt(t));var e}function yt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return bt(n)?n:void 0}var gt=yt(M,"WeakMap"),wt=Object.create,_t=function(){function t(){}return function(e){if(!rt(e))return{};if(wt)return wt(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function jt(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Et=Date.now;var St,xt,At,Ct=function(){try{var t=yt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ot=Ct,kt=Ot?function(t,e){return Ot(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:ot,It=(St=kt,xt=0,At=0,function(){var t=Et(),e=16-(t-At);if(At=t,e>0){if(++xt>=800)return arguments[0]}else xt=0;return St.apply(void 0,arguments)}),Ut=/^(?:0|[1-9]\d*)$/;function Dt(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ut.test(t))&&t>-1&&t%1==0&&t<e}function Pt(t,e,n){"__proto__"==e&&Ot?Ot(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function Bt(t,e){return t===e||t!=t&&e!=e}var Nt=Object.prototype.hasOwnProperty;function Tt(t,e,n){var r=t[e];Nt.call(t,e)&&Bt(r,n)&&(void 0!==n||e in t)||Pt(t,e,n)}var Lt=Math.max;function Rt(t,e){return It(function(t,e,n){return e=Lt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Lt(r.length-e,0),s=Array(i);++o<i;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(s),jt(t,this,a)}}(t,e,ot),t+"")}function Ft(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Gt(t){return null!=t&&Ft(t.length)&&!it(t)}var Mt=Object.prototype;function zt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Mt)}function qt(t){return Z(t)&&"[object Arguments]"==Y(t)}var Wt=Object.prototype,$t=Wt.hasOwnProperty,Jt=Wt.propertyIsEnumerable,Ht=qt(function(){return arguments}())?qt:function(t){return Z(t)&&$t.call(t,"callee")&&!Jt.call(t,"callee")};var Vt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Yt=Vt&&"object"==typeof module&&module&&!module.nodeType&&module,Zt=Yt&&Yt.exports===Vt?M.Buffer:void 0,Kt=(Zt?Zt.isBuffer:void 0)||function(){return!1},Xt={};Xt["[object Float32Array]"]=Xt["[object Float64Array]"]=Xt["[object Int8Array]"]=Xt["[object Int16Array]"]=Xt["[object Int32Array]"]=Xt["[object Uint8Array]"]=Xt["[object Uint8ClampedArray]"]=Xt["[object Uint16Array]"]=Xt["[object Uint32Array]"]=!0,Xt["[object Arguments]"]=Xt["[object Array]"]=Xt["[object ArrayBuffer]"]=Xt["[object Boolean]"]=Xt["[object DataView]"]=Xt["[object Date]"]=Xt["[object Error]"]=Xt["[object Function]"]=Xt["[object Map]"]=Xt["[object Number]"]=Xt["[object Object]"]=Xt["[object RegExp]"]=Xt["[object Set]"]=Xt["[object String]"]=Xt["[object WeakMap]"]=!1;var Qt="object"==typeof exports&&exports&&!exports.nodeType&&exports,te=Qt&&"object"==typeof module&&module&&!module.nodeType&&module,ee=te&&te.exports===Qt&&F.process,ne=function(){try{var t=te&&te.require&&te.require("util").types;return t||ee&&ee.binding&&ee.binding("util")}catch(t){}}(),re=ne&&ne.isTypedArray,oe=re?function(t){return function(e){return t(e)}}(re):function(t){return Z(t)&&Ft(t.length)&&!!Xt[Y(t)]},ie=oe,se=Object.prototype.hasOwnProperty;function ae(t,e){var n=Q(t),r=!n&&Ht(t),o=!n&&!r&&Kt(t),i=!n&&!r&&!o&&ie(t),s=n||r||o||i,a=s?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=a.length;for(var c in t)!e&&!se.call(t,c)||s&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Dt(c,u))||a.push(c);return a}function ue(t,e){return function(n){return t(e(n))}}var ce=ue(Object.keys,Object),le=Object.prototype.hasOwnProperty;function de(t){return Gt(t)?ae(t):function(t){if(!zt(t))return ce(t);var e=[];for(var n in Object(t))le.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}var pe=Object.prototype.hasOwnProperty;function he(t){if(!rt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=zt(t),n=[];for(var r in t)("constructor"!=r||!e&&pe.call(t,r))&&n.push(r);return n}function fe(t){return Gt(t)?ae(t,!0):he(t)}var ve=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,me=/^\w*$/;function be(t,e){if(Q(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!K(t))||(me.test(t)||!ve.test(t)||null!=e&&t in Object(e))}var ye=yt(Object,"create");var ge=Object.prototype.hasOwnProperty;var we=Object.prototype.hasOwnProperty;function _e(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function je(t,e){for(var n=t.length;n--;)if(Bt(t[n][0],e))return n;return-1}_e.prototype.clear=function(){this.__data__=ye?ye(null):{},this.size=0},_e.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},_e.prototype.get=function(t){var e=this.__data__;if(ye){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return ge.call(e,t)?e[t]:void 0},_e.prototype.has=function(t){var e=this.__data__;return ye?void 0!==e[t]:we.call(e,t)},_e.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ye&&void 0===e?"__lodash_hash_undefined__":e,this};var Ee=Array.prototype.splice;function Se(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Se.prototype.clear=function(){this.__data__=[],this.size=0},Se.prototype.delete=function(t){var e=this.__data__,n=je(e,t);return!(n<0)&&(n==e.length-1?e.pop():Ee.call(e,n,1),--this.size,!0)},Se.prototype.get=function(t){var e=this.__data__,n=je(e,t);return n<0?void 0:e[n][1]},Se.prototype.has=function(t){return je(this.__data__,t)>-1},Se.prototype.set=function(t,e){var n=this.__data__,r=je(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var xe=yt(M,"Map");function Ae(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function Ce(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Ce.prototype.clear=function(){this.size=0,this.__data__={hash:new _e,map:new(xe||Se),string:new _e}},Ce.prototype.delete=function(t){var e=Ae(this,t).delete(t);return this.size-=e?1:0,e},Ce.prototype.get=function(t){return Ae(this,t).get(t)},Ce.prototype.has=function(t){return Ae(this,t).has(t)},Ce.prototype.set=function(t,e){var n=Ae(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Oe(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Oe.Cache||Ce),n}Oe.Cache=Ce;var ke=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ie=/\\(\\)?/g,Ue=function(t){var e=Oe(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(ke,(function(t,n,r,o){e.push(r?o.replace(Ie,"$1"):n||t)})),e})),De=Ue;function Pe(t){return null==t?"":nt(t)}function Be(t,e){return Q(t)?t:be(t,e)?[t]:De(Pe(t))}function Ne(t){if("string"==typeof t||K(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}function Te(t,e){for(var n=0,r=(e=Be(e,t)).length;null!=t&&n<r;)t=t[Ne(e[n++])];return n&&n==r?t:void 0}function Le(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}var Re=z?z.isConcatSpreadable:void 0;function Fe(t){return Q(t)||Ht(t)||!!(Re&&t&&t[Re])}function Ge(t,e,n,r,o){var i=-1,s=t.length;for(n||(n=Fe),o||(o=[]);++i<s;){var a=t[i];e>0&&n(a)?e>1?Ge(a,e-1,n,r,o):Le(o,a):r||(o[o.length]=a)}return o}var Me=ue(Object.getPrototypeOf,Object),ze=Function.prototype,qe=Object.prototype,We=ze.toString,$e=qe.hasOwnProperty,Je=We.call(Object);function He(t){var e=this.__data__=new Se(t);this.size=e.size}He.prototype.clear=function(){this.__data__=new Se,this.size=0},He.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},He.prototype.get=function(t){return this.__data__.get(t)},He.prototype.has=function(t){return this.__data__.has(t)},He.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Se){var r=n.__data__;if(!xe||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Ce(r)}return n.set(t,e),this.size=n.size,this};var Ve="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ye=Ve&&"object"==typeof module&&module&&!module.nodeType&&module,Ze=Ye&&Ye.exports===Ve?M.Buffer:void 0,Ke=Ze?Ze.allocUnsafe:void 0;var Xe=Object.prototype.propertyIsEnumerable,Qe=Object.getOwnPropertySymbols,tn=Qe?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var n=-1,r=null==t?0:t.length,o=0,i=[];++n<r;){var s=t[n];e(s,n,t)&&(i[o++]=s)}return i}(Qe(t),(function(e){return Xe.call(t,e)})))}:function(){return[]};function en(t){return function(t,e,n){var r=e(t);return Q(t)?r:Le(r,n(t))}(t,de,tn)}var nn=yt(M,"DataView"),rn=yt(M,"Promise"),on=yt(M,"Set"),sn=lt(nn),an=lt(xe),un=lt(rn),cn=lt(on),ln=lt(gt),dn=Y;(nn&&"[object DataView]"!=dn(new nn(new ArrayBuffer(1)))||xe&&"[object Map]"!=dn(new xe)||rn&&"[object Promise]"!=dn(rn.resolve())||on&&"[object Set]"!=dn(new on)||gt&&"[object WeakMap]"!=dn(new gt))&&(dn=function(t){var e=Y(t),n="[object Object]"==e?t.constructor:void 0,r=n?lt(n):"";if(r)switch(r){case sn:return"[object DataView]";case an:return"[object Map]";case un:return"[object Promise]";case cn:return"[object Set]";case ln:return"[object WeakMap]"}return e});var pn=dn,hn=M.Uint8Array;function fn(t,e){var n,r,o=e?(n=t.buffer,r=new n.constructor(n.byteLength),new hn(r).set(new hn(n)),r):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}function vn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Ce;++e<n;)this.add(t[e])}function mn(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}vn.prototype.add=vn.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},vn.prototype.has=function(t){return this.__data__.has(t)};function bn(t,e,n,r,o,i){var s=1&n,a=t.length,u=e.length;if(a!=u&&!(s&&u>a))return!1;var c=i.get(t),l=i.get(e);if(c&&l)return c==e&&l==t;var d=-1,p=!0,h=2&n?new vn:void 0;for(i.set(t,e),i.set(e,t);++d<a;){var f=t[d],v=e[d];if(r)var m=s?r(v,f,d,e,t,i):r(f,v,d,t,e,i);if(void 0!==m){if(m)continue;p=!1;break}if(h){if(!mn(e,(function(t,e){if(s=e,!h.has(s)&&(f===t||o(f,t,n,r,i)))return h.push(e);var s}))){p=!1;break}}else if(f!==v&&!o(f,v,n,r,i)){p=!1;break}}return i.delete(t),i.delete(e),p}function yn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function gn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var wn=z?z.prototype:void 0,_n=wn?wn.valueOf:void 0;var jn=Object.prototype.hasOwnProperty;var En="[object Object]",Sn=Object.prototype.hasOwnProperty;function xn(t,e,n,r,o,i){var s=Q(t),a=Q(e),u=s?"[object Array]":pn(t),c=a?"[object Array]":pn(e),l=(u="[object Arguments]"==u?En:u)==En,d=(c="[object Arguments]"==c?En:c)==En,p=u==c;if(p&&Kt(t)){if(!Kt(e))return!1;s=!0,l=!1}if(p&&!l)return i||(i=new He),s||ie(t)?bn(t,e,n,r,o,i):function(t,e,n,r,o,i,s){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new hn(t),new hn(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Bt(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=yn;case"[object Set]":var u=1&r;if(a||(a=gn),t.size!=e.size&&!u)return!1;var c=s.get(t);if(c)return c==e;r|=2,s.set(t,e);var l=bn(a(t),a(e),r,o,i,s);return s.delete(t),l;case"[object Symbol]":if(_n)return _n.call(t)==_n.call(e)}return!1}(t,e,u,n,r,o,i);if(!(1&n)){var h=l&&Sn.call(t,"__wrapped__"),f=d&&Sn.call(e,"__wrapped__");if(h||f){var v=h?t.value():t,m=f?e.value():e;return i||(i=new He),o(v,m,n,r,i)}}return!!p&&(i||(i=new He),function(t,e,n,r,o,i){var s=1&n,a=en(t),u=a.length;if(u!=en(e).length&&!s)return!1;for(var c=u;c--;){var l=a[c];if(!(s?l in e:jn.call(e,l)))return!1}var d=i.get(t),p=i.get(e);if(d&&p)return d==e&&p==t;var h=!0;i.set(t,e),i.set(e,t);for(var f=s;++c<u;){var v=t[l=a[c]],m=e[l];if(r)var b=s?r(m,v,l,e,t,i):r(v,m,l,t,e,i);if(!(void 0===b?v===m||o(v,m,n,r,i):b)){h=!1;break}f||(f="constructor"==l)}if(h&&!f){var y=t.constructor,g=e.constructor;y==g||!("constructor"in t)||!("constructor"in e)||"function"==typeof y&&y instanceof y&&"function"==typeof g&&g instanceof g||(h=!1)}return i.delete(t),i.delete(e),h}(t,e,n,r,o,i))}function An(t,e,n,r,o){return t===e||(null==t||null==e||!Z(t)&&!Z(e)?t!=t&&e!=e:xn(t,e,n,r,An,o))}function Cn(t){return t==t&&!rt(t)}function On(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function kn(t){var e=function(t){for(var e=de(t),n=e.length;n--;){var r=e[n],o=t[r];e[n]=[r,o,Cn(o)]}return e}(t);return 1==e.length&&e[0][2]?On(e[0][0],e[0][1]):function(n){return n===t||function(t,e,n,r){var o=n.length,i=o,s=!r;if(null==t)return!i;for(t=Object(t);o--;){var a=n[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var u=(a=n[o])[0],c=t[u],l=a[1];if(s&&a[2]){if(void 0===c&&!(u in t))return!1}else{var d=new He;if(r)var p=r(c,l,u,t,e,d);if(!(void 0===p?An(l,c,3,r,d):p))return!1}}return!0}(n,t,e)}}function In(t,e){return null!=t&&e in Object(t)}function Un(t,e){return null!=t&&function(t,e,n){for(var r=-1,o=(e=Be(e,t)).length,i=!1;++r<o;){var s=Ne(e[r]);if(!(i=null!=t&&n(t,s)))break;t=t[s]}return i||++r!=o?i:!!(o=null==t?0:t.length)&&Ft(o)&&Dt(s,o)&&(Q(t)||Ht(t))}(t,e,In)}function Dn(t,e){return be(t)&&Cn(e)?On(Ne(t),e):function(n){var r=function(t,e,n){var r=null==t?void 0:Te(t,e);return void 0===r?n:r}(n,t);return void 0===r&&r===e?Un(n,t):An(e,r,3)}}function Pn(t){return be(t)?(e=Ne(t),function(t){return null==t?void 0:t[e]}):function(t){return function(e){return Te(e,t)}}(t);var e}function Bn(t){return"function"==typeof t?t:null==t?ot:"object"==typeof t?Q(t)?Dn(t[0],t[1]):kn(t):Pn(t)}var Nn,Tn=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),s=i.length;s--;){var a=i[Nn?s:++r];if(!1===e(o[a],a,o))break}return t};var Ln=function(t,e){return function(n,r){if(null==n)return n;if(!Gt(n))return t(n,r);for(var o=n.length,i=e?o:-1,s=Object(n);(e?i--:++i<o)&&!1!==r(s[i],i,s););return n}}((function(t,e){return t&&Tn(t,e,de)})),Rn=Ln;function Fn(t,e,n){(void 0!==n&&!Bt(t[e],n)||void 0===n&&!(e in t))&&Pt(t,e,n)}function Gn(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Mn(t){return function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,s=e.length;++i<s;){var a=e[i],u=r?r(n[a],t[a],a,n,t):void 0;void 0===u&&(u=t[a]),o?Pt(n,a,u):Tt(n,a,u)}return n}(t,fe(t))}function zn(t,e,n,r,o,i,s){var a=Gn(t,n),u=Gn(e,n),c=s.get(u);if(c)Fn(t,n,c);else{var l,d=i?i(a,u,n+"",t,e,s):void 0,p=void 0===d;if(p){var h=Q(u),f=!h&&Kt(u),v=!h&&!f&&ie(u);d=u,h||f||v?Q(a)?d=a:Z(l=a)&&Gt(l)?d=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(a):f?(p=!1,d=function(t,e){if(e)return t.slice();var n=t.length,r=Ke?Ke(n):new t.constructor(n);return t.copy(r),r}(u,!0)):v?(p=!1,d=fn(u,!0)):d=[]:function(t){if(!Z(t)||"[object Object]"!=Y(t))return!1;var e=Me(t);if(null===e)return!0;var n=$e.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&We.call(n)==Je}(u)||Ht(u)?(d=a,Ht(a)?d=Mn(a):rt(a)&&!it(a)||(d=function(t){return"function"!=typeof t.constructor||zt(t)?{}:_t(Me(t))}(u))):p=!1}p&&(s.set(u,d),o(d,u,r,i,s),s.delete(u)),Fn(t,n,d)}}function qn(t,e,n,r,o){t!==e&&Tn(e,(function(i,s){if(o||(o=new He),rt(i))zn(t,e,s,n,qn,r,o);else{var a=r?r(Gn(t,s),i,s+"",t,e,o):void 0;void 0===a&&(a=i),Fn(t,s,a)}}),fe)}var Wn=/[\\^$.*+?()[\]{}|]/g,$n=RegExp(Wn.source);function Jn(t,e){var n=-1,r=Gt(t)?Array(t.length):[];return Rn(t,(function(t,o,i){r[++n]=e(t,o,i)})),r}function Hn(t,e){return Ge(function(t,e){return(Q(t)?X:Jn)(t,Bn(e))}(t,e),1)}function Vn(t,e){return t>e}function Yn(t){return"string"==typeof t||!Q(t)&&Z(t)&&"[object String]"==Y(t)}function Zn(t,e){return t&&t.length?function(t,e,n){for(var r=-1,o=t.length;++r<o;){var i=t[r],s=e(i);if(null!=s&&(void 0===a?s==s&&!K(s):n(s,a)))var a=s,u=i}return u}(t,Bn(e),Vn):void 0}var Kn,Xn=(Kn=function(t,e,n){qn(t,e,n)},Rt((function(t,e){var n=-1,r=e.length,o=r>1?e[r-1]:void 0,i=r>2?e[2]:void 0;for(o=Kn.length>3&&"function"==typeof o?(r--,o):void 0,i&&function(t,e,n){if(!rt(n))return!1;var r=typeof e;return!!("number"==r?Gt(n)&&Dt(e,n.length):"string"==r&&e in n)&&Bt(n[e],t)}(e[0],e[1],i)&&(o=r<3?void 0:o,r=1),t=Object(t);++n<r;){var s=e[n];s&&Kn(t,s,n,o)}return t})));function Qn(t,e){return t(e={exports:{}},e.exports),e.exports}var tr={},er=tr;function nr(t){return t<0?-1:1}function rr(t,e){e.unsigned||--t;const n=e.unsigned?0:-Math.pow(2,t),r=Math.pow(2,t)-1,o=e.moduloBitLength?Math.pow(2,e.moduloBitLength):Math.pow(2,t),i=e.moduloBitLength?Math.pow(2,e.moduloBitLength-1):Math.pow(2,t-1);return function(t,s){s||(s={});let a=+t;if(s.enforceRange){if(!Number.isFinite(a))throw new TypeError("Argument is not a finite number");if(a=nr(a)*Math.floor(Math.abs(a)),a<n||a>r)throw new TypeError("Argument is not in byte range");return a}if(!isNaN(a)&&s.clamp)return a=function(t){return t%1==.5&&0==(1&t)?Math.floor(t):Math.round(t)}(a),a<n&&(a=n),a>r&&(a=r),a;if(!Number.isFinite(a)||0===a)return 0;if(a=nr(a)*Math.floor(Math.abs(a)),a%=o,!e.unsigned&&a>=i)return a-o;if(e.unsigned)if(a<0)a+=o;else if(-0===a)return 0;return a}}tr.void=function(){},tr.boolean=function(t){return!!t},tr.byte=rr(8,{unsigned:!1}),tr.octet=rr(8,{unsigned:!0}),tr.short=rr(16,{unsigned:!1}),tr["unsigned short"]=rr(16,{unsigned:!0}),tr.long=rr(32,{unsigned:!1}),tr["unsigned long"]=rr(32,{unsigned:!0}),tr["long long"]=rr(32,{unsigned:!1,moduloBitLength:64}),tr["unsigned long long"]=rr(32,{unsigned:!0,moduloBitLength:64}),tr.double=function(t){const e=+t;if(!Number.isFinite(e))throw new TypeError("Argument is not a finite floating-point value");return e},tr["unrestricted double"]=function(t){const e=+t;if(isNaN(e))throw new TypeError("Argument is NaN");return e},tr.float=tr.double,tr["unrestricted float"]=tr["unrestricted double"],tr.DOMString=function(t,e){return e||(e={}),e.treatNullAsEmptyString&&null===t?"":String(t)},tr.ByteString=function(t,e){const n=String(t);let r;for(let t=0;void 0!==(r=n.codePointAt(t));++t)if(r>255)throw new TypeError("Argument is not a valid bytestring");return n},tr.USVString=function(t){const e=String(t),n=e.length,r=[];for(let t=0;t<n;++t){const o=e.charCodeAt(t);if(o<55296||o>57343)r.push(String.fromCodePoint(o));else if(56320<=o&&o<=57343)r.push(String.fromCodePoint(65533));else if(t===n-1)r.push(String.fromCodePoint(65533));else{const n=e.charCodeAt(t+1);if(56320<=n&&n<=57343){const e=1023&o,i=1023&n;r.push(String.fromCodePoint(65536+1024*e+i)),++t}else r.push(String.fromCodePoint(65533))}}return r.join("")},tr.Date=function(t,e){if(!(t instanceof Date))throw new TypeError("Argument is not a Date object");if(!isNaN(t))return t},tr.RegExp=function(t,e){return t instanceof RegExp||(t=new RegExp(t)),t};var or=Qn((function(t){t.exports.mixin=function(t,e){const n=Object.getOwnPropertyNames(e);for(let r=0;r<n.length;++r)Object.defineProperty(t,n[r],Object.getOwnPropertyDescriptor(e,n[r]))},t.exports.wrapperSymbol=Symbol("wrapper"),t.exports.implSymbol=Symbol("impl"),t.exports.wrapperForImpl=function(e){return e[t.exports.wrapperSymbol]},t.exports.implForWrapper=function(e){return e[t.exports.implSymbol]}}));or.mixin,or.wrapperSymbol,or.implSymbol,or.wrapperForImpl,or.implForWrapper;var ir,sr=(ir=Object.freeze({__proto__:null}))&&ir.default||ir,ar={TRANSITIONAL:0,NONTRANSITIONAL:1};function ur(t){return t.split("\0").map((function(t){return t.normalize("NFC")})).join("\0")}function cr(t){for(var e=0,n=sr.length-1;e<=n;){var r=Math.floor((e+n)/2),o=sr[r];if(o[0][0]<=t&&o[0][1]>=t)return o;o[0][0]>t?n=r-1:e=r+1}return null}var lr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;function dr(t){return t.replace(lr,"_").length}var pr=/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/;function hr(t,e){"xn--"===t.substr(0,4)&&(t=j.default.toUnicode(t));var n=!1;(ur(t)!==t||"-"===t[3]&&"-"===t[4]||"-"===t[0]||"-"===t[t.length-1]||-1!==t.indexOf(".")||0===t.search(pr))&&(n=!0);for(var r=dr(t),o=0;o<r;++o){var i=cr(t.codePointAt(o));if(fr===ar.TRANSITIONAL&&"valid"!==i[1]||fr===ar.NONTRANSITIONAL&&"valid"!==i[1]&&"deviation"!==i[1]){n=!0;break}}return{label:t,error:n}}function fr(t,e,n){var r=function(t,e,n){for(var r=!1,o="",i=dr(t),s=0;s<i;++s){var a=t.codePointAt(s),u=cr(a);switch(u[1]){case"disallowed":r=!0,o+=String.fromCodePoint(a);break;case"ignored":break;case"mapped":o+=String.fromCodePoint.apply(String,u[2]);break;case"deviation":o+=n===ar.TRANSITIONAL?String.fromCodePoint.apply(String,u[2]):String.fromCodePoint(a);break;case"valid":o+=String.fromCodePoint(a);break;case"disallowed_STD3_mapped":e?(r=!0,o+=String.fromCodePoint(a)):o+=String.fromCodePoint.apply(String,u[2]);break;case"disallowed_STD3_valid":e&&(r=!0),o+=String.fromCodePoint(a)}}return{string:o,error:r}}(t,e,n);r.string=ur(r.string);for(var o=r.string.split("."),i=0;i<o.length;++i)try{var s=hr(o[i]);o[i]=s.label,r.error=r.error||s.error}catch(t){r.error=!0}return{string:o.join("."),error:r.error}}var vr={toASCII:function(t,e,n,r){var o=fr(t,e,n),i=o.string.split(".");if(i=i.map((function(t){try{return j.default.toASCII(t)}catch(e){return o.error=!0,t}})),r){var s=i.slice(0,i.length-1).join(".").length;(s.length>253||0===s.length)&&(o.error=!0);for(var a=0;a<i.length;++a)if(i.length>63||0===i.length){o.error=!0;break}}return o.error?null:i.join(".")},toUnicode:function(t,e){var n=fr(t,e,ar.NONTRANSITIONAL);return{domain:n.string,error:n.error}},PROCESSING_OPTIONS:ar},mr=Qn((function(t){const e={ftp:21,file:null,gopher:70,http:80,https:443,ws:80,wss:443},n=Symbol("failure");function r(t){return j.default.ucs2.decode(t).length}function o(t,e){const n=t[e];return isNaN(n)?void 0:String.fromCodePoint(n)}function i(t){return t>=48&&t<=57}function s(t){return t>=65&&t<=90||t>=97&&t<=122}function a(t){return i(t)||t>=65&&t<=70||t>=97&&t<=102}function u(t){return"."===t||"%2e"===t.toLowerCase()}function c(t){return 2===t.length&&s(t.codePointAt(0))&&(":"===t[1]||"|"===t[1])}function l(t){return void 0!==e[t]}function d(t){return l(t.scheme)}function p(t){let e=t.toString(16).toUpperCase();return 1===e.length&&(e="0"+e),"%"+e}function h(t){return t<=31||t>126}const f=new Set([32,34,35,60,62,63,96,123,125]);function v(t){return h(t)||f.has(t)}const m=new Set([47,58,59,61,64,91,92,93,94,124]);function b(t){return v(t)||m.has(t)}function y(t,e){const n=String.fromCodePoint(t);return e(t)?function(t){const e=new Buffer(t);let n="";for(let t=0;t<e.length;++t)n+=p(e[t]);return n}(n):n}function g(t){let e=10;if(t.length>=2&&"0"===t.charAt(0)&&"x"===t.charAt(1).toLowerCase()?(t=t.substring(2),e=16):t.length>=2&&"0"===t.charAt(0)&&(t=t.substring(1),e=8),""===t)return 0;return(10===e?/[^0-9]/:16===e?/[^0-9A-Fa-f]/:/[^0-7]/).test(t)?n:parseInt(t,e)}function w(t,e){if("["===t[0])return"]"!==t[t.length-1]?n:function(t){const e=[0,0,0,0,0,0,0,0];let r=0,s=null,u=0;if(58===(t=j.default.ucs2.decode(t))[u]){if(58!==t[u+1])return n;u+=2,++r,s=r}for(;u<t.length;){if(8===r)return n;if(58===t[u]){if(null!==s)return n;++u,++r,s=r;continue}let c=0,l=0;for(;l<4&&a(t[u]);)c=16*c+parseInt(o(t,u),16),++u,++l;if(46===t[u]){if(0===l)return n;if(u-=l,r>6)return n;let s=0;for(;void 0!==t[u];){let a=null;if(s>0){if(!(46===t[u]&&s<4))return n;++u}if(!i(t[u]))return n;for(;i(t[u]);){const e=parseInt(o(t,u));if(null===a)a=e;else{if(0===a)return n;a=10*a+e}if(a>255)return n;++u}e[r]=256*e[r]+a,++s,2!==s&&4!==s||++r}if(4!==s)return n;break}if(58===t[u]){if(++u,void 0===t[u])return n}else if(void 0!==t[u])return n;e[r]=c,++r}if(null!==s){let t=r-s;for(r=7;0!==r&&t>0;){const n=e[s+t-1];e[s+t-1]=e[r],e[r]=n,--r,--t}}else if(null===s&&8!==r)return n;return e}(t.substring(1,t.length-1));if(!e)return function(t){if(e=t,-1!==e.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/))return n;var e;let r="";const o=j.default.ucs2.decode(t);for(let t=0;t<o.length;++t)r+=y(o[t],h);return r}(t);const r=function(t){const e=new Buffer(t),n=[];for(let t=0;t<e.length;++t)37!==e[t]?n.push(e[t]):37===e[t]&&a(e[t+1])&&a(e[t+2])?(n.push(parseInt(e.slice(t+1,t+3).toString(),16)),t+=2):n.push(e[t]);return new Buffer(n).toString()}(t),s=vr.toASCII(r,!1,vr.PROCESSING_OPTIONS.NONTRANSITIONAL,!1);if(null===s)return n;if(-1!==s.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/))return n;const u=function(t){const e=t.split(".");if(""===e[e.length-1]&&e.length>1&&e.pop(),e.length>4)return t;const r=[];for(const o of e){if(""===o)return t;const e=g(o);if(e===n)return t;r.push(e)}for(let t=0;t<r.length-1;++t)if(r[t]>255)return n;if(r[r.length-1]>=Math.pow(256,5-r.length))return n;let o=r.pop(),i=0;for(const t of r)o+=t*Math.pow(256,3-i),++i;return o}(s);return"number"==typeof u||u===n?u:s}function _(t){return"number"==typeof t?function(t){let e="",n=t;for(let t=1;t<=4;++t)e=String(n%256)+e,4!==t&&(e="."+e),n=Math.floor(n/256);return e}(t):t instanceof Array?"["+function(t){let e="";const n=function(t){let e=null,n=1,r=null,o=0;for(let i=0;i<t.length;++i)0!==t[i]?(o>n&&(e=r,n=o),r=null,o=0):(null===r&&(r=i),++o);return o>n&&(e=r,n=o),{idx:e,len:n}}(t).idx;let r=!1;for(let o=0;o<=7;++o)r&&0===t[o]||(r&&(r=!1),n!==o?(e+=t[o].toString(16),7!==o&&(e+=":")):(e+=0===o?"::":":",r=!0));return e}(t)+"]":t}function E(t){const e=t.path;var n;0!==e.length&&("file"===t.scheme&&1===e.length&&(n=e[0],/^[A-Za-z]:$/.test(n))||e.pop())}function S(t){return""!==t.username||""!==t.password}function x(t,e,r,o,i){if(this.pointer=0,this.input=t,this.base=e||null,this.encodingOverride=r||"utf-8",this.stateOverride=i,this.url=o,this.failure=!1,this.parseError=!1,!this.url){this.url={scheme:"",username:"",password:"",host:null,port:null,path:[],query:null,fragment:null,cannotBeABaseURL:!1};const t=function(t){return t.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g,"")}(this.input);t!==this.input&&(this.parseError=!0),this.input=t}const s=function(t){return t.replace(/\u0009|\u000A|\u000D/g,"")}(this.input);for(s!==this.input&&(this.parseError=!0),this.input=s,this.state=i||"scheme start",this.buffer="",this.atFlag=!1,this.arrFlag=!1,this.passwordTokenSeenFlag=!1,this.input=j.default.ucs2.decode(this.input);this.pointer<=this.input.length;++this.pointer){const t=this.input[this.pointer],e=isNaN(t)?void 0:String.fromCodePoint(t),r=this["parse "+this.state](t,e);if(!r)break;if(r===n){this.failure=!0;break}}}x.prototype["parse scheme start"]=function(t,e){if(s(t))this.buffer+=e.toLowerCase(),this.state="scheme";else{if(this.stateOverride)return this.parseError=!0,n;this.state="no scheme",--this.pointer}return!0},x.prototype["parse scheme"]=function(t,e){if(function(t){return s(t)||i(t)}(t)||43===t||45===t||46===t)this.buffer+=e.toLowerCase();else if(58===t){if(this.stateOverride){if(d(this.url)&&!l(this.buffer))return!1;if(!d(this.url)&&l(this.buffer))return!1;if((S(this.url)||null!==this.url.port)&&"file"===this.buffer)return!1;if("file"===this.url.scheme&&(""===this.url.host||null===this.url.host))return!1}if(this.url.scheme=this.buffer,this.buffer="",this.stateOverride)return!1;"file"===this.url.scheme?(47===this.input[this.pointer+1]&&47===this.input[this.pointer+2]||(this.parseError=!0),this.state="file"):d(this.url)&&null!==this.base&&this.base.scheme===this.url.scheme?this.state="special relative or authority":d(this.url)?this.state="special authority slashes":47===this.input[this.pointer+1]?(this.state="path or authority",++this.pointer):(this.url.cannotBeABaseURL=!0,this.url.path.push(""),this.state="cannot-be-a-base-URL path")}else{if(this.stateOverride)return this.parseError=!0,n;this.buffer="",this.state="no scheme",this.pointer=-1}return!0},x.prototype["parse no scheme"]=function(t){return null===this.base||this.base.cannotBeABaseURL&&35!==t?n:(this.base.cannotBeABaseURL&&35===t?(this.url.scheme=this.base.scheme,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.url.cannotBeABaseURL=!0,this.state="fragment"):"file"===this.base.scheme?(this.state="file",--this.pointer):(this.state="relative",--this.pointer),!0)},x.prototype["parse special relative or authority"]=function(t){return 47===t&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="relative",--this.pointer),!0},x.prototype["parse path or authority"]=function(t){return 47===t?this.state="authority":(this.state="path",--this.pointer),!0},x.prototype["parse relative"]=function(t){return this.url.scheme=this.base.scheme,isNaN(t)?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query):47===t?this.state="relative slash":63===t?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===t?(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):d(this.url)&&92===t?(this.parseError=!0,this.state="relative slash"):(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.url.path=this.base.path.slice(0,this.base.path.length-1),this.state="path",--this.pointer),!0},x.prototype["parse relative slash"]=function(t){return!d(this.url)||47!==t&&92!==t?47===t?this.state="authority":(this.url.username=this.base.username,this.url.password=this.base.password,this.url.host=this.base.host,this.url.port=this.base.port,this.state="path",--this.pointer):(92===t&&(this.parseError=!0),this.state="special authority ignore slashes"),!0},x.prototype["parse special authority slashes"]=function(t){return 47===t&&47===this.input[this.pointer+1]?(this.state="special authority ignore slashes",++this.pointer):(this.parseError=!0,this.state="special authority ignore slashes",--this.pointer),!0},x.prototype["parse special authority ignore slashes"]=function(t){return 47!==t&&92!==t?(this.state="authority",--this.pointer):this.parseError=!0,!0},x.prototype["parse authority"]=function(t,e){if(64===t){this.parseError=!0,this.atFlag&&(this.buffer="%40"+this.buffer),this.atFlag=!0;const t=r(this.buffer);for(let e=0;e<t;++e){const t=this.buffer.codePointAt(e);if(58===t&&!this.passwordTokenSeenFlag){this.passwordTokenSeenFlag=!0;continue}const n=y(t,b);this.passwordTokenSeenFlag?this.url.password+=n:this.url.username+=n}this.buffer=""}else if(isNaN(t)||47===t||63===t||35===t||d(this.url)&&92===t){if(this.atFlag&&""===this.buffer)return this.parseError=!0,n;this.pointer-=r(this.buffer)+1,this.buffer="",this.state="host"}else this.buffer+=e;return!0},x.prototype["parse hostname"]=x.prototype["parse host"]=function(t,e){if(this.stateOverride&&"file"===this.url.scheme)--this.pointer,this.state="file host";else if(58!==t||this.arrFlag)if(isNaN(t)||47===t||63===t||35===t||d(this.url)&&92===t){if(--this.pointer,d(this.url)&&""===this.buffer)return this.parseError=!0,n;if(this.stateOverride&&""===this.buffer&&(S(this.url)||null!==this.url.port))return this.parseError=!0,!1;const t=w(this.buffer,d(this.url));if(t===n)return n;if(this.url.host=t,this.buffer="",this.state="path start",this.stateOverride)return!1}else 91===t?this.arrFlag=!0:93===t&&(this.arrFlag=!1),this.buffer+=e;else{if(""===this.buffer)return this.parseError=!0,n;const t=w(this.buffer,d(this.url));if(t===n)return n;if(this.url.host=t,this.buffer="",this.state="port","hostname"===this.stateOverride)return!1}return!0},x.prototype["parse port"]=function(t,r){if(i(t))this.buffer+=r;else{if(!(isNaN(t)||47===t||63===t||35===t||d(this.url)&&92===t||this.stateOverride))return this.parseError=!0,n;if(""!==this.buffer){const t=parseInt(this.buffer);if(t>Math.pow(2,16)-1)return this.parseError=!0,n;this.url.port=t===(o=this.url.scheme,e[o])?null:t,this.buffer=""}if(this.stateOverride)return!1;this.state="path start",--this.pointer}var o;return!0};const A=new Set([47,92,63,35]);x.prototype["parse file"]=function(t){var e,n;return this.url.scheme="file",47===t||92===t?(92===t&&(this.parseError=!0),this.state="file slash"):null!==this.base&&"file"===this.base.scheme?isNaN(t)?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query):63===t?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query="",this.state="query"):35===t?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),this.url.query=this.base.query,this.url.fragment="",this.state="fragment"):(this.input.length-this.pointer-1==0||(e=t,n=this.input[this.pointer+1],!s(e)||58!==n&&124!==n)||this.input.length-this.pointer-1>=2&&!A.has(this.input[this.pointer+2])?(this.url.host=this.base.host,this.url.path=this.base.path.slice(),E(this.url)):this.parseError=!0,this.state="path",--this.pointer):(this.state="path",--this.pointer),!0},x.prototype["parse file slash"]=function(t){var e;return 47===t||92===t?(92===t&&(this.parseError=!0),this.state="file host"):(null!==this.base&&"file"===this.base.scheme&&(2===(e=this.base.path[0]).length&&s(e.codePointAt(0))&&":"===e[1]?this.url.path.push(this.base.path[0]):this.url.host=this.base.host),this.state="path",--this.pointer),!0},x.prototype["parse file host"]=function(t,e){if(isNaN(t)||47===t||92===t||63===t||35===t)if(--this.pointer,!this.stateOverride&&c(this.buffer))this.parseError=!0,this.state="path";else if(""===this.buffer){if(this.url.host="",this.stateOverride)return!1;this.state="path start"}else{let t=w(this.buffer,d(this.url));if(t===n)return n;if("localhost"===t&&(t=""),this.url.host=t,this.stateOverride)return!1;this.buffer="",this.state="path start"}else this.buffer+=e;return!0},x.prototype["parse path start"]=function(t){return d(this.url)?(92===t&&(this.parseError=!0),this.state="path",47!==t&&92!==t&&--this.pointer):this.stateOverride||63!==t?this.stateOverride||35!==t?void 0!==t&&(this.state="path",47!==t&&--this.pointer):(this.url.fragment="",this.state="fragment"):(this.url.query="",this.state="query"),!0},x.prototype["parse path"]=function(t){if(isNaN(t)||47===t||d(this.url)&&92===t||!this.stateOverride&&(63===t||35===t)){if(d(this.url)&&92===t&&(this.parseError=!0),".."===(e=(e=this.buffer).toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e?(E(this.url),47===t||d(this.url)&&92===t||this.url.path.push("")):!u(this.buffer)||47===t||d(this.url)&&92===t?u(this.buffer)||("file"===this.url.scheme&&0===this.url.path.length&&c(this.buffer)&&(""!==this.url.host&&null!==this.url.host&&(this.parseError=!0,this.url.host=""),this.buffer=this.buffer[0]+":"),this.url.path.push(this.buffer)):this.url.path.push(""),this.buffer="","file"===this.url.scheme&&(void 0===t||63===t||35===t))for(;this.url.path.length>1&&""===this.url.path[0];)this.parseError=!0,this.url.path.shift();63===t&&(this.url.query="",this.state="query"),35===t&&(this.url.fragment="",this.state="fragment")}else 37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=y(t,v);var e;return!0},x.prototype["parse cannot-be-a-base-URL path"]=function(t){return 63===t?(this.url.query="",this.state="query"):35===t?(this.url.fragment="",this.state="fragment"):(isNaN(t)||37===t||(this.parseError=!0),37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),isNaN(t)||(this.url.path[0]=this.url.path[0]+y(t,h))),!0},x.prototype["parse query"]=function(t,e){if(isNaN(t)||!this.stateOverride&&35===t){d(this.url)&&"ws"!==this.url.scheme&&"wss"!==this.url.scheme||(this.encodingOverride="utf-8");const e=new Buffer(this.buffer);for(let t=0;t<e.length;++t)e[t]<33||e[t]>126||34===e[t]||35===e[t]||60===e[t]||62===e[t]?this.url.query+=p(e[t]):this.url.query+=String.fromCodePoint(e[t]);this.buffer="",35===t&&(this.url.fragment="",this.state="fragment")}else 37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),this.buffer+=e;return!0},x.prototype["parse fragment"]=function(t){return isNaN(t)||(0===t?this.parseError=!0:(37!==t||a(this.input[this.pointer+1])&&a(this.input[this.pointer+2])||(this.parseError=!0),this.url.fragment+=y(t,h))),!0},t.exports.serializeURL=function(t,e){let n=t.scheme+":";if(null!==t.host?(n+="//",""===t.username&&""===t.password||(n+=t.username,""!==t.password&&(n+=":"+t.password),n+="@"),n+=_(t.host),null!==t.port&&(n+=":"+t.port)):null===t.host&&"file"===t.scheme&&(n+="//"),t.cannotBeABaseURL)n+=t.path[0];else for(const e of t.path)n+="/"+e;return null!==t.query&&(n+="?"+t.query),e||null===t.fragment||(n+="#"+t.fragment),n},t.exports.serializeURLOrigin=function(e){switch(e.scheme){case"blob":try{return t.exports.serializeURLOrigin(t.exports.parseURL(e.path[0]))}catch(t){return"null"}case"ftp":case"gopher":case"http":case"https":case"ws":case"wss":return function(t){let e=t.scheme+"://";return e+=_(t.host),null!==t.port&&(e+=":"+t.port),e}({scheme:e.scheme,host:e.host,port:e.port});case"file":return"file://";default:return"null"}},t.exports.basicURLParse=function(t,e){void 0===e&&(e={});const n=new x(t,e.baseURL,e.encodingOverride,e.url,e.stateOverride);return n.failure?"failure":n.url},t.exports.setTheUsername=function(t,e){t.username="";const n=j.default.ucs2.decode(e);for(let e=0;e<n.length;++e)t.username+=y(n[e],b)},t.exports.setThePassword=function(t,e){t.password="";const n=j.default.ucs2.decode(e);for(let e=0;e<n.length;++e)t.password+=y(n[e],b)},t.exports.serializeHost=_,t.exports.cannotHaveAUsernamePasswordPort=function(t){return null===t.host||""===t.host||t.cannotBeABaseURL||"file"===t.scheme},t.exports.serializeInteger=function(t){return String(t)},t.exports.parseURL=function(e,n){return void 0===n&&(n={}),t.exports.basicURLParse(e,{baseURL:n.baseURL,encodingOverride:n.encodingOverride})}}));mr.serializeURL,mr.serializeURLOrigin,mr.basicURLParse,mr.setTheUsername,mr.setThePassword,mr.serializeHost,mr.cannotHaveAUsernamePasswordPort,mr.serializeInteger,mr.parseURL;var br=class{constructor(t){const e=t[0],n=t[1];let r=null;if(void 0!==n&&(r=mr.basicURLParse(n),"failure"===r))throw new TypeError("Invalid base URL");const o=mr.basicURLParse(e,{baseURL:r});if("failure"===o)throw new TypeError("Invalid URL");this._url=o}get href(){return mr.serializeURL(this._url)}set href(t){const e=mr.basicURLParse(t);if("failure"===e)throw new TypeError("Invalid URL");this._url=e}get origin(){return mr.serializeURLOrigin(this._url)}get protocol(){return this._url.scheme+":"}set protocol(t){mr.basicURLParse(t+":",{url:this._url,stateOverride:"scheme start"})}get username(){return this._url.username}set username(t){mr.cannotHaveAUsernamePasswordPort(this._url)||mr.setTheUsername(this._url,t)}get password(){return this._url.password}set password(t){mr.cannotHaveAUsernamePasswordPort(this._url)||mr.setThePassword(this._url,t)}get host(){const t=this._url;return null===t.host?"":null===t.port?mr.serializeHost(t.host):mr.serializeHost(t.host)+":"+mr.serializeInteger(t.port)}set host(t){this._url.cannotBeABaseURL||mr.basicURLParse(t,{url:this._url,stateOverride:"host"})}get hostname(){return null===this._url.host?"":mr.serializeHost(this._url.host)}set hostname(t){this._url.cannotBeABaseURL||mr.basicURLParse(t,{url:this._url,stateOverride:"hostname"})}get port(){return null===this._url.port?"":mr.serializeInteger(this._url.port)}set port(t){mr.cannotHaveAUsernamePasswordPort(this._url)||(""===t?this._url.port=null:mr.basicURLParse(t,{url:this._url,stateOverride:"port"}))}get pathname(){return this._url.cannotBeABaseURL?this._url.path[0]:0===this._url.path.length?"":"/"+this._url.path.join("/")}set pathname(t){this._url.cannotBeABaseURL||(this._url.path=[],mr.basicURLParse(t,{url:this._url,stateOverride:"path start"}))}get search(){return null===this._url.query||""===this._url.query?"":"?"+this._url.query}set search(t){const e=this._url;if(""===t)return void(e.query=null);const n="?"===t[0]?t.substring(1):t;e.query="",mr.basicURLParse(n,{url:e,stateOverride:"query"})}get hash(){return null===this._url.fragment||""===this._url.fragment?"":"#"+this._url.fragment}set hash(t){if(""===t)return void(this._url.fragment=null);const e="#"===t[0]?t.substring(1):t;this._url.fragment="",mr.basicURLParse(e,{url:this._url,stateOverride:"fragment"})}toJSON(){return this.href}},yr=Qn((function(t){const e=or.implSymbol;function n(r){if(!this||this[e]||!(this instanceof n))throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function.");if(arguments.length<1)throw new TypeError("Failed to construct 'URL': 1 argument required, but only "+arguments.length+" present.");const o=[];for(let t=0;t<arguments.length&&t<2;++t)o[t]=arguments[t];o[0]=er.USVString(o[0]),void 0!==o[1]&&(o[1]=er.USVString(o[1])),t.exports.setup(this,o)}n.prototype.toJSON=function(){if(!this||!t.exports.is(this))throw new TypeError("Illegal invocation");const n=[];for(let t=0;t<arguments.length&&t<0;++t)n[t]=arguments[t];return this[e].toJSON.apply(this[e],n)},Object.defineProperty(n.prototype,"href",{get(){return this[e].href},set(t){t=er.USVString(t),this[e].href=t},enumerable:!0,configurable:!0}),n.prototype.toString=function(){if(!this||!t.exports.is(this))throw new TypeError("Illegal invocation");return this.href},Object.defineProperty(n.prototype,"origin",{get(){return this[e].origin},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"protocol",{get(){return this[e].protocol},set(t){t=er.USVString(t),this[e].protocol=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"username",{get(){return this[e].username},set(t){t=er.USVString(t),this[e].username=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"password",{get(){return this[e].password},set(t){t=er.USVString(t),this[e].password=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"host",{get(){return this[e].host},set(t){t=er.USVString(t),this[e].host=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hostname",{get(){return this[e].hostname},set(t){t=er.USVString(t),this[e].hostname=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"port",{get(){return this[e].port},set(t){t=er.USVString(t),this[e].port=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pathname",{get(){return this[e].pathname},set(t){t=er.USVString(t),this[e].pathname=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"search",{get(){return this[e].search},set(t){t=er.USVString(t),this[e].search=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hash",{get(){return this[e].hash},set(t){t=er.USVString(t),this[e].hash=t},enumerable:!0,configurable:!0}),t.exports={is:t=>!!t&&t[e]instanceof br,create(t,e){let r=Object.create(n.prototype);return this.setup(r,t,e),r},setup(t,n,r){r||(r={}),r.wrapper=t,t[e]=new br(n,r),t[e][or.wrapperSymbol]=t},interface:n,expose:{Window:{URL:n},Worker:{URL:n}}}}));yr.is,yr.create,yr.setup,yr.expose;var gr={URL:yr.interface,serializeURL:mr.serializeURL,serializeURLOrigin:mr.serializeURLOrigin,basicURLParse:mr.basicURLParse,setTheUsername:mr.setTheUsername,setThePassword:mr.setThePassword,serializeHost:mr.serializeHost,serializeInteger:mr.serializeInteger,parseURL:mr.parseURL};const wr=y.default.Readable,_r=Symbol("buffer"),jr=Symbol("type");class Er{constructor(){this[jr]="";const t=arguments[0],e=arguments[1],n=[];let r=0;if(t){const e=t,o=Number(e.length);for(let t=0;t<o;t++){const o=e[t];let i;i=o instanceof Buffer?o:ArrayBuffer.isView(o)?Buffer.from(o.buffer,o.byteOffset,o.byteLength):o instanceof ArrayBuffer?Buffer.from(o):o instanceof Er?o[_r]:Buffer.from("string"==typeof o?o:String(o)),r+=i.length,n.push(i)}}this[_r]=Buffer.concat(n);let o=e&&void 0!==e.type&&String(e.type).toLowerCase();o&&!/[^\u0020-\u007E]/.test(o)&&(this[jr]=o)}get size(){return this[_r].length}get type(){return this[jr]}text(){return Promise.resolve(this[_r].toString())}arrayBuffer(){const t=this[_r],e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return Promise.resolve(e)}stream(){const t=new wr;return t._read=function(){},t.push(this[_r]),t.push(null),t}toString(){return"[object Blob]"}slice(){const t=this.size,e=arguments[0],n=arguments[1];let r,o;r=void 0===e?0:e<0?Math.max(t+e,0):Math.min(e,t),o=void 0===n?t:n<0?Math.max(t+n,0):Math.min(n,t);const i=Math.max(o-r,0),s=this[_r].slice(r,r+i),a=new Er([],{type:arguments[2]});return a[_r]=s,a}}function Sr(t,e,n){Error.call(this,t),this.message=t,this.type=e,n&&(this.code=this.errno=n.code),Error.captureStackTrace(this,this.constructor)}let xr;Object.defineProperties(Er.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Object.defineProperty(Er.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0}),Sr.prototype=Object.create(Error.prototype),Sr.prototype.constructor=Sr,Sr.prototype.name="FetchError";try{xr=require("encoding").convert}catch(t){}const Ar=Symbol("Body internals"),Cr=y.default.PassThrough;function Or(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.size;let o=void 0===r?0:r;var i=n.timeout;let s=void 0===i?0:i;null==t?t=null:Ir(t)?t=Buffer.from(t.toString()):Ur(t)||Buffer.isBuffer(t)||("[object ArrayBuffer]"===Object.prototype.toString.call(t)?t=Buffer.from(t):ArrayBuffer.isView(t)?t=Buffer.from(t.buffer,t.byteOffset,t.byteLength):t instanceof y.default||(t=Buffer.from(String(t)))),this[Ar]={body:t,disturbed:!1,error:null},this.size=o,this.timeout=s,t instanceof y.default&&t.on("error",(function(t){const n="AbortError"===t.name?t:new Sr(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,"system",t);e[Ar].error=n}))}function kr(){var t=this;if(this[Ar].disturbed)return Or.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[Ar].disturbed=!0,this[Ar].error)return Or.Promise.reject(this[Ar].error);let e=this.body;if(null===e)return Or.Promise.resolve(Buffer.alloc(0));if(Ur(e)&&(e=e.stream()),Buffer.isBuffer(e))return Or.Promise.resolve(e);if(!(e instanceof y.default))return Or.Promise.resolve(Buffer.alloc(0));let n=[],r=0,o=!1;return new Or.Promise((function(i,s){let a;t.timeout&&(a=setTimeout((function(){o=!0,s(new Sr(`Response timeout while trying to fetch ${t.url} (over ${t.timeout}ms)`,"body-timeout"))}),t.timeout)),e.on("error",(function(e){"AbortError"===e.name?(o=!0,s(e)):s(new Sr(`Invalid response body while trying to fetch ${t.url}: ${e.message}`,"system",e))})),e.on("data",(function(e){if(!o&&null!==e){if(t.size&&r+e.length>t.size)return o=!0,void s(new Sr(`content size at ${t.url} over limit: ${t.size}`,"max-size"));r+=e.length,n.push(e)}})),e.on("end",(function(){if(!o){clearTimeout(a);try{i(Buffer.concat(n,r))}catch(e){s(new Sr(`Could not create Buffer from response body for ${t.url}: ${e.message}`,"system",e))}}}))}))}function Ir(t){return"object"==typeof t&&"function"==typeof t.append&&"function"==typeof t.delete&&"function"==typeof t.get&&"function"==typeof t.getAll&&"function"==typeof t.has&&"function"==typeof t.set&&("URLSearchParams"===t.constructor.name||"[object URLSearchParams]"===Object.prototype.toString.call(t)||"function"==typeof t.sort)}function Ur(t){return"object"==typeof t&&"function"==typeof t.arrayBuffer&&"string"==typeof t.type&&"function"==typeof t.stream&&"function"==typeof t.constructor&&"string"==typeof t.constructor.name&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}function Dr(t){let e,n,r=t.body;if(t.bodyUsed)throw new Error("cannot clone body after it is used");return r instanceof y.default&&"function"!=typeof r.getBoundary&&(e=new Cr,n=new Cr,r.pipe(e),r.pipe(n),t[Ar].body=e,r=n),r}function Pr(t){return null===t?null:"string"==typeof t?"text/plain;charset=UTF-8":Ir(t)?"application/x-www-form-urlencoded;charset=UTF-8":Ur(t)?t.type||null:Buffer.isBuffer(t)||"[object ArrayBuffer]"===Object.prototype.toString.call(t)||ArrayBuffer.isView(t)?null:"function"==typeof t.getBoundary?`multipart/form-data;boundary=${t.getBoundary()}`:t instanceof y.default?null:"text/plain;charset=UTF-8"}function Br(t){const e=t.body;return null===e?0:Ur(e)?e.size:Buffer.isBuffer(e)?e.length:e&&"function"==typeof e.getLengthSync&&(e._lengthRetrievers&&0==e._lengthRetrievers.length||e.hasKnownLength&&e.hasKnownLength())?e.getLengthSync():null}Or.prototype={get body(){return this[Ar].body},get bodyUsed(){return this[Ar].disturbed},arrayBuffer(){return kr.call(this).then((function(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}))},blob(){let t=this.headers&&this.headers.get("content-type")||"";return kr.call(this).then((function(e){return Object.assign(new Er([],{type:t.toLowerCase()}),{[_r]:e})}))},json(){var t=this;return kr.call(this).then((function(e){try{return JSON.parse(e.toString())}catch(e){return Or.Promise.reject(new Sr(`invalid json response body at ${t.url} reason: ${e.message}`,"invalid-json"))}}))},text(){return kr.call(this).then((function(t){return t.toString()}))},buffer(){return kr.call(this)},textConverted(){var t=this;return kr.call(this).then((function(e){return function(t,e){if("function"!=typeof xr)throw new Error("The package `encoding` must be installed to use the textConverted() function");const n=e.get("content-type");let r,o,i="utf-8";n&&(r=/charset=([^;]*)/i.exec(n));o=t.slice(0,1024).toString(),!r&&o&&(r=/<meta.+?charset=(['"])(.+?)\1/i.exec(o));!r&&o&&(r=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(o),r||(r=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(o),r&&r.pop()),r&&(r=/charset=(.*)/i.exec(r.pop())));!r&&o&&(r=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(o));r&&(i=r.pop(),"gb2312"!==i&&"gbk"!==i||(i="gb18030"));return xr(t,"UTF-8",i).toString()}(e,t.headers)}))}},Object.defineProperties(Or.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}}),Or.mixIn=function(t){for(const e of Object.getOwnPropertyNames(Or.prototype))if(!(e in t)){const n=Object.getOwnPropertyDescriptor(Or.prototype,e);Object.defineProperty(t,e,n)}},Or.Promise=global.Promise;const Nr=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,Tr=/[^\t\x20-\x7e\x80-\xff]/;function Lr(t){if(t=`${t}`,Nr.test(t)||""===t)throw new TypeError(`${t} is not a legal HTTP header name`)}function Rr(t){if(t=`${t}`,Tr.test(t))throw new TypeError(`${t} is not a legal HTTP header value`)}function Fr(t,e){e=e.toLowerCase();for(const n in t)if(n.toLowerCase()===e)return n}const Gr=Symbol("map");class Mr{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;if(this[Gr]=Object.create(null),t instanceof Mr){const e=t.raw(),n=Object.keys(e);for(const t of n)for(const n of e[t])this.append(t,n)}else if(null==t);else{if("object"!=typeof t)throw new TypeError("Provided initializer must be an object");{const e=t[Symbol.iterator];if(null!=e){if("function"!=typeof e)throw new TypeError("Header pairs must be iterable");const n=[];for(const e of t){if("object"!=typeof e||"function"!=typeof e[Symbol.iterator])throw new TypeError("Each header pair must be iterable");n.push(Array.from(e))}for(const t of n){if(2!==t.length)throw new TypeError("Each header pair must be a name/value tuple");this.append(t[0],t[1])}}else for(const e of Object.keys(t)){const n=t[e];this.append(e,n)}}}}get(t){Lr(t=`${t}`);const e=Fr(this[Gr],t);return void 0===e?null:this[Gr][e].join(", ")}forEach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=zr(this),r=0;for(;r<n.length;){var o=n[r];const i=o[0],s=o[1];t.call(e,s,i,this),n=zr(this),r++}}set(t,e){e=`${e}`,Lr(t=`${t}`),Rr(e);const n=Fr(this[Gr],t);this[Gr][void 0!==n?n:t]=[e]}append(t,e){e=`${e}`,Lr(t=`${t}`),Rr(e);const n=Fr(this[Gr],t);void 0!==n?this[Gr][n].push(e):this[Gr][t]=[e]}has(t){return Lr(t=`${t}`),void 0!==Fr(this[Gr],t)}delete(t){Lr(t=`${t}`);const e=Fr(this[Gr],t);void 0!==e&&delete this[Gr][e]}raw(){return this[Gr]}keys(){return Wr(this,"key")}values(){return Wr(this,"value")}[Symbol.iterator](){return Wr(this,"key+value")}}function zr(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key+value";const n=Object.keys(t[Gr]).sort();return n.map("key"===e?function(t){return t.toLowerCase()}:"value"===e?function(e){return t[Gr][e].join(", ")}:function(e){return[e.toLowerCase(),t[Gr][e].join(", ")]})}Mr.prototype.entries=Mr.prototype[Symbol.iterator],Object.defineProperty(Mr.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(Mr.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});const qr=Symbol("internal");function Wr(t,e){const n=Object.create($r);return n[qr]={target:t,kind:e,index:0},n}const $r=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==$r)throw new TypeError("Value of `this` is not a HeadersIterator");var t=this[qr];const e=t.target,n=t.kind,r=t.index,o=zr(e,n);return r>=o.length?{value:void 0,done:!0}:(this[qr].index=r+1,{value:o[r],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));function Jr(t){const e=Object.assign({__proto__:null},t[Gr]),n=Fr(t[Gr],"Host");return void 0!==n&&(e[n]=e[n][0]),e}Object.defineProperty($r,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});const Hr=Symbol("Response internals"),Vr=w.default.STATUS_CODES;class Yr{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Or.call(this,t,e);const n=e.status||200,r=new Mr(e.headers);if(null!=t&&!r.has("Content-Type")){const e=Pr(t);e&&r.append("Content-Type",e)}this[Hr]={url:e.url,status:n,statusText:e.statusText||Vr[n],headers:r,counter:e.counter}}get url(){return this[Hr].url||""}get status(){return this[Hr].status}get ok(){return this[Hr].status>=200&&this[Hr].status<300}get redirected(){return this[Hr].counter>0}get statusText(){return this[Hr].statusText}get headers(){return this[Hr].headers}clone(){return new Yr(Dr(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}}Or.mixIn(Yr.prototype),Object.defineProperties(Yr.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),Object.defineProperty(Yr.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});const Zr=Symbol("Request internals"),Kr=_.default.URL||gr.URL,Xr=_.default.parse,Qr=_.default.format;function to(t){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(t)&&(t=new Kr(t).toString()),Xr(t)}const eo="destroy"in y.default.Readable.prototype;function no(t){return"object"==typeof t&&"object"==typeof t[Zr]}class ro{constructor(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};no(t)?e=to(t.url):(e=t&&t.href?to(t.href):to(`${t}`),t={});let r=n.method||t.method||"GET";if(r=r.toUpperCase(),(null!=n.body||no(t)&&null!==t.body)&&("GET"===r||"HEAD"===r))throw new TypeError("Request with GET/HEAD method cannot have body");let o=null!=n.body?n.body:no(t)&&null!==t.body?Dr(t):null;Or.call(this,o,{timeout:n.timeout||t.timeout||0,size:n.size||t.size||0});const i=new Mr(n.headers||t.headers||{});if(null!=o&&!i.has("Content-Type")){const t=Pr(o);t&&i.append("Content-Type",t)}let s=no(t)?t.signal:null;if("signal"in n&&(s=n.signal),null!=s&&!function(t){const e=t&&"object"==typeof t&&Object.getPrototypeOf(t);return!(!e||"AbortSignal"!==e.constructor.name)}(s))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[Zr]={method:r,redirect:n.redirect||t.redirect||"follow",headers:i,parsedURL:e,signal:s},this.follow=void 0!==n.follow?n.follow:void 0!==t.follow?t.follow:20,this.compress=void 0!==n.compress?n.compress:void 0===t.compress||t.compress,this.counter=n.counter||t.counter||0,this.agent=n.agent||t.agent}get method(){return this[Zr].method}get url(){return Qr(this[Zr].parsedURL)}get headers(){return this[Zr].headers}get redirect(){return this[Zr].redirect}get signal(){return this[Zr].signal}clone(){return new ro(this)}}function oo(t){Error.call(this,t),this.type="aborted",this.message=t,Error.captureStackTrace(this,this.constructor)}Or.mixIn(ro.prototype),Object.defineProperty(ro.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(ro.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}}),oo.prototype=Object.create(Error.prototype),oo.prototype.constructor=oo,oo.prototype.name="AbortError";const io=_.default.URL||gr.URL,so=y.default.PassThrough;function ao(t,e){if(!ao.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Or.Promise=ao.Promise,new ao.Promise((function(n,r){const o=new ro(t,e),i=function(t){const e=t[Zr].parsedURL,n=new Mr(t[Zr].headers);if(n.has("Accept")||n.set("Accept","*/*"),!e.protocol||!e.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(e.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(t.signal&&t.body instanceof y.default.Readable&&!eo)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let r=null;if(null==t.body&&/^(POST|PUT)$/i.test(t.method)&&(r="0"),null!=t.body){const e=Br(t);"number"==typeof e&&(r=String(e))}r&&n.set("Content-Length",r),n.has("User-Agent")||n.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),t.compress&&!n.has("Accept-Encoding")&&n.set("Accept-Encoding","gzip,deflate");let o=t.agent;return"function"==typeof o&&(o=o(e)),n.has("Connection")||o||n.set("Connection","close"),Object.assign({},e,{method:t.method,headers:Jr(n),agent:o})}(o),s=("https:"===i.protocol?E.default:w.default).request,a=o.signal;let u=null;const c=function(){let t=new oo("The user aborted a request.");r(t),o.body&&o.body instanceof y.default.Readable&&o.body.destroy(t),u&&u.body&&u.body.emit("error",t)};if(a&&a.aborted)return void c();const l=function(){c(),h()},d=s(i);let p;function h(){d.abort(),a&&a.removeEventListener("abort",l),clearTimeout(p)}a&&a.addEventListener("abort",l),o.timeout&&d.once("socket",(function(t){p=setTimeout((function(){r(new Sr(`network timeout at: ${o.url}`,"request-timeout")),h()}),o.timeout)})),d.on("error",(function(t){r(new Sr(`request to ${o.url} failed, reason: ${t.message}`,"system",t)),h()})),d.on("response",(function(t){clearTimeout(p);const e=function(t){const e=new Mr;for(const n of Object.keys(t))if(!Nr.test(n))if(Array.isArray(t[n]))for(const r of t[n])Tr.test(r)||(void 0===e[Gr][n]?e[Gr][n]=[r]:e[Gr][n].push(r));else Tr.test(t[n])||(e[Gr][n]=[t[n]]);return e}(t.headers);if(ao.isRedirect(t.statusCode)){const i=e.get("Location");let s=null;try{s=null===i?null:new io(i,o.url).toString()}catch(t){if("manual"!==o.redirect)return r(new Sr(`uri requested responds with an invalid redirect URL: ${i}`,"invalid-redirect")),void h()}switch(o.redirect){case"error":return r(new Sr(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),void h();case"manual":if(null!==s)try{e.set("Location",s)}catch(t){r(t)}break;case"follow":if(null===s)break;if(o.counter>=o.follow)return r(new Sr(`maximum redirect reached at: ${o.url}`,"max-redirect")),void h();const i={headers:new Mr(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:o.body,signal:o.signal,timeout:o.timeout,size:o.size};if(!function(t,e){const n=new io(e).hostname,r=new io(t).hostname;return n===r||"."===n[n.length-r.length-1]&&n.endsWith(r)}(o.url,s))for(const t of["authorization","www-authenticate","cookie","cookie2"])i.headers.delete(t);return 303!==t.statusCode&&o.body&&null===Br(o)?(r(new Sr("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void h()):(303!==t.statusCode&&(301!==t.statusCode&&302!==t.statusCode||"POST"!==o.method)||(i.method="GET",i.body=void 0,i.headers.delete("content-length")),n(ao(new ro(s,i))),void h())}}t.once("end",(function(){a&&a.removeEventListener("abort",l)}));let i=t.pipe(new so);const s={url:o.url,status:t.statusCode,statusText:t.statusMessage,headers:e,size:o.size,timeout:o.timeout,counter:o.counter},c=e.get("Content-Encoding");if(!o.compress||"HEAD"===o.method||null===c||204===t.statusCode||304===t.statusCode)return u=new Yr(i,s),void n(u);const d={flush:S.default.Z_SYNC_FLUSH,finishFlush:S.default.Z_SYNC_FLUSH};if("gzip"==c||"x-gzip"==c)return i=i.pipe(S.default.createGunzip(d)),u=new Yr(i,s),void n(u);if("deflate"!=c&&"x-deflate"!=c){if("br"==c&&"function"==typeof S.default.createBrotliDecompress)return i=i.pipe(S.default.createBrotliDecompress()),u=new Yr(i,s),void n(u);u=new Yr(i,s),n(u)}else{t.pipe(new so).once("data",(function(t){i=8==(15&t[0])?i.pipe(S.default.createInflate()):i.pipe(S.default.createInflateRaw()),u=new Yr(i,s),n(u)}))}})),function(t,e){const n=e.body;null===n?t.end():Ur(n)?n.stream().pipe(t):Buffer.isBuffer(n)?(t.write(n),t.end()):n.pipe(t)}(d,o)}))}ao.isRedirect=function(t){return 301===t||302===t||303===t||307===t||308===t},ao.Promise=global.Promise;var uo=function(){function t(t){this.contextProvider=t}return t.prototype.getServiceDetails=function(t,e){return T(this,void 0,void 0,(function(){return L(this,(function(n){return[2,this.fetch("".concat(this.contextProvider.getCurrentBaseUrl(),"/v1/port-forwarding/info/projects/").concat(t,"/services/").concat(e))]}))}))},t.prototype.getAddonDetails=function(t,e){return T(this,void 0,void 0,(function(){return L(this,(function(n){return[2,this.fetch("".concat(this.contextProvider.getCurrentBaseUrl(),"/v1/port-forwarding/info/projects/").concat(t,"/addons/").concat(e))]}))}))},t.prototype.fetch=function(t,e){return T(this,void 0,void 0,(function(){var n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:return n=Xn({},{headers:{Authorization:"Bearer ".concat(this.contextProvider.getCurrentToken()),"Content-Type":"application/json"}},N({},e)),[4,ao(t,n)];case 1:return(r=a.sent()).ok?[3,3]:(o=Error.bind,s=(i=JSON).stringify,[4,r.json()]);case 2:throw new(o.apply(Error,[void 0,s.apply(i,[a.sent()])]));case 3:return[4,r.json()];case 4:return[2,a.sent()]}}))}))},t}(),co=function(t,e,n){return T(void 0,void 0,void 0,(function(){var r,o,i,s,a;return L(this,(function(u){switch(u.label){case 0:if(r=ho(e||"127.0.0.1"),(o=ho(n||"127.255.255.255"))<r)throw new Error("Invalid IP range");"darwin"===x.default.platform()&&(i=function(t){return T(void 0,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return e="lo0 alias ".concat(t," up"),[4,po.apply(void 0,e.split(" "))];case 1:return n.sent(),[2]}}))}))}),s=r,u.label=1;case 1:return s<=o?(a=fo(s),[4,lo(t,a)]):[3,6];case 2:return u.sent()?i?[4,i(a)]:[3,4]:[3,5];case 3:u.sent(),u.label=4;case 4:return[2,a];case 5:return s+=1,[3,1];case 6:throw new Error("No ip available")}}))}))},lo=function(t,e){return new Promise((function(n){var r=new u.Socket,o=!1;r.on("connect",(function(){o=!0,r.destroy()})),r.setTimeout(400),r.on("timeout",(function(){o=!1,r.destroy()})),r.on("error",(function(){o=!1})),r.on("close",(function(){n(!o)})),e?r.connect(t,e):r.connect(t)}))},po=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return T(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return"/sbin/ifconfig",[4,vo("/sbin/ifconfig",t).resultPromise];case 1:return[2,e.sent()]}}))}))},ho=function(t){var e=t.split(".").reverse();if(4!==e.length)throw new Error("Invalid ip address: ".concat(t));for(var n=0,r=0;r<4;r+=1){var o=Number.parseInt(e[r],10);if(o<0||o>255)throw new Error("Invalid ip address: ".concat(t));n+=o<<8*r}return n},fo=function(t){if(!Number.isSafeInteger(t))throw new Error("Number is not an integer");if(t<0||t>4294967295)throw new Error("Number is out of range 0x0-0xffffffff");for(var e=[],n=0;n<4;n+=1)e.push(t>>8*n&255);return e.reverse().join(".")},vo=function(t,e,n){var r=c.spawn(t,e,N({windowsHide:!0},n)),o=new Promise((function(o,i){var s="",a="";(null===(null==n?void 0:n.stdio)||void 0===(null==n?void 0:n.stdio))&&(r.stdout&&r.stdout.on("data",(function(t){s+=t})),r.stderr&&r.stderr.on("data",(function(t){a+=t}))),r.on("close",(function(n){var r={code:n,stdout:s,stderr:a};if(0!==n){var u="Error during execution of command '".concat(t," ").concat(e.join(" "),"': ").concat(a);i({message:u,result:r})}else o(r)}))}));return{process:r,resultPromise:o}},mo=function(t,e,n){return T(void 0,void 0,void 0,(function(){var r,o;return L(this,(function(i){switch(i.label){case 0:return r=bo(t,10),[4,O.default.promises.writeFile(r,e,n)];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,4,,6]),[4,O.default.promises.rename(r,t)];case 3:return i.sent(),[3,6];case 4:return o=i.sent(),[4,O.default.promises.unlink(r).catch((function(){}))];case 5:throw i.sent(),o;case 6:return[2]}}))}))},bo=function(t,e){for(var n,r=k.default.dirname(t),o=k.default.basename(t),i=0;null===(n=i<e)||void 0===n||n;i+=1){var s=R([],Array(16),!0).map((function(){return Math.floor(16*Math.random()).toString(16)})).join(""),a=".".concat(s,".").concat(o),u=k.default.join(r,a);if(!O.default.existsSync(u))return u}throw new Error("Could not write file to file '".concat(t,"'."))},yo="win32"===process.platform?"\r\n":"\n",go=function(){function t(t,e){this.nodes=t,this.config=e}return t.prototype.add=function(t,e,n){var r=this;if(0===e.length)return this;var o=this.findOrCreateEntry(t,n);return e.forEach((function(t){if(!o.hosts.find((function(e){return e.host===t}))){var e=1;0===o.hosts.length&&(e=r.config.indent-"".concat(o.ipPrefixWhitespace).concat(o.ip).length),o.hosts.push({whitespace:" ".repeat(e<1?1:e),host:t})}})),this},t.prototype.remove=function(t,e){var n=this;return this.findEntries(t).forEach((function(t){e.forEach((function(e){var r=t.hosts.findIndex((function(t){return t.host===e}));r<0||(0===r&&void 0!==t.hosts[1]&&(t.hosts[1].whitespace=t.hosts[0].whitespace),t.hosts.splice(r,1),0===t.hosts.length&&n.removeEntry(t))}))})),this},t.prototype.removeHosts=function(t){var e=this;Ao(this.nodes,"entry").forEach((function(n){e.remove(n.ip,t)}))},t.prototype.removeIps=function(t){var e=this;return t.forEach((function(t){e.findEntries(t).forEach((function(t){return e.removeEntry(t)}))})),this},t.prototype.resolveHosts=function(t){return Hn(this.findEntries(t),(function(t){return t.hosts.map((function(t){return t.host}))}))},t.prototype.resolveIps=function(t){return Ao(this.nodes,"entry").filter((function(e){return e.hosts.some((function(e){return e.host===t}))})).map((function(t){return t.ip}))},t.prototype.toString=function(){return Eo(this.nodes,this.config.eol)},t.prototype.removeEntry=function(t){var e,n="number"==typeof(e=t)||Z(e)&&"[object Number]"==Y(e)?t:this.nodes.findIndex((function(e){return e===t}));n<0||this.nodes.splice(n,1)},t.prototype.findEntries=function(t){return Ao(this.nodes,"entry").filter((function(e){return e.ip===t}))},t.prototype.findOrCreateEntry=function(t,e){var n=this.findEntries(t)[0];if(n)return n;var r=this.makeEntry(t);if(e){var o=jo(e),i=this.nodes.findIndex((function(t){return"comment"===t.type&&t.line===o}));if(i>=0)this.insertAt(i+1,r);else{var s="blank"!==this.nodes[this.nodes.length-1].type?[wo(),_o(o),r]:[_o(o),r];this.insertAt.apply(this,R([this.nodes.length],s,!1))}}else this.insertAt(this.nodes.length,r);return r},t.prototype.insertAt=function(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];(e=this.nodes).splice.apply(e,R([t,0],n,!1))},t.prototype.makeEntry=function(t,e){var n=this.config.ipPrefixWhitespace;return N({type:"entry",ip:t,ipPrefixWhitespace:n,hosts:[]},e)},t.fromNodes=function(e,n){var r,o;return new t(e.filter((function(t){return"eol"!==t.type})),{eol:null!==(r=null==n?void 0:n.eol)&&void 0!==r?r:function(){var t,n=Ao(e,"eol").map((function(t){return t.line}));return null!==(t=Co(n))&&void 0!==t?t:yo}(),indent:null!==(o=null==n?void 0:n.indent)&&void 0!==o?o:function(){var t,n=Hn(Ao(e,"entry"),(function(t){var e=t.ipPrefixWhitespace,n=t.ip,r=t.hosts[0];return r?["".concat(e).concat(n).concat(r.whitespace).length]:[]}));return null!==(t=Co(n))&&void 0!==t?t:17}(),ipPrefixWhitespace:""})},t.parse=function(t,e){return this.fromNodes(So(t),e)},t}(),wo=function(){return{type:"blank",line:""}},_o=function(t){return{type:"comment",line:jo(t)}},jo=function(t){return t.startsWith("#")?t:"# ".concat(t)},Eo=function(t,e){var n=t.map((function(t){switch(t.type){case"entry":var e=t.hosts.map((function(t){var e=t.whitespace,n=t.host;return"".concat(e).concat(n)})).join("");return"".concat(t.ipPrefixWhitespace).concat(t.ip).concat(e);case"blank":case"comment":case"invalid":return t.line;default:return""}}));return n.join(null!=e?e:yo)},So=function(t){return t.split(/(\r?\n)/).map((function(t){return function(t){return t.match(/^\s*#.*$/)}(t)?{type:"comment",line:t}:function(t){return t.match(/^(\r?\n)$/)}(t)?{type:"eol",line:t}:function(t){return t.match(/^\s*$/)}(t)?{type:"blank",line:t}:xo(t)}))},xo=function(t){var e=t.match(/^(\s*)(\S+)(.+)?$/);if(!e)return{type:"invalid",line:t};var n=e[1],r=e[2],o=e.slice(3),i=!1,s=Hn(o.filter((function(t){return void 0!==t})),(function(t){var e=t.match(/(\s+)(\S+)/g);return e?e.map((function(t){var e=t.match(/^(\s+)(\S+)$/);e||(i=!0);var n=null!=e?e:[];return{whitespace:n[1],host:n[2]}})):(i=!0,[])}));return i?{type:"invalid",line:t}:{type:"entry",ipPrefixWhitespace:n,ip:r,hosts:s}},Ao=function(t,e){return t.filter((function(t){return t.type===e}))},Co=function(t){var e=new Map;t.forEach((function(t){var n;e.set(t,(null!==(n=e.get(t))&&void 0!==n?n:0)+1)}));var n=Zn(Array.from(e.entries()),(function(t){return t[1]}));if(n)return n[0]},Oo="win32"===process.platform?"C:/Windows/System32/drivers/etc/hosts":"/etc/hosts",ko=function(){function t(t){this.ast=go.fromNodes([]);var e={writeMode:"atomic",hostsFile:Oo};this.config=N(N({},e),t)}return t.prototype.add=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!Yn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."));return e.forEach((function(t){if(!Yn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.add(t,e,this.config.header),this},t.prototype.remove=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!Yn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."));return e.forEach((function(t){if(!Yn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.remove(t,e),this},t.prototype.removeHosts=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.forEach((function(t){if(!Yn(t))throw new Error("Expected 'host' to be a string, but got ".concat(typeof t,"."))})),this.ast.removeHosts(t),this},t.prototype.removeIps=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.forEach((function(t){if(!Yn(t))throw new Error("Expected 'ip' to be a string, but got ".concat(typeof t,"."))})),this.ast.removeIps(t),this},t.prototype.read=function(){return T(this,void 0,void 0,(function(){var t;return L(this,(function(e){switch(e.label){case 0:return[4,O.default.promises.readFile(this.config.hostsFile)];case 1:return t=e.sent(),this.ast=go.parse(t.toString(),this.config),[2,this]}}))}))},t.prototype.write=function(t){return T(this,void 0,void 0,(function(){var e,n,r,o;return L(this,(function(i){switch(i.label){case 0:switch(e=N(N({},this.config),t),n=e.hostsFile,r=e.writeMode,o=this.ast.toString(),r){case void 0:case"atomic":return[3,1];case"standard":return[3,3];case"disabled":return[3,5]}return[3,5];case 1:return[4,mo(n,o)];case 2:case 4:return i.sent(),[3,6];case 3:return[4,O.default.promises.writeFile(n,o)];case 5:return[3,6];case 6:return[2,this]}}))}))},t.prototype.backup=function(t){return T(this,void 0,void 0,(function(){var e,n,r,o;return L(this,(function(i){switch(i.label){case 0:return O.default.existsSync(this.config.hostsFile)?(e=k.default.dirname(this.config.hostsFile),n=k.default.basename(this.config.hostsFile),r="".concat(n).concat(t.suffix),o=k.default.resolve(e,r),O.default.existsSync(o)&&!t.rewrite?[3,2]:[4,O.default.promises.copyFile(this.config.hostsFile,o)]):[2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.load=function(e){return T(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,new t(e).read()];case 1:return[2,n.sent()]}}))}))},t}(),Io=function(){function t(){this.previousPromise=Promise.resolve()}return t.prototype.enter=function(t){return T(this,void 0,void 0,(function(){var e;return L(this,(function(n){return e=this.previousPromise.then((function(){return t()})).catch((function(){return t()})),this.previousPromise=e,[2,e]}))}))},t}(),Uo=function t(e,n){if(e&&n)return t(e)(n);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach((function(t){r[t]=e[t]})),r;function r(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach((function(t){r[t]=o[t]})),r}};var Do=Uo(Bo),Po=Uo(No);function Bo(t){var e=function(){return e.called?e.value:(e.called=!0,e.value=t.apply(this,arguments))};return e.called=!1,e}function No(t){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=t.apply(this,arguments)},n=t.name||"Function wrapped with `once`";return e.onceError=n+" shouldn't be called more than once",e.called=!1,e}Bo.proto=Bo((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Bo(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return No(this)},configurable:!0})})),Do.strict=Po;var To=function(){},Lo=function(t,e,n){if("function"==typeof e)return Lo(t,null,e);e||(e={}),n=Do(n||To);var r=t._writableState,o=t._readableState,i=e.readable||!1!==e.readable&&t.readable,s=e.writable||!1!==e.writable&&t.writable,a=!1,u=function(){t.writable||c()},c=function(){s=!1,i||n.call(t)},l=function(){i=!1,s||n.call(t)},d=function(e){n.call(t,e?new Error("exited with error code: "+e):null)},p=function(e){n.call(t,e)},h=function(){process.nextTick(f)},f=function(){if(!a)return(!i||o&&o.ended&&!o.destroyed)&&(!s||r&&r.ended&&!r.destroyed)?void 0:n.call(t,new Error("premature close"))},v=function(){t.req.on("finish",c)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?s&&!r&&(t.on("end",u),t.on("close",u)):(t.on("complete",c),t.on("abort",h),t.req?v():t.on("request",v)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",d),t.on("end",l),t.on("finish",c),!1!==e.error&&t.on("error",p),t.on("close",h),function(){a=!0,t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",v),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("exit",d),t.removeListener("end",l),t.removeListener("error",p),t.removeListener("close",h)}},Ro=Lo,Fo=function(){},Go=/^v?\.0/.test(process.version),Mo=function(t){return"function"==typeof t},zo=function(t,e,n,r){r=Do(r);var o=!1;t.on("close",(function(){o=!0})),Ro(t,{readable:e,writable:n},(function(t){if(t)return r(t);o=!0,r()}));var i=!1;return function(e){if(!o&&!i)return i=!0,function(t){return!!Go&&!!O.default&&(t instanceof(O.default.ReadStream||Fo)||t instanceof(O.default.WriteStream||Fo))&&Mo(t.close)}(t)?t.close(Fo):function(t){return t.setHeader&&Mo(t.abort)}(t)?t.abort():Mo(t.destroy)?t.destroy():void r(e||new Error("stream was destroyed"))}},qo=function(t){t()},Wo=function(t,e){return t.pipe(e)},$o=function(){var t,e=Array.prototype.slice.call(arguments),n=Mo(e[e.length-1]||Fo)&&e.pop()||Fo;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r=e.map((function(o,i){var s=i<e.length-1;return zo(o,s,i>0,(function(e){t||(t=e),e&&r.forEach(qo),s||(r.forEach(qo),n(t))}))}));return e.reduce(Wo)};const{Duplex:Jo}=y.default;function Ho(t){t.emit("close")}function Vo(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Yo(t){this.removeListener("error",Yo),this.destroy(),0===this.listenerCount("error")&&this.emit("error",t)}var Zo=function(t,e){let n=!0;const r=new Jo({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",(function(e,n){const o=!n&&r._readableState.objectMode?e.toString():e;r.push(o)||t.pause()})),t.once("error",(function(t){r.destroyed||(n=!1,r.destroy(t))})),t.once("close",(function(){r.destroyed||r.push(null)})),r._destroy=function(e,o){if(t.readyState===t.CLOSED)return o(e),void process.nextTick(Ho,r);let i=!1;t.once("error",(function(t){i=!0,o(t)})),t.once("close",(function(){i||o(e),process.nextTick(Ho,r)})),n&&t.terminate()},r._final=function(e){t.readyState!==t.CONNECTING?null!==t._socket&&(t._socket._writableState.finished?(e(),r._readableState.endEmitted&&r.destroy()):(t._socket.once("finish",(function(){e()})),t.close())):t.once("open",(function(){r._final(e)}))},r._read=function(){t.isPaused&&t.resume()},r._write=function(e,n,o){t.readyState!==t.CONNECTING?t.send(e,o):t.once("open",(function(){r._write(e,n,o)}))},r.on("end",Vo),r.on("error",Yo),r},Ko={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}},Xo="function"==typeof __webpack_require__?__non_webpack_require__:function(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")},Qo=process.config&&process.config.variables||{},ti=!!process.env.PREBUILDS_ONLY,ei=process.versions.modules,ni=!(!process.versions||!process.versions.electron)||!!process.env.ELECTRON_RUN_AS_NODE||"undefined"!=typeof window&&window.process&&"renderer"===window.process.type?"electron":"node",ri=x.default.arch(),oi=x.default.platform(),ii=process.env.LIBC||(function(t){return"linux"===t&&O.default.existsSync("/etc/alpine-release")}(oi)?"musl":"glibc"),si=process.env.ARM_VERSION||("arm64"===ri?"8":Qo.arm_version)||"",ai=(process.versions.uv||"").split(".")[0],ui=ci;function ci(t){return Xo(ci.path(t))}function li(t){try{return O.default.readdirSync(t)}catch(t){return[]}}function di(t,e){var n=li(t).filter(e);return n[0]&&k.default.join(t,n[0])}function pi(t){return/\.node$/.test(t)}function hi(t){var e=t.split("-");if(2===e.length){var n=e[0],r=e[1].split("+");if(n&&r.length&&r.every(Boolean))return{name:t,platform:n,architectures:r}}}function fi(t,e){return function(n){return null!=n&&(n.platform===t&&n.architectures.includes(e))}}function vi(t,e){return t.architectures.length-e.architectures.length}function mi(t){var e=t.split("."),n={file:t,specificity:0};if("node"===e.pop()){for(var r=0;r<e.length;r++){var o=e[r];if("node"===o||"electron"===o||"node-webkit"===o)n.runtime=o;else if("napi"===o)n.napi=!0;else if("abi"===o.slice(0,3))n.abi=o.slice(3);else if("uv"===o.slice(0,2))n.uv=o.slice(2);else if("armv"===o.slice(0,4))n.armv=o.slice(4);else{if("glibc"!==o&&"musl"!==o)continue;n.libc=o}n.specificity++}return n}}function bi(t,e){return function(n){return null!=n&&(!(n.runtime!==t&&!function(t){return"node"===t.runtime&&t.napi}(n))&&(!(n.abi!==e&&!n.napi)&&((!n.uv||n.uv===ai)&&((!n.armv||n.armv===si)&&(!n.libc||n.libc===ii)))))}}function yi(t){return function(e,n){return e.runtime!==n.runtime?e.runtime===t?-1:1:e.abi!==n.abi?e.abi?-1:1:e.specificity!==n.specificity?e.specificity>n.specificity?-1:1:0}}ci.path=function(t){t=k.default.resolve(t||".");try{var e=Xo(k.default.join(t,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(t=process.env[e+"_PREBUILD"])}catch(t){}if(!ti){var n=di(k.default.join(t,"build/Release"),pi);if(n)return n;var r=di(k.default.join(t,"build/Debug"),pi);if(r)return r}var o=a(t);if(o)return o;var i=a(k.default.dirname(process.execPath));if(i)return i;var s=["platform="+oi,"arch="+ri,"runtime="+ni,"abi="+ei,"uv="+ai,si?"armv="+si:"","libc="+ii,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"","function"==typeof __webpack_require__?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+s+"\n loaded from: "+t+"\n");function a(t){var e=li(k.default.join(t,"prebuilds")).map(hi).filter(fi(oi,ri)).sort(vi)[0];if(e){var n=k.default.join(t,"prebuilds",e.name),r=li(n).map(mi).filter(bi(ni,ei)).sort(yi(ni))[0];return r?k.default.join(n,r.file):void 0}}},ci.parseTags=mi,ci.matchTags=bi,ci.compareTags=yi,ci.parseTuple=hi,ci.matchTuple=fi,ci.compareTuples=vi;var gi={mask:(t,e,n,r,o)=>{for(var i=0;i<o;i++)n[r+i]=t[i]^e[3&i]},unmask:(t,e)=>{const n=t.length;for(var r=0;r<n;r++)t[r]^=e[3&r]}},wi=Qn((function(t){try{t.exports=ui(__dirname)}catch(e){t.exports=gi}})),_i=Qn((function(t){const{EMPTY_BUFFER:e}=Ko;function n(t,n){if(0===t.length)return e;if(1===t.length)return t[0];const r=Buffer.allocUnsafe(n);let o=0;for(let e=0;e<t.length;e++){const n=t[e];r.set(n,o),o+=n.length}return o<n?r.slice(0,o):r}function r(t,e,n,r,o){for(let i=0;i<o;i++)n[r+i]=t[i]^e[3&i]}function o(t,e){for(let n=0;n<t.length;n++)t[n]^=e[3&n]}function i(t){return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function s(t){if(s.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=Buffer.from(t):ArrayBuffer.isView(t)?e=Buffer.from(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),s.readOnly=!1),e}try{const e=wi;t.exports={concat:n,mask(t,n,o,i,s){s<48?r(t,n,o,i,s):e.mask(t,n,o,i,s)},toArrayBuffer:i,toBuffer:s,unmask(t,n){t.length<32?o(t,n):e.unmask(t,n)}}}catch(e){t.exports={concat:n,mask:r,toArrayBuffer:i,toBuffer:s,unmask:o}}}));_i.concat,_i.mask,_i.toArrayBuffer,_i.toBuffer,_i.unmask;const ji=Symbol("kDone"),Ei=Symbol("kRun");var Si=class{constructor(t){this[ji]=()=>{this.pending--,this[Ei]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Ei]()}[Ei](){if(this.pending!==this.concurrency&&this.jobs.length){const t=this.jobs.shift();this.pending++,t(this[ji])}}};const{kStatusCode:xi}=Ko,Ai=Buffer.from([0,0,255,255]),Ci=Symbol("permessage-deflate"),Oi=Symbol("total-length"),ki=Symbol("callback"),Ii=Symbol("buffers"),Ui=Symbol("error");let Di;var Pi=class{constructor(t,e,n){if(this._maxPayload=0|n,this._options=t||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._isServer=!!e,this._deflate=null,this._inflate=null,this.params=null,!Di){const t=void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10;Di=new Si(t)}}static get extensionName(){return"permessage-deflate"}offer(){const t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const t=this._deflate[ki];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){const e=this._options,n=t.find((t=>!(!1===e.serverNoContextTakeover&&t.server_no_context_takeover||t.server_max_window_bits&&(!1===e.serverMaxWindowBits||"number"==typeof e.serverMaxWindowBits&&e.serverMaxWindowBits>t.server_max_window_bits)||"number"==typeof e.clientMaxWindowBits&&!t.client_max_window_bits)));if(!n)throw new Error("None of the extension offers can be accepted");return e.serverNoContextTakeover&&(n.server_no_context_takeover=!0),e.clientNoContextTakeover&&(n.client_no_context_takeover=!0),"number"==typeof e.serverMaxWindowBits&&(n.server_max_window_bits=e.serverMaxWindowBits),"number"==typeof e.clientMaxWindowBits?n.client_max_window_bits=e.clientMaxWindowBits:!0!==n.client_max_window_bits&&!1!==e.clientMaxWindowBits||delete n.client_max_window_bits,n}acceptAsClient(t){const e=t[0];if(!1===this._options.clientNoContextTakeover&&e.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(e.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&e.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(e.client_max_window_bits=this._options.clientMaxWindowBits);return e}normalizeParams(t){return t.forEach((t=>{Object.keys(t).forEach((e=>{let n=t[e];if(n.length>1)throw new Error(`Parameter "${e}" must have only a single value`);if(n=n[0],"client_max_window_bits"===e){if(!0!==n){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}else if("server_max_window_bits"===e){const t=+n;if(!Number.isInteger(t)||t<8||t>15)throw new TypeError(`Invalid value for parameter "${e}": ${n}`);n=t}else{if("client_no_context_takeover"!==e&&"server_no_context_takeover"!==e)throw new Error(`Unknown parameter "${e}"`);if(!0!==n)throw new TypeError(`Invalid value for parameter "${e}": ${n}`)}t[e]=n}))})),t}decompress(t,e,n){Di.add((r=>{this._decompress(t,e,((t,e)=>{r(),n(t,e)}))}))}compress(t,e,n){Di.add((r=>{this._compress(t,e,((t,e)=>{r(),n(t,e)}))}))}_decompress(t,e,n){const r=this._isServer?"client":"server";if(!this._inflate){const t=`${r}_max_window_bits`,e="number"!=typeof this.params[t]?S.default.Z_DEFAULT_WINDOWBITS:this.params[t];this._inflate=S.default.createInflateRaw({...this._options.zlibInflateOptions,windowBits:e}),this._inflate[Ci]=this,this._inflate[Oi]=0,this._inflate[Ii]=[],this._inflate.on("error",Ti),this._inflate.on("data",Ni)}this._inflate[ki]=n,this._inflate.write(t),e&&this._inflate.write(Ai),this._inflate.flush((()=>{const t=this._inflate[Ui];if(t)return this._inflate.close(),this._inflate=null,void n(t);const o=_i.concat(this._inflate[Ii],this._inflate[Oi]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oi]=0,this._inflate[Ii]=[],e&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),n(null,o)}))}_compress(t,e,n){const r=this._isServer?"server":"client";if(!this._deflate){const t=`${r}_max_window_bits`,e="number"!=typeof this.params[t]?S.default.Z_DEFAULT_WINDOWBITS:this.params[t];this._deflate=S.default.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:e}),this._deflate[Oi]=0,this._deflate[Ii]=[],this._deflate.on("data",Bi)}this._deflate[ki]=n,this._deflate.write(t),this._deflate.flush(S.default.Z_SYNC_FLUSH,(()=>{if(!this._deflate)return;let t=_i.concat(this._deflate[Ii],this._deflate[Oi]);e&&(t=t.slice(0,t.length-4)),this._deflate[ki]=null,this._deflate[Oi]=0,this._deflate[Ii]=[],e&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),n(null,t)}))}};function Bi(t){this[Ii].push(t),this[Oi]+=t.length}function Ni(t){this[Oi]+=t.length,this[Ci]._maxPayload<1||this[Oi]<=this[Ci]._maxPayload?this[Ii].push(t):(this[Ui]=new RangeError("Max payload size exceeded"),this[Ui].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ui][xi]=1009,this.removeListener("data",Ni),this.reset())}function Ti(t){this[Ci]._inflate=null,t[xi]=1007,this[ki](t)}var Li=function(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0},Ri=Qn((function(t){try{t.exports=ui(__dirname)}catch(e){t.exports=Li}})),Fi=Qn((function(t){const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function n(t){return t>=1e3&&t<=1014&&1004!==t&&1005!==t&&1006!==t||t>=3e3&&t<=4999}function r(t){const e=t.length;let n=0;for(;n<e;)if(0==(128&t[n]))n++;else if(192==(224&t[n])){if(n+1===e||128!=(192&t[n+1])||192==(254&t[n]))return!1;n+=2}else if(224==(240&t[n])){if(n+2>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||224===t[n]&&128==(224&t[n+1])||237===t[n]&&160==(224&t[n+1]))return!1;n+=3}else{if(240!=(248&t[n]))return!1;if(n+3>=e||128!=(192&t[n+1])||128!=(192&t[n+2])||128!=(192&t[n+3])||240===t[n]&&128==(240&t[n+1])||244===t[n]&&t[n+1]>143||t[n]>244)return!1;n+=4}return!0}try{const o=Ri;t.exports={isValidStatusCode:n,isValidUTF8:t=>t.length<150?r(t):o(t),tokenChars:e}}catch(o){t.exports={isValidStatusCode:n,isValidUTF8:r,tokenChars:e}}}));Fi.isValidStatusCode,Fi.isValidUTF8,Fi.tokenChars;const{Writable:Gi}=y.default,{BINARY_TYPES:Mi,EMPTY_BUFFER:zi,kStatusCode:qi,kWebSocket:Wi}=Ko,{concat:$i,toArrayBuffer:Ji,unmask:Hi}=_i,{isValidStatusCode:Vi,isValidUTF8:Yi}=Fi;var Zi=class extends Gi{constructor(t={}){super(),this._binaryType=t.binaryType||Mi[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=0|t.maxPayload,this._skipUTF8Validation=!!t.skipUTF8Validation,this[Wi]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=0,this._loop=!1}_write(t,e,n){if(8===this._opcode&&0==this._state)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){const e=this._buffers[0];return this._buffers[0]=e.slice(t),e.slice(0,t)}const e=Buffer.allocUnsafe(t);do{const n=this._buffers[0],r=e.length-t;t>=n.length?e.set(this._buffers.shift(),r):(e.set(new Uint8Array(n.buffer,n.byteOffset,t),r),this._buffers[0]=n.slice(t)),t-=n.length}while(t>0);return e}startLoop(t){let e;this._loop=!0;do{switch(this._state){case 0:e=this.getInfo();break;case 1:e=this.getPayloadLength16();break;case 2:e=this.getPayloadLength64();break;case 3:this.getMask();break;case 4:e=this.getData(t);break;default:return void(this._loop=!1)}}while(this._loop);t(e)}getInfo(){if(this._bufferedBytes<2)return void(this._loop=!1);const t=this.consume(2);if(0!=(48&t[0]))return this._loop=!1,Ki(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const e=64==(64&t[0]);if(e&&!this._extensions[Pi.extensionName])return this._loop=!1,Ki(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=128==(128&t[0]),this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(e)return this._loop=!1,Ki(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,Ki(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return this._loop=!1,Ki(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=e}else{if(!(this._opcode>7&&this._opcode<11))return this._loop=!1,Ki(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin)return this._loop=!1,Ki(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(e)return this._loop=!1,Ki(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,Ki(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=128==(128&t[1]),this._isServer){if(!this._masked)return this._loop=!1,Ki(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,Ki(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(126===this._payloadLength)this._state=1;else{if(127!==this._payloadLength)return this.haveLength();this._state=2}}getPayloadLength16(){if(!(this._bufferedBytes<2))return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength();this._loop=!1}getPayloadLength64(){if(this._bufferedBytes<8)return void(this._loop=!1);const t=this.consume(8),e=t.readUInt32BE(0);return e>Math.pow(2,21)-1?(this._loop=!1,Ki(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=e*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,Ki(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=3:this._state=4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(t){let e=zi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength)return void(this._loop=!1);e=this.consume(this._payloadLength),this._masked&&0!=(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])&&Hi(e,this._mask)}return this._opcode>7?this.controlMessage(e):this._compressed?(this._state=5,void this.decompress(e,t)):(e.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(e)),this.dataMessage())}decompress(t,e){this._extensions[Pi.extensionName].decompress(t,this._fin,((t,n)=>{if(t)return e(t);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return e(Ki(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}const r=this.dataMessage();if(r)return e(r);this.startLoop(e)}))}dataMessage(){if(this._fin){const t=this._messageLength,e=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let n;n="nodebuffer"===this._binaryType?$i(e,t):"arraybuffer"===this._binaryType?Ji($i(e,t)):e,this.emit("message",n,!0)}else{const n=$i(e,t);if(!this._skipUTF8Validation&&!Yi(n))return this._loop=!1,Ki(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",n,!1)}}this._state=0}controlMessage(t){if(8===this._opcode)if(this._loop=!1,0===t.length)this.emit("conclude",1005,zi),this.end();else{if(1===t.length)return Ki(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{const e=t.readUInt16BE(0);if(!Vi(e))return Ki(RangeError,`invalid status code ${e}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const n=t.slice(2);if(!this._skipUTF8Validation&&!Yi(n))return Ki(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",e,n),this.end()}}else 9===this._opcode?this.emit("ping",t):this.emit("pong",t);this._state=0}};function Ki(t,e,n,r,o){const i=new t(n?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(i,Ki),i.code=o,i[qi]=r,i}const{randomFillSync:Xi}=U.default,{EMPTY_BUFFER:Qi}=Ko,{isValidStatusCode:ts}=Fi,{mask:es,toBuffer:ns}=_i,rs=Symbol("kByteLength"),os=Buffer.alloc(4);class is{constructor(t,e,n){this._extensions=e||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(t,e){let n,r,o=!1,i=2,s=!1;e.mask&&(n=e.maskBuffer||os,e.generateMask?e.generateMask(n):Xi(n,0,4),s=0==(n[0]|n[1]|n[2]|n[3]),i=6),"string"==typeof t?r=e.mask&&!s||void 0===e[rs]?(t=Buffer.from(t)).length:e[rs]:(r=t.length,o=e.mask&&e.readOnly&&!s);let a=r;r>=65536?(i+=8,a=127):r>125&&(i+=2,a=126);const u=Buffer.allocUnsafe(o?r+i:i);return u[0]=e.fin?128|e.opcode:e.opcode,e.rsv1&&(u[0]|=64),u[1]=a,126===a?u.writeUInt16BE(r,2):127===a&&(u[2]=u[3]=0,u.writeUIntBE(r,4,6)),e.mask?(u[1]|=128,u[i-4]=n[0],u[i-3]=n[1],u[i-2]=n[2],u[i-1]=n[3],s?[u,t]:o?(es(t,n,u,i,r),[u]):(es(t,n,t,0,r),[u,t])):[u,t]}close(t,e,n,r){let o;if(void 0===t)o=Qi;else{if("number"!=typeof t||!ts(t))throw new TypeError("First argument must be a valid error code number");if(void 0!==e&&e.length){const n=Buffer.byteLength(e);if(n>123)throw new RangeError("The message must not be greater than 123 bytes");o=Buffer.allocUnsafe(2+n),o.writeUInt16BE(t,0),"string"==typeof e?o.write(e,2):o.set(e,2)}else o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0)}const i={[rs]:o.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,o,!1,i,r]):this.sendFrame(is.frame(o,i),r)}ping(t,e,n){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):(r=(t=ns(t)).length,o=ns.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const i={[rs]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:9,readOnly:o,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,i,n]):this.sendFrame(is.frame(t,i),n)}pong(t,e,n){let r,o;if("string"==typeof t?(r=Buffer.byteLength(t),o=!1):(r=(t=ns(t)).length,o=ns.readOnly),r>125)throw new RangeError("The data size must not be greater than 125 bytes");const i={[rs]:r,fin:!0,generateMask:this._generateMask,mask:e,maskBuffer:this._maskBuffer,opcode:10,readOnly:o,rsv1:!1};this._deflating?this.enqueue([this.dispatch,t,!1,i,n]):this.sendFrame(is.frame(t,i),n)}send(t,e,n){const r=this._extensions[Pi.extensionName];let o,i,s=e.binary?2:1,a=e.compress;if("string"==typeof t?(o=Buffer.byteLength(t),i=!1):(o=(t=ns(t)).length,i=ns.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=o>=r._threshold),this._compress=a):(a=!1,s=0),e.fin&&(this._firstFragment=!0),r){const r={[rs]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:i,rsv1:a};this._deflating?this.enqueue([this.dispatch,t,this._compress,r,n]):this.dispatch(t,this._compress,r,n)}else this.sendFrame(is.frame(t,{[rs]:o,fin:e.fin,generateMask:this._generateMask,mask:e.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:i,rsv1:!1}),n)}dispatch(t,e,n,r){if(!e)return void this.sendFrame(is.frame(t,n),r);const o=this._extensions[Pi.extensionName];this._bufferedBytes+=n[rs],this._deflating=!0,o.compress(t,n.fin,((t,e)=>{if(this._socket.destroyed){const t=new Error("The socket was closed while data was being compressed");"function"==typeof r&&r(t);for(let e=0;e<this._queue.length;e++){const n=this._queue[e],r=n[n.length-1];"function"==typeof r&&r(t)}}else this._bufferedBytes-=n[rs],this._deflating=!1,n.readOnly=!1,this.sendFrame(is.frame(e,n),r),this.dequeue()}))}dequeue(){for(;!this._deflating&&this._queue.length;){const t=this._queue.shift();this._bufferedBytes-=t[3][rs],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][rs],this._queue.push(t)}sendFrame(t,e){2===t.length?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],e),this._socket.uncork()):this._socket.write(t[0],e)}}var ss=is;const{kForOnEventAttribute:as,kListener:us}=Ko,cs=Symbol("kCode"),ls=Symbol("kData"),ds=Symbol("kError"),ps=Symbol("kMessage"),hs=Symbol("kReason"),fs=Symbol("kTarget"),vs=Symbol("kType"),ms=Symbol("kWasClean");class bs{constructor(t){this[fs]=null,this[vs]=t}get target(){return this[fs]}get type(){return this[vs]}}Object.defineProperty(bs.prototype,"target",{enumerable:!0}),Object.defineProperty(bs.prototype,"type",{enumerable:!0});class ys extends bs{constructor(t,e={}){super(t),this[cs]=void 0===e.code?0:e.code,this[hs]=void 0===e.reason?"":e.reason,this[ms]=void 0!==e.wasClean&&e.wasClean}get code(){return this[cs]}get reason(){return this[hs]}get wasClean(){return this[ms]}}Object.defineProperty(ys.prototype,"code",{enumerable:!0}),Object.defineProperty(ys.prototype,"reason",{enumerable:!0}),Object.defineProperty(ys.prototype,"wasClean",{enumerable:!0});class gs extends bs{constructor(t,e={}){super(t),this[ds]=void 0===e.error?null:e.error,this[ps]=void 0===e.message?"":e.message}get error(){return this[ds]}get message(){return this[ps]}}Object.defineProperty(gs.prototype,"error",{enumerable:!0}),Object.defineProperty(gs.prototype,"message",{enumerable:!0});class ws extends bs{constructor(t,e={}){super(t),this[ls]=void 0===e.data?null:e.data}get data(){return this[ls]}}Object.defineProperty(ws.prototype,"data",{enumerable:!0});const _s={addEventListener(t,e,n={}){let r;if("message"===t)r=function(t,n){const r=new ws("message",{data:n?t:t.toString()});r[fs]=this,e.call(this,r)};else if("close"===t)r=function(t,n){const r=new ys("close",{code:t,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[fs]=this,e.call(this,r)};else if("error"===t)r=function(t){const n=new gs("error",{error:t,message:t.message});n[fs]=this,e.call(this,n)};else{if("open"!==t)return;r=function(){const t=new bs("open");t[fs]=this,e.call(this,t)}}r[as]=!!n[as],r[us]=e,n.once?this.once(t,r):this.on(t,r)},removeEventListener(t,e){for(const n of this.listeners(t))if(n[us]===e&&!n[as]){this.removeListener(t,n);break}}};var js={CloseEvent:ys,ErrorEvent:gs,Event:bs,EventTarget:_s,MessageEvent:ws};const{tokenChars:Es}=Fi;function Ss(t,e,n){void 0===t[e]?t[e]=[n]:t[e].push(n)}var xs={format:function(t){return Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>[e].concat(Object.keys(t).map((e=>{let n=t[e];return Array.isArray(n)||(n=[n]),n.map((t=>!0===t?e:`${e}=${t}`)).join("; ")}))).join("; "))).join(", ")})).join(", ")},parse:function(t){const e=Object.create(null);let n,r,o=Object.create(null),i=!1,s=!1,a=!1,u=-1,c=-1,l=-1,d=0;for(;d<t.length;d++)if(c=t.charCodeAt(d),void 0===n)if(-1===l&&1===Es[c])-1===u&&(u=d);else if(0===d||32!==c&&9!==c){if(59!==c&&44!==c)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d);const r=t.slice(u,l);44===c?(Ss(e,r,o),o=Object.create(null)):n=r,u=l=-1}}else-1===l&&-1!==u&&(l=d);else if(void 0===r)if(-1===l&&1===Es[c])-1===u&&(u=d);else if(32===c||9===c)-1===l&&-1!==u&&(l=d);else if(59===c||44===c){if(-1===u)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d),Ss(o,t.slice(u,l),!0),44===c&&(Ss(e,n,o),o=Object.create(null),n=void 0),u=l=-1}else{if(61!==c||-1===u||-1!==l)throw new SyntaxError(`Unexpected character at index ${d}`);r=t.slice(u,d),u=l=-1}else if(s){if(1!==Es[c])throw new SyntaxError(`Unexpected character at index ${d}`);-1===u?u=d:i||(i=!0),s=!1}else if(a)if(1===Es[c])-1===u&&(u=d);else if(34===c&&-1!==u)a=!1,l=d;else{if(92!==c)throw new SyntaxError(`Unexpected character at index ${d}`);s=!0}else if(34===c&&61===t.charCodeAt(d-1))a=!0;else if(-1===l&&1===Es[c])-1===u&&(u=d);else if(-1===u||32!==c&&9!==c){if(59!==c&&44!==c)throw new SyntaxError(`Unexpected character at index ${d}`);{if(-1===u)throw new SyntaxError(`Unexpected character at index ${d}`);-1===l&&(l=d);let s=t.slice(u,l);i&&(s=s.replace(/\\/g,""),i=!1),Ss(o,r,s),44===c&&(Ss(e,n,o),o=Object.create(null),n=void 0),r=void 0,u=l=-1}}else-1===l&&(l=d);if(-1===u||a||32===c||9===c)throw new SyntaxError("Unexpected end of input");-1===l&&(l=d);const p=t.slice(u,l);return void 0===n?Ss(e,p,o):(void 0===r?Ss(o,p,!0):Ss(o,r,i?p.replace(/\\/g,""):p),Ss(e,n,o)),e}};const{randomBytes:As,createHash:Cs}=U.default,{URL:Os}=_.default,{BINARY_TYPES:ks,EMPTY_BUFFER:Is,GUID:Us,kForOnEventAttribute:Ds,kListener:Ps,kStatusCode:Bs,kWebSocket:Ns,NOOP:Ts}=Ko,{EventTarget:{addEventListener:Ls,removeEventListener:Rs}}=js,{format:Fs,parse:Gs}=xs,{toBuffer:Ms}=_i,zs=["CONNECTING","OPEN","CLOSING","CLOSED"],qs=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Ws=[8,13];class $s extends b.default{constructor(t,e,n){super(),this._binaryType=ks[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Is,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=$s.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==t?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===e?e=[]:Array.isArray(e)||("object"==typeof e&&null!==e?(n=e,e=[]):e=[e]),Hs(this,t,e,n)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(t){ks.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,e,n){const r=new Zi({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation});this._sender=new ss(t,this._extensions,n.generateMask),this._receiver=r,this._socket=t,r[Ns]=this,t[Ns]=this,r.on("conclude",Qs),r.on("drain",ta),r.on("error",ea),r.on("message",ra),r.on("ping",oa),r.on("pong",ia),t.setTimeout(0),t.setNoDelay(),e.length>0&&t.unshift(e),t.on("close",aa),t.on("data",ua),t.on("end",ca),t.on("error",la),this._readyState=$s.OPEN,this.emit("open")}emitClose(){if(!this._socket)return this._readyState=$s.CLOSED,void this.emit("close",this._closeCode,this._closeMessage);this._extensions[Pi.extensionName]&&this._extensions[Pi.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=$s.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,e){if(this.readyState!==$s.CLOSED){if(this.readyState===$s.CONNECTING){const t="WebSocket was closed before the connection was established";return Ks(this,this._req,t)}this.readyState!==$s.CLOSING?(this._readyState=$s.CLOSING,this._sender.close(t,e,!this._isServer,(t=>{t||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())})),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),3e4)):this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end()}}pause(){this.readyState!==$s.CONNECTING&&this.readyState!==$s.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,e,n){if(this.readyState===$s.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===$s.OPEN?(void 0===e&&(e=!this._isServer),this._sender.ping(t||Is,e,n)):Xs(this,t,n)}pong(t,e,n){if(this.readyState===$s.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");"function"==typeof t?(n=t,t=e=void 0):"function"==typeof e&&(n=e,e=void 0),"number"==typeof t&&(t=t.toString()),this.readyState===$s.OPEN?(void 0===e&&(e=!this._isServer),this._sender.pong(t||Is,e,n)):Xs(this,t,n)}resume(){this.readyState!==$s.CONNECTING&&this.readyState!==$s.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,e,n){if(this.readyState===$s.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof e&&(n=e,e={}),"number"==typeof t&&(t=t.toString()),this.readyState!==$s.OPEN)return void Xs(this,t,n);const r={binary:"string"!=typeof t,mask:!this._isServer,compress:!0,fin:!0,...e};this._extensions[Pi.extensionName]||(r.compress=!1),this._sender.send(t||Is,r,n)}terminate(){if(this.readyState!==$s.CLOSED){if(this.readyState===$s.CONNECTING){const t="WebSocket was closed before the connection was established";return Ks(this,this._req,t)}this._socket&&(this._readyState=$s.CLOSING,this._socket.destroy())}}}Object.defineProperty($s,"CONNECTING",{enumerable:!0,value:zs.indexOf("CONNECTING")}),Object.defineProperty($s.prototype,"CONNECTING",{enumerable:!0,value:zs.indexOf("CONNECTING")}),Object.defineProperty($s,"OPEN",{enumerable:!0,value:zs.indexOf("OPEN")}),Object.defineProperty($s.prototype,"OPEN",{enumerable:!0,value:zs.indexOf("OPEN")}),Object.defineProperty($s,"CLOSING",{enumerable:!0,value:zs.indexOf("CLOSING")}),Object.defineProperty($s.prototype,"CLOSING",{enumerable:!0,value:zs.indexOf("CLOSING")}),Object.defineProperty($s,"CLOSED",{enumerable:!0,value:zs.indexOf("CLOSED")}),Object.defineProperty($s.prototype,"CLOSED",{enumerable:!0,value:zs.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((t=>{Object.defineProperty($s.prototype,t,{enumerable:!0})})),["open","error","close","message"].forEach((t=>{Object.defineProperty($s.prototype,`on${t}`,{enumerable:!0,get(){for(const e of this.listeners(t))if(e[Ds])return e[Ps];return null},set(e){for(const e of this.listeners(t))if(e[Ds]){this.removeListener(t,e);break}"function"==typeof e&&this.addEventListener(t,e,{[Ds]:!0})}})})),$s.prototype.addEventListener=Ls,$s.prototype.removeEventListener=Rs;var Js=$s;function Hs(t,e,n,r){const o={protocolVersion:Ws[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,host:void 0,path:void 0,port:void 0};if(!Ws.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${Ws.join(", ")})`);let i;if(e instanceof Os)i=e,t._url=e.href;else{try{i=new Os(e)}catch(t){throw new SyntaxError(`Invalid URL: ${e}`)}t._url=e}const s="wss:"===i.protocol,a="ws+unix:"===i.protocol;let u;if("ws:"===i.protocol||s||a?a&&!i.pathname?u="The URL's pathname is empty":i.hash&&(u="The URL contains a fragment identifier"):u='The URL\'s protocol must be one of "ws:", "wss:", or "ws+unix:"',u){const e=new SyntaxError(u);if(0===t._redirects)throw e;return void Vs(t,e)}const c=s?443:80,l=As(16).toString("base64"),d=s?E.default.get:w.default.get,p=new Set;let h;if(o.createConnection=s?Zs:Ys,o.defaultPort=o.defaultPort||c,o.port=i.port||c,o.host=i.hostname.startsWith("[")?i.hostname.slice(1,-1):i.hostname,o.headers={"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket",...o.headers},o.path=i.pathname+i.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(h=new Pi(!0!==o.perMessageDeflate?o.perMessageDeflate:{},!1,o.maxPayload),o.headers["Sec-WebSocket-Extensions"]=Fs({[Pi.extensionName]:h.offer()})),n.length){for(const t of n){if("string"!=typeof t||!qs.test(t)||p.has(t))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(t)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(i.username||i.password)&&(o.auth=`${i.username}:${i.password}`),a){const t=o.path.split(":");o.socketPath=t[0],o.path=t[1]}if(o.followRedirects){if(0===t._redirects){t._originalHost=i.host;const e=r&&r.headers;if(r={...r,headers:{}},e)for(const[t,n]of Object.entries(e))r.headers[t.toLowerCase()]=n}else i.host!==t._originalHost&&(delete o.headers.authorization,delete o.headers.cookie,delete o.headers.host,o.auth=void 0);o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64"))}let f=t._req=d(o);o.timeout&&f.on("timeout",(()=>{Ks(t,f,"Opening handshake has timed out")})),f.on("error",(e=>{null===f||f.aborted||(f=t._req=null,Vs(t,e))})),f.on("response",(i=>{const s=i.headers.location,a=i.statusCode;if(s&&o.followRedirects&&a>=300&&a<400){if(++t._redirects>o.maxRedirects)return void Ks(t,f,"Maximum redirects exceeded");let i;f.abort();try{i=new Os(s,e)}catch(e){const n=new SyntaxError(`Invalid URL: ${s}`);return void Vs(t,n)}Hs(t,i,n,r)}else t.emit("unexpected-response",f,i)||Ks(t,f,`Unexpected server response: ${i.statusCode}`)})),f.on("upgrade",((e,n,r)=>{if(t.emit("upgrade",e),t.readyState!==$s.CONNECTING)return;f=t._req=null;const i=Cs("sha1").update(l+Us).digest("base64");if(e.headers["sec-websocket-accept"]!==i)return void Ks(t,n,"Invalid Sec-WebSocket-Accept header");const s=e.headers["sec-websocket-protocol"];let a;if(void 0!==s?p.size?p.has(s)||(a="Server sent an invalid subprotocol"):a="Server sent a subprotocol but none was requested":p.size&&(a="Server sent no subprotocol"),a)return void Ks(t,n,a);s&&(t._protocol=s);const u=e.headers["sec-websocket-extensions"];if(void 0!==u){if(!h){return void Ks(t,n,"Server sent a Sec-WebSocket-Extensions header but no extension was requested")}let e;try{e=Gs(u)}catch(e){return void Ks(t,n,"Invalid Sec-WebSocket-Extensions header")}const r=Object.keys(e);if(1!==r.length||r[0]!==Pi.extensionName){return void Ks(t,n,"Server indicated an extension that was not requested")}try{h.accept(e[Pi.extensionName])}catch(e){return void Ks(t,n,"Invalid Sec-WebSocket-Extensions header")}t._extensions[Pi.extensionName]=h}t.setSocket(n,r,{generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}))}function Vs(t,e){t._readyState=$s.CLOSING,t.emit("error",e),t.emitClose()}function Ys(t){return t.path=t.socketPath,A.default.connect(t)}function Zs(t){return t.path=void 0,t.servername||""===t.servername||(t.servername=A.default.isIP(t.host)?"":t.host),I.default.connect(t)}function Ks(t,e,n){t._readyState=$s.CLOSING;const r=new Error(n);Error.captureStackTrace(r,Ks),e.setHeader?(e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),e.once("abort",t.emitClose.bind(t)),t.emit("error",r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function Xs(t,e,n){if(e){const n=Ms(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(n){n(new Error(`WebSocket is not open: readyState ${t.readyState} (${zs[t.readyState]})`))}}function Qs(t,e){const n=this[Ns];n._closeFrameReceived=!0,n._closeMessage=e,n._closeCode=t,void 0!==n._socket[Ns]&&(n._socket.removeListener("data",ua),process.nextTick(sa,n._socket),1005===t?n.close():n.close(t,e))}function ta(){const t=this[Ns];t.isPaused||t._socket.resume()}function ea(t){const e=this[Ns];void 0!==e._socket[Ns]&&(e._socket.removeListener("data",ua),process.nextTick(sa,e._socket),e.close(t[Bs])),e.emit("error",t)}function na(){this[Ns].emitClose()}function ra(t,e){this[Ns].emit("message",t,e)}function oa(t){const e=this[Ns];e.pong(t,!e._isServer,Ts),e.emit("ping",t)}function ia(t){this[Ns].emit("pong",t)}function sa(t){t.resume()}function aa(){const t=this[Ns];let e;this.removeListener("close",aa),this.removeListener("data",ua),this.removeListener("end",ca),t._readyState=$s.CLOSING,this._readableState.endEmitted||t._closeFrameReceived||t._receiver._writableState.errorEmitted||null===(e=t._socket.read())||t._receiver.write(e),t._receiver.end(),this[Ns]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",na),t._receiver.on("finish",na))}function ua(t){this[Ns]._receiver.write(t)||this.pause()}function ca(){const t=this[Ns];t._readyState=$s.CLOSING,t._receiver.end(),this.end()}function la(){const t=this[Ns];this.removeListener("error",la),this.on("error",Ts),t&&(t._readyState=$s.CLOSING,this.destroy())}var da=function(t){function n(e,n,r,o,i){void 0===i&&(i=5e3);var s=t.call(this)||this;s.endpoint=e,s.headers=n,s.rewriteHostHeader=r,s.bindToAssign=o,s.closeTimeout=i,s.protocol="TCP",s.openConnections=new Set,s.tcpServer=C.createServer(s.handleConnection.bind(s));var a=null==r?void 0:r.altHostnames.map((function(t){return(e=Pe(e=t))&&$n.test(e)?e.replace(Wn,"\\$&"):e;var e})).join("|");return s.hostRegex=new RegExp("Host: (?:".concat(a,")(:.*$|$)"),"im"),s}return B(n,t),Object.defineProperty(n.prototype,"bindTo",{get:function(){var t;return null!==(t=this.boundTo)&&void 0!==t?t:this.bindToAssign},enumerable:!1,configurable:!0}),n.prototype.open=function(){return T(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){return[2,new Promise((function(e){if(t.bindToAssign){var n=t.bindToAssign,r=n.port,o=n.address;t.tcpServer.listen(r,o,(function(){t.emit("tunnel-open",{address:o,port:r}),e({address:o,port:r})}))}else t.tcpServer.listen(0,(function(){var n=t.tcpServer.address(),r=n.address,o=n.port,i="0.0.0.0"===r||"::"===r?"127.0.0.1":r;t.boundTo={address:i,port:o},t.emit("tunnel-open",t.boundTo),e(t.boundTo)}))}))]}))}))},n.prototype.close=function(){return T(this,void 0,void 0,(function(){var t,e=this;return L(this,(function(n){switch(n.label){case 0:return t=!1,[4,Promise.race([new Promise((function(n){e.tcpServer.close((function(){t=!0,e.emit("tunnel-close"),n()}))})),new Promise((function(n){new Promise((function(t){return setTimeout(t,e.closeTimeout)})).then((function(){t||(e.openConnections.forEach((function(t){t.destroy(),e.openConnections.delete(t)})),n())}))}))])];case 1:return n.sent(),[2]}}))}))},n.prototype.handleConnection=function(t){var e=this;this.openConnections.add(t);var n=new Js(this.endpoint.replace("https:","wss:"),{headers:this.headers}),r=Zo(n),o=this.getHeaderTransform();this.rewriteHostHeader&&o?$o(t,o,r):$o(t,r),$o(r,t),n.on("close",(function(t,n,r){e.emit("connection-close",t,n,r)})),r.on("error",(function(t){e.emit("connection-error",t)})),t.on("error",(function(t){e.emit("connection-error",t)})),this.emit("connection-accept")},n.prototype.getHeaderTransform=function(){if(this.rewriteHostHeader){var t=this.rewriteHostHeader.targetHostname,n=this.hostRegex;return new e.Transform({transform:function(e,r,o){var i=e.toString();if(i.split("\n",1)[0].includes("HTTP")){var s=i.replace(n,"Host: ".concat(t));o(null,Buffer.from(s))}else o(null,e)}})}},n}(t.EventEmitter),pa=function(t){function e(e,n,r){var o=t.call(this)||this;return o.endpoint=e,o.headers=n,o.bindToAssign=r,o.protocol="UDP",o.udpSocket=D.default.createSocket("udp4"),o.handleConnection(),o}return B(e,t),Object.defineProperty(e.prototype,"bindTo",{get:function(){var t;return null!==(t=this.boundTo)&&void 0!==t?t:this.bindToAssign},enumerable:!1,configurable:!0}),e.prototype.open=function(){return T(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){return[2,new Promise((function(e){if(t.bindToAssign){var n=t.bindToAssign,r=n.port,o=n.address;t.udpSocket.bind(r,o,(function(){t.emit("tunnel-open",{address:o,port:r}),e({address:o,port:r})}))}else t.udpSocket.bind(0,(function(){var n=t.udpSocket.address(),r=n.address,o=n.port,i="0.0.0.0"===r||"::"===r?"127.0.0.1":r;t.boundTo={address:i,port:o},t.emit("tunnel-open",t.boundTo),e(t.boundTo)}))}))]}))}))},e.prototype.close=function(){return T(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){switch(e.label){case 0:return[4,new Promise((function(e){t.udpSocket.close((function(){t.emit("tunnel-close"),e()}))}))];case 1:return e.sent(),[2]}}))}))},e.prototype.handleConnection=function(){var t,e=this,n=new Js(this.endpoint.replace("https:","wss:"),{headers:this.headers}),r=Zo(n);this.udpSocket.on("message",(function(e,n){t=n,r.write(e)})),r.on("data",(function(n){t&&e.udpSocket.send(n,t.port,t.address,(function(t){t&&e.emit("connection-error",t)}))})),this.udpSocket.on("error",(function(t){e.emit("connection-error",t)})),r.on("error",(function(t){e.emit("connection-error",t)})),n.on("connection-close",(function(t,n,r){e.emit("connection-close",t,n,r)})),n.on("connection-error",(function(t){e.emit("connection-error",t)})),this.emit("connection-accept")},e}(t.EventEmitter);var ha="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,fa=function(t,e){return T(void 0,void 0,void 0,(function(){var n;return L(this,(function(r){return n=Promise.resolve([]),[2,t.reduce((function(t,n){return t.then((function(t){return e(n).then((function(e){return t.push(e),t}))}))}),n)]}))}))},va=function(t){function e(e){void 0===e&&(e=8192);var n=t.call(this)||this;return n.bufferDefaultSize=e,n._size=0,n.buffer=Buffer.alloc(n.bufferDefaultSize),n}return B(e,t),Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.getContentsAsString=function(t,e){void 0===t&&(t="utf8");var n=this.buffer.toString(t,0,Math.min(e||this.size,this.size)),r=Buffer.byteLength(n);return r<this.size&&this.buffer.copy(this.buffer,0,r),this._size-=r,n},e.prototype.adaptBuffer=function(t){if(this.buffer.length-this.size<t){var e=Math.ceil((t-(this.buffer.length-this.size))/this.bufferDefaultSize),n=Buffer.alloc(this.buffer.length+this.bufferDefaultSize*e);this.buffer.copy(n,0,0,this.size),this.buffer=n}},e.prototype._write=function(t,e,n){this.adaptBuffer(t.length),t.copy(this.buffer,this.size,0),this._size+=t.length,n()},e}(y.default.Writable),ma=function(t){function e(e,n,r){var o=t.call(this)||this;return o.contextProvider=e,o.listServices=n,o.listAddons=r,o.connections=[],o.hostsFileMutex=new Io,o.ipAllocationMutex=new Io,o.stopForwarding=function(t){return T(o,void 0,void 0,(function(){var e,n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:return[4,t.tunnel.close()];case 1:return a.sent(),e=t.forwardingContext,n=e.projectId,r=e.type,o=e.id,(i=e.hostnames).length>0?[4,this.unregisterHostnames(null===(s=t.tunnel.bindTo)||void 0===s?void 0:s.address,i)]:[3,3];case 2:a.sent(),a.label=3;case 3:return this.connections.splice(this.connections.findIndex((function(t){var e=t.forwardingContext,i=e.type,s=e.id,a=e.projectId;return s===o&&a===n&&i===r})),1),[2]}}))}))},o.canExecuteWithHostnames=function(){return"win32"!==process.platform?process.getuid&&0!==process.getuid()?{error:!0,message:"You are not running this command with sufficient privileges (uid=".concat(process.getuid(),"). Try running with 'sudo'.")}:{error:!1,type:"unix-admin"}:function(){try{return c.execSync("fsutil dirty query %systemdrive%"),!0}catch(t){if("ENOENT"===t.code)try{return c.execSync("fltmc"),!0}catch(t){return!1}return!1}}()?{error:!1,type:"windows-admin"}:{error:!0,message:"You are not running this command as administrator. Please start command line with admin rights."}},o.assertStartedWithNodejs=function(){if(!ha)throw new Error("Port forwarding only possible when started with nodejs")},o.proxyApiClient=new uo(e),o}return B(e,t),e.prototype.withProjectForwarding=function(t,e,n){return void 0===n&&(n=!0),T(this,void 0,void 0,(function(){var r;return L(this,(function(o){switch(o.label){case 0:return[4,this.forwardProject(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopProjectForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardProject=function(t,e){return void 0===e&&(e=!0),T(this,void 0,void 0,(function(){var n,r,o,i,s,a=this;return L(this,(function(u){switch(u.label){case 0:return this.assertStartedWithNodejs(),n=t.projectId,[4,this.listServices({parameters:{projectId:n}})];case 1:return r=u.sent(),[4,this.listAddons({parameters:{projectId:n}})];case 2:return o=u.sent(),[4,Promise.all(r.data.services.map((function(t){return T(a,void 0,void 0,(function(){return L(this,(function(r){return[2,this.forwardService({projectId:n,serviceId:t.id},e)]}))}))})))];case 3:return i=u.sent(),[4,Promise.all(o.data.addons.map((function(t){return T(a,void 0,void 0,(function(){return L(this,(function(r){switch(r.label){case 0:return[4,this.forwardAddon({projectId:n,addonId:t.id},e)];case 1:return[2,r.sent()]}}))}))})))];case 4:return s=u.sent(),[2,{services:i,addons:s}]}}))}))},e.prototype.withServiceForwarding=function(t,e,n){return void 0===n&&(n=!0),T(this,void 0,void 0,(function(){var r;return L(this,(function(o){switch(o.label){case 0:return[4,this.forwardService(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopServiceForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardService=function(t,e){return void 0===e&&(e=!0),T(this,void 0,void 0,(function(){var n,r,o,i,s,a,u,c=this;return L(this,(function(l){switch(l.label){case 0:return this.assertStartedWithNodejs(),n=t.projectId,r=t.serviceId,[4,this.proxyApiClient.getServiceDetails(n,r)];case 1:return o=l.sent(),i=o.namespace,s=o.targetDomain,a=o.instances,u=o.ports,0===a.length?[2,[]]:[4,fa(u,(function(t){var o,u="https://".concat(s,"/tunnel/projects/").concat(n,"/services/").concat(r,"/instance/").concat(a[0].podName,"/port/").concat(t.internalPort),l="".concat(r,".").concat(i,".svc.cluster.local"),d=["".concat(r)];t.name&&d.push("".concat(t.name,".").concat(r)),"HTTP"===t.protocol&&(o={altHostnames:d,targetHostname:l});var p=e?[]:R([l],d,!0);return c.forwardPort(u,t,p,"service",r,n,e,o)}))];case 2:return[2,l.sent()]}}))}))},e.prototype.withAddonForwarding=function(t,e,n){return void 0===n&&(n=!0),T(this,void 0,void 0,(function(){var r;return L(this,(function(o){switch(o.label){case 0:return[4,this.forwardAddon(t,n)];case 1:r=o.sent(),o.label=2;case 2:return o.trys.push([2,,4,6]),[4,e(r)];case 3:return[2,o.sent()];case 4:return[4,this.stopAddonForwarding(t)];case 5:return o.sent(),[7];case 6:return[2]}}))}))},e.prototype.forwardAddon=function(t,e){return void 0===e&&(e=!0),T(this,void 0,void 0,(function(){var n,r,o,i,s=this;return L(this,(function(a){switch(a.label){case 0:return this.assertStartedWithNodejs(),n=t.addonId,r=t.projectId,[4,this.proxyApiClient.getAddonDetails(r,n)];case 1:return o=a.sent(),i=o.instances.map((function(t){var e=t.podName,n=t.internalHostname;return t.ports.map((function(t){return{podName:e,internalHostname:n,port:t}}))})),[4,fa((u=i,null!=u&&u.length?Ge(u,1/0):[]),(function(t){var i=t.podName,a=t.internalHostname,u=t.port;return T(s,void 0,void 0,(function(){var t;return L(this,(function(s){return t="https://".concat(o.targetDomain,"/tunnel/projects/").concat(r,"/addons/").concat(n,"/instance/").concat(i,"/port/").concat(u.internalPort),[2,this.forwardPort(t,u,e?[]:[a],"addon",n,r,e)]}))}))}))];case 2:return[2,a.sent()]}var u}))}))},e.prototype.allocateIpAddress=function(t){return T(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){return[2,this.ipAllocationMutex.enter((function(){return T(e,void 0,void 0,(function(){var e,n,r,o,i;return L(this,(function(s){switch(s.label){case 0:return e="127.24.1.1",n="127.24.255.255",r=null!==(i=this.nextIpAddress)&&void 0!==i?i:e,[4,co(t,r,n)];case 1:return o=s.sent(),this.nextIpAddress=fo(ho(o)+1),ho(this.nextIpAddress)>ho(n)&&(this.nextIpAddress=e),[2,o]}}))}))}))]}))}))},e.prototype.forwardPort=function(t,e,n,r,o,i,s,a){var u;return void 0===s&&(s=!0),T(this,void 0,void 0,(function(){var c,l,d,p,h,f,v=this;return L(this,(function(m){switch(m.label){case 0:if(c={Authorization:"Bearer ".concat(this.contextProvider.getCurrentToken())},!s&&(l=this.canExecuteWithHostnames()).error)throw new Error("".concat(l.message," Alternatively, you can use the ipOnly mode when port-forwarding (apiClient.forwarding.forwardAddon({ projectId, addonId }, true))"));return[4,this.determineSocketAddress(i,o,r,e,s)];case 1:return d=m.sent(),p="UDP"===e.protocol?new pa(t,c,d):new da(t,c,a,d),s?[3,3]:[4,this.registerHostnames(null===(u=p.bindTo)||void 0===u?void 0:u.address,n)];case 2:m.sent(),m.label=3;case 3:return p.on("connection-accept",(function(){return v.emit("connection-accept",p)})),p.on("connection-close",(function(){return T(v,void 0,void 0,(function(){return L(this,(function(t){return[2,this.emit("connection-close",p)]}))}))})),[4,p.open()];case 4:return h=m.sent(),f={projectId:i,id:o,type:r,hostnames:n,port:h.port,address:h.address,protocol:e.protocol,portName:e.name},this.emit("tunnel-open",p,f),p.on("connection-error",(function(t){return v.emit("connection-error",p,f,t)})),p.on("tunnel-close",(function(){return v.emit("tunnel-close",p,f)})),this.connections.push({tunnel:p,forwardingContext:f}),[2,{data:f}]}}))}))},e.prototype.determineSocketAddress=function(t,e,n,r,o){var i;return T(this,void 0,void 0,(function(){var s,a,u;return L(this,(function(c){switch(c.label){case 0:return o?[2,void 0]:(s=this.connections.find((function(r){return r.forwardingContext.projectId===t&&r.forwardingContext.id===e&&r.forwardingContext.type===n})),a=(null===(i=null==s?void 0:s.forwardingContext)||void 0===i?void 0:i.port)!==r.internalPort,s&&a?[2,{address:s.forwardingContext.address,port:r.internalPort}]:(u={},[4,this.allocateIpAddress(r.internalPort)]));case 1:return[2,(u.address=c.sent(),u.port=r.internalPort,u)]}}))}))},e.prototype.registerHostnames=function(t,e){return T(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,this.modifyHostsFile((function(n){n.removeHosts.apply(n,e),n.add.apply(n,R([t],e,!1))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.unregisterHostnames=function(t,e){return T(this,void 0,void 0,(function(){return L(this,(function(n){switch(n.label){case 0:return[4,this.modifyHostsFile((function(n){n.remove.apply(n,R([t],e,!1))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.modifyHostsFile=function(t){return T(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,this.hostsFileMutex.enter((function(){return T(e,void 0,void 0,(function(){var e,n=this;return L(this,(function(r){switch(r.label){case 0:return[4,ko.load({header:"Northflank Proxy"})];case 1:return e=r.sent(),t(e),[4,e.backup({suffix:".backup-pre-northflank"})];case 2:r.sent(),r.label=3;case 3:return r.trys.push([3,5,,7]),[4,ba(5)((function(){return T(n,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return[4,e.write({writeMode:"atomic"})];case 1:return t.sent(),[2]}}))}))}))];case 4:return r.sent(),[3,7];case 5:return r.sent(),[4,ba(5)((function(){return T(n,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return[4,e.write({writeMode:"standard"})];case 1:return t.sent(),[2]}}))}))}))];case 6:return r.sent(),[3,7];case 7:return[2]}}))}))}))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopProjectForwarding=function(t){return T(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return e.forwardingContext.projectId===t.projectId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopServiceForwarding=function(t){return T(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return"service"===e.forwardingContext.type&&e.forwardingContext.projectId===t.projectId&&e.forwardingContext.id===t.serviceId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stopAddonForwarding=function(t){return T(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.connections.filter((function(e){return"addon"===e.forwardingContext.type&&e.forwardingContext.projectId===t.projectId&&e.forwardingContext.id===t.addonId})).map((function(t){return e.stopForwarding(t)})))];case 1:return n.sent(),[2]}}))}))},e.prototype.stop=function(){return T(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this.connections.map((function(e){return T(t,void 0,void 0,(function(){return L(this,(function(t){return[2,this.stopForwarding(e)]}))}))})))];case 1:return e.sent(),[2]}}))}))},e}(t.EventEmitter),ba=function(t,e){return void 0===e&&(e=50),function(n){var r=t,o=function(){return T(void 0,void 0,void 0,(function(){var t;return L(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,4]),[4,n()];case 1:return[2,i.sent()];case 2:if(t=i.sent(),r<=0)throw t;return r-=1,[4,new Promise((function(t){return setTimeout((function(){return t()}),e)}))];case 3:return i.sent(),[2,o()];case 4:return[2]}}))}))};return o()}},ya=function(t){function e(e,n,r,o,i,s){void 0===o&&(o=new g.PassThrough),void 0===i&&(i=new g.PassThrough),void 0===s&&(s=new g.PassThrough);var a=t.call(this)||this;return a.baseUrl=e,a.execConfig=n,a.token=r,a.stdOut=o,a.stdErr=i,a.stdIn=s,a.waitForCommandResult=function(){return T(a,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:if(void 0===this.currentCommand)throw new Error("No command is running");return[4,this.currentCommand];case 1:return[2,t.sent()]}}))}))},a.sendInputToCurrentCommand=function(t){return T(a,void 0,void 0,(function(){var e;return L(this,(function(n){if(void 0===this.currentCommand||void 0===this.duplex)throw new Error("No command is running");return null===(e=this.duplex)||void 0===e||e.write(this.constructPayloadPacket(t)),[2]}))}))},a.resizeTerminal=function(t){return T(a,void 0,void 0,(function(){var e;return L(this,(function(n){if(void 0===this.currentCommand||void 0===this.duplex)throw new Error("No command is running, can't resize terminal");return null===(e=this.duplex)||void 0===e||e.write(JSON.stringify({type:"resize",data:{ttyRows:null==t?void 0:t.rows,ttyColumns:null==t?void 0:t.columns}})),[2]}))}))},a.constructPayloadPacket=function(t){return JSON.stringify({type:"payload",data:t.toString()})},a}return B(e,t),Object.defineProperty(e.prototype,"execEndpoint",{get:function(){var t=this.execConfig,e=t.entityId,n=t.entityType,r=t.projectId,o="".concat(this.baseUrl,"/v1/command-exec/projects/").concat(r,"/");return"".concat(o).concat(function(){switch(n){case"service":return"services/".concat(e);case"job":return"jobs/".concat(e);case"addon":return"addons/".concat(e);case"build":return"builds/".concat(e);default:throw new Error("Unexpected Northflank entity type received in command exec endpoint generation: ".concat(n))}}())},enumerable:!1,configurable:!0}),e.prototype.start=function(){return T(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){if(void 0!==this.currentCommand)throw new Error("Command is already running");return this.currentCommand=new Promise((function(e,n){void 0!==t.remote&&n(Error("Command is already running"));var r,o=t.execEndpoint.replace("https:","wss:").replace("http:","ws:");t.remote=new Js(o);try{t.duplex=Zo(t.remote)}catch(t){throw new Error("Failed to establish connection to command execution proxy: ".concat(t.message))}t.initialAuth(),t.stdIn.on("data",(function(e){var n,r;(null===(n=t.duplex)||void 0===n?void 0:n.writable)&&(null===(r=t.duplex)||void 0===r||r.write(t.constructPayloadPacket(e)))})),t.duplex.on("data",(function(e){var n,o,s=JSON.parse(e.toString());switch(null==s?void 0:s.type){case"init":var a=s.data;"successful"!==a.auth&&i("Command initialization failed: ".concat(null!==(n=null==a?void 0:a.message)&&void 0!==n?n:"Reason unknown"));break;case"completion":r=s.data,t.emit("command-result",r),null===(o=t.duplex)||void 0===o||o.end();break;case"stdOut":t.emit("std-out-data",s.data),t.stdOut.write(s.data);break;case"stdErr":t.emit("std-err-data",s.data),t.stdErr.write(s.data);break;case"error":i(s.data);break;default:var u="unable to parse message: ".concat(JSON.stringify(s));i(u)}})),t.duplex.on("end",(function(){t.emit("command-completed"),t.reset(),e(r)})),t.duplex.on("error",(function(n){t.emit("error",n),t.emit("command-completed"),t.reset(),e(r)}));var i=function(e){t.emit("error",e),t.reset(),n(new Error(e))};t.emit("command-started")})),[2,this.currentCommand]}))}))},e.prototype.initialAuth=function(){var t,e=this.execConfig,n=e.command,r=e.containerName,o=e.shell,i=e.user,s=e.group,a=e.ttyColumns,u=e.ttyRows,c={type:"init",data:{auth:{type:"apiToken",apiToken:this.token},context:{containerId:r,command:n,shell:o,user:i,group:s,ttyColumns:a,ttyRows:u}}};null===(t=this.duplex)||void 0===t||t.write(JSON.stringify(c))},e.prototype.reset=function(){var t;this.remote=void 0,this.currentCommand=void 0,null===(t=this.duplex)||void 0===t||t.destroy(),this.duplex=void 0},e}(t.EventEmitter),ga=function(){function t(t){this.contextProvider=t,this.assertStartedWithNodejs=function(){if(!ha)throw new Error("Command exec only possible when started with nodejs")}}return t.prototype.execServiceCommand=function(t,e){return T(this,void 0,void 0,(function(){var n,r,o;return L(this,(function(i){return n=t.serviceId,r=t.projectId,"service",o=N({projectId:r,entityId:n,entityType:"service"},e),[2,this.execCommand(o)]}))}))},t.prototype.execServiceSession=function(t,e){return T(this,void 0,void 0,(function(){var n,r,o;return L(this,(function(i){return n=t.serviceId,r=t.projectId,"service",o=N({projectId:r,entityId:n,entityType:"service"},e),[2,this.shellSession(o)]}))}))},t.prototype.execJobCommand=function(t,e){return T(this,void 0,void 0,(function(){var n,r,o;return L(this,(function(i){return n=t.jobId,r=t.projectId,"job",o=N({projectId:r,entityId:n,entityType:"job"},e),[2,this.execCommand(o)]}))}))},t.prototype.execJobSession=function(t,e){return T(this,void 0,void 0,(function(){var n,r,o;return L(this,(function(i){return n=t.jobId,r=t.projectId,"job",o=N({projectId:r,entityId:n,entityType:"job"},e),[2,this.shellSession(o)]}))}))},t.prototype.execCommand=function(t){return T(this,void 0,void 0,(function(){var e,n,r;return L(this,(function(o){switch(o.label){case 0:return this.assertStartedWithNodejs(),e=this.getCommandRunner(N({shell:"none"},t)),n=new va,r=new va,e.stdOut.pipe(n),e.stdErr.pipe(r),e.on("error",(function(t){throw new Error(t)})),[4,e.start()];case 1:return[2,{commandResult:o.sent(),stdOut:n.getContentsAsString(),stdErr:r.getContentsAsString()}]}}))}))},t.prototype.shellSession=function(t){this.assertStartedWithNodejs();var e=this.getCommandRunner(t);return e.start(),e},t.prototype.getCommandRunner=function(t){var e=this.contextProvider.getCurrentBaseUrl(!0),n=this.contextProvider.getCurrentToken();if(!n)throw Error("API token not found");return new ya(e,t,n)},t}(),wa=ha?ao:window.fetch,_a=function(){if(ha)try{return JSON.parse(O.default.readFileSync(k.default.join(k.default.dirname(r.fileURLToPath("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("api-client.js",document.baseURI).href)),"../../package.json")).toString())}catch(t){return console.log("Failed to check version of northflank CLI (".concat(t.message,")")),{}}return{}},ja=function(){function t(t,e){var n=this;this.opts=e,this.call=function(t){return T(n,void 0,void 0,(function(){var e,n,r,o,i,s,a,u,c,l,d,p,h=this;return L(this,(function(f){switch(f.label){case 0:if(e=this.method,n={method:e,headers:this.getDefaultHeaders()},!(r=null===(p=this.contextProvider)||void 0===p?void 0:p.getCurrentBaseUrl()))throw new Error("Api client context not correctly initialized, please provide a url to the context.");return o="".concat(r).concat(this.endpointUrl(t)),i=this.body(t),s=N(N({url:o},n),{body:i}),[4,Aa(o,N(N({},n),{body:i}))];case 1:return[4,(a=f.sent()).text()];case 2:return u=f.sent(),c=function(){if(200!==a.status){var t=null==l?void 0:l.error,e=401===a.status?" (Make sure your API token has sufficient permissions)":"",n="".concat((null==t?void 0:t.message)||"").concat(e);if(h.opts.throwErrorOnHttpErrorCode)throw Error(n);return{status:a.status,message:n,id:null==t?void 0:t.id,details:null==t?void 0:t.details}}},l=function(){try{return JSON.parse(u)}catch(t){throw Error("Failed reading api request result: \n\tStatus: ".concat(a.statusText," (").concat(a.status,")\n\tMessage: ").concat(u))}}(),d=c(),[2,{data:null==l?void 0:l.data,rawResponse:a,request:s,error:d,pagination:null==l?void 0:l.pagination}]}}))}))},this.contextProvider=t}return t.prototype.getDefaultHeaders=function(){var t,e,n=this.contextProvider.getCurrentToken(),r=(null===(t=this.opts)||void 0===t?void 0:t.customUserAgent)?" (".concat(this.opts.customUserAgent,")"):"";return{Authorization:this.withAuth?"Bearer ".concat(n):void 0,"Content-Type":"application/json","User-Agent":"northflank-js-client/".concat(null===(e=_a())||void 0===e?void 0:e.version).concat(r)}},t}(),Ea=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="get",e.body=function(){},e}return B(e,t),e}(ja),Sa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="post",e}return B(e,t),e}(ja),xa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.method="delete",e.body=function(){},e}return B(e,t),e}(ja),Aa=function(t,e,n,r){return void 0===e&&(e={}),void 0===n&&(n=3),void 0===r&&(r=500),new Promise((function(o,i){var s=function(n){return wa(t,e).then((function(t){o(t)})).catch((function(t){return T(void 0,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return n>0?[4,(o=r,new Promise((function(t){setTimeout((function(){t()}),o)})))]:[3,2];case 1:return e.sent(),[2,s(n-1)];case 2:return[2,i(t)]}var o}))}))}))};return s(n)}))},Ca=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists projects for the authenticated user or team.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects".concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Oa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new project.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects"},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),ka=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get information about the given project",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId)},e.body=function(){},e}return B(e,t),e}(Ea),Ia=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Delete the given project. Fails if the project isn't empty.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId)},e.body=function(){},e}return B(e,t),e}(xa),Ua=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of addons belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Da=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Pa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return B(e,t),e}(Ea),Ba=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return B(e,t),e}(xa),Na=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the credentials for connecting to the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/credentials")},e.body=function(){},e}return B(e,t),e}(Ea),Ta=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the available addon types",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/addon-types"},e.body=function(){},e}return B(e,t),e}(Ea),La=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the allocated resources for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Ra=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the current addon version including available upgrades and upgrade history.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/version")},e.body=function(){},e}return B(e,t),e}(Ea),Fa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Upgrades the addon to a new version.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/version")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Ga=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the network settings for the addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/network-settings")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Ma=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the security rules for the addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/security")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns a list of backups for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),qa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Initiates a backup for the given addon",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Wa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about a given backup including restore history",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId)},e.body=function(){},e}return B(e,t),e}(Ea),$a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a given backup",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId)},e.body=function(){},e}return B(e,t),e}(xa),Ja=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restores the given addon to the given backup state.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/restore")},e.body=function(){},e}return B(e,t),e}(Sa),Ha=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Imports a database from an external archive or existing live database.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/import")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Va=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given addon.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/containers").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Ya=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Pause the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/pause")},e.body=function(){},e}return B(e,t),e}(Sa),Za=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Resume the given addon if it is paused.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/resume")},e.body=function(){},e}return B(e,t),e}(Sa),Ka=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restart the given addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/restart")},e.body=function(){},e}return B(e,t),e}(Sa),Xa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the in progress backup.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/abort")},e.body=function(){},e}return B(e,t),e}(Sa),Qa=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Generates a temporary download link for downloading the given backup.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/download-link")},e.body=function(){},e}return B(e,t),e}(Ea),tu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts an in-progress backup restore.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/addons/").concat(t.parameters.addonId,"/backups/").concat(t.parameters.backupId,"/abort-restore")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),eu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of jobs belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),nu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId)},e.body=function(){},e}return B(e,t),e}(Ea),ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId)},e.body=function(){},e}return B(e,t),e}(xa),ou=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new manual job that only runs when initiated via the UI, CLI, API or JS client.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/manual")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),iu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new cron job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/cron")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),su=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the scaling settings for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),au=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Fetches run history for the given job",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),uu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Starts a new job run for the given job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),cu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns data about the given job run",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs/").concat(t.parameters.runId)},e.body=function(){},e}return B(e,t),e}(Ea),lu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given job run",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runs/").concat(t.parameters.runId)},e.body=function(){},e}return B(e,t),e}(xa),du=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates settings for the job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/settings")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),pu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the health checks for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/health-checks")},e.body=function(){},e}return B(e,t),e}(Ea),hu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates health checks for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/health-checks")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),fu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists builds for the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),vu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Start a new build for the given job. Given a commit sha, it will build that commit.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),mu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about a build for the job",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return B(e,t),e}(Ea),bu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given job build",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return B(e,t),e}(xa),yu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the build options for a given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-options")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),gu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the version control source for a given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-source")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),wu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the Docker CMD override for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/cmd-override")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),_u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the build arguments of the given job. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),ju=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets build arguments for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Eu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the build arguments accessible by the given job. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/build-arguments/details")},e.body=function(){},e}return B(e,t),e}(Ea),Su=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the runtime environment for the given job. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runtime-environment").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),xu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the runtime environment for the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runtime-environment")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Au=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the runtime environment accessible by the given job. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/runtime-environment/details")},e.body=function(){},e}return B(e,t),e}(Ea),Cu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the deployment of the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/deployment")},e.body=function(){},e}return B(e,t),e}(Ea),Ou=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the deployment settings of the given job.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),ku=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/containers").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Iu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the branches of the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/branches").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Uu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the pull-requests of the given job.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/jobs/").concat(t.parameters.jobId,"/pull-requests").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Du=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the container registry credentials saved to this account. Does not display secrets.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/registry-credentials".concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Pu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Adds a new set of container registry credentials to this account.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials"},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Bu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Views a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId)},e.body=function(){},e}return B(e,t),e}(Ea),Nu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId)},e.body=function(){},e}return B(e,t),e}(xa),Tu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates a set of registry credential data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/registry-credentials/".concat(t.parameters.credentialId,"/modify")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Lu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available domains",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/domains".concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Ru=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Registers a new domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains"},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Fu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain)},e.body=function(){},e}return B(e,t),e}(Ea),Gu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes a domain and each of its registered subdomains.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain)},e.body=function(){},e}return B(e,t),e}(xa),Mu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Attempts to verify the domain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/verify")},e.body=function(){},e}return B(e,t),e}(Sa),zu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Adds a new subdomain to the domain.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),qu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain)},e.body=function(){},e}return B(e,t),e}(Ea),Wu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Removes a subdomain from a domain.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain)},e.body=function(){},e}return B(e,t),e}(xa),$u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets details about the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/verify")},e.body=function(){},e}return B(e,t),e}(Sa),Ju=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Assigns a service port to the given subdomain",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/assign")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Hu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Removes a subdomain from its assigned service",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/domains/".concat(t.parameters.domain,"/subdomains/").concat(t.parameters.subdomain,"/assign")},e.body=function(){},e}return B(e,t),e}(xa),Vu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available billing plans",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/plans"},e.body=function(){},e}return B(e,t),e}(Ea),Yu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists available project regions",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/regions"},e.body=function(){},e}return B(e,t),e}(Ea),Zu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Returns the partially random string used when generating host names for the authenticated account.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/dns-id"},e.body=function(){},e}return B(e,t),e}(Ea),Ku=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists linked version control providers",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/vcs"},e.body=function(){},e}return B(e,t),e}(Ea),Xu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of secrets belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/secrets").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Qu=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a secret with the specified payload",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),tc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="View a secret including its contents",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId).concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Delete a secret",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId)},e.body=function(){},e}return B(e,t),e}(xa),nc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Update a secret",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId)},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),rc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="View a secret with details about its linked addons",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/details")},e.body=function(){},e}return B(e,t),e}(Ea),oc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Link an addon to the secret group or edit the settings of the linked addon.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),ic=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about a given addon link.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return B(e,t),e}(Ea),sc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Unlinks an addon from the secret group.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/secrets/").concat(t.parameters.secretId,"/addons/").concat(t.parameters.addonId)},e.body=function(){},e}return B(e,t),e}(xa),ac=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of services belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),uc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new combined service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/combined")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new deployment service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),lc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a new build service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/build")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),dc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId)},e.body=function(){},e}return B(e,t),e}(Ea),pc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId)},e.body=function(){},e}return B(e,t),e}(xa),hc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Modifies the scaling settings for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/scale")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),fc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the deployment of the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/deployment")},e.body=function(){},e}return B(e,t),e}(Ea),vc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the deployment settings of the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/deployment")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),mc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Restarts the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/restart")},e.body=function(){},e}return B(e,t),e}(Sa),bc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Pause the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/pause")},e.body=function(){},e}return B(e,t),e}(Sa),yc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Resumes the given service. Optionally takes `instances` to resume with a given number of instances.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/resume")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),gc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the ports for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/ports")},e.body=function(){},e}return B(e,t),e}(Ea),wc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the list of ports for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/ports")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),_c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the build options for a given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-options")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),jc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates the version control source for a given build or combined service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-source")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Ec=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the Docker CMD override for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/cmd-override")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Sc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the health checks for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/health-checks")},e.body=function(){},e}return B(e,t),e}(Ea),xc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Updates health checks for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/health-checks")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Ac=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Lists the builds for the service",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Cc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Start a new build for the given combined or build service. If given a commit sha, it will build that commit. Otherwise, the most recent relevant commit will be built. If the service provided is a build service, a branch name or pull request to build from is required.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Oc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about a build for the service",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return B(e,t),e}(Ea),kc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Aborts the given service build",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build/").concat(t.parameters.buildId)},e.body=function(){},e}return B(e,t),e}(xa),Ic=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of containers for the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/containers").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Uc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the branches of the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/branches").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Dc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets information about the pull-requests of the given service.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/pull-requests").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Pc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of repositories accessible to this account",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/vcs/repos".concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Bc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of branches for the repo",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/vcs/repos/".concat(t.parameters.vcsService,"/").concat(t.parameters.repositoryOwner,"/").concat(t.parameters.repositoryName,"/branches").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Nc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets a list of volumes belonging to the project",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes")},e.body=function(){},e}return B(e,t),e}(Ea),Tc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Creates a volume with the specified payload",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Lc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Retrieve a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(){},e}return B(e,t),e}(Ea),Rc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Update volume mounts and storage size",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Fc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Deletes this volume and its associated data.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId)},e.body=function(){},e}return B(e,t),e}(xa),Gc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Attach a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId,"/attach")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Mc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Detach a volume",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/volumes/").concat(t.parameters.volumeId,"/detach")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),zc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the build arguments of the given service. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),qc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the build arguments for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Wc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the build arguments accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/build-arguments/details")},e.body=function(){},e}return B(e,t),e}(Ea),$c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Gets the runtime environment of the given service. If the API key does not have the permission 'Project > Secrets > General > Read', secrets inherited from secret groups will not be displayed.",e.withAuth=!0,e.endpointUrl=function(t){var e,n=Object.entries(null!==(e=null==t?void 0:t.options)&&void 0!==e?e:{}),r=n.length>0?"?".concat(n.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&")):"";return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/runtime-environment").concat(r)},e.body=function(){},e}return B(e,t),e}(Ea),Jc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Sets the runtime environment for the given service.",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/runtime-environment")},e.body=function(t){return JSON.stringify(t.data)},e}return B(e,t),e}(Sa),Hc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.description="Get details about the runtime environment accessible by the given service. Also requires the permission 'Project > Secrets > General > Read'",e.withAuth=!0,e.endpointUrl=function(t){return"/v1/projects/".concat(t.parameters.projectId,"/services/").concat(t.parameters.serviceId,"/runtime-environment/details")},e.body=function(){},e}return B(e,t),e}(Ea),Vc=function(){function t(){this.loadContext()}return t.prototype.loadContext=function(){this.contextWrapper=this.loadContextWrapper()},t.prototype.getInfo=function(){return""},t.prototype.storeContext=function(t){return T(this,void 0,void 0,(function(){return L(this,(function(e){switch(e.label){case 0:return[4,this.writeContext(t)];case 1:return e.sent(),this.contextWrapper=t,[2]}}))}))},t.prototype.addContext=function(t,e){return void 0===e&&(e=!0),T(this,void 0,void 0,(function(){var n,r,o;return L(this,(function(i){switch(i.label){case 0:if(e||void 0===this.findContext(t.name))return[3,1];throw new Error("Context with name ".concat(t.name," already exists"));case 1:return[4,this.removeContext(t.name)];case 2:i.sent(),i.label=3;case 3:return n=N({host:"https://api.northflank.com"},t),r=this.contextWrapper,o={current:n.name,contexts:R(R([],r.contexts,!0),[n],!1),lastUpdateCheck:r.lastUpdateCheck},[4,this.storeContext(o)];case 4:return i.sent(),[2]}}))}))},t.prototype.removeContext=function(t){return T(this,void 0,void 0,(function(){var e,n,r,o;return L(this,(function(i){switch(i.label){case 0:return e=this.contextWrapper,n=e.contexts.filter((function(e){return e.name!==t})),r=e.current===t?void 0:e.current,o={current:r,contexts:R([],n,!0),lastUpdateCheck:e.lastUpdateCheck},[4,this.storeContext(o)];case 1:return i.sent(),[2]}}))}))},t.prototype.getCurrentContext=function(){var t=this.contextWrapper.current;return void 0===t?t:this.findContext(t)},t.prototype.findContext=function(t){return this.contextWrapper.contexts.find((function(e){return e.name===t}))},t.prototype.getCurrentBaseUrl=function(t){var e=this.getCurrentContext();if(!0===t&&!(null==e?void 0:e.host))throw new Error("Context (".concat(null==e?void 0:e.name,") doesn't have a target API host. Please login again."));return null==e?void 0:e.host},t.prototype.getCurrentProjectName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.project},t.prototype.getCurrentName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.name},t.prototype.getCurrentToken=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.token},t.prototype.getCurrentServiceName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.service},t.prototype.getCurrentJobName=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.job},t.prototype.getCurrentPlanId=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.plan},t.prototype.getCurrentRegion=function(){var t;return null===(t=this.getCurrentContext())||void 0===t?void 0:t.region},t.prototype.useContext=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(!this.findContext(t))throw new Error("Context with name ".concat(t," doesn't exist"));return e=this.contextWrapper,n=N(N({},e),{current:t}),[4,this.storeContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateToken=function(t,e){return T(this,void 0,void 0,(function(){var n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:if(n=null!=e?e:this.getCurrentName(),!(r=this.findContext(n)))throw new Error("Context with name ".concat(e," doesn't exist"));return o=this.contextWrapper,i=o.contexts.map((function(e){return e.name===n?N(N({},r),{token:t}):e})),s=N(N({},o),{contexts:i}),[4,this.storeContext(s)];case 1:return a.sent(),[2]}}))}))},t.prototype.useProjectId=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set project id to current context, current context not defined");return n=N(N({},e),{project:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useServiceId=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set service id to current context, current context not defined");return n=N(N({},e),{service:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useJobId=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set job id to current context, current context not defined");return n=N(N({},e),{job:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.usePlanId=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set plan id to current context, current context not defined");return n=N(N({},e),{plan:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.useRegion=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(void 0===(e=this.getCurrentContext()))throw new Error("Failed to set region id to current context, current context not defined");return n=N(N({},e),{region:t}),[4,this.addContext(n)];case 1:return r.sent(),[2]}}))}))},t.prototype.getLastUpdateCheck=function(){return this.contextWrapper.lastUpdateCheck||new Date},t.prototype.setLastUpdateCheck=function(t){return T(this,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:return e=this.contextWrapper,n=N(N({},e),{lastUpdateCheck:t}),[4,this.storeContext(n)];case 1:return r.sent(),[2]}}))}))},t}(),Yc=function(t){function e(e){var n=t.call(this)||this;return n.assertDir=function(t){return T(n,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,O.default.promises.mkdir(t,{recursive:!0})];case 1:return[2,n.sent()];case 2:throw e=n.sent(),console.log("Failed to login, local files could not be created: ".concat(t,", error: ").concat(e.message)),e;case 3:return[2]}}))}))},n.configPath=e||"".concat(x.default.homedir(),"/.northflank"),n.configFile="".concat(n.configPath,"/config.json"),n.loadContext(),n}return B(e,t),e.prototype.loadContextWrapper=function(){try{return JSON.parse(O.default.readFileSync(this.configFile,"utf8"))}catch(t){return{contexts:[],lastUpdateCheck:new Date(0)}}},e.prototype.writeContext=function(t){return T(this,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return[4,this.assertConfigDir()];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,O.default.promises.writeFile(this.configFile,JSON.stringify(t,null,"\t"),{mode:416})];case 3:return n.sent(),[3,5];case 4:throw e=n.sent(),console.log("Failed to persist api context, local files could not be created, error: ".concat(e.message)),e;case 5:return[2]}}))}))},e.prototype.assertConfigDir=function(){return T(this,void 0,void 0,(function(){return L(this,(function(t){switch(t.label){case 0:return[4,this.assertDir(this.configPath)];case 1:return t.sent(),[2]}}))}))},e.prototype.getInfo=function(){return"Cli config stored in: ".concat(this.configPath)},e}(Vc),Zc=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.inMemoryContextWrapper={contexts:[],lastUpdateCheck:new Date(0)},e}return B(e,t),e.prototype.loadContextWrapper=function(){return this.inMemoryContextWrapper||(this.inMemoryContextWrapper={contexts:[],lastUpdateCheck:new Date(0)}),this.inMemoryContextWrapper},e.prototype.writeContext=function(t){return T(this,void 0,void 0,(function(){return L(this,(function(e){return this.inMemoryContextWrapper=t,[2]}))}))},e}(Vc),Kc=function(t,e){void 0===e&&(e={});var n,r=this;this.baseUrl=function(){return r.contextProvider.getCurrentBaseUrl()},this.contextProvider=t,this.forwarding=new ma(t,new ac(t,e).call,new Ua(t,e).call),this.exec=new ga(t),this.endpoints={list:(n={},n.projects=new Ca(t,e),n.addons=new Ua(t,e),n.jobs=new eu(t,e),n.registryCredentials=new Du(t,e),n.domains=new Lu(t,e),n.plans=new Vu(t,e),n.regions=new Yu(t,e),n.vcs=new Ku(t,e),n.secrets=new Xu(t,e),n.services=new ac(t,e),n.repos=new Pc(t,e),n.branches=new Bc(t,e),n.volumes=new Nc(t,e),n),create:function(){var n,r={};return r.project=new Oa(t,e),r.addon=new Da(t,e),r.job=((n={}).manual=new ou(t,e),n.cron=new iu(t,e),n),r.domain=new Ru(t,e),r.secret=new Qu(t,e),r.service=function(){var n={};return n.combined=new uc(t,e),n.deployment=new cc(t,e),n.build=new lc(t,e),n}(),r.volume=new Tc(t,e),r}(),get:function(){var n,r,o={};return o.project=new ka(t,e),o.addon=((r=new Pa(t,e)).credentials=new Na(t,e),r.types=new Ta(t,e),r.version=new Ra(t,e),r.backups=new za(t,e),r.backup=((n=new Wa(t,e)).download=new Qa(t,e),n),r.containers=new Va(t,e),r),o.job=function(){var n=new nu(t,e);return n.runs=new au(t,e),n.run=new cu(t,e),n.healthChecks=new pu(t,e),n.builds=new fu(t,e),n.build=new mu(t,e),n.buildArguments=new _u(t,e),n.buildArgumentDetails=new Eu(t,e),n.runtimeEnvironment=new Su(t,e),n.runtimeEnvironmentDetails=new Au(t,e),n.deployment=new Cu(t,e),n.containers=new ku(t,e),n.branches=new Iu(t,e),n.pullRequests=new Uu(t,e),n}(),o.registryCredentials=new Bu(t,e),o.domain=new Fu(t,e),o.subdomain=new qu(t,e),o.dnsId=new Zu(t,e),o.secret=new tc(t,e),o.secretDetails=new rc(t,e),o.secretLink=new ic(t,e),o.service=function(){var n=new dc(t,e);return n.deployment=new fc(t,e),n.ports=new gc(t,e),n.healthChecks=new Sc(t,e),n.builds=new Ac(t,e),n.build=new Oc(t,e),n.containers=new Ic(t,e),n.branches=new Uc(t,e),n.pullRequests=new Dc(t,e),n.buildArguments=new zc(t,e),n.buildArgumentDetails=new Wc(t,e),n.runtimeEnvironment=new $c(t,e),n.runtimeEnvironmentDetails=new Hc(t,e),n}(),o.volume=new Lc(t,e),o}(),delete:function(){var n={};return n.project=new Ia(t,e),n.addon=new Ba(t,e),n.backup=new $a(t,e),n.job=new ru(t,e),n.registryCredentials=new Nu(t,e),n.domain=new Gu(t,e),n.subdomain=new Wu(t,e),n.secret=new ec(t,e),n.secretLink=new sc(t,e),n.service=new pc(t,e),n.volume=new Fc(t,e),n}(),scale:function(){var n={};return n.addon=new La(t,e),n.job=new su(t,e),n.service=new hc(t,e),n}(),update:function(){var n,r={};return r.addon=((n={}).version=new Fa(t,e),n.networkSettings=new Ga(t,e),n.security=new Ma(t,e),n),r.job=function(){var n={};return n.settings=new du(t,e),n.healthChecks=new hu(t,e),n.buildOptions=new yu(t,e),n.buildSource=new gu(t,e),n.cmdOverride=new wu(t,e),n.buildArguments=new ju(t,e),n.runtimeEnvironment=new xu(t,e),n.deployment=new Ou(t,e),n}(),r.registryCredentials=new Tu(t,e),r.secret=new nc(t,e),r.secretLink=new oc(t,e),r.service=function(){var n={};return n.deployment=new vc(t,e),n.ports=new wc(t,e),n.buildOptions=new _c(t,e),n.buildSource=new jc(t,e),n.cmdOverride=new Ec(t,e),n.healthChecks=new xc(t,e),n.buildArguments=new qc(t,e),n.runtimeEnvironment=new Jc(t,e),n}(),r.volume=new Rc(t,e),r}(),backup:function(){var n={};return n.addon=new qa(t,e),n}(),restore:function(){var n,r={};return r.addon=((n={}).backup=new Ja(t,e),n),r}(),import:function(){var n,r={};return r.addon=((n={}).backup=new Ha(t,e),n),r}(),pause:function(){var n={};return n.addon=new Ya(t,e),n.service=new bc(t,e),n}(),resume:function(){var n={};return n.addon=new Za(t,e),n.service=new yc(t,e),n}(),restart:function(){var n={};return n.addon=new Ka(t,e),n.service=new mc(t,e),n}(),abort:function(){var n,r={};return r.addon=((n={}).backup=new Xa(t,e),n.restore=new tu(t,e),n),r.job=function(){var n={};return n.run=new lu(t,e),n.build=new bu(t,e),n}(),r.service=function(){var n={};return n.build=new kc(t,e),n}(),r}(),start:function(){var n,r={};return r.job=((n={}).run=new uu(t,e),n.build=new vu(t,e),n),r.service=function(){var n={};return n.build=new Cc(t,e),n}(),r}(),add:function(){var n,r={};return r.registryCredentials=new Pu(t,e),r.domain=((n={}).subdomain=new zu(t,e),n),r}(),verify:function(){var n={};return n.domain=new Mu(t,e),n.subdomain=new $u(t,e),n}(),assign:function(){var n,r={};return r.subdomain=((n={}).service=new Ju(t,e),n),r}(),unassign:function(){var n={};return n.subdomain=new Hu(t,e),n}(),attach:function(){var n={};return n.volume=new Gc(t,e),n}(),detach:function(){var n={};return n.volume=new Mc(t,e),n}()},this.list=function(){var t={};return t.projects=r.endpoints.list.projects.call,t.addons=r.endpoints.list.addons.call,t.jobs=r.endpoints.list.jobs.call,t.registryCredentials=r.endpoints.list.registryCredentials.call,t.domains=r.endpoints.list.domains.call,t.plans=r.endpoints.list.plans.call,t.regions=r.endpoints.list.regions.call,t.vcs=r.endpoints.list.vcs.call,t.secrets=r.endpoints.list.secrets.call,t.services=r.endpoints.list.services.call,t.repos=r.endpoints.list.repos.call,t.branches=r.endpoints.list.branches.call,t.volumes=r.endpoints.list.volumes.call,t}(),this.create=function(){var t,e={};return e.project=r.endpoints.create.project.call,e.addon=r.endpoints.create.addon.call,e.job=((t={}).manual=r.endpoints.create.job.manual.call,t.cron=r.endpoints.create.job.cron.call,t),e.domain=r.endpoints.create.domain.call,e.secret=r.endpoints.create.secret.call,e.service=function(){var t={};return t.combined=r.endpoints.create.service.combined.call,t.deployment=r.endpoints.create.service.deployment.call,t.build=r.endpoints.create.service.build.call,t}(),e.volume=r.endpoints.create.volume.call,e}(),this.get=function(){var t,e,n={};return n.project=r.endpoints.get.project.call,n.addon=((e=r.endpoints.get.addon.call).credentials=r.endpoints.get.addon.credentials.call,e.types=r.endpoints.get.addon.types.call,e.version=r.endpoints.get.addon.version.call,e.backups=r.endpoints.get.addon.backups.call,e.backup=((t=r.endpoints.get.addon.backup.call).download=r.endpoints.get.addon.backup.download.call,t),e.containers=r.endpoints.get.addon.containers.call,e),n.job=function(){var t=r.endpoints.get.job.call;return t.runs=r.endpoints.get.job.runs.call,t.run=r.endpoints.get.job.run.call,t.healthChecks=r.endpoints.get.job.healthChecks.call,t.builds=r.endpoints.get.job.builds.call,t.build=r.endpoints.get.job.build.call,t.buildArguments=r.endpoints.get.job.buildArguments.call,t.buildArgumentDetails=r.endpoints.get.job.buildArgumentDetails.call,t.runtimeEnvironment=r.endpoints.get.job.runtimeEnvironment.call,t.runtimeEnvironmentDetails=r.endpoints.get.job.runtimeEnvironmentDetails.call,t.deployment=r.endpoints.get.job.deployment.call,t.containers=r.endpoints.get.job.containers.call,t.branches=r.endpoints.get.job.branches.call,t.pullRequests=r.endpoints.get.job.pullRequests.call,t}(),n.registryCredentials=r.endpoints.get.registryCredentials.call,n.domain=r.endpoints.get.domain.call,n.subdomain=r.endpoints.get.subdomain.call,n.dnsId=r.endpoints.get.dnsId.call,n.secret=r.endpoints.get.secret.call,n.secretDetails=r.endpoints.get.secretDetails.call,n.secretLink=r.endpoints.get.secretLink.call,n.service=function(){var t=r.endpoints.get.service.call;return t.deployment=r.endpoints.get.service.deployment.call,t.ports=r.endpoints.get.service.ports.call,t.healthChecks=r.endpoints.get.service.healthChecks.call,t.builds=r.endpoints.get.service.builds.call,t.build=r.endpoints.get.service.build.call,t.containers=r.endpoints.get.service.containers.call,t.branches=r.endpoints.get.service.branches.call,t.pullRequests=r.endpoints.get.service.pullRequests.call,t.buildArguments=r.endpoints.get.service.buildArguments.call,t.buildArgumentDetails=r.endpoints.get.service.buildArgumentDetails.call,t.runtimeEnvironment=r.endpoints.get.service.runtimeEnvironment.call,t.runtimeEnvironmentDetails=r.endpoints.get.service.runtimeEnvironmentDetails.call,t}(),n.volume=r.endpoints.get.volume.call,n}(),this.delete=function(){var t={};return t.project=r.endpoints.delete.project.call,t.addon=r.endpoints.delete.addon.call,t.backup=r.endpoints.delete.backup.call,t.job=r.endpoints.delete.job.call,t.registryCredentials=r.endpoints.delete.registryCredentials.call,t.domain=r.endpoints.delete.domain.call,t.subdomain=r.endpoints.delete.subdomain.call,t.secret=r.endpoints.delete.secret.call,t.secretLink=r.endpoints.delete.secretLink.call,t.service=r.endpoints.delete.service.call,t.volume=r.endpoints.delete.volume.call,t}(),this.scale=function(){var t={};return t.addon=r.endpoints.scale.addon.call,t.job=r.endpoints.scale.job.call,t.service=r.endpoints.scale.service.call,t}(),this.update=function(){var t,e={};return e.addon=((t={}).version=r.endpoints.update.addon.version.call,t.networkSettings=r.endpoints.update.addon.networkSettings.call,t.security=r.endpoints.update.addon.security.call,t),e.job=function(){var t={};return t.settings=r.endpoints.update.job.settings.call,t.healthChecks=r.endpoints.update.job.healthChecks.call,t.buildOptions=r.endpoints.update.job.buildOptions.call,t.buildSource=r.endpoints.update.job.buildSource.call,t.cmdOverride=r.endpoints.update.job.cmdOverride.call,t.buildArguments=r.endpoints.update.job.buildArguments.call,t.runtimeEnvironment=r.endpoints.update.job.runtimeEnvironment.call,t.deployment=r.endpoints.update.job.deployment.call,t}(),e.registryCredentials=r.endpoints.update.registryCredentials.call,e.secret=r.endpoints.update.secret.call,e.secretLink=r.endpoints.update.secretLink.call,e.service=function(){var t={};return t.deployment=r.endpoints.update.service.deployment.call,t.ports=r.endpoints.update.service.ports.call,t.buildOptions=r.endpoints.update.service.buildOptions.call,t.buildSource=r.endpoints.update.service.buildSource.call,t.cmdOverride=r.endpoints.update.service.cmdOverride.call,t.healthChecks=r.endpoints.update.service.healthChecks.call,t.buildArguments=r.endpoints.update.service.buildArguments.call,t.runtimeEnvironment=r.endpoints.update.service.runtimeEnvironment.call,t}(),e.volume=r.endpoints.update.volume.call,e}(),this.backup=function(){var t={};return t.addon=r.endpoints.backup.addon.call,t}(),this.restore=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.restore.addon.backup.call,t),e}(),this.import=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.import.addon.backup.call,t),e}(),this.pause=function(){var t={};return t.addon=r.endpoints.pause.addon.call,t.service=r.endpoints.pause.service.call,t}(),this.resume=function(){var t={};return t.addon=r.endpoints.resume.addon.call,t.service=r.endpoints.resume.service.call,t}(),this.restart=function(){var t={};return t.addon=r.endpoints.restart.addon.call,t.service=r.endpoints.restart.service.call,t}(),this.abort=function(){var t,e={};return e.addon=((t={}).backup=r.endpoints.abort.addon.backup.call,t.restore=r.endpoints.abort.addon.restore.call,t),e.job=function(){var t={};return t.run=r.endpoints.abort.job.run.call,t.build=r.endpoints.abort.job.build.call,t}(),e.service=function(){var t={};return t.build=r.endpoints.abort.service.build.call,t}(),e}(),this.start=function(){var t,e={};return e.job=((t={}).run=r.endpoints.start.job.run.call,t.build=r.endpoints.start.job.build.call,t),e.service=function(){var t={};return t.build=r.endpoints.start.service.build.call,t}(),e}(),this.add=function(){var t,e={};return e.registryCredentials=r.endpoints.add.registryCredentials.call,e.domain=((t={}).subdomain=r.endpoints.add.domain.subdomain.call,t),e}(),this.verify=function(){var t={};return t.domain=r.endpoints.verify.domain.call,t.subdomain=r.endpoints.verify.subdomain.call,t}(),this.assign=function(){var t,e={};return e.subdomain=((t={}).service=r.endpoints.assign.subdomain.service.call,t),e}(),this.unassign=function(){var t={};return t.subdomain=r.endpoints.unassign.subdomain.call,t}(),this.attach=function(){var t={};return t.volume=r.endpoints.attach.volume.call,t}(),this.detach=function(){var t={};return t.volume=r.endpoints.detach.volume.call,t}()};exports.AbortAddonBackupEndpoint=Xa,exports.AbortAddonRestoreEndpoint=tu,exports.AbortJobBuildEndpoint=bu,exports.AbortJobRunEndpoint=lu,exports.AbortServiceBuildEndpoint=kc,exports.AddDomainSubdomainEndpoint=zu,exports.AddRegistrycredentialsEndpoint=Pu,exports.ApiClient=Kc,exports.ApiClientContextProvider=Vc,exports.ApiClientFileContextProvider=Yc,exports.ApiClientInMemoryContextProvider=Zc,exports.ApiEndpoint=ja,exports.AssignSubdomainServiceEndpoint=Ju,exports.AttachVolumeEndpoint=Gc,exports.BackupAddonEndpoint=qa,exports.CreateAddonEndpoint=Da,exports.CreateDomainEndpoint=Ru,exports.CreateJobCronEndpoint=iu,exports.CreateJobManualEndpoint=ou,exports.CreateProjectEndpoint=Oa,exports.CreateSecretEndpoint=Qu,exports.CreateServiceBuildEndpoint=lc,exports.CreateServiceCombinedEndpoint=uc,exports.CreateServiceDeploymentEndpoint=cc,exports.CreateVolumeEndpoint=Tc,exports.DeleteAddonEndpoint=Ba,exports.DeleteApiEndpoint=xa,exports.DeleteBackupEndpoint=$a,exports.DeleteDomainEndpoint=Gu,exports.DeleteJobEndpoint=ru,exports.DeleteProjectEndpoint=Ia,exports.DeleteRegistrycredentialsEndpoint=Nu,exports.DeleteSecretEndpoint=ec,exports.DeleteSecretlinkEndpoint=sc,exports.DeleteServiceEndpoint=pc,exports.DeleteSubdomainEndpoint=Wu,exports.DeleteVolumeEndpoint=Fc,exports.DetachVolumeEndpoint=Mc,exports.ExecCommandStandard=ya,exports.GetAddonBackupDownloadEndpoint=Qa,exports.GetAddonBackupEndpoint=Wa,exports.GetAddonBackupsEndpoint=za,exports.GetAddonContainersEndpoint=Va,exports.GetAddonCredentialsEndpoint=Na,exports.GetAddonEndpoint=Pa,exports.GetAddonTypesEndpoint=Ta,exports.GetAddonVersionEndpoint=Ra,exports.GetApiEndpoint=Ea,exports.GetDnsidEndpoint=Zu,exports.GetDomainEndpoint=Fu,exports.GetJobBranchesEndpoint=Iu,exports.GetJobBuildEndpoint=mu,exports.GetJobBuildargumentdetailsEndpoint=Eu,exports.GetJobBuildargumentsEndpoint=_u,exports.GetJobBuildsEndpoint=fu,exports.GetJobContainersEndpoint=ku,exports.GetJobDeploymentEndpoint=Cu,exports.GetJobEndpoint=nu,exports.GetJobHealthchecksEndpoint=pu,exports.GetJobPullrequestsEndpoint=Uu,exports.GetJobRunEndpoint=cu,exports.GetJobRunsEndpoint=au,exports.GetJobRuntimeenvironmentEndpoint=Su,exports.GetJobRuntimeenvironmentdetailsEndpoint=Au,exports.GetProjectEndpoint=ka,exports.GetRegistrycredentialsEndpoint=Bu,exports.GetSecretEndpoint=tc,exports.GetSecretdetailsEndpoint=rc,exports.GetSecretlinkEndpoint=ic,exports.GetServiceBranchesEndpoint=Uc,exports.GetServiceBuildEndpoint=Oc,exports.GetServiceBuildargumentdetailsEndpoint=Wc,exports.GetServiceBuildargumentsEndpoint=zc,exports.GetServiceBuildsEndpoint=Ac,exports.GetServiceContainersEndpoint=Ic,exports.GetServiceDeploymentEndpoint=fc,exports.GetServiceEndpoint=dc,exports.GetServiceHealthchecksEndpoint=Sc,exports.GetServicePortsEndpoint=gc,exports.GetServicePullrequestsEndpoint=Dc,exports.GetServiceRuntimeenvironmentEndpoint=$c,exports.GetServiceRuntimeenvironmentdetailsEndpoint=Hc,exports.GetSubdomainEndpoint=qu,exports.GetVolumeEndpoint=Lc,exports.ImportAddonBackupEndpoint=Ha,exports.ListAddonsEndpoint=Ua,exports.ListBranchesEndpoint=Bc,exports.ListDomainsEndpoint=Lu,exports.ListJobsEndpoint=eu,exports.ListPlansEndpoint=Vu,exports.ListProjectsEndpoint=Ca,exports.ListRegionsEndpoint=Yu,exports.ListRegistrycredentialsEndpoint=Du,exports.ListReposEndpoint=Pc,exports.ListSecretsEndpoint=Xu,exports.ListServicesEndpoint=ac,exports.ListVcsEndpoint=Ku,exports.ListVolumesEndpoint=Nc,exports.NorthflankExecCommand=ga,exports.NorthflankPortForwarder=ma,exports.PauseAddonEndpoint=Ya,exports.PauseServiceEndpoint=bc,exports.PostApiEndpoint=Sa,exports.RestartAddonEndpoint=Ka,exports.RestartServiceEndpoint=mc,exports.RestoreAddonBackupEndpoint=Ja,exports.ResumeAddonEndpoint=Za,exports.ResumeServiceEndpoint=yc,exports.ScaleAddonEndpoint=La,exports.ScaleJobEndpoint=su,exports.ScaleServiceEndpoint=hc,exports.StartJobBuildEndpoint=vu,exports.StartJobRunEndpoint=uu,exports.StartServiceBuildEndpoint=Cc,exports.UnassignSubdomainEndpoint=Hu,exports.UpdateAddonNetworksettingsEndpoint=Ga,exports.UpdateAddonSecurityEndpoint=Ma,exports.UpdateAddonVersionEndpoint=Fa,exports.UpdateJobBuildargumentsEndpoint=ju,exports.UpdateJobBuildoptionsEndpoint=yu,exports.UpdateJobBuildsourceEndpoint=gu,exports.UpdateJobCmdoverrideEndpoint=wu,exports.UpdateJobDeploymentEndpoint=Ou,exports.UpdateJobHealthchecksEndpoint=hu,exports.UpdateJobRuntimeenvironmentEndpoint=xu,exports.UpdateJobSettingsEndpoint=du,exports.UpdateRegistrycredentialsEndpoint=Tu,exports.UpdateSecretEndpoint=nc,exports.UpdateSecretlinkEndpoint=oc,exports.UpdateServiceBuildargumentsEndpoint=qc,exports.UpdateServiceBuildoptionsEndpoint=_c,exports.UpdateServiceBuildsourceEndpoint=jc,exports.UpdateServiceCmdoverrideEndpoint=Ec,exports.UpdateServiceDeploymentEndpoint=vc,exports.UpdateServiceHealthchecksEndpoint=xc,exports.UpdateServicePortsEndpoint=wc,exports.UpdateServiceRuntimeenvironmentEndpoint=Jc,exports.UpdateVolumeEndpoint=Rc,exports.VerifyDomainEndpoint=Mu,exports.VerifySubdomainEndpoint=$u;
|