docker-build-push/dist/index.js

32 lines
1.9 MiB
JavaScript
Raw Normal View History

require('./sourcemap-register.js');(()=>{var __webpack_modules__={7799:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){if(i===undefined)i=r;var s=Object.getOwnPropertyDescriptor(t,r);if(!s||("get"in s?!t.__esModule:s.writable||s.configurable)){s={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,i,s)}:function(e,t,r,i){if(i===undefined)i=r;e[i]=t[r]});var s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))i(t,e,r);s(t,e);return t};var a=this&&this.__awaiter||function(e,t,r,i){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(i.next(e))}catch(e){s(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});t.saveCache=t.restoreCache=t.isFeatureAvailable=t.ReserveCacheError=t.ValidationError=void 0;const o=n(r(2186));const l=n(r(1017));const c=n(r(1518));const p=n(r(8245));const d=r(6490);class ValidationError extends Error{constructor(e){super(e);this.name="ValidationError";Object.setPrototypeOf(this,ValidationError.prototype)}}t.ValidationError=ValidationError;class ReserveCacheError extends Error{constructor(e){super(e);this.name="ReserveCacheError";Object.setPrototypeOf(this,ReserveCacheError.prototype)}}t.ReserveCacheError=ReserveCacheError;function checkPaths(e){if(!e||e.length===0){throw new ValidationError(`Path Validation Error: At least one directory or file path is required`)}}function checkKey(e){if(e.length>512){throw new ValidationError(`Key Validation Error: ${e} cannot be larger than 512 characters.`)}const t=/^[^,]*$/;if(!t.test(e)){throw new ValidationError(`Key Validation Error: ${e} cannot contain commas.`)}}function isFeatureAvailable(){return!!process.env["ACTIONS_CACHE_URL"]}t.isFeatureAvailable=isFeatureAvailable;function restoreCache(e,t,r,i,s=false){return a(this,void 0,void 0,(function*(){checkPaths(e);r=r||[];const n=[t,...r];o.debug("Resolved Keys:");o.debug(JSON.stringify(n));if(n.length>10){throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`)}for(const e of n){checkKey(e)}const a=yield c.getCompressionMethod();let A="";try{const t=yield p.getCacheEntry(n,e,{compressionMethod:a,enableCrossOsArchive:s});if(!(t===null||t===void 0?void 0:t.archiveLocation)){return undefined}if(i===null||i===void 0?void 0:i.lookupOnly){o.info("Lookup only - skipping download");return t.cacheKey}A=l.join(yield c.createTempDirectory(),c.getCacheFileName(a));o.debug(`Archive Path: ${A}`);yield p.downloadCache(t.archiveLocation,A,i);if(o.isDebug()){yield(0,d.listTar)(A,a)}const r=c.getArchiveFileSizeInBytes(A);o.info(`Cache Size: ~${Math.round(r/(1024*1024))} MB (${r} B)`);yield(0,d.extractTar)(A,a);o.info("Cache restored successfully");return t.cacheKey}catch(e){const t=e;if(t.name===ValidationError.name){throw e}else{o.warning(`Failed to restore: ${e.message}`)}}finally{try{yield c.unlinkFile(A)}catch(e){o.debug(`Failed to delete archive: ${e}`)}}return undefined}))}t.restoreCache=restoreCache;function saveCache(e,t,r,i=false){var s,n,A,u,m;return a(this,void 0,void 0,(function*(){checkPaths(e);checkKey(t);const a=yield c.getCompressionMethod();let h=-1;const g=yield c.resolvePaths(e);o.debug("Cache Paths:");o.debug(`${JSON.stringify(g)}`);if(g.length===0){throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`)}const E=yield c.createTempDirectory();const y=l.join(E,c.getCacheFileName(a));o.debug(`Archive Path: ${y}`);try{yield(0,d.createTar)(E,g,a);if(o.isDebug()){yield(0,d.listTar)(y,a)}const l=10*1024*1024*1024;cons
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,r;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;r=t.prototype;if(isObject(r)===false)return false;if(r.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},7426:(e,t,r)=>{
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*/
e.exports=r(3765)},3583:(e,t,r)=>{"use strict";
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/var i=r(7426);var s=r(1017).extname;var n=/^\s*([^;\s]*)(?:;|\s|$)/;var a=/^text\//i;t.charset=charset;t.charsets={lookup:charset};t.contentType=contentType;t.extension=extension;t.extensions=Object.create(null);t.lookup=lookup;t.types=Object.create(null);populateMaps(t.extensions,t.types);function charset(e){if(!e||typeof e!=="string"){return false}var t=n.exec(e);var r=t&&i[t[1].toLowerCase()];if(r&&r.charset){return r.charset}if(t&&a.test(t[1])){return"UTF-8"}return false}function contentType(e){if(!e||typeof e!=="string"){return false}var r=e.indexOf("/")===-1?t.lookup(e):e;if(!r){return false}if(r.indexOf("charset")===-1){var i=t.charset(r);if(i)r+="; charset="+i.toLowerCase()}return r}function extension(e){if(!e||typeof e!=="string"){return false}var r=n.exec(e);var i=r&&t.extensions[r[1].toLowerCase()];if(!i||!i.length){return false}return i[0]}function lookup(e){if(!e||typeof e!=="string"){return false}var r=s("x."+e).toLowerCase().substr(1);if(!r){return false}return t.types[r]||false}function populateMaps(e,t){var r=["nginx","apache",undefined,"iana"];Object.keys(i).forEach((function forEachMimeType(s){var n=i[s];var a=n.extensions;if(!a||!a.length){return}e[s]=a;for(var o=0;o<a.length;o++){var l=a[o];if(t[l]){var c=r.indexOf(i[t[l]].source);var p=r.indexOf(n.source);if(t[l]!=="application/octet-stream"&&(c>p||c===p&&t[l].substr(0,12)==="application/")){continue}}t[l]=s}}))}},3973:(e,t,r)=>{e.exports=minimatch;minimatch.Minimatch=Minimatch;var i=function(){try{return r(1017)}catch(e){}}()||{sep:"/"};minimatch.sep=i.sep;var s=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var n=r(3717);var a={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var o="[^/]";var l=o+"*?";var c="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var p="(?:(?!(?:\\/|^)\\.).)*?";var d=charSet("().*{}+?[]^$\\!");function charSet(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var A=/\/+/;minimatch.filter=filter;function filter(e,t){t=t||{};return function(r,i,s){return minimatch(r,e,t)}}function ext(e,t){t=t||{};var r={};Object.keys(e).forEach((function(t){r[t]=e[t]}));Object.keys(t).forEach((function(e){r[e]=t[e]}));return r}minimatch.defaults=function(e){if(!e||typeof e!=="object"||!Object.keys(e).length){return minimatch}var t=minimatch;var r=function minimatch(r,i,s){return t(r,i,ext(e,s))};r.Minimatch=function Minimatch(r,i){return new t.Minimatch(r,ext(e,i))};r.Minimatch.defaults=function defaults(r){return t.defaults(ext(e,r)).Minimatch};r.filter=function filter(r,i){return t.filter(r,ext(e,i))};r.defaults=function defaults(r){return t.defaults(ext(e,r))};r.makeRe=function makeRe(r,i){return t.makeRe(r,ext(e,i))};r.braceExpand=function braceExpand(r,i){return t.braceExpand(r,ext(e,i))};r.match=function(r,i,s){return t.match(r,i,ext(e,s))};return r};Minimatch.defaults=function(e){return minimatch.defaults(e).Minimatch};function minimatch(e,t,r){assertValidPattern(t);if(!r)r={};if(!r.nocomment&&t.charAt(0)==="#"){return false}return new Minimatch(t,r).match(e)}function Minimatch(e,t){if(!(this instanceof Minimatch)){return new Minimatch(e,t)}assertValidPattern(e);if(!t)t={};e=e.trim();if(!t.allowWindowsEscape&&i.sep!=="/"){e=e.split(i.sep).join("/")}this.options=t;this.set=[];this.pattern=e;this.regexp=null;this.negate=false;this.comment=false;this.empty=false;this.partial=!!t.partial;this.make()}Minimatch.prototype.debug=function(){};Minimatch.prototype.make=make;function make(){var e=this.pattern;var t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=true;return}if(!e){this.empty=true;return}this.parseNegate();var r=this.globSet=this.braceExpand();if(t.debug)this.debug=function debug(){console.error.apply(console,arguments)};this.debug(this.pattern,r);r=this.globParts=r.map((function(e){return e.split(A)}));this.debug(this.pattern,r);r=r.map((function(e,t,r){return e.map(this.parse,this)}),this);this.debug(this.pattern,r);r=r.filter((function(e){return e.indexOf(false)===-1}));this.debug(this.pattern,r);thi
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */if(!String.fromCodePoint){(function(){var e=String.fromCharCode;var t=Math.floor;var fromCodePoint=function(){var r=16384;var i=[];var s;var n;var a=-1;var o=arguments.length;if(!o){return""}var l="";while(++a<o){var c=Number(arguments[a]);if(!isFinite(c)||c<0||c>1114111||t(c)!==c){throw RangeError("Invalid code point: "+c)}if(c<=65535){i.push(c)}else{c-=65536;s=(c>>10)+55296;n=c%1024+56320;i.push(s,n)}if(a+1===o||i.length>r){l+=e.apply(null,i);i.length=0}}return l};if(Object.defineProperty){Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:true,writable:true})}else{String.fromCodePoint=fromCodePoint}})()}})(false?0:t)},5911:(e,t)=>{t=e.exports=SemVer;var r;if(typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)){r=function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER");console.log.apply(console,e)}}else{r=function(){}}t.SEMVER_SPEC_VERSION="2.0.0";var i=256;var s=Number.MAX_SAFE_INTEGER||9007199254740991;var n=16;var a=i-6;var o=t.re=[];var l=t.safeRe=[];var c=t.src=[];var p=t.tokens={};var d=0;function tok(e){p[e]=d++}var A="[a-zA-Z0-9-]";var u=[["\\s",1],["\\d",i],[A,a]];function makeSafeRe(e){for(var t=0;t<u.length;t++){var r=u[t][0];var i=u[t][1];e=e.split(r+"*").join(r+"{0,"+i+"}").split(r+"+").join(r+"{1,"+i+"}")}return e}tok("NUMERICIDENTIFIER");c[p.NUMERICIDENTIFIER]="0|[1-9]\\d*";tok("NUMERICIDENTIFIERLOOSE");c[p.NUMERICIDENTIFIERLOOSE]="\\d+";tok("NONNUMERICIDENTIFIER");c[p.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-]"+A+"*";tok("MAINVERSION");c[p.MAINVERSION]="("+c[p.NUMERICIDENTIFIER]+")\\."+"("+c[p.NUMERICIDENTIFIER]+")\\."+"("+c[p.NUMERICIDENTIFIER]+")";tok("MAINVERSIONLOOSE");c[p.MAINVERSIONLOOSE]="("+c[p.NUMERICIDENTIFIERLOOSE]+")\\."+"("+c[p.NUMERICIDENTIFIERLOOSE]+")\\."+"("+c[p.NUMERICIDENTIFIERLOOSE]+")";tok("PRERELEASEIDENTIFIER");c[p.PRERELEASEIDENTIFIER]="(?:"+c[p.NUMERICIDENTIFIER]+"|"+c[p.NONNUMERICIDENTIFIER]+")";tok("PRERELEASEIDENTIFIERLOOSE");c[p.PRERELEASEIDENTIFIERLOOSE]="(?:"+c[p.NUMERICIDENTIFIERLOOSE]+"|"+c[p.NONNUMERICIDENTIFIER]+")";tok("PRERELEASE");c[p.PRERELEASE]="(?:-("+c[p.PRERELEASEIDENTIFIER]+"(?:\\."+c[p.PRERELEASEIDENTIFIER]+")*))";tok("PRERELEASELOOSE");c[p.PRERELEASELOOSE]="(?:-?("+c[p.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+c[p.PRERELEASEIDENTIFIERLOOSE]+")*))";tok("BUILDIDENTIFIER");c[p.BUILDIDENTIFIER]=A+"+";tok("BUILD");c[p.BUILD]="(?:\\+("+c[p.BUILDIDENTIFIER]+"(?:\\."+c[p.BUILDIDENTIFIER]+")*))";tok("FULL");tok("FULLPLAIN");c[p.FULLPLAIN]="v?"+c[p.MAINVERSION]+c[p.PRERELEASE]+"?"+c[p.BUILD]+"?";c[p.FULL]="^"+c[p.FULLPLAIN]+"$";tok("LOOSEPLAIN");c[p.LOOSEPLAIN]="[v=\\s]*"+c[p.MAINVERSIONLOOSE]+c[p.PRERELEASELOOSE]+"?"+c[p.BUILD]+"?";tok("LOOSE");c[p.LOOSE]="^"+c[p.LOOSEPLAIN]+"$";tok("GTLT");c[p.GTLT]="((?:<|>)?=?)";tok("XRANGEIDENTIFIERLOOSE");c[p.XRANGEIDENTIFIERLOOSE]=c[p.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";tok("XRANGEIDENTIFIER");c[p.XRANGEIDENTIFIER]=c[p.NUMERICIDENTIFIER]+"|x|X|\\*";tok("XRANGEPLAIN");c[p.XRANGEPLAIN]="[v=\\s]*("+c[p.XRANGEIDENTIFIER]+")"+"(?:\\.("+c[p.XRANGEIDENTIFIER]+")"+"(?:\\.("+c[p.XRANGEIDENTIFIER]+")"+"(?:"+c[p.PRERELEASE]+")?"+c[p.BUILD]+"?"+")?)?";tok("XRANGEPLAINLOOSE");c[p.XRANGEPLAINLOOSE]="[v=\\s]*("+c[p.XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+c[p.XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+c[p.XRANGEIDENTIFIERLOOSE]+")"+"(?:"+c[p.PRERELEASELOOSE]+")?"+c[p.BUILD]+"?"+")?)?";tok("XRANGE");c[p.XRANGE]="^"+c[p.GTLT]+"\\s*"+c[p.XRANGEPLAIN]+"$";tok("XRANGELOOSE");c[p.XRANGELOOSE]="^"+c[p.GTLT]+"\\s*"+c[p.XRANGEPLAINLOOSE]+"$";tok("COERCE");c[p.COERCE]="(^|[^\\d])"+"(\\d{1,"+n+"})"+"(?:\\.(\\d{1,"+n+"}))?"+"(?:\\.(\\d{1,"+n+"}))?"+"(?:$|[^\\d])";tok("COERCERTL");o[p.COERCERTL]=new RegExp(c[p.COERCE],"g");l[p.COERCERTL]=new RegExp(makeSafeRe(c[p.COERCE]),"g");tok("LONETILDE");c[p.LONETILDE]="(?:~>?)";tok("TILDETRIM");c[p.TILDETRIM]="(\\s*)"+c[p.LONETILDE]+"\\s+";o[p.TILDETRIM]=new RegExp(c[p.TILDETRIM],"g");l[p.TILDETRIM]=new RegExp(makeSafeRe(c[p.TILDETRIM]),"g");var m="$1~";tok("TILDE");c[p.TILDE]="^"+c
/*!
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/
const i=r(7147);const s=r(2037);const n=r(1017);const a=r(6113);const o={fs:i.constants,os:s.constants};const l="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c=/XXXXXX/,p=3,d=(o.O_CREAT||o.fs.O_CREAT)|(o.O_EXCL||o.fs.O_EXCL)|(o.O_RDWR||o.fs.O_RDWR),A=s.platform()==="win32",u=o.EBADF||o.os.errno.EBADF,m=o.ENOENT||o.os.errno.ENOENT,h=448,g=384,E="exit",y=[],C=i.rmdirSync.bind(i);let b=false;function rimraf(e,t){return i.rm(e,{recursive:true},t)}function FN_RIMRAF_SYNC(e){return i.rmSync(e,{recursive:true})}function tmpName(e,t){const r=_parseArguments(e,t),s=r[0],n=r[1];try{_assertAndSanitizeOptions(s)}catch(e){return n(e)}let a=s.tries;(function _getUniqueName(){try{const e=_generateTmpName(s);i.stat(e,(function(t){if(!t){if(a-- >0)return _getUniqueName();return n(new Error("Could not get a unique tmp filename, max tries reached "+e))}n(null,e)}))}catch(e){n(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let s=r.tries;do{const e=_generateTmpName(r);try{i.statSync(e)}catch(t){return e}}while(s-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(e,t){const r=_parseArguments(e,t),s=r[0],n=r[1];tmpName(s,(function _tmpNameCreated(e,t){if(e)return n(e);i.open(t,d,s.mode||g,(function _fileCreated(e,r){if(e)return n(e);if(s.discardDescriptor){return i.close(r,(function _discardCallback(e){return n(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,s,false))}))}else{const e=s.discardDescriptor||s.detachDescriptor;n(null,t,r,_prepareTmpFileRemoveCallback(t,e?-1:r,s,false))}}))}))}function fileSync(e){const t=_parseArguments(e),r=t[0];const s=r.discardDescriptor||r.detachDescriptor;const n=tmpNameSync(r);var a=i.openSync(n,d,r.mode||g);if(r.discardDescriptor){i.closeSync(a);a=undefined}return{name:n,fd:a,removeCallback:_prepareTmpFileRemoveCallback(n,s?-1:a,r,true)}}function dir(e,t){const r=_parseArguments(e,t),s=r[0],n=r[1];tmpName(s,(function _tmpNameCreated(e,t){if(e)return n(e);i.mkdir(t,s.mode||h,(function _dirCreated(e){if(e)return n(e);n(null,t,_prepareTmpDirRemoveCallback(t,s,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const s=tmpNameSync(r);i.mkdirSync(s,r.mode||h);return{name:s,removeCallback:_prepareTmpDirRemoveCallback(s,r,true)}}function _removeFileAsync(e,t){const _handler=function(e){if(e&&!_isENOENT(e)){return t(e)}t()};if(0<=e[0])i.close(e[0],(function(){i.unlink(e[1],_handler)}));else i.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])i.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{i.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,i){const s=_prepareRemoveCallback(_removeFileSync,[t,e],i);const n=_prepareRemoveCallback(_removeFileAsync,[t,e],i,s);if(!r.keep)y.unshift(s);return i?s:n}function _prepareTmpDirRemoveCallback(e,t,r){const s=t.unsafeCleanup?rimraf:i.rmdir.bind(i);const n=t.unsafeCleanup?FN_RIMRAF_SYNC:C;const a=_prepareRemoveCallback(n,e,r);const o=_prepareRemoveCallback(s,e,r,a);if(!t.keep)y.unshift(a);return r?a:o}function _prepareRemoveCallback(e,t,r,i){let s=false;return function _cleanupCallback(n){if(!s){const a=i||_cleanupCallback;const o=y.indexOf(a);if(o>=0)y.splice(o,1);s=true;if(r||e===C||e===FN_RIMRAF_SYNC){return e(t)}else{return e(t,n||function(){})}}}}function _garbageCollector(){if(!b)return;while(y.length){try{y[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=a.randomBytes(e)}catch(t){r=a.pseudoRandomBytes(e)}for(var i=0;i<e;i++){t.push(l[r[i]%l.length])}return t.join("")}function _isBlank(e){return e===null||_isUndefined(e)||!e.trim()}function _isUndefined(e){return typeof e==="undefined"}function _parseArguments(e,t){if(typeof e==="function"){return[{},e]}if(_isUndefined(e)){return[{},t]}const r={};for(const t of Object.getOwnPropertyNames(e)){r[t]=e[t]}return[r,t]}function _generateTmpName(e){const t=e.tmpdir;if(!_isUndefined(e.name))return n.join(t,e.dir,e.name);if(!_isUndefined(e.template))return n.join(t,e.dir,e.t
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=e=>e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=e=>e.replace(/\r?\n|\r/g,"\r\n");const i=[];const s=new Uint8Array([13,10]);d=0;let n=false;for(const[t,a]of e){if(typeof a==="string"){const e=N.encode(r+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(a)}\r\n`);i.push(e);d+=e.byteLength}else{const e=N.encode(`${r}; name="${escape(normalizeLinefeeds(t))}"`+(a.name?`; filename="${escape(a.name)}"`:"")+"\r\n"+`Content-Type: ${a.type||"application/octet-stream"}\r\n\r\n`);i.push(e,a,s);if(typeof a.size==="number"){d+=e.byteLength+a.size+s.byteLength}else{n=true}}}const a=N.encode(`--${t}--`);i.push(a);d+=a.byteLength;if(n){d=null}p=e;c=async function*(){for(const e of i){if(e.stream){yield*e.stream()}else{yield e}}};A="multipart/form-data; boundary="+t}else if(a(e)){p=e;d=e.size;if(e.type){A=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(s.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}i=e instanceof S?e:n(e)}if(typeof p==="string"||s.isBuffer(p)){d=Buffer.byteLength(p)}if(c!=null){let t;i=new S({async start(){t=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:r,done:s}=await t.next();if(s){queueMicrotask((()=>{e.close()}))}else{if(!b(i)){e.enqueue(new Uint8Array(r))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const u={stream:i,source:p,length:d};return[u,A]}function safelyExtractBody(e,t=false){if(!S){S=r(5356).ReadableStream}if(e instanceof S){C(!s.isDisturbed(e),"The body has already been consumed.");C(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,r]=e.stream.tee();const i=h(r,{transfer:[r]});const[,s]=i.tee();e.stream=t;return{stream:s,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(I(e)){yield e}else{const t=e.stream;if(s.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[y]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new m("The operation was aborted.","AbortError")}}function bodyMixinMethods(e){const t={blob(){return specConsumeBody(this,(e=>{let t=bodyMimeType(this);if(t==="failure"){t=""}else if(t){t=w(t)}return new g([e],{type:t})}),e)},arrayBuffer(){return specConsumeBody(this,(e=>new Uint8Array(e).buffer),e)},text(){return specConsumeBody(this,utf8DecodeBytes,e)},json(){return specConsumeBody(this,parseJSONFromBytes,e)},async formData(){u.brandCheck(this,e);throwIfAborted(this[A]);const t=this.headers.get("Content-Type");if(/multipart\/form-data/.test(t)){const e={};for(const[t,r]of this.headers)e[t.toLowerCase()]=r;const t=new d;let r;try{r=new i({headers:e,preservePath:true})}catch(e){throw new m(`${e}`,"AbortError")}r.on("field",((e,r)=>{t.append(e,r)}));r.on("file",((e,r,i,s,n)=>{const a=[];if(s==="base64"||s.toLowerCase()==="base64"){let s="";r.on("data",(e=>{s+=e.toString().replace(/[\r\n]/gm,"");const t=s.length-s.length%4;a.push(Buffer.from(s.slice(0,t),"base64"));s=s.slice(t)}));r.on("end",(()=>{a.push(Buffer.from(s,"base64"));t.append(e,new x(a,i,{type:n}))}))}else{r.on("data",(e=>{a.push(e)}));r.on("end",(()=>{t.append(e,new x(a,i,{type:n}))}))}}));const s=new Promise(((e,t)=>{r.on("finish",e);r.on("error",(e=>t(new TypeError(e))))}));if(this.body!==null)for await(const e of consumeBody(this[A].body))r.write(e);r.end();await s;return t}else if(/application\/x-www-form-urlencoded/.test(t)){let e;try{let t="";const r=new TextDecoder("utf-8",{ignoreBOM:true});for await(const e of consumeBody(this[A].body)){if(!I(e)){throw new TypeError("Expected Uint8Array chunk")}t+=r.decode(e,{stream:true})}t+=r.decode();e=new URLSearchParams(t)}catch(e){throw Object.assign(new TypeError,{cause:e})}const t=new d;for(const[r,i]of e){t.append(r,i)}return t}else{await Promise.resolve();throwIfAborted(this[A]);throw u.errors.exception({he
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */n[s-4]=this.maskKey[0];n[s-3]=this.maskKey[1];n[s-2]=this.maskKey[2];n[s-1]=this.maskKey[3];n[1]=r;if(r===126){n.writeUInt16BE(t,2)}else if(r===127){n[2]=n[3]=0;n.writeUIntBE(t,4,6)}n[1]|=128;for(let e=0;e<t;e++){n[s+e]=this.frameData[e]^this.maskKey[e%4]}return n}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,r)=>{"use strict";const{Writable:i}=r(2781);const s=r(7643);const{parserStates:n,opcodes:a,states:o,emptyBuffer:l}=r(9188);const{kReadyState:c,kSentClose:p,kResponse:d,kReceivedClose:A}=r(7578);const{isValidStatusCode:u,failWebsocketConnection:m,websocketMessageReceived:h}=r(5515);const{WebsocketFrameSend:g}=r(5444);const E={};E.ping=s.channel("undici:websocket:ping");E.pong=s.channel("undici:websocket:pong");class ByteParser extends i{#a=[];#o=0;#l=n.INFO;#c={};#p=[];constructor(e){super();this.ws=e}_write(e,t,r){this.#a.push(e);this.#o+=e.length;this.run(r)}run(e){while(true){if(this.#l===n.INFO){if(this.#o<2){return e()}const t=this.consume(2);this.#c.fin=(t[0]&128)!==0;this.#c.opcode=t[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==a.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==a.BINARY&&this.#c.opcode!==a.TEXT){m(this.ws,"Invalid frame type was fragmented.");return}const r=t[1]&127;if(r<=125){this.#c.payloadLength=r;this.#l=n.READ_DATA}else if(r===126){this.#l=n.PAYLOADLENGTH_16}else if(r===127){this.#l=n.PAYLOADLENGTH_64}if(this.#c.fragmented&&r>125){m(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===a.PING||this.#c.opcode===a.PONG||this.#c.opcode===a.CLOSE)&&r>125){m(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===a.CLOSE){if(r===1){m(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(r);this.#c.closeInfo=this.parseCloseBody(false,e);if(!this.ws[p]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new g(e);this.ws[d].socket.write(t.createFrame(a.CLOSE),(e=>{if(!e){this.ws[p]=true}}))}this.ws[c]=o.CLOSING;this.ws[A]=true;this.end();return}else if(this.#c.opcode===a.PING){const t=this.consume(r);if(!this.ws[A]){const e=new g(t);this.ws[d].socket.write(e.createFrame(a.PONG));if(E.ping.hasSubscribers){E.ping.publish({payload:t})}}this.#l=n.INFO;if(this.#o>0){continue}else{e();return}}else if(this.#c.opcode===a.PONG){const t=this.consume(r);if(E.pong.hasSubscribers){E.pong.publish({payload:t})}if(this.#o>0){continue}else{e();return}}}else if(this.#l===n.PAYLOADLENGTH_16){if(this.#o<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#l=n.READ_DATA}else if(this.#l===n.PAYLOADLENGTH_64){if(this.#o<8){return e()}const t=this.consume(8);const r=t.readUInt32BE(0);if(r>2**31-1){m(this.ws,"Received payload length > 2^31 bytes.");return}const i=t.readUInt32BE(4);this.#c.payloadLength=(r<<8)+i;this.#l=n.READ_DATA}else if(this.#l===n.READ_DATA){if(this.#o<this.#c.payloadLength){return e()}else if(this.#o>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#p.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===a.CONTINUATION){const e=Buffer.concat(this.#p);h(this.ws,this.#c.originalOpcode,e);this.#c={};this.#p.length=0}this.#l=n.INFO}}if(this.#o>0){continue}else{e();break}}}consume(e){if(e>this.#o){return null}else if(e===0){return l}if(this.#a[0].length===e){this.#o-=this.#a[0].length;return this.#a.shift()}const t=Buffer.allocUnsafe(e);let r=0;while(r!==e){const i=this.#a[0];const{length:s}=i;if(s+r===e){t.set(this.#a.shift(),r);break}else if(s+r>e){t.set(i.subarray(0,e-r),r);this.#a[0]=i.subarray(e-r);break}else{t.set(this.#a.shift(),r);r+=i.length}}this.#o-=e;return t}parseCloseBody(e,t){let r;if(t.length>=2){r=t.readUInt16BE(0)}if(e){if(!u(r)){return null}return{code:r}}let i=t.subarray(2);if(i[0]===239&&i[1]===187&&i[2]===191){i=i.subarray(3)}if(r!==undefined&&!u(r)){return null}try{i=new TextDecoder("utf-8",{fatal:true}).decode(i)}catch{return null}return{code:r,reason:i}}get closingIn
//# sourceMappingURL=index.js.map