Files
setup-docker-action/dist/index.js

18 lines
857 KiB
JavaScript
Raw Normal View History

2024-02-29 16:05:35 +01:00
require('./sourcemap-register.js');(()=>{var e={7351:function(e,t,r){"use strict";var A=this&&this.__createBinding||(Object.create?function(e,t,r,A){if(A===undefined)A=r;Object.defineProperty(e,A,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,A){if(A===undefined)A=r;e[A]=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 o=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.hasOwnProperty.call(e,r))A(t,e,r);s(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issue=t.issueCommand=void 0;const n=o(r(2037));const i=r(5278);function issueCommand(e,t,r){const A=new Command(e,t,r);process.stdout.write(A.toString()+n.EOL)}t.issueCommand=issueCommand;function issue(e,t=""){issueCommand(e,{},t)}t.issue=issue;const a="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=a+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const A=this.properties[r];if(A){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(A)}`}}}}e+=`${a}${escapeData(this.message)}`;return e}}function escapeData(e){return i.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return i.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(e,t,r){"use strict";var A=this&&this.__createBinding||(Object.create?function(e,t,r,A){if(A===undefined)A=r;Object.defineProperty(e,A,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,A){if(A===undefined)A=r;e[A]=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 o=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.hasOwnProperty.call(e,r))A(t,e,r);s(t,e);return t};var n=this&&this.__awaiter||function(e,t,r,A){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(A.next(e))}catch(e){s(e)}}function rejected(e){try{step(A["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((A=A.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:true});t.getIDToken=t.getState=t.saveState=t.group=t.endGroup=t.startGroup=t.info=t.notice=t.warning=t.error=t.debug=t.isDebug=t.setFailed=t.setCommandEcho=t.setOutput=t.getBooleanInput=t.getMultilineInput=t.getInput=t.addPath=t.setSecret=t.exportVariable=t.ExitCode=void 0;const i=r(7351);const a=r(717);const c=r(5278);const l=o(r(2037));const u=o(r(1017));const g=r(8041);var h;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(h=t.ExitCode||(t.ExitCode={}));function exportVariable(e,t){const r=c.toCommandValue(t);process.env[e]=r;const A=process.env["GITHUB_ENV"]||"";if(A){return a.issueFileCommand("ENV",a.prepareKeyValueMessage(e,t))}i.issueCommand("set-env",{name:e},r)}t.exportVariable=exportVariable;function setSecret(e){i.issueCommand("add-mask",{},e)}t.setSecret=setSecret;function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){a.issueFileCommand("PATH",e)}else{i.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}t.addPath=addPath;function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}if(t&&t.trimWhitespace===false){return r}return r.trim()}t.getInput=getInput;function getMultilineInput(e,t){const r=getInput(e,t).split("\n").filter((e=>e!==""));if(t&&t.trimWhitespace===false){return r}return r.map((e=>e.trim()))}t.getM
2023-03-02 14:00:16 +01:00
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
2024-02-29 16:05:35 +01:00
*/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},1223:(e,t,r)=>{var A=r(2940);e.exports=A(once);e.exports.strict=A(onceStrict);once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:true});Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:true})}));function once(e){var f=function(){if(f.called)return f.value;f.called=true;return f.value=e.apply(this,arguments)};f.called=false;return f}function onceStrict(e){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=e.apply(this,arguments)};var t=e.name||"Function wrapped with `once`";f.onceError=t+" shouldn't be called more than once";f.called=false;return f}},4347:(e,t,r)=>{e.exports=r(6244)},6244:(e,t,r)=>{var A=r(5369);t.operation=function(e){var r=t.timeouts(e);return new A(r,{forever:e&&(e.forever||e.retries===Infinity),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};t.timeouts=function(e){if(e instanceof Array){return[].concat(e)}var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:Infinity,randomize:false};for(var r in e){t[r]=e[r]}if(t.minTimeout>t.maxTimeout){throw new Error("minTimeout is greater than maxTimeout")}var A=[];for(var s=0;s<t.retries;s++){A.push(this.createTimeout(s,t))}if(e&&e.forever&&!A.length){A.push(this.createTimeout(s,t))}A.sort((function(e,t){return e-t}));return A};t.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1;var A=Math.round(r*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));A=Math.min(A,t.maxTimeout);return A};t.wrap=function(e,r,A){if(r instanceof Array){A=r;r=null}if(!A){A=[];for(var s in e){if(typeof e[s]==="function"){A.push(s)}}}for(var o=0;o<A.length;o++){var n=A[o];var i=e[n];e[n]=function retryWrapper(A){var s=t.operation(r);var o=Array.prototype.slice.call(arguments,1);var n=o.pop();o.push((function(e){if(s.retry(e)){return}if(e){arguments[0]=s.mainError()}n.apply(this,arguments)}));s.attempt((function(){A.apply(e,o)}))}.bind(e,i);e[n].options=r}}},5369:e=>{function RetryOperation(e,t){if(typeof t==="boolean"){t={forever:t}}this._originalTimeouts=JSON.parse(JSON.stringify(e));this._timeouts=e;this._options=t||{};this._maxRetryTime=t&&t.maxRetryTime||Infinity;this._fn=null;this._errors=[];this._attempts=1;this._operationTimeout=null;this._operationTimeoutCb=null;this._timeout=null;this._operationStart=null;this._timer=null;if(this._options.forever){this._cachedTimeouts=this._timeouts.slice(0)}}e.exports=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1;this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){if(this._timeout){clearTimeout(this._timeout)}if(this._timer){clearTimeout(this._timer)}this._timeouts=[];this._cachedTimeouts=null};RetryOperation.prototype.retry=function(e){if(this._timeout){clearTimeout(this._timeout)}if(!e){return false}var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime){this._errors.push(e);this._errors.unshift(new Error("RetryOperation timeout occurred"));return false}this._errors.push(e);var r=this._timeouts.shift();if(r===undefined){if(this._cachedTimeouts){this._errors.splice(0,this._errors.length-1);r=this._cachedTimeouts.slice(-1)}else{return false}}var A=this;this._timer=setTimeout((function(){A._attempts++;if(A._operationTimeoutCb){A._timeout=setTimeout((function(){A._operationTimeoutCb(A._attempts)}),A._operationTimeout);if(A._options.unref){A._timeout.unref()}}A._fn(A._attempts)}),r);if(this._options.unref){this._timer.unref()}return true};RetryOperation.prototype.attempt=function(e,t){this._fn=e;if(t){if(t.timeout){this._operationTimeout=t.timeout}if(t.cb){this._operationTimeoutCb=t.cb}}var r=this;if(this._operationTimeoutCb){this._tim
2023-03-02 14:00:16 +01:00
/*!
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/
2024-02-29 16:33:09 +01:00
const A=r(7147);const s=r(2037);const o=r(1017);const n=r(6113);const i={fs:A.constants,os:s.constants};const a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",c=/XXXXXX/,l=3,u=(i.O_CREAT||i.fs.O_CREAT)|(i.O_EXCL||i.fs.O_EXCL)|(i.O_RDWR||i.fs.O_RDWR),g=s.platform()==="win32",h=i.EBADF||i.os.errno.EBADF,d=i.ENOENT||i.os.errno.ENOENT,E=448,p=384,C="exit",Q=[],I=A.rmdirSync.bind(A);let B=false;function rimraf(e,t){return A.rm(e,{recursive:true},t)}function FN_RIMRAF_SYNC(e){return A.rmSync(e,{recursive:true})}function tmpName(e,t){const r=_parseArguments(e,t),s=r[0],o=r[1];try{_assertAndSanitizeOptions(s)}catch(e){return o(e)}let n=s.tries;(function _getUniqueName(){try{const e=_generateTmpName(s);A.stat(e,(function(t){if(!t){if(n-- >0)return _getUniqueName();return o(new Error("Could not get a unique tmp filename, max tries reached "+e))}o(null,e)}))}catch(e){o(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let s=r.tries;do{const e=_generateTmpName(r);try{A.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],o=r[1];tmpName(s,(function _tmpNameCreated(e,t){if(e)return o(e);A.open(t,u,s.mode||p,(function _fileCreated(e,r){if(e)return o(e);if(s.discardDescriptor){return A.close(r,(function _discardCallback(e){return o(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,s,false))}))}else{const e=s.discardDescriptor||s.detachDescriptor;o(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 o=tmpNameSync(r);var n=A.openSync(o,u,r.mode||p);if(r.discardDescriptor){A.closeSync(n);n=undefined}return{name:o,fd:n,removeCallback:_prepareTmpFileRemoveCallback(o,s?-1:n,r,true)}}function dir(e,t){const r=_parseArguments(e,t),s=r[0],o=r[1];tmpName(s,(function _tmpNameCreated(e,t){if(e)return o(e);A.mkdir(t,s.mode||E,(function _dirCreated(e){if(e)return o(e);o(null,t,_prepareTmpDirRemoveCallback(t,s,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const s=tmpNameSync(r);A.mkdirSync(s,r.mode||E);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])A.close(e[0],(function(){A.unlink(e[1],_handler)}));else A.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])A.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{A.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,A){const s=_prepareRemoveCallback(_removeFileSync,[t,e],A);const o=_prepareRemoveCallback(_removeFileAsync,[t,e],A,s);if(!r.keep)Q.unshift(s);return A?s:o}function _prepareTmpDirRemoveCallback(e,t,r){const s=t.unsafeCleanup?rimraf:A.rmdir.bind(A);const o=t.unsafeCleanup?FN_RIMRAF_SYNC:I;const n=_prepareRemoveCallback(o,e,r);const i=_prepareRemoveCallback(s,e,r,n);if(!t.keep)Q.unshift(n);return r?n:i}function _prepareRemoveCallback(e,t,r,A){let s=false;return function _cleanupCallback(o){if(!s){const n=A||_cleanupCallback;const i=Q.indexOf(n);if(i>=0)Q.splice(i,1);s=true;if(r||e===I||e===FN_RIMRAF_SYNC){return e(t)}else{return e(t,o||function(){})}}}}function _garbageCollector(){if(!B)return;while(Q.length){try{Q[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=n.randomBytes(e)}catch(t){r=n.pseudoRandomBytes(e)}for(var A=0;A<e;A++){t.push(a[r[A]%a.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 o.join(t,e.dir,e.name);if(!_isUndefined(e.template))return o.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 A=new TextEncoder;const s=[];const o=new Uint8Array([13,10]);u=0;let n=false;for(const[t,i]of e){if(typeof i==="string"){const e=A.encode(r+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(i)}\r\n`);s.push(e);u+=e.byteLength}else{const e=A.encode(`${r}; name="${escape(normalizeLinefeeds(t))}"`+(i.name?`; filename="${escape(i.name)}"`:"")+"\r\n"+`Content-Type: ${i.type||"application/octet-stream"}\r\n\r\n`);s.push(e,i,o);if(typeof i.size==="number"){u+=e.byteLength+i.size+o.byteLength}else{n=true}}}const i=A.encode(`--${t}--`);s.push(i);u+=i.byteLength;if(n){u=null}l=e;c=async function*(){for(const e of s){if(e.stream){yield*e.stream()}else{yield e}}};g="multipart/form-data; boundary="+t}else if(n(e)){l=e;u=e.size;if(e.type){g=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")}A=e instanceof k?e:o(e)}if(typeof l==="string"||s.isBuffer(l)){u=Buffer.byteLength(l)}if(c!=null){let t;A=new k({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(A)){e.enqueue(new Uint8Array(r))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const h={stream:A,source:l,length:u};return[h,g]}function safelyExtractBody(e,t=false){if(!k){k=r(5356).ReadableStream}if(e instanceof k){I(!s.isDisturbed(e),"The body has already been consumed.");I(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,r]=e.stream.tee();const A=E(r,{transfer:[r]});const[,s]=A.tee();e.stream=t;return{stream:s,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(m(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[Q]=true;yield*t}}}function throwIfAborted(e){if(e.aborted){throw new d("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=R(t)}return new p([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(){h.brandCheck(this,e);throwIfAborted(this[g]);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 u;let r;try{r=new A({headers:e,preservePath:true})}catch(e){throw new d(`${e}`,"AbortError")}r.on("field",((e,r)=>{t.append(e,r)}));r.on("file",((e,r,A,s,o)=>{const n=[];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;n.push(Buffer.from(s.slice(0,t),"base64"));s=s.slice(t)}));r.on("end",(()=>{n.push(Buffer.from(s,"base64"));t.append(e,new D(n,A,{type:o}))}))}else{r.on("data",(e=>{n.push(e)}));r.on("end",(()=>{t.append(e,new D(n,A,{type:o}))}))}}));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[g].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[g].body)){if(!m(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 u;for(const[r,A]of e){t.append(r,A)}return t}else{await Promise.resolve();throwIfAborted(this[g]);thro
2024-04-24 13:24:26 +01:00
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */o[s-4]=this.maskKey[0];o[s-3]=this.maskKey[1];o[s-2]=this.maskKey[2];o[s-1]=this.maskKey[3];o[1]=r;if(r===126){o.writeUInt16BE(t,2)}else if(r===127){o[2]=o[3]=0;o.writeUIntBE(t,4,6)}o[1]|=128;for(let e=0;e<t;e++){o[s+e]=this.frameData[e]^this.maskKey[e%4]}return o}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,r)=>{"use strict";const{Writable:A}=r(2781);const s=r(7643);const{parserStates:o,opcodes:n,states:i,emptyBuffer:a}=r(9188);const{kReadyState:c,kSentClose:l,kResponse:u,kReceivedClose:g}=r(7578);const{isValidStatusCode:h,failWebsocketConnection:d,websocketMessageReceived:E}=r(5515);const{WebsocketFrameSend:p}=r(5444);const C={};C.ping=s.channel("undici:websocket:ping");C.pong=s.channel("undici:websocket:pong");class ByteParser extends A{#n=[];#i=0;#a=o.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,t,r){this.#n.push(e);this.#i+=e.length;this.run(r)}run(e){while(true){if(this.#a===o.INFO){if(this.#i<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!==n.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==n.BINARY&&this.#c.opcode!==n.TEXT){d(this.ws,"Invalid frame type was fragmented.");return}const r=t[1]&127;if(r<=125){this.#c.payloadLength=r;this.#a=o.READ_DATA}else if(r===126){this.#a=o.PAYLOADLENGTH_16}else if(r===127){this.#a=o.PAYLOADLENGTH_64}if(this.#c.fragmented&&r>125){d(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===n.PING||this.#c.opcode===n.PONG||this.#c.opcode===n.CLOSE)&&r>125){d(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===n.CLOSE){if(r===1){d(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[l]){const e=Buffer.allocUnsafe(2);e.writeUInt16BE(this.#c.closeInfo.code,0);const t=new p(e);this.ws[u].socket.write(t.createFrame(n.CLOSE),(e=>{if(!e){this.ws[l]=true}}))}this.ws[c]=i.CLOSING;this.ws[g]=true;this.end();return}else if(this.#c.opcode===n.PING){const t=this.consume(r);if(!this.ws[g]){const e=new p(t);this.ws[u].socket.write(e.createFrame(n.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#a=o.INFO;if(this.#i>0){continue}else{e();return}}else if(this.#c.opcode===n.PONG){const t=this.consume(r);if(C.pong.hasSubscribers){C.pong.publish({payload:t})}if(this.#i>0){continue}else{e();return}}}else if(this.#a===o.PAYLOADLENGTH_16){if(this.#i<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#a=o.READ_DATA}else if(this.#a===o.PAYLOADLENGTH_64){if(this.#i<8){return e()}const t=this.consume(8);const r=t.readUInt32BE(0);if(r>2**31-1){d(this.ws,"Received payload length > 2^31 bytes.");return}const A=t.readUInt32BE(4);this.#c.payloadLength=(r<<8)+A;this.#a=o.READ_DATA}else if(this.#a===o.READ_DATA){if(this.#i<this.#c.payloadLength){return e()}else if(this.#i>=this.#c.payloadLength){const e=this.consume(this.#c.payloadLength);this.#l.push(e);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===n.CONTINUATION){const e=Buffer.concat(this.#l);E(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#a=o.INFO}}if(this.#i>0){continue}else{e();break}}}consume(e){if(e>this.#i){return null}else if(e===0){return a}if(this.#n[0].length===e){this.#i-=this.#n[0].length;return this.#n.shift()}const t=Buffer.allocUnsafe(e);let r=0;while(r!==e){const A=this.#n[0];const{length:s}=A;if(s+r===e){t.set(this.#n.shift(),r);break}else if(s+r>e){t.set(A.subarray(0,e-r),r);this.#n[0]=A.subarray(e-r);break}else{t.set(this.#n.shift(),r);r+=A.length}}this.#i-=e;return t}parseCloseBody(e,t){let r;if(t.length>=2){r=t.readUInt16BE(0)}if(e){if(!h(r)){return null}return{code:r}}let A=t.subarray(2);if(A[0]===239&&A[1]===187&&A[2]===191){A=A.subarray(3)}if(r!==undefined&&!h(r)){return null}try{A=new TextDecoder("utf-8",{fatal:true}).decode(A)}catch{return null}return{code:r,reason:A}}get closingIn
2023-03-02 14:00:16 +01:00
//# sourceMappingURL=index.js.map