diff --git a/github-actions/README.md b/github-actions/README.md index 2c84a0124..eb47f87e8 100644 --- a/github-actions/README.md +++ b/github-actions/README.md @@ -4,8 +4,6 @@ This directory contains some shared [GitHub Actions][docs] used on CIs managed by the Rust Infrastructure team. There are no stability guarantees for these actions, since they're supposed to only be used in infra managed by us. -* [**cancel-outdated-builds**](cancel-outdated-builds): cancel the build if a - new commit is pushed. * [**upload-docker-image**](upload-docker-image): upload a Docker image to ECR. * [**static-websites**](static-websites): deploy a directory to GitHub Pages. * [**simple-ci**](simple-ci): Build and test a Rust project. diff --git a/github-actions/cancel-outdated-builds/README.md b/github-actions/cancel-outdated-builds/README.md deleted file mode 100644 index ad94ed948..000000000 --- a/github-actions/cancel-outdated-builds/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# cancel-outdated-builds - -The `cancel-outdated-builds` action cancels the current build if a new commit is -pushed on the branch that started the build. There is no stability guarantee -for this action, since it's supposed to only be used in infra managed by us. - -## Usage - -To use the action add this to your workflow: - -```yaml -- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master - with: - github_token: "${{ secrets.github_token }}" -``` - -By default the action will check the GitHub API every minute. To use a custom -check interval you can add the `check_every_seconds` input with the amount of -seconds to wait between checks: - -```yaml -- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master - with: - github_token: "${{ secrets.github_token }}" - check_every_seconds: 120 # 2 minutes -``` - -## Development - -The action is written in NodeJS 16, and you can install the dependencies with: - -``` -npm install -``` - -GitHub Actions requires all the dependencies to be committed, so before -creating a commit you need to run: - -``` -npm run build -``` - -The command will bundle everything in `dist/index.js`. That file will need to -be committed. diff --git a/github-actions/cancel-outdated-builds/action.yml b/github-actions/cancel-outdated-builds/action.yml deleted file mode 100644 index 8ab3db9cb..000000000 --- a/github-actions/cancel-outdated-builds/action.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Prepare to cancel the build when it becomes outdated -description: Start a daemon that will cancel the current build if a new commit is pushed to the branch - -inputs: - github_token: - description: GitHub token used to interact with the GitHub API - default: ${{ github.token }} - required: false - check_every_seconds: - description: How many seconds to wait between checks - required: true - default: "60" - -runs: - using: node16 - main: dist/index.js diff --git a/github-actions/cancel-outdated-builds/dist/37.index.js b/github-actions/cancel-outdated-builds/dist/37.index.js deleted file mode 100644 index c349ca0a6..000000000 --- a/github-actions/cancel-outdated-builds/dist/37.index.js +++ /dev/null @@ -1,452 +0,0 @@ -"use strict"; -exports.id = 37; -exports.ids = [37]; -exports.modules = { - -/***/ 4037: -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "toFormData": () => (/* binding */ toFormData) -/* harmony export */ }); -/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2777); -/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8010); - - - -let s = 0; -const S = { - START_BOUNDARY: s++, - HEADER_FIELD_START: s++, - HEADER_FIELD: s++, - HEADER_VALUE_START: s++, - HEADER_VALUE: s++, - HEADER_VALUE_ALMOST_DONE: s++, - HEADERS_ALMOST_DONE: s++, - PART_DATA_START: s++, - PART_DATA: s++, - END: s++ -}; - -let f = 1; -const F = { - PART_BOUNDARY: f, - LAST_BOUNDARY: f *= 2 -}; - -const LF = 10; -const CR = 13; -const SPACE = 32; -const HYPHEN = 45; -const COLON = 58; -const A = 97; -const Z = 122; - -const lower = c => c | 0x20; - -const noop = () => {}; - -class MultipartParser { - /** - * @param {string} boundary - */ - constructor(boundary) { - this.index = 0; - this.flags = 0; - - this.onHeaderEnd = noop; - this.onHeaderField = noop; - this.onHeadersEnd = noop; - this.onHeaderValue = noop; - this.onPartBegin = noop; - this.onPartData = noop; - this.onPartEnd = noop; - - this.boundaryChars = {}; - - boundary = '\r\n--' + boundary; - const ui8a = new Uint8Array(boundary.length); - for (let i = 0; i < boundary.length; i++) { - ui8a[i] = boundary.charCodeAt(i); - this.boundaryChars[ui8a[i]] = true; - } - - this.boundary = ui8a; - this.lookbehind = new Uint8Array(this.boundary.length + 8); - this.state = S.START_BOUNDARY; - } - - /** - * @param {Uint8Array} data - */ - write(data) { - let i = 0; - const length_ = data.length; - let previousIndex = this.index; - let {lookbehind, boundary, boundaryChars, index, state, flags} = this; - const boundaryLength = this.boundary.length; - const boundaryEnd = boundaryLength - 1; - const bufferLength = data.length; - let c; - let cl; - - const mark = name => { - this[name + 'Mark'] = i; - }; - - const clear = name => { - delete this[name + 'Mark']; - }; - - const callback = (callbackSymbol, start, end, ui8a) => { - if (start === undefined || start !== end) { - this[callbackSymbol](ui8a && ui8a.subarray(start, end)); - } - }; - - const dataCallback = (name, clear) => { - const markSymbol = name + 'Mark'; - if (!(markSymbol in this)) { - return; - } - - if (clear) { - callback(name, this[markSymbol], i, data); - delete this[markSymbol]; - } else { - callback(name, this[markSymbol], data.length, data); - this[markSymbol] = 0; - } - }; - - for (i = 0; i < length_; i++) { - c = data[i]; - - switch (state) { - case S.START_BOUNDARY: - if (index === boundary.length - 2) { - if (c === HYPHEN) { - flags |= F.LAST_BOUNDARY; - } else if (c !== CR) { - return; - } - - index++; - break; - } else if (index - 1 === boundary.length - 2) { - if (flags & F.LAST_BOUNDARY && c === HYPHEN) { - state = S.END; - flags = 0; - } else if (!(flags & F.LAST_BOUNDARY) && c === LF) { - index = 0; - callback('onPartBegin'); - state = S.HEADER_FIELD_START; - } else { - return; - } - - break; - } - - if (c !== boundary[index + 2]) { - index = -2; - } - - if (c === boundary[index + 2]) { - index++; - } - - break; - case S.HEADER_FIELD_START: - state = S.HEADER_FIELD; - mark('onHeaderField'); - index = 0; - // falls through - case S.HEADER_FIELD: - if (c === CR) { - clear('onHeaderField'); - state = S.HEADERS_ALMOST_DONE; - break; - } - - index++; - if (c === HYPHEN) { - break; - } - - if (c === COLON) { - if (index === 1) { - // empty header field - return; - } - - dataCallback('onHeaderField', true); - state = S.HEADER_VALUE_START; - break; - } - - cl = lower(c); - if (cl < A || cl > Z) { - return; - } - - break; - case S.HEADER_VALUE_START: - if (c === SPACE) { - break; - } - - mark('onHeaderValue'); - state = S.HEADER_VALUE; - // falls through - case S.HEADER_VALUE: - if (c === CR) { - dataCallback('onHeaderValue', true); - callback('onHeaderEnd'); - state = S.HEADER_VALUE_ALMOST_DONE; - } - - break; - case S.HEADER_VALUE_ALMOST_DONE: - if (c !== LF) { - return; - } - - state = S.HEADER_FIELD_START; - break; - case S.HEADERS_ALMOST_DONE: - if (c !== LF) { - return; - } - - callback('onHeadersEnd'); - state = S.PART_DATA_START; - break; - case S.PART_DATA_START: - state = S.PART_DATA; - mark('onPartData'); - // falls through - case S.PART_DATA: - previousIndex = index; - - if (index === 0) { - // boyer-moore derrived algorithm to safely skip non-boundary data - i += boundaryEnd; - while (i < bufferLength && !(data[i] in boundaryChars)) { - i += boundaryLength; - } - - i -= boundaryEnd; - c = data[i]; - } - - if (index < boundary.length) { - if (boundary[index] === c) { - if (index === 0) { - dataCallback('onPartData', true); - } - - index++; - } else { - index = 0; - } - } else if (index === boundary.length) { - index++; - if (c === CR) { - // CR = part boundary - flags |= F.PART_BOUNDARY; - } else if (c === HYPHEN) { - // HYPHEN = end boundary - flags |= F.LAST_BOUNDARY; - } else { - index = 0; - } - } else if (index - 1 === boundary.length) { - if (flags & F.PART_BOUNDARY) { - index = 0; - if (c === LF) { - // unset the PART_BOUNDARY flag - flags &= ~F.PART_BOUNDARY; - callback('onPartEnd'); - callback('onPartBegin'); - state = S.HEADER_FIELD_START; - break; - } - } else if (flags & F.LAST_BOUNDARY) { - if (c === HYPHEN) { - callback('onPartEnd'); - state = S.END; - flags = 0; - } else { - index = 0; - } - } else { - index = 0; - } - } - - if (index > 0) { - // when matching a possible boundary, keep a lookbehind reference - // in case it turns out to be a false lead - lookbehind[index - 1] = c; - } else if (previousIndex > 0) { - // if our boundary turned out to be rubbish, the captured lookbehind - // belongs to partData - const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength); - callback('onPartData', 0, previousIndex, _lookbehind); - previousIndex = 0; - mark('onPartData'); - - // reconsider the current character even so it interrupted the sequence - // it could be the beginning of a new sequence - i--; - } - - break; - case S.END: - break; - default: - throw new Error(`Unexpected state entered: ${state}`); - } - } - - dataCallback('onHeaderField'); - dataCallback('onHeaderValue'); - dataCallback('onPartData'); - - // Update properties for the next call - this.index = index; - this.state = state; - this.flags = flags; - } - - end() { - if ((this.state === S.HEADER_FIELD_START && this.index === 0) || - (this.state === S.PART_DATA && this.index === this.boundary.length)) { - this.onPartEnd(); - } else if (this.state !== S.END) { - throw new Error('MultipartParser.end(): stream ended unexpectedly'); - } - } -} - -function _fileName(headerValue) { - // matches either a quoted-string or a token (RFC 2616 section 19.5.1) - const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i); - if (!m) { - return; - } - - const match = m[2] || m[3] || ''; - let filename = match.slice(match.lastIndexOf('\\') + 1); - filename = filename.replace(/%22/g, '"'); - filename = filename.replace(/&#(\d{4});/g, (m, code) => { - return String.fromCharCode(code); - }); - return filename; -} - -async function toFormData(Body, ct) { - if (!/multipart/i.test(ct)) { - throw new TypeError('Failed to fetch'); - } - - const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i); - - if (!m) { - throw new TypeError('no or bad content-type header, no multipart boundary'); - } - - const parser = new MultipartParser(m[1] || m[2]); - - let headerField; - let headerValue; - let entryValue; - let entryName; - let contentType; - let filename; - const entryChunks = []; - const formData = new formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__/* .FormData */ .Ct(); - - const onPartData = ui8a => { - entryValue += decoder.decode(ui8a, {stream: true}); - }; - - const appendToFile = ui8a => { - entryChunks.push(ui8a); - }; - - const appendFileToFormData = () => { - const file = new fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__/* .File */ .$B(entryChunks, filename, {type: contentType}); - formData.append(entryName, file); - }; - - const appendEntryToFormData = () => { - formData.append(entryName, entryValue); - }; - - const decoder = new TextDecoder('utf-8'); - decoder.decode(); - - parser.onPartBegin = function () { - parser.onPartData = onPartData; - parser.onPartEnd = appendEntryToFormData; - - headerField = ''; - headerValue = ''; - entryValue = ''; - entryName = ''; - contentType = ''; - filename = null; - entryChunks.length = 0; - }; - - parser.onHeaderField = function (ui8a) { - headerField += decoder.decode(ui8a, {stream: true}); - }; - - parser.onHeaderValue = function (ui8a) { - headerValue += decoder.decode(ui8a, {stream: true}); - }; - - parser.onHeaderEnd = function () { - headerValue += decoder.decode(); - headerField = headerField.toLowerCase(); - - if (headerField === 'content-disposition') { - // matches either a quoted-string or a token (RFC 2616 section 19.5.1) - const m = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i); - - if (m) { - entryName = m[2] || m[3] || ''; - } - - filename = _fileName(headerValue); - - if (filename) { - parser.onPartData = appendToFile; - parser.onPartEnd = appendFileToFormData; - } - } else if (headerField === 'content-type') { - contentType = headerValue; - } - - headerValue = ''; - headerField = ''; - }; - - for await (const chunk of Body) { - parser.write(chunk); - } - - parser.end(); - - return formData; -} - - -/***/ }) - -}; -; \ No newline at end of file diff --git a/github-actions/cancel-outdated-builds/dist/index.js b/github-actions/cancel-outdated-builds/dist/index.js deleted file mode 100644 index bed3c0b39..000000000 --- a/github-actions/cancel-outdated-builds/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -(()=>{var t={7351:function(t,r,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,r,n,o){if(o===undefined)o=n;Object.defineProperty(t,o,{enumerable:true,get:function(){return r[n]}})}:function(t,r,n,o){if(o===undefined)o=n;t[o]=r[n]});var a=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:true,value:r})}:function(t,r){t["default"]=r});var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n in t)if(n!=="default"&&Object.hasOwnProperty.call(t,n))o(r,t,n);a(r,t);return r};Object.defineProperty(r,"__esModule",{value:true});r.issue=r.issueCommand=void 0;const s=i(n(2037));const l=n(5278);function issueCommand(t,r,n){const o=new Command(t,r,n);process.stdout.write(o.toString()+s.EOL)}r.issueCommand=issueCommand;function issue(t,r=""){issueCommand(t,{},r)}r.issue=issue;const u="::";class Command{constructor(t,r,n){if(!t){t="missing.command"}this.command=t;this.properties=r;this.message=n}toString(){let t=u+this.command;if(this.properties&&Object.keys(this.properties).length>0){t+=" ";let r=true;for(const n in this.properties){if(this.properties.hasOwnProperty(n)){const o=this.properties[n];if(o){if(r){r=false}else{t+=","}t+=`${n}=${escapeProperty(o)}`}}}}t+=`${u}${escapeData(this.message)}`;return t}}function escapeData(t){return l.toCommandValue(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(t){return l.toCommandValue(t).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},2186:function(t,r,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,r,n,o){if(o===undefined)o=n;Object.defineProperty(t,o,{enumerable:true,get:function(){return r[n]}})}:function(t,r,n,o){if(o===undefined)o=n;t[o]=r[n]});var a=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:true,value:r})}:function(t,r){t["default"]=r});var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n in t)if(n!=="default"&&Object.hasOwnProperty.call(t,n))o(r,t,n);a(r,t);return r};var s=this&&this.__awaiter||function(t,r,n,o){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,a){function fulfilled(t){try{step(o.next(t))}catch(t){a(t)}}function rejected(t){try{step(o["throw"](t))}catch(t){a(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((o=o.apply(t,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.getIDToken=r.getState=r.saveState=r.group=r.endGroup=r.startGroup=r.info=r.notice=r.warning=r.error=r.debug=r.isDebug=r.setFailed=r.setCommandEcho=r.setOutput=r.getBooleanInput=r.getMultilineInput=r.getInput=r.addPath=r.setSecret=r.exportVariable=r.ExitCode=void 0;const l=n(7351);const u=n(717);const d=n(5278);const c=i(n(2037));const m=i(n(1017));const h=n(8041);var p;(function(t){t[t["Success"]=0]="Success";t[t["Failure"]=1]="Failure"})(p=r.ExitCode||(r.ExitCode={}));function exportVariable(t,r){const n=d.toCommandValue(r);process.env[t]=n;const o=process.env["GITHUB_ENV"]||"";if(o){return u.issueFileCommand("ENV",u.prepareKeyValueMessage(t,r))}l.issueCommand("set-env",{name:t},n)}r.exportVariable=exportVariable;function setSecret(t){l.issueCommand("add-mask",{},t)}r.setSecret=setSecret;function addPath(t){const r=process.env["GITHUB_PATH"]||"";if(r){u.issueFileCommand("PATH",t)}else{l.issueCommand("add-path",{},t)}process.env["PATH"]=`${t}${m.delimiter}${process.env["PATH"]}`}r.addPath=addPath;function getInput(t,r){const n=process.env[`INPUT_${t.replace(/ /g,"_").toUpperCase()}`]||"";if(r&&r.required&&!n){throw new Error(`Input required and not supplied: ${t}`)}if(r&&r.trimWhitespace===false){return n}return n.trim()}r.getInput=getInput;function getMultilineInput(t,r){const n=getInput(t,r).split("\n").filter((t=>t!==""));if(r&&r.trimWhitespace===false){return n}return n.map((t=>t.trim()))}r.getMultilineInput=getMultilineInput;function getBooleanInput(t,r){const n=["true","True","TRUE"];const o=["false","False","FALSE"];const a=getInput(t,r);if(n.includes(a))return true;if(o.includes(a))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${t}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}r.getBooleanInput=getBooleanInput;function setOutput(t,r){const n=process.env["GITHUB_OUTPUT"]||"";if(n){return u.issueFileCommand("OUTPUT",u.prepareKeyValueMessage(t,r))}process.stdout.write(c.EOL);l.issueCommand("set-output",{name:t},d.toCommandValue(r))}r.setOutput=setOutput;function setCommandEcho(t){l.issue("echo",t?"on":"off")}r.setCommandEcho=setCommandEcho;function setFailed(t){process.exitCode=p.Failure;error(t)}r.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}r.isDebug=isDebug;function debug(t){l.issueCommand("debug",{},t)}r.debug=debug;function error(t,r={}){l.issueCommand("error",d.toCommandProperties(r),t instanceof Error?t.toString():t)}r.error=error;function warning(t,r={}){l.issueCommand("warning",d.toCommandProperties(r),t instanceof Error?t.toString():t)}r.warning=warning;function notice(t,r={}){l.issueCommand("notice",d.toCommandProperties(r),t instanceof Error?t.toString():t)}r.notice=notice;function info(t){process.stdout.write(t+c.EOL)}r.info=info;function startGroup(t){l.issue("group",t)}r.startGroup=startGroup;function endGroup(){l.issue("endgroup")}r.endGroup=endGroup;function group(t,r){return s(this,void 0,void 0,(function*(){startGroup(t);let n;try{n=yield r()}finally{endGroup()}return n}))}r.group=group;function saveState(t,r){const n=process.env["GITHUB_STATE"]||"";if(n){return u.issueFileCommand("STATE",u.prepareKeyValueMessage(t,r))}l.issueCommand("save-state",{name:t},d.toCommandValue(r))}r.saveState=saveState;function getState(t){return process.env[`STATE_${t}`]||""}r.getState=getState;function getIDToken(t){return s(this,void 0,void 0,(function*(){return yield h.OidcClient.getIDToken(t)}))}r.getIDToken=getIDToken;var b=n(1327);Object.defineProperty(r,"summary",{enumerable:true,get:function(){return b.summary}});var y=n(1327);Object.defineProperty(r,"markdownSummary",{enumerable:true,get:function(){return y.markdownSummary}});var S=n(2981);Object.defineProperty(r,"toPosixPath",{enumerable:true,get:function(){return S.toPosixPath}});Object.defineProperty(r,"toWin32Path",{enumerable:true,get:function(){return S.toWin32Path}});Object.defineProperty(r,"toPlatformPath",{enumerable:true,get:function(){return S.toPlatformPath}})},717:function(t,r,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,r,n,o){if(o===undefined)o=n;Object.defineProperty(t,o,{enumerable:true,get:function(){return r[n]}})}:function(t,r,n,o){if(o===undefined)o=n;t[o]=r[n]});var a=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:true,value:r})}:function(t,r){t["default"]=r});var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n in t)if(n!=="default"&&Object.hasOwnProperty.call(t,n))o(r,t,n);a(r,t);return r};Object.defineProperty(r,"__esModule",{value:true});r.prepareKeyValueMessage=r.issueFileCommand=void 0;const s=i(n(7147));const l=i(n(2037));const u=n(5840);const d=n(5278);function issueFileCommand(t,r){const n=process.env[`GITHUB_${t}`];if(!n){throw new Error(`Unable to find environment variable for file command ${t}`)}if(!s.existsSync(n)){throw new Error(`Missing file at path: ${n}`)}s.appendFileSync(n,`${d.toCommandValue(r)}${l.EOL}`,{encoding:"utf8"})}r.issueFileCommand=issueFileCommand;function prepareKeyValueMessage(t,r){const n=`ghadelimiter_${u.v4()}`;const o=d.toCommandValue(r);if(t.includes(n)){throw new Error(`Unexpected input: name should not contain the delimiter "${n}"`)}if(o.includes(n)){throw new Error(`Unexpected input: value should not contain the delimiter "${n}"`)}return`${t}<<${n}${l.EOL}${o}${l.EOL}${n}`}r.prepareKeyValueMessage=prepareKeyValueMessage},8041:function(t,r,n){"use strict";var o=this&&this.__awaiter||function(t,r,n,o){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,a){function fulfilled(t){try{step(o.next(t))}catch(t){a(t)}}function rejected(t){try{step(o["throw"](t))}catch(t){a(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((o=o.apply(t,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.OidcClient=void 0;const a=n(6255);const i=n(5526);const s=n(2186);class OidcClient{static createHttpClient(t=true,r=10){const n={allowRetries:t,maxRetries:r};return new a.HttpClient("actions/oidc-client",[new i.BearerCredentialHandler(OidcClient.getRequestToken())],n)}static getRequestToken(){const t=process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];if(!t){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable")}return t}static getIDTokenUrl(){const t=process.env["ACTIONS_ID_TOKEN_REQUEST_URL"];if(!t){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable")}return t}static getCall(t){var r;return o(this,void 0,void 0,(function*(){const n=OidcClient.createHttpClient();const o=yield n.getJson(t).catch((t=>{throw new Error(`Failed to get ID Token. \n \n Error Code : ${t.statusCode}\n \n Error Message: ${t.result.message}`)}));const a=(r=o.result)===null||r===void 0?void 0:r.value;if(!a){throw new Error("Response json body do not have ID Token field")}return a}))}static getIDToken(t){return o(this,void 0,void 0,(function*(){try{let r=OidcClient.getIDTokenUrl();if(t){const n=encodeURIComponent(t);r=`${r}&audience=${n}`}s.debug(`ID token url is ${r}`);const n=yield OidcClient.getCall(r);s.setSecret(n);return n}catch(t){throw new Error(`Error message: ${t.message}`)}}))}}r.OidcClient=OidcClient},2981:function(t,r,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,r,n,o){if(o===undefined)o=n;Object.defineProperty(t,o,{enumerable:true,get:function(){return r[n]}})}:function(t,r,n,o){if(o===undefined)o=n;t[o]=r[n]});var a=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:true,value:r})}:function(t,r){t["default"]=r});var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n in t)if(n!=="default"&&Object.hasOwnProperty.call(t,n))o(r,t,n);a(r,t);return r};Object.defineProperty(r,"__esModule",{value:true});r.toPlatformPath=r.toWin32Path=r.toPosixPath=void 0;const s=i(n(1017));function toPosixPath(t){return t.replace(/[\\]/g,"/")}r.toPosixPath=toPosixPath;function toWin32Path(t){return t.replace(/[/]/g,"\\")}r.toWin32Path=toWin32Path;function toPlatformPath(t){return t.replace(/[/\\]/g,s.sep)}r.toPlatformPath=toPlatformPath},1327:function(t,r,n){"use strict";var o=this&&this.__awaiter||function(t,r,n,o){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,a){function fulfilled(t){try{step(o.next(t))}catch(t){a(t)}}function rejected(t){try{step(o["throw"](t))}catch(t){a(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((o=o.apply(t,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.summary=r.markdownSummary=r.SUMMARY_DOCS_URL=r.SUMMARY_ENV_VAR=void 0;const a=n(2037);const i=n(7147);const{access:s,appendFile:l,writeFile:u}=i.promises;r.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";r.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class Summary{constructor(){this._buffer=""}filePath(){return o(this,void 0,void 0,(function*(){if(this._filePath){return this._filePath}const t=process.env[r.SUMMARY_ENV_VAR];if(!t){throw new Error(`Unable to find environment variable for $${r.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`)}try{yield s(t,i.constants.R_OK|i.constants.W_OK)}catch(r){throw new Error(`Unable to access summary file: '${t}'. Check if the file has correct read/write permissions.`)}this._filePath=t;return this._filePath}))}wrap(t,r,n={}){const o=Object.entries(n).map((([t,r])=>` ${t}="${r}"`)).join("");if(!r){return`<${t}${o}>`}return`<${t}${o}>${r}`}write(t){return o(this,void 0,void 0,(function*(){const r=!!(t===null||t===void 0?void 0:t.overwrite);const n=yield this.filePath();const o=r?u:l;yield o(n,this._buffer,{encoding:"utf8"});return this.emptyBuffer()}))}clear(){return o(this,void 0,void 0,(function*(){return this.emptyBuffer().write({overwrite:true})}))}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){this._buffer="";return this}addRaw(t,r=false){this._buffer+=t;return r?this.addEOL():this}addEOL(){return this.addRaw(a.EOL)}addCodeBlock(t,r){const n=Object.assign({},r&&{lang:r});const o=this.wrap("pre",this.wrap("code",t),n);return this.addRaw(o).addEOL()}addList(t,r=false){const n=r?"ol":"ul";const o=t.map((t=>this.wrap("li",t))).join("");const a=this.wrap(n,o);return this.addRaw(a).addEOL()}addTable(t){const r=t.map((t=>{const r=t.map((t=>{if(typeof t==="string"){return this.wrap("td",t)}const{header:r,data:n,colspan:o,rowspan:a}=t;const i=r?"th":"td";const s=Object.assign(Object.assign({},o&&{colspan:o}),a&&{rowspan:a});return this.wrap(i,n,s)})).join("");return this.wrap("tr",r)})).join("");const n=this.wrap("table",r);return this.addRaw(n).addEOL()}addDetails(t,r){const n=this.wrap("details",this.wrap("summary",t)+r);return this.addRaw(n).addEOL()}addImage(t,r,n){const{width:o,height:a}=n||{};const i=Object.assign(Object.assign({},o&&{width:o}),a&&{height:a});const s=this.wrap("img",null,Object.assign({src:t,alt:r},i));return this.addRaw(s).addEOL()}addHeading(t,r){const n=`h${r}`;const o=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1";const a=this.wrap(o,t);return this.addRaw(a).addEOL()}addSeparator(){const t=this.wrap("hr",null);return this.addRaw(t).addEOL()}addBreak(){const t=this.wrap("br",null);return this.addRaw(t).addEOL()}addQuote(t,r){const n=Object.assign({},r&&{cite:r});const o=this.wrap("blockquote",t,n);return this.addRaw(o).addEOL()}addLink(t,r){const n=this.wrap("a",t,{href:r});return this.addRaw(n).addEOL()}}const d=new Summary;r.markdownSummary=d;r.summary=d},5278:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.toCommandProperties=r.toCommandValue=void 0;function toCommandValue(t){if(t===null||t===undefined){return""}else if(typeof t==="string"||t instanceof String){return t}return JSON.stringify(t)}r.toCommandValue=toCommandValue;function toCommandProperties(t){if(!Object.keys(t).length){return{}}return{title:t.title,file:t.file,line:t.startLine,endLine:t.endLine,col:t.startColumn,endColumn:t.endColumn}}r.toCommandProperties=toCommandProperties},5526:function(t,r){"use strict";var n=this&&this.__awaiter||function(t,r,n,o){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,a){function fulfilled(t){try{step(o.next(t))}catch(t){a(t)}}function rejected(t){try{step(o["throw"](t))}catch(t){a(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((o=o.apply(t,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.PersonalAccessTokenCredentialHandler=r.BearerCredentialHandler=r.BasicCredentialHandler=void 0;class BasicCredentialHandler{constructor(t,r){this.username=t;this.password=r}prepareRequest(t){if(!t.headers){throw Error("The request has no headers")}t.headers["Authorization"]=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.BasicCredentialHandler=BasicCredentialHandler;class BearerCredentialHandler{constructor(t){this.token=t}prepareRequest(t){if(!t.headers){throw Error("The request has no headers")}t.headers["Authorization"]=`Bearer ${this.token}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.BearerCredentialHandler=BearerCredentialHandler;class PersonalAccessTokenCredentialHandler{constructor(t){this.token=t}prepareRequest(t){if(!t.headers){throw Error("The request has no headers")}t.headers["Authorization"]=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.PersonalAccessTokenCredentialHandler=PersonalAccessTokenCredentialHandler},6255:function(t,r,n){"use strict";var o=this&&this.__createBinding||(Object.create?function(t,r,n,o){if(o===undefined)o=n;Object.defineProperty(t,o,{enumerable:true,get:function(){return r[n]}})}:function(t,r,n,o){if(o===undefined)o=n;t[o]=r[n]});var a=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:true,value:r})}:function(t,r){t["default"]=r});var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n in t)if(n!=="default"&&Object.hasOwnProperty.call(t,n))o(r,t,n);a(r,t);return r};var s=this&&this.__awaiter||function(t,r,n,o){function adopt(t){return t instanceof n?t:new n((function(r){r(t)}))}return new(n||(n=Promise))((function(n,a){function fulfilled(t){try{step(o.next(t))}catch(t){a(t)}}function rejected(t){try{step(o["throw"](t))}catch(t){a(t)}}function step(t){t.done?n(t.value):adopt(t.value).then(fulfilled,rejected)}step((o=o.apply(t,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.HttpClient=r.isHttps=r.HttpClientResponse=r.HttpClientError=r.getProxyUrl=r.MediaTypes=r.Headers=r.HttpCodes=void 0;const l=i(n(3685));const u=i(n(5687));const d=i(n(9835));const c=i(n(4294));var m;(function(t){t[t["OK"]=200]="OK";t[t["MultipleChoices"]=300]="MultipleChoices";t[t["MovedPermanently"]=301]="MovedPermanently";t[t["ResourceMoved"]=302]="ResourceMoved";t[t["SeeOther"]=303]="SeeOther";t[t["NotModified"]=304]="NotModified";t[t["UseProxy"]=305]="UseProxy";t[t["SwitchProxy"]=306]="SwitchProxy";t[t["TemporaryRedirect"]=307]="TemporaryRedirect";t[t["PermanentRedirect"]=308]="PermanentRedirect";t[t["BadRequest"]=400]="BadRequest";t[t["Unauthorized"]=401]="Unauthorized";t[t["PaymentRequired"]=402]="PaymentRequired";t[t["Forbidden"]=403]="Forbidden";t[t["NotFound"]=404]="NotFound";t[t["MethodNotAllowed"]=405]="MethodNotAllowed";t[t["NotAcceptable"]=406]="NotAcceptable";t[t["ProxyAuthenticationRequired"]=407]="ProxyAuthenticationRequired";t[t["RequestTimeout"]=408]="RequestTimeout";t[t["Conflict"]=409]="Conflict";t[t["Gone"]=410]="Gone";t[t["TooManyRequests"]=429]="TooManyRequests";t[t["InternalServerError"]=500]="InternalServerError";t[t["NotImplemented"]=501]="NotImplemented";t[t["BadGateway"]=502]="BadGateway";t[t["ServiceUnavailable"]=503]="ServiceUnavailable";t[t["GatewayTimeout"]=504]="GatewayTimeout"})(m=r.HttpCodes||(r.HttpCodes={}));var h;(function(t){t["Accept"]="accept";t["ContentType"]="content-type"})(h=r.Headers||(r.Headers={}));var p;(function(t){t["ApplicationJson"]="application/json"})(p=r.MediaTypes||(r.MediaTypes={}));function getProxyUrl(t){const r=d.getProxyUrl(new URL(t));return r?r.href:""}r.getProxyUrl=getProxyUrl;const b=[m.MovedPermanently,m.ResourceMoved,m.SeeOther,m.TemporaryRedirect,m.PermanentRedirect];const y=[m.BadGateway,m.ServiceUnavailable,m.GatewayTimeout];const S=["OPTIONS","GET","DELETE","HEAD"];const R=10;const g=5;class HttpClientError extends Error{constructor(t,r){super(t);this.name="HttpClientError";this.statusCode=r;Object.setPrototypeOf(this,HttpClientError.prototype)}}r.HttpClientError=HttpClientError;class HttpClientResponse{constructor(t){this.message=t}readBody(){return s(this,void 0,void 0,(function*(){return new Promise((t=>s(this,void 0,void 0,(function*(){let r=Buffer.alloc(0);this.message.on("data",(t=>{r=Buffer.concat([r,t])}));this.message.on("end",(()=>{t(r.toString())}))}))))}))}}r.HttpClientResponse=HttpClientResponse;function isHttps(t){const r=new URL(t);return r.protocol==="https:"}r.isHttps=isHttps;class HttpClient{constructor(t,r,n){this._ignoreSslError=false;this._allowRedirects=true;this._allowRedirectDowngrade=false;this._maxRedirects=50;this._allowRetries=false;this._maxRetries=1;this._keepAlive=false;this._disposed=false;this.userAgent=t;this.handlers=r||[];this.requestOptions=n;if(n){if(n.ignoreSslError!=null){this._ignoreSslError=n.ignoreSslError}this._socketTimeout=n.socketTimeout;if(n.allowRedirects!=null){this._allowRedirects=n.allowRedirects}if(n.allowRedirectDowngrade!=null){this._allowRedirectDowngrade=n.allowRedirectDowngrade}if(n.maxRedirects!=null){this._maxRedirects=Math.max(n.maxRedirects,0)}if(n.keepAlive!=null){this._keepAlive=n.keepAlive}if(n.allowRetries!=null){this._allowRetries=n.allowRetries}if(n.maxRetries!=null){this._maxRetries=n.maxRetries}}}options(t,r){return s(this,void 0,void 0,(function*(){return this.request("OPTIONS",t,null,r||{})}))}get(t,r){return s(this,void 0,void 0,(function*(){return this.request("GET",t,null,r||{})}))}del(t,r){return s(this,void 0,void 0,(function*(){return this.request("DELETE",t,null,r||{})}))}post(t,r,n){return s(this,void 0,void 0,(function*(){return this.request("POST",t,r,n||{})}))}patch(t,r,n){return s(this,void 0,void 0,(function*(){return this.request("PATCH",t,r,n||{})}))}put(t,r,n){return s(this,void 0,void 0,(function*(){return this.request("PUT",t,r,n||{})}))}head(t,r){return s(this,void 0,void 0,(function*(){return this.request("HEAD",t,null,r||{})}))}sendStream(t,r,n,o){return s(this,void 0,void 0,(function*(){return this.request(t,r,n,o)}))}getJson(t,r={}){return s(this,void 0,void 0,(function*(){r[h.Accept]=this._getExistingOrDefaultHeader(r,h.Accept,p.ApplicationJson);const n=yield this.get(t,r);return this._processResponse(n,this.requestOptions)}))}postJson(t,r,n={}){return s(this,void 0,void 0,(function*(){const o=JSON.stringify(r,null,2);n[h.Accept]=this._getExistingOrDefaultHeader(n,h.Accept,p.ApplicationJson);n[h.ContentType]=this._getExistingOrDefaultHeader(n,h.ContentType,p.ApplicationJson);const a=yield this.post(t,o,n);return this._processResponse(a,this.requestOptions)}))}putJson(t,r,n={}){return s(this,void 0,void 0,(function*(){const o=JSON.stringify(r,null,2);n[h.Accept]=this._getExistingOrDefaultHeader(n,h.Accept,p.ApplicationJson);n[h.ContentType]=this._getExistingOrDefaultHeader(n,h.ContentType,p.ApplicationJson);const a=yield this.put(t,o,n);return this._processResponse(a,this.requestOptions)}))}patchJson(t,r,n={}){return s(this,void 0,void 0,(function*(){const o=JSON.stringify(r,null,2);n[h.Accept]=this._getExistingOrDefaultHeader(n,h.Accept,p.ApplicationJson);n[h.ContentType]=this._getExistingOrDefaultHeader(n,h.ContentType,p.ApplicationJson);const a=yield this.patch(t,o,n);return this._processResponse(a,this.requestOptions)}))}request(t,r,n,o){return s(this,void 0,void 0,(function*(){if(this._disposed){throw new Error("Client has already been disposed.")}const a=new URL(r);let i=this._prepareRequest(t,a,o);const s=this._allowRetries&&S.includes(t)?this._maxRetries+1:1;let l=0;let u;do{u=yield this.requestRaw(i,n);if(u&&u.message&&u.message.statusCode===m.Unauthorized){let t;for(const r of this.handlers){if(r.canHandleAuthentication(u)){t=r;break}}if(t){return t.handleAuthentication(this,i,n)}else{return u}}let r=this._maxRedirects;while(u.message.statusCode&&b.includes(u.message.statusCode)&&this._allowRedirects&&r>0){const s=u.message.headers["location"];if(!s){break}const l=new URL(s);if(a.protocol==="https:"&&a.protocol!==l.protocol&&!this._allowRedirectDowngrade){throw new 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.")}yield u.readBody();if(l.hostname!==a.hostname){for(const t in o){if(t.toLowerCase()==="authorization"){delete o[t]}}}i=this._prepareRequest(t,l,o);u=yield this.requestRaw(i,n);r--}if(!u.message.statusCode||!y.includes(u.message.statusCode)){return u}l+=1;if(l{function callbackForResult(t,r){if(t){o(t)}else if(!r){o(new Error("Unknown error"))}else{n(r)}}this.requestRawWithCallback(t,r,callbackForResult)}))}))}requestRawWithCallback(t,r,n){if(typeof r==="string"){if(!t.options.headers){t.options.headers={}}t.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8")}let o=false;function handleResult(t,r){if(!o){o=true;n(t,r)}}const a=t.httpModule.request(t.options,(t=>{const r=new HttpClientResponse(t);handleResult(undefined,r)}));let i;a.on("socket",(t=>{i=t}));a.setTimeout(this._socketTimeout||3*6e4,(()=>{if(i){i.end()}handleResult(new Error(`Request timeout: ${t.options.path}`))}));a.on("error",(function(t){handleResult(t)}));if(r&&typeof r==="string"){a.write(r,"utf8")}if(r&&typeof r!=="string"){r.on("close",(function(){a.end()}));r.pipe(a)}else{a.end()}}getAgent(t){const r=new URL(t);return this._getAgent(r)}_prepareRequest(t,r,n){const o={};o.parsedUrl=r;const a=o.parsedUrl.protocol==="https:";o.httpModule=a?u:l;const i=a?443:80;o.options={};o.options.host=o.parsedUrl.hostname;o.options.port=o.parsedUrl.port?parseInt(o.parsedUrl.port):i;o.options.path=(o.parsedUrl.pathname||"")+(o.parsedUrl.search||"");o.options.method=t;o.options.headers=this._mergeHeaders(n);if(this.userAgent!=null){o.options.headers["user-agent"]=this.userAgent}o.options.agent=this._getAgent(o.parsedUrl);if(this.handlers){for(const t of this.handlers){t.prepareRequest(o.options)}}return o}_mergeHeaders(t){if(this.requestOptions&&this.requestOptions.headers){return Object.assign({},lowercaseKeys(this.requestOptions.headers),lowercaseKeys(t||{}))}return lowercaseKeys(t||{})}_getExistingOrDefaultHeader(t,r,n){let o;if(this.requestOptions&&this.requestOptions.headers){o=lowercaseKeys(this.requestOptions.headers)[r]}return t[r]||o||n}_getAgent(t){let r;const n=d.getProxyUrl(t);const o=n&&n.hostname;if(this._keepAlive&&o){r=this._proxyAgent}if(this._keepAlive&&!o){r=this._agent}if(r){return r}const a=t.protocol==="https:";let i=100;if(this.requestOptions){i=this.requestOptions.maxSockets||l.globalAgent.maxSockets}if(n&&n.hostname){const t={maxSockets:i,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})};let o;const s=n.protocol==="https:";if(a){o=s?c.httpsOverHttps:c.httpsOverHttp}else{o=s?c.httpOverHttps:c.httpOverHttp}r=o(t);this._proxyAgent=r}if(this._keepAlive&&!r){const t={keepAlive:this._keepAlive,maxSockets:i};r=a?new u.Agent(t):new l.Agent(t);this._agent=r}if(!r){r=a?u.globalAgent:l.globalAgent}if(a&&this._ignoreSslError){r.options=Object.assign(r.options||{},{rejectUnauthorized:false})}return r}_performExponentialBackoff(t){return s(this,void 0,void 0,(function*(){t=Math.min(R,t);const r=g*Math.pow(2,t);return new Promise((t=>setTimeout((()=>t()),r)))}))}_processResponse(t,r){return s(this,void 0,void 0,(function*(){return new Promise(((n,o)=>s(this,void 0,void 0,(function*(){const a=t.message.statusCode||0;const i={statusCode:a,result:null,headers:{}};if(a===m.NotFound){n(i)}function dateTimeDeserializer(t,r){if(typeof r==="string"){const t=new Date(r);if(!isNaN(t.valueOf())){return t}}return r}let s;let l;try{l=yield t.readBody();if(l&&l.length>0){if(r&&r.deserializeDates){s=JSON.parse(l,dateTimeDeserializer)}else{s=JSON.parse(l)}i.result=s}i.headers=t.message.headers}catch(t){}if(a>299){let t;if(s&&s.message){t=s.message}else if(l&&l.length>0){t=l}else{t=`Failed request: (${a})`}const r=new HttpClientError(t,a);r.result=i.result;o(r)}else{n(i)}}))))}))}}r.HttpClient=HttpClient;const lowercaseKeys=t=>Object.keys(t).reduce(((r,n)=>(r[n.toLowerCase()]=t[n],r)),{})},9835:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.checkBypass=r.getProxyUrl=void 0;function getProxyUrl(t){const r=t.protocol==="https:";if(checkBypass(t)){return undefined}const n=(()=>{if(r){return process.env["https_proxy"]||process.env["HTTPS_PROXY"]}else{return process.env["http_proxy"]||process.env["HTTP_PROXY"]}})();if(n){return new URL(n)}else{return undefined}}r.getProxyUrl=getProxyUrl;function checkBypass(t){if(!t.hostname){return false}const r=process.env["no_proxy"]||process.env["NO_PROXY"]||"";if(!r){return false}let n;if(t.port){n=Number(t.port)}else if(t.protocol==="http:"){n=80}else if(t.protocol==="https:"){n=443}const o=[t.hostname.toUpperCase()];if(typeof n==="number"){o.push(`${o[0]}:${n}`)}for(const t of r.split(",").map((t=>t.trim().toUpperCase())).filter((t=>t))){if(o.some((r=>r===t))){return true}}return false}r.checkBypass=checkBypass},7760:(t,r,n)=>{ -/*! node-domexception. MIT License. Jimmy Wärting */ -if(!globalThis.DOMException){try{const{MessageChannel:t}=n(1267),r=(new t).port1,o=new ArrayBuffer;r.postMessage(o,[o,o])}catch(t){t.constructor.name==="DOMException"&&(globalThis.DOMException=t.constructor)}}t.exports=globalThis.DOMException},4294:(t,r,n)=>{t.exports=n(4219)},4219:(t,r,n)=>{"use strict";var o=n(1808);var a=n(4404);var i=n(3685);var s=n(5687);var l=n(2361);var u=n(9491);var d=n(3837);r.httpOverHttp=httpOverHttp;r.httpsOverHttp=httpsOverHttp;r.httpOverHttps=httpOverHttps;r.httpsOverHttps=httpsOverHttps;function httpOverHttp(t){var r=new TunnelingAgent(t);r.request=i.request;return r}function httpsOverHttp(t){var r=new TunnelingAgent(t);r.request=i.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function httpOverHttps(t){var r=new TunnelingAgent(t);r.request=s.request;return r}function httpsOverHttps(t){var r=new TunnelingAgent(t);r.request=s.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function TunnelingAgent(t){var r=this;r.options=t||{};r.proxyOptions=r.options.proxy||{};r.maxSockets=r.options.maxSockets||i.Agent.defaultMaxSockets;r.requests=[];r.sockets=[];r.on("free",(function onFree(t,n,o,a){var i=toOptions(n,o,a);for(var s=0,l=r.requests.length;s=this.maxSockets){a.requests.push(i);return}a.createSocket(i,(function(r){r.on("free",onFree);r.on("close",onCloseOrRemove);r.on("agentRemove",onCloseOrRemove);t.onSocket(r);function onFree(){a.emit("free",r,i)}function onCloseOrRemove(t){a.removeSocket(r);r.removeListener("free",onFree);r.removeListener("close",onCloseOrRemove);r.removeListener("agentRemove",onCloseOrRemove)}}))};TunnelingAgent.prototype.createSocket=function createSocket(t,r){var n=this;var o={};n.sockets.push(o);var a=mergeOptions({},n.proxyOptions,{method:"CONNECT",path:t.host+":"+t.port,agent:false,headers:{host:t.host+":"+t.port}});if(t.localAddress){a.localAddress=t.localAddress}if(a.proxyAuth){a.headers=a.headers||{};a.headers["Proxy-Authorization"]="Basic "+new Buffer(a.proxyAuth).toString("base64")}c("making CONNECT request");var i=n.request(a);i.useChunkedEncodingByDefault=false;i.once("response",onResponse);i.once("upgrade",onUpgrade);i.once("connect",onConnect);i.once("error",onError);i.end();function onResponse(t){t.upgrade=true}function onUpgrade(t,r,n){process.nextTick((function(){onConnect(t,r,n)}))}function onConnect(a,s,l){i.removeAllListeners();s.removeAllListeners();if(a.statusCode!==200){c("tunneling socket could not be established, statusCode=%d",a.statusCode);s.destroy();var u=new Error("tunneling socket could not be established, "+"statusCode="+a.statusCode);u.code="ECONNRESET";t.request.emit("error",u);n.removeSocket(o);return}if(l.length>0){c("got illegal response body from proxy");s.destroy();var u=new Error("got illegal response body from proxy");u.code="ECONNRESET";t.request.emit("error",u);n.removeSocket(o);return}c("tunneling connection has established");n.sockets[n.sockets.indexOf(o)]=s;return r(s)}function onError(r){i.removeAllListeners();c("tunneling socket could not be established, cause=%s\n",r.message,r.stack);var a=new Error("tunneling socket could not be established, "+"cause="+r.message);a.code="ECONNRESET";t.request.emit("error",a);n.removeSocket(o)}};TunnelingAgent.prototype.removeSocket=function removeSocket(t){var r=this.sockets.indexOf(t);if(r===-1){return}this.sockets.splice(r,1);var n=this.requests.shift();if(n){this.createSocket(n,(function(t){n.request.onSocket(t)}))}};function createSecureSocket(t,r){var n=this;TunnelingAgent.prototype.createSocket.call(n,t,(function(o){var i=t.request.getHeader("host");var s=mergeOptions({},n.options,{socket:o,servername:i?i.replace(/:.*$/,""):t.host});var l=a.connect(0,s);n.sockets[n.sockets.indexOf(o)]=l;r(l)}))}function toOptions(t,r,n){if(typeof t==="string"){return{host:t,port:r,localAddress:n}}return t}function mergeOptions(t){for(var r=1,n=arguments.length;r{"use strict";Object.defineProperty(r,"__esModule",{value:true});Object.defineProperty(r,"v1",{enumerable:true,get:function(){return o.default}});Object.defineProperty(r,"v3",{enumerable:true,get:function(){return a.default}});Object.defineProperty(r,"v4",{enumerable:true,get:function(){return i.default}});Object.defineProperty(r,"v5",{enumerable:true,get:function(){return s.default}});Object.defineProperty(r,"NIL",{enumerable:true,get:function(){return l.default}});Object.defineProperty(r,"version",{enumerable:true,get:function(){return u.default}});Object.defineProperty(r,"validate",{enumerable:true,get:function(){return d.default}});Object.defineProperty(r,"stringify",{enumerable:true,get:function(){return c.default}});Object.defineProperty(r,"parse",{enumerable:true,get:function(){return m.default}});var o=_interopRequireDefault(n(8628));var a=_interopRequireDefault(n(6409));var i=_interopRequireDefault(n(5122));var s=_interopRequireDefault(n(9120));var l=_interopRequireDefault(n(5332));var u=_interopRequireDefault(n(1595));var d=_interopRequireDefault(n(6900));var c=_interopRequireDefault(n(8950));var m=_interopRequireDefault(n(2746));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}},4569:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(6113));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function md5(t){if(Array.isArray(t)){t=Buffer.from(t)}else if(typeof t==="string"){t=Buffer.from(t,"utf8")}return o.default.createHash("md5").update(t).digest()}var a=md5;r["default"]=a},5332:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n="00000000-0000-0000-0000-000000000000";r["default"]=n},2746:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(6900));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function parse(t){if(!(0,o.default)(t)){throw TypeError("Invalid UUID")}let r;const n=new Uint8Array(16);n[0]=(r=parseInt(t.slice(0,8),16))>>>24;n[1]=r>>>16&255;n[2]=r>>>8&255;n[3]=r&255;n[4]=(r=parseInt(t.slice(9,13),16))>>>8;n[5]=r&255;n[6]=(r=parseInt(t.slice(14,18),16))>>>8;n[7]=r&255;n[8]=(r=parseInt(t.slice(19,23),16))>>>8;n[9]=r&255;n[10]=(r=parseInt(t.slice(24,36),16))/1099511627776&255;n[11]=r/4294967296&255;n[12]=r>>>24&255;n[13]=r>>>16&255;n[14]=r>>>8&255;n[15]=r&255;return n}var a=parse;r["default"]=a},814:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;r["default"]=n},807:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=rng;var o=_interopRequireDefault(n(6113));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}const a=new Uint8Array(256);let i=a.length;function rng(){if(i>a.length-16){o.default.randomFillSync(a);i=0}return a.slice(i,i+=16)}},5274:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(6113));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function sha1(t){if(Array.isArray(t)){t=Buffer.from(t)}else if(typeof t==="string"){t=Buffer.from(t,"utf8")}return o.default.createHash("sha1").update(t).digest()}var a=sha1;r["default"]=a},8950:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(6900));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}const a=[];for(let t=0;t<256;++t){a.push((t+256).toString(16).substr(1))}function stringify(t,r=0){const n=(a[t[r+0]]+a[t[r+1]]+a[t[r+2]]+a[t[r+3]]+"-"+a[t[r+4]]+a[t[r+5]]+"-"+a[t[r+6]]+a[t[r+7]]+"-"+a[t[r+8]]+a[t[r+9]]+"-"+a[t[r+10]]+a[t[r+11]]+a[t[r+12]]+a[t[r+13]]+a[t[r+14]]+a[t[r+15]]).toLowerCase();if(!(0,o.default)(n)){throw TypeError("Stringified UUID is invalid")}return n}var i=stringify;r["default"]=i},8628:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(807));var a=_interopRequireDefault(n(8950));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}let i;let s;let l=0;let u=0;function v1(t,r,n){let d=r&&n||0;const c=r||new Array(16);t=t||{};let m=t.node||i;let h=t.clockseq!==undefined?t.clockseq:s;if(m==null||h==null){const r=t.random||(t.rng||o.default)();if(m==null){m=i=[r[0]|1,r[1],r[2],r[3],r[4],r[5]]}if(h==null){h=s=(r[6]<<8|r[7])&16383}}let p=t.msecs!==undefined?t.msecs:Date.now();let b=t.nsecs!==undefined?t.nsecs:u+1;const y=p-l+(b-u)/1e4;if(y<0&&t.clockseq===undefined){h=h+1&16383}if((y<0||p>l)&&t.nsecs===undefined){b=0}if(b>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}l=p;u=b;s=h;p+=122192928e5;const S=((p&268435455)*1e4+b)%4294967296;c[d++]=S>>>24&255;c[d++]=S>>>16&255;c[d++]=S>>>8&255;c[d++]=S&255;const R=p/4294967296*1e4&268435455;c[d++]=R>>>8&255;c[d++]=R&255;c[d++]=R>>>24&15|16;c[d++]=R>>>16&255;c[d++]=h>>>8|128;c[d++]=h&255;for(let t=0;t<6;++t){c[d+t]=m[t]}return r||(0,a.default)(c)}var d=v1;r["default"]=d},6409:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(5998));var a=_interopRequireDefault(n(4569));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}const i=(0,o.default)("v3",48,a.default);var s=i;r["default"]=s},5998:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=_default;r.URL=r.DNS=void 0;var o=_interopRequireDefault(n(8950));var a=_interopRequireDefault(n(2746));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function stringToBytes(t){t=unescape(encodeURIComponent(t));const r=[];for(let n=0;n{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(807));var a=_interopRequireDefault(n(8950));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function v4(t,r,n){t=t||{};const i=t.random||(t.rng||o.default)();i[6]=i[6]&15|64;i[8]=i[8]&63|128;if(r){n=n||0;for(let t=0;t<16;++t){r[n+t]=i[t]}return r}return(0,a.default)(i)}var i=v4;r["default"]=i},9120:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(5998));var a=_interopRequireDefault(n(5274));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}const i=(0,o.default)("v5",80,a.default);var s=i;r["default"]=s},6900:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(814));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function validate(t){return typeof t==="string"&&o.default.test(t)}var a=validate;r["default"]=a},1595:(t,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var o=_interopRequireDefault(n(6900));function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function version(t){if(!(0,o.default)(t)){throw TypeError("Invalid UUID")}return parseInt(t.substr(14,1),16)}var a=version;r["default"]=a},1452:function(t,r){(function(t,n){true?n(r):0})(this,(function(t){"use strict";const r=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?Symbol:t=>`Symbol(${t})`;function noop(){return undefined}function getGlobals(){if(typeof self!=="undefined"){return self}else if(typeof window!=="undefined"){return window}else if(typeof global!=="undefined"){return global}return undefined}const n=getGlobals();function typeIsObject(t){return typeof t==="object"&&t!==null||typeof t==="function"}const o=noop;const a=Promise;const i=Promise.prototype.then;const s=Promise.resolve.bind(a);const l=Promise.reject.bind(a);function newPromise(t){return new a(t)}function promiseResolvedWith(t){return s(t)}function promiseRejectedWith(t){return l(t)}function PerformPromiseThen(t,r,n){return i.call(t,r,n)}function uponPromise(t,r,n){PerformPromiseThen(PerformPromiseThen(t,r,n),undefined,o)}function uponFulfillment(t,r){uponPromise(t,r)}function uponRejection(t,r){uponPromise(t,undefined,r)}function transformPromiseWith(t,r,n){return PerformPromiseThen(t,r,n)}function setPromiseIsHandledToTrue(t){PerformPromiseThen(t,undefined,o)}const u=(()=>{const t=n&&n.queueMicrotask;if(typeof t==="function"){return t}const r=promiseResolvedWith(undefined);return t=>PerformPromiseThen(r,t)})();function reflectCall(t,r,n){if(typeof t!=="function"){throw new TypeError("Argument is not a function")}return Function.prototype.apply.call(t,r,n)}function promiseCall(t,r,n){try{return promiseResolvedWith(reflectCall(t,r,n))}catch(t){return promiseRejectedWith(t)}}const d=16384;class SimpleQueue{constructor(){this._cursor=0;this._size=0;this._front={_elements:[],_next:undefined};this._back=this._front;this._cursor=0;this._size=0}get length(){return this._size}push(t){const r=this._back;let n=r;if(r._elements.length===d-1){n={_elements:[],_next:undefined}}r._elements.push(t);if(n!==r){this._back=n;r._next=n}++this._size}shift(){const t=this._front;let r=t;const n=this._cursor;let o=n+1;const a=t._elements;const i=a[n];if(o===d){r=t._next;o=0}--this._size;this._cursor=o;if(t!==r){this._front=r}a[n]=undefined;return i}forEach(t){let r=this._cursor;let n=this._front;let o=n._elements;while(r!==o.length||n._next!==undefined){if(r===o.length){n=n._next;o=n._elements;r=0;if(o.length===0){break}}t(o[r]);++r}}peek(){const t=this._front;const r=this._cursor;return t._elements[r]}}function ReadableStreamReaderGenericInitialize(t,r){t._ownerReadableStream=r;r._reader=t;if(r._state==="readable"){defaultReaderClosedPromiseInitialize(t)}else if(r._state==="closed"){defaultReaderClosedPromiseInitializeAsResolved(t)}else{defaultReaderClosedPromiseInitializeAsRejected(t,r._storedError)}}function ReadableStreamReaderGenericCancel(t,r){const n=t._ownerReadableStream;return ReadableStreamCancel(n,r)}function ReadableStreamReaderGenericRelease(t){if(t._ownerReadableStream._state==="readable"){defaultReaderClosedPromiseReject(t,new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`))}else{defaultReaderClosedPromiseResetToRejected(t,new TypeError(`Reader was released and can no longer be used to monitor the stream's closedness`))}t._ownerReadableStream._reader=undefined;t._ownerReadableStream=undefined}function readerLockException(t){return new TypeError("Cannot "+t+" a stream using a released reader")}function defaultReaderClosedPromiseInitialize(t){t._closedPromise=newPromise(((r,n)=>{t._closedPromise_resolve=r;t._closedPromise_reject=n}))}function defaultReaderClosedPromiseInitializeAsRejected(t,r){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseReject(t,r)}function defaultReaderClosedPromiseInitializeAsResolved(t){defaultReaderClosedPromiseInitialize(t);defaultReaderClosedPromiseResolve(t)}function defaultReaderClosedPromiseReject(t,r){if(t._closedPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined}function defaultReaderClosedPromiseResetToRejected(t,r){defaultReaderClosedPromiseInitializeAsRejected(t,r)}function defaultReaderClosedPromiseResolve(t){if(t._closedPromise_resolve===undefined){return}t._closedPromise_resolve(undefined);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined}const c=r("[[AbortSteps]]");const m=r("[[ErrorSteps]]");const h=r("[[CancelSteps]]");const p=r("[[PullSteps]]");const b=Number.isFinite||function(t){return typeof t==="number"&&isFinite(t)};const y=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};function isDictionary(t){return typeof t==="object"||typeof t==="function"}function assertDictionary(t,r){if(t!==undefined&&!isDictionary(t)){throw new TypeError(`${r} is not an object.`)}}function assertFunction(t,r){if(typeof t!=="function"){throw new TypeError(`${r} is not a function.`)}}function isObject(t){return typeof t==="object"&&t!==null||typeof t==="function"}function assertObject(t,r){if(!isObject(t)){throw new TypeError(`${r} is not an object.`)}}function assertRequiredArgument(t,r,n){if(t===undefined){throw new TypeError(`Parameter ${r} is required in '${n}'.`)}}function assertRequiredField(t,r,n){if(t===undefined){throw new TypeError(`${r} is required in '${n}'.`)}}function convertUnrestrictedDouble(t){return Number(t)}function censorNegativeZero(t){return t===0?0:t}function integerPart(t){return censorNegativeZero(y(t))}function convertUnsignedLongLongWithEnforceRange(t,r){const n=0;const o=Number.MAX_SAFE_INTEGER;let a=Number(t);a=censorNegativeZero(a);if(!b(a)){throw new TypeError(`${r} is not a finite number`)}a=integerPart(a);if(ao){throw new TypeError(`${r} is outside the accepted range of ${n} to ${o}, inclusive`)}if(!b(a)||a===0){return 0}return a}function assertReadableStream(t,r){if(!IsReadableStream(t)){throw new TypeError(`${r} is not a ReadableStream.`)}}function AcquireReadableStreamDefaultReader(t){return new ReadableStreamDefaultReader(t)}function ReadableStreamAddReadRequest(t,r){t._reader._readRequests.push(r)}function ReadableStreamFulfillReadRequest(t,r,n){const o=t._reader;const a=o._readRequests.shift();if(n){a._closeSteps()}else{a._chunkSteps(r)}}function ReadableStreamGetNumReadRequests(t){return t._reader._readRequests.length}function ReadableStreamHasDefaultReader(t){const r=t._reader;if(r===undefined){return false}if(!IsReadableStreamDefaultReader(r)){return false}return true}class ReadableStreamDefaultReader{constructor(t){assertRequiredArgument(t,1,"ReadableStreamDefaultReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive reading by another reader")}ReadableStreamReaderGenericInitialize(this,t);this._readRequests=new SimpleQueue}get closed(){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("closed"))}return this._closedPromise}cancel(t=undefined){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("cancel"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("cancel"))}return ReadableStreamReaderGenericCancel(this,t)}read(){if(!IsReadableStreamDefaultReader(this)){return promiseRejectedWith(defaultReaderBrandCheckException("read"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("read from"))}let t;let r;const n=newPromise(((n,o)=>{t=n;r=o}));const o={_chunkSteps:r=>t({value:r,done:false}),_closeSteps:()=>t({value:undefined,done:true}),_errorSteps:t=>r(t)};ReadableStreamDefaultReaderRead(this,o);return n}releaseLock(){if(!IsReadableStreamDefaultReader(this)){throw defaultReaderBrandCheckException("releaseLock")}if(this._ownerReadableStream===undefined){return}if(this._readRequests.length>0){throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled")}ReadableStreamReaderGenericRelease(this)}}Object.defineProperties(ReadableStreamDefaultReader.prototype,{cancel:{enumerable:true},read:{enumerable:true},releaseLock:{enumerable:true},closed:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamDefaultReader.prototype,r.toStringTag,{value:"ReadableStreamDefaultReader",configurable:true})}function IsReadableStreamDefaultReader(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readRequests")){return false}return t instanceof ReadableStreamDefaultReader}function ReadableStreamDefaultReaderRead(t,r){const n=t._ownerReadableStream;n._disturbed=true;if(n._state==="closed"){r._closeSteps()}else if(n._state==="errored"){r._errorSteps(n._storedError)}else{n._readableStreamController[p](r)}}function defaultReaderBrandCheckException(t){return new TypeError(`ReadableStreamDefaultReader.prototype.${t} can only be used on a ReadableStreamDefaultReader`)}const S=Object.getPrototypeOf(Object.getPrototypeOf((async function*(){})).prototype);class ReadableStreamAsyncIteratorImpl{constructor(t,r){this._ongoingPromise=undefined;this._isFinished=false;this._reader=t;this._preventCancel=r}next(){const nextSteps=()=>this._nextSteps();this._ongoingPromise=this._ongoingPromise?transformPromiseWith(this._ongoingPromise,nextSteps,nextSteps):nextSteps();return this._ongoingPromise}return(t){const returnSteps=()=>this._returnSteps(t);return this._ongoingPromise?transformPromiseWith(this._ongoingPromise,returnSteps,returnSteps):returnSteps()}_nextSteps(){if(this._isFinished){return Promise.resolve({value:undefined,done:true})}const t=this._reader;if(t._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("iterate"))}let r;let n;const o=newPromise(((t,o)=>{r=t;n=o}));const a={_chunkSteps:t=>{this._ongoingPromise=undefined;u((()=>r({value:t,done:false})))},_closeSteps:()=>{this._ongoingPromise=undefined;this._isFinished=true;ReadableStreamReaderGenericRelease(t);r({value:undefined,done:true})},_errorSteps:r=>{this._ongoingPromise=undefined;this._isFinished=true;ReadableStreamReaderGenericRelease(t);n(r)}};ReadableStreamDefaultReaderRead(t,a);return o}_returnSteps(t){if(this._isFinished){return Promise.resolve({value:t,done:true})}this._isFinished=true;const r=this._reader;if(r._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("finish iterating"))}if(!this._preventCancel){const n=ReadableStreamReaderGenericCancel(r,t);ReadableStreamReaderGenericRelease(r);return transformPromiseWith(n,(()=>({value:t,done:true})))}ReadableStreamReaderGenericRelease(r);return promiseResolvedWith({value:t,done:true})}}const R={next(){if(!IsReadableStreamAsyncIterator(this)){return promiseRejectedWith(streamAsyncIteratorBrandCheckException("next"))}return this._asyncIteratorImpl.next()},return(t){if(!IsReadableStreamAsyncIterator(this)){return promiseRejectedWith(streamAsyncIteratorBrandCheckException("return"))}return this._asyncIteratorImpl.return(t)}};if(S!==undefined){Object.setPrototypeOf(R,S)}function AcquireReadableStreamAsyncIterator(t,r){const n=AcquireReadableStreamDefaultReader(t);const o=new ReadableStreamAsyncIteratorImpl(n,r);const a=Object.create(R);a._asyncIteratorImpl=o;return a}function IsReadableStreamAsyncIterator(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_asyncIteratorImpl")){return false}try{return t._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl}catch(t){return false}}function streamAsyncIteratorBrandCheckException(t){return new TypeError(`ReadableStreamAsyncIterator.${t} can only be used on a ReadableSteamAsyncIterator`)}const g=Number.isNaN||function(t){return t!==t};function CreateArrayFromList(t){return t.slice()}function CopyDataBlockBytes(t,r,n,o,a){new Uint8Array(t).set(new Uint8Array(n,o,a),r)}function TransferArrayBuffer(t){return t}function IsDetachedBuffer(t){return false}function ArrayBufferSlice(t,r,n){if(t.slice){return t.slice(r,n)}const o=n-r;const a=new ArrayBuffer(o);CopyDataBlockBytes(a,0,t,r,o);return a}function IsNonNegativeNumber(t){if(typeof t!=="number"){return false}if(g(t)){return false}if(t<0){return false}return true}function CloneAsUint8Array(t){const r=ArrayBufferSlice(t.buffer,t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(r)}function DequeueValue(t){const r=t._queue.shift();t._queueTotalSize-=r.size;if(t._queueTotalSize<0){t._queueTotalSize=0}return r.value}function EnqueueValueWithSize(t,r,n){if(!IsNonNegativeNumber(n)||n===Infinity){throw new RangeError("Size must be a finite, non-NaN, non-negative number.")}t._queue.push({value:r,size:n});t._queueTotalSize+=n}function PeekQueueValue(t){const r=t._queue.peek();return r.value}function ResetQueue(t){t._queue=new SimpleQueue;t._queueTotalSize=0}class ReadableStreamBYOBRequest{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("view")}return this._view}respond(t){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("respond")}assertRequiredArgument(t,1,"respond");t=convertUnsignedLongLongWithEnforceRange(t,"First parameter");if(this._associatedReadableByteStreamController===undefined){throw new TypeError("This BYOB request has been invalidated")}if(IsDetachedBuffer(this._view.buffer));ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!IsReadableStreamBYOBRequest(this)){throw byobRequestBrandCheckException("respondWithNewView")}assertRequiredArgument(t,1,"respondWithNewView");if(!ArrayBuffer.isView(t)){throw new TypeError("You can only respond with array buffer views")}if(this._associatedReadableByteStreamController===undefined){throw new TypeError("This BYOB request has been invalidated")}if(IsDetachedBuffer(t.buffer));ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController,t)}}Object.defineProperties(ReadableStreamBYOBRequest.prototype,{respond:{enumerable:true},respondWithNewView:{enumerable:true},view:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamBYOBRequest.prototype,r.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:true})}class ReadableByteStreamController{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("byobRequest")}return ReadableByteStreamControllerGetBYOBRequest(this)}get desiredSize(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("desiredSize")}return ReadableByteStreamControllerGetDesiredSize(this)}close(){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("close")}if(this._closeRequested){throw new TypeError("The stream has already been closed; do not close it again!")}const t=this._controlledReadableByteStream._state;if(t!=="readable"){throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`)}ReadableByteStreamControllerClose(this)}enqueue(t){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("enqueue")}assertRequiredArgument(t,1,"enqueue");if(!ArrayBuffer.isView(t)){throw new TypeError("chunk must be an array buffer view")}if(t.byteLength===0){throw new TypeError("chunk must have non-zero byteLength")}if(t.buffer.byteLength===0){throw new TypeError(`chunk's buffer must have non-zero byteLength`)}if(this._closeRequested){throw new TypeError("stream is closed or draining")}const r=this._controlledReadableByteStream._state;if(r!=="readable"){throw new TypeError(`The stream (in ${r} state) is not in the readable state and cannot be enqueued to`)}ReadableByteStreamControllerEnqueue(this,t)}error(t=undefined){if(!IsReadableByteStreamController(this)){throw byteStreamControllerBrandCheckException("error")}ReadableByteStreamControllerError(this,t)}[h](t){ReadableByteStreamControllerClearPendingPullIntos(this);ResetQueue(this);const r=this._cancelAlgorithm(t);ReadableByteStreamControllerClearAlgorithms(this);return r}[p](t){const r=this._controlledReadableByteStream;if(this._queueTotalSize>0){const r=this._queue.shift();this._queueTotalSize-=r.byteLength;ReadableByteStreamControllerHandleQueueDrain(this);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n);return}const n=this._autoAllocateChunkSize;if(n!==undefined){let r;try{r=new ArrayBuffer(n)}catch(r){t._errorSteps(r);return}const o={buffer:r,bufferByteLength:n,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}ReadableStreamAddReadRequest(r,t);ReadableByteStreamControllerCallPullIfNeeded(this)}}Object.defineProperties(ReadableByteStreamController.prototype,{close:{enumerable:true},enqueue:{enumerable:true},error:{enumerable:true},byobRequest:{enumerable:true},desiredSize:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableByteStreamController.prototype,r.toStringTag,{value:"ReadableByteStreamController",configurable:true})}function IsReadableByteStreamController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledReadableByteStream")){return false}return t instanceof ReadableByteStreamController}function IsReadableStreamBYOBRequest(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_associatedReadableByteStreamController")){return false}return t instanceof ReadableStreamBYOBRequest}function ReadableByteStreamControllerCallPullIfNeeded(t){const r=ReadableByteStreamControllerShouldCallPull(t);if(!r){return}if(t._pulling){t._pullAgain=true;return}t._pulling=true;const n=t._pullAlgorithm();uponPromise(n,(()=>{t._pulling=false;if(t._pullAgain){t._pullAgain=false;ReadableByteStreamControllerCallPullIfNeeded(t)}}),(r=>{ReadableByteStreamControllerError(t,r)}))}function ReadableByteStreamControllerClearPendingPullIntos(t){ReadableByteStreamControllerInvalidateBYOBRequest(t);t._pendingPullIntos=new SimpleQueue}function ReadableByteStreamControllerCommitPullIntoDescriptor(t,r){let n=false;if(t._state==="closed"){n=true}const o=ReadableByteStreamControllerConvertPullIntoDescriptor(r);if(r.readerType==="default"){ReadableStreamFulfillReadRequest(t,o,n)}else{ReadableStreamFulfillReadIntoRequest(t,o,n)}}function ReadableByteStreamControllerConvertPullIntoDescriptor(t){const r=t.bytesFilled;const n=t.elementSize;return new t.viewConstructor(t.buffer,t.byteOffset,r/n)}function ReadableByteStreamControllerEnqueueChunkToQueue(t,r,n,o){t._queue.push({buffer:r,byteOffset:n,byteLength:o});t._queueTotalSize+=o}function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r){const n=r.elementSize;const o=r.bytesFilled-r.bytesFilled%n;const a=Math.min(t._queueTotalSize,r.byteLength-r.bytesFilled);const i=r.bytesFilled+a;const s=i-i%n;let l=a;let u=false;if(s>o){l=s-r.bytesFilled;u=true}const d=t._queue;while(l>0){const n=d.peek();const o=Math.min(l,n.byteLength);const a=r.byteOffset+r.bytesFilled;CopyDataBlockBytes(r.buffer,a,n.buffer,n.byteOffset,o);if(n.byteLength===o){d.shift()}else{n.byteOffset+=o;n.byteLength-=o}t._queueTotalSize-=o;ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,o,r);l-=o}return u}function ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,n){n.bytesFilled+=r}function ReadableByteStreamControllerHandleQueueDrain(t){if(t._queueTotalSize===0&&t._closeRequested){ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(t._controlledReadableByteStream)}else{ReadableByteStreamControllerCallPullIfNeeded(t)}}function ReadableByteStreamControllerInvalidateBYOBRequest(t){if(t._byobRequest===null){return}t._byobRequest._associatedReadableByteStreamController=undefined;t._byobRequest._view=null;t._byobRequest=null}function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t){while(t._pendingPullIntos.length>0){if(t._queueTotalSize===0){return}const r=t._pendingPullIntos.peek();if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,r)){ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,r)}}}function ReadableByteStreamControllerPullInto(t,r,n){const o=t._controlledReadableByteStream;let a=1;if(r.constructor!==DataView){a=r.constructor.BYTES_PER_ELEMENT}const i=r.constructor;const s=TransferArrayBuffer(r.buffer);const l={buffer:s,bufferByteLength:s.byteLength,byteOffset:r.byteOffset,byteLength:r.byteLength,bytesFilled:0,elementSize:a,viewConstructor:i,readerType:"byob"};if(t._pendingPullIntos.length>0){t._pendingPullIntos.push(l);ReadableStreamAddReadIntoRequest(o,n);return}if(o._state==="closed"){const t=new i(l.buffer,l.byteOffset,0);n._closeSteps(t);return}if(t._queueTotalSize>0){if(ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(t,l)){const r=ReadableByteStreamControllerConvertPullIntoDescriptor(l);ReadableByteStreamControllerHandleQueueDrain(t);n._chunkSteps(r);return}if(t._closeRequested){const r=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,r);n._errorSteps(r);return}}t._pendingPullIntos.push(l);ReadableStreamAddReadIntoRequest(o,n);ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerRespondInClosedState(t,r){const n=t._controlledReadableByteStream;if(ReadableStreamHasBYOBReader(n)){while(ReadableStreamGetNumReadIntoRequests(n)>0){const r=ReadableByteStreamControllerShiftPendingPullInto(t);ReadableByteStreamControllerCommitPullIntoDescriptor(n,r)}}}function ReadableByteStreamControllerRespondInReadableState(t,r,n){ReadableByteStreamControllerFillHeadPullIntoDescriptor(t,r,n);if(n.bytesFilled0){const r=n.byteOffset+n.bytesFilled;const a=ArrayBufferSlice(n.buffer,r-o,r);ReadableByteStreamControllerEnqueueChunkToQueue(t,a,0,a.byteLength)}n.bytesFilled-=o;ReadableByteStreamControllerCommitPullIntoDescriptor(t._controlledReadableByteStream,n);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}function ReadableByteStreamControllerRespondInternal(t,r){const n=t._pendingPullIntos.peek();ReadableByteStreamControllerInvalidateBYOBRequest(t);const o=t._controlledReadableByteStream._state;if(o==="closed"){ReadableByteStreamControllerRespondInClosedState(t)}else{ReadableByteStreamControllerRespondInReadableState(t,r,n)}ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerShiftPendingPullInto(t){const r=t._pendingPullIntos.shift();return r}function ReadableByteStreamControllerShouldCallPull(t){const r=t._controlledReadableByteStream;if(r._state!=="readable"){return false}if(t._closeRequested){return false}if(!t._started){return false}if(ReadableStreamHasDefaultReader(r)&&ReadableStreamGetNumReadRequests(r)>0){return true}if(ReadableStreamHasBYOBReader(r)&&ReadableStreamGetNumReadIntoRequests(r)>0){return true}const n=ReadableByteStreamControllerGetDesiredSize(t);if(n>0){return true}return false}function ReadableByteStreamControllerClearAlgorithms(t){t._pullAlgorithm=undefined;t._cancelAlgorithm=undefined}function ReadableByteStreamControllerClose(t){const r=t._controlledReadableByteStream;if(t._closeRequested||r._state!=="readable"){return}if(t._queueTotalSize>0){t._closeRequested=true;return}if(t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();if(r.bytesFilled>0){const r=new TypeError("Insufficient bytes to fill elements in the given buffer");ReadableByteStreamControllerError(t,r);throw r}}ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamClose(r)}function ReadableByteStreamControllerEnqueue(t,r){const n=t._controlledReadableByteStream;if(t._closeRequested||n._state!=="readable"){return}const o=r.buffer;const a=r.byteOffset;const i=r.byteLength;const s=TransferArrayBuffer(o);if(t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();if(IsDetachedBuffer(r.buffer));r.buffer=TransferArrayBuffer(r.buffer)}ReadableByteStreamControllerInvalidateBYOBRequest(t);if(ReadableStreamHasDefaultReader(n)){if(ReadableStreamGetNumReadRequests(n)===0){ReadableByteStreamControllerEnqueueChunkToQueue(t,s,a,i)}else{if(t._pendingPullIntos.length>0){ReadableByteStreamControllerShiftPendingPullInto(t)}const r=new Uint8Array(s,a,i);ReadableStreamFulfillReadRequest(n,r,false)}}else if(ReadableStreamHasBYOBReader(n)){ReadableByteStreamControllerEnqueueChunkToQueue(t,s,a,i);ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(t)}else{ReadableByteStreamControllerEnqueueChunkToQueue(t,s,a,i)}ReadableByteStreamControllerCallPullIfNeeded(t)}function ReadableByteStreamControllerError(t,r){const n=t._controlledReadableByteStream;if(n._state!=="readable"){return}ReadableByteStreamControllerClearPendingPullIntos(t);ResetQueue(t);ReadableByteStreamControllerClearAlgorithms(t);ReadableStreamError(n,r)}function ReadableByteStreamControllerGetBYOBRequest(t){if(t._byobRequest===null&&t._pendingPullIntos.length>0){const r=t._pendingPullIntos.peek();const n=new Uint8Array(r.buffer,r.byteOffset+r.bytesFilled,r.byteLength-r.bytesFilled);const o=Object.create(ReadableStreamBYOBRequest.prototype);SetUpReadableStreamBYOBRequest(o,t,n);t._byobRequest=o}return t._byobRequest}function ReadableByteStreamControllerGetDesiredSize(t){const r=t._controlledReadableByteStream._state;if(r==="errored"){return null}if(r==="closed"){return 0}return t._strategyHWM-t._queueTotalSize}function ReadableByteStreamControllerRespond(t,r){const n=t._pendingPullIntos.peek();const o=t._controlledReadableByteStream._state;if(o==="closed"){if(r!==0){throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}}else{if(r===0){throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream")}if(n.bytesFilled+r>n.byteLength){throw new RangeError("bytesWritten out of range")}}n.buffer=TransferArrayBuffer(n.buffer);ReadableByteStreamControllerRespondInternal(t,r)}function ReadableByteStreamControllerRespondWithNewView(t,r){const n=t._pendingPullIntos.peek();const o=t._controlledReadableByteStream._state;if(o==="closed"){if(r.byteLength!==0){throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}}else{if(r.byteLength===0){throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream")}}if(n.byteOffset+n.bytesFilled!==r.byteOffset){throw new RangeError("The region specified by view does not match byobRequest")}if(n.bufferByteLength!==r.buffer.byteLength){throw new RangeError("The buffer of view has different capacity than byobRequest")}if(n.bytesFilled+r.byteLength>n.byteLength){throw new RangeError("The region specified by view is larger than byobRequest")}const a=r.byteLength;n.buffer=TransferArrayBuffer(r.buffer);ReadableByteStreamControllerRespondInternal(t,a)}function SetUpReadableByteStreamController(t,r,n,o,a,i,s){r._controlledReadableByteStream=t;r._pullAgain=false;r._pulling=false;r._byobRequest=null;r._queue=r._queueTotalSize=undefined;ResetQueue(r);r._closeRequested=false;r._started=false;r._strategyHWM=i;r._pullAlgorithm=o;r._cancelAlgorithm=a;r._autoAllocateChunkSize=s;r._pendingPullIntos=new SimpleQueue;t._readableStreamController=r;const l=n();uponPromise(promiseResolvedWith(l),(()=>{r._started=true;ReadableByteStreamControllerCallPullIfNeeded(r)}),(t=>{ReadableByteStreamControllerError(r,t)}))}function SetUpReadableByteStreamControllerFromUnderlyingSource(t,r,n){const o=Object.create(ReadableByteStreamController.prototype);let startAlgorithm=()=>undefined;let pullAlgorithm=()=>promiseResolvedWith(undefined);let cancelAlgorithm=()=>promiseResolvedWith(undefined);if(r.start!==undefined){startAlgorithm=()=>r.start(o)}if(r.pull!==undefined){pullAlgorithm=()=>r.pull(o)}if(r.cancel!==undefined){cancelAlgorithm=t=>r.cancel(t)}const a=r.autoAllocateChunkSize;if(a===0){throw new TypeError("autoAllocateChunkSize must be greater than 0")}SetUpReadableByteStreamController(t,o,startAlgorithm,pullAlgorithm,cancelAlgorithm,n,a)}function SetUpReadableStreamBYOBRequest(t,r,n){t._associatedReadableByteStreamController=r;t._view=n}function byobRequestBrandCheckException(t){return new TypeError(`ReadableStreamBYOBRequest.prototype.${t} can only be used on a ReadableStreamBYOBRequest`)}function byteStreamControllerBrandCheckException(t){return new TypeError(`ReadableByteStreamController.prototype.${t} can only be used on a ReadableByteStreamController`)}function AcquireReadableStreamBYOBReader(t){return new ReadableStreamBYOBReader(t)}function ReadableStreamAddReadIntoRequest(t,r){t._reader._readIntoRequests.push(r)}function ReadableStreamFulfillReadIntoRequest(t,r,n){const o=t._reader;const a=o._readIntoRequests.shift();if(n){a._closeSteps(r)}else{a._chunkSteps(r)}}function ReadableStreamGetNumReadIntoRequests(t){return t._reader._readIntoRequests.length}function ReadableStreamHasBYOBReader(t){const r=t._reader;if(r===undefined){return false}if(!IsReadableStreamBYOBReader(r)){return false}return true}class ReadableStreamBYOBReader{constructor(t){assertRequiredArgument(t,1,"ReadableStreamBYOBReader");assertReadableStream(t,"First parameter");if(IsReadableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive reading by another reader")}if(!IsReadableByteStreamController(t._readableStreamController)){throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte "+"source")}ReadableStreamReaderGenericInitialize(this,t);this._readIntoRequests=new SimpleQueue}get closed(){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("closed"))}return this._closedPromise}cancel(t=undefined){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("cancel"))}if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("cancel"))}return ReadableStreamReaderGenericCancel(this,t)}read(t){if(!IsReadableStreamBYOBReader(this)){return promiseRejectedWith(byobReaderBrandCheckException("read"))}if(!ArrayBuffer.isView(t)){return promiseRejectedWith(new TypeError("view must be an array buffer view"))}if(t.byteLength===0){return promiseRejectedWith(new TypeError("view must have non-zero byteLength"))}if(t.buffer.byteLength===0){return promiseRejectedWith(new TypeError(`view's buffer must have non-zero byteLength`))}if(IsDetachedBuffer(t.buffer));if(this._ownerReadableStream===undefined){return promiseRejectedWith(readerLockException("read from"))}let r;let n;const o=newPromise(((t,o)=>{r=t;n=o}));const a={_chunkSteps:t=>r({value:t,done:false}),_closeSteps:t=>r({value:t,done:true}),_errorSteps:t=>n(t)};ReadableStreamBYOBReaderRead(this,t,a);return o}releaseLock(){if(!IsReadableStreamBYOBReader(this)){throw byobReaderBrandCheckException("releaseLock")}if(this._ownerReadableStream===undefined){return}if(this._readIntoRequests.length>0){throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled")}ReadableStreamReaderGenericRelease(this)}}Object.defineProperties(ReadableStreamBYOBReader.prototype,{cancel:{enumerable:true},read:{enumerable:true},releaseLock:{enumerable:true},closed:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamBYOBReader.prototype,r.toStringTag,{value:"ReadableStreamBYOBReader",configurable:true})}function IsReadableStreamBYOBReader(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readIntoRequests")){return false}return t instanceof ReadableStreamBYOBReader}function ReadableStreamBYOBReaderRead(t,r,n){const o=t._ownerReadableStream;o._disturbed=true;if(o._state==="errored"){n._errorSteps(o._storedError)}else{ReadableByteStreamControllerPullInto(o._readableStreamController,r,n)}}function byobReaderBrandCheckException(t){return new TypeError(`ReadableStreamBYOBReader.prototype.${t} can only be used on a ReadableStreamBYOBReader`)}function ExtractHighWaterMark(t,r){const{highWaterMark:n}=t;if(n===undefined){return r}if(g(n)||n<0){throw new RangeError("Invalid highWaterMark")}return n}function ExtractSizeAlgorithm(t){const{size:r}=t;if(!r){return()=>1}return r}function convertQueuingStrategy(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.highWaterMark;const o=t===null||t===void 0?void 0:t.size;return{highWaterMark:n===undefined?undefined:convertUnrestrictedDouble(n),size:o===undefined?undefined:convertQueuingStrategySize(o,`${r} has member 'size' that`)}}function convertQueuingStrategySize(t,r){assertFunction(t,r);return r=>convertUnrestrictedDouble(t(r))}function convertUnderlyingSink(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.abort;const o=t===null||t===void 0?void 0:t.close;const a=t===null||t===void 0?void 0:t.start;const i=t===null||t===void 0?void 0:t.type;const s=t===null||t===void 0?void 0:t.write;return{abort:n===undefined?undefined:convertUnderlyingSinkAbortCallback(n,t,`${r} has member 'abort' that`),close:o===undefined?undefined:convertUnderlyingSinkCloseCallback(o,t,`${r} has member 'close' that`),start:a===undefined?undefined:convertUnderlyingSinkStartCallback(a,t,`${r} has member 'start' that`),write:s===undefined?undefined:convertUnderlyingSinkWriteCallback(s,t,`${r} has member 'write' that`),type:i}}function convertUnderlyingSinkAbortCallback(t,r,n){assertFunction(t,n);return n=>promiseCall(t,r,[n])}function convertUnderlyingSinkCloseCallback(t,r,n){assertFunction(t,n);return()=>promiseCall(t,r,[])}function convertUnderlyingSinkStartCallback(t,r,n){assertFunction(t,n);return n=>reflectCall(t,r,[n])}function convertUnderlyingSinkWriteCallback(t,r,n){assertFunction(t,n);return(n,o)=>promiseCall(t,r,[n,o])}function assertWritableStream(t,r){if(!IsWritableStream(t)){throw new TypeError(`${r} is not a WritableStream.`)}}function isAbortSignal(t){if(typeof t!=="object"||t===null){return false}try{return typeof t.aborted==="boolean"}catch(t){return false}}const _=typeof AbortController==="function";function createAbortController(){if(_){return new AbortController}return undefined}class WritableStream{constructor(t={},r={}){if(t===undefined){t=null}else{assertObject(t,"First parameter")}const n=convertQueuingStrategy(r,"Second parameter");const o=convertUnderlyingSink(t,"First parameter");InitializeWritableStream(this);const a=o.type;if(a!==undefined){throw new RangeError("Invalid type is specified")}const i=ExtractSizeAlgorithm(n);const s=ExtractHighWaterMark(n,1);SetUpWritableStreamDefaultControllerFromUnderlyingSink(this,o,s,i)}get locked(){if(!IsWritableStream(this)){throw streamBrandCheckException$2("locked")}return IsWritableStreamLocked(this)}abort(t=undefined){if(!IsWritableStream(this)){return promiseRejectedWith(streamBrandCheckException$2("abort"))}if(IsWritableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot abort a stream that already has a writer"))}return WritableStreamAbort(this,t)}close(){if(!IsWritableStream(this)){return promiseRejectedWith(streamBrandCheckException$2("close"))}if(IsWritableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot close a stream that already has a writer"))}if(WritableStreamCloseQueuedOrInFlight(this)){return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"))}return WritableStreamClose(this)}getWriter(){if(!IsWritableStream(this)){throw streamBrandCheckException$2("getWriter")}return AcquireWritableStreamDefaultWriter(this)}}Object.defineProperties(WritableStream.prototype,{abort:{enumerable:true},close:{enumerable:true},getWriter:{enumerable:true},locked:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStream.prototype,r.toStringTag,{value:"WritableStream",configurable:true})}function AcquireWritableStreamDefaultWriter(t){return new WritableStreamDefaultWriter(t)}function CreateWritableStream(t,r,n,o,a=1,i=(()=>1)){const s=Object.create(WritableStream.prototype);InitializeWritableStream(s);const l=Object.create(WritableStreamDefaultController.prototype);SetUpWritableStreamDefaultController(s,l,t,r,n,o,a,i);return s}function InitializeWritableStream(t){t._state="writable";t._storedError=undefined;t._writer=undefined;t._writableStreamController=undefined;t._writeRequests=new SimpleQueue;t._inFlightWriteRequest=undefined;t._closeRequest=undefined;t._inFlightCloseRequest=undefined;t._pendingAbortRequest=undefined;t._backpressure=false}function IsWritableStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_writableStreamController")){return false}return t instanceof WritableStream}function IsWritableStreamLocked(t){if(t._writer===undefined){return false}return true}function WritableStreamAbort(t,r){var n;if(t._state==="closed"||t._state==="errored"){return promiseResolvedWith(undefined)}t._writableStreamController._abortReason=r;(n=t._writableStreamController._abortController)===null||n===void 0?void 0:n.abort();const o=t._state;if(o==="closed"||o==="errored"){return promiseResolvedWith(undefined)}if(t._pendingAbortRequest!==undefined){return t._pendingAbortRequest._promise}let a=false;if(o==="erroring"){a=true;r=undefined}const i=newPromise(((n,o)=>{t._pendingAbortRequest={_promise:undefined,_resolve:n,_reject:o,_reason:r,_wasAlreadyErroring:a}}));t._pendingAbortRequest._promise=i;if(!a){WritableStreamStartErroring(t,r)}return i}function WritableStreamClose(t){const r=t._state;if(r==="closed"||r==="errored"){return promiseRejectedWith(new TypeError(`The stream (in ${r} state) is not in the writable state and cannot be closed`))}const n=newPromise(((r,n)=>{const o={_resolve:r,_reject:n};t._closeRequest=o}));const o=t._writer;if(o!==undefined&&t._backpressure&&r==="writable"){defaultWriterReadyPromiseResolve(o)}WritableStreamDefaultControllerClose(t._writableStreamController);return n}function WritableStreamAddWriteRequest(t){const r=newPromise(((r,n)=>{const o={_resolve:r,_reject:n};t._writeRequests.push(o)}));return r}function WritableStreamDealWithRejection(t,r){const n=t._state;if(n==="writable"){WritableStreamStartErroring(t,r);return}WritableStreamFinishErroring(t)}function WritableStreamStartErroring(t,r){const n=t._writableStreamController;t._state="erroring";t._storedError=r;const o=t._writer;if(o!==undefined){WritableStreamDefaultWriterEnsureReadyPromiseRejected(o,r)}if(!WritableStreamHasOperationMarkedInFlight(t)&&n._started){WritableStreamFinishErroring(t)}}function WritableStreamFinishErroring(t){t._state="errored";t._writableStreamController[m]();const r=t._storedError;t._writeRequests.forEach((t=>{t._reject(r)}));t._writeRequests=new SimpleQueue;if(t._pendingAbortRequest===undefined){WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return}const n=t._pendingAbortRequest;t._pendingAbortRequest=undefined;if(n._wasAlreadyErroring){n._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t);return}const o=t._writableStreamController[c](n._reason);uponPromise(o,(()=>{n._resolve();WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}),(r=>{n._reject(r);WritableStreamRejectCloseAndClosedPromiseIfNeeded(t)}))}function WritableStreamFinishInFlightWrite(t){t._inFlightWriteRequest._resolve(undefined);t._inFlightWriteRequest=undefined}function WritableStreamFinishInFlightWriteWithError(t,r){t._inFlightWriteRequest._reject(r);t._inFlightWriteRequest=undefined;WritableStreamDealWithRejection(t,r)}function WritableStreamFinishInFlightClose(t){t._inFlightCloseRequest._resolve(undefined);t._inFlightCloseRequest=undefined;const r=t._state;if(r==="erroring"){t._storedError=undefined;if(t._pendingAbortRequest!==undefined){t._pendingAbortRequest._resolve();t._pendingAbortRequest=undefined}}t._state="closed";const n=t._writer;if(n!==undefined){defaultWriterClosedPromiseResolve(n)}}function WritableStreamFinishInFlightCloseWithError(t,r){t._inFlightCloseRequest._reject(r);t._inFlightCloseRequest=undefined;if(t._pendingAbortRequest!==undefined){t._pendingAbortRequest._reject(r);t._pendingAbortRequest=undefined}WritableStreamDealWithRejection(t,r)}function WritableStreamCloseQueuedOrInFlight(t){if(t._closeRequest===undefined&&t._inFlightCloseRequest===undefined){return false}return true}function WritableStreamHasOperationMarkedInFlight(t){if(t._inFlightWriteRequest===undefined&&t._inFlightCloseRequest===undefined){return false}return true}function WritableStreamMarkCloseRequestInFlight(t){t._inFlightCloseRequest=t._closeRequest;t._closeRequest=undefined}function WritableStreamMarkFirstWriteRequestInFlight(t){t._inFlightWriteRequest=t._writeRequests.shift()}function WritableStreamRejectCloseAndClosedPromiseIfNeeded(t){if(t._closeRequest!==undefined){t._closeRequest._reject(t._storedError);t._closeRequest=undefined}const r=t._writer;if(r!==undefined){defaultWriterClosedPromiseReject(r,t._storedError)}}function WritableStreamUpdateBackpressure(t,r){const n=t._writer;if(n!==undefined&&r!==t._backpressure){if(r){defaultWriterReadyPromiseReset(n)}else{defaultWriterReadyPromiseResolve(n)}}t._backpressure=r}class WritableStreamDefaultWriter{constructor(t){assertRequiredArgument(t,1,"WritableStreamDefaultWriter");assertWritableStream(t,"First parameter");if(IsWritableStreamLocked(t)){throw new TypeError("This stream has already been locked for exclusive writing by another writer")}this._ownerWritableStream=t;t._writer=this;const r=t._state;if(r==="writable"){if(!WritableStreamCloseQueuedOrInFlight(t)&&t._backpressure){defaultWriterReadyPromiseInitialize(this)}else{defaultWriterReadyPromiseInitializeAsResolved(this)}defaultWriterClosedPromiseInitialize(this)}else if(r==="erroring"){defaultWriterReadyPromiseInitializeAsRejected(this,t._storedError);defaultWriterClosedPromiseInitialize(this)}else if(r==="closed"){defaultWriterReadyPromiseInitializeAsResolved(this);defaultWriterClosedPromiseInitializeAsResolved(this)}else{const r=t._storedError;defaultWriterReadyPromiseInitializeAsRejected(this,r);defaultWriterClosedPromiseInitializeAsRejected(this,r)}}get closed(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("closed"))}return this._closedPromise}get desiredSize(){if(!IsWritableStreamDefaultWriter(this)){throw defaultWriterBrandCheckException("desiredSize")}if(this._ownerWritableStream===undefined){throw defaultWriterLockException("desiredSize")}return WritableStreamDefaultWriterGetDesiredSize(this)}get ready(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("ready"))}return this._readyPromise}abort(t=undefined){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("abort"))}if(this._ownerWritableStream===undefined){return promiseRejectedWith(defaultWriterLockException("abort"))}return WritableStreamDefaultWriterAbort(this,t)}close(){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("close"))}const t=this._ownerWritableStream;if(t===undefined){return promiseRejectedWith(defaultWriterLockException("close"))}if(WritableStreamCloseQueuedOrInFlight(t)){return promiseRejectedWith(new TypeError("Cannot close an already-closing stream"))}return WritableStreamDefaultWriterClose(this)}releaseLock(){if(!IsWritableStreamDefaultWriter(this)){throw defaultWriterBrandCheckException("releaseLock")}const t=this._ownerWritableStream;if(t===undefined){return}WritableStreamDefaultWriterRelease(this)}write(t=undefined){if(!IsWritableStreamDefaultWriter(this)){return promiseRejectedWith(defaultWriterBrandCheckException("write"))}if(this._ownerWritableStream===undefined){return promiseRejectedWith(defaultWriterLockException("write to"))}return WritableStreamDefaultWriterWrite(this,t)}}Object.defineProperties(WritableStreamDefaultWriter.prototype,{abort:{enumerable:true},close:{enumerable:true},releaseLock:{enumerable:true},write:{enumerable:true},closed:{enumerable:true},desiredSize:{enumerable:true},ready:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStreamDefaultWriter.prototype,r.toStringTag,{value:"WritableStreamDefaultWriter",configurable:true})}function IsWritableStreamDefaultWriter(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_ownerWritableStream")){return false}return t instanceof WritableStreamDefaultWriter}function WritableStreamDefaultWriterAbort(t,r){const n=t._ownerWritableStream;return WritableStreamAbort(n,r)}function WritableStreamDefaultWriterClose(t){const r=t._ownerWritableStream;return WritableStreamClose(r)}function WritableStreamDefaultWriterCloseWithErrorPropagation(t){const r=t._ownerWritableStream;const n=r._state;if(WritableStreamCloseQueuedOrInFlight(r)||n==="closed"){return promiseResolvedWith(undefined)}if(n==="errored"){return promiseRejectedWith(r._storedError)}return WritableStreamDefaultWriterClose(t)}function WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,r){if(t._closedPromiseState==="pending"){defaultWriterClosedPromiseReject(t,r)}else{defaultWriterClosedPromiseResetToRejected(t,r)}}function WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,r){if(t._readyPromiseState==="pending"){defaultWriterReadyPromiseReject(t,r)}else{defaultWriterReadyPromiseResetToRejected(t,r)}}function WritableStreamDefaultWriterGetDesiredSize(t){const r=t._ownerWritableStream;const n=r._state;if(n==="errored"||n==="erroring"){return null}if(n==="closed"){return 0}return WritableStreamDefaultControllerGetDesiredSize(r._writableStreamController)}function WritableStreamDefaultWriterRelease(t){const r=t._ownerWritableStream;const n=new TypeError(`Writer was released and can no longer be used to monitor the stream's closedness`);WritableStreamDefaultWriterEnsureReadyPromiseRejected(t,n);WritableStreamDefaultWriterEnsureClosedPromiseRejected(t,n);r._writer=undefined;t._ownerWritableStream=undefined}function WritableStreamDefaultWriterWrite(t,r){const n=t._ownerWritableStream;const o=n._writableStreamController;const a=WritableStreamDefaultControllerGetChunkSize(o,r);if(n!==t._ownerWritableStream){return promiseRejectedWith(defaultWriterLockException("write to"))}const i=n._state;if(i==="errored"){return promiseRejectedWith(n._storedError)}if(WritableStreamCloseQueuedOrInFlight(n)||i==="closed"){return promiseRejectedWith(new TypeError("The stream is closing or closed and cannot be written to"))}if(i==="erroring"){return promiseRejectedWith(n._storedError)}const s=WritableStreamAddWriteRequest(n);WritableStreamDefaultControllerWrite(o,r,a);return s}const C={};class WritableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("abortReason")}return this._abortReason}get signal(){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("signal")}if(this._abortController===undefined){throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported")}return this._abortController.signal}error(t=undefined){if(!IsWritableStreamDefaultController(this)){throw defaultControllerBrandCheckException$2("error")}const r=this._controlledWritableStream._state;if(r!=="writable"){return}WritableStreamDefaultControllerError(this,t)}[c](t){const r=this._abortAlgorithm(t);WritableStreamDefaultControllerClearAlgorithms(this);return r}[m](){ResetQueue(this)}}Object.defineProperties(WritableStreamDefaultController.prototype,{abortReason:{enumerable:true},signal:{enumerable:true},error:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(WritableStreamDefaultController.prototype,r.toStringTag,{value:"WritableStreamDefaultController",configurable:true})}function IsWritableStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledWritableStream")){return false}return t instanceof WritableStreamDefaultController}function SetUpWritableStreamDefaultController(t,r,n,o,a,i,s,l){r._controlledWritableStream=t;t._writableStreamController=r;r._queue=undefined;r._queueTotalSize=undefined;ResetQueue(r);r._abortReason=undefined;r._abortController=createAbortController();r._started=false;r._strategySizeAlgorithm=l;r._strategyHWM=s;r._writeAlgorithm=o;r._closeAlgorithm=a;r._abortAlgorithm=i;const u=WritableStreamDefaultControllerGetBackpressure(r);WritableStreamUpdateBackpressure(t,u);const d=n();const c=promiseResolvedWith(d);uponPromise(c,(()=>{r._started=true;WritableStreamDefaultControllerAdvanceQueueIfNeeded(r)}),(n=>{r._started=true;WritableStreamDealWithRejection(t,n)}))}function SetUpWritableStreamDefaultControllerFromUnderlyingSink(t,r,n,o){const a=Object.create(WritableStreamDefaultController.prototype);let startAlgorithm=()=>undefined;let writeAlgorithm=()=>promiseResolvedWith(undefined);let closeAlgorithm=()=>promiseResolvedWith(undefined);let abortAlgorithm=()=>promiseResolvedWith(undefined);if(r.start!==undefined){startAlgorithm=()=>r.start(a)}if(r.write!==undefined){writeAlgorithm=t=>r.write(t,a)}if(r.close!==undefined){closeAlgorithm=()=>r.close()}if(r.abort!==undefined){abortAlgorithm=t=>r.abort(t)}SetUpWritableStreamDefaultController(t,a,startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,n,o)}function WritableStreamDefaultControllerClearAlgorithms(t){t._writeAlgorithm=undefined;t._closeAlgorithm=undefined;t._abortAlgorithm=undefined;t._strategySizeAlgorithm=undefined}function WritableStreamDefaultControllerClose(t){EnqueueValueWithSize(t,C,0);WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}function WritableStreamDefaultControllerGetChunkSize(t,r){try{return t._strategySizeAlgorithm(r)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return 1}}function WritableStreamDefaultControllerGetDesiredSize(t){return t._strategyHWM-t._queueTotalSize}function WritableStreamDefaultControllerWrite(t,r,n){try{EnqueueValueWithSize(t,r,n)}catch(r){WritableStreamDefaultControllerErrorIfNeeded(t,r);return}const o=t._controlledWritableStream;if(!WritableStreamCloseQueuedOrInFlight(o)&&o._state==="writable"){const r=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(o,r)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}function WritableStreamDefaultControllerAdvanceQueueIfNeeded(t){const r=t._controlledWritableStream;if(!t._started){return}if(r._inFlightWriteRequest!==undefined){return}const n=r._state;if(n==="erroring"){WritableStreamFinishErroring(r);return}if(t._queue.length===0){return}const o=PeekQueueValue(t);if(o===C){WritableStreamDefaultControllerProcessClose(t)}else{WritableStreamDefaultControllerProcessWrite(t,o)}}function WritableStreamDefaultControllerErrorIfNeeded(t,r){if(t._controlledWritableStream._state==="writable"){WritableStreamDefaultControllerError(t,r)}}function WritableStreamDefaultControllerProcessClose(t){const r=t._controlledWritableStream;WritableStreamMarkCloseRequestInFlight(r);DequeueValue(t);const n=t._closeAlgorithm();WritableStreamDefaultControllerClearAlgorithms(t);uponPromise(n,(()=>{WritableStreamFinishInFlightClose(r)}),(t=>{WritableStreamFinishInFlightCloseWithError(r,t)}))}function WritableStreamDefaultControllerProcessWrite(t,r){const n=t._controlledWritableStream;WritableStreamMarkFirstWriteRequestInFlight(n);const o=t._writeAlgorithm(r);uponPromise(o,(()=>{WritableStreamFinishInFlightWrite(n);const r=n._state;DequeueValue(t);if(!WritableStreamCloseQueuedOrInFlight(n)&&r==="writable"){const r=WritableStreamDefaultControllerGetBackpressure(t);WritableStreamUpdateBackpressure(n,r)}WritableStreamDefaultControllerAdvanceQueueIfNeeded(t)}),(r=>{if(n._state==="writable"){WritableStreamDefaultControllerClearAlgorithms(t)}WritableStreamFinishInFlightWriteWithError(n,r)}))}function WritableStreamDefaultControllerGetBackpressure(t){const r=WritableStreamDefaultControllerGetDesiredSize(t);return r<=0}function WritableStreamDefaultControllerError(t,r){const n=t._controlledWritableStream;WritableStreamDefaultControllerClearAlgorithms(t);WritableStreamStartErroring(n,r)}function streamBrandCheckException$2(t){return new TypeError(`WritableStream.prototype.${t} can only be used on a WritableStream`)}function defaultControllerBrandCheckException$2(t){return new TypeError(`WritableStreamDefaultController.prototype.${t} can only be used on a WritableStreamDefaultController`)}function defaultWriterBrandCheckException(t){return new TypeError(`WritableStreamDefaultWriter.prototype.${t} can only be used on a WritableStreamDefaultWriter`)}function defaultWriterLockException(t){return new TypeError("Cannot "+t+" a stream using a released writer")}function defaultWriterClosedPromiseInitialize(t){t._closedPromise=newPromise(((r,n)=>{t._closedPromise_resolve=r;t._closedPromise_reject=n;t._closedPromiseState="pending"}))}function defaultWriterClosedPromiseInitializeAsRejected(t,r){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseReject(t,r)}function defaultWriterClosedPromiseInitializeAsResolved(t){defaultWriterClosedPromiseInitialize(t);defaultWriterClosedPromiseResolve(t)}function defaultWriterClosedPromiseReject(t,r){if(t._closedPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._closedPromise);t._closedPromise_reject(r);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined;t._closedPromiseState="rejected"}function defaultWriterClosedPromiseResetToRejected(t,r){defaultWriterClosedPromiseInitializeAsRejected(t,r)}function defaultWriterClosedPromiseResolve(t){if(t._closedPromise_resolve===undefined){return}t._closedPromise_resolve(undefined);t._closedPromise_resolve=undefined;t._closedPromise_reject=undefined;t._closedPromiseState="resolved"}function defaultWriterReadyPromiseInitialize(t){t._readyPromise=newPromise(((r,n)=>{t._readyPromise_resolve=r;t._readyPromise_reject=n}));t._readyPromiseState="pending"}function defaultWriterReadyPromiseInitializeAsRejected(t,r){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseReject(t,r)}function defaultWriterReadyPromiseInitializeAsResolved(t){defaultWriterReadyPromiseInitialize(t);defaultWriterReadyPromiseResolve(t)}function defaultWriterReadyPromiseReject(t,r){if(t._readyPromise_reject===undefined){return}setPromiseIsHandledToTrue(t._readyPromise);t._readyPromise_reject(r);t._readyPromise_resolve=undefined;t._readyPromise_reject=undefined;t._readyPromiseState="rejected"}function defaultWriterReadyPromiseReset(t){defaultWriterReadyPromiseInitialize(t)}function defaultWriterReadyPromiseResetToRejected(t,r){defaultWriterReadyPromiseInitializeAsRejected(t,r)}function defaultWriterReadyPromiseResolve(t){if(t._readyPromise_resolve===undefined){return}t._readyPromise_resolve(undefined);t._readyPromise_resolve=undefined;t._readyPromise_reject=undefined;t._readyPromiseState="fulfilled"}const w=typeof DOMException!=="undefined"?DOMException:undefined;function isDOMExceptionConstructor(t){if(!(typeof t==="function"||typeof t==="object")){return false}try{new t;return true}catch(t){return false}}function createDOMExceptionPolyfill(){const t=function DOMException(t,r){this.message=t||"";this.name=r||"Error";if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}};t.prototype=Object.create(Error.prototype);Object.defineProperty(t.prototype,"constructor",{value:t,writable:true,configurable:true});return t}const v=isDOMExceptionConstructor(w)?w:createDOMExceptionPolyfill();function ReadableStreamPipeTo(t,r,n,o,a,i){const s=AcquireReadableStreamDefaultReader(t);const l=AcquireWritableStreamDefaultWriter(r);t._disturbed=true;let u=false;let d=promiseResolvedWith(undefined);return newPromise(((c,m)=>{let h;if(i!==undefined){h=()=>{const n=new v("Aborted","AbortError");const i=[];if(!o){i.push((()=>{if(r._state==="writable"){return WritableStreamAbort(r,n)}return promiseResolvedWith(undefined)}))}if(!a){i.push((()=>{if(t._state==="readable"){return ReadableStreamCancel(t,n)}return promiseResolvedWith(undefined)}))}shutdownWithAction((()=>Promise.all(i.map((t=>t())))),true,n)};if(i.aborted){h();return}i.addEventListener("abort",h)}function pipeLoop(){return newPromise(((t,r)=>{function next(n){if(n){t()}else{PerformPromiseThen(pipeStep(),next,r)}}next(false)}))}function pipeStep(){if(u){return promiseResolvedWith(true)}return PerformPromiseThen(l._readyPromise,(()=>newPromise(((t,r)=>{ReadableStreamDefaultReaderRead(s,{_chunkSteps:r=>{d=PerformPromiseThen(WritableStreamDefaultWriterWrite(l,r),undefined,noop);t(false)},_closeSteps:()=>t(true),_errorSteps:r})}))))}isOrBecomesErrored(t,s._closedPromise,(t=>{if(!o){shutdownWithAction((()=>WritableStreamAbort(r,t)),true,t)}else{shutdown(true,t)}}));isOrBecomesErrored(r,l._closedPromise,(r=>{if(!a){shutdownWithAction((()=>ReadableStreamCancel(t,r)),true,r)}else{shutdown(true,r)}}));isOrBecomesClosed(t,s._closedPromise,(()=>{if(!n){shutdownWithAction((()=>WritableStreamDefaultWriterCloseWithErrorPropagation(l)))}else{shutdown()}}));if(WritableStreamCloseQueuedOrInFlight(r)||r._state==="closed"){const r=new TypeError("the destination writable stream closed before all data could be piped to it");if(!a){shutdownWithAction((()=>ReadableStreamCancel(t,r)),true,r)}else{shutdown(true,r)}}setPromiseIsHandledToTrue(pipeLoop());function waitForWritesToFinish(){const t=d;return PerformPromiseThen(d,(()=>t!==d?waitForWritesToFinish():undefined))}function isOrBecomesErrored(t,r,n){if(t._state==="errored"){n(t._storedError)}else{uponRejection(r,n)}}function isOrBecomesClosed(t,r,n){if(t._state==="closed"){n()}else{uponFulfillment(r,n)}}function shutdownWithAction(t,n,o){if(u){return}u=true;if(r._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(r)){uponFulfillment(waitForWritesToFinish(),doTheRest)}else{doTheRest()}function doTheRest(){uponPromise(t(),(()=>finalize(n,o)),(t=>finalize(true,t)))}}function shutdown(t,n){if(u){return}u=true;if(r._state==="writable"&&!WritableStreamCloseQueuedOrInFlight(r)){uponFulfillment(waitForWritesToFinish(),(()=>finalize(t,n)))}else{finalize(t,n)}}function finalize(t,r){WritableStreamDefaultWriterRelease(l);ReadableStreamReaderGenericRelease(s);if(i!==undefined){i.removeEventListener("abort",h)}if(t){m(r)}else{c(undefined)}}}))}class ReadableStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("desiredSize")}return ReadableStreamDefaultControllerGetDesiredSize(this)}close(){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("close")}if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)){throw new TypeError("The stream is not in a state that permits close")}ReadableStreamDefaultControllerClose(this)}enqueue(t=undefined){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("enqueue")}if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(this)){throw new TypeError("The stream is not in a state that permits enqueue")}return ReadableStreamDefaultControllerEnqueue(this,t)}error(t=undefined){if(!IsReadableStreamDefaultController(this)){throw defaultControllerBrandCheckException$1("error")}ReadableStreamDefaultControllerError(this,t)}[h](t){ResetQueue(this);const r=this._cancelAlgorithm(t);ReadableStreamDefaultControllerClearAlgorithms(this);return r}[p](t){const r=this._controlledReadableStream;if(this._queue.length>0){const n=DequeueValue(this);if(this._closeRequested&&this._queue.length===0){ReadableStreamDefaultControllerClearAlgorithms(this);ReadableStreamClose(r)}else{ReadableStreamDefaultControllerCallPullIfNeeded(this)}t._chunkSteps(n)}else{ReadableStreamAddReadRequest(r,t);ReadableStreamDefaultControllerCallPullIfNeeded(this)}}}Object.defineProperties(ReadableStreamDefaultController.prototype,{close:{enumerable:true},enqueue:{enumerable:true},error:{enumerable:true},desiredSize:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStreamDefaultController.prototype,r.toStringTag,{value:"ReadableStreamDefaultController",configurable:true})}function IsReadableStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledReadableStream")){return false}return t instanceof ReadableStreamDefaultController}function ReadableStreamDefaultControllerCallPullIfNeeded(t){const r=ReadableStreamDefaultControllerShouldCallPull(t);if(!r){return}if(t._pulling){t._pullAgain=true;return}t._pulling=true;const n=t._pullAlgorithm();uponPromise(n,(()=>{t._pulling=false;if(t._pullAgain){t._pullAgain=false;ReadableStreamDefaultControllerCallPullIfNeeded(t)}}),(r=>{ReadableStreamDefaultControllerError(t,r)}))}function ReadableStreamDefaultControllerShouldCallPull(t){const r=t._controlledReadableStream;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return false}if(!t._started){return false}if(IsReadableStreamLocked(r)&&ReadableStreamGetNumReadRequests(r)>0){return true}const n=ReadableStreamDefaultControllerGetDesiredSize(t);if(n>0){return true}return false}function ReadableStreamDefaultControllerClearAlgorithms(t){t._pullAlgorithm=undefined;t._cancelAlgorithm=undefined;t._strategySizeAlgorithm=undefined}function ReadableStreamDefaultControllerClose(t){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return}const r=t._controlledReadableStream;t._closeRequested=true;if(t._queue.length===0){ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamClose(r)}}function ReadableStreamDefaultControllerEnqueue(t,r){if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(t)){return}const n=t._controlledReadableStream;if(IsReadableStreamLocked(n)&&ReadableStreamGetNumReadRequests(n)>0){ReadableStreamFulfillReadRequest(n,r,false)}else{let n;try{n=t._strategySizeAlgorithm(r)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}try{EnqueueValueWithSize(t,r,n)}catch(r){ReadableStreamDefaultControllerError(t,r);throw r}}ReadableStreamDefaultControllerCallPullIfNeeded(t)}function ReadableStreamDefaultControllerError(t,r){const n=t._controlledReadableStream;if(n._state!=="readable"){return}ResetQueue(t);ReadableStreamDefaultControllerClearAlgorithms(t);ReadableStreamError(n,r)}function ReadableStreamDefaultControllerGetDesiredSize(t){const r=t._controlledReadableStream._state;if(r==="errored"){return null}if(r==="closed"){return 0}return t._strategyHWM-t._queueTotalSize}function ReadableStreamDefaultControllerHasBackpressure(t){if(ReadableStreamDefaultControllerShouldCallPull(t)){return false}return true}function ReadableStreamDefaultControllerCanCloseOrEnqueue(t){const r=t._controlledReadableStream._state;if(!t._closeRequested&&r==="readable"){return true}return false}function SetUpReadableStreamDefaultController(t,r,n,o,a,i,s){r._controlledReadableStream=t;r._queue=undefined;r._queueTotalSize=undefined;ResetQueue(r);r._started=false;r._closeRequested=false;r._pullAgain=false;r._pulling=false;r._strategySizeAlgorithm=s;r._strategyHWM=i;r._pullAlgorithm=o;r._cancelAlgorithm=a;t._readableStreamController=r;const l=n();uponPromise(promiseResolvedWith(l),(()=>{r._started=true;ReadableStreamDefaultControllerCallPullIfNeeded(r)}),(t=>{ReadableStreamDefaultControllerError(r,t)}))}function SetUpReadableStreamDefaultControllerFromUnderlyingSource(t,r,n,o){const a=Object.create(ReadableStreamDefaultController.prototype);let startAlgorithm=()=>undefined;let pullAlgorithm=()=>promiseResolvedWith(undefined);let cancelAlgorithm=()=>promiseResolvedWith(undefined);if(r.start!==undefined){startAlgorithm=()=>r.start(a)}if(r.pull!==undefined){pullAlgorithm=()=>r.pull(a)}if(r.cancel!==undefined){cancelAlgorithm=t=>r.cancel(t)}SetUpReadableStreamDefaultController(t,a,startAlgorithm,pullAlgorithm,cancelAlgorithm,n,o)}function defaultControllerBrandCheckException$1(t){return new TypeError(`ReadableStreamDefaultController.prototype.${t} can only be used on a ReadableStreamDefaultController`)}function ReadableStreamTee(t,r){if(IsReadableByteStreamController(t._readableStreamController)){return ReadableByteStreamTee(t)}return ReadableStreamDefaultTee(t)}function ReadableStreamDefaultTee(t,r){const n=AcquireReadableStreamDefaultReader(t);let o=false;let a=false;let i=false;let s=false;let l;let d;let c;let m;let h;const p=newPromise((t=>{h=t}));function pullAlgorithm(){if(o){a=true;return promiseResolvedWith(undefined)}o=true;const t={_chunkSteps:t=>{u((()=>{a=false;const r=t;const n=t;if(!i){ReadableStreamDefaultControllerEnqueue(c._readableStreamController,r)}if(!s){ReadableStreamDefaultControllerEnqueue(m._readableStreamController,n)}o=false;if(a){pullAlgorithm()}}))},_closeSteps:()=>{o=false;if(!i){ReadableStreamDefaultControllerClose(c._readableStreamController)}if(!s){ReadableStreamDefaultControllerClose(m._readableStreamController)}if(!i||!s){h(undefined)}},_errorSteps:()=>{o=false}};ReadableStreamDefaultReaderRead(n,t);return promiseResolvedWith(undefined)}function cancel1Algorithm(r){i=true;l=r;if(s){const r=CreateArrayFromList([l,d]);const n=ReadableStreamCancel(t,r);h(n)}return p}function cancel2Algorithm(r){s=true;d=r;if(i){const r=CreateArrayFromList([l,d]);const n=ReadableStreamCancel(t,r);h(n)}return p}function startAlgorithm(){}c=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel1Algorithm);m=CreateReadableStream(startAlgorithm,pullAlgorithm,cancel2Algorithm);uponRejection(n._closedPromise,(t=>{ReadableStreamDefaultControllerError(c._readableStreamController,t);ReadableStreamDefaultControllerError(m._readableStreamController,t);if(!i||!s){h(undefined)}}));return[c,m]}function ReadableByteStreamTee(t){let r=AcquireReadableStreamDefaultReader(t);let n=false;let o=false;let a=false;let i=false;let s=false;let l;let d;let c;let m;let h;const p=newPromise((t=>{h=t}));function forwardReaderError(t){uponRejection(t._closedPromise,(n=>{if(t!==r){return}ReadableByteStreamControllerError(c._readableStreamController,n);ReadableByteStreamControllerError(m._readableStreamController,n);if(!i||!s){h(undefined)}}))}function pullWithDefaultReader(){if(IsReadableStreamBYOBReader(r)){ReadableStreamReaderGenericRelease(r);r=AcquireReadableStreamDefaultReader(t);forwardReaderError(r)}const l={_chunkSteps:r=>{u((()=>{o=false;a=false;const l=r;let u=r;if(!i&&!s){try{u=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(c._readableStreamController,r);ReadableByteStreamControllerError(m._readableStreamController,r);h(ReadableStreamCancel(t,r));return}}if(!i){ReadableByteStreamControllerEnqueue(c._readableStreamController,l)}if(!s){ReadableByteStreamControllerEnqueue(m._readableStreamController,u)}n=false;if(o){pull1Algorithm()}else if(a){pull2Algorithm()}}))},_closeSteps:()=>{n=false;if(!i){ReadableByteStreamControllerClose(c._readableStreamController)}if(!s){ReadableByteStreamControllerClose(m._readableStreamController)}if(c._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(c._readableStreamController,0)}if(m._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(m._readableStreamController,0)}if(!i||!s){h(undefined)}},_errorSteps:()=>{n=false}};ReadableStreamDefaultReaderRead(r,l)}function pullWithBYOBReader(l,d){if(IsReadableStreamDefaultReader(r)){ReadableStreamReaderGenericRelease(r);r=AcquireReadableStreamBYOBReader(t);forwardReaderError(r)}const p=d?m:c;const b=d?c:m;const y={_chunkSteps:r=>{u((()=>{o=false;a=false;const l=d?s:i;const u=d?i:s;if(!u){let n;try{n=CloneAsUint8Array(r)}catch(r){ReadableByteStreamControllerError(p._readableStreamController,r);ReadableByteStreamControllerError(b._readableStreamController,r);h(ReadableStreamCancel(t,r));return}if(!l){ReadableByteStreamControllerRespondWithNewView(p._readableStreamController,r)}ReadableByteStreamControllerEnqueue(b._readableStreamController,n)}else if(!l){ReadableByteStreamControllerRespondWithNewView(p._readableStreamController,r)}n=false;if(o){pull1Algorithm()}else if(a){pull2Algorithm()}}))},_closeSteps:t=>{n=false;const r=d?s:i;const o=d?i:s;if(!r){ReadableByteStreamControllerClose(p._readableStreamController)}if(!o){ReadableByteStreamControllerClose(b._readableStreamController)}if(t!==undefined){if(!r){ReadableByteStreamControllerRespondWithNewView(p._readableStreamController,t)}if(!o&&b._readableStreamController._pendingPullIntos.length>0){ReadableByteStreamControllerRespond(b._readableStreamController,0)}}if(!r||!o){h(undefined)}},_errorSteps:()=>{n=false}};ReadableStreamBYOBReaderRead(r,l,y)}function pull1Algorithm(){if(n){o=true;return promiseResolvedWith(undefined)}n=true;const t=ReadableByteStreamControllerGetBYOBRequest(c._readableStreamController);if(t===null){pullWithDefaultReader()}else{pullWithBYOBReader(t._view,false)}return promiseResolvedWith(undefined)}function pull2Algorithm(){if(n){a=true;return promiseResolvedWith(undefined)}n=true;const t=ReadableByteStreamControllerGetBYOBRequest(m._readableStreamController);if(t===null){pullWithDefaultReader()}else{pullWithBYOBReader(t._view,true)}return promiseResolvedWith(undefined)}function cancel1Algorithm(r){i=true;l=r;if(s){const r=CreateArrayFromList([l,d]);const n=ReadableStreamCancel(t,r);h(n)}return p}function cancel2Algorithm(r){s=true;d=r;if(i){const r=CreateArrayFromList([l,d]);const n=ReadableStreamCancel(t,r);h(n)}return p}function startAlgorithm(){return}c=CreateReadableByteStream(startAlgorithm,pull1Algorithm,cancel1Algorithm);m=CreateReadableByteStream(startAlgorithm,pull2Algorithm,cancel2Algorithm);forwardReaderError(r);return[c,m]}function convertUnderlyingDefaultOrByteSource(t,r){assertDictionary(t,r);const n=t;const o=n===null||n===void 0?void 0:n.autoAllocateChunkSize;const a=n===null||n===void 0?void 0:n.cancel;const i=n===null||n===void 0?void 0:n.pull;const s=n===null||n===void 0?void 0:n.start;const l=n===null||n===void 0?void 0:n.type;return{autoAllocateChunkSize:o===undefined?undefined:convertUnsignedLongLongWithEnforceRange(o,`${r} has member 'autoAllocateChunkSize' that`),cancel:a===undefined?undefined:convertUnderlyingSourceCancelCallback(a,n,`${r} has member 'cancel' that`),pull:i===undefined?undefined:convertUnderlyingSourcePullCallback(i,n,`${r} has member 'pull' that`),start:s===undefined?undefined:convertUnderlyingSourceStartCallback(s,n,`${r} has member 'start' that`),type:l===undefined?undefined:convertReadableStreamType(l,`${r} has member 'type' that`)}}function convertUnderlyingSourceCancelCallback(t,r,n){assertFunction(t,n);return n=>promiseCall(t,r,[n])}function convertUnderlyingSourcePullCallback(t,r,n){assertFunction(t,n);return n=>promiseCall(t,r,[n])}function convertUnderlyingSourceStartCallback(t,r,n){assertFunction(t,n);return n=>reflectCall(t,r,[n])}function convertReadableStreamType(t,r){t=`${t}`;if(t!=="bytes"){throw new TypeError(`${r} '${t}' is not a valid enumeration value for ReadableStreamType`)}return t}function convertReaderOptions(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.mode;return{mode:n===undefined?undefined:convertReadableStreamReaderMode(n,`${r} has member 'mode' that`)}}function convertReadableStreamReaderMode(t,r){t=`${t}`;if(t!=="byob"){throw new TypeError(`${r} '${t}' is not a valid enumeration value for ReadableStreamReaderMode`)}return t}function convertIteratorOptions(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.preventCancel;return{preventCancel:Boolean(n)}}function convertPipeOptions(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.preventAbort;const o=t===null||t===void 0?void 0:t.preventCancel;const a=t===null||t===void 0?void 0:t.preventClose;const i=t===null||t===void 0?void 0:t.signal;if(i!==undefined){assertAbortSignal(i,`${r} has member 'signal' that`)}return{preventAbort:Boolean(n),preventCancel:Boolean(o),preventClose:Boolean(a),signal:i}}function assertAbortSignal(t,r){if(!isAbortSignal(t)){throw new TypeError(`${r} is not an AbortSignal.`)}}function convertReadableWritablePair(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.readable;assertRequiredField(n,"readable","ReadableWritablePair");assertReadableStream(n,`${r} has member 'readable' that`);const o=t===null||t===void 0?void 0:t.writable;assertRequiredField(o,"writable","ReadableWritablePair");assertWritableStream(o,`${r} has member 'writable' that`);return{readable:n,writable:o}}class ReadableStream{constructor(t={},r={}){if(t===undefined){t=null}else{assertObject(t,"First parameter")}const n=convertQueuingStrategy(r,"Second parameter");const o=convertUnderlyingDefaultOrByteSource(t,"First parameter");InitializeReadableStream(this);if(o.type==="bytes"){if(n.size!==undefined){throw new RangeError("The strategy for a byte stream cannot have a size function")}const t=ExtractHighWaterMark(n,0);SetUpReadableByteStreamControllerFromUnderlyingSource(this,o,t)}else{const t=ExtractSizeAlgorithm(n);const r=ExtractHighWaterMark(n,1);SetUpReadableStreamDefaultControllerFromUnderlyingSource(this,o,r,t)}}get locked(){if(!IsReadableStream(this)){throw streamBrandCheckException$1("locked")}return IsReadableStreamLocked(this)}cancel(t=undefined){if(!IsReadableStream(this)){return promiseRejectedWith(streamBrandCheckException$1("cancel"))}if(IsReadableStreamLocked(this)){return promiseRejectedWith(new TypeError("Cannot cancel a stream that already has a reader"))}return ReadableStreamCancel(this,t)}getReader(t=undefined){if(!IsReadableStream(this)){throw streamBrandCheckException$1("getReader")}const r=convertReaderOptions(t,"First parameter");if(r.mode===undefined){return AcquireReadableStreamDefaultReader(this)}return AcquireReadableStreamBYOBReader(this)}pipeThrough(t,r={}){if(!IsReadableStream(this)){throw streamBrandCheckException$1("pipeThrough")}assertRequiredArgument(t,1,"pipeThrough");const n=convertReadableWritablePair(t,"First parameter");const o=convertPipeOptions(r,"Second parameter");if(IsReadableStreamLocked(this)){throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream")}if(IsWritableStreamLocked(n.writable)){throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream")}const a=ReadableStreamPipeTo(this,n.writable,o.preventClose,o.preventAbort,o.preventCancel,o.signal);setPromiseIsHandledToTrue(a);return n.readable}pipeTo(t,r={}){if(!IsReadableStream(this)){return promiseRejectedWith(streamBrandCheckException$1("pipeTo"))}if(t===undefined){return promiseRejectedWith(`Parameter 1 is required in 'pipeTo'.`)}if(!IsWritableStream(t)){return promiseRejectedWith(new TypeError(`ReadableStream.prototype.pipeTo's first argument must be a WritableStream`))}let n;try{n=convertPipeOptions(r,"Second parameter")}catch(t){return promiseRejectedWith(t)}if(IsReadableStreamLocked(this)){return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"))}if(IsWritableStreamLocked(t)){return promiseRejectedWith(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"))}return ReadableStreamPipeTo(this,t,n.preventClose,n.preventAbort,n.preventCancel,n.signal)}tee(){if(!IsReadableStream(this)){throw streamBrandCheckException$1("tee")}const t=ReadableStreamTee(this);return CreateArrayFromList(t)}values(t=undefined){if(!IsReadableStream(this)){throw streamBrandCheckException$1("values")}const r=convertIteratorOptions(t,"First parameter");return AcquireReadableStreamAsyncIterator(this,r.preventCancel)}}Object.defineProperties(ReadableStream.prototype,{cancel:{enumerable:true},getReader:{enumerable:true},pipeThrough:{enumerable:true},pipeTo:{enumerable:true},tee:{enumerable:true},values:{enumerable:true},locked:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ReadableStream.prototype,r.toStringTag,{value:"ReadableStream",configurable:true})}if(typeof r.asyncIterator==="symbol"){Object.defineProperty(ReadableStream.prototype,r.asyncIterator,{value:ReadableStream.prototype.values,writable:true,configurable:true})}function CreateReadableStream(t,r,n,o=1,a=(()=>1)){const i=Object.create(ReadableStream.prototype);InitializeReadableStream(i);const s=Object.create(ReadableStreamDefaultController.prototype);SetUpReadableStreamDefaultController(i,s,t,r,n,o,a);return i}function CreateReadableByteStream(t,r,n){const o=Object.create(ReadableStream.prototype);InitializeReadableStream(o);const a=Object.create(ReadableByteStreamController.prototype);SetUpReadableByteStreamController(o,a,t,r,n,0,undefined);return o}function InitializeReadableStream(t){t._state="readable";t._reader=undefined;t._storedError=undefined;t._disturbed=false}function IsReadableStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_readableStreamController")){return false}return t instanceof ReadableStream}function IsReadableStreamLocked(t){if(t._reader===undefined){return false}return true}function ReadableStreamCancel(t,r){t._disturbed=true;if(t._state==="closed"){return promiseResolvedWith(undefined)}if(t._state==="errored"){return promiseRejectedWith(t._storedError)}ReadableStreamClose(t);const n=t._reader;if(n!==undefined&&IsReadableStreamBYOBReader(n)){n._readIntoRequests.forEach((t=>{t._closeSteps(undefined)}));n._readIntoRequests=new SimpleQueue}const o=t._readableStreamController[h](r);return transformPromiseWith(o,noop)}function ReadableStreamClose(t){t._state="closed";const r=t._reader;if(r===undefined){return}defaultReaderClosedPromiseResolve(r);if(IsReadableStreamDefaultReader(r)){r._readRequests.forEach((t=>{t._closeSteps()}));r._readRequests=new SimpleQueue}}function ReadableStreamError(t,r){t._state="errored";t._storedError=r;const n=t._reader;if(n===undefined){return}defaultReaderClosedPromiseReject(n,r);if(IsReadableStreamDefaultReader(n)){n._readRequests.forEach((t=>{t._errorSteps(r)}));n._readRequests=new SimpleQueue}else{n._readIntoRequests.forEach((t=>{t._errorSteps(r)}));n._readIntoRequests=new SimpleQueue}}function streamBrandCheckException$1(t){return new TypeError(`ReadableStream.prototype.${t} can only be used on a ReadableStream`)}function convertQueuingStrategyInit(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.highWaterMark;assertRequiredField(n,"highWaterMark","QueuingStrategyInit");return{highWaterMark:convertUnrestrictedDouble(n)}}const byteLengthSizeFunction=t=>t.byteLength;try{Object.defineProperty(byteLengthSizeFunction,"name",{value:"size",configurable:true})}catch(t){}class ByteLengthQueuingStrategy{constructor(t){assertRequiredArgument(t,1,"ByteLengthQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!IsByteLengthQueuingStrategy(this)){throw byteLengthBrandCheckException("highWaterMark")}return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!IsByteLengthQueuingStrategy(this)){throw byteLengthBrandCheckException("size")}return byteLengthSizeFunction}}Object.defineProperties(ByteLengthQueuingStrategy.prototype,{highWaterMark:{enumerable:true},size:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(ByteLengthQueuingStrategy.prototype,r.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:true})}function byteLengthBrandCheckException(t){return new TypeError(`ByteLengthQueuingStrategy.prototype.${t} can only be used on a ByteLengthQueuingStrategy`)}function IsByteLengthQueuingStrategy(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_byteLengthQueuingStrategyHighWaterMark")){return false}return t instanceof ByteLengthQueuingStrategy}const countSizeFunction=()=>1;try{Object.defineProperty(countSizeFunction,"name",{value:"size",configurable:true})}catch(t){}class CountQueuingStrategy{constructor(t){assertRequiredArgument(t,1,"CountQueuingStrategy");t=convertQueuingStrategyInit(t,"First parameter");this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!IsCountQueuingStrategy(this)){throw countBrandCheckException("highWaterMark")}return this._countQueuingStrategyHighWaterMark}get size(){if(!IsCountQueuingStrategy(this)){throw countBrandCheckException("size")}return countSizeFunction}}Object.defineProperties(CountQueuingStrategy.prototype,{highWaterMark:{enumerable:true},size:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(CountQueuingStrategy.prototype,r.toStringTag,{value:"CountQueuingStrategy",configurable:true})}function countBrandCheckException(t){return new TypeError(`CountQueuingStrategy.prototype.${t} can only be used on a CountQueuingStrategy`)}function IsCountQueuingStrategy(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_countQueuingStrategyHighWaterMark")){return false}return t instanceof CountQueuingStrategy}function convertTransformer(t,r){assertDictionary(t,r);const n=t===null||t===void 0?void 0:t.flush;const o=t===null||t===void 0?void 0:t.readableType;const a=t===null||t===void 0?void 0:t.start;const i=t===null||t===void 0?void 0:t.transform;const s=t===null||t===void 0?void 0:t.writableType;return{flush:n===undefined?undefined:convertTransformerFlushCallback(n,t,`${r} has member 'flush' that`),readableType:o,start:a===undefined?undefined:convertTransformerStartCallback(a,t,`${r} has member 'start' that`),transform:i===undefined?undefined:convertTransformerTransformCallback(i,t,`${r} has member 'transform' that`),writableType:s}}function convertTransformerFlushCallback(t,r,n){assertFunction(t,n);return n=>promiseCall(t,r,[n])}function convertTransformerStartCallback(t,r,n){assertFunction(t,n);return n=>reflectCall(t,r,[n])}function convertTransformerTransformCallback(t,r,n){assertFunction(t,n);return(n,o)=>promiseCall(t,r,[n,o])}class TransformStream{constructor(t={},r={},n={}){if(t===undefined){t=null}const o=convertQueuingStrategy(r,"Second parameter");const a=convertQueuingStrategy(n,"Third parameter");const i=convertTransformer(t,"First parameter");if(i.readableType!==undefined){throw new RangeError("Invalid readableType specified")}if(i.writableType!==undefined){throw new RangeError("Invalid writableType specified")}const s=ExtractHighWaterMark(a,0);const l=ExtractSizeAlgorithm(a);const u=ExtractHighWaterMark(o,1);const d=ExtractSizeAlgorithm(o);let c;const m=newPromise((t=>{c=t}));InitializeTransformStream(this,m,u,d,s,l);SetUpTransformStreamDefaultControllerFromTransformer(this,i);if(i.start!==undefined){c(i.start(this._transformStreamController))}else{c(undefined)}}get readable(){if(!IsTransformStream(this)){throw streamBrandCheckException("readable")}return this._readable}get writable(){if(!IsTransformStream(this)){throw streamBrandCheckException("writable")}return this._writable}}Object.defineProperties(TransformStream.prototype,{readable:{enumerable:true},writable:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(TransformStream.prototype,r.toStringTag,{value:"TransformStream",configurable:true})}function InitializeTransformStream(t,r,n,o,a,i){function startAlgorithm(){return r}function writeAlgorithm(r){return TransformStreamDefaultSinkWriteAlgorithm(t,r)}function abortAlgorithm(r){return TransformStreamDefaultSinkAbortAlgorithm(t,r)}function closeAlgorithm(){return TransformStreamDefaultSinkCloseAlgorithm(t)}t._writable=CreateWritableStream(startAlgorithm,writeAlgorithm,closeAlgorithm,abortAlgorithm,n,o);function pullAlgorithm(){return TransformStreamDefaultSourcePullAlgorithm(t)}function cancelAlgorithm(r){TransformStreamErrorWritableAndUnblockWrite(t,r);return promiseResolvedWith(undefined)}t._readable=CreateReadableStream(startAlgorithm,pullAlgorithm,cancelAlgorithm,a,i);t._backpressure=undefined;t._backpressureChangePromise=undefined;t._backpressureChangePromise_resolve=undefined;TransformStreamSetBackpressure(t,true);t._transformStreamController=undefined}function IsTransformStream(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_transformStreamController")){return false}return t instanceof TransformStream}function TransformStreamError(t,r){ReadableStreamDefaultControllerError(t._readable._readableStreamController,r);TransformStreamErrorWritableAndUnblockWrite(t,r)}function TransformStreamErrorWritableAndUnblockWrite(t,r){TransformStreamDefaultControllerClearAlgorithms(t._transformStreamController);WritableStreamDefaultControllerErrorIfNeeded(t._writable._writableStreamController,r);if(t._backpressure){TransformStreamSetBackpressure(t,false)}}function TransformStreamSetBackpressure(t,r){if(t._backpressureChangePromise!==undefined){t._backpressureChangePromise_resolve()}t._backpressureChangePromise=newPromise((r=>{t._backpressureChangePromise_resolve=r}));t._backpressure=r}class TransformStreamDefaultController{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("desiredSize")}const t=this._controlledTransformStream._readable._readableStreamController;return ReadableStreamDefaultControllerGetDesiredSize(t)}enqueue(t=undefined){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("enqueue")}TransformStreamDefaultControllerEnqueue(this,t)}error(t=undefined){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("error")}TransformStreamDefaultControllerError(this,t)}terminate(){if(!IsTransformStreamDefaultController(this)){throw defaultControllerBrandCheckException("terminate")}TransformStreamDefaultControllerTerminate(this)}}Object.defineProperties(TransformStreamDefaultController.prototype,{enqueue:{enumerable:true},error:{enumerable:true},terminate:{enumerable:true},desiredSize:{enumerable:true}});if(typeof r.toStringTag==="symbol"){Object.defineProperty(TransformStreamDefaultController.prototype,r.toStringTag,{value:"TransformStreamDefaultController",configurable:true})}function IsTransformStreamDefaultController(t){if(!typeIsObject(t)){return false}if(!Object.prototype.hasOwnProperty.call(t,"_controlledTransformStream")){return false}return t instanceof TransformStreamDefaultController}function SetUpTransformStreamDefaultController(t,r,n,o){r._controlledTransformStream=t;t._transformStreamController=r;r._transformAlgorithm=n;r._flushAlgorithm=o}function SetUpTransformStreamDefaultControllerFromTransformer(t,r){const n=Object.create(TransformStreamDefaultController.prototype);let transformAlgorithm=t=>{try{TransformStreamDefaultControllerEnqueue(n,t);return promiseResolvedWith(undefined)}catch(t){return promiseRejectedWith(t)}};let flushAlgorithm=()=>promiseResolvedWith(undefined);if(r.transform!==undefined){transformAlgorithm=t=>r.transform(t,n)}if(r.flush!==undefined){flushAlgorithm=()=>r.flush(n)}SetUpTransformStreamDefaultController(t,n,transformAlgorithm,flushAlgorithm)}function TransformStreamDefaultControllerClearAlgorithms(t){t._transformAlgorithm=undefined;t._flushAlgorithm=undefined}function TransformStreamDefaultControllerEnqueue(t,r){const n=t._controlledTransformStream;const o=n._readable._readableStreamController;if(!ReadableStreamDefaultControllerCanCloseOrEnqueue(o)){throw new TypeError("Readable side is not in a state that permits enqueue")}try{ReadableStreamDefaultControllerEnqueue(o,r)}catch(t){TransformStreamErrorWritableAndUnblockWrite(n,t);throw n._readable._storedError}const a=ReadableStreamDefaultControllerHasBackpressure(o);if(a!==n._backpressure){TransformStreamSetBackpressure(n,true)}}function TransformStreamDefaultControllerError(t,r){TransformStreamError(t._controlledTransformStream,r)}function TransformStreamDefaultControllerPerformTransform(t,r){const n=t._transformAlgorithm(r);return transformPromiseWith(n,undefined,(r=>{TransformStreamError(t._controlledTransformStream,r);throw r}))}function TransformStreamDefaultControllerTerminate(t){const r=t._controlledTransformStream;const n=r._readable._readableStreamController;ReadableStreamDefaultControllerClose(n);const o=new TypeError("TransformStream terminated");TransformStreamErrorWritableAndUnblockWrite(r,o)}function TransformStreamDefaultSinkWriteAlgorithm(t,r){const n=t._transformStreamController;if(t._backpressure){const o=t._backpressureChangePromise;return transformPromiseWith(o,(()=>{const o=t._writable;const a=o._state;if(a==="erroring"){throw o._storedError}return TransformStreamDefaultControllerPerformTransform(n,r)}))}return TransformStreamDefaultControllerPerformTransform(n,r)}function TransformStreamDefaultSinkAbortAlgorithm(t,r){TransformStreamError(t,r);return promiseResolvedWith(undefined)}function TransformStreamDefaultSinkCloseAlgorithm(t){const r=t._readable;const n=t._transformStreamController;const o=n._flushAlgorithm();TransformStreamDefaultControllerClearAlgorithms(n);return transformPromiseWith(o,(()=>{if(r._state==="errored"){throw r._storedError}ReadableStreamDefaultControllerClose(r._readableStreamController)}),(n=>{TransformStreamError(t,n);throw r._storedError}))}function TransformStreamDefaultSourcePullAlgorithm(t){TransformStreamSetBackpressure(t,false);return t._backpressureChangePromise}function defaultControllerBrandCheckException(t){return new TypeError(`TransformStreamDefaultController.prototype.${t} can only be used on a TransformStreamDefaultController`)}function streamBrandCheckException(t){return new TypeError(`TransformStream.prototype.${t} can only be used on a TransformStream`)}t.ByteLengthQueuingStrategy=ByteLengthQueuingStrategy;t.CountQueuingStrategy=CountQueuingStrategy;t.ReadableByteStreamController=ReadableByteStreamController;t.ReadableStream=ReadableStream;t.ReadableStreamBYOBReader=ReadableStreamBYOBReader;t.ReadableStreamBYOBRequest=ReadableStreamBYOBRequest;t.ReadableStreamDefaultController=ReadableStreamDefaultController;t.ReadableStreamDefaultReader=ReadableStreamDefaultReader;t.TransformStream=TransformStream;t.TransformStreamDefaultController=TransformStreamDefaultController;t.WritableStream=WritableStream;t.WritableStreamDefaultController=WritableStreamDefaultController;t.WritableStreamDefaultWriter=WritableStreamDefaultWriter;Object.defineProperty(t,"__esModule",{value:true})}))},9491:t=>{"use strict";t.exports=require("assert")},4300:t=>{"use strict";t.exports=require("buffer")},2081:t=>{"use strict";t.exports=require("child_process")},6113:t=>{"use strict";t.exports=require("crypto")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5687:t=>{"use strict";t.exports=require("https")},1808:t=>{"use strict";t.exports=require("net")},7742:t=>{"use strict";t.exports=require("node:process")},2477:t=>{"use strict";t.exports=require("node:stream/web")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},4404:t=>{"use strict";t.exports=require("tls")},3837:t=>{"use strict";t.exports=require("util")},1267:t=>{"use strict";t.exports=require("worker_threads")},8572:(t,r,n)=>{const o=65536;if(!globalThis.ReadableStream){try{const t=n(7742);const{emitWarning:r}=t;try{t.emitWarning=()=>{};Object.assign(globalThis,n(2477));t.emitWarning=r}catch(n){t.emitWarning=r;throw n}}catch(t){Object.assign(globalThis,n(1452))}}try{const{Blob:t}=n(4300);if(t&&!t.prototype.stream){t.prototype.stream=function name(t){let r=0;const n=this;return new ReadableStream({type:"bytes",async pull(t){const a=n.slice(r,Math.min(n.size,r+o));const i=await a.arrayBuffer();r+=i.byteLength;t.enqueue(new Uint8Array(i));if(r===n.size){t.close()}}})}}}catch(t){}},3213:(t,r,n)=>{"use strict";n.d(r,{Z:()=>s});var o=n(1410);const a=class File extends o.Z{#e=0;#t="";constructor(t,r,n={}){if(arguments.length<2){throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`)}super(t,n);if(n===null)n={};const o=n.lastModified===undefined?Date.now():Number(n.lastModified);if(!Number.isNaN(o)){this.#e=o}this.#t=String(r)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](t){return!!t&&t instanceof o.Z&&/^(File)$/.test(t[Symbol.toStringTag])}};const i=a;const s=i},2777:(t,r,n)=>{"use strict";n.d(r,{$B:()=>s.Z});const o=require("node:fs");const a=require("node:path");var i=n(7760);var s=n(3213);var l=n(1410);const{stat:u}=o.promises;const blobFromSync=(t,r)=>fromBlob(statSync(t),t,r);const blobFrom=(t,r)=>u(t).then((n=>fromBlob(n,t,r)));const fileFrom=(t,r)=>u(t).then((n=>fromFile(n,t,r)));const fileFromSync=(t,r)=>fromFile(statSync(t),t,r);const fromBlob=(t,r,n="")=>new Blob([new BlobDataItem({path:r,size:t.size,lastModified:t.mtimeMs,start:0})],{type:n});const fromFile=(t,r,n="")=>new File([new BlobDataItem({path:r,size:t.size,lastModified:t.mtimeMs,start:0})],basename(r),{type:n,lastModified:t.mtimeMs});class BlobDataItem{#r;#n;constructor(t){this.#r=t.path;this.#n=t.start;this.size=t.size;this.lastModified=t.lastModified}slice(t,r){return new BlobDataItem({path:this.#r,lastModified:this.lastModified,size:r-t,start:this.#n+t})}async*stream(){const{mtimeMs:t}=await u(this.#r);if(t>this.lastModified){throw new DOMException("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError")}yield*createReadStream(this.#r,{start:this.#n,end:this.#n+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}const d=null&&blobFromSync},1410:(t,r,n)=>{"use strict";n.d(r,{Z:()=>l});var o=n(8572); -/*! fetch-blob. MIT License. Jimmy Wärting */const a=65536;async function*toIterator(t,r=true){for(const n of t){if("stream"in n){yield*n.stream()}else if(ArrayBuffer.isView(n)){if(r){let t=n.byteOffset;const r=n.byteOffset+n.byteLength;while(t!==r){const o=Math.min(r-t,a);const i=n.buffer.slice(t,t+o);t+=i.byteLength;yield new Uint8Array(i)}}else{yield n}}else{let t=0,r=n;while(t!==r.size){const n=r.slice(t,Math.min(r.size,t+a));const o=await n.arrayBuffer();t+=o.byteLength;yield new Uint8Array(o)}}}}const i=class Blob{#o=[];#a="";#i=0;#s="transparent";constructor(t=[],r={}){if(typeof t!=="object"||t===null){throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.")}if(typeof t[Symbol.iterator]!=="function"){throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.")}if(typeof r!=="object"&&typeof r!=="function"){throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.")}if(r===null)r={};const n=new TextEncoder;for(const r of t){let t;if(ArrayBuffer.isView(r)){t=new Uint8Array(r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength))}else if(r instanceof ArrayBuffer){t=new Uint8Array(r.slice(0))}else if(r instanceof Blob){t=r}else{t=n.encode(`${r}`)}this.#i+=ArrayBuffer.isView(t)?t.byteLength:t.size;this.#o.push(t)}this.#s=`${r.endings===undefined?"transparent":r.endings}`;const o=r.type===undefined?"":String(r.type);this.#a=/^[\x20-\x7E]*$/.test(o)?o:""}get size(){return this.#i}get type(){return this.#a}async text(){const t=new TextDecoder;let r="";for await(const n of toIterator(this.#o,false)){r+=t.decode(n,{stream:true})}r+=t.decode();return r}async arrayBuffer(){const t=new Uint8Array(this.size);let r=0;for await(const n of toIterator(this.#o,false)){t.set(n,r);r+=n.length}return t.buffer}stream(){const t=toIterator(this.#o,true);return new globalThis.ReadableStream({type:"bytes",async pull(r){const n=await t.next();n.done?r.close():r.enqueue(n.value)},async cancel(){await t.return()}})}slice(t=0,r=this.size,n=""){const{size:o}=this;let a=t<0?Math.max(o+t,0):Math.min(t,o);let i=r<0?Math.max(o+r,0):Math.min(r,o);const s=Math.max(i-a,0);const l=this.#o;const u=[];let d=0;for(const t of l){if(d>=s){break}const r=ArrayBuffer.isView(t)?t.byteLength:t.size;if(a&&r<=a){a-=r;i-=r}else{let n;if(ArrayBuffer.isView(t)){n=t.subarray(a,Math.min(r,i));d+=n.byteLength}else{n=t.slice(a,Math.min(r,i));d+=n.size}i-=r;u.push(n);a=0}}const c=new Blob([],{type:String(n).toLowerCase()});c.#i=s;c.#o=u;return c}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](t){return t&&typeof t==="object"&&typeof t.constructor==="function"&&(typeof t.stream==="function"||typeof t.arrayBuffer==="function")&&/^(Blob|File)$/.test(t[Symbol.toStringTag])}};Object.defineProperties(i.prototype,{size:{enumerable:true},type:{enumerable:true},slice:{enumerable:true}});const s=i;const l=s},8010:(t,r,n)=>{"use strict";n.d(r,{Ct:()=>m,au:()=>formDataToBlob});var o=n(1410);var a=n(3213); -/*! formdata-polyfill. MIT License. Jimmy Wärting */var{toStringTag:i,iterator:s,hasInstance:l}=Symbol,u=Math.random,d="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),f=(t,r,n)=>(t+="",/^(Blob|File)$/.test(r&&r[i])?[(n=n!==void 0?n+"":r[i]=="File"?r.name:"blob",t),r.name!==n||r[i]=="blob"?new a.Z([r],n,r):r]:[t,r+""]),e=(t,r)=>(r?t:t.replace(/\r?\n|\r/g,"\r\n")).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),x=(t,r,n)=>{if(r.lengthtypeof t[r]!="function"))}append(...t){x("append",arguments,2);this.#l.push(f(...t))}delete(t){x("delete",arguments,1);t+="";this.#l=this.#l.filter((([r])=>r!==t))}get(t){x("get",arguments,1);t+="";for(var r=this.#l,n=r.length,o=0;on[0]===t&&r.push(n[1])));return r}has(t){x("has",arguments,1);t+="";return this.#l.some((r=>r[0]===t))}forEach(t,r){x("forEach",arguments,1);for(var[n,o]of this)t.call(r,o,n,this)}set(...t){x("set",arguments,2);var r=[],n=!0;t=f(...t);this.#l.forEach((o=>{o[0]===t[0]?n&&(n=!r.push(t)):r.push(o)}));n&&r.push(t);this.#l=r}*entries(){yield*this.#l}*keys(){for(var[t]of this)yield t}*values(){for(var[,t]of this)yield t}};function formDataToBlob(t,r=o.Z){var n=`${u()}${u()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),a=[],i=`--${n}\r\nContent-Disposition: form-data; name="`;t.forEach(((t,r)=>typeof t=="string"?a.push(i+e(r)+`"\r\n\r\n${t.replace(/\r(?!\n)|(?{__nccwpck_require__.d=(t,r)=>{for(var n in r){if(__nccwpck_require__.o(r,n)&&!__nccwpck_require__.o(t,n)){Object.defineProperty(t,n,{enumerable:true,get:r[n]})}}}})();(()=>{__nccwpck_require__.f={};__nccwpck_require__.e=t=>Promise.all(Object.keys(__nccwpck_require__.f).reduce(((r,n)=>{__nccwpck_require__.f[n](t,r);return r}),[]))})();(()=>{__nccwpck_require__.u=t=>""+t+".index.js"})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";(()=>{var t={179:1};var installChunk=r=>{var n=r.modules,o=r.ids,a=r.runtime;for(var i in n){if(__nccwpck_require__.o(n,i)){__nccwpck_require__.m[i]=n[i]}}if(a)a(__nccwpck_require__);for(var s=0;s{if(!t[r]){if(true){installChunk(require("./"+__nccwpck_require__.u(r)))}else t[r]=1}}})();var n={};(()=>{"use strict";__nccwpck_require__.r(n);const t=require("node:http");const r=require("node:https");const o=require("node:zlib");const a=require("node:stream");const i=require("node:buffer");function dataUriToBuffer(t){if(!/^data:/i.test(t)){throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")')}t=t.replace(/\r?\n/g,"");const r=t.indexOf(",");if(r===-1||r<=4){throw new TypeError("malformed data: URI")}const n=t.substring(5,r).split(";");let o="";let a=false;const i=n[0]||"text/plain";let s=i;for(let t=1;ttypeof t==="object"&&typeof t.append==="function"&&typeof t.delete==="function"&&typeof t.get==="function"&&typeof t.getAll==="function"&&typeof t.has==="function"&&typeof t.set==="function"&&typeof t.sort==="function"&&t[c]==="URLSearchParams";const isBlob=t=>t&&typeof t==="object"&&typeof t.arrayBuffer==="function"&&typeof t.type==="string"&&typeof t.stream==="function"&&typeof t.constructor==="function"&&/^(Blob|File)$/.test(t[c]);const isAbortSignal=t=>typeof t==="object"&&(t[c]==="AbortSignal"||t[c]==="EventTarget");const isDomainOrSubdomain=(t,r)=>{const n=new URL(r).hostname;const o=new URL(t).hostname;return n===o||n.endsWith(`.${o}`)};const isSameProtocol=(t,r)=>{const n=new URL(r).protocol;const o=new URL(t).protocol;return n===o};const m=(0,l.promisify)(a.pipeline);const h=Symbol("Body internals");class Body{constructor(t,{size:r=0}={}){let n=null;if(t===null){t=null}else if(isURLSearchParameters(t)){t=i.Buffer.from(t.toString())}else if(isBlob(t)){}else if(i.Buffer.isBuffer(t)){}else if(l.types.isAnyArrayBuffer(t)){t=i.Buffer.from(t)}else if(ArrayBuffer.isView(t)){t=i.Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(t instanceof a){}else if(t instanceof d.Ct){t=(0,d.au)(t);n=t.type.split("=")[1]}else{t=i.Buffer.from(String(t))}let o=t;if(i.Buffer.isBuffer(t)){o=a.Readable.from(t)}else if(isBlob(t)){o=a.Readable.from(t.stream())}this[h]={body:t,stream:o,boundary:n,disturbed:false,error:null};this.size=r;if(t instanceof a){t.on("error",(t=>{const r=t instanceof FetchBaseError?t:new FetchError(`Invalid response body while trying to fetch ${this.url}: ${t.message}`,"system",t);this[h].error=r}))}}get body(){return this[h].stream}get bodyUsed(){return this[h].disturbed}async arrayBuffer(){const{buffer:t,byteOffset:r,byteLength:n}=await consumeBody(this);return t.slice(r,r+n)}async formData(){const t=this.headers.get("content-type");if(t.startsWith("application/x-www-form-urlencoded")){const t=new d.Ct;const r=new URLSearchParams(await this.text());for(const[n,o]of r){t.append(n,o)}return t}const{toFormData:r}=await __nccwpck_require__.e(37).then(__nccwpck_require__.bind(__nccwpck_require__,4037));return r(this.body,t)}async blob(){const t=this.headers&&this.headers.get("content-type")||this[h].body&&this[h].body.type||"";const r=await this.arrayBuffer();return new u.Z([r],{type:t})}async json(){const t=await this.text();return JSON.parse(t)}async text(){const t=await consumeBody(this);return(new TextDecoder).decode(t)}buffer(){return consumeBody(this)}}Body.prototype.buffer=(0,l.deprecate)(Body.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Body.prototype,{body:{enumerable:true},bodyUsed:{enumerable:true},arrayBuffer:{enumerable:true},blob:{enumerable:true},json:{enumerable:true},text:{enumerable:true},data:{get:(0,l.deprecate)((()=>{}),"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function consumeBody(t){if(t[h].disturbed){throw new TypeError(`body used already for: ${t.url}`)}t[h].disturbed=true;if(t[h].error){throw t[h].error}const{body:r}=t;if(r===null){return i.Buffer.alloc(0)}if(!(r instanceof a)){return i.Buffer.alloc(0)}const n=[];let o=0;try{for await(const a of r){if(t.size>0&&o+a.length>t.size){const n=new FetchError(`content size at ${t.url} over limit: ${t.size}`,"max-size");r.destroy(n);throw n}o+=a.length;n.push(a)}}catch(r){const n=r instanceof FetchBaseError?r:new FetchError(`Invalid response body while trying to fetch ${t.url}: ${r.message}`,"system",r);throw n}if(r.readableEnded===true||r._readableState.ended===true){try{if(n.every((t=>typeof t==="string"))){return i.Buffer.from(n.join(""))}return i.Buffer.concat(n,o)}catch(r){throw new FetchError(`Could not create Buffer from response body for ${t.url}: ${r.message}`,"system",r)}}else{throw new FetchError(`Premature close of server response while trying to fetch ${t.url}`)}}const clone=(t,r)=>{let n;let o;let{body:i}=t[h];if(t.bodyUsed){throw new Error("cannot clone body after it is used")}if(i instanceof a&&typeof i.getBoundary!=="function"){n=new a.PassThrough({highWaterMark:r});o=new a.PassThrough({highWaterMark:r});i.pipe(n);i.pipe(o);t[h].stream=n;i=o}return i};const p=(0,l.deprecate)((t=>t.getBoundary()),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167");const extractContentType=(t,r)=>{if(t===null){return null}if(typeof t==="string"){return"text/plain;charset=UTF-8"}if(isURLSearchParameters(t)){return"application/x-www-form-urlencoded;charset=UTF-8"}if(isBlob(t)){return t.type||null}if(i.Buffer.isBuffer(t)||l.types.isAnyArrayBuffer(t)||ArrayBuffer.isView(t)){return null}if(t instanceof d.Ct){return`multipart/form-data; boundary=${r[h].boundary}`}if(t&&typeof t.getBoundary==="function"){return`multipart/form-data;boundary=${p(t)}`}if(t instanceof a){return null}return"text/plain;charset=UTF-8"};const getTotalBytes=t=>{const{body:r}=t[h];if(r===null){return 0}if(isBlob(r)){return r.size}if(i.Buffer.isBuffer(r)){return r.length}if(r&&typeof r.getLengthSync==="function"){return r.hasKnownLength&&r.hasKnownLength()?r.getLengthSync():null}return null};const writeToStream=async(t,{body:r})=>{if(r===null){t.end()}else{await m(r,t)}};const b=typeof t.validateHeaderName==="function"?t.validateHeaderName:t=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(t)){const r=new TypeError(`Header name must be a valid HTTP token [${t}]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_HTTP_TOKEN"});throw r}};const y=typeof t.validateHeaderValue==="function"?t.validateHeaderValue:(t,r)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(r)){const r=new TypeError(`Invalid character in header content ["${t}"]`);Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"});throw r}};class Headers extends URLSearchParams{constructor(t){let r=[];if(t instanceof Headers){const n=t.raw();for(const[t,o]of Object.entries(n)){r.push(...o.map((r=>[t,r])))}}else if(t==null){}else if(typeof t==="object"&&!l.types.isBoxedPrimitive(t)){const n=t[Symbol.iterator];if(n==null){r.push(...Object.entries(t))}else{if(typeof n!=="function"){throw new TypeError("Header pairs must be iterable")}r=[...t].map((t=>{if(typeof t!=="object"||l.types.isBoxedPrimitive(t)){throw new TypeError("Each header pair must be an iterable object")}return[...t]})).map((t=>{if(t.length!==2){throw new TypeError("Each header pair must be a name/value tuple")}return[...t]}))}}else{throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence> or record)")}r=r.length>0?r.map((([t,r])=>{b(t);y(t,String(r));return[String(t).toLowerCase(),String(r)]})):undefined;super(r);return new Proxy(this,{get(t,r,n){switch(r){case"append":case"set":return(n,o)=>{b(n);y(n,String(o));return URLSearchParams.prototype[r].call(t,String(n).toLowerCase(),String(o))};case"delete":case"has":case"getAll":return n=>{b(n);return URLSearchParams.prototype[r].call(t,String(n).toLowerCase())};case"keys":return()=>{t.sort();return new Set(URLSearchParams.prototype.keys.call(t)).keys()};default:return Reflect.get(t,r,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){const r=this.getAll(t);if(r.length===0){return null}let n=r.join(", ");if(/^content-encoding$/i.test(t)){n=n.toLowerCase()}return n}forEach(t,r=undefined){for(const n of this.keys()){Reflect.apply(t,r,[this.get(n),n,this])}}*values(){for(const t of this.keys()){yield this.get(t)}}*entries(){for(const t of this.keys()){yield[t,this.get(t)]}}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((t,r)=>{t[r]=this.getAll(r);return t}),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((t,r)=>{const n=this.getAll(r);if(r==="host"){t[r]=n[0]}else{t[r]=n.length>1?n:n[0]}return t}),{})}}Object.defineProperties(Headers.prototype,["get","entries","forEach","values"].reduce(((t,r)=>{t[r]={enumerable:true};return t}),{}));function fromRawHeaders(t=[]){return new Headers(t.reduce(((t,r,n,o)=>{if(n%2===0){t.push(o.slice(n,n+2))}return t}),[]).filter((([t,r])=>{try{b(t);y(t,String(r));return true}catch{return false}})))}const S=new Set([301,302,303,307,308]);const isRedirect=t=>S.has(t);const R=Symbol("Response internals");class Response extends Body{constructor(t=null,r={}){super(t,r);const n=r.status!=null?r.status:200;const o=new Headers(r.headers);if(t!==null&&!o.has("Content-Type")){const r=extractContentType(t,this);if(r){o.append("Content-Type",r)}}this[R]={type:"default",url:r.url,status:n,statusText:r.statusText||"",headers:o,counter:r.counter,highWaterMark:r.highWaterMark}}get type(){return this[R].type}get url(){return this[R].url||""}get status(){return this[R].status}get ok(){return this[R].status>=200&&this[R].status<300}get redirected(){return this[R].counter>0}get statusText(){return this[R].statusText}get headers(){return this[R].headers}get highWaterMark(){return this[R].highWaterMark}clone(){return new Response(clone(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,r=302){if(!isRedirect(r)){throw new RangeError('Failed to execute "redirect" on "response": Invalid status code')}return new Response(null,{headers:{location:new URL(t).toString()},status:r})}static error(){const t=new Response(null,{status:0,statusText:""});t[R].type="error";return t}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Response.prototype,{type:{enumerable:true},url:{enumerable:true},status:{enumerable:true},ok:{enumerable:true},redirected:{enumerable:true},statusText:{enumerable:true},headers:{enumerable:true},clone:{enumerable:true}});const g=require("node:url");const getSearch=t=>{if(t.search){return t.search}const r=t.href.length-1;const n=t.hash||(t.href[r]==="#"?"#":"");return t.href[r-n.length]==="?"?"?":""};const _=require("node:net");function stripURLForUseAsAReferrer(t,r=false){if(t==null){return"no-referrer"}t=new URL(t);if(/^(about|blob|data):$/.test(t.protocol)){return"no-referrer"}t.username="";t.password="";t.hash="";if(r){t.pathname="";t.search=""}return t}const C=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]);const w="strict-origin-when-cross-origin";function validateReferrerPolicy(t){if(!C.has(t)){throw new TypeError(`Invalid referrerPolicy: ${t}`)}return t}function isOriginPotentiallyTrustworthy(t){if(/^(http|ws)s:$/.test(t.protocol)){return true}const r=t.host.replace(/(^\[)|(]$)/g,"");const n=(0,_.isIP)(r);if(n===4&&/^127\./.test(r)){return true}if(n===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(r)){return true}if(t.host==="localhost"||t.host.endsWith(".localhost")){return false}if(t.protocol==="file:"){return true}return false}function isUrlPotentiallyTrustworthy(t){if(/^about:(blank|srcdoc)$/.test(t)){return true}if(t.protocol==="data:"){return true}if(/^(blob|filesystem):$/.test(t.protocol)){return true}return isOriginPotentiallyTrustworthy(t)}function determineRequestsReferrer(t,{referrerURLCallback:r,referrerOriginCallback:n}={}){if(t.referrer==="no-referrer"||t.referrerPolicy===""){return null}const o=t.referrerPolicy;if(t.referrer==="about:client"){return"no-referrer"}const a=t.referrer;let i=stripURLForUseAsAReferrer(a);let s=stripURLForUseAsAReferrer(a,true);if(i.toString().length>4096){i=s}if(r){i=r(i)}if(n){s=n(s)}const l=new URL(t.url);switch(o){case"no-referrer":return"no-referrer";case"origin":return s;case"unsafe-url":return i;case"strict-origin":if(isUrlPotentiallyTrustworthy(i)&&!isUrlPotentiallyTrustworthy(l)){return"no-referrer"}return s.toString();case"strict-origin-when-cross-origin":if(i.origin===l.origin){return i}if(isUrlPotentiallyTrustworthy(i)&&!isUrlPotentiallyTrustworthy(l)){return"no-referrer"}return s;case"same-origin":if(i.origin===l.origin){return i}return"no-referrer";case"origin-when-cross-origin":if(i.origin===l.origin){return i}return s;case"no-referrer-when-downgrade":if(isUrlPotentiallyTrustworthy(i)&&!isUrlPotentiallyTrustworthy(l)){return"no-referrer"}return i;default:throw new TypeError(`Invalid referrerPolicy: ${o}`)}}function parseReferrerPolicyFromHeader(t){const r=(t.get("referrer-policy")||"").split(/[,\s]+/);let n="";for(const t of r){if(t&&C.has(t)){n=t}}return n}const v=Symbol("Request internals");const isRequest=t=>typeof t==="object"&&typeof t[v]==="object";const P=(0,l.deprecate)((()=>{}),".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class Request extends Body{constructor(t,r={}){let n;if(isRequest(t)){n=new URL(t.url)}else{n=new URL(t);t={}}if(n.username!==""||n.password!==""){throw new TypeError(`${n} is an url with embedded credentials.`)}let o=r.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)){o=o.toUpperCase()}if(!isRequest(r)&&"data"in r){P()}if((r.body!=null||isRequest(t)&&t.body!==null)&&(o==="GET"||o==="HEAD")){throw new TypeError("Request with GET/HEAD method cannot have body")}const a=r.body?r.body:isRequest(t)&&t.body!==null?clone(t):null;super(a,{size:r.size||t.size||0});const i=new Headers(r.headers||t.headers||{});if(a!==null&&!i.has("Content-Type")){const t=extractContentType(a,this);if(t){i.set("Content-Type",t)}}let s=isRequest(t)?t.signal:null;if("signal"in r){s=r.signal}if(s!=null&&!isAbortSignal(s)){throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget")}let l=r.referrer==null?t.referrer:r.referrer;if(l===""){l="no-referrer"}else if(l){const t=new URL(l);l=/^about:(\/\/)?client$/.test(t)?"client":t}else{l=undefined}this[v]={method:o,redirect:r.redirect||t.redirect||"follow",headers:i,parsedURL:n,signal:s,referrer:l};this.follow=r.follow===undefined?t.follow===undefined?20:t.follow:r.follow;this.compress=r.compress===undefined?t.compress===undefined?true:t.compress:r.compress;this.counter=r.counter||t.counter||0;this.agent=r.agent||t.agent;this.highWaterMark=r.highWaterMark||t.highWaterMark||16384;this.insecureHTTPParser=r.insecureHTTPParser||t.insecureHTTPParser||false;this.referrerPolicy=r.referrerPolicy||t.referrerPolicy||""}get method(){return this[v].method}get url(){return(0,g.format)(this[v].parsedURL)}get headers(){return this[v].headers}get redirect(){return this[v].redirect}get signal(){return this[v].signal}get referrer(){if(this[v].referrer==="no-referrer"){return""}if(this[v].referrer==="client"){return"about:client"}if(this[v].referrer){return this[v].referrer.toString()}return undefined}get referrerPolicy(){return this[v].referrerPolicy}set referrerPolicy(t){this[v].referrerPolicy=validateReferrerPolicy(t)}clone(){return new Request(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Request.prototype,{method:{enumerable:true},url:{enumerable:true},headers:{enumerable:true},redirect:{enumerable:true},clone:{enumerable:true},signal:{enumerable:true},referrer:{enumerable:true},referrerPolicy:{enumerable:true}});const getNodeRequestOptions=t=>{const{parsedURL:r}=t[v];const n=new Headers(t[v].headers);if(!n.has("Accept")){n.set("Accept","*/*")}let o=null;if(t.body===null&&/^(post|put)$/i.test(t.method)){o="0"}if(t.body!==null){const r=getTotalBytes(t);if(typeof r==="number"&&!Number.isNaN(r)){o=String(r)}}if(o){n.set("Content-Length",o)}if(t.referrerPolicy===""){t.referrerPolicy=w}if(t.referrer&&t.referrer!=="no-referrer"){t[v].referrer=determineRequestsReferrer(t)}else{t[v].referrer="no-referrer"}if(t[v].referrer instanceof URL){n.set("Referer",t.referrer)}if(!n.has("User-Agent")){n.set("User-Agent","node-fetch")}if(t.compress&&!n.has("Accept-Encoding")){n.set("Accept-Encoding","gzip, deflate, br")}let{agent:a}=t;if(typeof a==="function"){a=a(r)}if(!n.has("Connection")&&!a){n.set("Connection","close")}const i=getSearch(r);const s={path:r.pathname+i,method:t.method,headers:n[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:t.insecureHTTPParser,agent:a};return{parsedURL:r,options:s}};class AbortError extends FetchBaseError{constructor(t,r="aborted"){super(t,r)}}var E=__nccwpck_require__(2777);const T=new Set(["data:","http:","https:"]);async function fetch(n,i){return new Promise(((l,u)=>{const d=new Request(n,i);const{parsedURL:c,options:m}=getNodeRequestOptions(d);if(!T.has(c.protocol)){throw new TypeError(`node-fetch cannot load ${n}. URL scheme "${c.protocol.replace(/:$/,"")}" is not supported.`)}if(c.protocol==="data:"){const t=s(d.url);const r=new Response(t,{headers:{"Content-Type":t.typeFull}});l(r);return}const h=(c.protocol==="https:"?r:t).request;const{signal:p}=d;let b=null;const abort=()=>{const t=new AbortError("The operation was aborted.");u(t);if(d.body&&d.body instanceof a.Readable){d.body.destroy(t)}if(!b||!b.body){return}b.body.emit("error",t)};if(p&&p.aborted){abort();return}const abortAndFinalize=()=>{abort();finalize()};const y=h(c.toString(),m);if(p){p.addEventListener("abort",abortAndFinalize)}const finalize=()=>{y.abort();if(p){p.removeEventListener("abort",abortAndFinalize)}};y.on("error",(t=>{u(new FetchError(`request to ${d.url} failed, reason: ${t.message}`,"system",t));finalize()}));fixResponseChunkedTransferBadEnding(y,(t=>{if(b&&b.body){b.body.destroy(t)}}));if(process.version<"v14"){y.on("socket",(t=>{let r;t.prependListener("end",(()=>{r=t._eventsCount}));t.prependListener("close",(n=>{if(b&&r{y.setTimeout(0);const r=fromRawHeaders(t.rawHeaders);if(isRedirect(t.statusCode)){const n=r.get("Location");let o=null;try{o=n===null?null:new URL(n,d.url)}catch{if(d.redirect!=="manual"){u(new FetchError(`uri requested responds with an invalid redirect URL: ${n}`,"invalid-redirect"));finalize();return}}switch(d.redirect){case"error":u(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${d.url}`,"no-redirect"));finalize();return;case"manual":break;case"follow":{if(o===null){break}if(d.counter>=d.follow){u(new FetchError(`maximum redirect reached at: ${d.url}`,"max-redirect"));finalize();return}const n={headers:new Headers(d.headers),follow:d.follow,counter:d.counter+1,agent:d.agent,compress:d.compress,method:d.method,body:clone(d),signal:d.signal,size:d.size,referrer:d.referrer,referrerPolicy:d.referrerPolicy};if(!isDomainOrSubdomain(d.url,o)||!isSameProtocol(d.url,o)){for(const t of["authorization","www-authenticate","cookie","cookie2"]){n.headers.delete(t)}}if(t.statusCode!==303&&d.body&&i.body instanceof a.Readable){u(new FetchError("Cannot follow redirect with body being a readable stream","unsupported-redirect"));finalize();return}if(t.statusCode===303||(t.statusCode===301||t.statusCode===302)&&d.method==="POST"){n.method="GET";n.body=undefined;n.headers.delete("content-length")}const s=parseReferrerPolicyFromHeader(r);if(s){n.referrerPolicy=s}l(fetch(new Request(o,n)));finalize();return}default:return u(new TypeError(`Redirect option '${d.redirect}' is not a valid value of RequestRedirect`))}}if(p){t.once("end",(()=>{p.removeEventListener("abort",abortAndFinalize)}))}let n=(0,a.pipeline)(t,new a.PassThrough,(t=>{if(t){u(t)}}));if(process.version<"v12.10"){t.on("aborted",abortAndFinalize)}const s={url:d.url,status:t.statusCode,statusText:t.statusMessage,headers:r,size:d.size,counter:d.counter,highWaterMark:d.highWaterMark};const c=r.get("Content-Encoding");if(!d.compress||d.method==="HEAD"||c===null||t.statusCode===204||t.statusCode===304){b=new Response(n,s);l(b);return}const m={flush:o.Z_SYNC_FLUSH,finishFlush:o.Z_SYNC_FLUSH};if(c==="gzip"||c==="x-gzip"){n=(0,a.pipeline)(n,o.createGunzip(m),(t=>{if(t){u(t)}}));b=new Response(n,s);l(b);return}if(c==="deflate"||c==="x-deflate"){const r=(0,a.pipeline)(t,new a.PassThrough,(t=>{if(t){u(t)}}));r.once("data",(t=>{if((t[0]&15)===8){n=(0,a.pipeline)(n,o.createInflate(),(t=>{if(t){u(t)}}))}else{n=(0,a.pipeline)(n,o.createInflateRaw(),(t=>{if(t){u(t)}}))}b=new Response(n,s);l(b)}));r.once("end",(()=>{if(!b){b=new Response(n,s);l(b)}}));return}if(c==="br"){n=(0,a.pipeline)(n,o.createBrotliDecompress(),(t=>{if(t){u(t)}}));b=new Response(n,s);l(b);return}b=new Response(n,s);l(b)}));writeToStream(y,d).catch(u)}))}function fixResponseChunkedTransferBadEnding(t,r){const n=i.Buffer.from("0\r\n\r\n");let o=false;let a=false;let s;t.on("response",(t=>{const{headers:r}=t;o=r["transfer-encoding"]==="chunked"&&!r["content-length"]}));t.on("socket",(l=>{const onSocketClose=()=>{if(o&&!a){const t=new Error("Premature close");t.code="ERR_STREAM_PREMATURE_CLOSE";r(t)}};const onData=t=>{a=i.Buffer.compare(t.slice(-5),n)===0;if(!a&&s){a=i.Buffer.compare(s.slice(-3),n.slice(0,3))===0&&i.Buffer.compare(t.slice(-2),n.slice(3))===0}s=t};l.prependListener("close",onSocketClose);l.on("data",onData);t.on("close",(()=>{l.removeListener("close",onSocketClose);l.removeListener("data",onData)}))}))}const B=__nccwpck_require__(2186);const W=__nccwpck_require__(2081);const main=async()=>{let t=parseInt(B.getInput("check_every_seconds",{required:true}));while(true){if(await isLatestCommit()===false){await cancelRun();return}await new Promise((r=>setTimeout(r,t*1e3)))}};const isLatestCommit=async()=>{let t=process.env["GITHUB_SHA"];let r=process.env["GITHUB_REF"];let n=process.env["GITHUB_REPOSITORY"];let o=B.getInput("github_token",{required:true});let a=await fetch("https://api.github.com/repos/"+n+"/commits/"+r,{headers:{Accept:"application/vnd.github.v3.sha",Authorization:"token "+o,"If-None-Match":'"'+t+'"'}});let i=await a.text();if(a.status===200&&i!==t){return false}else if(a.status===304){return true}else if(a.status===429){return true}else{B.setFailed("Failed to fetch the latest commit!");process.exit(1)}};const cancelRun=async()=>{let t=process.env["GITHUB_REPOSITORY"];let r=process.env["GITHUB_RUN_ID"];let n=B.getInput("github_token",{required:true});let o=await fetch("https://api.github.com/repos/"+t+"/actions/runs/"+r+"/cancel",{method:"POST",headers:{Authorization:"token "+n}});if(o.status!==202){B.setFailed("Received unexpected status code "+o.status+"while cancelling the build!");process.exit(1)}};const daemonize=async()=>{let t=W.fork(__filename,["foreground"],{detached:true,stdio:"ignore"});t.unref();B.info("Successfully daemonized cancel-outdated-builds.");process.exit(0)};if(process.argv.length==3&&process.argv[2]=="foreground"){main()}else{daemonize()}})();module.exports=n})(); \ No newline at end of file diff --git a/github-actions/cancel-outdated-builds/index.js b/github-actions/cancel-outdated-builds/index.js deleted file mode 100644 index fddae4e8b..000000000 --- a/github-actions/cancel-outdated-builds/index.js +++ /dev/null @@ -1,87 +0,0 @@ -const actions = require("@actions/core"); -const childProcess = require("child_process"); -import fetch from "node-fetch"; - -const main = (async () => { - let checkEverySeconds = parseInt(actions.getInput("check_every_seconds", { required: true })); - while (true) { - if (await isLatestCommit() === false) { - await cancelRun(); - return; - } - await new Promise(resolve => setTimeout(resolve, checkEverySeconds * 1000)); - } -}); - -const isLatestCommit = async () => { - let commit = process.env["GITHUB_SHA"]; - let ref = process.env["GITHUB_REF"]; - let repo = process.env["GITHUB_REPOSITORY"]; - let token = actions.getInput("github_token", { required: true }); - - let resp = await fetch("https://api.github.com/repos/" + repo + "/commits/" + ref, { - headers: { - "Accept": "application/vnd.github.v3.sha", - "Authorization": "token " + token, - // If-None-Match allows a periodic polling without hitting the rate - // limits: when the commit is the same as the one provided in the - // header GitHub will return a 304 status code without impacting - // the limits. - "If-None-Match": '"' + commit + '"', - }, - }); - let currentCommit = await resp.text(); - - if (resp.status === 200 && currentCommit !== commit) { - // If-None-Match did not work, the commit changed - return false; - } else if (resp.status === 304) { - // A "Not modified" was returned (without impacting the rate limits), - // so the commit is indeed the last one - return true; - } else if (resp.status === 429) { - // If we're rate limited just fake that the commit is the latest so it - // will be checked later. - return true; - } else { - actions.setFailed("Failed to fetch the latest commit!"); - process.exit(1); - } -}; - -const cancelRun = async () => { - let repo = process.env["GITHUB_REPOSITORY"]; - let run_id = process.env["GITHUB_RUN_ID"]; - let token = actions.getInput("github_token", { required: true }); - - let resp = await fetch("https://api.github.com/repos/" + repo + "/actions/runs/" + run_id + "/cancel", { - method: "POST", - headers: { - "Authorization": "token " + token, - }, - }); - - if (resp.status !== 202) { - actions.setFailed( - "Received unexpected status code " + resp.status + "while cancelling the build!" - ); - process.exit(1); - } -}; - -const daemonize = async () => { - let subprocess = childProcess.fork(__filename, ["foreground"], { - detached: true, - stdio: "ignore", - }); - subprocess.unref(); - - actions.info("Successfully daemonized cancel-outdated-builds."); - process.exit(0); -}; - -if (process.argv.length == 3 && process.argv[2] == "foreground") { - main(); -} else { - daemonize(); -} diff --git a/github-actions/cancel-outdated-builds/package-lock.json b/github-actions/cancel-outdated-builds/package-lock.json deleted file mode 100644 index 6ba38af0f..000000000 --- a/github-actions/cancel-outdated-builds/package-lock.json +++ /dev/null @@ -1,223 +0,0 @@ -{ - "name": "cancel-outdated-builds", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "cancel-outdated-builds", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "@actions/core": "^1.10.0", - "node-fetch": "^3.2.0" - }, - "devDependencies": { - "@vercel/ncc": "^0.34.0" - } - }, - "node_modules/@actions/core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", - "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", - "dependencies": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "node_modules/@actions/http-client": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", - "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", - "dependencies": { - "tunnel": "^0.0.6" - } - }, - "node_modules/@vercel/ncc": { - "version": "0.34.0", - "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz", - "integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==", - "dev": true, - "bin": { - "ncc": "dist/ncc/cli.js" - } - }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", - "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==", - "engines": { - "node": ">= 12" - } - }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "3.2.10", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", - "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - } - }, - "dependencies": { - "@actions/core": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", - "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", - "requires": { - "@actions/http-client": "^2.0.1", - "uuid": "^8.3.2" - } - }, - "@actions/http-client": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", - "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", - "requires": { - "tunnel": "^0.0.6" - } - }, - "@vercel/ncc": { - "version": "0.34.0", - "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz", - "integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==", - "dev": true - }, - "data-uri-to-buffer": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", - "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==" - }, - "fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "requires": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - } - }, - "formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "requires": { - "fetch-blob": "^3.1.2" - } - }, - "node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==" - }, - "node-fetch": { - "version": "3.2.10", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.10.tgz", - "integrity": "sha512-MhuzNwdURnZ1Cp4XTazr69K0BTizsBroX7Zx3UgDSVcZYKF/6p0CBe4EUb/hLqmzVhl0UpYfgRljQ4yxE+iCxA==", - "requires": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - } - }, - "tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" - }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" - }, - "web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==" - } - } -} diff --git a/github-actions/cancel-outdated-builds/package.json b/github-actions/cancel-outdated-builds/package.json deleted file mode 100644 index d9d3cb498..000000000 --- a/github-actions/cancel-outdated-builds/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "cancel-outdated-builds", - "version": "1.0.0", - "description": "Start a daemon that will cancel the current build if a new commit is pushed to the branch", - "main": "index.js", - "scripts": { - "build": "node_modules/.bin/ncc build --minify index.js" - }, - "author": "", - "license": "MIT", - "dependencies": { - "@actions/core": "^1.10.0", - "node-fetch": "^3.2.0" - }, - "devDependencies": { - "@vercel/ncc": "^0.34.0" - } -} \ No newline at end of file