14 lines
41 KiB
JavaScript
14 lines
41 KiB
JavaScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
var Pn=Object.create;var ye=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var Fn=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,On=Object.prototype.hasOwnProperty;var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ge=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Fn(t))!On.call(e,o)&&o!==r&&ye(e,o,{get:()=>t[o],enumerable:!(n=Ln(t,o))||n.enumerable});return e};var L=(e,t,r)=>(r=e!=null?Pn(_n(e)):{},Ge(t||!e||!e.__esModule?ye(r,"default",{value:e,enumerable:!0}):r,e)),$n=e=>Ge(ye({},"__esModule",{value:!0}),e);var ve=h((ki,Ye)=>{Ye.exports=function(t,r,n){t(r),n&&n(r===!0?null:r)}});var X=h((qi,Ke)=>{"use strict";var Ve=ve();Ke.exports=function(t,r){if(!t)return function(o,i){return o?Ve(i,o,r):i(!0)};Array.isArray(t)||(t=Object.keys(t).map(function(o){return t[o]}));var n=0;return function(o,i){if(o)return Ve(i,o,r);n>=t.length?i(!0):i(null,t[n++])}}});var Qe=h((Si,Ze)=>{"use strict";var Dn=X();Ze.exports=function(e){return Dn(Object.keys(e))}});var xe=h((bi,Xe)=>{"use strict";var Bn=ve();Xe.exports=function(t,r){return function(n,o){if(n)return Bn(o,n,r);if(t!=null){var i=t;t=null,o(null,i)}else o(!0)}}});var tt=h((Pi,et)=>{"use strict";et.exports=function(t){var r=0;return t=t||1/0,function(n,o){if(n)return o&&o(n);if(r>t)return o(!0);o(null,r++)}}});var nt=h((Li,rt)=>{"use strict";rt.exports=function(t){return t=t||Math.random,function(r,n){return r?n&&n(r):n(null,t())}}});var it=h((Fi,ot)=>{"use strict";ot.exports=function(){return function(t,r){r(!0)}}});var ut=h((_i,st)=>{"use strict";st.exports=function(t){return function(r,n){n(t)}}});var lt=h((Oi,ct)=>{"use strict";ct.exports={keys:Qe(),once:xe(),values:X(),count:tt(),infinite:nt(),empty:it(),error:ut()}});var I=h(($i,ft)=>{"use strict";ft.exports=function(t,r){var n,o,i;r||(i=new Error("no done callback supplied"));function u(c){if(n=c,o)return u.abort();(function s(){for(var f=!0,l=!1;f;)if(l=!1,n(null,function(a,p){if(l=!0,a=a||o){if(f=!1,r)r(a===!0?null:a);else if(a&&a!==!0)throw console.warn(i),a}else t&&t(p)===!1||o?(f=!1,n(o||!0,r||function(){})):f||s()}),!l){f=!1;return}})()}return u.abort=function(c,s){if(typeof c=="function"&&(s=c,c=!0),o=c||!0,n)return n(o,s||function(){})},u}});var pt=h((Di,at)=>{"use strict";var Tn=I();at.exports=function(t){return Tn(null,t)}});var ht=h((Bi,dt)=>{"use strict";var Rn=I();dt.exports=function(t){return Rn(function(r){console.log(r)},t)}});var N=h((Ti,mt)=>{mt.exports=function(t){return t&&(typeof t=="string"?function(r){return r[t]}:typeof t=="object"&&typeof t.exec=="function"?function(r){var n=t.exec(r);return n&&n[0]}:t)}});var vt=h((Ri,yt)=>{"use strict";function gt(e){return e}var An=N(),In=I();yt.exports=function(t,r){var n=!1;return r?t=An(t)||gt:(r=t,t=gt),In(function(o){if(t(o))return n=!0,r(null,o),!1},function(o){n||r(o===!0?null:o,null)})}});var ee=h((Ai,xt)=>{"use strict";var Nn=I();xt.exports=function(t,r,n){n||(n=r,r=null);var o=Nn(function(i){r=t(r,i)},function(i){n(i,r)});return arguments.length===2?function(i){i(null,function(u,c){if(u)return n(u===!0?null:u);r=c,o(i)})}:o}});var we=h((Ii,wt)=>{"use strict";var Mn=ee();wt.exports=function(t){return Mn(function(r,n){return r.push(n),r},[],t)}});var Et=h((Ni,Ct)=>{"use strict";var Hn=we();Ct.exports=function(){return t=>{let r,n,o=new Promise((i,u)=>{r=i,n=u});return Hn((i,u)=>{i?n(i):r(u)})(t),o}}});var qt=h((Mi,kt)=>{"use strict";var jn=ee();kt.exports=function(t){return jn(function(r,n){return r+n},"",t)}});var bt=h((Hi,St)=>{"use strict";St.exports={drain:I(),onEnd:pt(),log:ht(),find:vt(),reduce:ee(),collect:we(),collectAsPromise:Et(),concat:qt()}});var Lt=h((ji,Pt)=>{"use strict";function Un(e){return e}var Jn=N();Pt.exports=function(t){return t?(t=Jn(t),function(r){return function(n,o){r(n,function(i,u){try{u=i?null:t(u)}catch(c){return r(c,function(){return o(c)})}o(i,u)})}}):Un}});var _t=h((Ui,Ft)=>{"use strict";function Wn(e){return e}var zn=N();Ft.exports=function(t){if(!t)return Wn;t=zn(t);var r=!1,n,o;return function(i){return function u(c,s){if(o)return s(o);c?(o=c,r?i(c,function(f){r?n=s:s(c)}):i(c,function(f){s(c)})):i(null,function(f,l){f?s(f):o?s(o):(r=!0,t(l,function(a,p){r=!1,o?(s(o),n&&n(o)):a?u(a,s):s(null,p)}))})}}}});var Ce=h((Ji,Ot)=>{var Gn=N();function Yn(e){return e}Ot.exports=function(t){return typeof t=="object"&&typeof t.test=="function"?function(r){return t.test(r)}:Gn(t)||Yn}});var te=h((Wi,$t)=>{"use strict";var Vn=Ce();$t.exports=function(t){return t=Vn(t),function(r){return function n(o,i){for(var u,c=!0;c;)c=!1,u=!0,r(o,function(s,f){if(!s&&!t(f))return u?c=!0:n(s,i);i(s,f)}),u=!1}}}});var Bt=h((zi,Dt)=>{"use strict";var Kn=Ce(),Zn=te();Dt.exports=function(t){return t=Kn(t),Zn(function(r){return!t(r)})}});var Rt=h((Gi,Tt)=>{"use strict";Tt.exports=function(t,r){var n=!1;function o(i){n||!r||(n=!0,r(i===!0?null:i))}return function(i){return function(u,c){return u&&o(u),i(u,function(s,f){s?o(s):t&&t(f),c(s,f)})}}}});var It=h((Yi,At)=>{"use strict";At.exports=function(t,r){r=r||{};var n=r.last||!1,o=!1;if(typeof t=="number"){n=!0;var i=t;t=function(){return--i}}return function(u){function c(s){u(!0,function(f){n=!1,s(f||!0)})}return function(s,f){o&&!s?n?c(f):f(o):(o=s)?u(o,f):u(null,function(l,a){(o=o||l)?f(o):t(a)?f(null,a):(o=!0,n?f(null,a):c(f))})}}}});var Ee=h((Vi,Nt)=>{"use strict";function Qn(e){return e}var Xn=N(),eo=te();Nt.exports=function(t,r){t=Xn(t)||Qn;var n={};return eo(function(o){var i=t(o);return n[i]?!!r:(n[i]=!0,!r)})}});var Ht=h((Ki,Mt)=>{"use strict";var to=Ee();Mt.exports=function(t){return to(t,!0)}});var Ut=h((Zi,jt)=>{"use strict";var ro=X(),no=xe();jt.exports=function(){return function(t){var r;return function(n,o){n?r?r(n,function(c){t(c||n,o)}):t(n,o):r?i():u();function i(){r(null,function(c,s){c?c===!0?u():t(!0,function(f){o(c)}):o(null,s)})}function u(){r=null,t(null,function(c,s){if(c)return o(c);s&&typeof s=="object"?s=ro(s):typeof s!="function"&&(s=no(s)),r=s,i()})}}}}});var Wt=h((Qi,Jt)=>{"use strict";Jt.exports={map:Lt(),asyncMap:_t(),filter:te(),filterNot:Bt(),through:Rt(),take:It(),unique:Ee(),nonUnique:Ht(),flatten:Ut()}});var ke=h((Xi,zt)=>{"use strict";zt.exports=function e(t){var r=arguments.length;if(typeof t=="function"&&t.length===1){for(var n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return function(c){if(n==null)throw new TypeError("partial sink should only be called once!");var s=n;switch(n=null,r){case 1:return e(c,s[0]);case 2:return e(c,s[0],s[1]);case 3:return e(c,s[0],s[1],s[2]);case 4:return e(c,s[0],s[1],s[2],s[3]);default:return s.unshift(c),e.apply(null,s)}}}var i=t;i&&typeof i.source=="function"&&(i=i.source);for(var o=1;o<r;o++){var u=arguments[o];typeof u=="function"?i=u(i):u&&typeof u=="object"&&(u.sink(i),i=u.source)}return i}});var G=h(($,Kt)=>{"use strict";var Gt=lt(),Yt=bt(),Vt=Wt();$=Kt.exports=ke();$.pull=$;for(S in Gt)$[S]=Gt[S];var S;for(S in Vt)$[S]=Vt[S];var S;for(S in Yt)$[S]=Yt[S];var S});var qe=h((Cs,Xt)=>{var ws=Xt.exports=function(e){(function t(){var r=!0,n=!1,o=!1;do o=!0,r=!1,e.call(this,function(){o?r=!0:t()}),o=!1;while(r)})()}});var Se=h((O,rr)=>{var Es=ke(),oo=qe();function er(e){e.destroy?e.destroy():console.error("warning, stream-to-pull-stream: \nthe wrapped node-stream does not implement `destroy`, \nthis may cause resource leaks.")}function tr(e,t,r){var n,o=!1,i;function u(){i||(i=!0,r&&r(n===!0?null:n))}function c(){o||(o=!0,f(),n?u():e(n=!0,u))}function s(l){f(),n||e(n=l,u)}function f(){t.on("finish",c),t.removeListener("close",c),t.removeListener("error",s)}t.on("close",c),t.on("finish",c),t.on("error",s),process.nextTick(function(){oo(function(l){e(null,function(a,p){if(n=n||a,a===!0)return t._isStdio?u():t.end();if(n=n||a)return er(t),u(n);if(t._isStdio)t.write(p,function(){l()});else{var d=t.write(p);d===!1?t.once("drain",l):l()}})})})}function io(e){var t=!1,r=!1,n;function o(){var i=e.read();if(i!==null&&n){var u=n;n=null,u(null,i)}}return e.on("readable",function(){r=!0,n&&o()}).on("end",function(){t=!0,n&&n(t)}).on("error",function(i){t=i,n&&n(t)}),function(i,u){n=u,t?u(t):r&&o()}}function re(e){var t=[],r=[],n,o=!1,i;function u(){for(;(t.length||n)&&r.length;)r.shift()(t.length?null:n,t.shift());!t.length&&o&&(o=!1,e.resume())}return e.on("data",function(c){t.push(c),u(),t.length&&e.pause&&(o=!0,e.pause())}),e.on("end",function(){n=!0,u()}),e.on("close",function(){n=!0,u()}),e.on("error",function(c){n=c,u()}),function(c,s){if(!s)throw new Error("*must* provide cb");if(c){let l=function(){for(;r.length;)r.shift()(c);s(c)};var f=l;if(n)return l();e.once("close",l),er(e)}else r.push(s),u()}}var so=re,ne=function(e,t){return function(r){return tr(r,e,t)}},oe=function(e){return re(e)};O=rr.exports=function(e,t){return e.writable&&e.write?e.readable?function(r){return tr(r,e,t),re(e)}:ne(e,t):oe(e)};O.sink=ne;O.source=oe;O.read=so;O.read1=re;O.read2=io;O.duplex=function(e,t){return{source:oe(e),sink:ne(e,t)}};O.transform=function(e){return function(t){var r=oe(e);return ne(e)(t),r}}});var ar=h((_s,fr)=>{var ao=qe();fr.exports=function(e,t){return function(r){var n=[],o,i;function u(f){n.push(f)}e=e||function(f){this.queue(f)},t=t||function(){this.queue(null)};var c={emit:function(f,l){f=="data"&&u(l),f=="end"&&(o=!0,u(null)),f=="error"&&(i=l)},queue:u},s;return function(f,l){if(o=o||f,f)return r(f,function(){if(s){var a=s;s=null,a(f)}l(f)});s=l,ao(function a(p){if(s)if(l=s,i)s=null,l(i);else if(n.length){var d=n.shift();s=null,l(d===null,d)}else r(o,function(m,g){if(m&&m!==!0)return i=m,p();if(o=o||m)t.call(c);else if(g!==null&&(e.call(c,g),i||o))return r(i||o,function(){s=null,l(i||o)});p(a)})})}}}});var dr=h((Os,pr)=>{pr.exports=function(){var e=[],t=0;function r(){return e.reduce(function(n,o){return n+o.length},0)}return{length:t,data:this,add:function(n){if(!Buffer.isBuffer(n))throw new Error("data must be a buffer, was: "+JSON.stringify(n));return this.length=t=t+n.length,e.push(n),this},has:function(n){return n==null?t>0:t>=n},get:function(n){var o;if(n==null||n===t){t=0;var i=e;return e=[],i.length==1?i[0]:Buffer.concat(i)}else if(e.length>1&&n<=(o=e[0].length)){var u=e[0].slice(0,n);return n===o?e.shift():e[0]=e[0].slice(n,o),t-=n,u}else if(n<t){for(var c=[],s=0;s+e[0].length<n;){var f=e.shift();s+=f.length,c.push(f)}return s<n&&(c.push(e[0].slice(0,n-s)),e[0]=e[0].slice(n-s,e[0].length),this.length=t=t-n),Buffer.concat(c)}else throw new Error("could not get "+n+" bytes")}}}});var yr=h(($s,gr)=>{"use strict";var po=dr();function ho(e){return Number.isFinite(e)}function hr(e){return typeof e=="function"}function mr(e,t){return t?function(r,n){var o=setTimeout(function(){e(new Error("pull-reader: read exceeded timeout"),n)},t);e(r,function(i,u){clearTimeout(o),n(i,u)})}:e}gr.exports=function(e){var t=[],r,n,o=!1,i=po(),u,c,s;function f(){for(;t.length;)if(t[0].length==null&&i.has(1))t.shift().cb(null,i.get());else if(i.has(t[0].length)){var p=t.shift();p.cb(null,i.get(p.length))}else if(u==!0&&t[0].length&&i.length<t[0].length){var d="stream ended with:"+i.length+" but wanted:"+t[0].length;t.shift().cb(new Error(d))}else if(u)t.shift().cb(u);else return!!t.length;return t.length||!i.has(1)||s}function l(){var p=f();p&&!o&&r&&!o&&!c&&(o=!0,n(null,function(d,m){if(o=!1,d)return u=d,f();i.add(m),l()}))}function a(p){if(s){for(;t.length;)t.shift().cb(s);return cb&&cb(s)}n=mr(p,e),r=p,l()}return a.abort=function(p,d){s=p||!0,r?(o=!0,r(s,function(){for(;t.length;)t.shift().cb(s);d&&d(s)})):d()},a.read=function(p,d,m){if(hr(d)&&(m=d,d=e),hr(m))t.push({length:ho(p)?p:null,cb:m}),l();else return c=!0,function(g,y){if(o||i.has(1)){if(g)return r(g,y);t.push({length:null,cb:y}),l()}else mr(r,d)(g,function(C,_){y(C,_)})}},a}});var xr=h((Ds,vr)=>{var M=1e3,H=M*60,j=H*60,D=j*24,mo=D*7,go=D*365.25;vr.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return yo(e);if(r==="number"&&isFinite(e))return t.long?xo(e):vo(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function yo(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*go;case"weeks":case"week":case"w":return r*mo;case"days":case"day":case"d":return r*D;case"hours":case"hour":case"hrs":case"hr":case"h":return r*j;case"minutes":case"minute":case"mins":case"min":case"m":return r*H;case"seconds":case"second":case"secs":case"sec":case"s":return r*M;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function vo(e){var t=Math.abs(e);return t>=D?Math.round(e/D)+"d":t>=j?Math.round(e/j)+"h":t>=H?Math.round(e/H)+"m":t>=M?Math.round(e/M)+"s":e+"ms"}function xo(e){var t=Math.abs(e);return t>=D?ue(e,t,D,"day"):t>=j?ue(e,t,j,"hour"):t>=H?ue(e,t,H,"minute"):t>=M?ue(e,t,M,"second"):e+" ms"}function ue(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}});var Fe=h((Bs,wr)=>{function wo(e){r.debug=r,r.default=r,r.coerce=s,r.disable=i,r.enable=o,r.enabled=u,r.humanize=xr(),r.destroy=f,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let a=0;for(let p=0;p<l.length;p++)a=(a<<5)-a+l.charCodeAt(p),a|=0;return r.colors[Math.abs(a)%r.colors.length]}r.selectColor=t;function r(l){let a,p=null,d,m;function g(...y){if(!g.enabled)return;let C=g,_=Number(new Date),qn=_-(a||_);C.diff=qn,C.prev=a,C.curr=_,a=_,y[0]=r.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");let Q=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,(ge,Sn)=>{if(ge==="%%")return"%";Q++;let ze=r.formatters[Sn];if(typeof ze=="function"){let bn=y[Q];ge=ze.call(C,bn),y.splice(Q,1),Q--}return ge}),r.formatArgs.call(C,y),(C.log||r.log).apply(C,y)}return g.namespace=l,g.useColors=r.useColors(),g.color=r.selectColor(l),g.extend=n,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(d!==r.namespaces&&(d=r.namespaces,m=r.enabled(l)),m),set:y=>{p=y}}),typeof r.init=="function"&&r.init(g),g}function n(l,a){let p=r(this.namespace+(typeof a>"u"?":":a)+l);return p.log=this.log,p}function o(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let a,p=(typeof l=="string"?l:"").split(/[\s,]+/),d=p.length;for(a=0;a<d;a++)p[a]&&(l=p[a].replace(/\*/g,".*?"),l[0]==="-"?r.skips.push(new RegExp("^"+l.slice(1)+"$")):r.names.push(new RegExp("^"+l+"$")))}function i(){let l=[...r.names.map(c),...r.skips.map(c).map(a=>"-"+a)].join(",");return r.enable(""),l}function u(l){if(l[l.length-1]==="*")return!0;let a,p;for(a=0,p=r.skips.length;a<p;a++)if(r.skips[a].test(l))return!1;for(a=0,p=r.names.length;a<p;a++)if(r.names[a].test(l))return!0;return!1}function c(l){return l.toString().substring(2,l.toString().length-2).replace(/\.\*\?$/,"*")}function s(l){return l instanceof Error?l.stack||l.message:l}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}wr.exports=wo});var Cr=h((E,ce)=>{E.formatArgs=Eo;E.save=ko;E.load=qo;E.useColors=Co;E.storage=So();E.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();E.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Co(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Eo(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+ce.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,o=>{o!=="%%"&&(r++,o==="%c"&&(n=r))}),e.splice(n,0,t)}E.log=console.debug||console.log||(()=>{});function ko(e){try{e?E.storage.setItem("debug",e):E.storage.removeItem("debug")}catch{}}function qo(){let e;try{e=E.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}function So(){try{return localStorage}catch{}}ce.exports=Fe()(E);var{formatters:bo}=ce.exports;bo.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var kr=h((Ts,Er)=>{"use strict";Er.exports=(e,t)=>{t=t||process.argv;let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1?!0:n<o)}});var Sr=h((Rs,qr)=>{"use strict";var Po=require("os"),b=kr(),w=process.env,U;b("no-color")||b("no-colors")||b("color=false")?U=!1:(b("color")||b("colors")||b("color=true")||b("color=always"))&&(U=!0);"FORCE_COLOR"in w&&(U=w.FORCE_COLOR.length===0||parseInt(w.FORCE_COLOR,10)!==0);function Lo(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Fo(e){if(U===!1)return 0;if(b("color=16m")||b("color=full")||b("color=truecolor"))return 3;if(b("color=256"))return 2;if(e&&!e.isTTY&&U!==!0)return 0;let t=U?1:0;if(process.platform==="win32"){let r=Po.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in w)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(r=>r in w)||w.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in w)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(w.TEAMCITY_VERSION)?1:0;if(w.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in w){let r=parseInt((w.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(w.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(w.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(w.TERM)||"COLORTERM"in w?1:(w.TERM==="dumb",t)}function _e(e){let t=Fo(e);return Lo(t)}qr.exports={supportsColor:_e,stdout:_e(process.stdout),stderr:_e(process.stderr)}});var Pr=h((x,fe)=>{var _o=require("tty"),le=require("util");x.init=Ao;x.log=Bo;x.formatArgs=$o;x.save=To;x.load=Ro;x.useColors=Oo;x.destroy=le.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");x.colors=[6,2,3,4,5,1];try{let e=Sr();e&&(e.stderr||e).level>=2&&(x.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}x.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(o,i)=>i.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function Oo(){return"colors"in x.inspectOpts?!!x.inspectOpts.colors:_o.isatty(process.stderr.fd)}function $o(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,o="\x1B[3"+(n<8?n:"8;5;"+n),i=` ${o};1m${t} \x1B[0m`;e[0]=i+e[0].split(`
|
|
`).join(`
|
|
`+i),e.push(o+"m+"+fe.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=Do()+t+" "+e[0]}function Do(){return x.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Bo(...e){return process.stderr.write(le.format(...e)+`
|
|
`)}function To(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function Ro(){return process.env.DEBUG}function Ao(e){e.inspectOpts={};let t=Object.keys(x.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=x.inspectOpts[t[r]]}fe.exports=Fe()(x);var{formatters:br}=fe.exports;br.o=function(e){return this.inspectOpts.colors=this.useColors,le.inspect(e,this.inspectOpts).split(`
|
|
`).map(t=>t.trim()).join(" ")};br.O=function(e){return this.inspectOpts.colors=this.useColors,le.inspect(e,this.inspectOpts)}});var $e=h((As,Oe)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Oe.exports=Cr():Oe.exports=Pr()});var Nr=h((B,Ir)=>{var Io=ar(),No=yr(),Lr=$e(),Fr=0,_r=1,Or=2,$r="GOODBYE";function Dr(e){let t=Buffer.alloc(9),r=0,n=e.value!==void 0?e.value:e.end;return typeof e=="string"&&e===$r?(t.fill(0),[t,null]):(typeof n=="string"?(r=_r,n=Buffer.from(n,"utf-8")):Buffer.isBuffer(n)?r=Fr:(r=Or,n=Buffer.from(JSON.stringify(n),"utf-8")),r=e.stream<<3|e.end<<2|r,t[0]=r,t.writeUInt32BE(n.length,1),t.writeInt32BE(e.req||0,5),[t,n])}function Br(e){if(e.length!==9)throw new Error("expected header to be 9 bytes long");let t=e[0],r=e.readUInt32BE(1);return{req:e.readInt32BE(5),stream:!!(t&8),end:!!(t&4),value:null,length:r,type:t&3}}function Tr(e,t){if(e.length!==t.length)throw new Error("incorrect length, expected:"+t.length+" found:"+e.length);if(t.type===Fr)t.value=e;else if(t.type===_r)t.value=e.toString();else if(t.type===Or)t.value=JSON.parse(e.toString());else throw new Error("unknown message type");return t}function Rr(e){return Io(function(r){e&&e("encoded: %o",r);let[n,o]=Dr(r);this.queue(n),o!==null&&this.queue(o)})}function Ar(e){let t=No(),r=!1;return function(o){return t(o),function(u,c){if(r)return c(!0);if(u)return t.abort(u,c);t.read(9,function(f,l){if(f)return c(f);let a=Br(l);if(a.length===0)return r=!0,c(null,$r);t.read(a.length,function(d,m){if(d)return c(d);try{Tr(m,a)}catch(g){return c(g)}e&&e("decoded: %o",a),c(null,a)})})}}}B=Ir.exports=function(t,r){let n=r===!0?Lr("packet-stream-codec"):typeof r=="string"?Lr(r):null;return{source:Rr(n)(t.source),sink(o){return t.sink(Ar(n)(o))}}};B.encodePair=Dr;B.decodeHead=Br;B.decodeBody=Tr;B.encode=Rr;B.decode=Ar});var De=h((Is,Mr)=>{function Mo(e){return e&&(e===!0?!0:{message:e.message,name:e.name,stack:e.stack})}function Ho(e){console.error("packet-stream asked to read after closed",e)}Mr.exports={flat:Mo,closedread:Ho}});var Ur=h((Ns,jr)=>{var{flat:Hr,closedread:jo}=De();function ae(e,t,r){this.id=e,this.read=null,this.writeEnd=null,this.readEnd=null,this._ps=t,this._remove=r}ae.prototype.write=function(e,t){let r=this._ps;t?(this.writeEnd=t,r&&(r.read({req:this.id,stream:!0,end:!0,value:Hr(t)}),this.readEnd&&this.destroy(t),r._maybedone(t))):r&&r.read({req:this.id,stream:!0,end:!1,value:e})};ae.prototype.end=function(e){this.write(null,Hr(e||!0))};ae.prototype.destroy=function(e){if(this.writeEnd){if(!this.readEnd){this.readEnd=!0;try{this.read&&this.read(null,e)}catch(t){console.error("Exception thrown by PacketStream substream end handler",t),console.error(t.stack)}}}else{if(this.writeEnd=!0,!this.readEnd){this.readEnd=!0;try{this.read(null,e)}catch(t){console.error("Exception thrown by PacketStream substream end handler",t),console.error(t.stack)}}this.write(null,e)}this._ps&&(this._remove(),this._remove=null,this.read=jo,this._ps=null)};jr.exports=ae});var zr=h((Ms,Wr)=>{var Jr=Ur(),{flat:Be,closedread:Uo}=De();function q(e){this.ended=!1,this.opts=e,this._req_counter=1,this._requests=new Map,this._instreams=new Map,this._outstreams=new Map,this._closecbs=[],this._closing=!1,this._closed=!1,e.close&&this._closecbs.push(e.close)}q.prototype.message=function(e){this.read({req:0,stream:!1,end:!1,value:e})};q.prototype.request=function(e,t){if(this._closing)return t(new Error("parent stream is closing"));let r=this._req_counter++;this._requests.set(r,(n,o)=>{this._requests.delete(r),t(n,o),this._maybedone(n)}),this.read({req:r,stream:!1,end:!1,value:e})};q.prototype.stream=function(){if(this._closing)throw new Error("parent stream is closing");let e=this._req_counter++,t=new Jr(e,this,()=>{this._outstreams.delete(e)});return this._outstreams.set(e,t),t};q.prototype.close=function(e){if(!e)throw new Error("packet-stream.close *must* have callback");if(this._closed)return e();this._closecbs.push(e),this._closing=!0,this._maybedone()};q.prototype.destroy=function(e){e=e||Be(e),this.ended=e,this._closing=!0;let t=e===!0?new Error("unexpected end of parent stream"):e,r=0;this._requests.forEach(n=>{r++,n(t)}),this._instreams.forEach(n=>{r++,n.writeEnd=!0,n.destroy(t)}),this._outstreams.forEach(n=>{r++,n.writeEnd=!0,n.destroy(t)}),r===0&&e===!0&&(t=null),this._maybedone(t)};q.prototype._maybedone=function(e){this._closed||!this._closing||this._requests.size!==0||this._instreams.size!==0||this._outstreams.size!==0||(this.read(null,e||!0),this._closed=!0,this._closecbs.forEach(t=>{t(e)}),this.opts=null,this._closecbs.length=0,this.read=Uo,this._requests.clear(),this._instreams.clear(),this._outstreams.clear())};q.prototype.read=function(e){console.error("please overwrite read method to do IO",e)};q.prototype.write=function(e,t){this.ended||(t?this.destroy(t):e.req&&!e.stream?this._onrequest(e):e.req&&e.stream?this._onstream(e):this._onmessage(e))};q.prototype._onmessage=function(e){this.opts&&typeof this.opts.message=="function"&&this.opts.message(e.value)};q.prototype._onrequest=function(e){let t=e.req*-1;if(e.req<0)this._requests.has(t)&&this._requests.get(t)(e.end?e.value:null,e.end?null:e.value);else if(this.opts&&typeof this.opts.request=="function"){let r=!1;this.opts.request(e.value,(n,o)=>{if(r)throw new Error("cb called twice from local api");r=!0,n?this.read({value:Be(n),end:!0,req:t}):this.read({value:o,end:!1,req:t}),this._maybedone()})}else{if(this.ended){let r=this.ended===!0?new Error("unexpected end of parent stream"):this.ended;this.read({value:Be(r),end:!0,stream:!1,req:t})}else this.read({value:{message:"Unable to handle requests",name:"NO_REQUEST_HANDLER",stack:null},end:!0,stream:!1,req:t});this._maybedone()}};q.prototype._onstream=function(e){if(e.req<0){let t=e.req*-1,r=this._outstreams.get(t);if(!r)return console.error("no stream for incoming msg",e);e.end?(r.writeEnd&&this._outstreams.delete(t),r.readEnd=!0,r.read(null,e.value),this._maybedone()):r.read(e.value)}else{let t=e.req,r=this._instreams.get(t);r||(r=new Jr(t*-1,this,()=>{this._instreams.delete(t)}),this._instreams.set(t,r),this.opts&&typeof this.opts.stream=="function"&&this.opts.stream(r)),e.end?(r.writeEnd&&this._instreams.delete(t),r.readEnd=!0,r.read&&r.read(null,e.value),this._maybedone()):r.read?r.read(e.value):console.error("no .read for stream:",r.id,"dropped:",e)}};Wr.exports=e=>new q(e)});var Yr=h((Hs,V)=>{"use strict";var Jo=G();function Wo(e){let t=!1;return(r,n)=>{t||(t=!0,e(r,n))}}function Te(e,t){let r=[],n=!1,o=!1,i,u,c=Wo((s,f)=>{t&&t(s,f),e=null,t=null,i=null,u&&u(s||!0,()=>{})});return e.read=function(s,f){if(n=n||f,i){let l=i;i=null,l(n,s)}else!n&&!o&&r.push(s);n&&c(n!==!0?n:null)},{source(s,f){s?(e&&e.write(null,s),f(s),r.length=0,o=!0,c(s!==!0?s:null)):r.length?f(null,r.shift()):n?f(n):i=f},sink(s){if(n)return u=null,s(n,()=>{});u=s,Jo.drain(f=>{if(n)return!1;e.write(f)},f=>{e&&!e.writeEnd&&e.write(null,f||!0),c&&c(f)})(s)}}}function Gr(e,t){return Te(e,r=>{e.writeEnd||e.write(null,r||!0),t&&t(r)})}function zo(e){return Gr(e).source}function Go(e,t){return Gr(e,t).sink}V.exports=Te;V.exports.source=zo;V.exports.sink=Go;V.exports.duplex=Te});var Kr=h((js,Vr)=>{Vr.exports=function(t){var r,n,o;function i(u){return function(c,s){u(c,function(f,l){if(f&&!o)return o=!0,s(null,t);f&&r?s(f):f?n=s:s(null,l)})}}return i.end=function(){return r=!0,n&&n(r),i},i}});var Qr=h((Us,Zr)=>{var Yo=Kr(),Re=G();Zr.exports=function(e,t){t=t||"GOODBYE";var r=Yo(t);return{source:Re(e.source,r),sink:Re(Re.filter(function(n){if(n!==t)return!0;r.end()}),e.sink)}}});var K=h(P=>{"use strict";var pe=G();function Vo(e){return e?Object.keys(e).length===0:!0}P.set=function(t,r,n){let o,i;for(let u=0;u<r.length;u++){let c=r[u];t[c]=t[c]||{},o=t,i=c,t=t[c]}o[i]=n};P.get=function(t,r){if(typeof r=="string")return t[r];let n;for(let o=0;o<r.length;o++){let i=r[o];if(n=t=t[i],t==null)return t}return n};P.prefix=function(t,r){let n;for(let o=0;o<r.length;o++){let i=r[o];if(n=t=t[i],typeof t!="object")return t}return typeof n!="object"?!!n:!1};function Ko(e,t){for(let r in t){let n=t[r];e[n]||(e[n]={}),e=e[n]}return e}function Zo(e,t){(function r(n,o){let i=t[o];if(n)t.length-1===o?delete n[i]:o<t.length&&r(n[i],o+1);else return;Vo(n[i])&&delete n[i]})(e,0)}function Qo(e,t){for(let r in t)e[r]=t[r];return e}P.mount=function(t,r,n){if(!Array.isArray(r))throw new Error("path must be array of strings");return Qo(Ko(t,r),n)};P.unmount=function(t,r){return Zo(t,r)};var de=e=>e==="source",he=e=>e==="sink",Ae=e=>e==="duplex",Xo=e=>e==="sync",ei=e=>e==="async",Xr=e=>Xo(e)||ei(e),ti=e=>de(e)||he(e)||Ae(e);P.isRequest=Xr;P.isStream=ti;function Ie(e){return function(t){t(e||!0,()=>{})}}function en(e){return{source:pe.error(e),sink:Ie(e)}}P.errorAsStream=function(t,r){return de(t)?pe.error(r):he(t)?Ie(r):en(r)};P.errorAsStreamOrCb=function(t,r,n){return Xr(t)?n(r):Ae(t)?en(r):de(t)?pe.error(r):he(t)?Ie(r):n(r)};P.pipeToStream=function(t,r,n){de(t)?r(n):he(t)?n(r):Ae(t)&&pe(r,n,r)}});var Ne=h((Ws,tn)=>{"use strict";function ri(e){return typeof e=="string"?[`Error: ${e}`]:e.stack?e.stack.split(`
|
|
`):[`${e.name}: ${e.message}`]}tn.exports=function(t,r){let n=new Error(r),o=n.stack.split(`
|
|
`);o.splice(1,1);let i=ri(t);i[0]=" "+i[0];for(let u=1;u<o.length;u++)if(i.includes(o[u])){o.splice(u);break}return n.stack=o.concat(i).join(`
|
|
`),n}});var sn=h((zs,on)=>{"use strict";var ni=zr(),Me=Yr(),oi=Qr(),J=K(),rn=Ne(),nn=$e()("muxrpc:psc");on.exports=function(t,r,n){let o=ni({message(){},request(u,c){if(!Array.isArray(u.args))return c(new Error(`invalid request, args should be array, was: ${JSON.stringify(u)}`));let s=u.name,f=u.args,l=!1,a=!1;f.push((p,d)=>{a=!0,l=!0,c(p,d)});try{t("async",s,f)}catch(p){if(l||a)throw rn(p,"no callback provided to muxrpc async funtion");c(p)}},stream(u){u.read=function(s,f){if(f)return u.write(null,f);let{name:l,type:a,args:p}=s,d,m;if(u.read=null,!J.isStream(a))return u.write(null,new Error(`unsupported stream type: ${a}`));try{m=t(a,l,p)}catch(C){d=C}let y=Me[a==="source"?"sink":a==="sink"?"source":"duplex"](u);return J.pipeToStream(a,y,d?J.errorAsStream(a,d):m)}},close(u){if(o=null,i.ended=!0,!i.closed&&(i.closed=!0,n)){let c=n;n=null,c(u)}}}),i=oi(Me(o,()=>{}));return i=r?r(i,nn.enabled?nn.namespace:!1):i,i.remoteCall=function(u,c,s,f){if(c==="emit")return o.message(s);if(!(J.isRequest(u)||J.isStream(u)))throw new Error(`unsupported type: ${JSON.stringify(u)}`);if(J.isRequest(u))return o.request({name:c,args:s},f);let l=o.stream(),a=Me[u](l,f);return l.write({name:c,args:s,type:u}),a},i.isOpen=function(){return!o.ended},i.close=function(u,c){if(typeof u=="function"&&(c=u,u=!1),!o){c&&c();return}if(u){o.destroy(u),c&&c();return}return o.close(s=>{if(c)c(s);else if(s)throw rn(s,"no callback provided for muxrpc close")}),this},i.closed=!1,i}});var cn=h((Gs,un)=>{"use strict";var ii=Ne(),si=K();function He(e,t,r,n){for(let o in t){let i=t[o],u=r?r.concat(o):[o];if(i&&typeof i=="object"){let c=i;e[o]=He({},c,u,n)}else{let c=i;e[o]=(...s)=>n(c,u,s)}}return e}function ui(e){if(e)throw ii(e,"callback not provided")}function ci(e,t,r,n){e=e||{};function o(i,u,c){let s=typeof c[c.length-1]=="function"?c.pop():i==="sync"||i==="async"?null:ui;if(typeof s=="function"){let f;try{f=r(i,u,c,s)}catch(l){return si.errorAsStreamOrCb(i,l,s)}return f}else return new Promise((f,l)=>{r(i,u,c,(a,p)=>{a?l(a):f(p)})})}return n?o("async","manifest",[function(i,u){if(i)return n(i);He(e,u,null,o),n(null,u,e)}]):He(e,t,null,o),e}un.exports=ci});var an=h((Ys,fn)=>{"use strict";var me=K();function ln(e){return Array.isArray(e)?e:e.split(".")}function li(e){return e&&typeof e.pre=="function"&&typeof e.test=="function"&&typeof e.post=="function"}fn.exports=function(t){if(li(t))return t;if(typeof t=="function")return{pre:t};let r=null,n={};function o(i){if(i.allow){r={};for(let u of i.allow)me.set(r,ln(u),!0)}else r=null;if(i.deny)for(let u of i.deny)me.set(n,ln(u),!0);else n={};return this}return t&&o(t),o.pre=i=>{if(i=Array.isArray(i)?i:[i],r&&!me.prefix(r,i))return new Error(`method:${i} is not in list of allowed methods`);if(n&&me.prefix(n,i))return new Error(`method:${i} is on list of disallowed methods`)},o.post=()=>{},o.test=i=>o.pre(i),o.get=()=>({allow:r,deny:n}),o}});var dn=h((Vs,pn)=>{"use strict";var fi=an(),je=K();pn.exports=function(t,r,n){n=fi(n);function o(u,c){return u===je.get(r,c)}function i(u,c,s){if(c==="emit")throw new Error("emit has been removed");if(u==="async"&&o("sync",c)){let f=s.pop(),l;try{l=je.get(t,c).apply(this,s)}catch(a){return f(a)}return f(null,l)}if(!o(u,c))throw new Error(`no ${u}:${c}`);return je.get(t,c).apply(this,s)}return function(c,s,f){let l=n.pre(s,f);if(l)throw l;return i.call(this,c,s,f)}}});var gn=h((Ks,mn)=>{"use strict";var ai=Nr(),pi=require("events").EventEmitter,di=sn(),hi=cn(),mi=dn();function hn(e,t,r,n,o,i,u){let c;typeof e=="function"&&(c=e,e={}),t=t||{},e=e||{};let s=new pi;i||(i=ai);let f,l={_emit(p,d){return s&&s._emit(p,d),l},id:n},a=di(mi(r,t,o).bind(l),i,p=>{if(!s.closed&&(s.closed=!0,s.emit("closed"),f)){let d=f;f=null,d(p)}});if(hi(s,e,(p,d,m,g)=>{if(a.closed)throw new Error("stream is closed");return a.remoteCall(p,d,m,g)},c),s._emit=s.emit,u){Object.__defineGetter__.call(s,"id",()=>l.id),Object.__defineSetter__.call(s,"id",d=>{l.id=d});let p=!0;s.createStream=d=>{if(f=d,p)return p=!1,a;throw new Error("one stream per rpc")}}else s.stream=a;return s.closed=!1,s.close=function(p,d){return a.close(p,d),this},s}mn.exports=function(e,t,r){return arguments.length>3?hn.apply(this,arguments):function(n,o,i){return hn(e,t,n,i,o,r,!0)}}});var wi={};module.exports=$n(wi);var vn=L(require("net")),xn=L(require("http")),z=L(require("fs")),wn=L(require("path")),Ue=L(require("child_process")),We=L(G()),Je=require("util");var Y=L(require("net"));var v=L(require("fs")),F=require("util");var Zt=(0,F.promisify)(v.readFile),es=(0,F.promisify)(v.writeFile),ts=(0,F.promisify)(v.appendFile),rs=(0,F.promisify)(v.rename),ns=(0,F.promisify)(v.readdir),os=(0,F.promisify)(v.unlink);var is=(0,F.promisify)(v.rmdir),ss=(0,F.promisify)(v.rm),us=(0,F.promisify)(v.copyFile);var Qt={info:3,debug:2,trace:1},vs=Object.keys(Qt).reduce((e,t)=>(e[Qt[t]]=t,e),[]);var be=Se(),nr=e=>{if("port"in e)return be.duplex(Y.connect(e.port,e.host));let t=e.socketPath;if(process.platform!=="win32"||t.startsWith("\\\\.\\pipe\\"))return be.duplex(Y.connect(t));let r=new Y.Socket;return lo(r,t)};function uo(e){let t=[];return e.split("-").map(r=>{let n=r.match(/.{2}/g);n!==null&&n.reverse().map(o=>{t.push(parseInt(o,16))})}),Buffer.from(t)}function co(e,t,r){return t||r===void 0?{headerSize:e,err:t}:e===0?{headerSize:e,data:r}:r.length>e?(r=r.slice(e,r.length),e=0,{headerSize:e,data:r}):(e=e-r.length,{headerSize:e})}function lo(e,t){let r=0,n=[],o=[],i,u=l=>{l instanceof Error&&console.error(l),e.destroy();for(let a of n)a.cb(l,void 0);n=[];for(let a of o)a(l,(p,d)=>{});o=[]};function c(l,a){i.source(l,function(p,d){let m=co(r,p,d);r=m.headerSize,m.err||m.data?a(m.err||null,m.data):c(l,a)})}return(async()=>{let l=await Zt(t),p=l.toString().match(/!<socket >(\d+)( s)? ((([A-Fa-f0-9]{2}){4}-?){4})/),d,m;if(p!==null){let g=p[1],y=p[3];d=parseInt(g,10);let C=uo(y),_=Buffer.alloc(12);_.writeUInt32LE(process.pid,0),m=Buffer.concat([C,_]),r=16+3*4}else{let g=l.indexOf(10);d=parseInt(l.slice(0,g).toString(),10),m=l.slice(g+1),r=0}e.on("error",g=>{u(g)}),e.connect(d,"127.0.0.1",()=>{e.write(m,g=>{if(!g){i=be.duplex(e);for(let y of n)c(y.abort,y.cb);n=[];for(let y of o)i.sink(y);o=[]}})})})().catch(l=>{u(l)}),{source:function(l,a){i!==void 0?c(l,a):n.push({abort:l,cb:a})},sink:function(l){i!==void 0?i.sink(l):o.push(l)}}}var ie=!1;function or(e,t,r){return ie?function(o){return Pe(e(o),`${t} ${JSON.stringify(o)}`,r)}:e}function Pe(e,t,r){return ie?{source:ir(e.source,`${t} Source`,r),sink:fo(e.sink,`${t} Sink`,r)}:e}function ir(e,t,r){return ie?function(o,i){r.write(`${t} end in (${typeof o}${o&&typeof o=="object"?`: ${Object.keys(o)}`:""}): ${o&&typeof o=="object"&&o.stack||o}`),e(o,function(c,s){r.write(`${t} end out (${typeof c}${c&&typeof c=="object"?`: ${Object.keys(c)}`:""}): ${c&&typeof c=="object"&&c.stack||c}`),r.write(`${t} data: ${s==null?void 0:s.toString("hex")}`),i(c,s)})}:e}function fo(e,t,r){return ie?function(o){e(ir(o,t,r))}:e}var k=L(require("path")),lr=L(require("fs"));async function se(e,t=process.cwd(),r=process.env){if(process.platform!=="win32")return e;if(k.isAbsolute(e))return await Le(e)||e;if(/[/\\]/.test(e)){let u=k.join(t,e);return await Le(u)||u}let n,o;if(r){for(let u of Object.keys(r))if(u.toLowerCase()==="path"){let c=r[u];typeof c=="string"&&(n=c,o=c.split(k.delimiter).filter(Boolean),o.push(k.join(r.ProgramW6432||"C:\\Program Files","Docker\\Docker\\resources\\bin")));break}}if(o===void 0||o.length===0){let u=new Error(`No PATH to look up executable '${e}'.`);throw u.code="ENOENT",u}for(let u of o){let c;k.isAbsolute(u)?c=k.join(u,e):c=k.join(t,u,e);let s=await Le(c);if(s)return s}let i=new Error(`Exectuable '${e}' not found on PATH '${n}'.`);throw i.code="ENOENT",i}var sr=process.env.PATHEXT,ur=sr?sr.toLowerCase().split(";"):[".com",".exe",".bat",".cmd"];async function Le(e){if(ur.indexOf(k.extname(e))!==-1)return await cr(e)?e:void 0;for(let t of ur){let r=e+t;if(await cr(r))return r}}function cr(e){return new Promise(t=>lr.stat(e,(r,n)=>t(!r&&n.isFile())))}var gi=gn(),W=Se(),Cn;try{Cn=require(`${wn.dirname(process.argv[0])}/node_modules/node-pty`)}catch{}var En=JSON.parse(process.env.REMOTE_CONTAINERS_SOCKETS),yi={...En.reduce((e,t)=>(e[t]="duplex",e),{}),rpc:"async",connected:"async",ready:"async"},vi={exec:"async",stdin:"sink",stdout:"source",stderr:"source",exit:"async",terminate:"async",dispose:"async",ptyExec:"async",ptyIn:"sink",ptyOut:"source",ptyResize:"async",ptyExit:"async",ptyTerminate:"async",ptyDispose:"async",execToEnd:"async",setBaseEnv:"async",connect:"duplex"},T=process.env,R={},A={},yn=0,Z=gi(yi,vi)({exec:async(e,t)=>{try{let r=e.cwd,n=e.env?{...T,...e.env}:T,o=await se(e.cmd,r,n),i=Ue.spawn(o,e.args,{cwd:r,env:n,windowsHide:!0}),u=yn++;R[u]={process:i,exit:new Promise((c,s)=>{i.once("error",s),i.once("close",(f,l)=>{c({code:f,signal:l})})}),stdin:W.sink(i.stdin),stdout:W.source(i.stdout),stderr:W.source(i.stderr)},t(null,u)}catch(r){t(r)}},stdin:e=>R[e].stdin,stdout:e=>R[e].stdout,stderr:e=>R[e].stderr,exit:(e,t)=>{R[e].exit.then(r=>t(null,r),t)},terminate:(e,t)=>{R[e].process.kill("SIGKILL"),t()},dispose:(e,t)=>{delete R[e],t()},ptyExec:async(e,t)=>{try{let{cwd:r,cols:n,rows:o}=e,i=e.env?{...T,...e.env}:T,u=await se(e.cmd,r,i),c=Cn.spawn(u,e.args||[],{cwd:r,env:i,cols:n,rows:o}),s=[],f,l=c.onData(p=>{if(f){let d=f;f=void 0,d(null,p)}else s.push(p)}),a=yn++;A[a]={process:c,exit:new Promise(p=>{c.onExit(({exitCode:d,signal:m})=>p({code:d,signal:m}))}),in:p=>{p(null,function d(m,g){if(m!==!0){if(m)throw m;c.write(g),p(null,d)}})},out:(p,d)=>{if(p)return l.dispose(),s.length=0,d(p);if(s.length){let m=s.join("");s.length=0,d(null,m)}else f=d}},t(null,a)}catch(r){t(r)}},ptyIn:e=>A[e].in,ptyOut:e=>A[e].out,ptyResize:(e,t,r,n)=>{A[e].process.resize(t,r),n()},ptyExit:(e,t)=>{A[e].exit.then(r=>t(null,r),t)},ptyTerminate:(e,t)=>{A[e].process.kill("SIGKILL"),t()},ptyDispose:(e,t)=>{delete A[e],t()},execToEnd:async(e,t)=>{try{let r=e.cwd,n=e.env?{...T,...e.env}:T,o=await se(e.cmd,r,n),i=Ue.spawn(o,e.args,{cwd:r,env:n,windowsHide:!0}),u=[];i.stdout.on("data",s=>u.push(s));let c=[];i.stderr.on("data",s=>c.push(s)),i.once("error",t),i.once("close",(s,f)=>{t(null,{stdout:Buffer.concat(u),stderr:Buffer.concat(c),code:s,signal:f})})}catch(r){t(r)}},setBaseEnv:(e,t)=>{T=e,t()},connect:or(nr,"Remote Connect",{write:console.error})});(0,We.default)(W.source(process.stdin),Z.createStream(),W.sink(process.stdout));var kn=En.map(async e=>{try{if(!(await(0,Je.promisify)(z.lstat)(e)).isSocket())return;await(0,Je.promisify)(z.unlink)(e)}catch(r){if(!(r&&r.code==="ENOENT"))throw r}let t=vn.createServer(r=>{r=Pe(W.duplex(r),"Remote Listener",{write:console.error}),(0,We.default)(r,xi,Z[e](n=>{n&&console.error("Remote to local stream terminated with error:",n)}),r)});return new Promise(r=>t.listen(e,r))});function xi(e){return(t,r)=>{e(t,(n,o)=>{typeof n=="object"&&(n==null?void 0:n.code)==="ECONNRESET"&&(n=!0),r(n,o)})}}if(process.env.REMOTE_CONTAINERS_IPC){let e;kn.push(new Promise(t=>e=t)),xn.createServer((t,r)=>{let n=[];t.on("data",o=>n.push(o)),t.on("end",()=>{Z.rpc(Buffer.concat(n).toString(),(o,i)=>{o?(console.error(o),r.writeHead(500),r.end()):(r.writeHead(200),r.write(i,u=>{u&&console.error(u)}),r.end())})})}).listen(process.env.REMOTE_CONTAINERS_IPC,e)}Promise.all(kn).then(()=>Z.ready(e=>{e&&console.error(e)})).catch(e=>console.error(e));Z.connected(e=>{e&&console.error(e)});process.on("uncaughtException",e=>{z.writeSync(process.stderr.fd,String(e&&(e.stack||e.message)||e))});
|
|
//# sourceMappingURL=remoteContainersServer.js.map
|