setup-cpp/dist/legacy/assets/actions_python-BF80bhWt.js

3 lines
79 KiB
JavaScript

"use strict";function _interopNamespaceDefault(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}function getProxyUrl(e){let t,r,s="https:"===e.protocol;return checkBypass(e)||(r=s?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY,r&&(t=new URL(r))),t}function checkBypass(e){if(!e.hostname)return!1;let t,r=process.env.no_proxy||process.env.NO_PROXY||"";if(!r)return!1;e.port?t=+e.port:"http:"===e.protocol?t=80:"https:"===e.protocol&&(t=443);let s=[e.hostname.toUpperCase()];"number"==typeof t&&s.push(`${s[0]}:${t}`);for(let i of r.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e)))if(s.some((e=>e===i)))return!0;return!1}function downloadTool(e,t,r,s){return __awaiter(this,void 0,void 0,(function*(){t=t||path.join(_getTempDirectory(),v4_1.default()),yield io.mkdirP(path.dirname(t)),core.debug("Downloading "+e),core.debug("Destination "+t);const i=_getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS",10),n=_getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS",20),o=new retry_helper_1.RetryHelper(3,i,n);return yield o.execute((()=>__awaiter(this,void 0,void 0,(function*(){return yield downloadToolAttempt(e,t||"",r,s)}))),(e=>!(e instanceof HTTPError&&e.httpStatusCode&&500>e.httpStatusCode&&408!==e.httpStatusCode&&429!==e.httpStatusCode)))}))}function downloadToolAttempt(e,t,r,s){return __awaiter(this,void 0,void 0,(function*(){if(fs.existsSync(t))throw Error(`Destination file path ${t} already exists`);const i=new httpm.HttpClient(userAgent,[],{allowRetries:!1});r&&(core.debug("set auth"),void 0===s&&(s={}),s.authorization=r);const n=yield i.get(e,s);if(200!==n.message.statusCode){const t=new HTTPError(n.message.statusCode);throw core.debug(`Failed to download from "${e}". Code(${n.message.statusCode}) Message(${n.message.statusMessage})`),t}const o=util.promisify(stream$1.pipeline),a=_getGlobal("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY",(()=>n.message))();let h=!1;try{return yield o(a,fs.createWriteStream(t)),core.debug("download complete"),h=!0,t}finally{if(!h){core.debug("download failed");try{yield io.rmRF(t)}catch(c){core.debug(`Failed to delete '${t}'. ${c.message}`)}}}}))}function extract7z(e,t,r){return __awaiter(this,void 0,void 0,(function*(){assert_1.ok(IS_WINDOWS$1,"extract7z() not supported on current OS"),assert_1.ok(e,'parameter "file" is required'),t=yield _createExtractFolder(t);const s=process.cwd();if(process.chdir(t),r)try{const t=["x",core.isDebug()?"-bb1":"-bb0","-bd","-sccUTF-8",e],s={silent:!0};yield exec_1.exec(`"${r}"`,t,s)}finally{process.chdir(s)}else{const r=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",`& '${path.join(__dirname,"..","scripts","Invoke-7zdec.ps1").replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Source '${e.replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Target '${t.replace(/'/g,"''").replace(/"|\n|\r/g,"")}'`],i={silent:!0};try{const e=yield io.which("powershell",!0);yield exec_1.exec(`"${e}"`,r,i)}finally{process.chdir(s)}}return t}))}function extractTar(e,t,r="xz"){return __awaiter(this,void 0,void 0,(function*(){if(!e)throw Error("parameter 'file' is required");t=yield _createExtractFolder(t),core.debug("Checking tar --version");let s="";yield exec_1.exec("tar --version",[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:e=>s+=""+e,stderr:e=>s+=""+e}}),core.debug(s.trim());const i=s.toUpperCase().includes("GNU TAR");let n;n=r instanceof Array?r:[r],core.isDebug()&&!r.includes("v")&&n.push("-v");let o=t,a=e;return IS_WINDOWS$1&&i&&(n.push("--force-local"),o=t.replace(/\\/g,"/"),a=e.replace(/\\/g,"/")),i&&(n.push("--warning=no-unknown-keyword"),n.push("--overwrite")),n.push("-C",o,"-f",a),yield exec_1.exec("tar",n),t}))}function extractXar(e,t,r=[]){return __awaiter(this,void 0,void 0,(function*(){let s;assert_1.ok(IS_MAC$1,"extractXar() not supported on current OS"),assert_1.ok(e,'parameter "file" is required'),t=yield _createExtractFolder(t),s=r instanceof Array?r:[r],s.push("-x","-C",t,"-f",e),core.isDebug()&&s.push("-v");const i=yield io.which("xar",!0);return yield exec_1.exec(`"${i}"`,_unique(s)),t}))}function extractZip(e,t){return __awaiter(this,void 0,void 0,(function*(){if(!e)throw Error("parameter 'file' is required");return t=yield _createExtractFolder(t),IS_WINDOWS$1?yield extractZipWin(e,t):yield extractZipNix(e,t),t}))}function extractZipWin(e,t){return __awaiter(this,void 0,void 0,(function*(){const r=e.replace(/'/g,"''").replace(/"|\n|\r/g,""),s=t.replace(/'/g,"''").replace(/"|\n|\r/g,""),i=yield io.which("pwsh",!1);if(i){const e=["-NoLogo","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",["$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;",`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${r}', '${s}', $true) }`,`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${r}' -DestinationPath '${s}' -Force } else { throw $_ } } ;`].join(" ")];core.debug("Using pwsh at path: "+i),yield exec_1.exec(`"${i}"`,e)}else{const e=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",["$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;",`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${r}' -DestinationPath '${s}' -Force }`,`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${r}', '${s}', $true) }`].join(" ")],t=yield io.which("powershell",!0);core.debug("Using powershell at path: "+t),yield exec_1.exec(`"${t}"`,e)}}))}function extractZipNix(e,t){return __awaiter(this,void 0,void 0,(function*(){const r=yield io.which("unzip",!0),s=[e];core.isDebug()||s.unshift("-q"),s.unshift("-o"),yield exec_1.exec(`"${r}"`,s,{cwd:t})}))}function cacheDir(e,t,r,s){return __awaiter(this,void 0,void 0,(function*(){if(r=semver.clean(r)||r,s=s||os.arch(),core.debug(`Caching tool ${t} ${r} ${s}`),core.debug("source dir: "+e),!fs.statSync(e).isDirectory())throw Error("sourceDir is not a directory");const i=yield _createToolPath(t,r,s);for(const t of fs.readdirSync(e)){const r=path.join(e,t);yield io.cp(r,i,{recursive:!0})}return _completeToolPath(t,r,s),i}))}function cacheFile(e,t,r,s,i){return __awaiter(this,void 0,void 0,(function*(){if(s=semver.clean(s)||s,i=i||os.arch(),core.debug(`Caching tool ${r} ${s} ${i}`),core.debug("source file: "+e),!fs.statSync(e).isFile())throw Error("sourceFile is not a file");const n=yield _createToolPath(r,s,i),o=path.join(n,t);return core.debug("destination file "+o),yield io.cp(e,o),_completeToolPath(r,s,i),n}))}function find(e,t,r){if(!e)throw Error("toolName parameter is required");if(!t)throw Error("versionSpec parameter is required");r=r||os.arch(),isExplicitVersion(t)||(t=evaluateVersions(findAllVersions(e,r),t));let s="";if(t){t=semver.clean(t)||"";const i=path.join(_getCacheDirectory(),e,t,r);core.debug("checking cache: "+i),fs.existsSync(i)&&fs.existsSync(i+".complete")?(core.debug(`Found tool in cache ${e} ${t} ${r}`),s=i):core.debug("not found")}return s}function findAllVersions(e,t){const r=[];t=t||os.arch();const s=path.join(_getCacheDirectory(),e);if(fs.existsSync(s)){const e=fs.readdirSync(s);for(const i of e)if(isExplicitVersion(i)){const e=path.join(s,i,t||"");fs.existsSync(e)&&fs.existsSync(e+".complete")&&r.push(i)}}return r}function getManifestFromRepo(e,t,r,s="master"){return __awaiter(this,void 0,void 0,(function*(){let i=[];const n=`https://api.github.com/repos/${e}/${t}/git/trees/${s}`,o=new httpm.HttpClient("tool-cache"),a={};r&&(core.debug("set auth"),a.authorization=r);const h=yield o.getJson(n,a);if(!h.result)return i;let c="";for(const e of h.result.tree)if("versions-manifest.json"===e.path){c=e.url;break}a.accept="application/vnd.github.VERSION.raw";let l=yield(yield o.get(c,a)).readBody();if(l){l=l.replace(/^\uFEFF/,"");try{i=JSON.parse(l)}catch(p){core.debug("Invalid json")}}return i}))}function findFromManifest(e,t,r,s=os.arch()){return __awaiter(this,void 0,void 0,(function*(){return yield mm._findMatch(e,t,r,s)}))}function _createExtractFolder(e){return __awaiter(this,void 0,void 0,(function*(){return e||(e=path.join(_getTempDirectory(),v4_1.default())),yield io.mkdirP(e),e}))}function _createToolPath(e,t,r){return __awaiter(this,void 0,void 0,(function*(){const s=path.join(_getCacheDirectory(),e,semver.clean(t)||t,r||"");core.debug("destination "+s);const i=s+".complete";return yield io.rmRF(s),yield io.rmRF(i),yield io.mkdirP(s),s}))}function _completeToolPath(e,t,r){const s=path.join(_getCacheDirectory(),e,semver.clean(t)||t,r||"");fs.writeFileSync(s+".complete",""),core.debug("finished caching tool")}function isExplicitVersion(e){const t=semver.clean(e)||"";core.debug("isExplicit: "+t);const r=null!=semver.valid(t);return core.debug("explicit? "+r),r}function evaluateVersions(e,t){let r="";core.debug(`evaluating ${e.length} versions`);for(let s=(e=e.sort(((e,t)=>semver.gt(e,t)?1:-1))).length-1;s>=0;s--){const i=e[s];if(semver.satisfies(i,t)){r=i;break}}return core.debug(r?"matched: "+r:"match not found"),r}function _getCacheDirectory(){const e=process.env.RUNNER_TOOL_CACHE||"";return assert_1.ok(e,"Expected RUNNER_TOOL_CACHE to be defined"),e}function _getTempDirectory(){const e=process.env.RUNNER_TEMP||"";return assert_1.ok(e,"Expected RUNNER_TEMP to be defined"),e}function _getGlobal(e,t){const r=setupCpp.commonjsGlobal[e];return void 0!==r?r:t}function _unique(e){return Array.from(new Set(e))}function isDigit(e){return e>=CHAR_0&&CHAR_9>=e}function isHexit(e){return e>=CHAR_A&&CHAR_F>=e||e>=CHAR_a&&CHAR_f>=e||e>=CHAR_0&&CHAR_9>=e}function isBit(e){return e===CHAR_1||e===CHAR_0}function isOctit(e){return e>=CHAR_0&&CHAR_7>=e}function isAlphaNumQuoteHyphen(e){return e>=CHAR_A&&CHAR_Z>=e||e>=CHAR_a&&CHAR_z>=e||e>=CHAR_0&&CHAR_9>=e||e===CHAR_APOS||e===CHAR_QUOT||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function isAlphaNumHyphen(e){return e>=CHAR_A&&CHAR_Z>=e||e>=CHAR_a&&CHAR_z>=e||e>=CHAR_0&&CHAR_9>=e||e===CHAR_LOWBAR||e===CHAR_HYPHEN}function hasKey(e,t){return!!hasOwnProperty.call(e,t)||("__proto__"===t&&defineProperty(e,"__proto__",descriptor),!1)}function InlineTable(){return Object.defineProperties({},{[_type]:{value:INLINE_TABLE}})}function isInlineTable(e){return null!==e&&"object"==typeof e&&e[_type]===INLINE_TABLE}function Table(){return Object.defineProperties({},{[_type]:{value:TABLE},[_declared]:{value:!1,writable:!0}})}function isTable(e){return null!==e&&"object"==typeof e&&e[_type]===TABLE}function InlineList(e){return Object.defineProperties([],{[_type]:{value:INLINE_LIST},[_contentType]:{value:e}})}function isInlineList(e){return null!==e&&"object"==typeof e&&e[_type]===INLINE_LIST}function List(){return Object.defineProperties([],{[_type]:{value:LIST}})}function isList(e){return null!==e&&"object"==typeof e&&e[_type]===LIST}function Integer(e){let t=+e;return Object.is(t,-0)&&(t=0),setupCpp.commonjsGlobal.BigInt&&!Number.isSafeInteger(t)?new BoxedBigInt(e):Object.defineProperties(new Number(t),{isNaN:{value:function(){return isNaN(this)}},[_type]:{value:INTEGER},[_inspect]:{value:()=>`[Integer: ${e}]`}})}function isInteger(e){return null!==e&&"object"==typeof e&&e[_type]===INTEGER}function Float(e){return Object.defineProperties(new Number(e),{[_type]:{value:FLOAT},[_inspect]:{value:()=>`[Float: ${e}]`}})}function isFloat(e){return null!==e&&"object"==typeof e&&e[_type]===FLOAT}function tomlType$1(e){const t=typeof e;if("object"===t){if(null===e)return"null";if(e instanceof Date)return"datetime";if(_type in e)switch(e[_type]){case INLINE_TABLE:return"inline-table";case INLINE_LIST:return"inline-list";case TABLE:return"table";case LIST:return"list";case FLOAT:return"float";case INTEGER:return"integer"}}return t}function makeParserClass(e){return class extends e{constructor(){super(),this.ctx=this.obj=Table()}atEndOfWord(){return this.char===CHAR_NUM||this.char===CTRL_I||this.char===CHAR_SP||this.atEndOfLine()}atEndOfLine(){return this.char===e.END||this.char===CTRL_J||this.char===CTRL_M}parseStart(){if(this.char===e.END)return null;if(this.char===CHAR_LSQB)return this.call(this.parseTableOrList);if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(isAlphaNumQuoteHyphen(this.char))return this.callNow(this.parseAssignStatement);throw this.error(new TomlError(`Unknown character "${this.char}"`))}parseWhitespaceToEOL(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M)return null;if(this.char===CHAR_NUM)return this.goto(this.parseComment);if(this.char===e.END||this.char===CTRL_J)return this.return();throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"))}parseAssignStatement(){return this.callNow(this.parseAssign,this.recordAssignStatement)}recordAssignStatement(e){let t=this.ctx,r=e.key.pop();for(let s of e.key){if(hasKey(t,s)&&(!isTable(t[s])||t[s][_declared]))throw this.error(new TomlError("Can't redefine existing key"));t=t[s]=t[s]||Table()}if(hasKey(t,r))throw this.error(new TomlError("Can't redefine existing key"));return t[r]=isInteger(e.value)||isFloat(e.value)?e.value.valueOf():e.value,this.goto(this.parseWhitespaceToEOL)}parseAssign(){return this.callNow(this.parseKeyword,this.recordAssignKeyword)}recordAssignKeyword(e){return this.state.resultTable?this.state.resultTable.push(e):this.state.resultTable=[e],this.goto(this.parseAssignKeywordPreDot)}parseAssignKeywordPreDot(){return this.char===CHAR_PERIOD?this.next(this.parseAssignKeywordPostDot):this.char!==CHAR_SP&&this.char!==CTRL_I?this.goto(this.parseAssignEqual):void 0}parseAssignKeywordPostDot(){if(this.char!==CHAR_SP&&this.char!==CTRL_I)return this.callNow(this.parseKeyword,this.recordAssignKeyword)}parseAssignEqual(){if(this.char===CHAR_EQUALS)return this.next(this.parseAssignPreValue);throw this.error(new TomlError('Invalid character, expected "="'))}parseAssignPreValue(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseValue,this.recordAssignValue)}recordAssignValue(e){return this.returnNow({key:this.state.resultTable,value:e})}parseComment(){do{if(this.char===e.END||this.char===CTRL_J)return this.return()}while(this.nextChar())}parseTableOrList(){if(this.char!==CHAR_LSQB)return this.goto(this.parseTable);this.next(this.parseList)}parseTable(){return this.ctx=this.obj,this.goto(this.parseTableNext)}parseTableNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseTableMore)}parseTableMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)&&(!isTable(this.ctx[e])||this.ctx[e][_declared]))throw this.error(new TomlError("Can't redefine existing key"));return this.ctx=this.ctx[e]=this.ctx[e]||Table(),this.ctx[_declared]=!0,this.next(this.parseWhitespaceToEOL)}if(this.char===CHAR_PERIOD){if(hasKey(this.ctx,e))if(isTable(this.ctx[e]))this.ctx=this.ctx[e];else{if(!isList(this.ctx[e]))throw this.error(new TomlError("Can't redefine existing key"));this.ctx=this.ctx[e][this.ctx[e].length-1]}else this.ctx=this.ctx[e]=Table();return this.next(this.parseTableNext)}throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseList(){return this.ctx=this.obj,this.goto(this.parseListNext)}parseListNext(){return this.char===CHAR_SP||this.char===CTRL_I?null:this.callNow(this.parseKeyword,this.parseListMore)}parseListMore(e){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CHAR_RSQB){if(hasKey(this.ctx,e)||(this.ctx[e]=List()),isInlineList(this.ctx[e]))throw this.error(new TomlError("Can't extend an inline array"));if(!isList(this.ctx[e]))throw this.error(new TomlError("Can't redefine an existing key"));{const t=Table();this.ctx[e].push(t),this.ctx=t}return this.next(this.parseListEnd)}if(this.char===CHAR_PERIOD){if(hasKey(this.ctx,e)){if(isInlineList(this.ctx[e]))throw this.error(new TomlError("Can't extend an inline array"));if(isInlineTable(this.ctx[e]))throw this.error(new TomlError("Can't extend an inline table"));if(isList(this.ctx[e]))this.ctx=this.ctx[e][this.ctx[e].length-1];else{if(!isTable(this.ctx[e]))throw this.error(new TomlError("Can't redefine an existing key"));this.ctx=this.ctx[e]}}else this.ctx=this.ctx[e]=Table();return this.next(this.parseListNext)}throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseListEnd(e){if(this.char===CHAR_RSQB)return this.next(this.parseWhitespaceToEOL);throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"))}parseValue(){if(this.char===e.END)throw this.error(new TomlError("Key without value"));if(this.char===CHAR_QUOT)return this.next(this.parseDoubleString);if(this.char===CHAR_APOS)return this.next(this.parseSingleString);if(this.char===CHAR_HYPHEN||this.char===CHAR_PLUS)return this.goto(this.parseNumberSign);if(this.char===CHAR_i)return this.next(this.parseInf);if(this.char===CHAR_n)return this.next(this.parseNan);if(isDigit(this.char))return this.goto(this.parseNumberOrDateTime);if(this.char===CHAR_t||this.char===CHAR_f)return this.goto(this.parseBoolean);if(this.char===CHAR_LSQB)return this.call(this.parseInlineList,this.recordValue);if(this.char===CHAR_LCUB)return this.call(this.parseInlineTable,this.recordValue);throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"))}recordValue(e){return this.returnNow(e)}parseInf(){if(this.char===CHAR_n)return this.next(this.parseInf2);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseInf2(){if(this.char===CHAR_f)return this.return("-"===this.state.buf?-1/0:1/0);throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'))}parseNan(){if(this.char===CHAR_a)return this.next(this.parseNan2);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseNan2(){if(this.char===CHAR_n)return this.return(NaN);throw this.error(new TomlError('Unexpected character, expected "nan"'))}parseKeyword(){return this.char===CHAR_QUOT?this.next(this.parseBasicString):this.char===CHAR_APOS?this.next(this.parseLiteralString):this.goto(this.parseBareKey)}parseBareKey(){do{if(this.char===e.END)throw this.error(new TomlError("Key ended without value"));if(!isAlphaNumHyphen(this.char)){if(0===this.state.buf.length)throw this.error(new TomlError("Empty bare keys are not allowed"));return this.returnNow()}this.consume()}while(this.nextChar())}parseSingleString(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiStringMaybe):this.goto(this.parseLiteralString)}parseLiteralString(){do{if(this.char===CHAR_APOS)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||CTRL_CHAR_BOUNDARY>=this.char&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiStringMaybe(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiString):this.returnNow()}parseLiteralMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseLiteralMultiStringContent):this.goto(this.parseLiteralMultiStringContent)}parseLiteralMultiStringContent(){do{if(this.char===CHAR_APOS)return this.next(this.parseLiteralMultiEnd);if(this.char===e.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||CTRL_CHAR_BOUNDARY>=this.char&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}parseLiteralMultiEnd(){return this.char===CHAR_APOS?this.next(this.parseLiteralMultiEnd2):(this.state.buf+="'",this.goto(this.parseLiteralMultiStringContent))}parseLiteralMultiEnd2(){return this.char===CHAR_APOS?this.return():(this.state.buf+="''",this.goto(this.parseLiteralMultiStringContent))}parseDoubleString(){return this.char===CHAR_QUOT?this.next(this.parseMultiStringMaybe):this.goto(this.parseBasicString)}parseBasicString(){do{if(this.char===CHAR_BSOL)return this.call(this.parseEscape,this.recordEscapeReplacement);if(this.char===CHAR_QUOT)return this.return();if(this.atEndOfLine())throw this.error(new TomlError("Unterminated string"));if(this.char===CHAR_DEL||CTRL_CHAR_BOUNDARY>=this.char&&this.char!==CTRL_I)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}recordEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseBasicString)}parseMultiStringMaybe(){return this.char===CHAR_QUOT?this.next(this.parseMultiString):this.returnNow()}parseMultiString(){return this.char===CTRL_M?null:this.char===CTRL_J?this.next(this.parseMultiStringContent):this.goto(this.parseMultiStringContent)}parseMultiStringContent(){do{if(this.char===CHAR_BSOL)return this.call(this.parseMultiEscape,this.recordMultiEscapeReplacement);if(this.char===CHAR_QUOT)return this.next(this.parseMultiEnd);if(this.char===e.END)throw this.error(new TomlError("Unterminated multi-line string"));if(this.char===CHAR_DEL||CTRL_CHAR_BOUNDARY>=this.char&&this.char!==CTRL_I&&this.char!==CTRL_J&&this.char!==CTRL_M)throw this.errorControlCharInString();this.consume()}while(this.nextChar())}errorControlCharInString(){let e="\\u00";return 16>this.char&&(e+="0"),e+=this.char.toString(16),this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${e} instead`))}recordMultiEscapeReplacement(e){return this.state.buf+=e,this.goto(this.parseMultiStringContent)}parseMultiEnd(){return this.char===CHAR_QUOT?this.next(this.parseMultiEnd2):(this.state.buf+='"',this.goto(this.parseMultiStringContent))}parseMultiEnd2(){return this.char===CHAR_QUOT?this.return():(this.state.buf+='""',this.goto(this.parseMultiStringContent))}parseMultiEscape(){return this.char===CTRL_M||this.char===CTRL_J?this.next(this.parseMultiTrim):this.char===CHAR_SP||this.char===CTRL_I?this.next(this.parsePreMultiTrim):this.goto(this.parseEscape)}parsePreMultiTrim(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===CTRL_M||this.char===CTRL_J)return this.next(this.parseMultiTrim);throw this.error(new TomlError("Can't escape whitespace"))}parseMultiTrim(){return this.char===CTRL_J||this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M?null:this.returnNow()}parseEscape(){if(this.char in escapes)return this.return(escapes[this.char]);if(this.char===CHAR_u)return this.call(this.parseSmallUnicode,this.parseUnicodeReturn);if(this.char===CHAR_U)return this.call(this.parseLargeUnicode,this.parseUnicodeReturn);throw this.error(new TomlError("Unknown escape character: "+this.char))}parseUnicodeReturn(e){try{const t=parseInt(e,16);if(t>=SURROGATE_FIRST&&SURROGATE_LAST>=t)throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));return this.returnNow(String.fromCodePoint(t))}catch(t){throw this.error(TomlError.wrap(t))}}parseSmallUnicode(){if(!isHexit(this.char))throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));if(this.consume(),this.state.buf.length>=4)return this.return()}parseLargeUnicode(){if(!isHexit(this.char))throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));if(this.consume(),this.state.buf.length>=8)return this.return()}parseNumberSign(){return this.consume(),this.next(this.parseMaybeSignedInfOrNan)}parseMaybeSignedInfOrNan(){return this.char===CHAR_i?this.next(this.parseInf):this.char===CHAR_n?this.next(this.parseNan):this.callNow(this.parseNoUnder,this.parseNumberIntegerStart)}parseNumberIntegerStart(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberIntegerExponentOrDecimal)):this.goto(this.parseNumberInteger)}parseNumberIntegerExponentOrDecimal(){return this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Integer(this.state.buf))}parseNumberInteger(){if(!isDigit(this.char)){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnder);if(this.char===CHAR_E||this.char===CHAR_e)return this.consume(),this.next(this.parseNumberExponentSign);if(this.char===CHAR_PERIOD)return this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}this.consume()}parseNoUnder(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD||this.char===CHAR_E||this.char===CHAR_e)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNoUnderHexOctBinLiteral(){if(this.char===CHAR_LOWBAR||this.char===CHAR_PERIOD)throw this.error(new TomlError("Unexpected character, expected digit"));if(this.atEndOfWord())throw this.error(new TomlError("Incomplete number"));return this.returnNow()}parseNumberFloat(){return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder,this.parseNumberFloat):isDigit(this.char)?void this.consume():this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.returnNow(Float(this.state.buf))}parseNumberExponentSign(){if(isDigit(this.char))return this.goto(this.parseNumberExponent);if(this.char!==CHAR_HYPHEN&&this.char!==CHAR_PLUS)throw this.error(new TomlError("Unexpected character, expected -, + or digit"));this.consume(),this.call(this.parseNoUnder,this.parseNumberExponent)}parseNumberExponent(){if(!isDigit(this.char))return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder):this.returnNow(Float(this.state.buf));this.consume()}parseNumberOrDateTime(){return this.char===CHAR_0?(this.consume(),this.next(this.parseNumberBaseOrDateTime)):this.goto(this.parseNumberOrDateTimeOnly)}parseNumberOrDateTimeOnly(){return this.char===CHAR_LOWBAR?this.call(this.parseNoUnder,this.parseNumberInteger):isDigit(this.char)?(this.consume(),void(this.state.buf.length>4&&this.next(this.parseNumberInteger))):this.char===CHAR_E||this.char===CHAR_e?(this.consume(),this.next(this.parseNumberExponentSign)):this.char===CHAR_PERIOD?(this.consume(),this.call(this.parseNoUnder,this.parseNumberFloat)):this.char===CHAR_HYPHEN?this.goto(this.parseDateTime):this.char===CHAR_COLON?this.goto(this.parseOnlyTimeHour):this.returnNow(Integer(this.state.buf))}parseDateTimeOnly(){if(4>this.state.buf.length){if(isDigit(this.char))return this.consume();if(this.char===CHAR_COLON)return this.goto(this.parseOnlyTimeHour);throw this.error(new TomlError("Expected digit while parsing year part of a date"))}if(this.char===CHAR_HYPHEN)return this.goto(this.parseDateTime);throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"))}parseNumberBaseOrDateTime(){return this.char===CHAR_b?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerBin)):this.char===CHAR_o?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerOct)):this.char===CHAR_x?(this.consume(),this.call(this.parseNoUnderHexOctBinLiteral,this.parseIntegerHex)):this.char===CHAR_PERIOD?this.goto(this.parseNumberInteger):isDigit(this.char)?this.goto(this.parseDateTimeOnly):this.returnNow(Integer(this.state.buf))}parseIntegerHex(){if(!isHexit(this.char)){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}this.consume()}parseIntegerOct(){if(!isOctit(this.char)){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}this.consume()}parseIntegerBin(){if(!isBit(this.char)){if(this.char===CHAR_LOWBAR)return this.call(this.parseNoUnderHexOctBinLiteral);{const e=Integer(this.state.buf);if(e.isNaN())throw this.error(new TomlError("Invalid number"));return this.returnNow(e)}}this.consume()}parseDateTime(){if(4>this.state.buf.length)throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseDateMonth)}parseDateMonth(){if(this.char===CHAR_HYPHEN){if(2>this.state.buf.length)throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseDateDay)}if(!isDigit(this.char))throw this.error(new TomlError("Incomplete datetime"));this.consume()}parseDateDay(){if(this.char===CHAR_T||this.char===CHAR_SP){if(2>this.state.buf.length)throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));return this.state.result+="-"+this.state.buf,this.state.buf="",this.next(this.parseStartTimeHour)}if(this.atEndOfWord())return this.returnNow(createDate(this.state.result+"-"+this.state.buf));if(!isDigit(this.char))throw this.error(new TomlError("Incomplete datetime"));this.consume()}parseStartTimeHour(){return this.atEndOfWord()?this.returnNow(createDate(this.state.result)):this.goto(this.parseTimeHour)}parseTimeHour(){if(this.char===CHAR_COLON){if(2>this.state.buf.length)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result+="T"+this.state.buf,this.state.buf="",this.next(this.parseTimeMin)}if(!isDigit(this.char))throw this.error(new TomlError("Incomplete datetime"));this.consume()}parseTimeMin(){if(this.state.buf.length>=2||!isDigit(this.char)){if(2===this.state.buf.length&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeSec);throw this.error(new TomlError("Incomplete datetime"))}this.consume()}parseTimeSec(){if(!isDigit(this.char))throw this.error(new TomlError("Incomplete datetime"));if(this.consume(),2===this.state.buf.length)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseTimeZoneOrFraction)}parseOnlyTimeHour(){if(this.char===CHAR_COLON){if(2>this.state.buf.length)throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));return this.state.result=this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeMin)}throw this.error(new TomlError("Incomplete time"))}parseOnlyTimeMin(){if(this.state.buf.length>=2||!isDigit(this.char)){if(2===this.state.buf.length&&this.char===CHAR_COLON)return this.state.result+=":"+this.state.buf,this.state.buf="",this.next(this.parseOnlyTimeSec);throw this.error(new TomlError("Incomplete time"))}this.consume()}parseOnlyTimeSec(){if(!isDigit(this.char))throw this.error(new TomlError("Incomplete time"));if(this.consume(),2===this.state.buf.length)return this.next(this.parseOnlyTimeFractionMaybe)}parseOnlyTimeFractionMaybe(){if(this.state.result+=":"+this.state.buf,this.char!==CHAR_PERIOD)return this.return(createTime(this.state.result));this.state.buf="",this.next(this.parseOnlyTimeFraction)}parseOnlyTimeFraction(){if(!isDigit(this.char)){if(this.atEndOfWord()){if(0===this.state.buf.length)throw this.error(new TomlError("Expected digit in milliseconds"));return this.returnNow(createTime(this.state.result+"."+this.state.buf))}throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}this.consume()}parseTimeZoneOrFraction(){if(this.char===CHAR_PERIOD)this.consume(),this.next(this.parseDateTimeFraction);else{if(this.char!==CHAR_HYPHEN&&this.char!==CHAR_PLUS){if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}this.consume(),this.next(this.parseTimeZoneHour)}}parseDateTimeFraction(){if(isDigit(this.char))this.consume();else{if(1===this.state.buf.length)throw this.error(new TomlError("Expected digit in milliseconds"));if(this.char!==CHAR_HYPHEN&&this.char!==CHAR_PLUS){if(this.char===CHAR_Z)return this.consume(),this.return(createDateTime(this.state.result+this.state.buf));if(this.atEndOfWord())return this.returnNow(createDateTimeFloat(this.state.result+this.state.buf));throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"))}this.consume(),this.next(this.parseTimeZoneHour)}}parseTimeZoneHour(){if(!isDigit(this.char))throw this.error(new TomlError("Unexpected character in datetime, expected digit"));if(this.consume(),/\d\d$/.test(this.state.buf))return this.next(this.parseTimeZoneSep)}parseTimeZoneSep(){if(this.char!==CHAR_COLON)throw this.error(new TomlError("Unexpected character in datetime, expected colon"));this.consume(),this.next(this.parseTimeZoneMin)}parseTimeZoneMin(){if(!isDigit(this.char))throw this.error(new TomlError("Unexpected character in datetime, expected digit"));if(this.consume(),/\d\d$/.test(this.state.buf))return this.return(createDateTime(this.state.result+this.state.buf))}parseBoolean(){return this.char===CHAR_t?(this.consume(),this.next(this.parseTrue_r)):this.char===CHAR_f?(this.consume(),this.next(this.parseFalse_a)):void 0}parseTrue_r(){if(this.char===CHAR_r)return this.consume(),this.next(this.parseTrue_u);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_u(){if(this.char===CHAR_u)return this.consume(),this.next(this.parseTrue_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseTrue_e(){if(this.char===CHAR_e)return this.return(!0);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_a(){if(this.char===CHAR_a)return this.consume(),this.next(this.parseFalse_l);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_l(){if(this.char===CHAR_l)return this.consume(),this.next(this.parseFalse_s);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_s(){if(this.char===CHAR_s)return this.consume(),this.next(this.parseFalse_e);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseFalse_e(){if(this.char===CHAR_e)return this.return(!1);throw this.error(new TomlError("Invalid boolean, expected true or false"))}parseInlineList(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===e.END)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_NUM?this.call(this.parseComment):this.char===CHAR_RSQB?this.return(this.state.resultArr||InlineList()):this.callNow(this.parseValue,this.recordInlineListValue)}recordInlineListValue(e){if(this.state.resultArr){const t=this.state.resultArr[_contentType],r=tomlType$1(e);if(t!==r)throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${t} and ${r}`))}else this.state.resultArr=InlineList(tomlType$1(e));return isFloat(e)||isInteger(e)?this.state.resultArr.push(e.valueOf()):this.state.resultArr.push(e),this.goto(this.parseInlineListNext)}parseInlineListNext(){if(this.char===CHAR_SP||this.char===CTRL_I||this.char===CTRL_M||this.char===CTRL_J)return null;if(this.char===CHAR_NUM)return this.call(this.parseComment);if(this.char===CHAR_COMMA)return this.next(this.parseInlineList);if(this.char===CHAR_RSQB)return this.goto(this.parseInlineList);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}parseInlineTable(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));return this.char===CHAR_RCUB?this.return(this.state.resultTable||InlineTable()):(this.state.resultTable||(this.state.resultTable=InlineTable()),this.callNow(this.parseAssign,this.recordInlineTableValue))}recordInlineTableValue(e){let t=this.state.resultTable,r=e.key.pop();for(let s of e.key){if(hasKey(t,s)&&(!isTable(t[s])||t[s][_declared]))throw this.error(new TomlError("Can't redefine existing key"));t=t[s]=t[s]||Table()}if(hasKey(t,r))throw this.error(new TomlError("Can't redefine existing key"));return t[r]=isInteger(e.value)||isFloat(e.value)?e.value.valueOf():e.value,this.goto(this.parseInlineTableNext)}parseInlineTableNext(){if(this.char===CHAR_SP||this.char===CTRL_I)return null;if(this.char===e.END||this.char===CHAR_NUM||this.char===CTRL_J||this.char===CTRL_M)throw this.error(new TomlError("Unterminated inline array"));if(this.char===CHAR_COMMA)return this.next(this.parseInlineTable);if(this.char===CHAR_RCUB)return this.goto(this.parseInlineTable);throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"))}}}function prettyError$2(e,t){if(null==e.pos||null==e.line)return e;let r=e.message;if(r+=` at row ${e.line+1}, col ${e.col+1}, pos ${e.pos}:\n`,t&&t.split){const s=t.split(/\n/),i=(Math.min(s.length,e.line+3)+"").length;let n=" ";for(;i>n.length;)n+=" ";for(let t=Math.max(0,e.line-1);Math.min(s.length,e.line+2)>t;++t){let o=t+1+"";if(i>o.length&&(o=" "+o),e.line===t){r+=o+"> "+s[t]+"\n",r+=n+" ";for(let t=0;e.col>t;++t)r+=" ";r+="^\n"}else r+=o+": "+s[t]+"\n"}}return e.message=r+"\n",e}function parseString(e){setupCpp.commonjsGlobal.Buffer&&setupCpp.commonjsGlobal.Buffer.isBuffer(e)&&(e=e.toString("utf8"));const t=new TOMLParser$2;try{return t.parse(e),t.finish()}catch(r){throw prettyError$1(r,e)}}function parseAsync(e,t){function r(t,s,n,o){if(t>=e.length)try{return n(i.finish())}catch(a){return o(prettyError(a,e))}try{i.parse(e.slice(t,t+s)),setImmediate(r,t+s,s,n,o)}catch(a){o(prettyError(a,e))}}t||(t={});const s=t.blocksize||40960,i=new TOMLParser$1;return new Promise(((e,t)=>{setImmediate(r,0,s,e,t)}))}function parseStream(e){return e?parseReadable(e):parseTransform()}function parseReadable(e){const t=new TOMLParser;return e.setEncoding("utf8"),new Promise(((r,s)=>{function i(){if(a=!0,!o)try{r(t.finish())}catch(e){s(e)}}function n(e){h=!0,s(e)}let o,a=!1,h=!1;e.once("end",i),e.once("error",n),function r(){let s;for(o=!0;null!==(s=e.read());)try{t.parse(s)}catch(c){return n(c)}if(o=!1,a)return i();h||e.once("readable",r)}()}))}function parseTransform(){const e=new TOMLParser;return new stream.Transform({objectMode:!0,transform(t,r,s){try{e.parse(t.toString(r))}catch(i){this.emit("error",i)}s()},flush(t){try{this.push(e.finish())}catch(r){this.emit("error",r)}t()}})}function stringify(e){if(null===e)throw typeError("null");if(void 0===e)throw typeError("undefined");if("object"!=typeof e)throw typeError(typeof e);if("function"==typeof e.toJSON&&(e=e.toJSON()),null==e)return null;const t=tomlType(e);if("table"!==t)throw typeError(t);return stringifyObject("","",e)}function typeError(e){return Error("Can only stringify objects, not "+e)}function arrayOneTypeError(){return Error("Array values can't have mixed types")}function getInlineKeys(e){return Object.keys(e).filter((t=>isInline(e[t])))}function getComplexKeys(e){return Object.keys(e).filter((t=>!isInline(e[t])))}function toJSON(e){let t=Array.isArray(e)?[]:{}.hasOwnProperty.call(e,"__proto__")?{["__proto__"]:void 0}:{};for(let r of Object.keys(e))t[r]=e[r]&&"function"==typeof e[r].toJSON&&!("toISOString"in e[r])?e[r].toJSON():e[r];return t}function stringifyObject(e,t,r){var s,i;s=getInlineKeys(r=toJSON(r)),i=getComplexKeys(r);var n=[],o=t||"";s.forEach((e=>{var t=tomlType(r[e]);"undefined"!==t&&"null"!==t&&n.push(o+stringifyKey(e)+" = "+stringifyAnyInline(r[e],!0))})),n.length>0&&n.push("");var a=e&&s.length>0?t+" ":"";return i.forEach((t=>{n.push(stringifyComplex(e,a,t,r[t]))})),n.join("\n")}function isInline(e){switch(tomlType(e)){case"undefined":case"null":case"integer":case"nan":case"float":case"boolean":case"string":case"datetime":return!0;case"array":return 0===e.length||"table"!==tomlType(e[0]);case"table":return 0===Object.keys(e).length;default:return!1}}function tomlType(e){return void 0===e?"undefined":null===e?"null":"bigint"==typeof e||Number.isInteger(e)&&!Object.is(e,-0)?"integer":"number"==typeof e?"float":"boolean"==typeof e?"boolean":"string"==typeof e?"string":"toISOString"in e?isNaN(e)?"undefined":"datetime":Array.isArray(e)?"array":"table"}function stringifyKey(e){var t=e+"";return/^[-A-Za-z0-9_]+$/.test(t)?t:stringifyBasicString(t)}function stringifyBasicString(e){return'"'+escapeString(e).replace(/"/g,'\\"')+'"'}function stringifyLiteralString(e){return"'"+e+"'"}function numpad(e,t){for(;e>t.length;)t="0"+t;return t}function escapeString(e){return e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/([\u0000-\u001f\u007f])/,(e=>"\\u"+numpad(4,e.codePointAt(0).toString(16))))}function stringifyMultilineString(e){let t=e.split(/\n/).map((e=>escapeString(e).replace(/"(?="")/g,'\\"'))).join("\n");return'"'===t.slice(-1)&&(t+="\\\n"),'"""\n'+t+'"""'}function stringifyAnyInline(e,t){let r=tomlType(e);return"string"===r&&(t&&/\n/.test(e)?r="string-multiline":!/[\b\t\n\f\r']/.test(e)&&/"/.test(e)&&(r="string-literal")),stringifyInline(e,r)}function stringifyInline(e,t){switch(t||(t=tomlType(e)),t){case"string-multiline":return stringifyMultilineString(e);case"string":return stringifyBasicString(e);case"string-literal":return stringifyLiteralString(e);case"integer":return stringifyInteger(e);case"float":return stringifyFloat(e);case"boolean":return stringifyBoolean(e);case"datetime":return stringifyDatetime(e);case"array":return stringifyInlineArray(e.filter((e=>"null"!==tomlType(e)&&"undefined"!==tomlType(e)&&"nan"!==tomlType(e))));case"table":return stringifyInlineTable(e);default:throw typeError(t)}}function stringifyInteger(e){return(e+"").replace(/\B(?=(\d{3})+(?!\d))/g,"_")}function stringifyFloat(e){if(e===1/0)return"inf";if(e===-1/0)return"-inf";if(Object.is(e,NaN))return"nan";if(Object.is(e,-0))return"-0.0";var t=(e+"").split("."),r=t[1]||0;return stringifyInteger(t[0])+"."+r}function stringifyBoolean(e){return e+""}function stringifyDatetime(e){return e.toISOString()}function isNumber(e){return"float"===e||"integer"===e}function arrayType(e){var t=tomlType(e[0]);return e.every((e=>tomlType(e)===t))?t:e.every((e=>isNumber(tomlType(e))))?"float":"mixed"}function validateArray(e){const t=arrayType(e);if("mixed"===t)throw arrayOneTypeError();return t}function stringifyInlineArray(e){const t=validateArray(e=toJSON(e));var r="[",s=e.map((e=>stringifyInline(e,t)));return s.join(", ").length>60||/\n/.test(s)?r+="\n "+s.join(",\n ")+"\n":r+=" "+s.join(", ")+(s.length>0?" ":""),r+"]"}function stringifyInlineTable(e){e=toJSON(e);var t=[];return Object.keys(e).forEach((r=>{t.push(stringifyKey(r)+" = "+stringifyAnyInline(e[r],!1))})),"{ "+t.join(", ")+(t.length>0?" ":"")+"}"}function stringifyComplex(e,t,r,s){var i=tomlType(s);if("array"===i)return stringifyArrayOfTables(e,t,r,s);if("table"===i)return stringifyComplexTable(e,t,r,s);throw typeError(i)}function stringifyArrayOfTables(e,t,r,s){validateArray(s=toJSON(s));var i=tomlType(s[0]);if("table"!==i)throw typeError(i);var n=e+stringifyKey(r),o="";return s.forEach((e=>{o.length>0&&(o+="\n"),o+=t+"[["+n+"]]\n",o+=stringifyObject(n+".",t,e)})),o}function stringifyComplexTable(e,t,r,s){var i=e+stringifyKey(r),n="";return getInlineKeys(s).length>0&&(n+=t+"["+i+"]\n"),n+stringifyObject(i+".",t,s)}function createSymlinkInFolder(e,t,r,s=!1){const i=path__namespace.join(e,t),n=path__namespace.join(e,r);fs$1.existsSync(n)||(fs$1.symlinkSync(i,n),!IS_WINDOWS&&s&&fs$1.chmodSync(n,"755"))}function validateVersion(e){return isNightlyKeyword(e)||!!setupCpp.semver.validRange(e)}function isNightlyKeyword(e){return"nightly"===e}function getPyPyVersionFromPath(e){return path__namespace.basename(path__namespace.dirname(e))}function readExactPyPyVersionFile(e){let t="";const r=path__namespace.join(e,PYPY_VERSION_FILE);return fs$1.existsSync(r)&&(t=(""+fs$1.readFileSync(r)).trim()),t}function writeExactPyPyVersionFile(e,t){const r=path__namespace.join(e,PYPY_VERSION_FILE);fs$1.writeFileSync(r,t)}function validatePythonVersionFormatForPyPy(e){return/^\d+\.\d+$/.test(e)}async function getWindowsInfo(){const{stdout:e}=await setupCpp.getExecOutput_1('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"',void 0,{silent:!0});return{osName:"Windows",osVersion:e.trim().split(" ")[3]}}async function getMacOSInfo(){const{stdout:e}=await setupCpp.getExecOutput_1("sw_vers",["-productVersion"],{silent:!0});return{osName:"macOS",osVersion:e.trim()}}async function getLinuxInfo(){const{stdout:e}=await setupCpp.getExecOutput_1("lsb_release",["-i","-r","-s"],{silent:!0}),[t,r]=e.trim().split("\n");return setupCpp.coreExports.debug(`OS Name: ${t}, Version: ${r}`),{osName:t,osVersion:r}}async function getOSInfo(){let e;try{IS_WINDOWS?e=await getWindowsInfo():IS_LINUX?e=await getLinuxInfo():IS_MAC&&(e=await getMacOSInfo())}catch(t){setupCpp.coreExports.debug(t.message)}finally{return e}}async function installPyPy(e,t,r,s,i){let n;if(!(i=null!=i?i:await getAvailablePyPyVersions())||0===i.length)throw Error("No release was found in PyPy version.json");let o=findRelease(i,t,e,r,!1);if(!o||!o.foundAsset)throw Error(`PyPy version ${t} (${e}) with arch ${r} not found`);const{foundAsset:a,resolvedPythonVersion:h,resolvedPyPyVersion:c}=o,l=""+a.download_url;setupCpp.coreExports.info(`Downloading PyPy from "${l}" ...`);try{const e=await downloadTool_1(l);setupCpp.coreExports.info("Extracting downloaded archive..."),n=IS_WINDOWS?await extractZip_1(e):await extractTar_1(e,void 0,"x");const t=fs$1.readdirSync(n)[0],s=path__namespace.join(n,t);let i=s;isNightlyKeyword(c)||(i=await cacheDir_1(s,"PyPy",h,r)),writeExactPyPyVersionFile(i,c);const o=getPyPyBinaryPath(i);return await createPyPySymlink(o,h),await installPip(o),{installDir:i,resolvedPythonVersion:h,resolvedPyPyVersion:c}}catch(p){throw p instanceof Error&&(setupCpp.coreExports.info(p instanceof HTTPError_1&&(403===p.httpStatusCode||429===p.httpStatusCode)?`Received HTTP status code ${p.httpStatusCode}. This usually indicates the rate limit has been exceeded`:p.message),void 0!==p.stack&&setupCpp.coreExports.debug(p.stack)),p}}async function getAvailablePyPyVersions(){const e="https://downloads.python.org/pypy/versions.json",t=new httpClient.HttpClient("tool-cache"),r=await t.getJson(e);if(!r.result)throw Error(`Unable to retrieve the list of available PyPy versions from '${e}'`);return r.result}async function createPyPySymlink(e,t){const r=setupCpp.semver.coerce(t),s=setupCpp.semver.major(r),i=2===s?"":"3",n=`${s}.${setupCpp.semver.minor(r)}`,o=IS_WINDOWS?".exe":"";setupCpp.coreExports.info("Creating symlinks..."),createSymlinkInFolder(e,`pypy${i}${o}`,`python${s}${o}`,!0),createSymlinkInFolder(e,`pypy${i}${o}`,"python"+o,!0),createSymlinkInFolder(e,`pypy${i}${o}`,`pypy${n}${o}`,!0)}async function installPip(e){setupCpp.coreExports.info("Installing and updating pip");const t=path__namespace.join(e,"python");await setupCpp.exec_2(t+" -m ensurepip"),await setupCpp.exec_2(e+"/python -m pip install --ignore-installed pip")}function findRelease(e,t,r,s,i){const n={includePrerelease:i},o=e.filter((e=>{const i=setupCpp.semver.satisfies(setupCpp.semver.coerce(e.python_version),t),o=isNightlyKeyword(r)&&isNightlyKeyword(e.pypy_version)||setupCpp.semver.satisfies(pypyVersionToSemantic(e.pypy_version),r,n),a=e.files&&(IS_WINDOWS?isArchPresentForWindows(e,s):isArchPresentForMacOrLinux(e,s,process.platform));return i&&o&&a}));if(0===o.length)return null;const a=o.sort(((e,t)=>setupCpp.semver.compare(setupCpp.semver.coerce(pypyVersionToSemantic(t.pypy_version)),setupCpp.semver.coerce(pypyVersionToSemantic(e.pypy_version)))||setupCpp.semver.compare(setupCpp.semver.coerce(t.python_version),setupCpp.semver.coerce(e.python_version))))[0];return{foundAsset:IS_WINDOWS?findAssetForWindows(a,s):findAssetForMacOrLinux(a,s,process.platform),resolvedPythonVersion:a.python_version,resolvedPyPyVersion:a.pypy_version.trim()}}function getPyPyBinaryPath(e){const t=path__namespace.join(e,"bin");return IS_WINDOWS?e:t}function pypyVersionToSemantic(e){return e.replace(/(\d+\.\d+\.\d+)((?:a|b|rc))(\d*)/g,"$1-$2.$3")}function isArchPresentForWindows(e,t){return t=replaceX32toX86(t),e.files.some((e=>WINDOWS_PLATFORMS.includes(e.platform)&&e.arch===t))}function isArchPresentForMacOrLinux(e,t,r){return e.files.some((e=>e.arch===t&&e.platform===r))}function findAssetForWindows(e,t){return t=replaceX32toX86(t),e.files.find((e=>WINDOWS_PLATFORMS.includes(e.platform)&&e.arch===t))}function findAssetForMacOrLinux(e,t,r){return e.files.find((e=>e.arch===t&&e.platform===r))}function replaceX32toX86(e){return"x32"===e&&(e="x86"),e}async function findPyPyVersion(e,t,r,s,i){let n,o="",a="";const h=parsePyPyVersion(e);({installDir:n,resolvedPythonVersion:a,resolvedPyPyVersion:o}=findPyPyToolCache(h.pythonVersion,h.pypyVersion,t)),n||({installDir:n,resolvedPythonVersion:a,resolvedPyPyVersion:o}=await installPyPy(h.pypyVersion,h.pythonVersion,t,i,void 0));const c=path__namespace.join(n,IS_WINDOWS?"Scripts":"bin"),l=path__namespace.join(IS_WINDOWS?n:c,"python"+(IS_WINDOWS?".exe":"")),p=getPyPyBinaryPath(n);return setupCpp.coreExports.exportVariable("pythonLocation",n),setupCpp.coreExports.exportVariable("Python_ROOT_DIR",n),setupCpp.coreExports.exportVariable("Python2_ROOT_DIR",n),setupCpp.coreExports.exportVariable("Python3_ROOT_DIR",n),setupCpp.coreExports.exportVariable("PKG_CONFIG_PATH",p+"/lib/pkgconfig"),setupCpp.coreExports.addPath(p),setupCpp.coreExports.addPath(c),setupCpp.coreExports.setOutput("python-version","pypy"+o),setupCpp.coreExports.setOutput("python-path",l),{resolvedPyPyVersion:o,resolvedPythonVersion:a}}function findPyPyToolCache(e,t,r){let s="",i="",n=IS_WINDOWS?findPyPyInstallDirForWindows(e):find_1("PyPy",e,r);return n&&(i=getPyPyVersionFromPath(n),s=readExactPyPyVersionFile(n),setupCpp.semver.satisfies(s,t)||(n=null,s="",i="")),n||setupCpp.coreExports.info(`PyPy version ${e} (${t}) was not found in the local cache`),{installDir:n,resolvedPythonVersion:i,resolvedPyPyVersion:s}}function parsePyPyVersion(e){const t=e.split("-").filter((e=>!!e));if(/^(pypy)(.+)/.test(t[0])){const e=t[0].replace("pypy","");t.splice(0,1,"pypy",e)}if(2>t.length||"pypy"!=t[0])throw Error("Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy<python-version>' or 'pypy-<python-version>'. See README for examples and documentation.");const r=t[1];let s;if(s=t.length>2?pypyVersionToSemantic(t[2]):"x",!validateVersion(r)||!validateVersion(s))throw Error("Invalid 'version' property for PyPy. Both Python version and PyPy versions should satisfy SemVer notation. See README for examples and documentation.");if(!validatePythonVersionFormatForPyPy(r))throw Error("Invalid format of Python version for PyPy. Python version should be specified in format 'x.y'. See README for examples and documentation.");return{pypyVersion:s,pythonVersion:r}}function findPyPyInstallDirForWindows(e){let t="";return WINDOWS_ARCHS.forEach((r=>t=t||find_1("PyPy",e,r))),t}async function findReleaseFromManifest(e,t,r){return r||(r=await getManifest()),await findFromManifest_1(e,!1,r,t)}function getManifest(){return setupCpp.coreExports.debug(`Getting manifest from ${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}@${MANIFEST_REPO_BRANCH}`),getManifestFromRepo_1(MANIFEST_REPO_OWNER,MANIFEST_REPO_NAME,AUTH,MANIFEST_REPO_BRANCH)}async function installPython(e){const t={cwd:e,env:{...process.env,...IS_LINUX&&{LD_LIBRARY_PATH:path__namespace.join(e,"lib")}},silent:!0,listeners:{stdout:e=>{setupCpp.coreExports.info((""+e).trim())},stderr:e=>{setupCpp.coreExports.error((""+e).trim())}}};IS_WINDOWS?await setupCpp.exec_2("powershell",["./setup.ps1"],t):await setupCpp.exec_2("bash",["./setup.sh"],t)}async function installCpythonFromRelease(e){const t=e.files[0].download_url;setupCpp.coreExports.info(`Download from "${t}"`);let r="";try{let e;r=await downloadTool_1(t,void 0,AUTH),setupCpp.coreExports.info("Extract downloaded archive"),e=IS_WINDOWS?await extractZip_1(r):await extractTar_1(r),setupCpp.coreExports.info("Execute installation script"),await installPython(e)}catch(s){throw s instanceof HTTPError_1&&(setupCpp.coreExports.info(403===s.httpStatusCode||429===s.httpStatusCode?`Received HTTP status code ${s.httpStatusCode}. This usually indicates the rate limit has been exceeded`:s.message),s.stack&&setupCpp.coreExports.debug(s.stack)),s}}function binDir(e){return path__namespace.join(e,IS_WINDOWS?"Scripts":"bin")}async function useCpythonVersion(e,t,r,s,i){let n=pythonVersionToSemantic(desugarDevVersion(e));setupCpp.coreExports.debug(`Semantic version spec of ${e} is ${n}`);let o=find_1("Python",n,t);if(!o){setupCpp.coreExports.info(`Version ${n} was not found in the local cache`);const e=await findReleaseFromManifest(n,t,null);e&&e.files&&e.files.length>0&&(setupCpp.coreExports.info(`Version ${n} is available for downloading`),await installCpythonFromRelease(e),o=find_1("Python",n,t))}if(!o){const r=await getOSInfo();throw Error([`The version '${e}' with architecture '${t}' was not found for ${r?`${r.osName} ${r.osVersion}`:"this operating system"}.`,"The list of all available versions can be found here: "+MANIFEST_URL].join(os__namespace.EOL))}const a=binDir(o),h=path__namespace.join(IS_WINDOWS?o:a,"python"+(IS_WINDOWS?".exe":""));if(setupCpp.coreExports.exportVariable("pythonLocation",o),setupCpp.coreExports.exportVariable("PKG_CONFIG_PATH",o+"/lib/pkgconfig"),setupCpp.coreExports.exportVariable("pythonLocation",o),setupCpp.coreExports.exportVariable("Python_ROOT_DIR",o),setupCpp.coreExports.exportVariable("Python2_ROOT_DIR",o),setupCpp.coreExports.exportVariable("Python3_ROOT_DIR",o),setupCpp.coreExports.exportVariable("PKG_CONFIG_PATH",o+"/lib/pkgconfig"),IS_LINUX){const e=process.env.LD_LIBRARY_PATH?":"+process.env.LD_LIBRARY_PATH:"",t=path__namespace.join(o,"lib");e.split(":").includes(t)||setupCpp.coreExports.exportVariable("LD_LIBRARY_PATH",t+e)}if(setupCpp.coreExports.addPath(o),setupCpp.coreExports.addPath(a),IS_WINDOWS){const e=path__namespace.basename(path__namespace.dirname(o)),t=setupCpp.semver.major(e),r=setupCpp.semver.minor(e),s=path__namespace.join(process.env.APPDATA||"","Python",`Python${t}${r}`,"Scripts");setupCpp.coreExports.addPath(s)}const c=versionFromPath(o);return setupCpp.coreExports.setOutput("python-version",c),setupCpp.coreExports.setOutput("python-path",h),{impl:"CPython",version:c}}function desugarDevVersion(e){return e.replace(/^(\d+)\.(\d+)-dev$/,"~$1.$2.0-0")}function versionFromPath(e){const t=e.split(path__namespace.sep),r=t.findIndex((e=>"PyPy"===e||"Python"===e));return t[r+1]||""}function pythonVersionToSemantic(e,t){return e.replace(/(\d+\.\d+\.\d+)((?:a|b|rc)\d*)/g,"$1-$2")}function isPyPyVersion(e){return e.startsWith("pypy")}async function setupActionsPython(e,t,r){var s;IS_MAC&&(process.env.AGENT_TOOLSDIRECTORY="/Users/runner/hostedtoolcache");const i=null==(s=process.env.AGENT_TOOLSDIRECTORY)?void 0:s.trim();if("string"==typeof i&&""!==i&&(process.env.RUNNER_TOOL_CACHE=process.env.AGENT_TOOLSDIRECTORY),setupCpp.coreExports.debug("Python is expected to be installed into "+process.env.RUNNER_TOOL_CACHE),e){let t;if(isPyPyVersion(e)){const s=await findPyPyVersion(e,r,!0,checkLatest,!1);t=`${s.resolvedPyPyVersion}-${s.resolvedPythonVersion}`,setupCpp.info(`Successfully set up PyPy ${s.resolvedPyPyVersion} with Python (${s.resolvedPythonVersion})`)}else{const s=await useCpythonVersion(e,r);t=s.version,setupCpp.info(`Successfully set up ${s.impl} (${t})`)}}setupCpp.ciInfo.GITHUB_ACTIONS&&await addPythonLoggingMatcher()}async function addPythonLoggingMatcher(){const e=path$1.join(dirname,"python_matcher.json");if(!(await setupCpp.pathExists(e)))return setupCpp.warning("the python_matcher.json file does not exist in the same folder as setup-cpp.js");setupCpp.info("::add-matcher::"+e)}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const path$1=require("path"),require$$1$1=require("url"),setupCpp=require("../setup-cpp.js"),fs$1=require("fs"),os$1=require("os"),childProcess=require("child_process"),http=require("http"),https=require("https"),require$$0=require("stream"),require$$1=require("util"),require$$0$1=require("assert");require("crypto"),require("net"),require("tls"),require("events"),require("buffer"),require("process"),require("string_decoder"),require("timers"),require("console");var _documentCurrentScript="undefined"!=typeof document?document.currentScript:null;const path__namespace=_interopNamespaceDefault(path$1),os__namespace=_interopNamespaceDefault(os$1);var toolCache={},manifest={exports:{}};!function(e,t){var r=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),s=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return s(t,e),t},n=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{h(s.next(e))}catch(t){n(t)}}function a(e){try{h(s.throw(e))}catch(t){n(t)}}function h(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t._readLinuxVersionFile=t._getOsVersion=t._findMatch=void 0;const o=i(setupCpp.semverExports),a=setupCpp.requireCore(),h=os$1,c=childProcess,l=fs$1;t._findMatch=function(t,r,s,i){return n(this,void 0,void 0,(function*(){const n=h.platform();let c,l,p;for(const h of s){const s=h.version;if(a.debug(`check ${s} satisfies ${t}`),o.satisfies(s,t)&&(!r||h.stable===r)&&(p=h.files.find((t=>{a.debug(`${t.arch}===${i} && ${t.platform}===${n}`);let r=t.arch===i&&t.platform===n;if(r&&t.platform_version){const s=e.exports._getOsVersion();r=s===t.platform_version||o.satisfies(s,t.platform_version)}return r})),p)){a.debug("matched "+h.version),l=h;break}}return l&&p&&(c=Object.assign({},l),c.files=[p]),c}))},t._getOsVersion=function(){const t=h.platform();let r="";if("darwin"===t)r=""+c.execSync("sw_vers -productVersion");else if("linux"===t){const t=e.exports._readLinuxVersionFile();if(t){const e=t.split("\n");for(const t of e){const e=t.split("=");if(2===e.length&&("VERSION_ID"===e[0].trim()||"DISTRIB_RELEASE"===e[0].trim())){r=e[1].trim().replace(/^"/,"").replace(/"$/,"");break}}}}return r},t._readLinuxVersionFile=function(){const e="/etc/lsb-release",t="/etc/os-release";let r="";return l.existsSync(e)?r=""+l.readFileSync(e):l.existsSync(t)&&(r=""+l.readFileSync(t)),r}}(manifest,manifest.exports);var manifestExports=manifest.exports,httpClient={},proxy={};Object.defineProperty(proxy,"__esModule",{value:!0}),proxy.getProxyUrl=getProxyUrl,proxy.checkBypass=checkBypass,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=http,r=https,s=proxy;let i;var n,o,a,h,c;(o=n=e.HttpCodes||(e.HttpCodes={}))[o.OK=200]="OK",o[o.MultipleChoices=300]="MultipleChoices",o[o.MovedPermanently=301]="MovedPermanently",o[o.ResourceMoved=302]="ResourceMoved",o[o.SeeOther=303]="SeeOther",o[o.NotModified=304]="NotModified",o[o.UseProxy=305]="UseProxy",o[o.SwitchProxy=306]="SwitchProxy",o[o.TemporaryRedirect=307]="TemporaryRedirect",o[o.PermanentRedirect=308]="PermanentRedirect",o[o.BadRequest=400]="BadRequest",o[o.Unauthorized=401]="Unauthorized",o[o.PaymentRequired=402]="PaymentRequired",o[o.Forbidden=403]="Forbidden",o[o.NotFound=404]="NotFound",o[o.MethodNotAllowed=405]="MethodNotAllowed",o[o.NotAcceptable=406]="NotAcceptable",o[o.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",o[o.RequestTimeout=408]="RequestTimeout",o[o.Conflict=409]="Conflict",o[o.Gone=410]="Gone",o[o.TooManyRequests=429]="TooManyRequests",o[o.InternalServerError=500]="InternalServerError",o[o.NotImplemented=501]="NotImplemented",o[o.BadGateway=502]="BadGateway",o[o.ServiceUnavailable=503]="ServiceUnavailable",o[o.GatewayTimeout=504]="GatewayTimeout",(h=a=e.Headers||(e.Headers={})).Accept="accept",h.ContentType="content-type",(c=e.MediaTypes||(e.MediaTypes={})).ApplicationJson="application/json",e.getProxyUrl=function(e){let t=s.getProxyUrl(new URL(e));return t?t.href:""};const l=[n.MovedPermanently,n.ResourceMoved,n.SeeOther,n.TemporaryRedirect,n.PermanentRedirect],p=[n.BadGateway,n.ServiceUnavailable,n.GatewayTimeout],u=["OPTIONS","GET","DELETE","HEAD"];class f extends Error{constructor(e,t){super(e),this.name="HttpClientError",this.statusCode=t,Object.setPrototypeOf(this,f.prototype)}}e.HttpClientError=f;class d{constructor(e){this.message=e}readBody(){return new Promise((async(e,t)=>{let r=Buffer.alloc(0);this.message.on("data",(e=>{r=Buffer.concat([r,e])})),this.message.on("end",(()=>{e(""+r)}))}))}}e.HttpClientResponse=d,e.isHttps=function(e){return"https:"===new URL(e).protocol};class m{constructor(e,t,r){this._ignoreSslError=!1,this._allowRedirects=!0,this._allowRedirectDowngrade=!1,this._maxRedirects=50,this._allowRetries=!1,this._maxRetries=1,this._keepAlive=!1,this._disposed=!1,this.userAgent=e,this.handlers=t||[],this.requestOptions=r,r&&(null!=r.ignoreSslError&&(this._ignoreSslError=r.ignoreSslError),this._socketTimeout=r.socketTimeout,null!=r.allowRedirects&&(this._allowRedirects=r.allowRedirects),null!=r.allowRedirectDowngrade&&(this._allowRedirectDowngrade=r.allowRedirectDowngrade),null!=r.maxRedirects&&(this._maxRedirects=Math.max(r.maxRedirects,0)),null!=r.keepAlive&&(this._keepAlive=r.keepAlive),null!=r.allowRetries&&(this._allowRetries=r.allowRetries),null!=r.maxRetries&&(this._maxRetries=r.maxRetries))}options(e,t){return this.request("OPTIONS",e,null,t||{})}get(e,t){return this.request("GET",e,null,t||{})}del(e,t){return this.request("DELETE",e,null,t||{})}post(e,t,r){return this.request("POST",e,t,r||{})}patch(e,t,r){return this.request("PATCH",e,t,r||{})}put(e,t,r){return this.request("PUT",e,t,r||{})}head(e,t){return this.request("HEAD",e,null,t||{})}sendStream(e,t,r,s){return this.request(e,t,r,s)}async getJson(e,t={}){t[a.Accept]=this._getExistingOrDefaultHeader(t,a.Accept,c.ApplicationJson);let r=await this.get(e,t);return this._processResponse(r,this.requestOptions)}async postJson(e,t,r={}){let s=JSON.stringify(t,null,2);r[a.Accept]=this._getExistingOrDefaultHeader(r,a.Accept,c.ApplicationJson),r[a.ContentType]=this._getExistingOrDefaultHeader(r,a.ContentType,c.ApplicationJson);let i=await this.post(e,s,r);return this._processResponse(i,this.requestOptions)}async putJson(e,t,r={}){let s=JSON.stringify(t,null,2);r[a.Accept]=this._getExistingOrDefaultHeader(r,a.Accept,c.ApplicationJson),r[a.ContentType]=this._getExistingOrDefaultHeader(r,a.ContentType,c.ApplicationJson);let i=await this.put(e,s,r);return this._processResponse(i,this.requestOptions)}async patchJson(e,t,r={}){let s=JSON.stringify(t,null,2);r[a.Accept]=this._getExistingOrDefaultHeader(r,a.Accept,c.ApplicationJson),r[a.ContentType]=this._getExistingOrDefaultHeader(r,a.ContentType,c.ApplicationJson);let i=await this.patch(e,s,r);return this._processResponse(i,this.requestOptions)}async request(e,t,r,s){if(this._disposed)throw Error("Client has already been disposed.");let i,o=new URL(t),a=this._prepareRequest(e,o,s),h=this._allowRetries&&-1!=u.indexOf(e)?this._maxRetries+1:1,c=0;for(;h>c;){if(i=await this.requestRaw(a,r),i&&i.message&&i.message.statusCode===n.Unauthorized){let e;for(let t=0;this.handlers.length>t;t++)if(this.handlers[t].canHandleAuthentication(i)){e=this.handlers[t];break}return e?e.handleAuthentication(this,a,r):i}let t=this._maxRedirects;for(;-1!=l.indexOf(i.message.statusCode)&&this._allowRedirects&&t>0;){const n=i.message.headers.location;if(!n)break;let h=new URL(n);if("https:"==o.protocol&&o.protocol!=h.protocol&&!this._allowRedirectDowngrade)throw Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.");if(await i.readBody(),h.hostname!==o.hostname)for(let e in s)"authorization"===e.toLowerCase()&&delete s[e];a=this._prepareRequest(e,h,s),i=await this.requestRaw(a,r),t--}if(-1==p.indexOf(i.message.statusCode))return i;c+=1,h>c&&(await i.readBody(),await this._performExponentialBackoff(c))}return i}dispose(){this._agent&&this._agent.destroy(),this._disposed=!0}requestRaw(e,t){return new Promise(((r,s)=>{this.requestRawWithCallback(e,t,(function(e,t){e&&s(e),r(t)}))}))}requestRawWithCallback(e,t,r){let s;"string"==typeof t&&(e.options.headers["Content-Length"]=Buffer.byteLength(t,"utf8"));let i=!1,n=(e,t)=>{i||(i=!0,r(e,t))},o=e.httpModule.request(e.options,(e=>{let t=new d(e);n(null,t)}));o.on("socket",(e=>{s=e})),o.setTimeout(this._socketTimeout||18e4,(()=>{s&&s.end(),n(Error("Request timeout: "+e.options.path),null)})),o.on("error",(function(e){n(e,null)})),t&&"string"==typeof t&&o.write(t,"utf8"),t&&"string"!=typeof t?(t.on("close",(function(){o.end()})),t.pipe(o)):o.end()}getAgent(e){let t=new URL(e);return this._getAgent(t)}_prepareRequest(e,s,i){const n={};n.parsedUrl=s;const o="https:"===n.parsedUrl.protocol;n.httpModule=o?r:t;const a=o?443:80;return n.options={},n.options.host=n.parsedUrl.hostname,n.options.port=n.parsedUrl.port?parseInt(n.parsedUrl.port):a,n.options.path=(n.parsedUrl.pathname||"")+(n.parsedUrl.search||""),n.options.method=e,n.options.headers=this._mergeHeaders(i),null!=this.userAgent&&(n.options.headers["user-agent"]=this.userAgent),n.options.agent=this._getAgent(n.parsedUrl),this.handlers&&this.handlers.forEach((e=>{e.prepareRequest(n.options)})),n}_mergeHeaders(e){const t=e=>Object.keys(e).reduce(((t,r)=>(t[r.toLowerCase()]=e[r],t)),{});return this.requestOptions&&this.requestOptions.headers?Object.assign({},t(this.requestOptions.headers),t(e)):t(e||{})}_getExistingOrDefaultHeader(e,t,r){let s;var i;return this.requestOptions&&this.requestOptions.headers&&(s=(i=this.requestOptions.headers,Object.keys(i).reduce(((e,t)=>(e[t.toLowerCase()]=i[t],e)),{}))[t]),e[t]||s||r}_getAgent(e){let n,o=s.getProxyUrl(e),a=o&&o.hostname;if(this._keepAlive&&a&&(n=this._proxyAgent),this._keepAlive&&!a&&(n=this._agent),n)return n;const h="https:"===e.protocol;let c=100;if(this.requestOptions&&(c=this.requestOptions.maxSockets||t.globalAgent.maxSockets),a){i||(i=setupCpp.tunnel);const e={maxSockets:c,keepAlive:this._keepAlive,proxy:{...(o.username||o.password)&&{proxyAuth:`${o.username}:${o.password}`},host:o.hostname,port:o.port}};let t;const r="https:"===o.protocol;t=h?r?i.httpsOverHttps:i.httpsOverHttp:r?i.httpOverHttps:i.httpOverHttp,n=t(e),this._proxyAgent=n}if(this._keepAlive&&!n){const e={keepAlive:this._keepAlive,maxSockets:c};n=h?new r.Agent(e):new t.Agent(e),this._agent=n}return n||(n=h?r.globalAgent:t.globalAgent),h&&this._ignoreSslError&&(n.options=Object.assign(n.options||{},{rejectUnauthorized:!1})),n}_performExponentialBackoff(e){const t=5*Math.pow(2,e=Math.min(10,e));return new Promise((e=>setTimeout((()=>e()),t)))}static dateTimeDeserializer(e,t){if("string"==typeof t){let e=new Date(t);if(!isNaN(e.valueOf()))return e}return t}async _processResponse(e,t){return new Promise((async(r,s)=>{const i=e.message.statusCode,o={statusCode:i,result:null,headers:{}};let a,h;i==n.NotFound&&r(o);try{h=await e.readBody(),h&&h.length>0&&(a=t&&t.deserializeDates?JSON.parse(h,m.dateTimeDeserializer):JSON.parse(h),o.result=a),o.headers=e.message.headers}catch(c){}if(i>299){let e;e=a&&a.message?a.message:h&&h.length>0?h:"Failed request: ("+i+")";let t=new f(e,i);t.result=o.result,s(t)}else r(o)}))}}e.HttpClient=m}(httpClient);var retryHelper={},__createBinding$1=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),__setModuleDefault$1=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar$1=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&__createBinding$1(t,e,r);return __setModuleDefault$1(t,e),t},__awaiter$1=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{h(s.next(e))}catch(t){n(t)}}function a(e){try{h(s.throw(e))}catch(t){n(t)}}function h(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))};Object.defineProperty(retryHelper,"__esModule",{value:!0}),retryHelper.RetryHelper=void 0;const core$1=__importStar$1(setupCpp.requireCore());class RetryHelper{constructor(e,t,r){if(1>e)throw Error("max attempts should be greater than or equal to 1");if(this.maxAttempts=e,this.minSeconds=Math.floor(t),this.maxSeconds=Math.floor(r),this.minSeconds>this.maxSeconds)throw Error("min seconds should be less than or equal to max seconds")}execute(e,t){return __awaiter$1(this,void 0,void 0,(function*(){let r=1;for(;this.maxAttempts>r;){try{return yield e()}catch(s){if(t&&!t(s))throw s;core$1.info(s.message)}const i=this.getSleepAmount();core$1.info(`Waiting ${i} seconds before trying again`),yield this.sleep(i),r++}return yield e()}))}getSleepAmount(){return Math.floor(Math.random()*(this.maxSeconds-this.minSeconds+1))+this.minSeconds}sleep(e){return __awaiter$1(this,void 0,void 0,(function*(){return new Promise((t=>setTimeout(t,1e3*e)))}))}}retryHelper.RetryHelper=RetryHelper;var __createBinding=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),__setModuleDefault=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t},__awaiter=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__awaiter||function(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{h(s.next(e))}catch(t){n(t)}}function a(e){try{h(s.throw(e))}catch(t){n(t)}}function h(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}h((s=s.apply(e,t||[])).next())}))},__importDefault=setupCpp.commonjsGlobal&&setupCpp.commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(toolCache,"__esModule",{value:!0}),toolCache.evaluateVersions=toolCache.isExplicitVersion=findFromManifest_1=toolCache.findFromManifest=getManifestFromRepo_1=toolCache.getManifestFromRepo=toolCache.findAllVersions=find_1=toolCache.find=toolCache.cacheFile=cacheDir_1=toolCache.cacheDir=extractZip_1=toolCache.extractZip=toolCache.extractXar=extractTar_1=toolCache.extractTar=toolCache.extract7z=downloadTool_1=toolCache.downloadTool=HTTPError_1=toolCache.HTTPError=void 0;const core=__importStar(setupCpp.requireCore()),io=__importStar(setupCpp.io),fs=__importStar(fs$1),mm=__importStar(manifestExports),os=__importStar(os$1),path=__importStar(path$1),httpm=__importStar(httpClient),semver=__importStar(setupCpp.semverExports),stream$1=__importStar(require$$0),util=__importStar(require$$1),v4_1=__importDefault(setupCpp.v4_1),exec_1=setupCpp.exec,assert_1=require$$0$1,retry_helper_1=retryHelper;class HTTPError extends Error{constructor(e){super("Unexpected HTTP response: "+e),this.httpStatusCode=e,Object.setPrototypeOf(this,new.target.prototype)}}var HTTPError_1=toolCache.HTTPError=HTTPError;const IS_WINDOWS$1="win32"===process.platform,IS_MAC$1="darwin"===process.platform,userAgent="actions/tool-cache";var downloadTool_1=toolCache.downloadTool=downloadTool;toolCache.extract7z=extract7z;var extractTar_1=toolCache.extractTar=extractTar;toolCache.extractXar=extractXar;var extractZip_1=toolCache.extractZip=extractZip,cacheDir_1=toolCache.cacheDir=cacheDir;toolCache.cacheFile=cacheFile;var find_1=toolCache.find=find;toolCache.findAllVersions=findAllVersions;var getManifestFromRepo_1=toolCache.getManifestFromRepo=getManifestFromRepo,findFromManifest_1=toolCache.findFromManifest=findFromManifest;toolCache.isExplicitVersion=isExplicitVersion,toolCache.evaluateVersions=evaluateVersions;var parse={exports:{}},tomlParser={exports:{}};const ParserEND=1114112;class ParserError extends Error{constructor(e,t,r){super("[ParserError] "+e,t,r),this.name="ParserError",this.code="ParserError",Error.captureStackTrace&&Error.captureStackTrace(this,ParserError)}}class State{constructor(e){this.parser=e,this.buf="",this.returned=null,this.result=null,this.resultTable=null,this.resultArr=null}}class Parser{constructor(){this.pos=0,this.col=0,this.line=0,this.obj={},this.ctx=this.obj,this.stack=[],this._buf="",this.char=null,this.ii=0,this.state=new State(this.parseStart)}parse(e){if(0===e.length||null==e.length)return;let t;for(this._buf=e+"",this.ii=-1,this.char=-1;!1===t||this.nextChar();)t=this.runOne();this._buf=null}nextChar(){return 10===this.char&&(++this.line,this.col=-1),++this.ii,this.char=this._buf.codePointAt(this.ii),++this.pos,++this.col,this.haveBuffer()}haveBuffer(){return this._buf.length>this.ii}runOne(){return this.state.parser.call(this,this.state.returned)}finish(){let e;this.char=ParserEND;do{e=this.state.parser,this.runOne()}while(this.state.parser!==e);return this.ctx=null,this.state=null,this._buf=null,this.obj}next(e){if("function"!=typeof e)throw new ParserError("Tried to set state to non-existent state: "+JSON.stringify(e));this.state.parser=e}goto(e){return this.next(e),this.runOne()}call(e,t){t&&this.next(t),this.stack.push(this.state),this.state=new State(e)}callNow(e,t){return this.call(e,t),this.runOne()}return(e){if(0===this.stack.length)throw this.error(new ParserError("Stack underflow"));void 0===e&&(e=this.state.buf),this.state=this.stack.pop(),this.state.returned=e}returnNow(e){return this.return(e),this.runOne()}consume(){if(this.char===ParserEND)throw this.error(new ParserError("Unexpected end-of-buffer"));this.state.buf+=this._buf[this.ii]}error(e){return e.line=this.line,e.col=this.col,e.pos=this.pos,e}parseStart(){throw new ParserError("Must declare a parseStart method")}}Parser.END=ParserEND,Parser.Error=ParserError;var parser=Parser,createDatetime=e=>{const t=new Date(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t},formatNum=(e,t)=>{for(t+="";e>t.length;)t="0"+t;return t};const f$2=formatNum;class FloatingDateTime extends Date{constructor(e){super(e+"Z"),this.isFloating=!0}toISOString(){return`${this.getUTCFullYear()}-${f$2(2,this.getUTCMonth()+1)}-${f$2(2,this.getUTCDate())}T${f$2(2,this.getUTCHours())}:${f$2(2,this.getUTCMinutes())}:${f$2(2,this.getUTCSeconds())}.${f$2(3,this.getUTCMilliseconds())}`}}var createDatetimeFloat=e=>{const t=new FloatingDateTime(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t};const f$1=formatNum,DateTime=setupCpp.commonjsGlobal.Date;let Date$1=class extends DateTime{constructor(e){super(e),this.isDate=!0}toISOString(){return`${this.getUTCFullYear()}-${f$1(2,this.getUTCMonth()+1)}-${f$1(2,this.getUTCDate())}`}};var createDate$1=e=>{const t=new Date$1(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t};const f=formatNum;class Time extends Date{constructor(e){super(`0000-01-01T${e}Z`),this.isTime=!0}toISOString(){return`${f(2,this.getUTCHours())}:${f(2,this.getUTCMinutes())}:${f(2,this.getUTCSeconds())}.${f(3,this.getUTCMilliseconds())}`}}var createTime$1=e=>{const t=new Time(e);if(isNaN(t))throw new TypeError("Invalid Datetime");return t};tomlParser.exports=makeParserClass(parser),tomlParser.exports.makeParserClass=makeParserClass;class TomlError extends Error{constructor(e){super(e),this.name="TomlError",Error.captureStackTrace&&Error.captureStackTrace(this,TomlError),this.fromTOML=!0,this.wrapped=null}}TomlError.wrap=e=>{const t=new TomlError(e.message);return t.code=e.code,t.wrapped=e,t},tomlParser.exports.TomlError=TomlError;const createDateTime=createDatetime,createDateTimeFloat=createDatetimeFloat,createDate=createDate$1,createTime=createTime$1,CTRL_I=9,CTRL_J=10,CTRL_M=13,CTRL_CHAR_BOUNDARY=31,CHAR_SP=32,CHAR_QUOT=34,CHAR_NUM=35,CHAR_APOS=39,CHAR_PLUS=43,CHAR_COMMA=44,CHAR_HYPHEN=45,CHAR_PERIOD=46,CHAR_0=48,CHAR_1=49,CHAR_7=55,CHAR_9=57,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_A=65,CHAR_E=69,CHAR_F=70,CHAR_T=84,CHAR_U=85,CHAR_Z=90,CHAR_LOWBAR=95,CHAR_a=97,CHAR_b=98,CHAR_e=101,CHAR_f=102,CHAR_i=105,CHAR_l=108,CHAR_n=110,CHAR_o=111,CHAR_r=114,CHAR_s=115,CHAR_t=116,CHAR_u=117,CHAR_x=120,CHAR_z=122,CHAR_LCUB=123,CHAR_RCUB=125,CHAR_LSQB=91,CHAR_BSOL=92,CHAR_RSQB=93,CHAR_DEL=127,SURROGATE_FIRST=55296,SURROGATE_LAST=57343,escapes={[CHAR_b]:"\b",[CHAR_t]:"\t",[CHAR_n]:"\n",[CHAR_f]:"\f",[CHAR_r]:"\r",[CHAR_QUOT]:'"',[CHAR_BSOL]:"\\"},_type=Symbol(),_declared=Symbol(),hasOwnProperty={}.hasOwnProperty,defineProperty=Object.defineProperty,descriptor={configurable:!0,enumerable:!0,writable:!0,value:void 0},INLINE_TABLE=Symbol(),TABLE=Symbol(),_contentType=Symbol(),INLINE_LIST=Symbol(),LIST=Symbol();let _custom;try{const utilInspect=eval("require('util').inspect");_custom=utilInspect.custom}catch(_){}const _inspect=_custom||"inspect";class BoxedBigInt{constructor(e){try{this.value=setupCpp.commonjsGlobal.BigInt.asIntN(64,e)}catch(_){this.value=null}Object.defineProperty(this,_type,{value:INTEGER})}isNaN(){return null===this.value}toString(){return this.value+""}[_inspect](){return`[BigInt: ${""+this}]}`}valueOf(){return this.value}}const INTEGER=Symbol(),FLOAT=Symbol();var tomlParserExports=tomlParser.exports,parsePrettyError=prettyError$2,parseString_1=parseString;const TOMLParser$2=tomlParserExports,prettyError$1=parsePrettyError;var parseAsync_1=parseAsync;const TOMLParser$1=tomlParserExports,prettyError=parsePrettyError;var parseStream_1=parseStream;const stream=require$$0,TOMLParser=tomlParserExports;parse.exports=parseString_1,parse.exports.async=parseAsync_1,parse.exports.stream=parseStream_1,parse.exports.prettyError=parsePrettyError;var stringify$1={exports:{}};stringify$1.exports=stringify,stringify$1.exports.value=stringifyInline;const IS_WINDOWS="win32"===process.platform,IS_LINUX="linux"===process.platform,IS_MAC="darwin"===process.platform,WINDOWS_ARCHS=["x86","x64"],WINDOWS_PLATFORMS=["win32","win64"],PYPY_VERSION_FILE="PYPY_VERSION",TOKEN=setupCpp.coreExports.getInput("token"),AUTH=TOKEN?"token "+TOKEN:void 0,MANIFEST_REPO_OWNER="actions",MANIFEST_REPO_NAME="python-versions",MANIFEST_REPO_BRANCH="main",MANIFEST_URL=`https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`,dirname="string"==typeof __dirname?__dirname:path$1.dirname(require$$1$1.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.src||new URL("assets/actions_python-BF80bhWt.js",document.baseURI).href)),checkLatest=!1;exports.setupActionsPython=setupActionsPython;
//# sourceMappingURL=actions_python-BF80bhWt.js.map