UNPKG

azureauth

Version:

node-azure auth wrapps the AzureAuth CLI wrapper for performing AAD Authentication

2 lines 158 kB
"use strict";var us=Object.create;var vt=Object.defineProperty;var ls=Object.getOwnPropertyDescriptor;var cs=Object.getOwnPropertyNames;var xs=Object.getPrototypeOf,ds=Object.prototype.hasOwnProperty;var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hs=(e,t)=>{for(var r in t)vt(e,r,{get:t[r],enumerable:!0})},gi=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of cs(t))!ds.call(e,n)&&n!==r&&vt(e,n,{get:()=>t[n],enumerable:!(i=ls(t,n))||i.enumerable});return e};var gt=(e,t,r)=>(r=e!=null?us(xs(e)):{},gi(t||!e||!e.__esModule?vt(r,"default",{value:e,enumerable:!0}):r,e)),ps=e=>gi(vt({},"__esModule",{value:!0}),e);var Fi=m(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.DownloaderHelper=Ce.DH_STATES=void 0;var xr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ms=function(){function e(t,r){for(var i,n=0;n<r.length;n++)i=r[n],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),_s=require("fs"),Y=wt(_s),Be=require("url"),ys=require("path"),Ee=wt(ys),vs=require("http"),wi=wt(vs),gs=require("https"),bi=wt(gs),ws=require("events");function wt(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function bs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ei(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:e}function Es(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var Si=Ce.DH_STATES={IDLE:"IDLE",SKIPPED:"SKIPPED",STARTED:"STARTED",DOWNLOADING:"DOWNLOADING",RETRY:"RETRY",PAUSED:"PAUSED",RESUMED:"RESUMED",STOPPED:"STOPPED",FINISHED:"FINISHED",FAILED:"FAILED"},Ju=Ce.DownloaderHelper=function(e){function t(r,i){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};bs(this,t);var a=Ei(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{captureRejections:!0}));return a.__validate(r,i)?(a.url=a.requestURL=r.trim(),a.state=Si.IDLE,a.__defaultOpts={body:null,retry:!1,method:"GET",headers:{},fileName:"",timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},a.__opts=Object.assign({},a.__defaultOpts),a.__pipes=[],a.__total=0,a.__downloaded=0,a.__progress=0,a.__retryCount=0,a.__retryTimeout=null,a.__resumeRetryCount=0,a.__states=Si,a.__promise=null,a.__request=null,a.__response=null,a.__isAborted=!1,a.__isResumed=!1,a.__isResumable=!1,a.__isRedirected=!1,a.__destFolder=i,a.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},a.__fileName="",a.__filePath="",a.updateOptions(n),a):Ei(a)}return Es(t,e),ms(t,[{key:"start",value:function(){var i=this,n=function(){return new Promise(function(a,o){i.__promise={resolve:a,reject:o},i.__start()})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(a){var o=a.name,s=a.total,u=i.__opts.override;if(i.__opts.override=!0,i.__filePath=i.__getFilePath(o),i.__opts.override=u,i.__filePath&&Y.existsSync(i.__filePath)){var x=i.__getFilesizeInBytes(i.__filePath);return x===s?n():i.resumeFromFile(i.__filePath,{total:s,fileName:o})}return n()}):n()}},{key:"pause",value:function(){var i=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(n){return n.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return i.__setState(i.__states.PAUSED),i.emit("pause"),!0}))}},{key:"resume",value:function(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range="bytes="+this.__downloaded+"-"),this.emit("resume",this.__isResumed),this.__start()):this.start()}},{key:"stop",value:function(){var i=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var n=function(){return new Promise(function(a,o){Y.access(i.__filePath,function(s){return s?(i.__emitStop(),a(!0)):void Y.unlink(i.__filePath,function(u){return u?(i.__setState(i.__states.FAILED),i.emit("error",u),o(u)):(i.__emitStop(),void a(!0))})})})};return this.__requestAbort(),this.__closeFileStream().then(function(){return i.__opts.removeOnStop?n():(i.__emitStop(),Promise.resolve(!0))})}},{key:"pipe",value:function(i){var n=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;return this.__pipes.push({stream:i,options:n}),i}},{key:"unpipe",value:function(){var i=this,n=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,a=function(s){return i.__response?i.__response.unpipe(s):s.unpipe()};if(n){var o=this.__pipes.find(function(s){return s.stream===n});return void(o&&(a(n),this.__pipes=this.__pipes.filter(function(s){return s.stream!==n})))}this.__pipes.forEach(function(s){return a(s.stream)}),this.__pipes=[]}},{key:"getDownloadPath",value:function(){return this.__filePath}},{key:"isResumable",value:function(){return this.__isResumable}},{key:"updateOptions",value:function(i){var n=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"";this.__opts=Object.assign({},this.__opts,i),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),(typeof this.__opts.progressThrottle!="number"||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=n||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url)}},{key:"getOptions",value:function(){return this.__opts}},{key:"getMetadata",value:function(){return this.__opts.metadata}},{key:"getStats",value:function(){return{total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:"getTotalSize",value:function(){var i=this;return new Promise(function(n,a){var o=function(u){i.__initProtocol(u);var x=Object.assign({},i.__headers);x.hasOwnProperty("range")&&delete x.range;var l=i.__getReqOptions("HEAD",u,x);return Object.assign({},i.__reqOptions,l)},s=function(u,x){var l=i.__protocol.request(x,function(c){if(i.__isRequireRedirect(c)){var f=/^https?:\/\//.test(c.headers.location)?c.headers.location:new Be.URL(c.headers.location,u).href;return i.emit("redirected",f,u),s(f,o(f))}return c.statusCode===200?void n({name:i.__getFileNameFromHeaders(c.headers,c),total:parseInt(c.headers["content-length"])||null}):a(new Error("Response status was "+c.statusCode))});l.on("error",function(c){return a(c)}),l.on("timeout",function(){return a(new Error("timeout"))}),l.on("uncaughtException",function(c){return a(c)}),l.end()};s(i.url,o(i.url))})}},{key:"getResumeState",value:function(){return{downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:"resumeFromFile",value:function(i){var n=this,a=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return this.__opts.override=!0,this.__filePath=i,(a.total&&a.fileName?Promise.resolve({name:a.fileName,total:a.total}):this.getTotalSize()).then(function(o){var s=o.name,u=o.total;return n.__total=a.total||u,n.__fileName=a.fileName||s,n.__downloaded=a.downloaded||n.__getFilesizeInBytes(n.__filePath),n.__reqOptions.headers.range="bytes="+n.__downloaded+"-",n.__isResumed=!0,n.__isResumable=!0,n.__setState(n.__states.RESUMED),n.emit("resume",n.__isResumed),new Promise(function(x,l){n.__promise={resolve:x,reject:l},n.__start()})})}},{key:"__start",value:function(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit("start"),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on("error",this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on("timeout",this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on("uncaughtException",this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end()}},{key:"__resolvePending",value:function(){if(this.__promise){var i=this.__promise.resolve;return this.__promise=null,i(!0)}}},{key:"__downloadRequest",value:function(i,n){var a=this;return this.__protocol.request(this.__reqOptions,function(o){if(a.__response=o,a.__isResumed||(a.__total=parseInt(o.headers["content-length"])||null,a.__resetStats()),a.__isRequireRedirect(o)){var s=/^https?:\/\//.test(o.headers.location)?o.headers.location:new Be.URL(o.headers.location,a.url).href;return a.__isRedirected=!0,a.__initProtocol(s),a.emit("redirected",s,a.url),a.__start()}if(o.statusCode!==200&&o.statusCode!==206){var u=new Error("Response status was "+o.statusCode);return u.status=o.statusCode||0,u.body=o.body||"",a.__setState(a.__states.FAILED),a.emit("error",u),n(u)}(a.__opts.forceResume||o.headers.hasOwnProperty("accept-ranges")&&o.headers["accept-ranges"]!=="none")&&(a.__isResumable=!0),a.__startDownload(o,i,n)})}},{key:"__startDownload",value:function(i,n,a){var o=this,s=i;if(this.__isResumed)this.__fileStream=Y.createWriteStream(this.__filePath,{flags:"a"});else{var u=this.__getFileNameFromHeaders(i.headers);if(this.__filePath=this.__getFilePath(u),this.__fileName=this.__filePath.split(Ee.sep).pop(),Y.existsSync(this.__filePath)){var x=this.__getFilesizeInBytes(this.__filePath),l=this.__total?this.__total:0;if(xr(this.__opts.override)==="object"&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||x>=l))return this.emit("skip",{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:x}),this.__setState(this.__states.SKIPPED),n(!0)}this.__fileStream=Y.createWriteStream(this.__filePath,{})}this.emit("download",{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,s.on("data",function(c){return o.__calculateStats(c.length)}),this.__pipes.forEach(function(c){s.pipe(c.stream,c.options),s=c.stream}),s.pipe(this.__fileStream),s.on("error",this.__onError(n,a)),this.__fileStream.on("finish",this.__onFinished(n,a)),this.__fileStream.on("error",this.__onError(n,a))}},{key:"__hasFinished",value:function(){return!this.__isAborted&&[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)===-1}},{key:"__isRequireRedirect",value:function(i){return 300<i.statusCode&&400>i.statusCode&&i.headers.hasOwnProperty("location")&&i.headers.location}},{key:"__onFinished",value:function(i,n){var a=this;return function(){a.__fileStream.close(function(o){if(o)return n(o);if(a.__hasFinished()){var s=!!a.__total&&a.__downloaded!==a.__total;if(s&&a.__isResumable&&a.__opts.resumeOnIncomplete&&a.__resumeRetryCount<=a.__opts.resumeOnIncompleteMaxRetry)return a.__resumeRetryCount++,a.emit("warning",new Error("uncomplete download, retrying")),a.resume();a.__setState(a.__states.FINISHED),a.__pipes=[],a.emit("end",{fileName:a.__fileName,filePath:a.__filePath,totalSize:a.__total,incomplete:s,onDiskSize:a.__getFilesizeInBytes(a.__filePath),downloadedSize:a.__downloaded})}return i(a.__downloaded===a.__total)})}}},{key:"__closeFileStream",value:function(){var i=this;return this.__fileStream?new Promise(function(n,a){i.__fileStream.close(function(o){return o?a(o):n(!0)})}):Promise.resolve(!0)}},{key:"__onError",value:function(i,n){var a=this,o=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return function(s){return a.__pipes=[],o&&a.__requestAbort(),a.state===a.__states.STOPPED||a.state===a.__states.FAILED?void 0:a.__opts.retry?a.__retry(s).catch(function(u){a.__removeFile().finally(function(){a.__setState(a.__states.FAILED),a.emit("error",u||s),n(u||s)})}):a.__removeFile().finally(function(){a.__setState(a.__states.FAILED),a.emit("error",s),n(s)})}}},{key:"__retry",value:function(){var i=this,n=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null;if(!this.__opts.retry||xr(this.__opts.retry)!=="object")return Promise.reject(n||new Error("wrong retry options"));var a=this.__opts.retry,o=a.delay,s=o===void 0?0:o,u=a.maxRetries,x=u===void 0?999:u;return this.__retryCount>=x?Promise.reject(n||new Error("reached the maximum retries")):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit("retry",this.__retryCount,this.__opts.retry,n),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(l){return l.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(l){return i.__retryTimeout=setTimeout(function(){return l(0<i.__downloaded?i.resume():i.__start())},s)})}))}},{key:"__onTimeout",value:function(i,n){var a=this;return function(){return a.__requestAbort(),a.__opts.retry?a.__retry(new Error("timeout")).catch(function(o){a.__removeFile().finally(function(){a.__setState(a.__states.FAILED),o?n(o):(a.emit("timeout"),n(new Error("timeout")))})}):a.__removeFile().finally(function(){a.__setState(a.__states.FAILED),a.emit("timeout"),n(new Error("timeout"))})}}},{key:"__resetStats",value:function(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0}}},{key:"__getFileNameFromHeaders",value:function(i,n){var a="",o=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,s=/.*filename="(.*?)";?/i,u=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,x=i.hasOwnProperty("content-disposition"),l=x?i["content-disposition"].match(o):null,c=!x||l?null:i["content-disposition"].match(s),f=!x||l||c?null:i["content-disposition"].match(u);return x&&(l||c||f)?(a=i["content-disposition"],a=a.trim(),l?a=l[1]:c?a=c[1]:f&&(a=f[1]),a=a.replace(/[/\\]/g,"")):0<Ee.basename(new Be.URL(this.requestURL).pathname).length?a=Ee.basename(new Be.URL(this.requestURL).pathname):a=new Be.URL(this.requestURL).hostname+".html",this.__opts.fileName?this.__getFileNameFromOpts(a,n):a.replace(/\.*$/,"")}},{key:"__getFilePath",value:function(i){var n=Ee.join(this.__destFolder,i),a=n;return this.__opts.override||this.state===this.__states.RESUMED||(a=this.__uniqFileNameSync(a),n!==a&&this.emit("renamed",{path:a,fileName:a.split(Ee.sep).pop(),prevPath:n,prevFileName:n.split(Ee.sep).pop()})),a}},{key:"__getFileNameFromOpts",value:function(i,n){if(!this.__opts.fileName)return i;if(typeof this.__opts.fileName=="string")return this.__opts.fileName;if(typeof this.__opts.fileName=="function"){var a=Ee.join(this.__destFolder,i);return n&&n.headers||this.__response&&this.__response.headers?this.__opts.fileName(i,a,(n||this.__response).headers["content-type"]):this.__opts.fileName(i,a)}if(xr(this.__opts.fileName)==="object"){var o=this.__opts.fileName,s=o.name,u=!!o.hasOwnProperty("ext")&&o.ext;if(typeof u=="string")return s+"."+u;if(typeof u=="boolean"){if(u)return s;var x=i.includes(".")?i.split(".").pop():"";return x===""?s:s+"."+x}}return i}},{key:"__calculateStats",value:function(i){var n=new Date,a=n-this.__statsEstimate.time,o=n-this.__statsEstimate.throttleTime,s=this.__total||0;i&&(this.__downloaded+=i,this.__progress=s===0?0:100*(this.__downloaded/s),(this.__downloaded===s||1e3<a)&&(this.__statsEstimate.time=n,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===s||o>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=n,this.emit("progress.throttled",this.getStats())),this.emit("progress",this.getStats()))}},{key:"__setState",value:function(i){this.state=i,this.emit("stateChanged",this.state)}},{key:"__getReqOptions",value:function(i,n){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},o=new Be.URL(n),s={protocol:o.protocol,host:o.hostname,port:o.port,path:o.pathname+o.search,method:i};return a&&(s.headers=a),s}},{key:"__getFilesizeInBytes",value:function(i){try{var n=Y.statSync(i,{throwIfNoEntry:!1}),a=n.size||0;return a}catch(o){this.emit("warning",o)}return 0}},{key:"__validate",value:function(i,n){if(typeof i!="string")throw new Error("URL should be an string");if(i.trim()==="")throw new Error("URL couldn't be empty");if(typeof n!="string")throw new Error("Destination Folder should be an string");if(n.trim()==="")throw new Error("Destination Folder couldn't be empty");if(!Y.existsSync(n))throw new Error("Destination Folder must exist");var a=Y.statSync(n);if(!a.isDirectory())throw new Error("Destination Folder must be a directory");try{Y.accessSync(n,Y.constants.W_OK)}catch{throw new Error("Destination Folder must be writable")}return!0}},{key:"__initProtocol",value:function(i){var n=this.__getReqOptions(this.__opts.method,i,this.__headers);this.requestURL=i,-1<i.indexOf("https://")?(this.__protocol=bi,n.agent=new bi.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},n,this.__opts.httpsRequestOptions)):(this.__protocol=wi,n.agent=new wi.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},n,this.__opts.httpRequestOptions))}},{key:"__uniqFileNameSync",value:function(i){if(typeof i!="string"||i==="")return i;try{Y.accessSync(i,Y.F_OK);var n=i.match(/(.*)(\([0-9]+\))(\..*)$/),a=n?n[1].trim():i,o=n?parseInt(n[2].replace(/\(|\)/,"")):0,s=i.split(".").pop();return s!==i&&0<s.length?(s="."+s,a=a.replace(s,"")):s="",this.__uniqFileNameSync(a+" ("+ ++o+")"+s)}catch{return i}}},{key:"__removeFile",value:function(){var i=this;return new Promise(function(n){return i.__fileStream?void i.__fileStream.close(function(a){return a&&i.emit("warning",a),i.__opts.removeOnFail?Y.access(i.__filePath,function(o){return o?n():void Y.unlink(i.__filePath,function(s){s&&i.emit("warning",a),n()})}):void n()}):n()})}},{key:"__requestAbort",value:function(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort())}},{key:"__emitStop",value:function(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit("stop")}}]),t}(ws.EventEmitter)});var Oi=m((tl,Ri)=>{var he=require("constants"),Ss=process.cwd,bt=null,Fs=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return bt||(bt=Ss.call(process)),bt};try{process.cwd()}catch{}typeof process.chdir=="function"&&(dr=process.chdir,process.chdir=function(e){bt=null,dr.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,dr));var dr;Ri.exports=Rs;function Rs(e){he.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=a(e.chown),e.fchown=a(e.fchown),e.lchown=a(e.lchown),e.chmod=i(e.chmod),e.fchmod=i(e.fchmod),e.lchmod=i(e.lchmod),e.chownSync=o(e.chownSync),e.fchownSync=o(e.fchownSync),e.lchownSync=o(e.lchownSync),e.chmodSync=n(e.chmodSync),e.fchmodSync=n(e.fchmodSync),e.lchmodSync=n(e.lchmodSync),e.stat=s(e.stat),e.fstat=s(e.fstat),e.lstat=s(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(l,c,f){f&&process.nextTick(f)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(l,c,f,h){h&&process.nextTick(h)},e.lchownSync=function(){}),Fs==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(l){function c(f,h,p){var _=Date.now(),d=0;l(f,h,function v(g){if(g&&(g.code==="EACCES"||g.code==="EPERM"||g.code==="EBUSY")&&Date.now()-_<6e4){setTimeout(function(){e.stat(h,function(E,z){E&&E.code==="ENOENT"?l(f,h,v):p(g)})},d),d<100&&(d+=10);return}p&&p(g)})}return Object.setPrototypeOf&&Object.setPrototypeOf(c,l),c}(e.rename)),e.read=typeof e.read!="function"?e.read:function(l){function c(f,h,p,_,d,v){var g;if(v&&typeof v=="function"){var E=0;g=function(z,O,X){if(z&&z.code==="EAGAIN"&&E<10)return E++,l.call(e,f,h,p,_,d,g);v.apply(this,arguments)}}return l.call(e,f,h,p,_,d,g)}return Object.setPrototypeOf&&Object.setPrototypeOf(c,l),c}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(l){return function(c,f,h,p,_){for(var d=0;;)try{return l.call(e,c,f,h,p,_)}catch(v){if(v.code==="EAGAIN"&&d<10){d++;continue}throw v}}}(e.readSync);function t(l){l.lchmod=function(c,f,h){l.open(c,he.O_WRONLY|he.O_SYMLINK,f,function(p,_){if(p){h&&h(p);return}l.fchmod(_,f,function(d){l.close(_,function(v){h&&h(d||v)})})})},l.lchmodSync=function(c,f){var h=l.openSync(c,he.O_WRONLY|he.O_SYMLINK,f),p=!0,_;try{_=l.fchmodSync(h,f),p=!1}finally{if(p)try{l.closeSync(h)}catch{}else l.closeSync(h)}return _}}function r(l){he.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(c,f,h,p){l.open(c,he.O_SYMLINK,function(_,d){if(_){p&&p(_);return}l.futimes(d,f,h,function(v){l.close(d,function(g){p&&p(v||g)})})})},l.lutimesSync=function(c,f,h){var p=l.openSync(c,he.O_SYMLINK),_,d=!0;try{_=l.futimesSync(p,f,h),d=!1}finally{if(d)try{l.closeSync(p)}catch{}else l.closeSync(p)}return _}):l.futimes&&(l.lutimes=function(c,f,h,p){p&&process.nextTick(p)},l.lutimesSync=function(){})}function i(l){return l&&function(c,f,h){return l.call(e,c,f,function(p){x(p)&&(p=null),h&&h.apply(this,arguments)})}}function n(l){return l&&function(c,f){try{return l.call(e,c,f)}catch(h){if(!x(h))throw h}}}function a(l){return l&&function(c,f,h,p){return l.call(e,c,f,h,function(_){x(_)&&(_=null),p&&p.apply(this,arguments)})}}function o(l){return l&&function(c,f,h){try{return l.call(e,c,f,h)}catch(p){if(!x(p))throw p}}}function s(l){return l&&function(c,f,h){typeof f=="function"&&(h=f,f=null);function p(_,d){d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),h&&h.apply(this,arguments)}return f?l.call(e,c,f,p):l.call(e,c,p)}}function u(l){return l&&function(c,f){var h=f?l.call(e,c,f):l.call(e,c);return h&&(h.uid<0&&(h.uid+=4294967296),h.gid<0&&(h.gid+=4294967296)),h}}function x(l){if(!l||l.code==="ENOSYS")return!0;var c=!process.getuid||process.getuid()!==0;return!!(c&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var Bi=m((rl,Ti)=>{var Ai=require("stream").Stream;Ti.exports=Os;function Os(e){return{ReadStream:t,WriteStream:r};function t(i,n){if(!(this instanceof t))return new t(i,n);Ai.call(this);var a=this;this.path=i,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,n=n||{};for(var o=Object.keys(n),s=0,u=o.length;s<u;s++){var x=o[s];this[x]=n[x]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){a._read()});return}e.open(this.path,this.flags,this.mode,function(l,c){if(l){a.emit("error",l),a.readable=!1;return}a.fd=c,a.emit("open",c),a._read()})}function r(i,n){if(!(this instanceof r))return new r(i,n);Ai.call(this),this.path=i,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,n=n||{};for(var a=Object.keys(n),o=0,s=a.length;o<s;o++){var u=a[o];this[u]=n[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Di=m((il,Ci)=>{"use strict";Ci.exports=Ts;var As=Object.getPrototypeOf||function(e){return e.__proto__};function Ts(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:As(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var Ii=m((nl,mr)=>{var N=require("fs"),Bs=Oi(),Cs=Bi(),Ds=Di(),Et=require("util"),W,Ft;typeof Symbol=="function"&&typeof Symbol.for=="function"?(W=Symbol.for("graceful-fs.queue"),Ft=Symbol.for("graceful-fs.previous")):(W="___graceful-fs.queue",Ft="___graceful-fs.previous");function Ps(){}function ki(e,t){Object.defineProperty(e,W,{get:function(){return t}})}var Se=Ps;Et.debuglog?Se=Et.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Se=function(){var e=Et.format.apply(Et,arguments);e="GFS4: "+e.split(/\n/).join(` GFS4: `),console.error(e)});N[W]||(Pi=global[W]||[],ki(N,Pi),N.close=function(e){function t(r,i){return e.call(N,r,function(n){n||qi(),typeof i=="function"&&i.apply(this,arguments)})}return Object.defineProperty(t,Ft,{value:e}),t}(N.close),N.closeSync=function(e){function t(r){e.apply(N,arguments),qi()}return Object.defineProperty(t,Ft,{value:e}),t}(N.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Se(N[W]),require("assert").equal(N[W].length,0)}));var Pi;global[W]||ki(global,N[W]);mr.exports=hr(Ds(N));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!N.__patched&&(mr.exports=hr(N),N.__patched=!0);function hr(e){Bs(e),e.gracefulify=hr,e.createReadStream=O,e.createWriteStream=X;var t=e.readFile;e.readFile=r;function r(y,w,b){return typeof w=="function"&&(b=w,w=null),C(y,w,b);function C(D,B,S,F){return t(D,B,function(R){R&&(R.code==="EMFILE"||R.code==="ENFILE")?De([C,[D,B,S],R,F||Date.now(),Date.now()]):typeof S=="function"&&S.apply(this,arguments)})}}var i=e.writeFile;e.writeFile=n;function n(y,w,b,C){return typeof b=="function"&&(C=b,b=null),D(y,w,b,C);function D(B,S,F,R,M){return i(B,S,F,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?De([D,[B,S,F,R],T,M||Date.now(),Date.now()]):typeof R=="function"&&R.apply(this,arguments)})}}var a=e.appendFile;a&&(e.appendFile=o);function o(y,w,b,C){return typeof b=="function"&&(C=b,b=null),D(y,w,b,C);function D(B,S,F,R,M){return a(B,S,F,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?De([D,[B,S,F,R],T,M||Date.now(),Date.now()]):typeof R=="function"&&R.apply(this,arguments)})}}var s=e.copyFile;s&&(e.copyFile=u);function u(y,w,b,C){return typeof b=="function"&&(C=b,b=0),D(y,w,b,C);function D(B,S,F,R,M){return s(B,S,F,function(T){T&&(T.code==="EMFILE"||T.code==="ENFILE")?De([D,[B,S,F,R],T,M||Date.now(),Date.now()]):typeof R=="function"&&R.apply(this,arguments)})}}var x=e.readdir;e.readdir=c;var l=/^v[0-5]\./;function c(y,w,b){typeof w=="function"&&(b=w,w=null);var C=l.test(process.version)?function(S,F,R,M){return x(S,D(S,F,R,M))}:function(S,F,R,M){return x(S,F,D(S,F,R,M))};return C(y,w,b);function D(B,S,F,R){return function(M,T){M&&(M.code==="EMFILE"||M.code==="ENFILE")?De([C,[B,S,F],M,R||Date.now(),Date.now()]):(T&&T.sort&&T.sort(),typeof F=="function"&&F.call(this,M,T))}}}if(process.version.substr(0,4)==="v0.8"){var f=Cs(e);v=f.ReadStream,E=f.WriteStream}var h=e.ReadStream;h&&(v.prototype=Object.create(h.prototype),v.prototype.open=g);var p=e.WriteStream;p&&(E.prototype=Object.create(p.prototype),E.prototype.open=z),Object.defineProperty(e,"ReadStream",{get:function(){return v},set:function(y){v=y},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return E},set:function(y){E=y},enumerable:!0,configurable:!0});var _=v;Object.defineProperty(e,"FileReadStream",{get:function(){return _},set:function(y){_=y},enumerable:!0,configurable:!0});var d=E;Object.defineProperty(e,"FileWriteStream",{get:function(){return d},set:function(y){d=y},enumerable:!0,configurable:!0});function v(y,w){return this instanceof v?(h.apply(this,arguments),this):v.apply(Object.create(v.prototype),arguments)}function g(){var y=this;j(y.path,y.flags,y.mode,function(w,b){w?(y.autoClose&&y.destroy(),y.emit("error",w)):(y.fd=b,y.emit("open",b),y.read())})}function E(y,w){return this instanceof E?(p.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function z(){var y=this;j(y.path,y.flags,y.mode,function(w,b){w?(y.destroy(),y.emit("error",w)):(y.fd=b,y.emit("open",b))})}function O(y,w){return new e.ReadStream(y,w)}function X(y,w){return new e.WriteStream(y,w)}var I=e.open;e.open=j;function j(y,w,b,C){return typeof b=="function"&&(C=b,b=null),D(y,w,b,C);function D(B,S,F,R,M){return I(B,S,F,function(T,P){T&&(T.code==="EMFILE"||T.code==="ENFILE")?De([D,[B,S,F,R],T,M||Date.now(),Date.now()]):typeof R=="function"&&R.apply(this,arguments)})}}return e}function De(e){Se("ENQUEUE",e[0].name,e[1]),N[W].push(e),pr()}var St;function qi(){for(var e=Date.now(),t=0;t<N[W].length;++t)N[W][t].length>2&&(N[W][t][3]=e,N[W][t][4]=e);pr()}function pr(){if(clearTimeout(St),St=void 0,N[W].length!==0){var e=N[W].shift(),t=e[0],r=e[1],i=e[2],n=e[3],a=e[4];if(n===void 0)Se("RETRY",t.name,r),t.apply(null,r);else if(Date.now()-n>=6e4){Se("TIMEOUT",t.name,r);var o=r.pop();typeof o=="function"&&o.call(null,i)}else{var s=Date.now()-a,u=Math.max(a-n,1),x=Math.min(u*1.2,100);s>=x?(Se("RETRY",t.name,r),t.apply(null,r.concat([n]))):N[W].push(e)}St===void 0&&(St=setTimeout(pr,0))}}});var _r=m((al,zi)=>{"use strict";zi.exports=e=>{let t=new Uint8Array(e);if(!(t&&t.length>1))return null;let r=(i,n)=>{n=Object.assign({offset:0},n);for(let a=0;a<i.length;a++)if(i[a]!==t[a+n.offset])return!1;return!0};if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([137,80,78,71,13,10,26,10]))return{ext:"png",mime:"image/png"};if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(r([87,69,66,80],{offset:8}))return{ext:"webp",mime:"image/webp"};if(r([70,76,73,70]))return{ext:"flif",mime:"image/flif"};if((r([73,73,42,0])||r([77,77,0,42]))&&r([67,82],{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(r([73,73,42,0])||r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([56,66,80,83]))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(r([80,75,3,4])&&r([109,105,109,101,116,121,112,101,97,112,112,108,105,99,97,116,105,111,110,47,101,112,117,98,43,122,105,112],{offset:30}))return{ext:"epub",mime:"application/epub+zip"};if(r([80,75,3,4])&&r([77,69,84,65,45,73,78,70,47,109,111,122,105,108,108,97,46,114,115,97],{offset:30}))return{ext:"xpi",mime:"application/x-xpinstall"};if(r([80,75])&&(t[2]===3||t[2]===5||t[2]===7)&&(t[3]===4||t[3]===6||t[3]===8))return{ext:"zip",mime:"application/zip"};if(r([117,115,116,97,114],{offset:257}))return{ext:"tar",mime:"application/x-tar"};if(r([82,97,114,33,26,7])&&(t[6]===0||t[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(r([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([0,0,0])&&(t[3]===24||t[3]===32)&&r([102,116,121,112],{offset:4})||r([51,103,112,53])||r([0,0,0,28,102,116,121,112,109,112,52,50])&&r([109,112,52,49,109,112,52,50,105,115,111,109],{offset:16})||r([0,0,0,28,102,116,121,112,105,115,111,109])||r([0,0,0,28,102,116,121,112,109,112,52,50,0,0,0,0]))return{ext:"mp4",mime:"video/mp4"};if(r([0,0,0,28,102,116,121,112,77,52,86]))return{ext:"m4v",mime:"video/x-m4v"};if(r([77,84,104,100]))return{ext:"mid",mime:"audio/midi"};if(r([26,69,223,163])){let i=t.subarray(4,4100),n=i.findIndex((a,o,s)=>s[o]===66&&s[o+1]===130);if(n>=0){let a=n+3,o=s=>Array.from(s).every((u,x)=>i[a+x]===u.charCodeAt(0));if(o("matroska"))return{ext:"mkv",mime:"video/x-matroska"};if(o("webm"))return{ext:"webm",mime:"video/webm"}}}return r([0,0,0,20,102,116,121,112,113,116,32,32])||r([102,114,101,101],{offset:4})||r([102,116,121,112,113,116,32,32],{offset:4})||r([109,100,97,116],{offset:4})||r([119,105,100,101],{offset:4})?{ext:"mov",mime:"video/quicktime"}:r([82,73,70,70])&&r([65,86,73],{offset:8})?{ext:"avi",mime:"video/x-msvideo"}:r([48,38,178,117,142,102,207,17,166,217])?{ext:"wmv",mime:"video/x-ms-wmv"}:r([0,0,1,186])?{ext:"mpg",mime:"video/mpeg"}:r([73,68,51])||r([255,251])?{ext:"mp3",mime:"audio/mpeg"}:r([102,116,121,112,77,52,65],{offset:4})||r([77,52,65,32])?{ext:"m4a",mime:"audio/m4a"}:r([79,112,117,115,72,101,97,100],{offset:28})?{ext:"opus",mime:"audio/opus"}:r([79,103,103,83])?{ext:"ogg",mime:"audio/ogg"}:r([102,76,97,67])?{ext:"flac",mime:"audio/x-flac"}:r([82,73,70,70])&&r([87,65,86,69],{offset:8})?{ext:"wav",mime:"audio/x-wav"}:r([35,33,65,77,82,10])?{ext:"amr",mime:"audio/amr"}:r([37,80,68,70])?{ext:"pdf",mime:"application/pdf"}:r([77,90])?{ext:"exe",mime:"application/x-msdownload"}:(t[0]===67||t[0]===70)&&r([87,83],{offset:1})?{ext:"swf",mime:"application/x-shockwave-flash"}:r([123,92,114,116,102])?{ext:"rtf",mime:"application/rtf"}:r([0,97,115,109])?{ext:"wasm",mime:"application/wasm"}:r([119,79,70,70])&&(r([0,1,0,0],{offset:4})||r([79,84,84,79],{offset:4}))?{ext:"woff",mime:"font/woff"}:r([119,79,70,50])&&(r([0,1,0,0],{offset:4})||r([79,84,84,79],{offset:4}))?{ext:"woff2",mime:"font/woff2"}:r([76,80],{offset:34})&&(r([0,0,1],{offset:8})||r([1,0,2],{offset:8})||r([2,0,2],{offset:8}))?{ext:"eot",mime:"application/octet-stream"}:r([0,1,0,0,0])?{ext:"ttf",mime:"font/ttf"}:r([79,84,84,79,0])?{ext:"otf",mime:"font/otf"}:r([0,0,1,0])?{ext:"ico",mime:"image/x-icon"}:r([70,76,86,1])?{ext:"flv",mime:"video/x-flv"}:r([37,33])?{ext:"ps",mime:"application/postscript"}:r([253,55,122,88,90,0])?{ext:"xz",mime:"application/x-xz"}:r([83,81,76,105])?{ext:"sqlite",mime:"application/x-sqlite3"}:r([78,69,83,26])?{ext:"nes",mime:"application/x-nintendo-nes-rom"}:r([67,114,50,52])?{ext:"crx",mime:"application/x-google-chrome-extension"}:r([77,83,67,70])||r([73,83,99,40])?{ext:"cab",mime:"application/vnd.ms-cab-compressed"}:r([33,60,97,114,99,104,62,10,100,101,98,105,97,110,45,98,105,110,97,114,121])?{ext:"deb",mime:"application/x-deb"}:r([33,60,97,114,99,104,62])?{ext:"ar",mime:"application/x-unix-archive"}:r([237,171,238,219])?{ext:"rpm",mime:"application/x-rpm"}:r([31,160])||r([31,157])?{ext:"Z",mime:"application/x-compress"}:r([76,90,73,80])?{ext:"lz",mime:"application/x-lzip"}:r([208,207,17,224,161,177,26,225])?{ext:"msi",mime:"application/x-msi"}:r([6,14,43,52,2,5,1,1,13,1,2,1,1,2])?{ext:"mxf",mime:"application/mxf"}:r([71],{offset:4})&&(r([71],{offset:192})||r([71],{offset:196}))?{ext:"mts",mime:"video/mp2t"}:r([66,76,69,78,68,69,82])?{ext:"blend",mime:"application/x-blender"}:r([66,80,71,251])?{ext:"bpg",mime:"image/bpg"}:null}});var Rt=m((ol,Ni)=>{"use strict";var oe=Ni.exports=function(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"};oe.writable=function(e){return oe(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"};oe.readable=function(e){return oe(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object"};oe.duplex=function(e){return oe.writable(e)&&oe.readable(e)};oe.transform=function(e){return oe.duplex(e)&&typeof e._transform=="function"&&typeof e._transformState=="object"}});var Ke=m((sl,yr)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?yr.exports={nextTick:qs}:yr.exports=process;function qs(e,t,r,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,a,o;switch(n){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,i)});default:for(a=new Array(n-1),o=0;o<a.length;)a[o++]=arguments[o];return process.nextTick(function(){e.apply(null,a)})}}});var ji=m((fl,Li)=>{var ks={}.toString;Li.exports=Array.isArray||function(e){return ks.call(e)=="[object Array]"}});var vr=m((ul,Mi)=>{Mi.exports=require("stream")});var Xe=m((gr,Wi)=>{var Ot=require("buffer"),se=Ot.Buffer;function Ui(e,t){for(var r in e)t[r]=e[r]}se.from&&se.alloc&&se.allocUnsafe&&se.allocUnsafeSlow?Wi.exports=Ot:(Ui(Ot,gr),gr.Buffer=Pe);function Pe(e,t,r){return se(e,t,r)}Ui(se,Pe);Pe.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return se(e,t,r)};Pe.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=se(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Pe.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return se(e)};Pe.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Ot.SlowBuffer(e)}});var qe=m(Z=>{function Is(e){return Array.isArray?Array.isArray(e):At(e)==="[object Array]"}Z.isArray=Is;function zs(e){return typeof e=="boolean"}Z.isBoolean=zs;function Ns(e){return e===null}Z.isNull=Ns;function Ls(e){return e==null}Z.isNullOrUndefined=Ls;function js(e){return typeof e=="number"}Z.isNumber=js;function Ms(e){return typeof e=="string"}Z.isString=Ms;function Us(e){return typeof e=="symbol"}Z.isSymbol=Us;function Ws(e){return e===void 0}Z.isUndefined=Ws;function Hs(e){return At(e)==="[object RegExp]"}Z.isRegExp=Hs;function $s(e){return typeof e=="object"&&e!==null}Z.isObject=$s;function Gs(e){return At(e)==="[object Date]"}Z.isDate=Gs;function Zs(e){return At(e)==="[object Error]"||e instanceof Error}Z.isError=Zs;function Ys(e){return typeof e=="function"}Z.isFunction=Ys;function Ks(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}Z.isPrimitive=Ks;Z.isBuffer=require("buffer").Buffer.isBuffer;function At(e){return Object.prototype.toString.call(e)}});var Hi=m((cl,wr)=>{typeof Object.create=="function"?wr.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:wr.exports=function(t,r){if(r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}}});var ke=m((xl,Er)=>{try{if(br=require("util"),typeof br.inherits!="function")throw"";Er.exports=br.inherits}catch{Er.exports=Hi()}var br});var Gi=m((dl,Sr)=>{"use strict";function Xs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var $i=Xe().Buffer,Ve=require("util");function Vs(e,t,r){e.copy(t,r)}Sr.exports=function(){function e(){Xs(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n},e.prototype.concat=function(r){if(this.length===0)return $i.alloc(0);for(var i=$i.allocUnsafe(r>>>0),n=this.head,a=0;n;)Vs(n.data,i,a),a+=n.data.length,n=n.next;return i},e}();Ve&&Ve.inspect&&Ve.inspect.custom&&(Sr.exports.prototype[Ve.inspect.custom]=function(){var e=Ve.inspect({length:this.length});return this.constructor.name+" "+e})});var Fr=m((hl,Zi)=>{"use strict";var Tt=Ke();function Qs(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Tt.nextTick(Bt,this,e)):Tt.nextTick(Bt,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(a){!t&&a?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,Tt.nextTick(Bt,r,a)):Tt.nextTick(Bt,r,a):t&&t(a)}),this)}function Js(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Bt(e,t){e.emit("error",t)}Zi.exports={destroy:Qs,undestroy:Js}});var Ki=m((pl,Yi)=>{Yi.exports=require("util").deprecate});var Or=m((ml,nn)=>{"use strict";var Fe=Ke();nn.exports=U;function Vi(e){var t=this;this.next=null,this.entry=null,this.finish=function(){_0(t,e)}}var e0=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:Fe.nextTick,Ie;U.WritableState=Je;var Qi=Object.create(qe());Qi.inherits=ke();var t0={deprecate:Ki()},Ji=vr(),Dt=Xe().Buffer,r0=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i0(e){return Dt.from(e)}function n0(e){return Dt.isBuffer(e)||e instanceof r0}var en=Fr();Qi.inherits(U,Ji);function a0(){}function Je(e,t){Ie=Ie||Re(),e=e||{};var r=t instanceof Ie;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,n=e.writableHighWaterMark,a=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:r&&(n||n===0)?this.highWaterMark=n:this.highWaterMark=a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(s){x0(t,s)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Vi(this)}Je.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(Je.prototype,"buffer",{get:t0.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Ct;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ct=Function.prototype[Symbol.hasInstance],Object.defineProperty(U,Symbol.hasInstance,{value:function(e){return Ct.call(this,e)?!0:this!==U?!1:e&&e._writableState instanceof Je}})):Ct=function(e){return e instanceof this};function U(e){if(Ie=Ie||Re(),!Ct.call(U,this)&&!(this instanceof Ie))return new U(e);this._writableState=new Je(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),Ji.call(this)}U.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function o0(e,t){var r=new Error("write after end");e.emit("error",r),Fe.nextTick(t,r)}function s0(e,t,r,i){var n=!0,a=!1;return r===null?a=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),Fe.nextTick(i,a),n=!1),n}U.prototype.write=function(e,t,r){var i=this._writableState,n=!1,a=!i.objectMode&&n0(e);return a&&!Dt.isBuffer(e)&&(e=i0(e)),typeof t=="function"&&(r=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=a0),i.ended?o0(this,r):(a||s0(this,i,e,r))&&(i.pendingcb++,n=u0(this,i,a,e,t,r)),n};U.prototype.cork=function(){var e=this._writableState;e.corked++};U.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&tn(this,e))};U.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function f0(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Dt.from(t,r)),t}Object.defineProperty(U.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function u0(e,t,r,i,n,a){if(!r){var o=f0(t,i,n);i!==o&&(r=!0,n="buffer",i=o)}var s=t.objectMode?1:i.length;t.length+=s;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var x=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:a,next:null},x?x.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Rr(e,t,!1,s,i,n,a);return u}function Rr(e,t,r,i,n,a,o){t.writelen=i,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,a,t.onwrite),t.sync=!1}function l0(e,t,r,i,n){--t.pendingcb,r?(Fe.nextTick(n,i),Fe.nextTick(Qe,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),Qe(e,t))}function c0(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function x0(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(c0(r),t)l0(e,r,i,t,n);else{var a=rn(r);!a&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&tn(e,r),i?e0(Xi,e,r,a,n):Xi(e,r,a,n)}}function Xi(e,t,r,i){r||d0(e,t),t.pendingcb--,i(),Qe(e,t)}function d0(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function tn(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),a=t.corkedRequestsFree;a.entry=r;for(var o=0,s=!0;r;)n[o]=r,r.isBuf||(s=!1),r=r.next,o+=1;n.allBuffers=s,Rr(e,t,!0,t.length,n,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,a.next?(t.corkedRequestsFree=a.next,a.next=null):t.corkedRequestsFree=new Vi(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,x=r.encoding,l=r.callback,c=t.objectMode?1:u.length;if(Rr(e,t,!1,c,u,x,l),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}U.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};U.prototype._writev=null;U.prototype.end=function(e,t,r){var i=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||m0(this,i,r)};function rn(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function h0(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),Qe(e,t)})}function p0(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,Fe.nextTick(h0,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Qe(e,t){var r=rn(t);return r&&(p0(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function m0(e,t,r){t.ending=!0,Qe(e,t),r&&(t.finished?Fe.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function _0(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(U.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});U.prototype.destroy=en.destroy;U.prototype._undestroy=en.undestroy;U.prototype._destroy=function(e,t){this.end(),t(e)}});var Re=m((_l,fn)=>{"use strict";var an=Ke(),y0=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};fn.exports=fe;var on=Object.create(qe());on.inherits=ke();var sn=Br(),Tr=Or();on.inherits(fe,sn);for(Ar=y0(Tr.prototype),Pt=0;Pt<Ar.length;Pt++)qt=Ar[Pt],fe.prototype[qt]||(fe.prototype[qt]=Tr.prototype[qt]);var Ar,qt,Pt;function fe(e){if(!(this instanceof fe))return new fe(e);sn.call(this,e),Tr.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",v0)}Object.defineProperty(fe.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function v0(){this.allowHalfOpen||this._writableState.ended||an.nextTick(g0,this)}function g0(e){e.end()}Object.defineProperty(fe.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===v