tabby/clients/tabby-agent/dist/cli.js

51 lines
313 KiB
JavaScript
Raw Normal View History

#!/bin/env node
var Td=Object.create;var gr=Object.defineProperty;var kd=Object.getOwnPropertyDescriptor;var Bd=Object.getOwnPropertyNames;var Fd=Object.getPrototypeOf,jd=Object.prototype.hasOwnProperty;var Pd=(t,e,i)=>e in t?gr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Id=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Bd(e))!jd.call(t,r)&&r!==i&&gr(t,r,{get:()=>e[r],enumerable:!(n=kd(e,r))||n.enumerable});return t};var $=(t,e,i)=>(i=t!=null?Td(Fd(t)):{},Id(e||!t||!t.__esModule?gr(i,"default",{value:t,enumerable:!0}):i,t));var N=(t,e,i)=>(Pd(t,typeof e!="symbol"?e+"":e,i),i),br=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)};var p=(t,e,i)=>(br(t,e,"read from private field"),i?i.call(t):e.get(t)),C=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},S=(t,e,i,n)=>(br(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),en=(t,e,i,n)=>({set _(r){S(t,e,r,i)},get _(){return p(t,e,n)}}),A=(t,e,i)=>(br(t,e,"access private method"),i);var Yo=y((tw,Ko)=>{var Jo=require("stream").Stream,xm=require("util");Ko.exports=Se;function Se(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}xm.inherits(Se,Jo);Se.create=function(t,e){var i=new this;e=e||{};for(var n in e)i[n]=e[n];i.source=t;var r=t.emit;return t.emit=function(){return i._handleEmit(arguments),r.apply(t,arguments)},t.on("error",function(){}),i.pauseStream&&t.pause(),i};Object.defineProperty(Se.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});Se.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};Se.prototype.resume=function(){this._released||this.release(),this.source.resume()};Se.prototype.pause=function(){this.source.pause()};Se.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this)),this._bufferedEvents=[]};Se.prototype.pipe=function(){var t=Jo.prototype.pipe.apply(this,arguments);return this.resume(),t};Se.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}t[0]==="data"&&(this.dataSize+=t[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(t)};Se.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var t="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(t))}}});var es=y((iw,Zo)=>{var vm=require("util"),Qo=require("stream").Stream,Xo=Yo();Zo.exports=z;function z(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}vm.inherits(z,Qo);z.create=function(t){var e=new this;t=t||{};for(var i in t)e[i]=t[i];return e};z.isStreamLike=function(t){return typeof t!="function"&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"&&!Buffer.isBuffer(t)};z.prototype.append=function(t){var e=z.isStreamLike(t);if(e){if(!(t instanceof Xo)){var i=Xo.create(t,{maxDataSize:1/0,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this)),t=i}this._handleErrors(t),this.pauseStreams&&t.pause()}return this._streams.push(t),this};z.prototype.pipe=function(t,e){return Qo.prototype.pipe.call(this,t,e),this.resume(),t};z.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};z.prototype._realGetNext=function(){var t=this._streams.shift();if(typeof t>"u"){this.end();return}if(typeof t!="function"){this._pipeNext(t);return}var e=t;e(function(i){var n=z.isStreamLike(i);n&&(i.on("data",this._checkDataSize.bind(this)),this._handleErrors(i)),
`;P.DEFAULT_CONTENT_TYPE="application/octet-stream";P.prototype.append=function(t,e,i){i=i||{},typeof i=="string"&&(i={filename:i});var n=jr.prototype.append.bind(this);if(typeof e=="number"&&(e=""+e),Rs.isArray(e)){this._error(new Error("Arrays are not supported."));return}var r=this._multiPartHeader(t,e,i),a=this._multiPartFooter();n(r),n(e),n(a),this._trackLength(r,e,i)};P.prototype._trackLength=function(t,e,i){var n=0;i.knownLength!=null?n+=+i.knownLength:Buffer.isBuffer(e)?n=e.length:typeof e=="string"&&(n=Buffer.byteLength(e)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(t)+P.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof Ym))&&(i.knownLength||this._valuesToMeasure.push(e))};P.prototype._lengthRetriever=function(t,e){t.hasOwnProperty("fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):Km.stat(t.path,function(i,n){var r;if(i){e(i);return}r=n.size-(t.start?t.start:0),e(null,r)}):t.hasOwnProperty("httpVersion")?e(null,+t.headers["content-length"]):t.hasOwnProperty("httpModule")?(t.on("response",function(i){t.pause(),e(null,+i.headers["content-length"])}),t.resume()):e("Unknown stream")};P.prototype._multiPartHeader=function(t,e,i){if(typeof i.header=="string")return i.header;var n=this._getContentDisposition(e,i),r=this._getContentType(e,i),a="",o={"Content-Disposition":["form-data",'name="'+t+'"'].concat(n||[]),"Content-Type":[].concat(r||[])};typeof i.header=="object"&&Fr(o,i.header);var s;for(var c in o)o.hasOwnProperty(c)&&(s=o[c],s!=null&&(Array.isArray(s)||(s=[s]),s.length&&(a+=c+": "+s.join("; ")+P.LINE_BREAK)));return"--"+this.getBoundary()+P.LINE_BREAK+a+P.LINE_BREAK};P.prototype._getContentDisposition=function(t,e){var i,n;return typeof e.filepath=="string"?i=kr.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t.name||t.path?i=kr.basename(e.filename||t.name||t.path):t.readable&&t.hasOwnProperty("httpVersion")&&(i=kr.basename(t.client._httpMessage.path||"")),i&&(n='filename="'+i+'"'),n};P.prototype._getContentType=function(t,e){var i=e.contentType;return!i&&t.name&&(i=Br.lookup(t.name)),!i&&t.path&&(i=Br.lookup(t.path)),!i&&t.readable&&t.hasOwnProperty("httpVersion")&&(i=t.headers["content-type"]),!i&&(e.filepath||e.filename)&&(i=Br.lookup(e.filepath||e.filename)),!i&&typeof t=="object"&&(i=P.DEFAULT_CONTENT_TYPE),i};P.prototype._multiPartFooter=function(){return function(t){var e=P.LINE_BREAK,i=this._streams.length===0;i&&(e+=this._lastBoundary()),t(e)}.bind(this)};P.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+P.LINE_BREAK};P.prototype.getHeaders=function(t){var e,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t)t.hasOwnProperty(e)&&(i[e.toLowerCase()]=t[e]);return i};P.prototype.setBoundary=function(t){this._boundary=t};P.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};P.prototype.getBuffer=function(){for(var t=new Buffer.alloc(0),e=this.getBoundary(),i=0,n=this._streams.length;i<n;i++)typeof this._streams[i]!="function"&&(Buffer.isBuffer(this._streams[i])?t=Buffer.concat([t,this._streams[i]]):t=Buffer.concat([t,Buffer.from(this._streams[i])]),(typeof this._streams[i]!="string"||this._streams[i].substring(2,e.length+2)!==e)&&(t=Buffer.concat([t,Buffer.from(P.LINE_BREAK)])));return Buffer.concat([t,Buffer.from(this._lastBoundary())])};P.prototype._generateBoundary=function(){for(var t="--------------------------",e=0;e<24;e++)t+=Math.floor(Math.random()*10).toString(16);this._boundary=t};P.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;return this._streams.length&&(t+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),t};P.prototype.hasKnownLength=function(){var t=!0;return this._valuesToMeasure.length&&(t=!1),t};P.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(t
2023-05-29 02:09:44 +00:00
`).join(`
`+a),t.push(r+"m+"+hn.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Fh()+e+" "+t[0]}function Fh(){return Q.inspectOpts.hideDate?"":new Date().toISOString()+" "}function jh(...t){return process.stderr.write(mn.format(...t)+`
`)}function Ph(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function Ih(){return process.env.DEBUG}function qh(t){t.inspectOpts={};let e=Object.keys(Q.inspectOpts);for(let i=0;i<e.length;i++)t.inspectOpts[e[i]]=Q.inspectOpts[e[i]]}hn.exports=Mr()(Q);var{formatters:Gs}=hn.exports;Gs.o=function(t){return this.inspectOpts.colors=this.useColors,mn.inspect(t,this.inspectOpts).split(`
`).map(e=>e.trim()).join(" ")};Gs.O=function(t){return this.inspectOpts.colors=this.useColors,mn.inspect(t,this.inspectOpts)}});var Js=y((b0,$r)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?$r.exports=Ws():$r.exports=Vs()});var Ys=y((w0,Ks)=>{var Ei;Ks.exports=function(){if(!Ei){try{Ei=Js()("follow-redirects")}catch{}typeof Ei!="function"&&(Ei=function(){})}Ei.apply(null,arguments)}});var rc=y((S0,Jr)=>{var vt=require("url"),Hr=vt.URL,Uh=require("http"),Lh=require("https"),Zs=require("stream").Writable,ec=require("assert"),tc=Ys(),Gr=["abort","aborted","connect","error","socket","timeout"],Vr=Object.create(null);Gr.forEach(function(t){Vr[t]=function(e,i,n){this._redirectable.emit(t,e,i,n)}});var Nh=Ci("ERR_INVALID_URL","Invalid URL",TypeError),Xs=Ci("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Dh=Ci("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),zh=Ci("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Mh=Ci("ERR_STREAM_WRITE_AFTER_END","write after end");function fe(t,e){Zs.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var i=this;this._onNativeResponse=function(n){i._processResponse(n)},this._performRequest()}fe.prototype=Object.create(Zs.prototype);fe.prototype.abort=function(){nc(this._currentRequest),this.emit("abort")};fe.prototype.write=function(t,e,i){if(this._ending)throw new Mh;if(!yt(t)&&!Wh(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(Ai(e)&&(i=e,e=null),t.length===0){i&&i();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,i)):(this.emit("error",new zh),this.abort())};fe.prototype.end=function(t,e,i){if(Ai(t)?(i=t,t=e=null):Ai(e)&&(i=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,i);else{var n=this,r=this._currentRequest;this.write(t,e,function(){n._ended=!0,r.end(null,null,i)}),this._ending=!0}};fe.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};fe.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};fe.prototype.setTimeout=function(t,e){var i=this;function n(o){o.setTimeout(t),o.removeListener("timeout",o.destroy),o.addListener("timeout",o.destroy)}function r(o){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout(function(){i.emit("timeout"),a()},t),n(o)}function a(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",a),i.removeListener("error",a),i.removeListener("response",a),e&&i.removeListener("timeout",e),i.socket||i._currentRequest.removeListener("socket",r)}return e&&this.on("timeout",e),this.socket?r(this.socket):this._currentRequest.once("socket",r),this.on("socket",n),this.on("abort",a),this.on("error",a),this.on("response",a),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){fe.prototype[t]=function(e,i){return this._currentRequest[t](e,i)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(fe.prototype,t,{get:function(){return this._currentRequest[t]}})});fe.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};fe.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}if(this._options.agents){var i=t.slice(0,-1);this._options.agent=this._options.agents[i]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var r of Gr)n.on(r,Vr[r]);if(this._currentUrl=/^\//.test(this._options.path
`)>=0)return!1;return!0}function Mv(t,e){var i;if(t.indent===" ")i=" ";else if(typeof t.indent=="number"&&t.indent>0)i=Fe.call(Array(t.indent+1)," ");else return null;return{base:i,prev:Fe.call(Array(e+1),i)}}function Fa(t,e){if(t.length===0)return"";var i=`
`+e.prev+e.base;return i+Fe.call(t,","+i)+`
`+e.prev}function Fn(t,e){var i=Ba(t),n=[];if(i){n.length=t.length;for(var r=0;r<t.length;r++)n[r]=at(t,r)?e(t[r],t):""}var a=typeof Ra=="function"?Ra(t):[],o;if(Xt){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var c in t)at(t,c)&&(i&&String(Number(c))===c&&c<t.length||Xt&&o["$"+c]instanceof Symbol||(dl.call(/[^\w$]/,c)?n.push(e(c,t)+": "+e(t[c],t)):n.push(c+": "+e(t[c],t))));if(typeof Ra=="function")for(var l=0;l<a.length;l++)ml.call(t,a[l])&&n.push("["+e(a[l])+"]: "+e(t[a[l]],t));return n}});var Sl=y((gA,wl)=>{"use strict";var qa=Je(),Qt=de(),$v=bl(),Hv=qa("%TypeError%"),In=qa("%WeakMap%",!0),qn=qa("%Map%",!0),Wv=Qt("WeakMap.prototype.get",!0),Gv=Qt("WeakMap.prototype.set",!0),Vv=Qt("WeakMap.prototype.has",!0),Jv=Qt("Map.prototype.get",!0),Kv=Qt("Map.prototype.set",!0),Yv=Qt("Map.prototype.has",!0),Ua=function(t,e){for(var i=t,n;(n=i.next)!==null;i=n)if(n.key===e)return i.next=n.next,n.next=t.next,t.next=n,n},Xv=function(t,e){var i=Ua(t,e);return i&&i.value},Qv=function(t,e,i){var n=Ua(t,e);n?n.value=i:t.next={key:e,next:t.next,value:i}},Zv=function(t,e){return!!Ua(t,e)};wl.exports=function(){var e,i,n,r={assert:function(a){if(!r.has(a))throw new Hv("Side channel does not contain "+$v(a))},get:function(a){if(In&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Wv(e,a)}else if(qn){if(i)return Jv(i,a)}else if(n)return Xv(n,a)},has:function(a){if(In&&a&&(typeof a=="object"||typeof a=="function")){if(e)return Vv(e,a)}else if(qn){if(i)return Yv(i,a)}else if(n)return Zv(n,a);return!1},set:function(a,o){In&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new In),Gv(e,a,o)):qn?(i||(i=new qn),Kv(i,a,o)):(n||(n={key:{},next:null}),Qv(n,a,o))}};return r}});var La=y((bA,Al)=>{"use strict";var El=function(t){return t!==t};Al.exports=function(e,i){return e===0&&i===0?1/e===1/i:!!(e===i||El(e)&&El(i))}});var Na=y((wA,Cl)=>{"use strict";var ey=La();Cl.exports=function(){return typeof Object.is=="function"?Object.is:ey}});var Ol=y((SA,Rl)=>{"use strict";var ty=Na(),iy=rt();Rl.exports=function(){var e=ty();return iy(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var Bl=y((EA,kl)=>{"use strict";var ny=rt(),ry=Yt(),ay=La(),_l=Na(),oy=Ol(),Tl=ry(_l(),Object);ny(Tl,{getPolyfill:_l,implementation:ay,shim:oy});kl.exports=Tl});var Ke=y((AA,Fl)=>{"use strict";var sy=On();Fl.exports=function(){return sy()&&!!Symbol.toStringTag}});var Il=y((CA,Pl)=>{"use strict";var cy=Ke()(),py=de(),Da=py("Object.prototype.toString"),Un=function(e){return cy&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Da(e)==="[object Arguments]"},jl=function(e){return Un(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Da(e)!=="[object Array]"&&Da(e.callee)==="[object Function]"},ly=function(){return Un(arguments)}();Un.isLegacyArguments=jl;Pl.exports=ly?Un:jl});var Ul=y((RA,ql)=>{var uy={}.toString;ql.exports=Array.isArray||function(t){return uy.call(t)=="[object Array]"}});var zl=y((OA,Dl)=>{"use strict";var Nl=Function.prototype.toString,Zt=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ma,Ln;if(typeof Zt=="function"&&typeof Object.defineProperty=="function")try{Ma=Object.defineProperty({},"length",{get:function(){throw Ln}}),Ln={},Zt(function(){throw 42},null,Ma)}catch(t){t!==Ln&&(Zt=null)}else Zt=null;var fy=/^\s*class\b/,$a=function(e){try{var i=Nl.call(e);return fy.test(i)}catch{return!1}},za=function(e){try{return $a(e)?!1:(Nl.call(e),!0)}catch{return!1}},Nn=Object.prototype.toString,dy="[object Object]",my="[object Function]",hy="[object GeneratorFunction]",xy="[object HTMLAllCollection]",vy="[object HTML document.all class]",yy="[object HTMLCollection]",gy=typeof Symbol=="function"&&!!Symbol.toStringTag,by=!(0 in[,]),Ha=function(){return!1};typeof document=="object"&&(Ll=document.all,Nn.call(Ll)===Nn.call(document.all)&&(Ha=function(e){if((by||!e)&&(typeof e>"u"||typeof e=="object"))try{var i=Nn.call(e);return(i===xy||i===vy||i===yy||i===dy)&&e("")==null}catch{}return!1}));var Ll;Dl.exports=Zt?function(e){if(Ha(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Zt(e,nul
2023-05-29 02:09:44 +00:00
(see https://github.com/puleos/object-hash/issues/26)
Use "options.replacer" or "options.ignoreUnknown"
`)},_domwindow:function(){return n("domwindow")},_bigint:function(r){return n("bigint:"+r.toString())},_process:function(){return n("process")},_timer:function(){return n("timer")},_pipe:function(){return n("pipe")},_tcp:function(){return n("tcp")},_udp:function(){return n("udp")},_tty:function(){return n("tty")},_statwatcher:function(){return n("statwatcher")},_securecontext:function(){return n("securecontext")},_connection:function(){return n("connection")},_zlib:function(){return n("zlib")},_context:function(){return n("context")},_nodescript:function(){return n("nodescript")},_httpparser:function(){return n("httpparser")},_dataview:function(){return n("dataview")},_signal:function(){return n("signal")},_fsevent:function(){return n("fsevent")},_tlswrap:function(){return n("tlswrap")}}}function Gf(){return{buf:"",write:function(t){this.buf+=t},end:function(t){this.buf+=t},read:function(){return this.buf}}}});var Yf=y((jC,Kf)=>{Kf.exports={STRING:2,BOOLEAN:4,BYTES:4,NUMBER:8,Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8}});var Zf=y(lr=>{"use strict";lr.byteLength=db;lr.toByteArray=hb;lr.fromByteArray=yb;var De=[],we=[],fb=typeof Uint8Array<"u"?Uint8Array:Array,Oo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(kt=0,Xf=Oo.length;kt<Xf;++kt)De[kt]=Oo[kt],we[Oo.charCodeAt(kt)]=kt;var kt,Xf;we["-".charCodeAt(0)]=62;we["_".charCodeAt(0)]=63;function Qf(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");i===-1&&(i=e);var n=i===e?0:4-i%4;return[i,n]}function db(t){var e=Qf(t),i=e[0],n=e[1];return(i+n)*3/4-n}function mb(t,e,i){return(e+i)*3/4-i}function hb(t){var e,i=Qf(t),n=i[0],r=i[1],a=new fb(mb(t,n,r)),o=0,s=r>0?n-4:n,c;for(c=0;c<s;c+=4)e=we[t.charCodeAt(c)]<<18|we[t.charCodeAt(c+1)]<<12|we[t.charCodeAt(c+2)]<<6|we[t.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return r===2&&(e=we[t.charCodeAt(c)]<<2|we[t.charCodeAt(c+1)]>>4,a[o++]=e&255),r===1&&(e=we[t.charCodeAt(c)]<<10|we[t.charCodeAt(c+1)]<<4|we[t.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function xb(t){return De[t>>18&63]+De[t>>12&63]+De[t>>6&63]+De[t&63]}function vb(t,e,i){for(var n,r=[],a=e;a<i;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),r.push(xb(n));return r.join("")}function yb(t){for(var e,i=t.length,n=i%3,r=[],a=16383,o=0,s=i-n;o<s;o+=a)r.push(vb(t,o,o+a>s?s:o+a));return n===1?(e=t[i-1],r.push(De[e>>2]+De[e<<4&63]+"==")):n===2&&(e=(t[i-2]<<8)+t[i-1],r.push(De[e>>10]+De[e>>4&63]+De[e<<2&63]+"=")),r.join("")}});var ed=y(_o=>{_o.read=function(t,e,i,n,r){var a,o,s=r*8-n-1,c=(1<<s)-1,l=c>>1,u=-7,f=i?r-1:0,x=i?-1:1,g=t[e+f];for(f+=x,a=g&(1<<-u)-1,g>>=-u,u+=s;u>0;a=a*256+t[e+f],f+=x,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=o*256+t[e+f],f+=x,u-=8);if(a===0)a=1-l;else{if(a===c)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,n),a=a-l}return(g?-1:1)*o*Math.pow(2,a-n)};_o.write=function(t,e,i,n,r,a){var o,s,c,l=a*8-r-1,u=(1<<l)-1,f=u>>1,x=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:a-1,h=n?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+f>=1?e+=x/c:e+=x*Math.pow(2,1-f),e*c>=2&&(o++,c/=2),o+f>=u?(s=0,o=u):o+f>=1?(s=(e*c-1)*Math.pow(2,r),o=o+f):(s=e*Math.pow(2,f-1)*Math.pow(2,r),o=0));r>=8;t[i+g]=s&255,g+=h,s/=256,r-=8);for(o=o<<r|s,l+=r;l>0;t[i+g]=o&255,g+=h,o/=256,l-=8);t[i+g-h]|=v*128}});var vd=y(xi=>{"use strict";var To=Zf(),mi=ed(),td=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;xi.Buffer=m;xi.SlowBuffer=Ab;xi.INSPECT_MAX_BYTES=50;var ur=2147483647;xi.kMaxLength=ur;m.TYPED_ARRAY_SUPPORT=gb();!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function gb(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};ret
`).forEach(function(o){r=o.indexOf(":"),i=o.substring(0,r).trim().toLowerCase(),n=o.substring(r+1).trim(),!(!i||e[i]&&sh[i])&&(i==="set-cookie"?e[i]?e[i].push(n):e[i]=[n]:e[i]=e[i]?e[i]+", "+n:n)}),e};var Ls=Symbol("internals");function bi(t){return t&&String(t).trim().toLowerCase()}function un(t){return t===!1||t==null?t:d.isArray(t)?t.map(un):String(t)}function ch(t){let e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=i.exec(t);)e[n[1]]=n[2];return e}var ph=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Nr(t,e,i,n,r){if(d.isFunction(n))return n.call(this,e,i);if(r&&(e=i),!!d.isString(e)){if(d.isString(n))return e.indexOf(n)!==-1;if(d.isRegExp(n))return n.test(e)}}function lh(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,i,n)=>i.toUpperCase()+n)}function uh(t,e){let i=d.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+i,{value:function(r,a,o){return this[n].call(this,e,r,a,o)},configurable:!0})})}var Nt=class{constructor(e){e&&this.set(e)}set(e,i,n){let r=this;function a(s,c,l){let u=bi(c);if(!u)throw new Error("header name must be a non-empty string");let f=d.findKey(r,u);(!f||r[f]===void 0||l===!0||l===void 0&&r[f]!==!1)&&(r[f||c]=un(s))}let o=(s,c)=>d.forEach(s,(l,u)=>a(l,u,c));return d.isPlainObject(e)||e instanceof this.constructor?o(e,i):d.isString(e)&&(e=e.trim())&&!ph(e)?o(Us(e),i):e!=null&&a(i,e,n),this}get(e,i){if(e=bi(e),e){let n=d.findKey(this,e);if(n){let r=this[n];if(!i)return r;if(i===!0)return ch(r);if(d.isFunction(i))return i.call(this,r,n);if(d.isRegExp(i))return i.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,i){if(e=bi(e),e){let n=d.findKey(this,e);return!!(n&&this[n]!==void 0&&(!i||Nr(this,this[n],n,i)))}return!1}delete(e,i){let n=this,r=!1;function a(o){if(o=bi(o),o){let s=d.findKey(n,o);s&&(!i||Nr(n,n[s],s,i))&&(delete n[s],r=!0)}}return d.isArray(e)?e.forEach(a):a(e),r}clear(e){let i=Object.keys(this),n=i.length,r=!1;for(;n--;){let a=i[n];(!e||Nr(this,this[a],a,e,!0))&&(delete this[a],r=!0)}return r}normalize(e){let i=this,n={};return d.forEach(this,(r,a)=>{let o=d.findKey(n,a);if(o){i[o]=un(r),delete i[a];return}let s=e?lh(a):String(a).trim();s!==a&&delete i[a],i[s]=un(r),n[s]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let i=Object.create(null);return d.forEach(this,(n,r)=>{n!=null&&n!==!1&&(i[r]=e&&d.isArray(n)?n.join(", "):n)}),i}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,i])=>e+": "+i).join(`
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...i){let n=new this(e);return i.forEach(r=>n.set(r)),n}static accessor(e){let n=(this[Ls]=this[Ls]={accessors:{}}).accessors,r=this.prototype;function a(o){let s=bi(o);n[s]||(uh(r,o),n[s]=!0)}return d.isArray(e)?e.forEach(a):a(e),this}};Nt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.freezeMethods(Nt.prototype);d.freezeMethods(Nt);var H=Nt;function wi(t,e){let i=this||Lt,n=e||i,r=H.from(n.headers),a=n.data;return d.forEach(t,function(s){a=s.call(i,a,r.normalize(),e?e.status:void 0)}),r.normalize(),a}function Si(t){return!!(t&&t.__CANCEL__)}function Ns(t,e,i){w.call(this,t??"canceled",w.ERR_CANCELED,e,i),this.name="CanceledError"}d.inherits(Ns,w,{__CANCEL__:!0});var Ee=Ns;function tt(t,e,i){let n=i.config.validateStatus;!i.status||!n||n(i.status)?t(i):e(new w("Request failed with status code "+i.status,[w.ERR_BAD_REQUEST,w.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}function Dr(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function zr(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}function ht(t,e){return t&&!Dr(e)?zr(t,e):e}var vc=$(zs(),1),yc=$(require("http"),1),gc=$(require("https"),1),bc=$(require("util"),1),wc=$(rc(),1),Ge=$(require("zlib"),1);var gt="1.4.0";function Ri(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}var Gh=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Kr(t,e,i){let n=i&&i.Blob||M.classes.Blob,r=Ri(t);if(e===void 0&&n&&(e=!0),r==="data"){t=r.length?t.slice(r.length+1):t;let a=Gh.exec(t);if(!a)throw new w("Invalid URL",w.ERR_INVALID_URL);let o=a[1],s=a[2],c=a[3],l=Buffer.from(decodeURIComponent(c),s?"base64":"utf8");if(e){if(!n)throw new w("Blob is not supported",w.ERR_NOT_SUPPORT);return new n([l],{type:o})}return l}throw new w("Unsupported protocol "+r,w.ERR_NOT_SUPPORT)}var bt=$(require("stream"),1);var oc=$(require("stream"),1);function Vh(t,e){let i=0,n=1e3/e,r=null;return function(o,s){let c=Date.now();if(o||c-i>n)return r&&(clearTimeout(r),r=null),i=c,t.apply(null,s);r||(r=setTimeout(()=>(r=null,i=Date.now(),t.apply(null,s)),n-(c-i)))}}var ac=Vh;function Jh(t,e){t=t||10;let i=new Array(t),n=new Array(t),r=0,a=0,o;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=n[a];o||(o=l),i[r]=c,n[r]=l;let f=a,x=0;for(;f!==r;)x+=i[f++],f=f%t;if(r=(r+1)%t,r===a&&(a=(a+1)%t),l-o<e)return;let g=u&&l-u;return g?Math.round(x*1e3/g):void 0}}var xn=Jh;var vn=Symbol("internals"),Yr=class extends oc.default.Transform{constructor(e){e=d.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(s,c)=>!d.isUndefined(c[s])),super({readableHighWaterMark:e.chunkSize});let i=this,n=this[vn]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},r=xn(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",s=>{s==="progress"&&(n.isCaptured||(n.isCaptured=!0))});let a=0;n.updateProgress=ac(function(){let c=n.length,l=n.bytesSeen,u=l-a;if(!u||i.destroyed)return;let f=r(u);a=l,process.nextTick(()=>{i.emit("progress",{loaded:l,total:c,progress:c?l/c:void 0,bytes:u,rate:f||void 0,estimated:f&&c&&l<=c?(c-l)/f:void 0})})},n.ticksRate);let o=()=>{n.updateProgress(!0)};this.once("end",o),this.once("error",o)}_read(e){let i=this[vn];return i.onReadCallback&&i.onReadCallback(),super._read(e)}_transform(e,i,n){let r=this,a=this[vn],o=a.maxRate,s=this.readableHighWaterMark,c=a.timeWindow,l=1e3/c,u=o/l,f=a.minChunkSize!==!1?Math.max(a.minChunkSize,u*.01):0;function x(h,v){let E=Buffer.byteLength(h);a.bytesSeen+=E,a.bytes+=E,a.isCaptured&&a.updateProgress(),r.push(h)?process.nextTick(v):a.onReadCallback=()=>{a.onReadCallback=null,process.nextTick(v)}}let g=(h,v)=>{let E=Buffer.byteLength(h),b=null,T=s,O,k=0;if(o){let F=Date.now();(!a.ts||(k=F-a.ts)>=c)&&(a.ts=F,O=u-a.
`,Xh=Oi.encode(it),Qh=2,Qr=class{constructor(e,i){let{escapeName:n}=this.constructor,r=d.isString(i),a=`Content-Disposition: form-data; name="${n(e)}"${!r&&i.name?`; filename="${n(i.name)}"`:""}${it}`;r?i=Oi.encode(String(i).replace(/\r?\n|\r\n?/g,it)):a+=`Content-Type: ${i.type||"application/octet-stream"}${it}`,this.headers=Oi.encode(a+it),this.contentLength=r?i.byteLength:i.size,this.size=this.headers.byteLength+this.contentLength+Qh,this.name=e,this.value=i}async*encode(){yield this.headers;let{value:e}=this;d.isTypedArray(e)?yield e:yield*yn(e),yield Xh}static escapeName(e){return String(e).replace(/[\r\n"]/g,i=>({"\r":"%0D","\n":"%0A",'"':"%22"})[i])}},Zh=(t,e,i)=>{let{tag:n="form-data-boundary",size:r=25,boundary:a=n+"-"+d.generateString(r,Yh)}=i||{};if(!d.isFormData(t))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=Oi.encode("--"+a+it),s=Oi.encode("--"+a+"--"+it+it),c=s.byteLength,l=Array.from(t.entries()).map(([f,x])=>{let g=new Qr(f,x);return c+=g.size,g});c+=o.byteLength*l.length,c=d.toFiniteNumber(c);let u={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(c)&&(u["Content-Length"]=c),e&&e(u),pc.Readable.from(async function*(){for(let f of l)yield o,yield*f.encode();yield s}())},lc=Zh;var uc=$(require("stream"),1),Zr=class extends uc.default.Transform{__transform(e,i,n){this.push(e),n()}_transform(e,i,n){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let r=Buffer.alloc(2);r[0]=120,r[1]=156,this.push(r,i)}this.__transform(e,i,n)}},fc=Zr;var ex=(t,e)=>d.isAsyncFn(t)?function(...i){let n=i.pop();t.apply(this,i).then(r=>{try{e?n(null,...e(r)):n(null,r)}catch(a){n(a)}},n)}:t,dc=ex;var mc={flush:Ge.default.constants.Z_SYNC_FLUSH,finishFlush:Ge.default.constants.Z_SYNC_FLUSH},tx={flush:Ge.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Ge.default.constants.BROTLI_OPERATION_FLUSH},hc=d.isFunction(Ge.default.createBrotliDecompress),{http:ix,https:nx}=wc.default,rx=/https:?/,xc=M.protocols.map(t=>t+":");function ax(t){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t)}function Ec(t,e,i){let n=e;if(!n&&n!==!1){let r=(0,vc.getProxyForUrl)(i);r&&(n=new URL(r))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+a}t.headers.host=t.hostname+(t.port?":"+t.port:"");let r=n.hostname||n.host;t.hostname=r,t.host=r,t.port=n.port,t.path=i,n.protocol&&(t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}t.beforeRedirects.proxy=function(a){Ec(a,e,a.href)}}var ox=typeof process<"u"&&d.kindOf(process)==="process",sx=t=>new Promise((e,i)=>{let n,r,a=(c,l)=>{r||(r=!0,n&&n(c,l))},o=c=>{a(c),e(c)},s=c=>{a(c,!0),i(c)};t(o,s,c=>n=c).catch(s)}),Ac=ox&&function(e){return sx(async function(n,r,a){let{data:o,lookup:s,family:c}=e,{responseType:l,responseEncoding:u}=e,f=e.method.toUpperCase(),x,g=!1,h;s&&d.isAsyncFn(s)&&(s=dc(s,R=>{if(d.isString(R))R=[R,R.indexOf(".")<0?6:4];else if(!d.isArray(R))throw new TypeError("lookup async function must return an array [ip: string, family: number]]");return R}));let v=new Sc.default,E=()=>{e.cancelToken&&e.cancelToken.unsubscribe(b),e.signal&&e.signal.removeEventListener("abort",b),v.removeAllListeners()};a((R,B)=>{x=!0,B&&(g=!0,E())});function b(R){v.emit("abort",!R||R.type?new Ee(null,e,h):R)}v.once("abort",r),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(b),e.signal&&(e.signal.aborted?b():e.signal.addEventListener("abort",b)));let T=ht(e.baseURL,e.url),O=new URL(T,"http://localhost"),k=O.protocol||xc[0];if(k==="data:"){let R;if(f!=="GET")return tt(n,r,{status:405,statusText:"method not allowed",headers:{},config:e});try{R=Kr(e.url,l==="blob",{Blob:e.env&&e.env.Blob})}catch(B){throw w.from(B,w.ERR_BAD_REQUEST,e)}return l==="text"?(R=R.toString(u),(!u||u==="utf8")&&(R=d.stripBOM(
`)?this.buffer="":this.buffer=n.pop();for(let r of n){let a=null;try{a=JSON.parse(r)}catch(o){this.errLogger.write(JSON.stringify(o,Object.getOwnPropertyNames(o))+`
`);continue}this.handleRequest(a).then(o=>{this.sendResponse(o)})}}}async handleRequest(e){let i=[0,null];try{if(!this.agent)throw new Error(`Agent not bound.
`);i[0]=e[0];let n=e[1].func;if(n==="cancelRequest")i[1]=this.cancelRequest(e);else{let r=this.agent[n];if(!r)throw new Error(`Unknown function: ${n}`);let a=r.apply(this.agent,e[1].args);a instanceof be?(this.ongoingRequests[e[0]]=a,i[1]=await a,delete this.ongoingRequests[e[0]]):i[1]=a}}catch(n){this.errLogger.write(JSON.stringify(n,Object.getOwnPropertyNames(n))+`
`)}finally{return i}}cancelRequest(e){let i=this.ongoingRequests[e[1].args[0]];return i?(i.cancel(),!0):!1}sendResponse(e){this.outStream.write(JSON.stringify(e)+`
`)}bind(e){this.agent=e;for(let i of Rd)this.agent.on(i,n=>{this.sendResponse([0,n])})}listen(){this.inStream.on("data",this.handleInput.bind(this))}};var Jb=new mr,Od=new hr;Od.bind(Jb);Od.listen();
2023-05-29 02:09:44 +00:00
/*! Bundled license information:
mime-db/index.js:
(*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*)
mime-types/index.js:
(*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*)
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
*/