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

18 lines
942 KiB
JavaScript
Raw Normal View History

2023-11-17 11:58:43 +01:00
require('./sourcemap-register.js');(()=>{var e={7351:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=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))n(t,e,r);A(t,e);return t};Object.defineProperty(t,"__esModule",{value:true});t.issue=t.issueCommand=void 0;const o=s(r(2037));const i=r(5278);function issueCommand(e,t,r){const n=new Command(e,t,r);process.stdout.write(n.toString()+o.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 n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}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 n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var A=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=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))n(t,e,r);A(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,A){function fulfilled(e){try{step(n.next(e))}catch(e){A(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){A(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.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=s(r(2037));const u=s(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 n=process.env["GITHUB_ENV"]||"";if(n){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.
2023-11-17 11:58:43 +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},1917:(e,t,r)=>{"use strict";var n=r(1161);var A=r(8866);function renamed(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. "+"Use yaml."+t+" instead, which is now safe by default.")}}e.exports.Type=r(6073);e.exports.Schema=r(1082);e.exports.FAILSAFE_SCHEMA=r(8562);e.exports.JSON_SCHEMA=r(1035);e.exports.CORE_SCHEMA=r(2011);e.exports.DEFAULT_SCHEMA=r(8759);e.exports.load=n.load;e.exports.loadAll=n.loadAll;e.exports.dump=A.dump;e.exports.YAMLException=r(8179);e.exports.types={binary:r(7900),float:r(2705),map:r(6150),null:r(721),pairs:r(6860),set:r(9548),timestamp:r(9212),bool:r(4993),int:r(1615),merge:r(6104),omap:r(9046),seq:r(7283),str:r(3619)};e.exports.safeLoad=renamed("safeLoad","load");e.exports.safeLoadAll=renamed("safeLoadAll","loadAll");e.exports.safeDump=renamed("safeDump","dump")},6829:e=>{"use strict";function isNothing(e){return typeof e==="undefined"||e===null}function isObject(e){return typeof e==="object"&&e!==null}function toArray(e){if(Array.isArray(e))return e;else if(isNothing(e))return[];return[e]}function extend(e,t){var r,n,A,s;if(t){s=Object.keys(t);for(r=0,n=s.length;r<n;r+=1){A=s[r];e[A]=t[A]}}return e}function repeat(e,t){var r="",n;for(n=0;n<t;n+=1){r+=e}return r}function isNegativeZero(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}e.exports.isNothing=isNothing;e.exports.isObject=isObject;e.exports.toArray=toArray;e.exports.repeat=repeat;e.exports.isNegativeZero=isNegativeZero;e.exports.extend=extend},8866:(e,t,r)=>{"use strict";var n=r(6829);var A=r(8179);var s=r(8759);var o=Object.prototype.toString;var i=Object.prototype.hasOwnProperty;var a=65279;var c=9;var l=10;var u=13;var g=32;var h=33;var d=34;var p=35;var E=37;var C=38;var I=39;var Q=42;var B=44;var m=45;var y=58;var w=61;var b=62;var R=63;var k=64;var v=91;var S=93;var D=96;var _=123;var T=124;var N=125;var F={};F[0]="\\0";F[7]="\\a";F[8]="\\b";F[9]="\\t";F[10]="\\n";F[11]="\\v";F[12]="\\f";F[13]="\\r";F[27]="\\e";F[34]='\\"';F[92]="\\\\";F[133]="\\N";F[160]="\\_";F[8232]="\\L";F[8233]="\\P";var L=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];var U=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function compileStyleMap(e,t){var r,n,A,s,o,a,c;if(t===null)return{};r={};n=Object.keys(t);for(A=0,s=n.length;A<s;A+=1){o=n[A];a=String(t[o]);if(o.slice(0,2)==="!!"){o="tag:yaml.org,2002:"+o.slice(2)}c=e.compiledTypeMap["fallback"][o];if(c&&i.call(c.styleAliases,a)){a=c.styleAliases[a]}r[o]=a}return r}function encodeHex(e){var t,r,s;t=e.toString(16).toUpperCase();if(e<=255){r="x";s=2}else if(e<=65535){r="u";s=4}else if(e<=4294967295){r="U";s=8}else{throw new A("code point within a string may not be greater than 0xFFFFFFFF")}return"\\"+r+n.repeat("0",s-t.length)+t}var M=1,O=2;function State(e){this.schema=e["schema"]||s;this.indent=Math.max(1,e["indent"]||2);this.noArrayIndent=e["noArrayIndent"]||false;this.skipInvalid=e["skipInvalid"]||false;this.flowLevel=n.isNothing(e["flowLevel"])?-1:e["flowLevel"];this.styleMap=compileStyleMap(this.schema,e["styles"]||null);this.sortKeys=e["sortKeys"]||false;this.lineWidth=e["lineWidth"]||80;this.noRefs=e["noRefs"]||false;this.noCompatMode=e["noCompatMode"]||false;this.condenseFlow=e["condenseFlow"]||false;this.quotingType=e["quotingType"]==='"'?O:M;this.forceQuotes=e["forceQuotes"]||false;this.replacer=typeof e["replacer"]==="function"?e["replacer"]:null;this.implicitTypes=this.schema.compiledImplicit;this.explicitTypes=this.schema.compiledExplicit;this.tag=null;this.result="";this.duplicates=[];this.usedDuplicates=null}function indentString(e,t){var r=n.repeat(" ",t),A=0,s=-1,o="",i,a=e.length;while(A<a){s=e.indexOf("\n",A);if(s===-1){i=e.slice(A);A=a}else{i=e.slice(A,s+1);A=s+1}if(i.leng
2023-03-02 14:00:16 +01:00
/*!
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/
2023-11-17 11:58:43 +01:00
const n=r(7147);const A=r(2037);const s=r(1017);const o=r(6113);const i={fs:n.constants,os:A.constants};const a=r(4959);const c="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",l=/XXXXXX/,u=3,g=(i.O_CREAT||i.fs.O_CREAT)|(i.O_EXCL||i.fs.O_EXCL)|(i.O_RDWR||i.fs.O_RDWR),h=A.platform()==="win32",d=i.EBADF||i.os.errno.EBADF,p=i.ENOENT||i.os.errno.ENOENT,E=448,C=384,I="exit",Q=[],B=n.rmdirSync.bind(n),m=a.sync;let y=false;function tmpName(e,t){const r=_parseArguments(e,t),A=r[0],s=r[1];try{_assertAndSanitizeOptions(A)}catch(e){return s(e)}let o=A.tries;(function _getUniqueName(){try{const e=_generateTmpName(A);n.stat(e,(function(t){if(!t){if(o-- >0)return _getUniqueName();return s(new Error("Could not get a unique tmp filename, max tries reached "+e))}s(null,e)}))}catch(e){s(e)}})()}function tmpNameSync(e){const t=_parseArguments(e),r=t[0];_assertAndSanitizeOptions(r);let A=r.tries;do{const e=_generateTmpName(r);try{n.statSync(e)}catch(t){return e}}while(A-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(e,t){const r=_parseArguments(e,t),A=r[0],s=r[1];tmpName(A,(function _tmpNameCreated(e,t){if(e)return s(e);n.open(t,g,A.mode||C,(function _fileCreated(e,r){if(e)return s(e);if(A.discardDescriptor){return n.close(r,(function _discardCallback(e){return s(e,t,undefined,_prepareTmpFileRemoveCallback(t,-1,A,false))}))}else{const e=A.discardDescriptor||A.detachDescriptor;s(null,t,r,_prepareTmpFileRemoveCallback(t,e?-1:r,A,false))}}))}))}function fileSync(e){const t=_parseArguments(e),r=t[0];const A=r.discardDescriptor||r.detachDescriptor;const s=tmpNameSync(r);var o=n.openSync(s,g,r.mode||C);if(r.discardDescriptor){n.closeSync(o);o=undefined}return{name:s,fd:o,removeCallback:_prepareTmpFileRemoveCallback(s,A?-1:o,r,true)}}function dir(e,t){const r=_parseArguments(e,t),A=r[0],s=r[1];tmpName(A,(function _tmpNameCreated(e,t){if(e)return s(e);n.mkdir(t,A.mode||E,(function _dirCreated(e){if(e)return s(e);s(null,t,_prepareTmpDirRemoveCallback(t,A,false))}))}))}function dirSync(e){const t=_parseArguments(e),r=t[0];const A=tmpNameSync(r);n.mkdirSync(A,r.mode||E);return{name:A,removeCallback:_prepareTmpDirRemoveCallback(A,r,true)}}function _removeFileAsync(e,t){const _handler=function(e){if(e&&!_isENOENT(e)){return t(e)}t()};if(0<=e[0])n.close(e[0],(function(){n.unlink(e[1],_handler)}));else n.unlink(e[1],_handler)}function _removeFileSync(e){let t=null;try{if(0<=e[0])n.closeSync(e[0])}catch(e){if(!_isEBADF(e)&&!_isENOENT(e))throw e}finally{try{n.unlinkSync(e[1])}catch(e){if(!_isENOENT(e))t=e}}if(t!==null){throw t}}function _prepareTmpFileRemoveCallback(e,t,r,n){const A=_prepareRemoveCallback(_removeFileSync,[t,e],n);const s=_prepareRemoveCallback(_removeFileAsync,[t,e],n,A);if(!r.keep)Q.unshift(A);return n?A:s}function _prepareTmpDirRemoveCallback(e,t,r){const A=t.unsafeCleanup?a:n.rmdir.bind(n);const s=t.unsafeCleanup?m:B;const o=_prepareRemoveCallback(s,e,r);const i=_prepareRemoveCallback(A,e,r,o);if(!t.keep)Q.unshift(o);return r?o:i}function _prepareRemoveCallback(e,t,r,n){let A=false;return function _cleanupCallback(s){if(!A){const o=n||_cleanupCallback;const i=Q.indexOf(o);if(i>=0)Q.splice(i,1);A=true;if(r||e===B||e===m){return e(t)}else{return e(t,s||function(){})}}}}function _garbageCollector(){if(!y)return;while(Q.length){try{Q[0]()}catch(e){}}}function _randomChars(e){let t=[],r=null;try{r=o.randomBytes(e)}catch(t){r=o.pseudoRandomBytes(e)}for(var n=0;n<e;n++){t.push(c[r[n]%c.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 s.join(t,e.dir,e.name);if(!_isUndefined(e.template))return s.join(t,e.dir,e.template).replace(l,_randomChars(6));const r=[e.prefix?e.prefix:"tmp","-",process.pid,"-",_randomChars(12),e.postfix?"-"+e.po
/*! 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=new TextEncoder;const A=[];const s=new Uint8Array([13,10]);u=0;let o=false;for(const[t,i]of e){if(typeof i==="string"){const e=n.encode(r+`; name="${escape(normalizeLinefeeds(t))}"`+`\r\n\r\n${normalizeLinefeeds(i)}\r\n`);A.push(e);u+=e.byteLength}else{const e=n.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`);A.push(e,i,s);if(typeof i.size==="number"){u+=e.byteLength+i.size+s.byteLength}else{o=true}}}const i=n.encode(`--${t}--`);A.push(i);u+=i.byteLength;if(o){u=null}l=e;c=async function*(){for(const e of A){if(e.stream){yield*e.stream()}else{yield e}}};g="multipart/form-data; boundary="+t}else if(o(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(A.isDisturbed(e)||e.locked){throw new TypeError("Response body object should not be disturbed or locked")}n=e instanceof k?e:s(e)}if(typeof l==="string"||A.isBuffer(l)){u=Buffer.byteLength(l)}if(c!=null){let t;n=new k({async start(){t=c(e)[Symbol.asyncIterator]()},async pull(e){const{value:r,done:A}=await t.next();if(A){queueMicrotask((()=>{e.close()}))}else{if(!B(n)){e.enqueue(new Uint8Array(r))}}return e.desiredSize>0},async cancel(e){await t.return()},type:undefined})}const h={stream:n,source:l,length:u};return[h,g]}function safelyExtractBody(e,t=false){if(!k){k=r(5356).ReadableStream}if(e instanceof k){Q(!A.isDisturbed(e),"The body has already been consumed.");Q(!e.locked,"The stream is locked.")}return extractBody(e,t)}function cloneBody(e){const[t,r]=e.stream.tee();const n=p(r,{transfer:[r]});const[,A]=n.tee();e.stream=t;return{stream:A,length:e.length,source:e.source}}async function*consumeBody(e){if(e){if(m(e)){yield e}else{const t=e.stream;if(A.isDisturbed(t)){throw new TypeError("The body has already been consumed.")}if(t.locked){throw new TypeError("The stream is locked.")}t[I]=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 E([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 n({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,n,A,s)=>{const o=[];if(A==="base64"||A.toLowerCase()==="base64"){let A="";r.on("data",(e=>{A+=e.toString().replace(/[\r\n]/gm,"");const t=A.length-A.length%4;o.push(Buffer.from(A.slice(0,t),"base64"));A=A.slice(t)}));r.on("end",(()=>{o.push(Buffer.from(A,"base64"));t.append(e,new v(o,n,{type:s}))}))}else{r.on("data",(e=>{o.push(e)}));r.on("end",(()=>{t.append(e,new v(o,n,{type:s}))}))}}));const A=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 A;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,n]of e){t.append(r,n)}return t}else{await Promise.resolve();throwIfAborted(this[g]);thro
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */s[A-4]=this.maskKey[0];s[A-3]=this.maskKey[1];s[A-2]=this.maskKey[2];s[A-1]=this.maskKey[3];s[1]=r;if(r===126){s.writeUInt16BE(t,2)}else if(r===127){s[2]=s[3]=0;s.writeUIntBE(t,4,6)}s[1]|=128;for(let e=0;e<t;e++){s[A+e]=this.frameData[e]^this.maskKey[e%4]}return s}}e.exports={WebsocketFrameSend:WebsocketFrameSend}},1688:(e,t,r)=>{"use strict";const{Writable:n}=r(2781);const A=r(7643);const{parserStates:s,opcodes:o,states:i,emptyBuffer:a}=r(9188);const{kReadyState:c,kSentClose:l,kResponse:u,kReceivedClose:g}=r(7578);const{isValidStatusCode:h,failWebsocketConnection:d,websocketMessageReceived:p}=r(5515);const{WebsocketFrameSend:E}=r(5444);const C={};C.ping=A.channel("undici:websocket:ping");C.pong=A.channel("undici:websocket:pong");class ByteParser extends n{#o=[];#i=0;#a=s.INFO;#c={};#l=[];constructor(e){super();this.ws=e}_write(e,t,r){this.#o.push(e);this.#i+=e.length;this.run(r)}run(e){while(true){if(this.#a===s.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!==o.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==o.BINARY&&this.#c.opcode!==o.TEXT){d(this.ws,"Invalid frame type was fragmented.");return}const r=t[1]&127;if(r<=125){this.#c.payloadLength=r;this.#a=s.READ_DATA}else if(r===126){this.#a=s.PAYLOADLENGTH_16}else if(r===127){this.#a=s.PAYLOADLENGTH_64}if(this.#c.fragmented&&r>125){d(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===o.PING||this.#c.opcode===o.PONG||this.#c.opcode===o.CLOSE)&&r>125){d(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===o.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 E(e);this.ws[u].socket.write(t.createFrame(o.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===o.PING){const t=this.consume(r);if(!this.ws[g]){const e=new E(t);this.ws[u].socket.write(e.createFrame(o.PONG));if(C.ping.hasSubscribers){C.ping.publish({payload:t})}}this.#a=s.INFO;if(this.#i>0){continue}else{e();return}}else if(this.#c.opcode===o.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===s.PAYLOADLENGTH_16){if(this.#i<2){return e()}const t=this.consume(2);this.#c.payloadLength=t.readUInt16BE(0);this.#a=s.READ_DATA}else if(this.#a===s.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 n=t.readUInt32BE(4);this.#c.payloadLength=(r<<8)+n;this.#a=s.READ_DATA}else if(this.#a===s.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===o.CONTINUATION){const e=Buffer.concat(this.#l);p(this.ws,this.#c.originalOpcode,e);this.#c={};this.#l.length=0}this.#a=s.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.#o[0].length===e){this.#i-=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:A}=n;if(A+r===e){t.set(this.#o.shift(),r);break}else if(A+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.#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 n=t.subarray(2);if(n[0]===239&&n[1]===187&&n[2]===191){n=n.subarray(3)}if(r!==undefined&&!h(r)){return null}try{n=new TextDecoder("utf-8",{fatal:true}).decode(n)}catch{return null}return{code:r,reason:n}}get closingIn
2023-03-02 14:00:16 +01:00
//# sourceMappingURL=index.js.map