3
0
Fork 0
mirror of https://gitea.com/docker/login-action.git synced 2024-11-26 19:39:39 +01:00
docker-login/dist/index.js

33 lines
2.4 MiB
JavaScript
Raw Normal View History

require('./sourcemap-register.js');(()=>{var e={7799:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;var i=Object.getOwnPropertyDescriptor(t,r);if(!i||("get"in i?!t.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return t[r]}}}Object.defineProperty(e,n,i)}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var a=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))n(t,e,r);i(t,e);return t};var o=this&&this.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function fulfilled(e){try{step(n.next(e))}catch(e){i(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){i(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});t.saveCache=t.restoreCache=t.isFeatureAvailable=t.ReserveCacheError=t.ValidationError=void 0;const s=a(r(2186));const c=a(r(1017));const l=a(r(1518));const d=a(r(8245));const p=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,n,i=false){return o(this,void 0,void 0,(function*(){checkPaths(e);r=r||[];const a=[t,...r];s.debug("Resolved Keys:");s.debug(JSON.stringify(a));if(a.length>10){throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`)}for(const e of a){checkKey(e)}const o=yield l.getCompressionMethod();let u="";try{const t=yield d.getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i});if(!(t===null||t===void 0?void 0:t.archiveLocation)){return undefined}if(n===null||n===void 0?void 0:n.lookupOnly){s.info("Lookup only - skipping download");return t.cacheKey}u=c.join(yield l.createTempDirectory(),l.getCacheFileName(o));s.debug(`Archive Path: ${u}`);yield d.downloadCache(t.archiveLocation,u,n);if(s.isDebug()){yield(0,p.listTar)(u,o)}const r=l.getArchiveFileSizeInBytes(u);s.info(`Cache Size: ~${Math.round(r/(1024*1024))} MB (${r} B)`);yield(0,p.extractTar)(u,o);s.info("Cache restored successfully");return t.cacheKey}catch(e){const t=e;if(t.name===ValidationError.name){throw e}else{s.warning(`Failed to restore: ${e.message}`)}}finally{try{yield l.unlinkFile(u)}catch(e){s.debug(`Failed to delete archive: ${e}`)}}return undefined}))}t.restoreCache=restoreCache;function saveCache(e,t,r,n=false){var i,a,u,A,m;return o(this,void 0,void 0,(function*(){checkPaths(e);checkKey(t);const o=yield l.getCompressionMethod();let g=-1;const h=yield l.resolvePaths(e);s.debug("Cache Paths:");s.debug(`${JSON.stringify(h)}`);if(h.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 f=yield l.createTempDirectory();const y=c.join(f,l.getCacheFileName(o));s.debug(`Archive Path: ${y}`);try{yield(0,p.createTar)(f,h,o);if(s.isDebug()){yield(0,p.listTar)(y,o)}const c=10*1024*1024*1024;const E=l.getArchiveFi
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var t;var r;var n;var i;var a;var o;var s;var c;var l;var d;var p;var u;var A;var m;var g;var h;var f;var y;var E;var C;var v;var b;var I;(function(t){var r=typeof global==="object"?global:typeof self==="object"?self:typeof this==="object"?this:{};if(typeof define==="function"&&define.amd){define("tslib",["exports"],(function(e){t(createExporter(r,createExporter(e)))}))}else if(true&&typeof e.exports==="object"){t(createExporter(r,createExporter(e.exports)))}else{t(createExporter(r))}function createExporter(e,t){if(e!==r){if(typeof Object.create==="function"){Object.defineProperty(e,"__esModule",{value:true})}else{e.__esModule=true}}return function(r,n){return e[r]=t?t(r,n):n}}})((function(e){var B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(t.hasOwnProperty(r))e[r]=t[r]};t=function(e,t){B(e,t);function __(){this.constructor=e}e.prototype=t===null?Object.create(t):(__.prototype=t.prototype,new __)};r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};n=function(e,t){var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0)r[n]=e[n];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++){if(t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i]))r[n[i]]=e[n[i]]}return r};i=function(e,t,r,n){var i=arguments.length,a=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)if(o=e[s])a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a;return i>3&&a&&Object.defineProperty(t,r,a),a};a=function(e,t){return function(r,n){t(r,n,e)}};o=function(e,t){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(e,t)};s=function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,i){function fulfilled(e){try{step(n.next(e))}catch(e){i(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){i(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};c=function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function verb(e){return function(t){return step([e,t])}}function step(o){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,i&&(a=o[0]&2?i["return"]:o[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;if(i=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;i=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){r.label=o[1];break}if(o[0]===6&&r.label<a[1]){r.label=a[1];a=o;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(o);break}if(a[2])r.ops.pop();r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e];i=0}finally{n=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};I=function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]};l=function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))t[r]=e[r]};d=function(e){var t=typeof Symbol==="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&n>=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};p=function(e,t){var r=typeof Symbol==="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,a=[],o;try{while((t===void 0||t-- >0)&&!(i=n.next()).done)a.push(i.value)}catch(e){o={error:e}}finally{try{if(i&&!i.done&&(r=n[
/*!
* 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 n=r(7426);var i=r(1017).extname;var a=/^\s*([^;\s]*)(?:;|\s|$)/;var o=/^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=a.exec(e);var r=t&&n[t[1].toLowerCase()];if(r&&r.charset){return r.charset}if(t&&o.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 n=t.charset(r);if(n)r+="; charset="+n.toLowerCase()}return r}function extension(e){if(!e||typeof e!=="string"){return false}var r=a.exec(e);var n=r&&t.extensions[r[1].toLowerCase()];if(!n||!n.length){return false}return n[0]}function lookup(e){if(!e||typeof e!=="string"){return false}var r=i("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(n).forEach((function forEachMimeType(i){var a=n[i];var o=a.extensions;if(!o||!o.length){return}e[i]=o;for(var s=0;s<o.length;s++){var c=o[s];if(t[c]){var l=r.indexOf(n[t[c]].source);var d=r.indexOf(a.source);if(t[c]!=="application/octet-stream"&&(l>d||l===d&&t[c].substr(0,12)==="application/")){continue}}t[c]=i}}))}},3973:(e,t,r)=>{e.exports=minimatch;minimatch.Minimatch=Minimatch;var n=function(){try{return r(1017)}catch(e){}}()||{sep:"/"};minimatch.sep=n.sep;var i=minimatch.GLOBSTAR=Minimatch.GLOBSTAR={};var a=r(8184);var o={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}};var s="[^/]";var c=s+"*?";var l="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";var d="(?:(?!(?:\\/|^)\\.).)*?";var p=charSet("().*{}+?[]^$\\!");function charSet(e){return e.split("").reduce((function(e,t){e[t]=true;return e}),{})}var u=/\/+/;minimatch.filter=filter;function filter(e,t){t=t||{};return function(r,n,i){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,n,i){return t(r,n,ext(e,i))};r.Minimatch=function Minimatch(r,n){return new t.Minimatch(r,ext(e,n))};r.Minimatch.defaults=function defaults(r){return t.defaults(ext(e,r)).Minimatch};r.filter=function filter(r,n){return t.filter(r,ext(e,n))};r.defaults=function defaults(r){return t.defaults(ext(e,r))};r.makeRe=function makeRe(r,n){return t.makeRe(r,ext(e,n))};r.braceExpand=function braceExpand(r,n){return t.braceExpand(r,ext(e,n))};r.match=function(r,n,i){return t.match(r,n,ext(e,i))};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&&n.sep!=="/"){e=e.split(n.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(u)}));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 n=[];var i;var a;var o=-1;var s=arguments.length;if(!s){return""}var c="";while(++o<s){var l=Number(arguments[o]);if(!isFinite(l)||l<0||l>1114111||t(l)!==l){throw RangeError("Invalid code point: "+l)}if(l<=65535){n.push(l)}else{l-=65536;i=(l>>10)+55296;a=l%1024+56320;n.push(i,a)}if(o+1===s||n.length>r){c+=e.apply(null,n);n.length=0}}return c};if(Object.defineProperty){Object.defineProperty(String,"fromCodePoint",{value:fromCodePoint,configurable:true,writable:true})}else{String.fromCodePoint=fromCodePoint}})()}})(false?0:t)},4526:e=>{const t=/^[-+]?0x[a-fA-F0-9]+$/;const r=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;if(!Number.parseInt&&window.parseInt){Number.parseInt=window.parseInt}if(!Number.parseFloat&&window.parseFloat){Number.parseFloat=window.parseFloat}const n={hex:true,leadingZeros:true,decimalPoint:".",eNotation:true};function toNumber(e,i={}){i=Object.assign({},n,i);if(!e||typeof e!=="string")return e;let a=e.trim();if(i.skipLike!==undefined&&i.skipLike.test(a))return e;else if(i.hex&&t.test(a)){return Number.parseInt(a,16)}else{const t=r.exec(a);if(t){const r=t[1];const n=t[2];let o=trimZeros(t[3]);const s=t[4]||t[6];if(!i.leadingZeros&&n.length>0&&r&&a[2]!==".")return e;else if(!i.leadingZeros&&n.length>0&&!r&&a[1]!==".")return e;else{const t=Number(a);const c=""+t;if(c.search(/[eE]/)!==-1){if(i.eNotation)return t;else return e}else if(s){if(i.eNotation)return t;else return e}else if(a.indexOf(".")!==-1){if(c==="0"&&o==="")return t;else if(c===o)return t;else if(r&&c==="-"+o)return t;else return e}if(n){if(o===c)return t;else if(r+o===c)return t;else return e}if(a===c)return t;else if(a===r+c)return t;return e}}else{return e}}}function trimZeros(e){if(e&&e.indexOf(".")!==-1){e=e.replace(/0+$/,"");if(e===".")e="0";else if(e[0]===".")e="0"+e;else if(e[e.length-1]===".")e=e.substr(0,e.length-1);return e}return e}e.exports=toNumber},9318:(e,t,r)=>{"use strict";const n=r(2037);const i=r(6224);const a=r(1621);const{env:o}=process;let s;if(a("no-color")||a("no-colors")||a("color=false")||a("color=never")){s=0}else if(a("color")||a("colors")||a("color=true")||a("color=always")){s=1}if("FORCE_COLOR"in o){if(o.FORCE_COLOR==="true"){s=1}else if(o.FORCE_COLOR==="false"){s=0}else{s=o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3)}}function translateLevel(e){if(e===0){return false}return{level:e,hasBasic:true,has256:e>=2,has16m:e>=3}}function supportsColor(e,t){if(s===0){return 0}if(a("color=16m")||a("color=full")||a("color=truecolor")){return 3}if(a("color=256")){return 2}if(e&&!t&&s===undefined){return 0}const r=s||0;if(o.TERM==="dumb"){return r}if(process.platform==="win32"){const e=n.release().split(".");if(Number(e[0])>=10&&Number(e[2])>=10586){return Number(e[2])>=14931?3:2}return 1}if("CI"in o){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((e=>e in o))||o.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in o){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0}if(o.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in o){const e=parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(o.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)){return 1}if("COLORTERM"in o){return 1}return r}function getSupportLevel(e){const t=supportsColor(e,e&&e.isTTY);return translateLevel(t)}e.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(true,i.isatty(1))),stderr:translateLevel(supportsColor(true,i.isatty(2)))}},4256:(e,t,r)=>{"use strict";var n=r(5477);var i=r(2020);var a={TRANSITIONAL:0,NONTRANSITIONAL:1};function normalize(e){return e.split("\0").map((function(e){return e.normalize("NFC")})).join("\0")}function findStatus(e){var t=0;var r=i.length-1;while(t<=r){v
/*! 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 n=[];const i=new Uint8Array([13,10]);p=0;let a=false;for(const[t,o]of e){if(typeof o==="string"){const e=Q.encode(r+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(o)}\r\n`);n.push(e);p+=e.byteLength}else{const e=Q.encode(`${r}; name="${escape(normalizeLinefeeds(t))}"`+(o.name?`; filename="${escape(o.name)}"`:"")+"\r\n"+`Content-Type: ${o.type||"application/octet-stream"}\r\n\r\n`);n.push(e,o,i);if(typeof o.size==="number"){p+=e.byteLength+o.size+i.byteLength}else{a=true}}}const o=Q.encode(`--${t}--`);n.push(o);p+=o.byteLength;if(a){p=null}d=e;l=async function*(){for(const e of n){if(e.stream){yield*e.stream()}else{yield e}}};u="multipart/form-data; boundary="+t}else if(o(e)){d=e;p=e.size;if(e.type){u=e.type}}else if(typeof e[Symbol.asyncIterator]==="function"){if(t){throw new TypeError("keepalive")}if(i.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}n=e instanceof w?e:a(e)}if(typeof d==="string"||i.isBuffer(d)){p=Buffer.byteLength(d)}if(l!=null){let t;n=new w({async start(){t=l(e)[Symbol.asyncIterator]()},async pull(e){const{value:r,done:i}=await t.next();if(i){queueMicrotask((()=>{e.close()}))}else{if(!C(n)){e.enqueue(new Uint8Array(r))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const A={stream:n,source:d,length:p};return[A,u]}function safelyExtractBody(e,t=false){if(!w){w=r(5356).ReadableStream}if(e instanceof w){E(!i.isDisturbed(e),"The body has already been consumed.");E(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,r]=e.stream.tee();const n=g(r,{transfer:[r]});const[,i]=n.tee();e.stream=t;return{stream:i,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(v(e)){yield e}else{const t=e.stream;if(i.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=S(t)}return new h([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(){A.brandCheck(this,e);throwIfAborted(this[u]);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 p;let r;try{r=new n({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,n,i,a)=>{const o=[];if(i==="base64"||i.toLowerCase()==="base64"){let i="";r.on("data",(e=>{i+=e.toString().replace(/[\r\n]/gm,"");const t=i.length-i.length%4;o.push(Buffer.from(i.slice(0,t),"base64"));i=i.slice(t)}));r.on("end",(()=>{o.push(Buffer.from(i,"base64"));t.append(e,new x(o,n,{type:a}))}))}else{r.on("data",(e=>{o.push(e)}));r.on("end",(()=>{t.append(e,new x(o,n,{type:a}))}))}}));const i=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[u].body))r.write(e);r.end();await i;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[u].body)){if(!v(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 p;for(const[r,n]of e){t.append(r,n)}return t}else{await Promise.resolve();throwIfAborted(this[u]);throw A.errors.exception({he
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */a[i-4]=this.maskKey[0];a[i-3]=this.maskKey[1];a[i-2]=this.maskKey[2];a[i-1]=this.maskKey[3];a[1]=r;if(r===126){a.writeUInt16BE(t,2)}else if(r===127){a[2]=a[3]=0;a.writeUIntBE(t,4,6)}a[1]|=128;for(let e=0;e<t;e++){a[i+e]=this.frameData[e]^this.maskKey[e%4]}return a}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,r)=>{"use strict";const{Writable:n}=r(2781);const i=r(7643);const{parserStates:a,opcodes:o,states:s,emptyBuffer:c}=r(9188);const{kReadyState:l,kSentClose:d,kResponse:p,kReceivedClose:u}=r(7578);const{isValidStatusCode:A,failWebsocketConnection:m,websocketMessageReceived:g}=r(5515);const{WebsocketFrameSend:h}=r(5444);const f={};f.ping=i.channel("undici:websocket:ping");f.pong=i.channel("undici:websocket:pong");class ByteParser extends n{#o=[];#s=0;#c=a.INFO;#l={};#d=[];constructor(e){super();this.ws=e}_write(e,t,r){this.#o.push(e);this.#s+=e.length;this.run(r)}run(e){while(true){if(this.#c===a.INFO){if(this.#s<2){return e()}const t=this.consume(2);this.#l.fin=(t[0]&128)!==0;this.#l.opcode=t[0]&15;this.#l.originalOpcode??=this.#l.opcode;this.#l.fragmented=!this.#l.fin&&this.#l.opcode!==o.CONTINUATION;if(this.#l.fragmented&&this.#l.opcode!==o.BINARY&&this.#l.opcode!==o.TEXT){m(this.ws,"Invalid frame type was fragmented.");return}const r=t[1]&127;if(r<=125){this.#l.payloadLength=r;this.#c=a.READ_DATA}else if(r===126){this.#c=a.PAYLOADLENGTH_16}else if(r===127){this.#c=a.PAYLOADLENGTH_64}if(this.#l.fragmented&&r>125){m(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#l.opcode===o.PING||this.#l.opcode===o.PONG||this.#l.opcode===o.CLOSE)&&r>125){m(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#l.opcode===o.CLOSE){if(r===1){m(this.ws,"Received close frame with a 1-byte body.");return}const e=this.consume(r);this.#l.closeInfo=this.parseCloseBody(false,e);if(!this.ws[d]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#l.closeInfo.code,0);const t=new h(e);this.ws[p].socket.write(t.createFrame(o.CLOSE),(e=>{if(!e){this.ws[d]=true}}))}this.ws[l]=s.CLOSING;this.ws[u]=true;this.end();return}else if(this.#l.opcode===o.PING){const t=this.consume(r);if(!this.ws[u]){const e=new h(t);this.ws[p].socket.write(e.createFrame(o.PONG));if(f.ping.hasSubscribers){f.ping.publish({payload:t})}}this.#c=a.INFO;if(this.#s>0){continue}else{e();return}}else if(this.#l.opcode===o.PONG){const t=this.consume(r);if(f.pong.hasSubscribers){f.pong.publish({payload:t})}if(this.#s>0){continue}else{e();return}}}else if(this.#c===a.PAYLOADLENGTH_16){if(this.#s<2){return e()}const t=this.consume(2);this.#l.payloadLength=t.readUInt16BE(0);this.#c=a.READ_DATA}else if(this.#c===a.PAYLOADLENGTH_64){if(this.#s<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 n=t.readUInt32BE(4);this.#l.payloadLength=(r<<8)+n;this.#c=a.READ_DATA}else if(this.#c===a.READ_DATA){if(this.#s<this.#l.payloadLength){return e()}else if(this.#s>=this.#l.payloadLength){const e=this.consume(this.#l.payloadLength);this.#d.push(e);if(!this.#l.fragmented||this.#l.fin&&this.#l.opcode===o.CONTINUATION){const e=Buffer.concat(this.#d);g(this.ws,this.#l.originalOpcode,e);this.#l={};this.#d.length=0}this.#c=a.INFO}}if(this.#s>0){continue}else{e();break}}}consume(e){if(e>this.#s){return null}else if(e===0){return c}if(this.#o[0].length===e){this.#s-=this.#o[0].length;return this.#o.shift()}const t=Buffer.allocUnsafe(e);let r=0;while(r!==e){const n=this.#o[0];const{length:i}=n;if(i+r===e){t.set(this.#o.shift(),r);break}else if(i+r>e){t.set(n.subarray(0,e-r),r);this.#o[0]=n.subarray(e-r);break}else{t.set(this.#o.shift(),r);r+=n.length}}this.#s-=e;return t}parseCloseBody(e,t){let r;if(t.length>=2){r=t.readUInt16BE(0)}if(e){if(!A(r)){return null}return{code:r}}let n=t.subarray(2);if(n[0]===239&&n[1]===187&&n[2]===191){n=n.subarray(3)}if(r!==undefined&&!A(r)){return null}try{n=new TextDecoder("utf-8",{fatal:true}).decode(n)}catch{return null}return{code:r,reason:n}}get closingIn
//# sourceMappingURL=index.js.map