diff --git a/bun.build.ts b/bun.build.ts new file mode 100644 index 0000000..e18b185 --- /dev/null +++ b/bun.build.ts @@ -0,0 +1,31 @@ +import { $, Glob } from "bun"; +import path from "path"; + +// Cross-platform directory removal +if (process.platform === "win32") { + // await $`cmd /c "rmdir /s /q dist"`; +} else { + await $`rm -rf ./dist`; +} + +// await Bun.build({ +// entrypoints: ["./src/index.ts"], +// env: "inline", +// target: "bun", +// outdir: `./dist`, +// minify: true, +// }); + +// Build all files in src +for (const entrypoint of new Glob("./src/**/*.ts").scanSync()) { + const parts = entrypoint.split(path.sep); + const entrypointPath = path.join(...parts.slice(2, -1)); + + await Bun.build({ + entrypoints: [entrypoint], + target: "bun", + outdir: path.join("dist", entrypointPath), + env: "inline", + minify: true, + }); +} diff --git a/bun.lock b/bun.lock new file mode 100644 index 0000000..210261b --- /dev/null +++ b/bun.lock @@ -0,0 +1,113 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "node-exchange-rates", + "dependencies": { + "fast-xml-parser": "^5.2.0", + "got": "^14.4.7", + "telegraf": "^4.16.3", + }, + "devDependencies": { + "bun-types": "latest", + }, + }, + }, + "packages": { + "@sec-ant/readable-stream": ["@sec-ant/readable-stream@0.4.1", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="], + + "@sindresorhus/is": ["@sindresorhus/is@7.0.1", "", {}, "sha512-QWLl2P+rsCJeofkDNIT3WFmb6NrRud1SUYW8dIhXK/46XFV8Q/g7Bsvib0Askb0reRLe+WYPeeE+l5cH7SlkuQ=="], + + "@szmarczak/http-timer": ["@szmarczak/http-timer@5.0.1", "", { "dependencies": { "defer-to-connect": "^2.0.1" } }, "sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw=="], + + "@telegraf/types": ["@telegraf/types@7.1.0", "", {}, "sha512-kGevOIbpMcIlCDeorKGpwZmdH7kHbqlk/Yj6dEpJMKEQw5lk0KVQY0OLXaCswy8GqlIVLd5625OB+rAntP9xVw=="], + + "@types/http-cache-semantics": ["@types/http-cache-semantics@4.0.4", "", {}, "sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA=="], + + "@types/node": ["@types/node@22.14.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="], + + "@types/ws": ["@types/ws@8.18.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg=="], + + "abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="], + + "buffer-alloc": ["buffer-alloc@1.2.0", "", { "dependencies": { "buffer-alloc-unsafe": "^1.1.0", "buffer-fill": "^1.0.0" } }, "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow=="], + + "buffer-alloc-unsafe": ["buffer-alloc-unsafe@1.1.0", "", {}, "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg=="], + + "buffer-fill": ["buffer-fill@1.0.0", "", {}, "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ=="], + + "bun-types": ["bun-types@1.2.9", "", { "dependencies": { "@types/node": "*", "@types/ws": "*" } }, "sha512-dk/kOEfQbajENN/D6FyiSgOKEuUi9PWfqKQJEgwKrCMWbjS/S6tEXp178mWvWAcUSYm9ArDlWHZKO3T/4cLXiw=="], + + "cacheable-lookup": ["cacheable-lookup@7.0.0", "", {}, "sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w=="], + + "cacheable-request": ["cacheable-request@12.0.1", "", { "dependencies": { "@types/http-cache-semantics": "^4.0.4", "get-stream": "^9.0.1", "http-cache-semantics": "^4.1.1", "keyv": "^4.5.4", "mimic-response": "^4.0.0", "normalize-url": "^8.0.1", "responselike": "^3.0.0" } }, "sha512-Yo9wGIQUaAfIbk+qY0X4cDQgCosecfBe3V9NSyeY4qPC2SAkbCS4Xj79VP8WOzitpJUZKc/wsRCYF5ariDIwkg=="], + + "debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="], + + "decompress-response": ["decompress-response@6.0.0", "", { "dependencies": { "mimic-response": "^3.1.0" } }, "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ=="], + + "defer-to-connect": ["defer-to-connect@2.0.1", "", {}, "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg=="], + + "event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="], + + "fast-xml-parser": ["fast-xml-parser@5.2.0", "", { "dependencies": { "strnum": "^2.0.5" }, "bin": { "fxparser": "src/cli/cli.js" } }, "sha512-Uw9+Mjt4SBRud1IcaYuW/O0lW8SKKdMl5g7g24HiIuyH5fQSD+AVLybSlJtqLYEbytVFjWQa5DMGcNgeksdRBg=="], + + "form-data-encoder": ["form-data-encoder@4.0.2", "", {}, "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw=="], + + "get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="], + + "got": ["got@14.4.7", "", { "dependencies": { "@sindresorhus/is": "^7.0.1", "@szmarczak/http-timer": "^5.0.1", "cacheable-lookup": "^7.0.0", "cacheable-request": "^12.0.1", "decompress-response": "^6.0.0", "form-data-encoder": "^4.0.2", "http2-wrapper": "^2.2.1", "lowercase-keys": "^3.0.0", "p-cancelable": "^4.0.1", "responselike": "^3.0.0", "type-fest": "^4.26.1" } }, "sha512-DI8zV1231tqiGzOiOzQWDhsBmncFW7oQDH6Zgy6pDPrqJuVZMtoSgPLLsBZQj8Jg4JFfwoOsDA8NGtLQLnIx2g=="], + + "http-cache-semantics": ["http-cache-semantics@4.1.1", "", {}, "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ=="], + + "http2-wrapper": ["http2-wrapper@2.2.1", "", { "dependencies": { "quick-lru": "^5.1.1", "resolve-alpn": "^1.2.0" } }, "sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ=="], + + "is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="], + + "json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="], + + "keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="], + + "lowercase-keys": ["lowercase-keys@3.0.0", "", {}, "sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ=="], + + "mimic-response": ["mimic-response@4.0.0", "", {}, "sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg=="], + + "mri": ["mri@1.2.0", "", {}, "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="], + + "normalize-url": ["normalize-url@8.0.1", "", {}, "sha512-IO9QvjUMWxPQQhs60oOu10CRkWCiZzSUkzbXGGV9pviYl1fXYcvkzQ5jV9z8Y6un8ARoVRl4EtC6v6jNqbaJ/w=="], + + "p-cancelable": ["p-cancelable@4.0.1", "", {}, "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg=="], + + "p-timeout": ["p-timeout@4.1.0", "", {}, "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw=="], + + "quick-lru": ["quick-lru@5.1.1", "", {}, "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="], + + "resolve-alpn": ["resolve-alpn@1.2.1", "", {}, "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g=="], + + "responselike": ["responselike@3.0.0", "", { "dependencies": { "lowercase-keys": "^3.0.0" } }, "sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg=="], + + "safe-compare": ["safe-compare@1.1.4", "", { "dependencies": { "buffer-alloc": "^1.2.0" } }, "sha512-b9wZ986HHCo/HbKrRpBJb2kqXMK9CEWIE1egeEvZsYn69ay3kdfl9nG3RyOcR+jInTDf7a86WQ1d4VJX7goSSQ=="], + + "sandwich-stream": ["sandwich-stream@2.0.2", "", {}, "sha512-jLYV0DORrzY3xaz/S9ydJL6Iz7essZeAfnAavsJ+zsJGZ1MOnsS52yRjU3uF3pJa/lla7+wisp//fxOwOH8SKQ=="], + + "strnum": ["strnum@2.0.5", "", {}, "sha512-YAT3K/sgpCUxhxNMrrdhtod3jckkpYwH6JAuwmUdXZsmzH1wUyzTMrrK2wYCEEqlKwrWDd35NeuUkbBy/1iK+Q=="], + + "telegraf": ["telegraf@4.16.3", "", { "dependencies": { "@telegraf/types": "^7.1.0", "abort-controller": "^3.0.0", "debug": "^4.3.4", "mri": "^1.2.0", "node-fetch": "^2.7.0", "p-timeout": "^4.1.0", "safe-compare": "^1.1.4", "sandwich-stream": "^2.0.2" }, "bin": { "telegraf": "lib/cli.mjs" } }, "sha512-yjEu2NwkHlXu0OARWoNhJlIjX09dRktiMQFsM678BAH/PEPVwctzL67+tvXqLCRQQvm3SDtki2saGO9hLlz68w=="], + + "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="], + + "type-fest": ["type-fest@4.39.1", "", {}, "sha512-uW9qzd66uyHYxwyVBYiwS4Oi0qZyUqwjU+Oevr6ZogYiXt99EOYtwvzMSLw1c3lYo2HzJsep/NB23iEVEgjG/w=="], + + "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + + "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="], + + "whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="], + + "decompress-response/mimic-response": ["mimic-response@3.1.0", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="], + } +} diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..5eef522 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,38 @@ +// @bun +var WZ=Object.create;var{getPrototypeOf:YZ,defineProperty:w8,getOwnPropertyNames:VZ}=Object;var GZ=Object.prototype.hasOwnProperty;var S0=($,K,J)=>{J=$!=null?WZ(YZ($)):{};let X=K||!$||!$.__esModule?w8(J,"default",{value:$,enumerable:!0}):J;for(let Z of VZ($))if(!GZ.call(X,Z))w8(X,Z,{get:()=>$[Z],enumerable:!0});return X};var E=($,K)=>()=>(K||$((K={exports:{}}).exports,K),K.exports);var j=import.meta.require;var L8=E((yB,M8)=>{var I0=1000,C0=I0*60,D0=C0*60,M0=D0*24,UZ=M0*7,zZ=M0*365.25;M8.exports=function($,K){K=K||{};var J=typeof $;if(J==="string"&&$.length>0)return BZ($);else if(J==="number"&&isFinite($))return K.long?MZ($):wZ($);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function BZ($){if($=String($),$.length>100)return;var K=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!K)return;var J=parseFloat(K[1]),X=(K[2]||"ms").toLowerCase();switch(X){case"years":case"year":case"yrs":case"yr":case"y":return J*zZ;case"weeks":case"week":case"w":return J*UZ;case"days":case"day":case"d":return J*M0;case"hours":case"hour":case"hrs":case"hr":case"h":return J*D0;case"minutes":case"minute":case"mins":case"min":case"m":return J*C0;case"seconds":case"second":case"secs":case"sec":case"s":return J*I0;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return J;default:return}}function wZ($){var K=Math.abs($);if(K>=M0)return Math.round($/M0)+"d";if(K>=D0)return Math.round($/D0)+"h";if(K>=C0)return Math.round($/C0)+"m";if(K>=I0)return Math.round($/I0)+"s";return $+"ms"}function MZ($){var K=Math.abs($);if(K>=M0)return O1($,K,M0,"day");if(K>=D0)return O1($,K,D0,"hour");if(K>=C0)return O1($,K,C0,"minute");if(K>=I0)return O1($,K,I0,"second");return $+" ms"}function O1($,K,J,X){var Z=K>=J*1.5;return Math.round($/J)+" "+X+(Z?"s":"")}});var R$=E((bB,F8)=>{function LZ($){J.debug=J,J.default=J,J.coerce=V,J.disable=W,J.enable=Z,J.enabled=Y,J.humanize=L8(),J.destroy=z,Object.keys($).forEach((U)=>{J[U]=$[U]}),J.names=[],J.skips=[],J.formatters={};function K(U){let B=0;for(let w=0;w{if(x==="%%")return"%";T++;let w0=J.formatters[A$];if(typeof w0==="function"){let QZ=M[T];x=w0.call(N,QZ),M.splice(T,1),T--}return x}),J.formatArgs.call(N,M),(N.log||J.log).apply(N,M)}if(H.namespace=U,H.useColors=J.useColors(),H.color=J.selectColor(U),H.extend=X,H.destroy=J.destroy,Object.defineProperty(H,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(w!==null)return w;if(F!==J.namespaces)F=J.namespaces,L=J.enabled(U);return L},set:(M)=>{w=M}}),typeof J.init==="function")J.init(H);return H}function X(U,B){let w=J(this.namespace+(typeof B==="undefined"?":":B)+U);return w.log=this.log,w}function Z(U){J.save(U),J.namespaces=U,J.names=[],J.skips=[];let B=(typeof U==="string"?U:"").trim().replace(" ",",").split(",").filter(Boolean);for(let w of B)if(w[0]==="-")J.skips.push(w.slice(1));else J.names.push(w)}function Q(U,B){let w=0,F=0,L=-1,H=0;while(w"-"+B)].join(",");return J.enable(""),U}function Y(U){for(let B of J.skips)if(Q(U,B))return!1;for(let B of J.names)if(Q(U,B))return!0;return!1}function V(U){if(U instanceof Error)return U.stack||U.message;return U}function z(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return J.enable(J.load()),J}F8.exports=LZ});var H8=E((P8,I1)=>{P8.formatArgs=PZ;P8.save=HZ;P8.load=fZ;P8.useColors=FZ;P8.storage=AZ();P8.destroy=(()=>{let $=!1;return()=>{if(!$)$=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();P8.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function FZ(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let $;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&($=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt($[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function PZ($){if($[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+$[0]+(this.useColors?"%c ":" ")+"+"+I1.exports.humanize(this.diff),!this.useColors)return;let K="color: "+this.color;$.splice(1,0,K,"color: inherit");let J=0,X=0;$[0].replace(/%[a-zA-Z%]/g,(Z)=>{if(Z==="%%")return;if(J++,Z==="%c")X=J}),$.splice(X,0,K)}P8.log=console.debug||console.log||(()=>{});function HZ($){try{if($)P8.storage.setItem("debug",$);else P8.storage.removeItem("debug")}catch(K){}}function fZ(){let $;try{$=P8.storage.getItem("debug")}catch(K){}if(!$&&typeof process!=="undefined"&&"env"in process)$=process.env.DEBUG;return $}function AZ(){try{return localStorage}catch($){}}I1.exports=R$()(P8);var{formatters:RZ}=I1.exports;RZ.j=function($){try{return JSON.stringify($)}catch(K){return"[UnexpectedJSONParseError]: "+K.message}}});var E8=E((A8,D1)=>{var IZ=j("tty"),C1=j("util");A8.init=hZ;A8.log=yZ;A8.formatArgs=DZ;A8.save=bZ;A8.load=kZ;A8.useColors=CZ;A8.destroy=C1.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");A8.colors=[6,2,3,4,5,1];try{let $=(()=>{throw new Error("Cannot require module "+"supports-color");})();if($&&($.stderr||$).level>=2)A8.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch($){}A8.inspectOpts=Object.keys(process.env).filter(($)=>{return/^debug_/i.test($)}).reduce(($,K)=>{let J=K.substring(6).toLowerCase().replace(/_([a-z])/g,(Z,Q)=>{return Q.toUpperCase()}),X=process.env[K];if(/^(yes|on|true|enabled)$/i.test(X))X=!0;else if(/^(no|off|false|disabled)$/i.test(X))X=!1;else if(X==="null")X=null;else X=Number(X);return $[J]=X,$},{});function CZ(){return"colors"in A8.inspectOpts?Boolean(A8.inspectOpts.colors):IZ.isatty(process.stderr.fd)}function DZ($){let{namespace:K,useColors:J}=this;if(J){let X=this.color,Z="\x1B[3"+(X<8?X:"8;5;"+X),Q=` ${Z};1m${K} \x1B[0m`;$[0]=Q+$[0].split(` +`).join(` +`+Q),$.push(Z+"m+"+D1.exports.humanize(this.diff)+"\x1B[0m")}else $[0]=_Z()+K+" "+$[0]}function _Z(){if(A8.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function yZ(...$){return process.stderr.write(C1.formatWithOptions(A8.inspectOpts,...$)+` +`)}function bZ($){if($)process.env.DEBUG=$;else delete process.env.DEBUG}function kZ(){return process.env.DEBUG}function hZ($){$.inspectOpts={};let K=Object.keys(A8.inspectOpts);for(let J=0;JK.trim()).join(" ")};f8.O=function($){return this.inspectOpts.colors=this.useColors,C1.inspect($,this.inspectOpts)}});var Q0=E((xB,E$)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)E$.exports=H8();else E$.exports=E8()});var _1=E((q8)=>{Object.defineProperty(q8,"__esModule",{value:!0});q8.indexed=q8.zip=q8.fmtCaption=q8.env=void 0;q8.env=process.env;function mZ($){if(!$)return;let K=$.caption;if(!K||typeof K==="string")return $;let{text:J,entities:X}=K;return{...$,caption:J,...X&&{caption_entities:X,parse_mode:void 0}}}q8.fmtCaption=mZ;function*lZ($,K){let J=$[Symbol.iterator](),X=K[Symbol.iterator](),Z=J.next(),Q=X.next();while(!Z.done){if(yield Z.value,!Q.done)yield Q.value;Z=J.next(),Q=X.next()}while(!Q.done)yield Q.value,Q=X.next()}q8.zip=lZ;function iZ($,K){return new Proxy($,{get:function(J,X,Z){if((typeof X==="string"||typeof X==="number")&&!isNaN(+X))return K.call(J,+X);return Reflect.get(J,X,Z)}})}q8.indexed=iZ});var I8=E((T8)=>{Object.defineProperty(T8,"__esModule",{value:!0});T8.MessageReactions=T8.ReactionList=T8.Digit=void 0;var j8=_1();T8.Digit=new Set(["0","1","2","3","4","5","6","7","8","9"]);var sZ=($)=>{if($.type==="custom_emoji")return`Custom(${$.custom_emoji_id})`;else return $.emoji};class W0{constructor($){this.list=$}static fromArray($=[]){return j8.indexed(new W0($),function(K){return this.list[K]})}static has($,K){if(typeof K==="string")if(T8.Digit.has(K[0]))return $.some((J)=>J.custom_emoji_id===K);else return $.some((J)=>J.emoji===K);return $.some((J)=>{if(J.type==="custom_emoji")return J.custom_emoji_id===K.custom_emoji_id;else if(J.type==="emoji")return J.emoji===K.emoji})}toArray(){return[...this.list]}filter($){return W0.fromArray(this.list.filter($))}has($){return W0.has(this.list,$)}get count(){return this.list.length}[Symbol.iterator](){return this.list[Symbol.iterator]()}[Symbol.for("nodejs.util.inspect.custom")](){return["ReactionList {",this.list.map(sZ).join(", "),"}"].join(" ")}}T8.ReactionList=W0;class q$ extends W0{constructor($){var K,J;super((J=(K=$.update.message_reaction)===null||K===void 0?void 0:K.new_reaction)!==null&&J!==void 0?J:[]);this.ctx=$}static from($){return j8.indexed(new q$($),function(K){return this.list[K]})}get old(){var $;return W0.fromArray(($=this.ctx.update.message_reaction)===null||$===void 0?void 0:$.old_reaction)}get new(){var $;return W0.fromArray(($=this.ctx.update.message_reaction)===null||$===void 0?void 0:$.new_reaction)}get added(){return this.new.filter(($)=>!this.old.has($))}get removed(){return this.old.filter(($)=>!this.new.has($))}get kept(){return this.new.filter(($)=>this.old.has($))}}T8.MessageReactions=q$});var y1=E((F0)=>{var aZ=F0&&F0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(F0,"__esModule",{value:!0});F0.Context=void 0;var eZ=aZ(Q0()),C8=I8(),$7=eZ.default("telegraf:context");class N${constructor($,K,J){this.update=$,this.telegram=K,this.botInfo=J,this.state={}}get updateType(){for(let $ in this.update)if(typeof this.update[$]==="object")return $;throw new Error(`Cannot determine \`updateType\` of ${JSON.stringify(this.update)}`)}get me(){var $;return($=this.botInfo)===null||$===void 0?void 0:$.username}get tg(){return this.telegram}get message(){return this.update.message}get editedMessage(){return this.update.edited_message}get inlineQuery(){return this.update.inline_query}get shippingQuery(){return this.update.shipping_query}get preCheckoutQuery(){return this.update.pre_checkout_query}get chosenInlineResult(){return this.update.chosen_inline_result}get channelPost(){return this.update.channel_post}get editedChannelPost(){return this.update.edited_channel_post}get messageReaction(){return this.update.message_reaction}get messageReactionCount(){return this.update.message_reaction_count}get callbackQuery(){return this.update.callback_query}get poll(){return this.update.poll}get pollAnswer(){return this.update.poll_answer}get myChatMember(){return this.update.my_chat_member}get chatMember(){return this.update.chat_member}get chatJoinRequest(){return this.update.chat_join_request}get chatBoost(){return this.update.chat_boost}get removedChatBoost(){return this.update.removed_chat_boost}get msg(){return _8(this)}get msgId(){return X7(this)}get chat(){var $,K,J,X,Z,Q,W;return(W=(Q=(Z=(X=(J=(K=($=this.msg)!==null&&$!==void 0?$:this.messageReaction)!==null&&K!==void 0?K:this.messageReactionCount)!==null&&J!==void 0?J:this.chatJoinRequest)!==null&&X!==void 0?X:this.chatMember)!==null&&Z!==void 0?Z:this.myChatMember)!==null&&Q!==void 0?Q:this.removedChatBoost)===null||W===void 0?void 0:W.chat}get senderChat(){let $=this.msg;return($===null||$===void 0?void 0:$.has("sender_chat"))&&$.sender_chat}get from(){return J7(this)}get inlineMessageId(){var $,K;return(K=($=this.callbackQuery)!==null&&$!==void 0?$:this.chosenInlineResult)===null||K===void 0?void 0:K.inline_message_id}get passportData(){var $;if(this.message==null)return;if(!("passport_data"in this.message))return;return($=this.message)===null||$===void 0?void 0:$.passport_data}get webAppData(){if(!(this.message&&("web_app_data"in this.message)))return;let{data:$,button_text:K}=this.message.web_app_data;return{data:{json(){return JSON.parse($)},text(){return $}},button_text:K}}get webhookReply(){return this.telegram.webhookReply}set webhookReply($){this.telegram.webhookReply=$}get reactions(){return C8.MessageReactions.from(this)}assert($,K){if($===void 0)throw new TypeError(`Telegraf: "${K}" isn't available for "${this.updateType}"`)}has($){if(!Array.isArray($))$=[$];for(let K of $)if(typeof K!=="string"?K(this.update):(K in this.update))return!0;return!1}get text(){return D8(this)[0]}entities(...$){let[K="",J=[]]=D8(this);return($.length?J.filter((X)=>$.includes(X.type)):J).map((X)=>({...X,fragment:K.slice(X.offset,X.offset+X.length)}))}answerInlineQuery(...$){return this.assert(this.inlineQuery,"answerInlineQuery"),this.telegram.answerInlineQuery(this.inlineQuery.id,...$)}answerCbQuery(...$){return this.assert(this.callbackQuery,"answerCbQuery"),this.telegram.answerCbQuery(this.callbackQuery.id,...$)}answerGameQuery(...$){return this.assert(this.callbackQuery,"answerGameQuery"),this.telegram.answerGameQuery(this.callbackQuery.id,...$)}getUserChatBoosts(){return this.assert(this.chat,"getUserChatBoosts"),this.assert(this.from,"getUserChatBoosts"),this.telegram.getUserChatBoosts(this.chat.id,this.from.id)}answerShippingQuery(...$){return this.assert(this.shippingQuery,"answerShippingQuery"),this.telegram.answerShippingQuery(this.shippingQuery.id,...$)}answerPreCheckoutQuery(...$){return this.assert(this.preCheckoutQuery,"answerPreCheckoutQuery"),this.telegram.answerPreCheckoutQuery(this.preCheckoutQuery.id,...$)}editMessageText($,K){var J,X;return this.assert((J=this.msgId)!==null&&J!==void 0?J:this.inlineMessageId,"editMessageText"),this.telegram.editMessageText((X=this.chat)===null||X===void 0?void 0:X.id,this.msgId,this.inlineMessageId,$,K)}editMessageCaption($,K){var J,X;return this.assert((J=this.msgId)!==null&&J!==void 0?J:this.inlineMessageId,"editMessageCaption"),this.telegram.editMessageCaption((X=this.chat)===null||X===void 0?void 0:X.id,this.msgId,this.inlineMessageId,$,K)}editMessageMedia($,K){var J,X;return this.assert((J=this.msgId)!==null&&J!==void 0?J:this.inlineMessageId,"editMessageMedia"),this.telegram.editMessageMedia((X=this.chat)===null||X===void 0?void 0:X.id,this.msgId,this.inlineMessageId,$,K)}editMessageReplyMarkup($){var K,J;return this.assert((K=this.msgId)!==null&&K!==void 0?K:this.inlineMessageId,"editMessageReplyMarkup"),this.telegram.editMessageReplyMarkup((J=this.chat)===null||J===void 0?void 0:J.id,this.msgId,this.inlineMessageId,$)}editMessageLiveLocation($,K,J){var X,Z;return this.assert((X=this.msgId)!==null&&X!==void 0?X:this.inlineMessageId,"editMessageLiveLocation"),this.telegram.editMessageLiveLocation((Z=this.chat)===null||Z===void 0?void 0:Z.id,this.msgId,this.inlineMessageId,$,K,J)}stopMessageLiveLocation($){var K,J;return this.assert((K=this.msgId)!==null&&K!==void 0?K:this.inlineMessageId,"stopMessageLiveLocation"),this.telegram.stopMessageLiveLocation((J=this.chat)===null||J===void 0?void 0:J.id,this.msgId,this.inlineMessageId,$)}sendMessage($,K){return this.assert(this.chat,"sendMessage"),this.telegram.sendMessage(this.chat.id,$,{message_thread_id:y(this),...K})}reply(...$){return this.sendMessage(...$)}getChat(...$){return this.assert(this.chat,"getChat"),this.telegram.getChat(this.chat.id,...$)}exportChatInviteLink(...$){return this.assert(this.chat,"exportChatInviteLink"),this.telegram.exportChatInviteLink(this.chat.id,...$)}createChatInviteLink(...$){return this.assert(this.chat,"createChatInviteLink"),this.telegram.createChatInviteLink(this.chat.id,...$)}editChatInviteLink(...$){return this.assert(this.chat,"editChatInviteLink"),this.telegram.editChatInviteLink(this.chat.id,...$)}revokeChatInviteLink(...$){return this.assert(this.chat,"revokeChatInviteLink"),this.telegram.revokeChatInviteLink(this.chat.id,...$)}banChatMember(...$){return this.assert(this.chat,"banChatMember"),this.telegram.banChatMember(this.chat.id,...$)}get kickChatMember(){return this.banChatMember}unbanChatMember(...$){return this.assert(this.chat,"unbanChatMember"),this.telegram.unbanChatMember(this.chat.id,...$)}restrictChatMember(...$){return this.assert(this.chat,"restrictChatMember"),this.telegram.restrictChatMember(this.chat.id,...$)}promoteChatMember(...$){return this.assert(this.chat,"promoteChatMember"),this.telegram.promoteChatMember(this.chat.id,...$)}setChatAdministratorCustomTitle(...$){return this.assert(this.chat,"setChatAdministratorCustomTitle"),this.telegram.setChatAdministratorCustomTitle(this.chat.id,...$)}setChatPhoto(...$){return this.assert(this.chat,"setChatPhoto"),this.telegram.setChatPhoto(this.chat.id,...$)}deleteChatPhoto(...$){return this.assert(this.chat,"deleteChatPhoto"),this.telegram.deleteChatPhoto(this.chat.id,...$)}setChatTitle(...$){return this.assert(this.chat,"setChatTitle"),this.telegram.setChatTitle(this.chat.id,...$)}setChatDescription(...$){return this.assert(this.chat,"setChatDescription"),this.telegram.setChatDescription(this.chat.id,...$)}pinChatMessage(...$){return this.assert(this.chat,"pinChatMessage"),this.telegram.pinChatMessage(this.chat.id,...$)}unpinChatMessage(...$){return this.assert(this.chat,"unpinChatMessage"),this.telegram.unpinChatMessage(this.chat.id,...$)}unpinAllChatMessages(...$){return this.assert(this.chat,"unpinAllChatMessages"),this.telegram.unpinAllChatMessages(this.chat.id,...$)}leaveChat(...$){return this.assert(this.chat,"leaveChat"),this.telegram.leaveChat(this.chat.id,...$)}setChatPermissions(...$){return this.assert(this.chat,"setChatPermissions"),this.telegram.setChatPermissions(this.chat.id,...$)}getChatAdministrators(...$){return this.assert(this.chat,"getChatAdministrators"),this.telegram.getChatAdministrators(this.chat.id,...$)}getChatMember(...$){return this.assert(this.chat,"getChatMember"),this.telegram.getChatMember(this.chat.id,...$)}getChatMembersCount(...$){return this.assert(this.chat,"getChatMembersCount"),this.telegram.getChatMembersCount(this.chat.id,...$)}setPassportDataErrors($){return this.assert(this.from,"setPassportDataErrors"),this.telegram.setPassportDataErrors(this.from.id,$)}sendPhoto($,K){return this.assert(this.chat,"sendPhoto"),this.telegram.sendPhoto(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithPhoto(...$){return this.sendPhoto(...$)}sendMediaGroup($,K){return this.assert(this.chat,"sendMediaGroup"),this.telegram.sendMediaGroup(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithMediaGroup(...$){return this.sendMediaGroup(...$)}sendAudio($,K){return this.assert(this.chat,"sendAudio"),this.telegram.sendAudio(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithAudio(...$){return this.sendAudio(...$)}sendDice($){return this.assert(this.chat,"sendDice"),this.telegram.sendDice(this.chat.id,{message_thread_id:y(this),...$})}replyWithDice(...$){return this.sendDice(...$)}sendDocument($,K){return this.assert(this.chat,"sendDocument"),this.telegram.sendDocument(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithDocument(...$){return this.sendDocument(...$)}sendSticker($,K){return this.assert(this.chat,"sendSticker"),this.telegram.sendSticker(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithSticker(...$){return this.sendSticker(...$)}sendVideo($,K){return this.assert(this.chat,"sendVideo"),this.telegram.sendVideo(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithVideo(...$){return this.sendVideo(...$)}sendAnimation($,K){return this.assert(this.chat,"sendAnimation"),this.telegram.sendAnimation(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithAnimation(...$){return this.sendAnimation(...$)}sendVideoNote($,K){return this.assert(this.chat,"sendVideoNote"),this.telegram.sendVideoNote(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithVideoNote(...$){return this.sendVideoNote(...$)}sendInvoice($,K){return this.assert(this.chat,"sendInvoice"),this.telegram.sendInvoice(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithInvoice(...$){return this.sendInvoice(...$)}sendGame($,K){return this.assert(this.chat,"sendGame"),this.telegram.sendGame(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithGame(...$){return this.sendGame(...$)}sendVoice($,K){return this.assert(this.chat,"sendVoice"),this.telegram.sendVoice(this.chat.id,$,{message_thread_id:y(this),...K})}replyWithVoice(...$){return this.sendVoice(...$)}sendPoll($,K,J){return this.assert(this.chat,"sendPoll"),this.telegram.sendPoll(this.chat.id,$,K,{message_thread_id:y(this),...J})}replyWithPoll(...$){return this.sendPoll(...$)}sendQuiz($,K,J){return this.assert(this.chat,"sendQuiz"),this.telegram.sendQuiz(this.chat.id,$,K,{message_thread_id:y(this),...J})}replyWithQuiz(...$){return this.sendQuiz(...$)}stopPoll(...$){return this.assert(this.chat,"stopPoll"),this.telegram.stopPoll(this.chat.id,...$)}sendChatAction($,K){return this.assert(this.chat,"sendChatAction"),this.telegram.sendChatAction(this.chat.id,$,{message_thread_id:y(this),...K})}async persistentChatAction($,K,{intervalDuration:J,...X}={}){await this.sendChatAction($,{...X});let Z=setInterval(()=>this.sendChatAction($,{...X}).catch((Q)=>{$7("Ignored error while persisting sendChatAction:",Q)}),J!==null&&J!==void 0?J:4000);try{await K()}finally{clearInterval(Z)}}replyWithChatAction(...$){return this.sendChatAction(...$)}react($,K){this.assert(this.chat,"setMessageReaction"),this.assert(this.msgId,"setMessageReaction");let J=$?Array.isArray($)?$:[$]:void 0,X=J===null||J===void 0?void 0:J.map((Z)=>typeof Z==="string"?C8.Digit.has(Z[0])?{type:"custom_emoji",custom_emoji_id:Z}:{type:"emoji",emoji:Z}:Z);return this.telegram.setMessageReaction(this.chat.id,this.msgId,X,K)}sendLocation($,K,J){return this.assert(this.chat,"sendLocation"),this.telegram.sendLocation(this.chat.id,$,K,{message_thread_id:y(this),...J})}replyWithLocation(...$){return this.sendLocation(...$)}sendVenue($,K,J,X,Z){return this.assert(this.chat,"sendVenue"),this.telegram.sendVenue(this.chat.id,$,K,J,X,{message_thread_id:y(this),...Z})}replyWithVenue(...$){return this.sendVenue(...$)}sendContact($,K,J){return this.assert(this.chat,"sendContact"),this.telegram.sendContact(this.chat.id,$,K,{message_thread_id:y(this),...J})}replyWithContact(...$){return this.sendContact(...$)}getStickerSet($){return this.telegram.getStickerSet($)}setChatStickerSet($){return this.assert(this.chat,"setChatStickerSet"),this.telegram.setChatStickerSet(this.chat.id,$)}deleteChatStickerSet(){return this.assert(this.chat,"deleteChatStickerSet"),this.telegram.deleteChatStickerSet(this.chat.id)}createForumTopic(...$){return this.assert(this.chat,"createForumTopic"),this.telegram.createForumTopic(this.chat.id,...$)}editForumTopic($){var K;return this.assert(this.chat,"editForumTopic"),this.assert((K=this.message)===null||K===void 0?void 0:K.message_thread_id,"editForumTopic"),this.telegram.editForumTopic(this.chat.id,this.message.message_thread_id,$)}closeForumTopic(){var $;return this.assert(this.chat,"closeForumTopic"),this.assert(($=this.message)===null||$===void 0?void 0:$.message_thread_id,"closeForumTopic"),this.telegram.closeForumTopic(this.chat.id,this.message.message_thread_id)}reopenForumTopic(){var $;return this.assert(this.chat,"reopenForumTopic"),this.assert(($=this.message)===null||$===void 0?void 0:$.message_thread_id,"reopenForumTopic"),this.telegram.reopenForumTopic(this.chat.id,this.message.message_thread_id)}deleteForumTopic(){var $;return this.assert(this.chat,"deleteForumTopic"),this.assert(($=this.message)===null||$===void 0?void 0:$.message_thread_id,"deleteForumTopic"),this.telegram.deleteForumTopic(this.chat.id,this.message.message_thread_id)}unpinAllForumTopicMessages(){var $;return this.assert(this.chat,"unpinAllForumTopicMessages"),this.assert(($=this.message)===null||$===void 0?void 0:$.message_thread_id,"unpinAllForumTopicMessages"),this.telegram.unpinAllForumTopicMessages(this.chat.id,this.message.message_thread_id)}editGeneralForumTopic($){return this.assert(this.chat,"editGeneralForumTopic"),this.telegram.editGeneralForumTopic(this.chat.id,$)}closeGeneralForumTopic(){return this.assert(this.chat,"closeGeneralForumTopic"),this.telegram.closeGeneralForumTopic(this.chat.id)}reopenGeneralForumTopic(){return this.assert(this.chat,"reopenGeneralForumTopic"),this.telegram.reopenGeneralForumTopic(this.chat.id)}hideGeneralForumTopic(){return this.assert(this.chat,"hideGeneralForumTopic"),this.telegram.hideGeneralForumTopic(this.chat.id)}unhideGeneralForumTopic(){return this.assert(this.chat,"unhideGeneralForumTopic"),this.telegram.unhideGeneralForumTopic(this.chat.id)}unpinAllGeneralForumTopicMessages(){return this.assert(this.chat,"unpinAllGeneralForumTopicMessages"),this.telegram.unpinAllGeneralForumTopicMessages(this.chat.id)}setStickerPositionInSet($,K){return this.telegram.setStickerPositionInSet($,K)}setStickerSetThumb(...$){return this.telegram.setStickerSetThumbnail(...$)}setStickerSetThumbnail(...$){return this.telegram.setStickerSetThumbnail(...$)}setStickerMaskPosition(...$){return this.telegram.setStickerMaskPosition(...$)}setStickerKeywords(...$){return this.telegram.setStickerKeywords(...$)}setStickerEmojiList(...$){return this.telegram.setStickerEmojiList(...$)}deleteStickerSet(...$){return this.telegram.deleteStickerSet(...$)}setStickerSetTitle(...$){return this.telegram.setStickerSetTitle(...$)}setCustomEmojiStickerSetThumbnail(...$){return this.telegram.setCustomEmojiStickerSetThumbnail(...$)}deleteStickerFromSet($){return this.telegram.deleteStickerFromSet($)}uploadStickerFile(...$){return this.assert(this.from,"uploadStickerFile"),this.telegram.uploadStickerFile(this.from.id,...$)}createNewStickerSet(...$){return this.assert(this.from,"createNewStickerSet"),this.telegram.createNewStickerSet(this.from.id,...$)}addStickerToSet(...$){return this.assert(this.from,"addStickerToSet"),this.telegram.addStickerToSet(this.from.id,...$)}getMyCommands(){return this.telegram.getMyCommands()}setMyCommands($){return this.telegram.setMyCommands($)}replyWithMarkdown($,K){return this.reply($,{parse_mode:"Markdown",...K})}replyWithMarkdownV2($,K){return this.reply($,{parse_mode:"MarkdownV2",...K})}replyWithHTML($,K){return this.reply($,{parse_mode:"HTML",...K})}deleteMessage($){if(this.assert(this.chat,"deleteMessage"),typeof $!=="undefined")return this.telegram.deleteMessage(this.chat.id,$);return this.assert(this.msgId,"deleteMessage"),this.telegram.deleteMessage(this.chat.id,this.msgId)}deleteMessages($){return this.assert(this.chat,"deleteMessages"),this.telegram.deleteMessages(this.chat.id,$)}forwardMessage($,K){return this.assert(this.chat,"forwardMessage"),this.assert(this.msgId,"forwardMessage"),this.telegram.forwardMessage($,this.chat.id,this.msgId,K)}forwardMessages($,K,J){return this.assert(this.chat,"forwardMessages"),this.telegram.forwardMessages($,this.chat.id,K,J)}copyMessage($,K){return this.assert(this.chat,"copyMessage"),this.assert(this.msgId,"copyMessage"),this.telegram.copyMessage($,this.chat.id,this.msgId,K)}copyMessages($,K,J){var X;return this.assert(this.chat,"copyMessages"),this.telegram.copyMessages($,(X=this.chat)===null||X===void 0?void 0:X.id,K,J)}approveChatJoinRequest($){return this.assert(this.chat,"approveChatJoinRequest"),this.telegram.approveChatJoinRequest(this.chat.id,$)}declineChatJoinRequest($){return this.assert(this.chat,"declineChatJoinRequest"),this.telegram.declineChatJoinRequest(this.chat.id,$)}banChatSenderChat($){return this.assert(this.chat,"banChatSenderChat"),this.telegram.banChatSenderChat(this.chat.id,$)}unbanChatSenderChat($){return this.assert(this.chat,"unbanChatSenderChat"),this.telegram.unbanChatSenderChat(this.chat.id,$)}setChatMenuButton($){return this.assert(this.chat,"setChatMenuButton"),this.telegram.setChatMenuButton({chatId:this.chat.id,menuButton:$})}getChatMenuButton(){return this.assert(this.chat,"getChatMenuButton"),this.telegram.getChatMenuButton({chatId:this.chat.id})}setMyDefaultAdministratorRights($){return this.telegram.setMyDefaultAdministratorRights($)}getMyDefaultAdministratorRights($){return this.telegram.getMyDefaultAdministratorRights($)}}F0.Context=N$;F0.default=N$;var K7={isAccessible(){return"date"in this&&this.date!==0},has(...$){return $.some((K)=>this[K]!=null)}};function _8($){var K,J,X,Z,Q;let W=(Q=(Z=(J=(K=$.message)!==null&&K!==void 0?K:$.editedMessage)!==null&&J!==void 0?J:(X=$.callbackQuery)===null||X===void 0?void 0:X.message)!==null&&Z!==void 0?Z:$.channelPost)!==null&&Q!==void 0?Q:$.editedChannelPost;if(W)return Object.assign(Object.create(K7),W)}function J7($){var K,J,X,Z,Q,W,Y,V,z,U,B,w;if($.callbackQuery)return $.callbackQuery.from;let F=$.msg;if(F===null||F===void 0?void 0:F.has("from"))return F.from;return(V=(Y=(W=(Q=(Z=(X=(J=(K=$.inlineQuery)!==null&&K!==void 0?K:$.shippingQuery)!==null&&J!==void 0?J:$.preCheckoutQuery)!==null&&X!==void 0?X:$.chosenInlineResult)!==null&&Z!==void 0?Z:$.chatMember)!==null&&Q!==void 0?Q:$.myChatMember)!==null&&W!==void 0?W:$.chatJoinRequest)===null||Y===void 0?void 0:Y.from)!==null&&V!==void 0?V:(w=(U=(z=$.messageReaction)!==null&&z!==void 0?z:$.pollAnswer)!==null&&U!==void 0?U:(B=$.chatBoost)===null||B===void 0?void 0:B.boost.source)===null||w===void 0?void 0:w.user}function X7($){var K,J;let X=_8($);return(J=(K=X!==null&&X!==void 0?X:$.messageReaction)!==null&&K!==void 0?K:$.messageReactionCount)===null||J===void 0?void 0:J.message_id}function D8($){let K=$.msg,J,X;if(K){if("text"in K)J=K.text,X=K.entities;else if("caption"in K)J=K.caption,X=K.caption_entities;else if("game"in K)J=K.game.text,X=K.game.text_entities}else if($.poll)J=$.poll.explanation,X=$.poll.explanation_entities;return[J,X]}var y=($)=>{let K=$.msg;return(K===null||K===void 0?void 0:K.isAccessible())?K.is_topic_message?K.message_thread_id:void 0:void 0}});var k8=E((y8)=>{Object.defineProperty(y8,"__esModule",{value:!0});y8.allOf=y8.anyOf=y8.callbackQuery=y8.editedChannelPost=y8.channelPost=y8.editedMessage=y8.message=void 0;var Z7=(...$)=>(K)=>{if(!("message"in K))return!1;for(let J of $)if(!(J in K.message))return!1;return!0};y8.message=Z7;var Q7=(...$)=>(K)=>{if(!("edited_message"in K))return!1;for(let J of $)if(!(J in K.edited_message))return!1;return!0};y8.editedMessage=Q7;var W7=(...$)=>(K)=>{if(!("channel_post"in K))return!1;for(let J of $)if(!(J in K.channel_post))return!1;return!0};y8.channelPost=W7;var Y7=(...$)=>(K)=>{if(!("edited_channel_post"in K))return!1;for(let J of $)if(!(J in K.edited_channel_post))return!1;return!0};y8.editedChannelPost=Y7;var V7=(...$)=>(K)=>{if(!("callback_query"in K))return!1;for(let J of $)if(!(J in K.callback_query))return!1;return!0};y8.callbackQuery=V7;var G7=(...$)=>(K)=>{for(let J of $)if(J(K))return!0;return!1};y8.anyOf=G7;var U7=(...$)=>(K)=>{for(let J of $)if(!J(K))return!1;return!0};y8.allOf=U7});var v8=E((h8)=>{Object.defineProperty(h8,"__esModule",{value:!0});h8.argsParser=void 0;var P7="'",H7='"';function f7($,K=[],J=0){let X={};for(let z of K)if(z.type==="text_mention"||z.type==="text_link")X[z.offset-J]=z.length;let Z=[],Q=0,W=void 0,Y="";function V(z){if(Q!==z)Z.push(Y+$.slice(Q,z)),W=void 0;Y="",Q=z+1}for(let z=0;z<$.length;z++){let U=$[z],B=X[z];if(B)V(z),Q--,z+=B,V(z);else if(U===P7||U===H7)if(W)if(W===U)V(z);else continue;else V(z),W=U;else if(U===" ")if(W)continue;else V(z);else if(U===` +`)V(z);else if(U==="\\")Y+=$.slice(Q,z),Q=++z;else continue}if(Q<$.length)V($.length);return Z}h8.argsParser=f7});var Y0=E((P0)=>{var A7=P0&&P0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(P0,"__esModule",{value:!0});P0.Composer=void 0;var R7=A7(y1()),g8=k8(),E7=v8();function q7($){return()=>$}var b1=q7(Promise.resolve());class A{constructor(...$){this.handler=A.compose($)}use(...$){return this.handler=A.compose([this.handler,...$]),this}guard($,...K){return this.use(A.guard($,...K))}on($,...K){return this.use(A.on($,...K))}hears($,...K){return this.use(A.hears($,...K))}command($,...K){return this.use(A.command($,...K))}action($,...K){return this.use(A.action($,...K))}inlineQuery($,...K){return this.use(A.inlineQuery($,...K))}gameQuery(...$){return this.use(A.gameQuery(...$))}reaction($,...K){return this.use(A.reaction($,...K))}drop($){return this.use(A.drop($))}filter($){return this.use(A.filter($))}entity($,...K){return this.use(A.entity($,...K))}email($,...K){return this.use(A.email($,...K))}url($,...K){return this.use(A.url($,...K))}textLink($,...K){return this.use(A.textLink($,...K))}textMention($,...K){return this.use(A.textMention($,...K))}mention($,...K){return this.use(A.mention($,...K))}phone($,...K){return this.use(A.phone($,...K))}hashtag($,...K){return this.use(A.hashtag($,...K))}cashtag($,...K){return this.use(A.cashtag($,...K))}spoiler($,...K){return this.use(A.spoiler($,...K))}start(...$){let K=A.compose($);return this.command("start",(J,X)=>K(Object.assign(J,{startPayload:J.payload}),X))}help(...$){return this.command("help",...$)}settings(...$){return this.command("settings",...$)}middleware(){return this.handler}static reply(...$){return(K)=>K.reply(...$)}static catch($,...K){let J=A.compose(K);return(X,Z)=>Promise.resolve(J(X,Z)).catch((Q)=>$(Q,X))}static fork($){let K=A.unwrap($);return async(J,X)=>{await Promise.all([K(J,b1),X()])}}static tap($){let K=A.unwrap($);return(J,X)=>Promise.resolve(K(J,b1)).then(()=>X())}static passThru(){return($,K)=>K()}static lazy($){if(typeof $!=="function")throw new Error("Argument must be a function");return(K,J)=>Promise.resolve($(K)).then((X)=>A.unwrap(X)(K,J))}static log($=console.log){return(K,J)=>{return $(JSON.stringify(K.update,null,2)),J()}}static branch($,K,J){if(typeof $!=="function")return A.unwrap($?K:J);return A.lazy((X)=>Promise.resolve($(X)).then((Z)=>Z?K:J))}static optional($,...K){return A.branch($,A.compose(K),A.passThru())}static filter($){return A.branch($,A.passThru(),b1)}static drop($){return A.branch($,b1,A.passThru())}static dispatch($,K){return A.lazy((J)=>Promise.resolve($(J)).then((X)=>K[X]))}static guard($,...K){return A.optional((J)=>$(J.update),...K)}static on($,...K){let J=Array.isArray($)?$:[$],X=(Z)=>{for(let Q of J)if(typeof Q!=="string"?Q(Z):(Q in Z)||("message"in Z)&&(Q in Z.message))return!0;return!1};return A.optional((Z)=>X(Z.update),...K)}static entity($,...K){if(typeof $!=="function"){let J=h1($);return A.entity(({type:X})=>J.includes(X),...K)}return A.optional((J)=>{var X;let Z=(X=J.message)!==null&&X!==void 0?X:J.channelPost;if(Z===void 0)return!1;let Q=k1(Z),W=j7(Z);if(Q===void 0)return!1;return W.some((Y)=>$(Y,Q.substring(Y.offset,Y.offset+Y.length),J))},...K)}static entityText($,K,...J){if(J.length===0)return Array.isArray(K)?A.entity($,...K):A.entity($,K);let X=s0(K);return A.entity(({type:Z},Q,W)=>{if(Z!==$)return!1;for(let Y of X)if(W.match=Y(Q,W))return!0;return!1},...J)}static email($,...K){return A.entityText("email",$,...K)}static phone($,...K){return A.entityText("phone_number",$,...K)}static url($,...K){return A.entityText("url",$,...K)}static textLink($,...K){return A.entityText("text_link",$,...K)}static textMention($,...K){return A.entityText("text_mention",$,...K)}static mention($,...K){return A.entityText("mention",h1($,"@"),...K)}static hashtag($,...K){return A.entityText("hashtag",h1($,"#"),...K)}static cashtag($,...K){return A.entityText("cashtag",h1($,"$"),...K)}static spoiler($,...K){return A.entityText("spoiler",$,...K)}static match($,...K){let J=A.compose(K);return(X,Z)=>{var Q,W,Y,V;let z=(Y=(W=(Q=k1(X.message))!==null&&Q!==void 0?Q:k1(X.channelPost))!==null&&W!==void 0?W:k1(X.callbackQuery))!==null&&Y!==void 0?Y:(V=X.inlineQuery)===null||V===void 0?void 0:V.query;if(z===void 0)return Z();for(let U of $){let B=U(z,X);if(B)return J(Object.assign(X,{match:B}),Z)}return Z()}}static hears($,...K){return A.on("text",A.match(s0($),...K))}static command($,...K){if(K.length===0)return A.entity("bot_command",$);let J=s0($),X=g8.message("text"),Z=A.compose(K);return A.on(X,(Q,W)=>{let{entities:Y}=Q.message,V=Y===null||Y===void 0?void 0:Y[0];if((V===null||V===void 0?void 0:V.type)!=="bot_command")return W();if(V.offset>0)return W();let z=V.length,U=Q.message.text,[B,w]=U.slice(0,z).split("@");if(!B)return W();if(w&&w.toLowerCase()!==Q.me.toLowerCase())return W();let F=B.slice(1);for(let L of J){let H=L(F,Q);if(H){let M=z+1,N=U.slice(M),R=Object.assign(Q,{match:H,command:F,payload:N,args:[]}),q=void 0;return Object.defineProperty(R,"args",{enumerable:!0,configurable:!0,get(){if(q!=null)return q;return q=E7.argsParser(N,Y,M)},set(T){q=T}}),Z(R,W)}}return W()})}static action($,...K){return A.on("callback_query",A.match(s0($),...K))}static inlineQuery($,...K){return A.on("inline_query",A.match(s0($),...K))}static reaction($,...K){let J=Array.isArray($)?$:[$],X=A.compose(K);return A.on("message_reaction",(Z,Q)=>{let W=J.find((Y)=>typeof Y==="string"&&Y.startsWith("-")?Z.reactions.removed.has(Y.slice(1)):Z.reactions.added.has(Y));if(W)return X(Object.assign(Z,{match:W}),Q);return Q()})}static acl($,...K){if(typeof $==="function")return A.optional($,...K);let J=Array.isArray($)?$:[$];return A.optional((X)=>!X.from||J.includes(X.from.id),...K)}static memberStatus($,...K){let J=Array.isArray($)?$:[$];return A.optional(async(X)=>{if(X.message===void 0)return!1;let Z=await X.getChatMember(X.message.from.id);return J.includes(Z.status)},...K)}static admin(...$){return A.memberStatus(["administrator","creator"],...$)}static creator(...$){return A.memberStatus("creator",...$)}static chatType($,...K){let J=Array.isArray($)?$:[$];return A.optional((X)=>{let Z=X.chat;return Z!==void 0&&J.includes(Z.type)},...K)}static privateChat(...$){return A.chatType("private",...$)}static groupChat(...$){return A.chatType(["group","supergroup"],...$)}static gameQuery(...$){return A.guard(g8.callbackQuery("game_short_name"),...$)}static unwrap($){if(!$)throw new Error("Handler is undefined");return"middleware"in $?$.middleware():$}static compose($){if(!Array.isArray($))throw new Error("Middlewares must be an array");if($.length===0)return A.passThru();if($.length===1)return A.unwrap($[0]);return(K,J)=>{let X=-1;return Z(0,K);async function Z(Q,W){var Y;if(!(W instanceof R7.default))throw new Error("next(ctx) called with invalid context");if(Q<=X)throw new Error("next() called multiple times");X=Q,await A.unwrap((Y=$[Q])!==null&&Y!==void 0?Y:J)(W,async(z=W)=>{await Z(Q+1,z)})}}}}P0.Composer=A;A.mount=A.on;function N7($){return $.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function s0($){if(!Array.isArray($))$=[$];return $.map((K)=>{if(!K)throw new Error("Invalid trigger");if(typeof K==="function")return K;if(K instanceof RegExp)return(X="")=>{return K.lastIndex=0,K.exec(X)};let J=new RegExp(`^${N7(K)}$`);return(X)=>J.exec(X)})}function j7($){var K,J;if($==null)return[];if("caption_entities"in $)return(K=$.caption_entities)!==null&&K!==void 0?K:[];if("entities"in $)return(J=$.entities)!==null&&J!==void 0?J:[];return[]}function k1($){if($==null)return;if("caption"in $)return $.caption;if("text"in $)return $.text;if("data"in $)return $.data;if("game_short_name"in $)return $.game_short_name;return}function h1($,K=""){return(Array.isArray($)?$:[$]).filter(Boolean).map((X)=>K&&typeof X==="string"&&!X.startsWith(K)?`${K}${X}`:X)}P0.default=A});var j$=E((c8)=>{Object.defineProperty(c8,"__esModule",{value:!0});c8.compactOptions=void 0;function T7($){if(!$)return $;let K={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J)&&$[J]!==void 0)K[J]=$[J];return K}c8.compactOptions=T7});var u8=E((t0)=>{var O7=t0&&t0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(t0,"__esModule",{value:!0});var S7=O7(Q0()),x1=S7.default("telegraf:webhook");function I7($,K){return async(J,X,Z=()=>{X.statusCode=403,x1("Replying with status code",X.statusCode),X.end()})=>{if(x1("Incoming request",J.method,J.url),!$(J))return x1("Webhook filter failed",J.method,J.url),Z();let Q;try{if(J.body!=null){let W=J.body;if(W instanceof Buffer)W=String(J.body);if(typeof W==="string")W=JSON.parse(W);Q=W}else{let W="";for await(let Y of J)W+=String(Y);Q=JSON.parse(W)}}catch(W){X.writeHead(415).end(),x1("Failed to parse request body:",W);return}return await K(Q,X)}}t0.default=I7});var v1=E((p8)=>{Object.defineProperty(p8,"__esModule",{value:!0});p8.TelegramError=void 0;class T$ extends Error{constructor($,K={}){super(`${$.error_code}: ${$.description}`);this.response=$,this.on=K}get code(){return this.response.error_code}get description(){return this.response.description}get parameters(){return this.response.parameters}}p8.TelegramError=T$;p8.default=T$});var n8=E((_0)=>{var l8=_0&&_0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(_0,"__esModule",{value:!0});_0.Polling=void 0;var D7=l8(j("abort-controller")),_7=l8(Q0()),y7=j("util"),O$=v1(),g1=_7.default("telegraf:polling"),b7=y7.promisify(setTimeout);function k7($){return()=>$}var h7=k7(Promise.resolve());class i8{constructor($,K){this.telegram=$,this.allowedUpdates=K,this.abortController=new D7.default,this.skipOffsetSync=!1,this.offset=0}async*[Symbol.asyncIterator](){var $,K;g1("Starting long polling");do try{let J=await this.telegram.callApi("getUpdates",{timeout:50,offset:this.offset,allowed_updates:this.allowedUpdates},this.abortController),X=J[J.length-1];if(X!==void 0)this.offset=X.update_id+1;yield J}catch(J){let X=J;if(X.name==="AbortError")return;if(X.name==="FetchError"||X instanceof O$.TelegramError&&X.code===429||X instanceof O$.TelegramError&&X.code>=500){let Z=(K=($=X.parameters)===null||$===void 0?void 0:$.retry_after)!==null&&K!==void 0?K:5;g1("Failed to fetch updates, retrying after %ds.",Z,X),await b7(Z*1000);continue}if(X instanceof O$.TelegramError&&(X.code===401||X.code===409))throw this.skipOffsetSync=!0,X;throw X}while(!this.abortController.signal.aborted)}async syncUpdateOffset(){if(this.skipOffsetSync)return;g1("Syncing update offset..."),await this.telegram.callApi("getUpdates",{offset:this.offset,limit:1})}async loop($){if(this.abortController.signal.aborted)throw new Error("Polling instances must not be reused!");try{for await(let K of this)await Promise.all(K.map($))}finally{g1("Long polling stopped"),this.stop(),await this.syncUpdateOffset().catch(h7)}}stop(){this.abortController.abort()}}_0.Polling=i8});var r8=E((oB,c1)=>{class S$ extends Error{constructor($){super($);this.name="TimeoutError"}}var o8=($,K,J,X)=>{let Z,Q=new Promise((W,Y)=>{if(typeof K!=="number"||K<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(K===1/0){W($);return}X={customTimers:{setTimeout,clearTimeout},...X},Z=X.customTimers.setTimeout.call(void 0,()=>{if(typeof J==="function"){try{W(J())}catch(U){Y(U)}return}let V=typeof J==="string"?J:`Promise timed out after ${K} milliseconds`,z=J instanceof Error?J:new S$(V);if(typeof $.cancel==="function")$.cancel();Y(z)},K),(async()=>{try{W(await $)}catch(V){Y(V)}finally{X.customTimers.clearTimeout.call(void 0,Z)}})()});return Q.clear=()=>{clearTimeout(Z),Z=void 0},Q};c1.exports=o8;c1.exports.default=o8;c1.exports.TimeoutError=S$});var d1=E((t8)=>{Object.defineProperty(t8,"__esModule",{value:!0});t8.is2D=t8.hasPropType=t8.hasProp=void 0;function s8($,K){return $!==void 0&&K in $}t8.hasProp=s8;function x7($,K,J){return s8($,K)&&J===typeof $[K]}t8.hasPropType=x7;function v7($){return Array.isArray($[0])}t8.is2D=v7});var $K=E((e8)=>{Object.defineProperty(e8,"__esModule",{value:!0});var d7=j("stream");/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */function u7($,K){var J={};for(var X in $)if(Object.prototype.hasOwnProperty.call($,X)&&K.indexOf(X)<0)J[X]=$[X];if($!=null&&typeof Object.getOwnPropertySymbols==="function"){for(var Z=0,X=Object.getOwnPropertySymbols($);Z{var l7=n&&n.__createBinding||(Object.create?function($,K,J,X){if(X===void 0)X=J;var Z=Object.getOwnPropertyDescriptor(K,J);if(!Z||("get"in Z?!K.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return K[J]}};Object.defineProperty($,X,Z)}:function($,K,J,X){if(X===void 0)X=J;$[X]=K[J]}),i7=n&&n.__setModuleDefault||(Object.create?function($,K){Object.defineProperty($,"default",{enumerable:!0,value:K})}:function($,K){$.default=K}),n7=n&&n.__importStar||function($){if($&&$.__esModule)return $;var K={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))l7(K,$,J)}return i7(K,$),K},o7=n&&n.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(n,"__esModule",{value:!0});var r7=n7(j("stream")),s7=d1(),t7=o7($K()),y0=`\r +`;class C$ extends t7.default{constructor($){super({head:`--${$}${y0}`,tail:`${y0}--${$}--`,separator:`${y0}--${$}${y0}`})}addPart($){let K=new r7.PassThrough;for(let[J,X]of Object.entries($.headers))K.write(`${J}:${X}${y0}`);if(K.write(y0),C$.isStream($.body))$.body.pipe(K);else K.end($.body);this.add(K)}static isStream($){return typeof $==="object"&&$!==null&&s7.hasPropType($,"pipe","function")}}n.default=C$});var VK=E((o)=>{var a7=o&&o.__createBinding||(Object.create?function($,K,J,X){if(X===void 0)X=J;var Z=Object.getOwnPropertyDescriptor(K,J);if(!Z||("get"in Z?!K.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return K[J]}};Object.defineProperty($,X,Z)}:function($,K,J,X){if(X===void 0)X=J;$[X]=K[J]}),e7=o&&o.__setModuleDefault||(Object.create?function($,K){Object.defineProperty($,"default",{enumerable:!0,value:K})}:function($,K){$.default=K}),u1=o&&o.__importStar||function($){if($&&$.__esModule)return $;var K={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))a7(K,$,J)}return e7(K,$),K},y$=o&&o.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(o,"__esModule",{value:!0});var e0=u1(j("crypto")),$Q=u1(j("fs")),JK=j("fs/promises"),KQ=u1(j("https")),JQ=u1(j("path")),XK=y$(j("node-fetch")),V0=d1(),XQ=j$(),ZK=y$(KK()),D$=y$(v1()),ZQ=j("url"),_$=Q0()("telegraf:client"),{isStream:QQ}=ZK.default,WQ=new Set(["answerCallbackQuery","answerInlineQuery","deleteMessage","leaveChat","sendChatAction"]),YQ={audio:"mp3",photo:"jpg",sticker:"webp",video:"mp4",animation:"mp4",video_note:"mp4",voice:"ogg"},VQ={apiRoot:"https://api.telegram.org",apiMode:"bot",webhookReply:!0,agent:new KQ.Agent({keepAlive:!0,keepAliveMsecs:1e4}),attachmentAgent:void 0,testEnv:!1};function QK($){return Object.entries($).some(([K,J])=>{if(K==="link_preview_options")return!1;if(Array.isArray(J))return J.some(({media:X})=>X&&typeof X==="object"&&(X.source||X.url));return J&&typeof J==="object"&&(V0.hasProp(J,"source")&&J.source||V0.hasProp(J,"url")&&J.url||V0.hasPropType(J,"media","object")&&(V0.hasProp(J.media,"source")&&J.media.source||V0.hasProp(J.media,"url")&&J.media.url))})}function GQ($,K){if(K==null)return;return K}function UQ($){return Promise.resolve({method:"POST",compress:!0,headers:{"content-type":"application/json",connection:"keep-alive"},body:JSON.stringify($,GQ)})}var zQ=["results","reply_markup","mask_position","shipping_options","errors"];async function WK($,K){for(let Z of zQ)if(V0.hasProp($,Z)&&typeof $[Z]!=="string")$[Z]=JSON.stringify($[Z]);let J=e0.randomBytes(32).toString("hex"),X=new ZK.default(J);return await Promise.all(Object.keys($).map((Z)=>BQ(X,Z,$[Z],K))),{method:"POST",compress:!0,headers:{"content-type":`multipart/form-data; boundary=${J}`,connection:"keep-alive"},body:X}}async function BQ($,K,J,X){if(J==null)return;if(typeof J==="string"||typeof J==="boolean"||typeof J==="number"){$.addPart({headers:{"content-disposition":`form-data; name="${K}"`},body:`${J}`});return}if(K==="thumb"||K==="thumbnail"){let Z=e0.randomBytes(16).toString("hex");return await a0($,J,Z,X),$.addPart({headers:{"content-disposition":`form-data; name="${K}"`},body:`attach://${Z}`})}if(Array.isArray(J)){let Z=await Promise.all(J.map(async(Q)=>{var W;if(typeof Q.media!=="object")return await Promise.resolve(Q);let Y=e0.randomBytes(16).toString("hex");await a0($,Q.media,Y,X);let V=(W=Q.thumb)!==null&&W!==void 0?W:Q.thumbnail;if(typeof V==="object"){let z=e0.randomBytes(16).toString("hex");return await a0($,V,z,X),{...Q,media:`attach://${Y}`,thumbnail:`attach://${z}`}}return{...Q,media:`attach://${Y}`}}));return $.addPart({headers:{"content-disposition":`form-data; name="${K}"`},body:JSON.stringify(Z)})}if(J&&typeof J==="object"&&V0.hasProp(J,"media")&&V0.hasProp(J,"type")&&typeof J.media!=="undefined"&&typeof J.type!=="undefined"){let Z=e0.randomBytes(16).toString("hex");return await a0($,J.media,Z,X),$.addPart({headers:{"content-disposition":`form-data; name="${K}"`},body:JSON.stringify({...J,media:`attach://${Z}`})})}return await a0($,J,K,X)}async function a0($,K,J,X){var Z,Q,W;let Y=(Z=K.filename)!==null&&Z!==void 0?Z:`${J}.${(Q=YQ[J])!==null&&Q!==void 0?Q:"dat"}`;if("url"in K&&K.url!==void 0){let z=await XK.default(K.url,{agent:X,timeout:500000});return $.addPart({headers:{"content-disposition":`form-data; name="${J}"; filename="${Y}"`},body:z.body})}if("source"in K&&K.source){let V=K.source;if(typeof K.source==="string"){let z=await JK.realpath(K.source);if((await JK.stat(z)).isFile())Y=(W=K.filename)!==null&&W!==void 0?W:JQ.basename(K.source),V=await $Q.createReadStream(K.source);else throw new TypeError(`Unable to upload '${K.source}', not a file`)}if(QQ(V)||Buffer.isBuffer(V))$.addPart({headers:{"content-disposition":`form-data; name="${J}"; filename="${Y}"`},body:V})}}async function wQ($,K,J){if(!QK(K)){if(!$.headersSent)$.setHeader("content-type","application/json");return $.end(JSON.stringify(K),"utf-8"),!0}let{headers:X,body:Z}=await WK(K,J.attachmentAgent);if(!$.headersSent)for(let[Q,W]of Object.entries(X))$.setHeader(Q,W);return await new Promise((Q)=>{$.on("finish",Q),Z.pipe($)}),!0}function MQ($){throw $.message=$.message.replace(/\/(bot|user)(\d+):[^/]+\//,"/$1$2:[REDACTED]/"),$}class YK{constructor($,K,J){if(this.token=$,this.response=J,this.options={...VQ,...XQ.compactOptions(K)},this.options.apiRoot.startsWith("http://"))this.options.agent=void 0}set webhookReply($){this.options.webhookReply=$}get webhookReply(){return this.options.webhookReply}async callApi($,K,{signal:J}={}){let{token:X,options:Z,response:Q}=this;if(Z.webhookReply&&(Q===null||Q===void 0?void 0:Q.writableEnded)===!1&&WQ.has($))return _$("Call via webhook",$,K),await wQ(Q,{method:$,...K},Z);if(!X)throw new D$.default({error_code:401,description:"Bot Token is required"});_$("HTTP call",$,K);let W=QK(K)?await WK({method:$,...K},Z.attachmentAgent):await UQ(K),Y=new ZQ.URL(`./${Z.apiMode}${X}${Z.testEnv?"/test":""}/${$}`,Z.apiRoot);W.agent=Z.agent,W.signal=J,W.timeout=500000;let V=await XK.default(Y,W).catch(MQ);if(V.status>=500){let U={error_code:V.status,description:V.statusText};throw new D$.default(U,{method:$,payload:K})}let z=await V.json();if(!z.ok)throw _$("API call failed",z),new D$.default(z,{method:$,payload:K});return z.result}}o.default=YK});var wK=E((UK)=>{Object.defineProperty(UK,"__esModule",{value:!0});UK.linkOrMention=UK.createFmt=UK.join=UK.FmtString=void 0;var LQ=_1();class G0{constructor($,K){if(this.text=$,K)this.entities=K,this.parse_mode=void 0}static normalise($){if($ instanceof G0)return $;return new G0(String($))}}UK.FmtString=G0;var FQ=Array.isArray,GK=($,K)=>{var J;let X=$.text.length;if(K instanceof G0){$.text=`${$.text}${K.text}`;for(let Z=0;Z<(((J=K.entities)===null||J===void 0?void 0:J.length)||0);Z++){let Q=K.entities[Z];$.entities.push({...Q,offset:Q.offset+X})}}else $.text=`${$.text}${K}`},PQ=($,K)=>{let J=new G0("");J.entities=[];let X=$[Symbol.iterator](),Z=X.next();while(!Z.done)if(GK(J,Z.value),Z=X.next(),K&&!Z.done)GK(J,K);if(J.entities.length)J.parse_mode=void 0;else delete J.entities;return J};UK.join=PQ;function HQ($,K){return function J(X,...Z){var Q;X=FQ(X)?X:[X];let W=UK.join(LQ.zip(X,Z));if($)(Q=W.entities)!==null&&Q!==void 0||(W.entities=[]),W.entities.unshift({type:$,offset:0,length:W.text.length,...K}),W.parse_mode=void 0;return W}}UK.createFmt=HQ;var fQ=($,K)=>{let{text:J,entities:X=[]}=G0.normalise($);return X.unshift(Object.assign(K,{offset:0,length:J.length})),new G0(J,X)};UK.linkOrMention=fQ});var k$=E((b$)=>{Object.defineProperty(b$,"__esModule",{value:!0});b$.mention=b$.link=b$.pre=b$.code=b$.quote=b$.underline=b$.strikethrough=b$.spoiler=b$.italic=b$.bold=b$.fmt=b$.join=b$.FmtString=void 0;var p=wK();Object.defineProperty(b$,"FmtString",{enumerable:!0,get:function(){return p.FmtString}});b$.join=p.join;b$.fmt=p.createFmt();b$.bold=p.createFmt("bold");b$.italic=p.createFmt("italic");b$.spoiler=p.createFmt("spoiler");b$.strikethrough=p.createFmt("strikethrough");b$.underline=p.createFmt("underline");b$.quote=p.createFmt("blockquote");b$.code=p.createFmt("code");var EQ=($)=>p.createFmt("pre",{language:$});b$.pre=EQ;var qQ=($,K)=>p.linkOrMention($,{type:"text_link",url:K});b$.link=qQ;var NQ=($,K)=>typeof K==="number"?b$.link($,"tg://user?id="+K):p.linkOrMention($,{type:"text_mention",user:K});b$.mention=NQ});var x$=E((H0)=>{var kQ=H0&&H0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(H0,"__esModule",{value:!0});H0.Telegram=void 0;var hQ=kQ(VK()),xQ=j("path"),FK=j("url"),PK=k$(),K0=_1();class h$ extends hQ.default{getMe(){return this.callApi("getMe",{})}getFile($){return this.callApi("getFile",{file_id:$})}async getFileLink($){if(typeof $==="string")$=await this.getFile($);else if($.file_path===void 0)$=await this.getFile($.file_id);if($.file_path!==void 0&&xQ.isAbsolute($.file_path)){let K=new FK.URL(this.options.apiRoot);return K.port="",K.pathname=$.file_path,K.protocol="file:",K}return new FK.URL(`./file/${this.options.apiMode}${this.token}${this.options.testEnv?"/test":""}/${$.file_path}`,this.options.apiRoot)}getUpdates($,K,J,X){return this.callApi("getUpdates",{allowed_updates:X,limit:K,offset:J,timeout:$})}getWebhookInfo(){return this.callApi("getWebhookInfo",{})}getGameHighScores($,K,J,X){return this.callApi("getGameHighScores",{user_id:$,inline_message_id:K,chat_id:J,message_id:X})}setGameScore($,K,J,X,Z,Q=!0,W=!1){return this.callApi("setGameScore",{force:W,score:K,user_id:$,inline_message_id:J,chat_id:X,message_id:Z,disable_edit_message:!Q})}setWebhook($,K){return this.callApi("setWebhook",{url:$,...K})}deleteWebhook($){return this.callApi("deleteWebhook",{...$})}sendMessage($,K,J){let X=PK.FmtString.normalise(K);return this.callApi("sendMessage",{chat_id:$,...J,...X})}forwardMessage($,K,J,X){return this.callApi("forwardMessage",{chat_id:$,from_chat_id:K,message_id:J,...X})}forwardMessages($,K,J,X){return this.callApi("forwardMessages",{chat_id:$,from_chat_id:K,message_ids:J,...X})}sendChatAction($,K,J){return this.callApi("sendChatAction",{chat_id:$,action:K,...J})}setMessageReaction($,K,J,X){return this.callApi("setMessageReaction",{chat_id:$,message_id:K,reaction:J,is_big:X})}getUserProfilePhotos($,K,J){return this.callApi("getUserProfilePhotos",{user_id:$,offset:K,limit:J})}sendLocation($,K,J,X){return this.callApi("sendLocation",{chat_id:$,latitude:K,longitude:J,...X})}sendVenue($,K,J,X,Z,Q){return this.callApi("sendVenue",{latitude:K,longitude:J,title:X,address:Z,chat_id:$,...Q})}sendInvoice($,K,J){return this.callApi("sendInvoice",{chat_id:$,...K,...J})}sendContact($,K,J,X){return this.callApi("sendContact",{chat_id:$,phone_number:K,first_name:J,...X})}sendPhoto($,K,J){return this.callApi("sendPhoto",{chat_id:$,photo:K,...K0.fmtCaption(J)})}sendDice($,K){return this.callApi("sendDice",{chat_id:$,...K})}sendDocument($,K,J){return this.callApi("sendDocument",{chat_id:$,document:K,...K0.fmtCaption(J)})}sendAudio($,K,J){return this.callApi("sendAudio",{chat_id:$,audio:K,...K0.fmtCaption(J)})}sendSticker($,K,J){return this.callApi("sendSticker",{chat_id:$,sticker:K,...J})}sendVideo($,K,J){return this.callApi("sendVideo",{chat_id:$,video:K,...K0.fmtCaption(J)})}sendAnimation($,K,J){return this.callApi("sendAnimation",{chat_id:$,animation:K,...K0.fmtCaption(J)})}sendVideoNote($,K,J){return this.callApi("sendVideoNote",{chat_id:$,video_note:K,...J})}sendVoice($,K,J){return this.callApi("sendVoice",{chat_id:$,voice:K,...K0.fmtCaption(J)})}sendGame($,K,J){return this.callApi("sendGame",{chat_id:$,game_short_name:K,...J})}sendMediaGroup($,K,J){return this.callApi("sendMediaGroup",{chat_id:$,media:K,...J})}sendPoll($,K,J,X){return this.callApi("sendPoll",{chat_id:$,type:"regular",question:K,options:J,...X})}sendQuiz($,K,J,X){return this.callApi("sendPoll",{chat_id:$,type:"quiz",question:K,options:J,...X})}stopPoll($,K,J){return this.callApi("stopPoll",{chat_id:$,message_id:K,...J})}getChat($){return this.callApi("getChat",{chat_id:$})}getChatAdministrators($){return this.callApi("getChatAdministrators",{chat_id:$})}getChatMember($,K){return this.callApi("getChatMember",{chat_id:$,user_id:K})}getChatMembersCount($){return this.callApi("getChatMembersCount",{chat_id:$})}answerInlineQuery($,K,J){return this.callApi("answerInlineQuery",{inline_query_id:$,results:K,...J})}setChatPermissions($,K,J){return this.callApi("setChatPermissions",{chat_id:$,permissions:K,...J})}banChatMember($,K,J,X){return this.callApi("banChatMember",{chat_id:$,user_id:K,until_date:J,...X})}get kickChatMember(){return this.banChatMember}promoteChatMember($,K,J){return this.callApi("promoteChatMember",{chat_id:$,user_id:K,...J})}restrictChatMember($,K,J){return this.callApi("restrictChatMember",{chat_id:$,user_id:K,...J})}setChatAdministratorCustomTitle($,K,J){return this.callApi("setChatAdministratorCustomTitle",{chat_id:$,user_id:K,custom_title:J})}exportChatInviteLink($){return this.callApi("exportChatInviteLink",{chat_id:$})}createChatInviteLink($,K){return this.callApi("createChatInviteLink",{chat_id:$,...K})}createInvoiceLink($){return this.callApi("createInvoiceLink",{...$})}editChatInviteLink($,K,J){return this.callApi("editChatInviteLink",{chat_id:$,invite_link:K,...J})}revokeChatInviteLink($,K){return this.callApi("revokeChatInviteLink",{chat_id:$,invite_link:K})}setChatPhoto($,K){return this.callApi("setChatPhoto",{chat_id:$,photo:K})}deleteChatPhoto($){return this.callApi("deleteChatPhoto",{chat_id:$})}setChatTitle($,K){return this.callApi("setChatTitle",{chat_id:$,title:K})}setChatDescription($,K){return this.callApi("setChatDescription",{chat_id:$,description:K})}pinChatMessage($,K,J){return this.callApi("pinChatMessage",{chat_id:$,message_id:K,...J})}unpinChatMessage($,K){return this.callApi("unpinChatMessage",{chat_id:$,message_id:K})}unpinAllChatMessages($){return this.callApi("unpinAllChatMessages",{chat_id:$})}leaveChat($){return this.callApi("leaveChat",{chat_id:$})}unbanChatMember($,K,J){return this.callApi("unbanChatMember",{chat_id:$,user_id:K,...J})}answerCbQuery($,K,J){return this.callApi("answerCallbackQuery",{text:K,callback_query_id:$,...J})}answerGameQuery($,K){return this.callApi("answerCallbackQuery",{url:K,callback_query_id:$})}getUserChatBoosts($,K){return this.callApi("getUserChatBoosts",{chat_id:$,user_id:K})}answerShippingQuery($,K,J,X){return this.callApi("answerShippingQuery",{ok:K,shipping_query_id:$,shipping_options:J,error_message:X})}answerPreCheckoutQuery($,K,J){return this.callApi("answerPreCheckoutQuery",{ok:K,pre_checkout_query_id:$,error_message:J})}answerWebAppQuery($,K){return this.callApi("answerWebAppQuery",{web_app_query_id:$,result:K})}editMessageText($,K,J,X,Z){let Q=PK.FmtString.normalise(X);return this.callApi("editMessageText",{chat_id:$,message_id:K,inline_message_id:J,...Z,...Q})}editMessageCaption($,K,J,X,Z){return this.callApi("editMessageCaption",{chat_id:$,message_id:K,inline_message_id:J,...Z,...K0.fmtCaption({caption:X})})}editMessageMedia($,K,J,X,Z){return this.callApi("editMessageMedia",{chat_id:$,message_id:K,inline_message_id:J,media:K0.fmtCaption(X),...Z})}editMessageReplyMarkup($,K,J,X){return this.callApi("editMessageReplyMarkup",{chat_id:$,message_id:K,inline_message_id:J,reply_markup:X})}editMessageLiveLocation($,K,J,X,Z,Q){return this.callApi("editMessageLiveLocation",{latitude:X,longitude:Z,chat_id:$,message_id:K,inline_message_id:J,...Q})}stopMessageLiveLocation($,K,J,X){return this.callApi("stopMessageLiveLocation",{chat_id:$,message_id:K,inline_message_id:J,reply_markup:X})}deleteMessage($,K){return this.callApi("deleteMessage",{chat_id:$,message_id:K})}deleteMessages($,K){return this.callApi("deleteMessages",{chat_id:$,message_ids:K})}setChatStickerSet($,K){return this.callApi("setChatStickerSet",{chat_id:$,sticker_set_name:K})}deleteChatStickerSet($){return this.callApi("deleteChatStickerSet",{chat_id:$})}getForumTopicIconStickers(){return this.callApi("getForumTopicIconStickers",{})}createForumTopic($,K,J){return this.callApi("createForumTopic",{chat_id:$,name:K,...J})}editForumTopic($,K,J){return this.callApi("editForumTopic",{chat_id:$,message_thread_id:K,...J})}closeForumTopic($,K){return this.callApi("closeForumTopic",{chat_id:$,message_thread_id:K})}reopenForumTopic($,K){return this.callApi("reopenForumTopic",{chat_id:$,message_thread_id:K})}deleteForumTopic($,K){return this.callApi("deleteForumTopic",{chat_id:$,message_thread_id:K})}unpinAllForumTopicMessages($,K){return this.callApi("unpinAllForumTopicMessages",{chat_id:$,message_thread_id:K})}editGeneralForumTopic($,K){return this.callApi("editGeneralForumTopic",{chat_id:$,name:K})}closeGeneralForumTopic($){return this.callApi("closeGeneralForumTopic",{chat_id:$})}reopenGeneralForumTopic($){return this.callApi("reopenGeneralForumTopic",{chat_id:$})}hideGeneralForumTopic($){return this.callApi("hideGeneralForumTopic",{chat_id:$})}unhideGeneralForumTopic($){return this.callApi("unhideGeneralForumTopic",{chat_id:$})}unpinAllGeneralForumTopicMessages($){return this.callApi("unpinAllGeneralForumTopicMessages",{chat_id:$})}getStickerSet($){return this.callApi("getStickerSet",{name:$})}uploadStickerFile($,K,J){return this.callApi("uploadStickerFile",{user_id:$,sticker_format:J,sticker:K})}createNewStickerSet($,K,J,X){return this.callApi("createNewStickerSet",{name:K,title:J,user_id:$,...X})}addStickerToSet($,K,J){return this.callApi("addStickerToSet",{name:K,user_id:$,...J})}setStickerPositionInSet($,K){return this.callApi("setStickerPositionInSet",{sticker:$,position:K})}get setStickerSetThumb(){return this.setStickerSetThumbnail}setStickerSetThumbnail($,K,J){return this.callApi("setStickerSetThumbnail",{name:$,user_id:K,thumbnail:J})}setStickerMaskPosition($,K){return this.callApi("setStickerMaskPosition",{sticker:$,mask_position:K})}setStickerKeywords($,K){return this.callApi("setStickerKeywords",{sticker:$,keywords:K})}setStickerEmojiList($,K){return this.callApi("setStickerEmojiList",{sticker:$,emoji_list:K})}deleteStickerSet($){return this.callApi("deleteStickerSet",{name:$})}setStickerSetTitle($,K){return this.callApi("setStickerSetTitle",{name:$,title:K})}setCustomEmojiStickerSetThumbnail($,K){return this.callApi("setCustomEmojiStickerSetThumbnail",{name:$,custom_emoji_id:K})}deleteStickerFromSet($){return this.callApi("deleteStickerFromSet",{sticker:$})}getCustomEmojiStickers($){return this.callApi("getCustomEmojiStickers",{custom_emoji_ids:$})}setMyCommands($,K){return this.callApi("setMyCommands",{commands:$,...K})}deleteMyCommands($={}){return this.callApi("deleteMyCommands",$)}getMyCommands($={}){return this.callApi("getMyCommands",$)}setMyDescription($,K){return this.callApi("setMyDescription",{description:$,language_code:K})}setMyName($,K){return this.callApi("setMyName",{name:$,language_code:K})}getMyName($){return this.callApi("getMyName",{language_code:$})}getMyDescription($){return this.callApi("getMyDescription",{language_code:$})}setMyShortDescription($,K){return this.callApi("setMyShortDescription",{short_description:$,language_code:K})}getMyShortDescription($){return this.callApi("getMyShortDescription",{language_code:$})}setPassportDataErrors($,K){return this.callApi("setPassportDataErrors",{user_id:$,errors:K})}sendCopy($,K,J){return this.copyMessage($,K.chat.id,K.message_id,J)}copyMessage($,K,J,X){return this.callApi("copyMessage",{chat_id:$,from_chat_id:K,message_id:J,...K0.fmtCaption(X)})}copyMessages($,K,J,X){return this.callApi("copyMessages",{chat_id:$,from_chat_id:K,message_ids:J,...X})}approveChatJoinRequest($,K){return this.callApi("approveChatJoinRequest",{chat_id:$,user_id:K})}declineChatJoinRequest($,K){return this.callApi("declineChatJoinRequest",{chat_id:$,user_id:K})}banChatSenderChat($,K,J){return this.callApi("banChatSenderChat",{chat_id:$,sender_chat_id:K,...J})}unbanChatSenderChat($,K){return this.callApi("unbanChatSenderChat",{chat_id:$,sender_chat_id:K})}setChatMenuButton({chatId:$,menuButton:K}={}){return this.callApi("setChatMenuButton",{chat_id:$,menu_button:K})}getChatMenuButton({chatId:$}={}){return this.callApi("getChatMenuButton",{chat_id:$})}setMyDefaultAdministratorRights({rights:$,forChannels:K}={}){return this.callApi("setMyDefaultAdministratorRights",{rights:$,for_channels:K})}getMyDefaultAdministratorRights({forChannels:$}={}){return this.callApi("getMyDefaultAdministratorRights",{for_channels:$})}logOut(){return this.callApi("logOut",{})}close(){return this.callApi("close",{})}}H0.Telegram=h$;H0.default=h$});var fK=E((X2,HK)=>{var vQ=function(){try{if(!Buffer.isEncoding("latin1"))return!1;var $=Buffer.alloc?Buffer.alloc(4):new Buffer(4);return $.fill("ab","ucs2"),$.toString("hex")==="61006200"}catch(K){return!1}}();function gQ($){return $.length===1&&$.charCodeAt(0)<256}function p1($,K,J,X){if(J<0||X>$.length)throw new RangeError("Out of range index");if(J=J>>>0,X=X===void 0?$.length:X>>>0,X>J)$.fill(K,J,X);return $}function cQ($,K,J,X){if(J<0||X>$.length)throw new RangeError("Out of range index");if(X<=J)return $;J=J>>>0,X=X===void 0?$.length:X>>>0;var Z=J,Q=K.length;while(Z<=X-Q)K.copy($,Z),Z+=Q;if(Z!==X)K.copy($,Z,0,X-Z);return $}function dQ($,K,J,X,Z){if(vQ)return $.fill(K,J,X,Z);if(typeof K==="number")return p1($,K,J,X);if(typeof K==="string"){if(typeof J==="string")Z=J,J=0,X=$.length;else if(typeof X==="string")Z=X,X=$.length;if(Z!==void 0&&typeof Z!=="string")throw new TypeError("encoding must be a string");if(Z==="latin1")Z="binary";if(typeof Z==="string"&&!Buffer.isEncoding(Z))throw new TypeError("Unknown encoding: "+Z);if(K==="")return p1($,0,J,X);if(gQ(K))return p1($,K.charCodeAt(0),J,X);K=new Buffer(K,Z)}if(Buffer.isBuffer(K))return cQ($,K,J,X);return p1($,0,J,X)}HK.exports=dQ});var RK=E((Z2,AK)=>{function uQ($){if(typeof $!=="number")throw new TypeError('"size" argument must be a number');if($<0)throw new RangeError('"size" argument must not be negative');if(Buffer.allocUnsafe)return Buffer.allocUnsafe($);else return new Buffer($)}AK.exports=uQ});var NK=E((Q2,qK)=>{var EK=fK(),pQ=RK();qK.exports=function $(K,J,X){if(typeof K!=="number")throw new TypeError('"size" argument must be a number');if(K<0)throw new RangeError('"size" argument must not be negative');if(Buffer.alloc)return Buffer.alloc(K,J,X);var Z=pQ(K);if(K===0)return Z;if(J===void 0)return EK(Z,0);if(typeof X!=="string")X=void 0;return EK(Z,J,X)}});var SK=E((W2,OK)=>{var TK=j("crypto"),jK=NK(),mQ=function $(K,J){var X=String(K),Z=String(J),Q=X.length,W=0;if(Q!==Z.length)Z=X,W=1;for(var Y=0;Y{var iQ=l&&l.__createBinding||(Object.create?function($,K,J,X){if(X===void 0)X=J;var Z=Object.getOwnPropertyDescriptor(K,J);if(!Z||("get"in Z?!K.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return K[J]}};Object.defineProperty($,X,Z)}:function($,K,J,X){if(X===void 0)X=J;$[X]=K[J]}),nQ=l&&l.__setModuleDefault||(Object.create?function($,K){Object.defineProperty($,"default",{enumerable:!0,value:K})}:function($,K){$.default=K}),v$=l&&l.__importStar||function($){if($&&$.__esModule)return $;var K={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))iQ(K,$,J)}return nQ(K,$),K},$1=l&&l.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(l,"__esModule",{value:!0});l.Telegraf=void 0;var oQ=v$(j("crypto")),rQ=v$(j("http")),sQ=v$(j("https")),tQ=Y0(),aQ=j$(),eQ=$1(y1()),DK=$1(Q0()),$W=$1(u8()),KW=n8(),JW=$1(r8()),IK=$1(x$()),XW=j("url"),CK=SK(),m=DK.default("telegraf:main"),ZW={telegram:{},handlerTimeout:90000,contextType:eQ.default};function QW($){return()=>$}var WW=QW(Promise.resolve()),YW="x-telegram-bot-api-secret-token";class _K extends tQ.Composer{constructor($,K){super();this.context={},this.webhookFilter=function(J){let X=DK.default("telegraf:webhook");if(J.method==="POST")if(CK(this.path,J.url))if(!this.secretToken)return!0;else{let Z=J.headers[YW];if(CK(this.secretToken,Z))return!0;else X("Secret token does not match:",Z,this.secretToken)}else X("Path does not match:",J.url,this.path);else X("Unexpected request method, not POST. Received:",J.method);return!1},this.handleError=(J,X)=>{throw process.exitCode=1,console.error("Unhandled error while processing",X.update),J},this.options={...ZW,...aQ.compactOptions(K)},this.telegram=new IK.default($,this.options.telegram),m("Created a `Telegraf` instance")}get token(){return this.telegram.token}set webhookReply($){this.telegram.webhookReply=$}get webhookReply(){return this.telegram.webhookReply}catch($){return this.handleError=$,this}webhookCallback($="/",K={}){let{secretToken:J}=K;return $W.default(this.webhookFilter.bind({hookPath:$,path:$,secretToken:J}),(X,Z)=>this.handleUpdate(X,Z))}getDomainOpts($){var K;let J=$.domain.startsWith("https://")||$.domain.startsWith("http://");if(J)m("Unexpected protocol in domain, telegraf will use https:",$.domain);let X=J?new XW.URL($.domain).host:$.domain,Z=(K=$.path)!==null&&K!==void 0?K:`/telegraf/${this.secretPathComponent()}`,Q=`https://${X}${Z}`;return{domain:X,path:Z,url:Q}}async createWebhook($){let{domain:K,path:J,...X}=$,Z=this.getDomainOpts({domain:K,path:J});return await this.telegram.setWebhook(Z.url,X),m(`Webhook set to ${Z.url}`),this.webhookCallback(Z.path,{secretToken:X.secret_token})}startPolling($=[]){return this.polling=new KW.Polling(this.telegram,$),this.polling.loop(async(K)=>{await this.handleUpdate(K)})}startWebhook($,K,J,X,Z,Q){let W=this.webhookCallback($,{secretToken:Q}),Y=typeof Z==="function"?(V,z)=>W(V,z,()=>Z(V,z)):W;return this.webhookServer=K!=null?sQ.createServer(K,Y):rQ.createServer(Y),this.webhookServer.listen(J,X,()=>{m("Webhook listening on port: %s",J)}),this}secretPathComponent(){return oQ.createHash("sha3-256").update(this.token).update(process.version).digest("hex")}async launch($={},K){var J,X;let[Z,Q]=typeof $==="function"?[{},$]:[$,K],W=Z.dropPendingUpdates,Y=Z.allowedUpdates,V=Z.webhook;if(m("Connecting to Telegram"),(J=this.botInfo)!==null&&J!==void 0||(this.botInfo=await this.telegram.getMe()),Q===null||Q===void 0||Q(),m(`Launching @${this.botInfo.username}`),V===void 0){await this.telegram.deleteWebhook({drop_pending_updates:W}),m("Bot started with long polling"),await this.startPolling(Y);return}let z=this.getDomainOpts({domain:V.domain,path:(X=V.path)!==null&&X!==void 0?X:V.hookPath}),{tlsOptions:U,port:B,host:w,cb:F,secretToken:L}=V;this.startWebhook(z.path,U,B,w,F,L),await this.telegram.setWebhook(z.url,{drop_pending_updates:W,allowed_updates:Y,ip_address:V.ipAddress,max_connections:V.maxConnections,secret_token:V.secretToken,certificate:V.certificate}),m(`Bot started with webhook @ ${z.url}`)}stop($="unspecified"){var K,J;if(m("Stopping bot... Reason:",$),this.polling===void 0&&this.webhookServer===void 0)throw new Error("Bot is not running!");(K=this.webhookServer)===null||K===void 0||K.close(),(J=this.polling)===null||J===void 0||J.stop()}async handleUpdate($,K){var J,X;(J=this.botInfo)!==null&&J!==void 0||(this.botInfo=(m("Update %d is waiting for `botInfo` to be initialized",$.update_id),await((X=this.botInfoCall)!==null&&X!==void 0?X:this.botInfoCall=this.telegram.getMe()))),m("Processing update",$.update_id);let Z=new IK.default(this.token,this.telegram.options,K),W=new this.options.contextType($,Z,this.botInfo);Object.assign(W,this.context);try{await JW.default(Promise.resolve(this.middleware()(W,WW)),this.options.handlerTimeout)}catch(Y){return await this.handleError(Y,W)}finally{if((K===null||K===void 0?void 0:K.writableEnded)===!1)K.end();m("Finished processing update",$.update_id)}}}l.Telegraf=_K});var kK=E((b0)=>{var VW=b0&&b0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(b0,"__esModule",{value:!0});b0.Router=void 0;var m1=VW(Y0());class bK{constructor($,K=new Map){if(this.routeFn=$,this.handlers=K,this.otherwiseHandler=m1.default.passThru(),typeof $!=="function")throw new Error("Missing routing function")}on($,...K){if(K.length===0)throw new TypeError("At least one handler must be provided");return this.handlers.set($,m1.default.compose(K)),this}otherwise(...$){if($.length===0)throw new TypeError("At least one otherwise handler must be provided");return this.otherwiseHandler=m1.default.compose($),this}middleware(){return m1.default.lazy(($)=>{var K;let J=this.routeFn($);if(J==null)return this.otherwiseHandler;return Object.assign($,J.context),Object.assign($.state,J.state),(K=this.handlers.get(J.route))!==null&&K!==void 0?K:this.otherwiseHandler})}}b0.Router=bK});var vK=E((hK)=>{Object.defineProperty(hK,"__esModule",{value:!0});hK.webApp=hK.login=hK.pay=hK.game=hK.switchToCurrentChat=hK.switchToChat=hK.callback=hK.url=hK.channelRequest=hK.groupRequest=hK.botRequest=hK.userRequest=hK.pollRequest=hK.locationRequest=hK.contactRequest=hK.text=void 0;function GW($,K=!1){return{text:$,hide:K}}hK.text=GW;function UW($,K=!1){return{text:$,request_contact:!0,hide:K}}hK.contactRequest=UW;function zW($,K=!1){return{text:$,request_location:!0,hide:K}}hK.locationRequest=zW;function BW($,K,J=!1){return{text:$,request_poll:{type:K},hide:J}}hK.pollRequest=BW;function wW($,K,J,X=!1){return{text:$,request_users:{request_id:K,...J},hide:X}}hK.userRequest=wW;function MW($,K,J,X=!1){return{text:$,request_users:{request_id:K,user_is_bot:!0,...J},hide:X}}hK.botRequest=MW;function LW($,K,J,X=!1){return{text:$,request_chat:{request_id:K,chat_is_channel:!1,...J},hide:X}}hK.groupRequest=LW;function FW($,K,J,X=!1){return{text:$,request_chat:{request_id:K,chat_is_channel:!0,...J},hide:X}}hK.channelRequest=FW;function PW($,K,J=!1){return{text:$,url:K,hide:J}}hK.url=PW;function HW($,K,J=!1){return{text:$,callback_data:K,hide:J}}hK.callback=HW;function fW($,K,J=!1){return{text:$,switch_inline_query:K,hide:J}}hK.switchToChat=fW;function AW($,K,J=!1){return{text:$,switch_inline_query_current_chat:K,hide:J}}hK.switchToCurrentChat=AW;function RW($,K=!1){return{text:$,callback_game:{},hide:K}}hK.game=RW;function EW($,K=!1){return{text:$,pay:!0,hide:K}}hK.pay=EW;function qW($,K,J={},X=!1){return{text:$,login_url:{...J,url:K},hide:X}}hK.login=qW;function NW($,K,J=!1){return{text:$,web_app:{url:K},hide:J}}hK.webApp=NW});var g$=E((_)=>{var cW=_&&_.__createBinding||(Object.create?function($,K,J,X){if(X===void 0)X=J;var Z=Object.getOwnPropertyDescriptor(K,J);if(!Z||("get"in Z?!K.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return K[J]}};Object.defineProperty($,X,Z)}:function($,K,J,X){if(X===void 0)X=J;$[X]=K[J]}),dW=_&&_.__setModuleDefault||(Object.create?function($,K){Object.defineProperty($,"default",{enumerable:!0,value:K})}:function($,K){$.default=K}),uW=_&&_.__importStar||function($){if($&&$.__esModule)return $;var K={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))cW(K,$,J)}return dW(K,$),K};Object.defineProperty(_,"__esModule",{value:!0});_.inlineKeyboard=_.keyboard=_.forceReply=_.removeKeyboard=_.button=_.Markup=void 0;var pW=d1();class r{constructor($){this.reply_markup=$}selective($=!0){return new r({...this.reply_markup,selective:$})}placeholder($){return new r({...this.reply_markup,input_field_placeholder:$})}resize($=!0){return new r({...this.reply_markup,resize_keyboard:$})}oneTime($=!0){return new r({...this.reply_markup,one_time_keyboard:$})}persistent($=!0){return new r({...this.reply_markup,is_persistent:$})}}_.Markup=r;_.button=uW(vK());function mW(){return new r({remove_keyboard:!0})}_.removeKeyboard=mW;function lW(){return new r({force_reply:!0})}_.forceReply=lW;function iW($,K){let J=gK($,{columns:1,...K});return new r({keyboard:J})}_.keyboard=iW;function nW($,K){let J=gK($,{columns:$.length,...K});return new r({inline_keyboard:J})}_.inlineKeyboard=nW;function gK($,K){let J=[];if(!Array.isArray($))return J;if(pW.is2D($))return $.map((W)=>W.filter((Y)=>!Y.hide));let X=K.wrap!==void 0?K.wrap:(W,Y,V)=>V.length>=K.columns,Z=[],Q=0;for(let W of $.filter((Y)=>!Y.hide)){if(X(W,Q,Z)&&Z.length>0)J.push(Z),Z=[];Z.push(W),Q++}if(Z.length>0)J.push(Z);return J}});var cK=E((c$)=>{Object.defineProperty(c$,"__esModule",{value:!0});c$.Markup=void 0;var oW=g$();Object.defineProperty(c$,"Markup",{enumerable:!0,get:function(){return oW.Markup}})});var pK=E((dK)=>{Object.defineProperty(dK,"__esModule",{value:!0});dK.fromFileId=dK.fromURL=dK.fromURLStream=dK.fromReadableStream=dK.fromBuffer=dK.fromLocalFile=void 0;var sW=($,K)=>({source:$,filename:K});dK.fromLocalFile=sW;var tW=($,K)=>({source:$,filename:K});dK.fromBuffer=tW;var aW=($,K)=>({source:$,filename:K});dK.fromReadableStream=aW;var eW=($,K)=>({url:$.toString(),filename:K});dK.fromURLStream=eW;var $5=($)=>$.toString();dK.fromURL=$5;var K5=($)=>$;dK.fromFileId=K5});var iK=E((mK)=>{Object.defineProperty(mK,"__esModule",{value:!0});mK.deunionize=void 0;function Y5($){return $}mK.deunionize=Y5});var u$=E((t)=>{var V5=t&&t.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(t,"__esModule",{value:!0});t.isSessionContext=t.MemorySessionStore=t.session=void 0;var G5=V5(Q0()),J0=G5.default("telegraf:session");function U5($){var K,J,X;let Z=(K=$===null||$===void 0?void 0:$.property)!==null&&K!==void 0?K:"session",Q=(J=$===null||$===void 0?void 0:$.getSessionKey)!==null&&J!==void 0?J:z5,W=(X=$===null||$===void 0?void 0:$.store)!==null&&X!==void 0?X:new d$,Y=new Map,V=new Map;return async(z,U)=>{var B;let w=z.update.update_id,F=!1;function L(){if(F&&process.env.EXPERIMENTAL_SESSION_CHECKS)throw new Error("Session was accessed or assigned to after the middleware chain exhausted. This is a bug in your code. You're probably accessing session asynchronously and missing awaits.")}let H=await Q(z);if(!H)return z[Z]=void 0,await U();let M=Y.get(H);if(M)J0(`(${w}) found cached session, reusing from cache`),++M.counter;else{J0(`(${w}) did not find cached session`);let q=V.get(H);if(q)J0(`(${w}) found a concurrent request, reusing promise`);else J0(`(${w}) fetching from upstream store`),q=W.get(H);V.set(H,q);let T=await q;V.delete(H),J0(`(${w}) updating cache`);let b=Y.get(H);if(b)b.counter++,M=b;else M={ref:T!==null&&T!==void 0?T:(B=$===null||$===void 0?void 0:$.defaultSession)===null||B===void 0?void 0:B.call($,z),counter:1},Y.set(H,M)}let N=M,R=!1;Object.defineProperty(z,Z,{get(){return L(),R=!0,N.ref},set(q){L(),R=!0,N.ref=q}});try{await U(),F=!0}finally{if(--N.counter===0)J0(`(${w}) refcounter reached 0, removing cached`),Y.delete(H);if(J0(`(${w}) middlewares completed, checking session`),R)if(N.ref==null)J0(`(${w}) ctx.${Z} missing, removing from store`),await W.delete(H);else J0(`(${w}) ctx.${Z} found, updating store`),await W.set(H,N.ref)}}}t.session=U5;function z5($){var K,J;let X=(K=$.from)===null||K===void 0?void 0:K.id,Z=(J=$.chat)===null||J===void 0?void 0:J.id;if(X==null||Z==null)return;return`${X}:${Z}`}class d${constructor($=1/0){this.ttl=$,this.store=new Map}get($){let K=this.store.get($);if(K==null)return;else if(K.expires{var sK=K1&&K1.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(K1,"__esModule",{value:!0});var w5=sK(Y0()),M5=sK(Q0()),nK=M5.default("telegraf:scenes:context"),oK=()=>Promise.resolve(),rK=()=>Math.floor(Date.now()/1000);class tK{constructor($,K,J){this.ctx=$,this.scenes=K,this.leaving=!1;let X={};this.options={defaultSession:X,...J}}get session(){var $,K;let J=Object.assign({},this.options.defaultSession),X=(K=($=this.ctx.session)===null||$===void 0?void 0:$.__scenes)!==null&&K!==void 0?K:J;if(X.expires!==void 0&&X.expires{var L5=k0&&k0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(k0,"__esModule",{value:!0});k0.Stage=void 0;var F5=u$(),P5=L5(p$()),J1=Y0();class aK extends J1.Composer{constructor($=[],K){super();this.options={...K},this.scenes=new Map,$.forEach((J)=>this.register(J))}register(...$){return $.forEach((K)=>{if((K===null||K===void 0?void 0:K.id)==null||typeof K.middleware!=="function")throw new Error("telegraf: Unsupported scene");this.scenes.set(K.id,K)}),this}middleware(){let $=J1.Composer.compose([(K,J)=>{let X=this.scenes,Z=new P5.default(K,X,this.options);return K.scene=Z,J()},super.middleware(),J1.Composer.lazy((K)=>{var J;return(J=K.scene.current)!==null&&J!==void 0?J:J1.Composer.passThru()})]);return J1.Composer.optional(F5.isSessionContext,$)}static enter(...$){return(K)=>K.scene.enter(...$)}static reenter(...$){return(K)=>K.scene.reenter(...$)}static leave(...$){return(K)=>K.scene.leave(...$)}}k0.Stage=aK});var l$=E((f0)=>{var H5=f0&&f0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(f0,"__esModule",{value:!0});f0.BaseScene=void 0;var $4=H5(Y0()),{compose:l1}=$4.default;class m$ extends $4.default{constructor($,K){let J={handlers:[],enterHandlers:[],leaveHandlers:[],...K};super(...J.handlers);this.id=$,this.ttl=J.ttl,this.enterHandler=l1(J.enterHandlers),this.leaveHandler=l1(J.leaveHandlers)}enter(...$){return this.enterHandler=l1([this.enterHandler,...$]),this}leave(...$){return this.leaveHandler=l1([this.leaveHandler,...$]),this}enterMiddleware(){return this.enterHandler}leaveMiddleware(){return this.leaveHandler}}f0.BaseScene=m$;f0.default=m$});var i$=E((J4)=>{Object.defineProperty(J4,"__esModule",{value:!0});class K4{constructor($,K){var J;this.ctx=$,this.steps=K,this.state=$.scene.state,this.cursor=(J=$.scene.session.cursor)!==null&&J!==void 0?J:0}get step(){return this.steps[this.cursor]}get cursor(){return this.ctx.scene.session.cursor}set cursor($){this.ctx.scene.session.cursor=$}selectStep($){return this.cursor=$,this}next(){return this.selectStep(this.cursor+1)}back(){return this.selectStep(this.cursor-1)}}J4.default=K4});var Z4=E((h0)=>{var o$=h0&&h0.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(h0,"__esModule",{value:!0});h0.WizardScene=void 0;var A5=o$(l$()),R5=o$(i$()),n$=o$(Y0());class X4 extends A5.default{constructor($,K,...J){let X,Z;if(typeof K==="function"||"middleware"in K)X=void 0,Z=[K,...J];else X=K,Z=J;super($,X);this.steps=Z}middleware(){return n$.default.compose([($,K)=>{return $.wizard=new R5.default($,this.steps),K()},super.middleware(),($,K)=>{if($.wizard.step===void 0)return $.wizard.selectStep(0),$.scene.leave();return n$.default.unwrap($.wizard.step)($,K)}])}enterMiddleware(){return n$.default.compose([this.enterHandler,this.middleware()])}}h0.WizardScene=X4});var W4=E((d)=>{var Q4=d&&d.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(d,"__esModule",{value:!0});d.WizardContextWizard=d.WizardScene=d.BaseScene=d.SceneContextScene=d.Stage=void 0;var E5=eK();Object.defineProperty(d,"Stage",{enumerable:!0,get:function(){return E5.Stage}});var q5=p$();Object.defineProperty(d,"SceneContextScene",{enumerable:!0,get:function(){return Q4(q5).default}});var N5=l$();Object.defineProperty(d,"BaseScene",{enumerable:!0,get:function(){return N5.BaseScene}});var j5=Z4();Object.defineProperty(d,"WizardScene",{enumerable:!0,get:function(){return j5.WizardScene}});var T5=i$();Object.defineProperty(d,"WizardContextWizard",{enumerable:!0,get:function(){return Q4(T5).default}})});var Y4=E((A0)=>{var O5=A0&&A0.__createBinding||(Object.create?function($,K,J,X){if(X===void 0)X=J;var Z=Object.getOwnPropertyDescriptor(K,J);if(!Z||("get"in Z?!K.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return K[J]}};Object.defineProperty($,X,Z)}:function($,K,J,X){if(X===void 0)X=J;$[X]=K[J]}),S5=A0&&A0.__exportStar||function($,K){for(var J in $)if(J!=="default"&&!Object.prototype.hasOwnProperty.call(K,J))O5(K,$,J)};Object.defineProperty(A0,"__esModule",{value:!0});S5(W4(),A0)});var G4=E((O)=>{var I5=O&&O.__createBinding||(Object.create?function($,K,J,X){if(X===void 0)X=J;var Z=Object.getOwnPropertyDescriptor(K,J);if(!Z||("get"in Z?!K.__esModule:Z.writable||Z.configurable))Z={enumerable:!0,get:function(){return K[J]}};Object.defineProperty($,X,Z)}:function($,K,J,X){if(X===void 0)X=J;$[X]=K[J]}),C5=O&&O.__setModuleDefault||(Object.create?function($,K){Object.defineProperty($,"default",{enumerable:!0,value:K})}:function($,K){$.default=K}),X1=O&&O.__importStar||function($){if($&&$.__esModule)return $;var K={};if($!=null){for(var J in $)if(J!=="default"&&Object.prototype.hasOwnProperty.call($,J))I5(K,$,J)}return C5(K,$),K};Object.defineProperty(O,"__esModule",{value:!0});O.Scenes=O.MemorySessionStore=O.session=O.deunionize=O.Format=O.Input=O.Markup=O.Types=O.Telegram=O.TelegramError=O.Router=O.Composer=O.Context=O.Telegraf=void 0;var D5=yK();Object.defineProperty(O,"Telegraf",{enumerable:!0,get:function(){return D5.Telegraf}});var _5=y1();Object.defineProperty(O,"Context",{enumerable:!0,get:function(){return _5.Context}});var y5=Y0();Object.defineProperty(O,"Composer",{enumerable:!0,get:function(){return y5.Composer}});var b5=kK();Object.defineProperty(O,"Router",{enumerable:!0,get:function(){return b5.Router}});var k5=v1();Object.defineProperty(O,"TelegramError",{enumerable:!0,get:function(){return k5.TelegramError}});var h5=x$();Object.defineProperty(O,"Telegram",{enumerable:!0,get:function(){return h5.Telegram}});O.Types=X1(cK());O.Markup=X1(g$());O.Input=X1(pK());O.Format=X1(k$());var x5=iK();Object.defineProperty(O,"deunionize",{enumerable:!0,get:function(){return x5.deunionize}});var V4=u$();Object.defineProperty(O,"session",{enumerable:!0,get:function(){return V4.session}});Object.defineProperty(O,"MemorySessionStore",{enumerable:!0,get:function(){return V4.MemorySessionStore}});O.Scenes=X1(Y4())});var C9=E((I9,H6)=>{Object.defineProperty(I9,"__esModule",{value:!0});function DV($){return $.encrypted}var P6=($,K)=>{let J;if(typeof K==="function")J={connect:K};else J=K;let X=typeof J.connect==="function",Z=typeof J.secureConnect==="function",Q=typeof J.close==="function",W=()=>{if(X)J.connect();if(DV($)&&Z){if($.authorized)J.secureConnect();else if(!$.authorizationError)$.once("secureConnect",J.secureConnect)}if(Q)$.once("close",J.close)};if($.writable&&!$.connecting)W();else if($.connecting)$.once("connect",W);else if($.destroyed&&Q)J.close($._hadError)};I9.default=P6;H6.exports=P6;H6.exports.default=P6});var a9=E((Qw,t9)=>{var ZG=new Set([200,203,204,206,300,301,308,404,405,410,414,501]),QG=new Set([200,203,204,300,301,302,303,307,308,404,405,410,414,501]),WG=new Set([500,502,503,504]),YG={date:!0,connection:!0,"keep-alive":!0,"proxy-authenticate":!0,"proxy-authorization":!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0},VG={"content-length":!0,"content-encoding":!0,"transfer-encoding":!0,"content-range":!0};function E0($){let K=parseInt($,10);return isFinite(K)?K:0}function GG($){if(!$)return!0;return WG.has($.status)}function j6($){let K={};if(!$)return K;let J=$.trim().split(/,/);for(let X of J){let[Z,Q]=X.split(/=/,2);K[Z.trim()]=Q===void 0?!0:Q.trim().replace(/^"|"$/g,"")}return K}function UG($){let K=[];for(let J in $){let X=$[J];K.push(X===!0?J:J+"="+X)}if(!K.length)return;return K.join(", ")}t9.exports=class ${constructor(K,J,{shared:X,cacheHeuristic:Z,immutableMinTimeToLive:Q,ignoreCargoCult:W,_fromObject:Y}={}){if(Y){this._fromObject(Y);return}if(!J||!J.headers)throw Error("Response headers missing");if(this._assertRequestHasHeaders(K),this._responseTime=this.now(),this._isShared=X!==!1,this._cacheHeuristic=Z!==void 0?Z:0.1,this._immutableMinTtl=Q!==void 0?Q:86400000,this._status="status"in J?J.status:200,this._resHeaders=J.headers,this._rescc=j6(J.headers["cache-control"]),this._method="method"in K?K.method:"GET",this._url=K.url,this._host=K.headers.host,this._noAuthorization=!K.headers.authorization,this._reqHeaders=J.headers.vary?K.headers:null,this._reqcc=j6(K.headers["cache-control"]),W&&"pre-check"in this._rescc&&"post-check"in this._rescc)delete this._rescc["pre-check"],delete this._rescc["post-check"],delete this._rescc["no-cache"],delete this._rescc["no-store"],delete this._rescc["must-revalidate"],this._resHeaders=Object.assign({},this._resHeaders,{"cache-control":UG(this._rescc)}),delete this._resHeaders.expires,delete this._resHeaders.pragma;if(J.headers["cache-control"]==null&&/no-cache/.test(J.headers.pragma))this._rescc["no-cache"]=!0}now(){return Date.now()}storable(){return!!(!this._reqcc["no-store"]&&(this._method==="GET"||this._method==="HEAD"||this._method==="POST"&&this._hasExplicitExpiration())&&QG.has(this._status)&&!this._rescc["no-store"]&&(!this._isShared||!this._rescc.private)&&(!this._isShared||this._noAuthorization||this._allowsStoringAuthenticated())&&(this._resHeaders.expires||this._rescc["max-age"]||this._isShared&&this._rescc["s-maxage"]||this._rescc.public||ZG.has(this._status)))}_hasExplicitExpiration(){return this._isShared&&this._rescc["s-maxage"]||this._rescc["max-age"]||this._resHeaders.expires}_assertRequestHasHeaders(K){if(!K||!K.headers)throw Error("Request headers missing")}satisfiesWithoutRevalidation(K){this._assertRequestHasHeaders(K);let J=j6(K.headers["cache-control"]);if(J["no-cache"]||/no-cache/.test(K.headers.pragma))return!1;if(J["max-age"]&&this.age()>J["max-age"])return!1;if(J["min-fresh"]&&this.timeToLive()<1000*J["min-fresh"])return!1;if(this.stale()){if(!(J["max-stale"]&&!this._rescc["must-revalidate"]&&(J["max-stale"]===!0||J["max-stale"]>this.age()-this.maxAge())))return!1}return this._requestMatches(K,!1)}_requestMatches(K,J){return(!this._url||this._url===K.url)&&this._host===K.headers.host&&(!K.method||this._method===K.method||J&&K.method==="HEAD")&&this._varyMatches(K)}_allowsStoringAuthenticated(){return this._rescc["must-revalidate"]||this._rescc.public||this._rescc["s-maxage"]}_varyMatches(K){if(!this._resHeaders.vary)return!0;if(this._resHeaders.vary==="*")return!1;let J=this._resHeaders.vary.trim().toLowerCase().split(/\s*,\s*/);for(let X of J)if(K.headers[X]!==this._reqHeaders[X])return!1;return!0}_copyWithoutHopByHopHeaders(K){let J={};for(let X in K){if(YG[X])continue;J[X]=K[X]}if(K.connection){let X=K.connection.trim().split(/\s*,\s*/);for(let Z of X)delete J[Z]}if(J.warning){let X=J.warning.split(/,/).filter((Z)=>{return!/^\s*1[0-9][0-9]/.test(Z)});if(!X.length)delete J.warning;else J.warning=X.join(",").trim()}return J}responseHeaders(){let K=this._copyWithoutHopByHopHeaders(this._resHeaders),J=this.age();if(J>86400&&!this._hasExplicitExpiration()&&this.maxAge()>86400)K.warning=(K.warning?`${K.warning}, `:"")+'113 - "rfc7234 5.5.4"';return K.age=`${Math.round(J)}`,K.date=new Date(this.now()).toUTCString(),K}date(){let K=Date.parse(this._resHeaders.date);if(isFinite(K))return K;return this._responseTime}age(){let K=this._ageValue(),J=(this.now()-this._responseTime)/1000;return K+J}_ageValue(){return E0(this._resHeaders.age)}maxAge(){if(!this.storable()||this._rescc["no-cache"])return 0;if(this._isShared&&(this._resHeaders["set-cookie"]&&!this._rescc.public&&!this._rescc.immutable))return 0;if(this._resHeaders.vary==="*")return 0;if(this._isShared){if(this._rescc["proxy-revalidate"])return 0;if(this._rescc["s-maxage"])return E0(this._rescc["s-maxage"])}if(this._rescc["max-age"])return E0(this._rescc["max-age"]);let K=this._rescc.immutable?this._immutableMinTtl:0,J=this.date();if(this._resHeaders.expires){let X=Date.parse(this._resHeaders.expires);if(Number.isNaN(X)||XX)return Math.max(K,(J-X)/1000*this._cacheHeuristic)}return K}timeToLive(){let K=this.maxAge()-this.age(),J=K+E0(this._rescc["stale-if-error"]),X=K+E0(this._rescc["stale-while-revalidate"]);return Math.max(0,K,J,X)*1000}stale(){return this.maxAge()<=this.age()}_useStaleIfError(){return this.maxAge()+E0(this._rescc["stale-if-error"])>this.age()}useStaleWhileRevalidate(){return this.maxAge()+E0(this._rescc["stale-while-revalidate"])>this.age()}static fromObject(K){return new this(void 0,void 0,{_fromObject:K})}_fromObject(K){if(this._responseTime)throw Error("Reinitialized");if(!K||K.v!==1)throw Error("Invalid serialization");this._responseTime=K.t,this._isShared=K.sh,this._cacheHeuristic=K.ch,this._immutableMinTtl=K.imm!==void 0?K.imm:86400000,this._status=K.st,this._resHeaders=K.resh,this._rescc=K.rescc,this._method=K.m,this._url=K.u,this._host=K.h,this._noAuthorization=K.a,this._reqHeaders=K.reqh,this._reqcc=K.reqcc}toObject(){return{v:1,t:this._responseTime,sh:this._isShared,ch:this._cacheHeuristic,imm:this._immutableMinTtl,st:this._status,resh:this._resHeaders,rescc:this._rescc,m:this._method,u:this._url,h:this._host,a:this._noAuthorization,reqh:this._reqHeaders,reqcc:this._reqcc}}revalidationHeaders(K){this._assertRequestHasHeaders(K);let J=this._copyWithoutHopByHopHeaders(K.headers);if(delete J["if-range"],!this._requestMatches(K,!0)||!this.storable())return delete J["if-none-match"],delete J["if-modified-since"],J;if(this._resHeaders.etag)J["if-none-match"]=J["if-none-match"]?`${J["if-none-match"]}, ${this._resHeaders.etag}`:this._resHeaders.etag;if(J["accept-ranges"]||J["if-match"]||J["if-unmodified-since"]||this._method&&this._method!="GET"){if(delete J["if-modified-since"],J["if-none-match"]){let Z=J["if-none-match"].split(/,/).filter((Q)=>{return!/^\s*W\//.test(Q)});if(!Z.length)delete J["if-none-match"];else J["if-none-match"]=Z.join(",").trim()}}else if(this._resHeaders["last-modified"]&&!J["if-modified-since"])J["if-modified-since"]=this._resHeaders["last-modified"];return J}revalidatedPolicy(K,J){if(this._assertRequestHasHeaders(K),this._useStaleIfError()&&GG(J))return{modified:!1,matches:!1,policy:this};if(!J||!J.headers)throw Error("Response headers missing");let X=!1;if(J.status!==void 0&&J.status!=304)X=!1;else if(J.headers.etag&&!/^\s*W\//.test(J.headers.etag))X=this._resHeaders.etag&&this._resHeaders.etag.replace(/^\s*W\//,"")===J.headers.etag;else if(this._resHeaders.etag&&J.headers.etag)X=this._resHeaders.etag.replace(/^\s*W\//,"")===J.headers.etag.replace(/^\s*W\//,"");else if(this._resHeaders["last-modified"])X=this._resHeaders["last-modified"]===J.headers["last-modified"];else if(!this._resHeaders.etag&&!this._resHeaders["last-modified"]&&!J.headers.etag&&!J.headers["last-modified"])X=!0;if(!X)return{policy:new this.constructor(K,J),modified:J.status!=304,matches:!1};let Z={};for(let W in this._resHeaders)Z[W]=W in J.headers&&!VG[W]?J.headers[W]:this._resHeaders[W];let Q=Object.assign({},J,{status:this._status,method:this._method,headers:Z});return{policy:new this.constructor(K,Q,{shared:this._isShared,cacheHeuristic:this._cacheHeuristic,immutableMinTimeToLive:this._immutableMinTtl}),modified:!1,matches:!0}}}});var e9=E((BG)=>{BG.stringify=function $(K){if(typeof K=="undefined")return K;if(K&&Buffer.isBuffer(K))return JSON.stringify(":base64:"+K.toString("base64"));if(K&&K.toJSON)K=K.toJSON();if(K&&typeof K==="object"){var J="",X=Array.isArray(K);J=X?"[":"{";var Z=!0;for(var Q in K){var W=typeof K[Q]=="function"||!X&&typeof K[Q]==="undefined";if(Object.hasOwnProperty.call(K,Q)&&!W){if(!Z)J+=",";if(Z=!1,X)if(K[Q]==null)J+="null";else J+=$(K[Q]);else if(K[Q]!==void 0)J+=$(Q)+":"+$(K[Q])}}return J+=X?"]":"}",J}else if(typeof K==="string")return JSON.stringify(/^:/.test(K)?":"+K:K);else if(typeof K==="undefined")return"null";else return JSON.stringify(K)};BG.parse=function($){return JSON.parse($,function(K,J){if(typeof J==="string")if(/^:base64:/.test(J))return Buffer.from(J.substring(8),"base64");else return/^:/.test(J)?J.substring(1):J;return J})}});var ZJ=E((zw,XJ)=>{var LG=j("events"),$J=e9(),FG=($)=>{let K={redis:"@keyv/redis",rediss:"@keyv/redis",mongodb:"@keyv/mongo",mongo:"@keyv/mongo",sqlite:"@keyv/sqlite",postgresql:"@keyv/postgres",postgres:"@keyv/postgres",mysql:"@keyv/mysql",etcd:"@keyv/etcd",offline:"@keyv/offline",tiered:"@keyv/tiered"};if($.adapter||$.uri){let J=$.adapter||/^[^:+]*/.exec($.uri)[0];return new(j(K[J]))($)}return new Map},KJ=["sqlite","postgres","mysql","mongo","redis","tiered"];class JJ extends LG{constructor($,{emitErrors:K=!0,...J}={}){super();if(this.opts={namespace:"keyv",serialize:$J.stringify,deserialize:$J.parse,...typeof $==="string"?{uri:$}:$,...J},!this.opts.store){let Z={...this.opts};this.opts.store=FG(Z)}if(this.opts.compression){let Z=this.opts.compression;this.opts.serialize=Z.serialize.bind(Z),this.opts.deserialize=Z.deserialize.bind(Z)}if(typeof this.opts.store.on==="function"&&K)this.opts.store.on("error",(Z)=>this.emit("error",Z));this.opts.store.namespace=this.opts.namespace;let X=(Z)=>async function*(){for await(let[Q,W]of typeof Z==="function"?Z(this.opts.store.namespace):Z){let Y=await this.opts.deserialize(W);if(this.opts.store.namespace&&!Q.includes(this.opts.store.namespace))continue;if(typeof Y.expires==="number"&&Date.now()>Y.expires){this.delete(Q);continue}yield[this._getKeyUnprefix(Q),Y.value]}};if(typeof this.opts.store[Symbol.iterator]==="function"&&this.opts.store instanceof Map)this.iterator=X(this.opts.store);else if(typeof this.opts.store.iterator==="function"&&this.opts.store.opts&&this._checkIterableAdaptar())this.iterator=X(this.opts.store.iterator.bind(this.opts.store))}_checkIterableAdaptar(){return KJ.includes(this.opts.store.opts.dialect)||KJ.findIndex(($)=>this.opts.store.opts.url.includes($))>=0}_getKeyPrefix($){return`${this.opts.namespace}:${$}`}_getKeyPrefixArray($){return $.map((K)=>`${this.opts.namespace}:${K}`)}_getKeyUnprefix($){return $.split(":").splice(1).join(":")}get($,K){let{store:J}=this.opts,X=Array.isArray($),Z=X?this._getKeyPrefixArray($):this._getKeyPrefix($);if(X&&J.getMany===void 0){let Q=[];for(let W of Z)Q.push(Promise.resolve().then(()=>J.get(W)).then((Y)=>typeof Y==="string"?this.opts.deserialize(Y):this.opts.compression?this.opts.deserialize(Y):Y).then((Y)=>{if(Y===void 0||Y===null)return;if(typeof Y.expires==="number"&&Date.now()>Y.expires)return this.delete(W).then(()=>{return});return K&&K.raw?Y:Y.value}));return Promise.allSettled(Q).then((W)=>{let Y=[];for(let V of W)Y.push(V.value);return Y})}return Promise.resolve().then(()=>X?J.getMany(Z):J.get(Z)).then((Q)=>typeof Q==="string"?this.opts.deserialize(Q):this.opts.compression?this.opts.deserialize(Q):Q).then((Q)=>{if(Q===void 0||Q===null)return;if(X)return Q.map((W,Y)=>{if(typeof W==="string")W=this.opts.deserialize(W);if(W===void 0||W===null)return;if(typeof W.expires==="number"&&Date.now()>W.expires){this.delete($[Y]).then(()=>{return});return}return K&&K.raw?W:W.value});if(typeof Q.expires==="number"&&Date.now()>Q.expires)return this.delete($).then(()=>{return});return K&&K.raw?Q:Q.value})}set($,K,J){let X=this._getKeyPrefix($);if(typeof J==="undefined")J=this.opts.ttl;if(J===0)J=void 0;let{store:Z}=this.opts;return Promise.resolve().then(()=>{let Q=typeof J==="number"?Date.now()+J:null;if(typeof K==="symbol")this.emit("error","symbol cannot be serialized");return K={value:K,expires:Q},this.opts.serialize(K)}).then((Q)=>Z.set(X,Q,J)).then(()=>!0)}delete($){let{store:K}=this.opts;if(Array.isArray($)){let X=this._getKeyPrefixArray($);if(K.deleteMany===void 0){let Z=[];for(let Q of X)Z.push(K.delete(Q));return Promise.allSettled(Z).then((Q)=>Q.every((W)=>W.value===!0))}return Promise.resolve().then(()=>K.deleteMany(X))}let J=this._getKeyPrefix($);return Promise.resolve().then(()=>K.delete(J))}clear(){let{store:$}=this.opts;return Promise.resolve().then(()=>$.clear())}has($){let K=this._getKeyPrefix($),{store:J}=this.opts;return Promise.resolve().then(async()=>{if(typeof J.has==="function")return J.has(K);return await J.get(K)!==void 0})}disconnect(){let{store:$}=this.opts;if(typeof $.disconnect==="function")return $.disconnect()}}XJ.exports=JJ});var GJ=E((Tw,VJ)=>{var jG=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];VJ.exports=($,K)=>{if(K._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let J=new Set(Object.keys($).concat(jG)),X={};for(let Z of J){if(Z in K)continue;X[Z]={get(){let Q=$[Z];return typeof Q==="function"?Q.bind($):Q},set(Q){$[Z]=Q},enumerable:!0,configurable:!1}}return Object.defineProperties(K,X),$.once("aborted",()=>{K.destroy(),K.emit("aborted")}),$.once("close",()=>{if($.complete)if(K.readable)K.once("end",()=>{K.emit("close")});else K.emit("close");else K.emit("close")}),K}});var zJ=E((Ow,UJ)=>{var{Transform:TG,PassThrough:OG}=j("stream"),I6=j("zlib"),SG=GJ();UJ.exports=($)=>{let K=($.headers["content-encoding"]||"").toLowerCase();if(!["gzip","deflate","br"].includes(K))return $;let J=K==="br";if(J&&typeof I6.createBrotliDecompress!=="function")return $.destroy(new Error("Brotli is not supported on Node.js < 12")),$;let X=!0,Z=new TG({transform(Y,V,z){X=!1,z(null,Y)},flush(Y){Y()}}),Q=new OG({autoDestroy:!1,destroy(Y,V){$.destroy(),V(Y)}}),W=J?I6.createBrotliDecompress():I6.createUnzip();return W.once("error",(Y)=>{if(X&&!$.readable){Q.end();return}Q.destroy(Y)}),SG($,Q),$.pipe(Z).pipe(W).pipe(Q),Q}});var c6=E((sw,DJ)=>{class CJ{constructor($={}){if(!($.maxSize&&$.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");this.maxSize=$.maxSize,this.onEviction=$.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_set($,K){if(this.cache.set($,K),this._size++,this._size>=this.maxSize){if(this._size=0,typeof this.onEviction==="function")for(let[J,X]of this.oldCache.entries())this.onEviction(J,X);this.oldCache=this.cache,this.cache=new Map}}get($){if(this.cache.has($))return this.cache.get($);if(this.oldCache.has($)){let K=this.oldCache.get($);return this.oldCache.delete($),this._set($,K),K}}set($,K){if(this.cache.has($))this.cache.set($,K);else this._set($,K);return this}has($){return this.cache.has($)||this.oldCache.has($)}peek($){if(this.cache.has($))return this.cache.get($);if(this.oldCache.has($))return this.oldCache.get($)}delete($){let K=this.cache.delete($);if(K)this._size--;return this.oldCache.delete($)||K}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}*keys(){for(let[$]of this)yield $}*values(){for(let[,$]of this)yield $}*[Symbol.iterator](){for(let $ of this.cache)yield $;for(let $ of this.oldCache){let[K]=$;if(!this.cache.has(K))yield $}}get size(){let $=0;for(let K of this.oldCache.keys())if(!this.cache.has(K))$++;return Math.min(this._size+$,this.maxSize)}}DJ.exports=CJ});var d6=E((tw,_J)=>{_J.exports=($)=>{if($.listenerCount("error")!==0)return $;$.__destroy=$._destroy,$._destroy=(...J)=>{let X=J.pop();$.__destroy(...J,async(Z)=>{await Promise.resolve(),X(Z)})};let K=(J)=>{Promise.resolve().then(()=>{$.emit("error",J)})};return $.once("error",K),Promise.resolve().then(()=>{$.off("error",K)}),$}});var N0=E((aw,vJ)=>{var{URL:yJ}=j("url"),aG=j("events"),eG=j("tls"),$U=j("http2"),KU=c6(),JU=d6(),v=Symbol("currentStreamCount"),bJ=Symbol("request"),g=Symbol("cachedOriginSet"),B0=Symbol("gracefullyClosing"),V$=Symbol("length"),kJ=["createConnection","maxDeflateDynamicTableSize","maxSettings","maxSessionMemory","maxHeaderListPairs","maxOutstandingPings","maxReservedRemoteStreams","maxSendHeaderBlockLength","paddingStrategy","peerMaxConcurrentStreams","settings","family","localAddress","rejectUnauthorized","pskCallback","minDHSize","path","socket","ca","cert","sigalgs","ciphers","clientCertEngine","crl","dhparam","ecdhCurve","honorCipherOrder","key","privateKeyEngine","privateKeyIdentifier","maxVersion","minVersion","pfx","secureOptions","secureProtocol","sessionIdContext","ticketKeys"],XU=($,K,J)=>{let X=0,Z=$.length;while(X>>1;if(J($[Q],K))X=Q+1;else Z=Q}return X},ZU=($,K)=>$.remoteSettings.maxConcurrentStreams>K.remoteSettings.maxConcurrentStreams,u6=($,K)=>{for(let J=0;J<$.length;J++){let X=$[J];if(X[g].length>0&&X[g].lengthK[g].includes(Z))&&X[v]+K[v]<=K.remoteSettings.maxConcurrentStreams)xJ(X)}},hJ=($,K)=>{for(let J=0;J<$.length;J++){let X=$[J];if(K[g].length>0&&K[g].lengthX[g].includes(Z))&&K[v]+X[v]<=X.remoteSettings.maxConcurrentStreams)return xJ(K),!0}return!1},xJ=($)=>{if($[B0]=!0,$[v]===0)$.close()};class l0 extends aG{constructor({timeout:$=0,maxSessions:K=Number.POSITIVE_INFINITY,maxEmptySessions:J=10,maxCachedTlsSessions:X=100}={}){super();this.sessions={},this.queue={},this.timeout=$,this.maxSessions=K,this.maxEmptySessions=J,this._emptySessionCount=0,this._sessionCount=0,this.settings={enablePush:!1,initialWindowSize:33554432},this.tlsSessionCache=new KU({maxSize:X})}get protocol(){return"https:"}normalizeOptions($){let K="";for(let J=0;J=this.maxSessions){this.closeEmptySessions(this.maxSessions-this._sessionCount+1);return}for(let $ in this.queue)for(let K in this.queue[$]){let J=this.queue[$][K];if(!J.completed)J.completed=!0,J()}}_isBetterSession($,K){return $>K}_accept($,K,J,X){let Z=0;while(Z0)this.getSession(J,X,K),K.length=0}getSession($,K,J){return new Promise((X,Z)=>{if(Array.isArray(J)&&J.length>0)J=[...J],X();else J=[{resolve:X,reject:Z}];try{if(typeof $==="string")$=new yJ($);else if(!($ instanceof yJ))throw new TypeError("The `origin` argument needs to be a string or an URL object");if(K){let{servername:z}=K,{hostname:U}=$;if(z&&U!==z)throw new Error(`Origin ${U} differs from servername ${z}`)}}catch(z){for(let U=0;U=H||L[B0]||L.destroyed)continue;if(!w)U=H;if(this._isBetterSession(M,B))w=L,B=M}if(w){this._accept(w,J,W,K);return}}if(Q in this.queue){if(W in this.queue[Q]){this.queue[Q][W].listeners.push(...J);return}}else this.queue[Q]={[V$]:0};let Y=()=>{if(Q in this.queue&&this.queue[Q][W]===V){if(delete this.queue[Q][W],--this.queue[Q][V$]===0)delete this.queue[Q]}},V=async()=>{this._sessionCount++;let z=`${W}:${Q}`,U=!1,B;try{let w={...K};if(w.settings===void 0)w.settings=this.settings;if(w.session===void 0)w.session=this.tlsSessionCache.get(z);B=await(w.createConnection||this.createConnection).call(this,$,w),w.createConnection=()=>B;let L=$U.connect($,w);L[v]=0,L[B0]=!1;let H=()=>{let{socket:R}=L,q;if(R.servername===!1)R.servername=R.remoteAddress,q=L.originSet,R.servername=!1;else q=L.originSet;return q},M=()=>L[v]{this.tlsSessionCache.set(z,R)}),L.once("error",(R)=>{for(let q=0;q{L.destroy()}),L.once("close",()=>{if(this._sessionCount--,U){this._emptySessionCount--;let R=this.sessions[Q];if(R.length===1)delete this.sessions[Q];else R.splice(R.indexOf(L),1)}else{Y();let R=new Error("Session closed without receiving a SETTINGS frame");R.code="HTTP2WRAPPER_NOSETTINGS";for(let q=0;q{let R=this.queue[Q];if(!R)return;let q=L[g];for(let T=0;T{if(L[g]=H()||[],L[B0]=!1,hJ(this.sessions[Q],L),L[B0]||!M())return;if(N(),!M())return;u6(this.sessions[Q],L)}),L.once("remoteSettings",()=>{if(V.destroyed){let R=new Error("Agent has been destroyed");for(let q=0;qthis.maxEmptySessions)this.closeEmptySessions(this._emptySessionCount-this.maxEmptySessions);L.on("remoteSettings",()=>{if(!M())return;if(N(),!M())return;u6(this.sessions[Q],L)})}),L[bJ]=L.request,L.request=(R,q)=>{if(L[B0])throw new Error("The session is gracefully closing. No new streams are allowed.");let T=L[bJ](R,q);if(L.ref(),L[v]++===0)this._emptySessionCount--;return T.once("close",()=>{if(--L[v]===0){if(this._emptySessionCount++,L.unref(),this._emptySessionCount>this.maxEmptySessions||L[B0]){L.close();return}}if(L.destroyed||L.closed)return;if(M()&&!hJ(this.sessions[Q],L)){if(u6(this.sessions[Q],L),N(),L[v]===0)this._processQueue()}}),T}}catch(w){Y(),this._sessionCount--;for(let F=0;F{this.getSession($,K,[{reject:Q,resolve:(W)=>{try{let Y=W.request(J,X);JU(Y),Z(Y)}catch(Y){Q(Y)}}}])})}async createConnection($,K){return l0.connect($,K)}static connect($,K){K.ALPNProtocols=["h2"];let J=$.port||443,X=$.hostname;if(typeof K.servername==="undefined")K.servername=X;let Z=eG.connect(J,X,K);if(K.socket)Z._peername={family:void 0,address:void 0,port:J};return Z}closeEmptySessions($=Number.POSITIVE_INFINITY){let K=0,{sessions:J}=this;for(let X in J){let Z=J[X];for(let Q=0;Q=$)return K}}}return K}destroy($){let{sessions:K,queue:J}=this;for(let X in K){let Z=K[X];for(let Q=0;Q{var{Readable:QU}=j("stream");class gJ extends QU{constructor($,K){super({emitClose:!1,autoDestroy:!0,highWaterMark:K});this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=$,this._dumped=!1}get connection(){return this.socket}set connection($){this.socket=$}_destroy($,K){if(!this.readableEnded)this.aborted=!0;K(),this.req._request.destroy($)}setTimeout($,K){return this.req.setTimeout($,K),this}_dump(){if(!this._dumped)this._dumped=!0,this.removeAllListeners("data"),this.resume()}_read(){if(this.req)this.req._request.resume()}}cJ.exports=gJ});var uJ=E(($M,dJ)=>{dJ.exports=($,K,J)=>{for(let X of J)$.on(X,(...Z)=>K.emit(X,...Z))}});var P1=E((KM,pJ)=>{var j0=($,K,J)=>{KM[K]=class X extends ${constructor(...Z){super(typeof J==="string"?J:J(Z));this.name=`${super.name} [${K}]`,this.code=K}}};j0(TypeError,"ERR_INVALID_ARG_TYPE",($)=>{let K=$[0].includes(".")?"property":"argument",J=$[1],X=Array.isArray(J);if(X)J=`${J.slice(0,-1).join(", ")} or ${J.slice(-1)}`;return`The "${$[0]}" ${K} must be ${X?"one of":"of"} type ${J}. Received ${typeof $[2]}`});j0(TypeError,"ERR_INVALID_PROTOCOL",($)=>`Protocol "${$[0]}" not supported. Expected "${$[1]}"`);j0(Error,"ERR_HTTP_HEADERS_SENT",($)=>`Cannot ${$[0]} headers after they are sent to the client`);j0(TypeError,"ERR_INVALID_HTTP_TOKEN",($)=>`${$[0]} must be a valid HTTP token [${$[1]}]`);j0(TypeError,"ERR_HTTP_INVALID_HEADER_VALUE",($)=>`Invalid value "${$[0]} for header "${$[1]}"`);j0(TypeError,"ERR_INVALID_CHAR",($)=>`Invalid character in ${$[0]} [${$[1]}]`);j0(Error,"ERR_HTTP2_NO_SOCKET_MANIPULATION","HTTP/2 sockets should not be directly manipulated (e.g. read and written)")});var lJ=E((JM,mJ)=>{mJ.exports=($)=>{switch($){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var m6=E((XM,iJ)=>{var{ERR_INVALID_HTTP_TOKEN:WU}=P1(),YU=lJ(),VU=/^[\^`\-\w!#$%&*+.|~]+$/;iJ.exports=($)=>{if(typeof $!=="string"||!VU.test($)&&!YU($))throw new WU("Header name",$)}});var l6=E((ZM,nJ)=>{var{ERR_HTTP_INVALID_HEADER_VALUE:GU,ERR_INVALID_CHAR:UU}=P1(),zU=/[^\t\u0020-\u007E\u0080-\u00FF]/;nJ.exports=($,K)=>{if(typeof K==="undefined")throw new GU(K,$);if(zU.test(K))throw new UU("header content",$)}});var sJ=E((QM,rJ)=>{var{ERR_HTTP2_NO_SOCKET_MANIPULATION:oJ}=P1(),BU={has($,K){let J=$.session===void 0?$:$.session.socket;return K in $||K in J},get($,K){switch(K){case"on":case"once":case"end":case"emit":case"destroy":return $[K].bind($);case"writable":case"destroyed":return $[K];case"readable":if($.destroyed)return!1;return $.readable;case"setTimeout":{let{session:J}=$;if(J!==void 0)return J.setTimeout.bind(J);return $.setTimeout.bind($)}case"write":case"read":case"pause":case"resume":throw new oJ;default:{let J=$.session===void 0?$:$.session.socket,X=J[K];return typeof X==="function"?X.bind(J):X}}},getPrototypeOf($){if($.session!==void 0)return Reflect.getPrototypeOf($.session.socket);return Reflect.getPrototypeOf($)},set($,K,J){switch(K){case"writable":case"readable":case"destroyed":case"on":case"once":case"end":case"emit":case"destroy":return $[K]=J,!0;case"setTimeout":{let{session:X}=$;if(X===void 0)$.setTimeout=J;else X.setTimeout=J;return!0}case"write":case"read":case"pause":case"resume":throw new oJ;default:{let X=$.session===void 0?$:$.session.socket;return X[K]=J,!0}}}};rJ.exports=BU});var o6=E((WM,XX)=>{var{URL:i6,urlToHttpOptions:tJ}=j("url"),wU=j("http2"),{Writable:MU}=j("stream"),{Agent:LU,globalAgent:FU}=N0(),PU=p6(),HU=uJ(),{ERR_INVALID_ARG_TYPE:G$,ERR_INVALID_PROTOCOL:fU,ERR_HTTP_HEADERS_SENT:aJ}=P1(),AU=m6(),RU=l6(),EU=sJ(),{HTTP2_HEADER_STATUS:eJ,HTTP2_HEADER_METHOD:$X,HTTP2_HEADER_PATH:KX,HTTP2_HEADER_AUTHORITY:H1,HTTP2_METHOD_CONNECT:qU}=wU.constants,h=Symbol("headers"),i0=Symbol("origin"),f1=Symbol("session"),n6=Symbol("options"),U$=Symbol("flushedHeaders"),n0=Symbol("jobs"),A1=Symbol("pendingAgentPromise");class JX extends MU{constructor($,K,J){super({autoDestroy:!1,emitClose:!1});if(typeof $==="string")$=tJ(new i6($));else if($ instanceof i6)$=tJ($);else $={...$};if(typeof K==="function"||K===void 0)J=K,K=$;else K=Object.assign($,K);if(K.h2session){if(this[f1]=K.h2session,this[f1].destroyed)throw new Error("The session has been closed already");this.protocol=this[f1].socket.encrypted?"https:":"http:"}else if(K.agent===!1)this.agent=new LU({maxEmptySessions:0});else if(typeof K.agent==="undefined"||K.agent===null)this.agent=FU;else if(typeof K.agent.request==="function")this.agent=K.agent;else throw new G$("options.agent",["http2wrapper.Agent-like Object","undefined","false"],K.agent);if(this.agent)this.protocol=this.agent.protocol;if(K.protocol&&K.protocol!==this.protocol)throw new fU(K.protocol,this.protocol);if(!K.port)K.port=K.defaultPort||this.agent&&this.agent.defaultPort||443;K.host=K.hostname||K.host||"localhost",delete K.hostname;let{timeout:X}=K;if(K.timeout=void 0,this[h]=Object.create(null),this[n0]=[],this[A1]=void 0,this.socket=null,this.connection=null,this.method=K.method||"GET",!(this.method==="CONNECT"&&(K.path==="/"||K.path===void 0)))this.path=K.path;this.res=null,this.aborted=!1,this.reusedSocket=!1;let{headers:Z}=K;if(Z)for(let W in Z)this.setHeader(W,Z[W]);if(K.auth&&!("authorization"in this[h]))this[h].authorization="Basic "+Buffer.from(K.auth).toString("base64");K.session=K.tlsSession,K.path=K.socketPath,this[n6]=K,this[i0]=new i6(`${this.protocol}//${K.servername||K.host}:${K.port}`);let Q=K._reuseSocket;if(Q)K.createConnection=(...W)=>{if(Q.destroyed)return this.agent.createConnection(...W);return Q},this.agent.getSession(this[i0],this[n6]).catch(()=>{});if(X)this.setTimeout(X);if(J)this.once("response",J);this[U$]=!1}get method(){return this[h][$X]}set method($){if($)this[h][$X]=$.toUpperCase()}get path(){let $=this.method==="CONNECT"?H1:KX;return this[h][$]}set path($){if($){let K=this.method==="CONNECT"?H1:KX;this[h][K]=$}}get host(){return this[i0].hostname}set host($){}get _mustNotHaveABody(){return this.method==="GET"||this.method==="HEAD"||this.method==="DELETE"}_write($,K,J){if(this._mustNotHaveABody){J(new Error("The GET, HEAD and DELETE methods must NOT have a body"));return}this.flushHeaders();let X=()=>this._request.write($,K,J);if(this._request)X();else this[n0].push(X)}_final($){this.flushHeaders();let K=()=>{if(this._mustNotHaveABody||this.method==="CONNECT"){$();return}this._request.end($)};if(this._request)K();else this[n0].push(K)}abort(){if(this.res&&this.res.complete)return;if(!this.aborted)process.nextTick(()=>this.emit("abort"));this.aborted=!0,this.destroy()}async _destroy($,K){if(this.res)this.res._dump();if(this._request)this._request.destroy();else process.nextTick(()=>{this.emit("close")});try{await this[A1]}catch(J){if(this.aborted)$=J}K($)}async flushHeaders(){if(this[U$]||this.destroyed)return;this[U$]=!0;let $=this.method===qU,K=(J)=>{if(this._request=J,this.destroyed){J.destroy();return}if(!$)HU(J,this,["timeout","continue"]);J.once("error",(Z)=>{this.destroy(Z)}),J.once("aborted",()=>{let{res:Z}=this;if(Z)Z.aborted=!0,Z.emit("aborted"),Z.destroy();else this.destroy(new Error("The server aborted the HTTP/2 stream"))});let X=(Z,Q,W)=>{let Y=new PU(this.socket,J.readableHighWaterMark);if(this.res=Y,Y.url=`${this[i0].origin}${this.path}`,Y.req=this,Y.statusCode=Z[eJ],Y.headers=Z,Y.rawHeaders=W,Y.once("end",()=>{Y.complete=!0,Y.socket=null,Y.connection=null}),$)if(Y.upgrade=!0,this.emit("connect",Y,J,Buffer.alloc(0)))this.emit("close");else J.destroy();else if(J.on("data",(V)=>{if(!Y._dumped&&!Y.push(V))J.pause()}),J.once("end",()=>{if(!this.aborted)Y.push(null)}),!this.emit("response",Y))Y._dump()};J.once("response",X),J.once("headers",(Z)=>this.emit("information",{statusCode:Z[eJ]})),J.once("trailers",(Z,Q,W)=>{let{res:Y}=this;if(Y===null){X(Z,Q,W);return}Y.trailers=Z,Y.rawTrailers=W}),J.once("close",()=>{let{aborted:Z,res:Q}=this;if(Q){if(Z)Q.aborted=!0,Q.emit("aborted"),Q.destroy();let W=()=>{Q.emit("close"),this.destroy(),this.emit("close")};if(Q.readable)Q.once("end",W);else W();return}if(!this.destroyed){this.destroy(new Error("The HTTP/2 stream has been early terminated")),this.emit("close");return}this.destroy(),this.emit("close")}),this.socket=new Proxy(J,EU);for(let Z of this[n0])Z();this[n0].length=0,this.emit("socket",this.socket)};if(!(H1 in this[h])&&!$)this[h][H1]=this[i0].host;if(this[f1])try{K(this[f1].request(this[h]))}catch(J){this.destroy(J)}else{this.reusedSocket=!0;try{let J=this.agent.request(this[i0],this[n6],this[h]);this[A1]=J,K(await J),this[A1]=!1}catch(J){this[A1]=!1,this.destroy(J)}}}get connection(){return this.socket}set connection($){this.socket=$}getHeaderNames(){return Object.keys(this[h])}hasHeader($){if(typeof $!=="string")throw new G$("name","string",$);return Boolean(this[h][$.toLowerCase()])}getHeader($){if(typeof $!=="string")throw new G$("name","string",$);return this[h][$.toLowerCase()]}get headersSent(){return this[U$]}removeHeader($){if(typeof $!=="string")throw new G$("name","string",$);if(this.headersSent)throw new aJ("remove");delete this[h][$.toLowerCase()]}setHeader($,K){if(this.headersSent)throw new aJ("set");AU($),RU($,K);let J=$.toLowerCase();if(J==="connection"){if(K.toLowerCase()==="keep-alive")return;throw new Error(`Invalid 'connection' header: ${K}`)}if(J==="host"&&this.method==="CONNECT")this[h][H1]=K;else this[h][J]=K}setNoDelay(){}setSocketKeepAlive(){}setTimeout($,K){let J=()=>this._request.setTimeout($,K);if(this._request)J();else this[n0].push(J);return this}get maxHeadersCount(){if(!this.destroyed&&this._request)return this._request.session.localSettings.maxHeaderListSize;return}set maxHeadersCount($){}}XX.exports=JX});var QX=E((YM,ZX)=>{var NU=j("tls");ZX.exports=($={},K=NU.connect)=>new Promise((J,X)=>{let Z=!1,Q,W=async()=>{if(await V,Q.off("timeout",Y),Q.off("error",X),$.resolveSocket){if(J({alpnProtocol:Q.alpnProtocol,socket:Q,timeout:Z}),Z)await Promise.resolve(),Q.emit("timeout")}else Q.destroy(),J({alpnProtocol:Q.alpnProtocol,timeout:Z})},Y=async()=>{Z=!0,W()},V=(async()=>{try{Q=await K($,W),Q.on("error",X),Q.once("timeout",Y)}catch(z){X(z)}})()})});var YX=E((VM,WX)=>{var{isIP:jU}=j("net"),TU=j("assert"),OU=($)=>{if($[0]==="["){let J=$.indexOf("]");return TU(J!==-1),$.slice(1,J)}let K=$.indexOf(":");if(K===-1)return $;return $.slice(0,K)};WX.exports=($)=>{let K=OU($);if(jU(K))return"";return K}});var LX=E((GM,R1)=>{var{URL:VX,urlToHttpOptions:GX}=j("url"),UX=j("http"),r6=j("https"),SU=QX(),IU=c6(),{Agent:CU,globalAgent:DU}=N0(),_U=o6(),yU=YX(),zX=d6(),BX=new IU({maxSize:100}),bU=new Map,kU=($,K,J)=>{K._httpMessage={shouldKeepAlive:!0};let X=()=>{$.emit("free",K,J)};K.on("free",X);let Z=()=>{$.removeSocket(K,J)};K.on("close",Z);let Q=()=>{let{freeSockets:Y}=$;for(let V of Object.values(Y))if(V.includes(K)){K.destroy();return}};K.on("timeout",Q);let W=()=>{$.removeSocket(K,J),K.off("close",Z),K.off("free",X),K.off("timeout",Q),K.off("agentRemove",W)};K.on("agentRemove",W),$.emit("free",K,J)},wX=($,K=new Map,J=void 0)=>{return async(X)=>{let Z=`${X.host}:${X.port}:${X.ALPNProtocols.sort()}`;if(!$.has(Z)){if(K.has(Z))return{alpnProtocol:(await K.get(Z)).alpnProtocol};let{path:Q}=X;X.path=X.socketPath;let W=SU(X,J);K.set(Z,W);try{let Y=await W;return $.set(Z,Y.alpnProtocol),K.delete(Z),X.path=Q,Y}catch(Y){throw K.delete(Z),X.path=Q,Y}}return{alpnProtocol:$.get(Z)}}},MX=wX(BX,bU);R1.exports=async($,K,J)=>{if(typeof $==="string")$=GX(new VX($));else if($ instanceof VX)$=GX($);else $={...$};if(typeof K==="function"||K===void 0)J=K,K=$;else K=Object.assign($,K);if(K.ALPNProtocols=K.ALPNProtocols||["h2","http/1.1"],!Array.isArray(K.ALPNProtocols)||K.ALPNProtocols.length===0)throw new Error("The `ALPNProtocols` option must be an Array with at least one entry");K.protocol=K.protocol||"https:";let X=K.protocol==="https:";K.host=K.hostname||K.host||"localhost",K.session=K.tlsSession,K.servername=K.servername||yU(K.headers&&K.headers.host||K.host),K.port=K.port||(X?443:80),K._defaultAgent=X?r6.globalAgent:UX.globalAgent;let Z=K.resolveProtocol||MX,{agent:Q}=K;if(Q!==void 0&&Q!==!1&&Q.constructor.name!=="Object")throw new Error("The `options.agent` can be only an object `http`, `https` or `http2` properties");if(X){K.resolveSocket=!0;let{socket:W,alpnProtocol:Y,timeout:V}=await Z(K);if(V){if(W)W.destroy();let U=new Error(`Timed out resolving ALPN: ${K.timeout} ms`);throw U.code="ETIMEDOUT",U.ms=K.timeout,U}if(W&&K.createConnection)W.destroy(),W=void 0;delete K.resolveSocket;let z=Y==="h2";if(Q)Q=z?Q.http2:Q.https,K.agent=Q;if(Q===void 0)Q=z?DU:r6.globalAgent;if(W)if(Q===!1)W.destroy();else{let U=(z?CU:r6.Agent).prototype.createConnection;if(Q.createConnection===U)if(z)K._reuseSocket=W;else kU(Q,W,K);else W.destroy()}if(z)return zX(new _U(K,J))}else if(Q)K.agent=Q.http;if(K.headers){if(K.headers={...K.headers},K.headers[":authority"]){if(!K.headers.host)K.headers.host=K.headers[":authority"];delete K.headers[":authority"]}delete K.headers[":method"],delete K.headers[":scheme"],delete K.headers[":path"]}return zX(UX.request(K,J))};R1.exports.protocolCache=BX;R1.exports.resolveProtocol=MX;R1.exports.createResolveProtocol=wX});var s6=E((UM,FX)=>{var hU=j("stream"),xU=j("tls"),vU=new xU.TLSSocket(new hU.PassThrough)._handle._parentWrap.constructor;FX.exports=vU});var t6=E((zM,HX)=>{class PX extends Error{constructor($,K=""){super(`The proxy server rejected the request with status code ${$} (${K||"empty status message"})`);this.statusCode=$,this.statusMessage=K}}HX.exports=PX});var AX=E((BM,fX)=>{var gU=($,K,J)=>{if(!J.some((Z)=>{if(typeof Z==="string")return typeof K===Z;return K instanceof Z})){let Z=J.map((Q)=>typeof Q==="string"?Q:Q.name);throw new TypeError(`Expected '${$}' to be a type of ${Z.join(" or ")}, got ${typeof K}`)}};fX.exports=gU});var a6=E((wM,EX)=>{var{URL:RX}=j("url"),z$=AX();EX.exports=($,K)=>{z$("proxyOptions",K,["object"]),z$("proxyOptions.headers",K.headers,["object","undefined"]),z$("proxyOptions.raw",K.raw,["boolean","undefined"]),z$("proxyOptions.url",K.url,[RX,"string"]);let J=new RX(K.url);$.proxyOptions={raw:!0,...K,headers:{...K.headers},url:J}}});var B$=E((MM,qX)=>{qX.exports=($)=>{let{username:K,password:J}=$.proxyOptions.url;if(K||J){let X=`${K}:${J}`,Z=`Basic ${Buffer.from(X).toString("base64")}`;return{"proxy-authorization":Z,authorization:Z}}return{}}});var CX=E((LM,IX)=>{var cU=j("tls"),dU=j("http"),NX=j("https"),uU=s6(),{globalAgent:pU}=N0(),mU=t6(),jX=a6(),lU=B$(),TX=($,K,J)=>{(async()=>{try{let{proxyOptions:X}=$,{url:Z,headers:Q,raw:W}=X,Y=await pU.request(Z,X,{...lU($),...Q,":method":"CONNECT",":authority":`${K.host}:${K.port}`});Y.once("error",J),Y.once("response",(V)=>{let z=V[":status"];if(z!==200){J(new mU(z,""));return}let U=$ instanceof NX.Agent;if(W&&U){K.socket=Y;let w=cU.connect(K);w.once("close",()=>{Y.destroy()}),J(null,w);return}let B=new uU(Y);B.encrypted=!1,B._handle.getpeername=(w)=>{w.family=void 0,w.address=void 0,w.port=void 0},J(null,B)})}catch(X){J(X)}})()};class OX extends dU.Agent{constructor($){super($);jX(this,$.proxyOptions)}createConnection($,K){TX(this,$,K)}}class SX extends NX.Agent{constructor($){super($);jX(this,$.proxyOptions)}createConnection($,K){TX(this,$,K)}}IX.exports={HttpOverHttp2:OX,HttpsOverHttp2:SX}});var e6=E((FM,_X)=>{var{Agent:iU}=N0(),nU=s6(),oU=t6(),rU=a6();class DX extends iU{constructor($){super($);rU(this,$.proxyOptions)}async createConnection($,K){let J=`${$.hostname}:${$.port||443}`,[X,Z,Q]=await this._getProxyStream(J);if(Z!==200)throw new oU(Z,Q);if(this.proxyOptions.raw)K.socket=X;else{let W=new nU(X);return W.encrypted=!1,W._handle.getpeername=(Y)=>{Y.family=void 0,Y.address=void 0,Y.port=void 0},W}return super.createConnection($,K)}}_X.exports=DX});var kX=E((PM,bX)=>{var{globalAgent:sU}=N0(),tU=e6(),aU=B$(),eU=($)=>new Promise((K,J)=>{$.once("error",J),$.once("response",(X)=>{$.off("error",J),K(X[":status"])})});class yX extends tU{async _getProxyStream($){let{proxyOptions:K}=this,J={...aU(this),...K.headers,":method":"CONNECT",":authority":$},X=await sU.request(K.url,K,J),Z=await eU(X);return[X,Z,""]}}bX.exports=yX});var xX=E((HM,hX)=>{var $z=j("http"),Kz=j("https"),Jz=e6(),Xz=B$(),Zz=($)=>new Promise((K,J)=>{let X=(Z,Q,W)=>{Q.unshift(W),$.off("error",J),K([Q,Z.statusCode,Z.statusMessage])};$.once("error",J),$.once("connect",X)});class $8 extends Jz{async _getProxyStream($){let{proxyOptions:K}=this,{url:J,headers:X}=this.proxyOptions,Q=(J.protocol==="https:"?Kz:$z).request({...K,hostname:J.hostname,port:J.port,path:$,headers:{...Xz(this),...X,host:$},method:"CONNECT"}).end();return Zz(Q)}}hX.exports={Http2OverHttp:$8,Http2OverHttps:$8}});var gX=E((fM,vX)=>{var Qz=j("http2"),{Agent:Wz,globalAgent:Yz}=N0(),K8=o6(),Vz=p6(),Gz=LX(),{HttpOverHttp2:Uz,HttpsOverHttp2:zz}=CX(),Bz=kX(),{Http2OverHttp:wz,Http2OverHttps:Mz}=xX(),Lz=m6(),Fz=l6(),Pz=($,K,J)=>new K8($,K,J),Hz=($,K,J)=>{let X=new K8($,K,J);return X.end(),X};vX.exports={...Qz,ClientRequest:K8,IncomingMessage:Vz,Agent:Wz,globalAgent:Yz,request:Pz,get:Hz,auto:Gz,proxies:{HttpOverHttp2:Uz,HttpsOverHttp2:zz,Http2OverHttp2:Bz,Http2OverHttp:wz,Http2OverHttps:Mz},validateHeaderName:Lz,validateHeaderValue:Fz}});var ZZ=S0(G4(),1);import{setTimeout as dz}from"timers/promises";var B4=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function v5($){return B4.includes($)}var w4=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...B4];function g5($){return w4.includes($)}var M4=["null","undefined","string","number","bigint","boolean","symbol"];function c5($){return M4.includes($)}var q2=["positive number","negative number","Class","string with a number","null or undefined","Iterable","AsyncIterable","native Promise","EnumCase","string with a URL","truthy","falsy","primitive","integer","plain object","TypedArray","array-like","tuple-like","Node.js Stream","infinite number","empty array","non-empty array","empty string","empty string or whitespace","non-empty string","non-empty string and not whitespace","empty object","non-empty object","empty set","non-empty set","empty map","non-empty map","PropertyKey","even integer","odd integer","T","in range","predicate returns truthy for any value","predicate returns truthy for all values","valid Date","valid length","whitespace string",...w4,...M4],S=($)=>{let K=Object.prototype.toString.call($).slice(8,-1);if(/HTML\w+Element/.test(K)&&$6($))return"HTMLElement";if(g5(K))return K;return};function U4($){if($===null)return"null";switch(typeof $){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN($)?"NaN":"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol";default:}if(n1($))return"Observable";if(s($))return"Array";if(Z1($))return"Buffer";let K=S($);if(K)return K;if($ instanceof String||$ instanceof Boolean||$ instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}function d5($){return k($?.then)&&k($?.catch)}var r$=Object.assign(U4,{all:F4,any:s$,array:s,arrayBuffer:P4,arrayLike:H4,asyncFunction:f4,asyncGenerator:A4,asyncGeneratorFunction:R4,asyncIterable:t$,bigint:E4,bigInt64Array:q4,bigUint64Array:N4,blob:j4,boolean:T4,boundFunction:O4,buffer:Z1,class:S4,dataView:I4,date:a$,detect:U4,directInstanceOf:C4,emptyArray:D4,emptyMap:_4,emptyObject:y4,emptySet:b4,emptyString:e$,emptyStringOrWhitespace:i1,enumCase:k4,error:h4,evenInteger:x4,falsy:v4,float32Array:g4,float64Array:c4,formData:d4,function:k,generator:u4,generatorFunction:p4,htmlElement:$6,infinite:m4,inRange:l4,int16Array:i4,int32Array:n4,int8Array:o4,integer:K6,iterable:J6,map:x0,nan:X6,nativePromise:Z6,negativeNumber:r4,nodeStream:s4,nonEmptyArray:t4,nonEmptyMap:a4,nonEmptyObject:e4,nonEmptySet:$9,nonEmptyString:K9,nonEmptyStringAndNotWhitespace:J9,null:Q1,nullOrUndefined:Q6,number:v0,numericString:X9,object:g0,observable:n1,oddInteger:Z9,plainObject:W6,positiveNumber:Q9,primitive:W9,promise:Y9,propertyKey:V9,regExp:G9,safeInteger:Y6,set:c0,sharedArrayBuffer:U9,string:a,symbol:V6,truthy:z9,tupleLike:B9,typedArray:w9,uint16Array:M9,uint32Array:L9,uint8Array:F9,uint8ClampedArray:P9,undefined:G6,urlInstance:H9,urlSearchParams:f9,urlString:A9,validDate:R9,validLength:U6,weakMap:E9,weakRef:q9,weakSet:N9,whitespaceString:z6});function L4($){return(K)=>K6(K)&&Math.abs(K%2)===$}function F4($,...K){return j9(Array.prototype.every,$,K)}function s$($,...K){return(s($)?$:[$]).some((X)=>j9(Array.prototype.some,X,K))}function s($,K){if(!Array.isArray($))return!1;if(!k(K))return!0;return $.every((J)=>K(J))}function P4($){return S($)==="ArrayBuffer"}function H4($){return!Q6($)&&!k($)&&U6($.length)}function f4($){return S($)==="AsyncFunction"}function A4($){return t$($)&&k($.next)&&k($.throw)}function R4($){return S($)==="AsyncGeneratorFunction"}function t$($){return k($?.[Symbol.asyncIterator])}function E4($){return typeof $==="bigint"}function q4($){return S($)==="BigInt64Array"}function N4($){return S($)==="BigUint64Array"}function j4($){return S($)==="Blob"}function T4($){return $===!0||$===!1}function O4($){return k($)&&!Object.hasOwn($,"prototype")}function Z1($){return $?.constructor?.isBuffer?.($)??!1}function S4($){return k($)&&$.toString().startsWith("class ")}function I4($){return S($)==="DataView"}function a$($){return S($)==="Date"}function C4($,K){if($===void 0||$===null)return!1;return Object.getPrototypeOf($)===K.prototype}function D4($){return s($)&&$.length===0}function _4($){return x0($)&&$.size===0}function y4($){return g0($)&&!x0($)&&!c0($)&&Object.keys($).length===0}function b4($){return c0($)&&$.size===0}function e$($){return a($)&&$.length===0}function i1($){return e$($)||z6($)}function k4($,K){return Object.values(K).includes($)}function h4($){return S($)==="Error"}function x4($){return L4(0)($)}function v4($){return!$}function g4($){return S($)==="Float32Array"}function c4($){return S($)==="Float64Array"}function d4($){return S($)==="FormData"}function k($){return typeof $==="function"}function u4($){return J6($)&&k($?.next)&&k($?.throw)}function p4($){return S($)==="GeneratorFunction"}var u5=1,p5=["innerHTML","ownerDocument","style","attributes","nodeValue"];function $6($){return g0($)&&$.nodeType===u5&&a($.nodeName)&&!W6($)&&p5.every((K)=>(K in $))}function m4($){return $===Number.POSITIVE_INFINITY||$===Number.NEGATIVE_INFINITY}function l4($,K){if(v0(K))return $>=Math.min(0,K)&&$<=Math.max(K,0);if(s(K)&&K.length===2)return $>=Math.min(...K)&&$<=Math.max(...K);throw new TypeError(`Invalid range: ${JSON.stringify(K)}`)}function i4($){return S($)==="Int16Array"}function n4($){return S($)==="Int32Array"}function o4($){return S($)==="Int8Array"}function K6($){return Number.isInteger($)}function J6($){return k($?.[Symbol.iterator])}function x0($){return S($)==="Map"}function X6($){return Number.isNaN($)}function Z6($){return S($)==="Promise"}function r4($){return v0($)&&$<0}function s4($){return g0($)&&k($.pipe)&&!n1($)}function t4($){return s($)&&$.length>0}function a4($){return x0($)&&$.size>0}function e4($){return g0($)&&!x0($)&&!c0($)&&Object.keys($).length>0}function $9($){return c0($)&&$.size>0}function K9($){return a($)&&$.length>0}function J9($){return a($)&&!i1($)}function Q1($){return $===null}function Q6($){return Q1($)||G6($)}function v0($){return typeof $==="number"&&!Number.isNaN($)}function X9($){return a($)&&!i1($)&&!Number.isNaN(Number($))}function g0($){return!Q1($)&&(typeof $==="object"||k($))}function n1($){if(!$)return!1;if($===$[Symbol.observable]?.())return!0;if($===$["@@observable"]?.())return!0;return!1}function Z9($){return L4(1)($)}function W6($){if(typeof $!=="object"||$===null)return!1;let K=Object.getPrototypeOf($);return(K===null||K===Object.prototype||Object.getPrototypeOf(K)===null)&&!(Symbol.toStringTag in $)&&!(Symbol.iterator in $)}function Q9($){return v0($)&&$>0}function W9($){return Q1($)||c5(typeof $)}function Y9($){return Z6($)||d5($)}function V9($){return s$([a,v0,V6],$)}function G9($){return S($)==="RegExp"}function Y6($){return Number.isSafeInteger($)}function c0($){return S($)==="Set"}function U9($){return S($)==="SharedArrayBuffer"}function a($){return typeof $==="string"}function V6($){return typeof $==="symbol"}function z9($){return Boolean($)}function B9($,K){if(s(K)&&s($)&&K.length===$.length)return K.every((J,X)=>J($[X]));return!1}function w9($){return v5(S($))}function M9($){return S($)==="Uint16Array"}function L9($){return S($)==="Uint32Array"}function F9($){return S($)==="Uint8Array"}function P9($){return S($)==="Uint8ClampedArray"}function G6($){return $===void 0}function H9($){return S($)==="URL"}function f9($){return S($)==="URLSearchParams"}function A9($){if(!a($))return!1;try{return new URL($),!0}catch{return!1}}function R9($){return a$($)&&!X6(Number($))}function U6($){return Y6($)&&$>=0}function E9($){return S($)==="WeakMap"}function q9($){return S($)==="WeakRef"}function N9($){return S($)==="WeakSet"}function z6($){return a($)&&/^\s+$/.test($)}function j9($,K,J){if(!k(K))throw new TypeError(`Invalid predicate: ${JSON.stringify(K)}`);if(J.length===0)throw new TypeError("Invalid number of values");return $.call(J,K)}function f($,K){return`Expected value which is \`${$}\`, received value of type \`${r$(K)}\`.`}function z4($){return Array.from(new Set($))}var m5=new Intl.ListFormat("en",{style:"long",type:"conjunction"}),l5=new Intl.ListFormat("en",{style:"long",type:"disjunction"});function T9($,K){let J=z4((s($)?$:[$]).map((Z)=>`\`${Z}\``)),X=z4(K.map((Z)=>`\`${r$(Z)}\``));return`Expected values which are ${l5.format(J)}. Received values of type${X.length>1?"s":""} ${m5.format(X)}.`}var P={all:o5,any:r5,array:s5,arrayBuffer:t5,arrayLike:a5,asyncFunction:e5,asyncGenerator:$Y,asyncGeneratorFunction:KY,asyncIterable:JY,bigint:XY,bigInt64Array:ZY,bigUint64Array:QY,blob:WY,boolean:YY,boundFunction:VY,buffer:GY,class:UY,dataView:zY,date:BY,directInstanceOf:wY,emptyArray:MY,emptyMap:LY,emptyObject:FY,emptySet:PY,emptyString:HY,emptyStringOrWhitespace:fY,enumCase:AY,error:RY,evenInteger:EY,falsy:qY,float32Array:NY,float64Array:jY,formData:TY,function:OY,generator:SY,generatorFunction:IY,htmlElement:CY,infinite:DY,inRange:_Y,int16Array:yY,int32Array:bY,int8Array:kY,integer:hY,iterable:xY,map:vY,nan:gY,nativePromise:cY,negativeNumber:dY,nodeStream:uY,nonEmptyArray:pY,nonEmptyMap:mY,nonEmptyObject:lY,nonEmptySet:iY,nonEmptyString:nY,nonEmptyStringAndNotWhitespace:oY,null:rY,nullOrUndefined:sY,number:tY,numericString:aY,object:eY,observable:$V,oddInteger:KV,plainObject:JV,positiveNumber:XV,primitive:ZV,promise:QV,propertyKey:WV,regExp:YV,safeInteger:VV,set:GV,sharedArrayBuffer:UV,string:zV,symbol:BV,truthy:wV,tupleLike:MV,typedArray:LV,uint16Array:FV,uint32Array:PV,uint8Array:HV,uint8ClampedArray:fV,undefined:AV,urlInstance:RV,urlSearchParams:EV,urlString:qV,validDate:NV,validLength:jV,weakMap:TV,weakRef:OV,weakSet:SV,whitespaceString:IV},B6={isArray:"Array",isArrayBuffer:"ArrayBuffer",isArrayLike:"array-like",isAsyncFunction:"AsyncFunction",isAsyncGenerator:"AsyncGenerator",isAsyncGeneratorFunction:"AsyncGeneratorFunction",isAsyncIterable:"AsyncIterable",isBigint:"bigint",isBigInt64Array:"BigInt64Array",isBigUint64Array:"BigUint64Array",isBlob:"Blob",isBoolean:"boolean",isBoundFunction:"Function",isBuffer:"Buffer",isClass:"Class",isDataView:"DataView",isDate:"Date",isDirectInstanceOf:"T",isEmptyArray:"empty array",isEmptyMap:"empty map",isEmptyObject:"empty object",isEmptySet:"empty set",isEmptyString:"empty string",isEmptyStringOrWhitespace:"empty string or whitespace",isEnumCase:"EnumCase",isError:"Error",isEvenInteger:"even integer",isFalsy:"falsy",isFloat32Array:"Float32Array",isFloat64Array:"Float64Array",isFormData:"FormData",isFunction:"Function",isGenerator:"Generator",isGeneratorFunction:"GeneratorFunction",isHtmlElement:"HTMLElement",isInfinite:"infinite number",isInRange:"in range",isInt16Array:"Int16Array",isInt32Array:"Int32Array",isInt8Array:"Int8Array",isInteger:"integer",isIterable:"Iterable",isMap:"Map",isNan:"NaN",isNativePromise:"native Promise",isNegativeNumber:"negative number",isNodeStream:"Node.js Stream",isNonEmptyArray:"non-empty array",isNonEmptyMap:"non-empty map",isNonEmptyObject:"non-empty object",isNonEmptySet:"non-empty set",isNonEmptyString:"non-empty string",isNonEmptyStringAndNotWhitespace:"non-empty string and not whitespace",isNull:"null",isNullOrUndefined:"null or undefined",isNumber:"number",isNumericString:"string with a number",isObject:"Object",isObservable:"Observable",isOddInteger:"odd integer",isPlainObject:"plain object",isPositiveNumber:"positive number",isPrimitive:"primitive",isPromise:"Promise",isPropertyKey:"PropertyKey",isRegExp:"RegExp",isSafeInteger:"integer",isSet:"Set",isSharedArrayBuffer:"SharedArrayBuffer",isString:"string",isSymbol:"symbol",isTruthy:"truthy",isTupleLike:"tuple-like",isTypedArray:"TypedArray",isUint16Array:"Uint16Array",isUint32Array:"Uint32Array",isUint8Array:"Uint8Array",isUint8ClampedArray:"Uint8ClampedArray",isUndefined:"undefined",isUrlInstance:"URL",isUrlSearchParams:"URLSearchParams",isUrlString:"string with a URL",isValidDate:"valid Date",isValidLength:"valid length",isWeakMap:"WeakMap",isWeakRef:"WeakRef",isWeakSet:"WeakSet",isWhitespaceString:"whitespace string"};function i5($){return Object.keys($)}var n5=i5(B6);function O9($){return n5.includes($)}function o5($,...K){if(!F4($,...K)){let J=O9($.name)?B6[$.name]:"predicate returns truthy for all values";throw new TypeError(T9(J,K))}}function r5($,...K){if(!s$($,...K)){let X=(s($)?$:[$]).map((Z)=>O9(Z.name)?B6[Z.name]:"predicate returns truthy for any value");throw new TypeError(T9(X,K))}}function s5($,K,J){if(!s($))throw new TypeError(J??f("Array",$));if(K)for(let X of $)K(X,J)}function t5($,K){if(!P4($))throw new TypeError(K??f("ArrayBuffer",$))}function a5($,K){if(!H4($))throw new TypeError(K??f("array-like",$))}function e5($,K){if(!f4($))throw new TypeError(K??f("AsyncFunction",$))}function $Y($,K){if(!A4($))throw new TypeError(K??f("AsyncGenerator",$))}function KY($,K){if(!R4($))throw new TypeError(K??f("AsyncGeneratorFunction",$))}function JY($,K){if(!t$($))throw new TypeError(K??f("AsyncIterable",$))}function XY($,K){if(!E4($))throw new TypeError(K??f("bigint",$))}function ZY($,K){if(!q4($))throw new TypeError(K??f("BigInt64Array",$))}function QY($,K){if(!N4($))throw new TypeError(K??f("BigUint64Array",$))}function WY($,K){if(!j4($))throw new TypeError(K??f("Blob",$))}function YY($,K){if(!T4($))throw new TypeError(K??f("boolean",$))}function VY($,K){if(!O4($))throw new TypeError(K??f("Function",$))}function GY($,K){if(!Z1($))throw new TypeError(K??f("Buffer",$))}function UY($,K){if(!S4($))throw new TypeError(K??f("Class",$))}function zY($,K){if(!I4($))throw new TypeError(K??f("DataView",$))}function BY($,K){if(!a$($))throw new TypeError(K??f("Date",$))}function wY($,K,J){if(!C4($,K))throw new TypeError(J??f("T",$))}function MY($,K){if(!D4($))throw new TypeError(K??f("empty array",$))}function LY($,K){if(!_4($))throw new TypeError(K??f("empty map",$))}function FY($,K){if(!y4($))throw new TypeError(K??f("empty object",$))}function PY($,K){if(!b4($))throw new TypeError(K??f("empty set",$))}function HY($,K){if(!e$($))throw new TypeError(K??f("empty string",$))}function fY($,K){if(!i1($))throw new TypeError(K??f("empty string or whitespace",$))}function AY($,K,J){if(!k4($,K))throw new TypeError(J??f("EnumCase",$))}function RY($,K){if(!h4($))throw new TypeError(K??f("Error",$))}function EY($,K){if(!x4($))throw new TypeError(K??f("even integer",$))}function qY($,K){if(!v4($))throw new TypeError(K??f("falsy",$))}function NY($,K){if(!g4($))throw new TypeError(K??f("Float32Array",$))}function jY($,K){if(!c4($))throw new TypeError(K??f("Float64Array",$))}function TY($,K){if(!d4($))throw new TypeError(K??f("FormData",$))}function OY($,K){if(!k($))throw new TypeError(K??f("Function",$))}function SY($,K){if(!u4($))throw new TypeError(K??f("Generator",$))}function IY($,K){if(!p4($))throw new TypeError(K??f("GeneratorFunction",$))}function CY($,K){if(!$6($))throw new TypeError(K??f("HTMLElement",$))}function DY($,K){if(!m4($))throw new TypeError(K??f("infinite number",$))}function _Y($,K,J){if(!l4($,K))throw new TypeError(J??f("in range",$))}function yY($,K){if(!i4($))throw new TypeError(K??f("Int16Array",$))}function bY($,K){if(!n4($))throw new TypeError(K??f("Int32Array",$))}function kY($,K){if(!o4($))throw new TypeError(K??f("Int8Array",$))}function hY($,K){if(!K6($))throw new TypeError(K??f("integer",$))}function xY($,K){if(!J6($))throw new TypeError(K??f("Iterable",$))}function vY($,K){if(!x0($))throw new TypeError(K??f("Map",$))}function gY($,K){if(!X6($))throw new TypeError(K??f("NaN",$))}function cY($,K){if(!Z6($))throw new TypeError(K??f("native Promise",$))}function dY($,K){if(!r4($))throw new TypeError(K??f("negative number",$))}function uY($,K){if(!s4($))throw new TypeError(K??f("Node.js Stream",$))}function pY($,K){if(!t4($))throw new TypeError(K??f("non-empty array",$))}function mY($,K){if(!a4($))throw new TypeError(K??f("non-empty map",$))}function lY($,K){if(!e4($))throw new TypeError(K??f("non-empty object",$))}function iY($,K){if(!$9($))throw new TypeError(K??f("non-empty set",$))}function nY($,K){if(!K9($))throw new TypeError(K??f("non-empty string",$))}function oY($,K){if(!J9($))throw new TypeError(K??f("non-empty string and not whitespace",$))}function rY($,K){if(!Q1($))throw new TypeError(K??f("null",$))}function sY($,K){if(!Q6($))throw new TypeError(K??f("null or undefined",$))}function tY($,K){if(!v0($))throw new TypeError(K??f("number",$))}function aY($,K){if(!X9($))throw new TypeError(K??f("string with a number",$))}function eY($,K){if(!g0($))throw new TypeError(K??f("Object",$))}function $V($,K){if(!n1($))throw new TypeError(K??f("Observable",$))}function KV($,K){if(!Z9($))throw new TypeError(K??f("odd integer",$))}function JV($,K){if(!W6($))throw new TypeError(K??f("plain object",$))}function XV($,K){if(!Q9($))throw new TypeError(K??f("positive number",$))}function ZV($,K){if(!W9($))throw new TypeError(K??f("primitive",$))}function QV($,K){if(!Y9($))throw new TypeError(K??f("Promise",$))}function WV($,K){if(!V9($))throw new TypeError(K??f("PropertyKey",$))}function YV($,K){if(!G9($))throw new TypeError(K??f("RegExp",$))}function VV($,K){if(!Y6($))throw new TypeError(K??f("integer",$))}function GV($,K){if(!c0($))throw new TypeError(K??f("Set",$))}function UV($,K){if(!U9($))throw new TypeError(K??f("SharedArrayBuffer",$))}function zV($,K){if(!a($))throw new TypeError(K??f("string",$))}function BV($,K){if(!V6($))throw new TypeError(K??f("symbol",$))}function wV($,K){if(!z9($))throw new TypeError(K??f("truthy",$))}function MV($,K,J){if(!B9($,K))throw new TypeError(J??f("tuple-like",$))}function LV($,K){if(!w9($))throw new TypeError(K??f("TypedArray",$))}function FV($,K){if(!M9($))throw new TypeError(K??f("Uint16Array",$))}function PV($,K){if(!L9($))throw new TypeError(K??f("Uint32Array",$))}function HV($,K){if(!F9($))throw new TypeError(K??f("Uint8Array",$))}function fV($,K){if(!P9($))throw new TypeError(K??f("Uint8ClampedArray",$))}function AV($,K){if(!G6($))throw new TypeError(K??f("undefined",$))}function RV($,K){if(!H9($))throw new TypeError(K??f("URL",$))}function EV($,K){if(!f9($))throw new TypeError(K??f("URLSearchParams",$))}function qV($,K){if(!A9($))throw new TypeError(K??f("string with a URL",$))}function NV($,K){if(!R9($))throw new TypeError(K??f("valid Date",$))}function jV($,K){if(!U6($))throw new TypeError(K??f("valid length",$))}function TV($,K){if(!E9($))throw new TypeError(K??f("WeakMap",$))}function OV($,K){if(!q9($))throw new TypeError(K??f("WeakRef",$))}function SV($,K){if(!N9($))throw new TypeError(K??f("WeakSet",$))}function IV($,K){if(!z6($))throw new TypeError(K??f("whitespace string",$))}var G=r$;import{EventEmitter as gz}from"events";class S9 extends Error{constructor($){super($||"Promise was canceled");this.name="CancelError"}get isCanceled(){return!0}}var e=Object.freeze({pending:Symbol("pending"),canceled:Symbol("canceled"),resolved:Symbol("resolved"),rejected:Symbol("rejected")});class d0{static fn($){return(...K)=>new d0((J,X,Z)=>{K.push(Z),$(...K).then(J,X)})}#J=[];#X=!0;#$=e.pending;#K;#Z;constructor($){this.#K=new Promise((K,J)=>{this.#Z=J;let X=(W)=>{if(this.#$!==e.canceled||!Q.shouldReject)K(W),this.#Q(e.resolved)},Z=(W)=>{if(this.#$!==e.canceled||!Q.shouldReject)J(W),this.#Q(e.rejected)},Q=(W)=>{if(this.#$!==e.pending)throw new Error(`The \`onCancel\` handler was attached after the promise ${this.#$.description}.`);this.#J.push(W)};Object.defineProperties(Q,{shouldReject:{get:()=>this.#X,set:(W)=>{this.#X=W}}}),$(X,Z,Q)})}then($,K){return this.#K.then($,K)}catch($){return this.#K.catch($)}finally($){return this.#K.finally($)}cancel($){if(this.#$!==e.pending)return;if(this.#Q(e.canceled),this.#J.length>0)try{for(let K of this.#J)K()}catch(K){this.#Z(K);return}if(this.#X)this.#Z(new S9($))}get isCanceled(){return this.#$===e.canceled}#Q($){if(this.#$===e.pending)this.#$=$}}Object.setPrototypeOf(d0.prototype,Promise.prototype);function CV($){return G.object($)&&"_onResponse"in $}class I extends Error{input;code;stack;response;request;timings;constructor($,K,J){super($,{cause:K});if(Error.captureStackTrace(this,this.constructor),this.name="RequestError",this.code=K.code??"ERR_GOT_REQUEST_ERROR",this.input=K.input,CV(J))Object.defineProperty(this,"request",{enumerable:!1,value:J}),Object.defineProperty(this,"response",{enumerable:!1,value:J.response}),this.options=J.options;else this.options=J;if(this.timings=this.request?.timings,G.string(K.stack)&&G.string(this.stack)){let X=this.stack.indexOf(this.message)+this.message.length,Z=this.stack.slice(X).split(` +`).reverse(),Q=K.stack.slice(K.stack.indexOf(K.message)+K.message.length).split(` +`).reverse();while(Q.length>0&&Q[0]===Z[0])Z.shift();this.stack=`${this.stack.slice(0,X)}${Z.reverse().join(` +`)}${Q.reverse().join(` +`)}`}}}class w6 extends I{constructor($){super(`Redirected ${$.options.maxRedirects} times. Aborting.`,{},$);this.name="MaxRedirectsError",this.code="ERR_TOO_MANY_REDIRECTS"}}class R0 extends I{constructor($){super(`Response code ${$.statusCode} (${$.statusMessage})`,{},$.request);this.name="HTTPError",this.code="ERR_NON_2XX_3XX_RESPONSE"}}class M6 extends I{constructor($,K){super($.message,$,K);this.name="CacheError",this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_CACHE_ACCESS":this.code}}class o1 extends I{constructor($,K){super($.message,$,K);this.name="UploadError",this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_UPLOAD":this.code}}class r1 extends I{timings;event;constructor($,K,J){super($.message,$,J);this.name="TimeoutError",this.event=$.event,this.timings=K}}class s1 extends I{constructor($,K){super($.message,$,K);this.name="ReadError",this.code=this.code==="ERR_GOT_REQUEST_ERROR"?"ERR_READING_RESPONSE_STREAM":this.code}}class L6 extends I{constructor($){super("Retrying",{},$);this.name="RetryError",this.code="ERR_RETRYING"}}class F6 extends I{constructor($){super("This operation was aborted.",{},$);this.code="ERR_ABORTED",this.name="AbortError"}}import iX from"process";import{Buffer as q1}from"buffer";import{Duplex as yz}from"stream";import bz,{ServerResponse as lX}from"http";var D9=S0(C9(),1);import{errorMonitor as yV}from"events";import{types as bV}from"util";var kV=($)=>{if($.timings)return $.timings;let K={start:Date.now(),socket:void 0,lookup:void 0,connect:void 0,secureConnect:void 0,upload:void 0,response:void 0,end:void 0,error:void 0,abort:void 0,phases:{wait:void 0,dns:void 0,tcp:void 0,tls:void 0,request:void 0,firstByte:void 0,download:void 0,total:void 0}};$.timings=K;let J=(W)=>{W.once(yV,()=>{K.error=Date.now(),K.phases.total=K.error-K.start})};J($);let X=()=>{K.abort=Date.now(),K.phases.total=K.abort-K.start};$.prependOnceListener("abort",X);let Z=(W)=>{if(K.socket=Date.now(),K.phases.wait=K.socket-K.start,bV.isProxy(W))return;let Y=()=>{K.lookup=Date.now(),K.phases.dns=K.lookup-K.socket};W.prependOnceListener("lookup",Y),D9.default(W,{connect:()=>{if(K.connect=Date.now(),K.lookup===void 0)W.removeListener("lookup",Y),K.lookup=K.connect,K.phases.dns=K.lookup-K.socket;K.phases.tcp=K.connect-K.lookup},secureConnect:()=>{K.secureConnect=Date.now(),K.phases.tls=K.secureConnect-K.connect}})};if($.socket)Z($.socket);else $.prependOnceListener("socket",Z);let Q=()=>{K.upload=Date.now(),K.phases.request=K.upload-(K.secureConnect??K.connect)};if($.writableFinished)Q();else $.prependOnceListener("finish",Q);return $.prependOnceListener("response",(W)=>{K.response=Date.now(),K.phases.firstByte=K.response-K.upload,W.timings=K,J(W),W.prependOnceListener("end",()=>{if($.off("abort",X),W.off("aborted",X),K.phases.total)return;K.end=Date.now(),K.phases.download=K.end-K.response,K.phases.total=K.end-K.start}),W.prependOnceListener("aborted",X)}),K},_9=kV;import HG from"events";import a1 from"url";import fG from"crypto";import AG,{PassThrough as RG}from"stream";var f6=($,K)=>K.some((J)=>J instanceof RegExp?J.test($):J===$),hV=new Set(["https:","http:","file:"]),xV=($)=>{try{let{protocol:K}=new URL($);return K.endsWith(":")&&!K.includes(".")&&!hV.has(K)}catch{return!1}},vV=($,{stripHash:K})=>{let J=/^data:(?[^,]*?),(?[^#]*?)(?:#(?.*))?$/.exec($);if(!J)throw new Error(`Invalid URL: ${$}`);let{type:X,data:Z,hash:Q}=J.groups,W=X.split(";");Q=K?"":Q;let Y=!1;if(W[W.length-1]==="base64")W.pop(),Y=!0;let V=W.shift()?.toLowerCase()??"",U=[...W.map((B)=>{let[w,F=""]=B.split("=").map((L)=>L.trim());if(w==="charset"){if(F=F.toLowerCase(),F==="us-ascii")return""}return`${w}${F?`=${F}`:""}`}).filter(Boolean)];if(Y)U.push("base64");if(U.length>0||V&&V!=="text/plain")U.unshift(V);return`data:${U.join(";")},${Y?Z.trim():Z}${Q?`#${Q}`:""}`};function A6($,K){if(K={defaultProtocol:"http",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,removeExplicitPort:!1,sortQueryParameters:!0,...K},typeof K.defaultProtocol==="string"&&!K.defaultProtocol.endsWith(":"))K.defaultProtocol=`${K.defaultProtocol}:`;if($=$.trim(),/^data:/i.test($))return vV($,K);if(xV($))return $;let J=$.startsWith("//");if(!(!J&&/^\.*\//.test($)))$=$.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,K.defaultProtocol);let Z=new URL($);if(K.forceHttp&&K.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(K.forceHttp&&Z.protocol==="https:")Z.protocol="http:";if(K.forceHttps&&Z.protocol==="http:")Z.protocol="https:";if(K.stripAuthentication)Z.username="",Z.password="";if(K.stripHash)Z.hash="";else if(K.stripTextFragment)Z.hash=Z.hash.replace(/#?:~:text.*?$/i,"");if(Z.pathname){let W=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,Y=0,V="";for(;;){let U=W.exec(Z.pathname);if(!U)break;let B=U[0],w=U.index,F=Z.pathname.slice(Y,w);V+=F.replace(/\/{2,}/g,"/"),V+=B,Y=w+B.length}let z=Z.pathname.slice(Y,Z.pathname.length);V+=z.replace(/\/{2,}/g,"/"),Z.pathname=V}if(Z.pathname)try{Z.pathname=decodeURI(Z.pathname)}catch{}if(K.removeDirectoryIndex===!0)K.removeDirectoryIndex=[/^index\.[a-z]+$/];if(Array.isArray(K.removeDirectoryIndex)&&K.removeDirectoryIndex.length>0){let W=Z.pathname.split("/"),Y=W[W.length-1];if(f6(Y,K.removeDirectoryIndex))W=W.slice(0,-1),Z.pathname=W.slice(1).join("/")+"/"}if(Z.hostname){if(Z.hostname=Z.hostname.replace(/\.$/,""),K.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(Z.hostname))Z.hostname=Z.hostname.replace(/^www\./,"")}if(Array.isArray(K.removeQueryParameters)){for(let W of[...Z.searchParams.keys()])if(f6(W,K.removeQueryParameters))Z.searchParams.delete(W)}if(!Array.isArray(K.keepQueryParameters)&&K.removeQueryParameters===!0)Z.search="";if(Array.isArray(K.keepQueryParameters)&&K.keepQueryParameters.length>0){for(let W of[...Z.searchParams.keys()])if(!f6(W,K.keepQueryParameters))Z.searchParams.delete(W)}if(K.sortQueryParameters){Z.searchParams.sort();try{Z.search=decodeURIComponent(Z.search)}catch{}}if(K.removeTrailingSlash)Z.pathname=Z.pathname.replace(/\/$/,"");if(K.removeExplicitPort&&Z.port)Z.port="";let Q=$;if($=Z.toString(),!K.removeSingleSlash&&Z.pathname==="/"&&!Q.endsWith("/")&&Z.hash==="")$=$.replace(/\/$/,"");if((K.removeTrailingSlash||Z.pathname==="/")&&Z.hash===""&&K.removeSingleSlash)$=$.replace(/\/$/,"");if(J&&!K.normalizeProtocol)$=$.replace(/^http:\/\//,"//");if(K.stripProtocol)$=$.replace(/^(?:https?:)?\/\//,"");return $}import{on as JG}from"events";import{finished as XG}from"stream/promises";function gV($,{checkOpen:K=!0}={}){return $!==null&&typeof $==="object"&&($.writable||$.readable||!K||$.writable===void 0&&$.readable===void 0)&&typeof $.pipe==="function"}function y9($,{checkOpen:K=!0}={}){return gV($,{checkOpen:K})&&($.readable||!K)&&typeof $.read==="function"&&typeof $.readable==="boolean"&&typeof $.readableObjectMode==="boolean"&&typeof $.destroy==="function"&&typeof $.destroyed==="boolean"}var cV=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class b9{#J;#X;#$=!1;#K=void 0;constructor($,K){this.#J=$,this.#X=K}next(){let $=()=>this.#Z();return this.#K=this.#K?this.#K.then($,$):$(),this.#K}return($){let K=()=>this.#Q($);return this.#K?this.#K.then(K,K):K()}async#Z(){if(this.#$)return{done:!0,value:void 0};let $;try{$=await this.#J.read()}catch(K){throw this.#K=void 0,this.#$=!0,this.#J.releaseLock(),K}return $.done&&(this.#K=void 0,this.#$=!0,this.#J.releaseLock()),$}async#Q($){if(this.#$)return{done:!0,value:$};if(this.#$=!0,!this.#X){let K=this.#J.cancel($);return this.#J.releaseLock(),await K,{done:!0,value:$}}return this.#J.releaseLock(),{done:!0,value:$}}}var R6=Symbol();function k9(){return this[R6].next()}Object.defineProperty(k9,"name",{value:"next"});function h9($){return this[R6].return($)}Object.defineProperty(h9,"name",{value:"return"});var dV=Object.create(cV,{next:{enumerable:!0,configurable:!0,writable:!0,value:k9},return:{enumerable:!0,configurable:!0,writable:!0,value:h9}});function E6({preventCancel:$=!1}={}){let K=this.getReader(),J=new b9(K,$),X=Object.create(dV);return X[R6]=J,X}var x9=($)=>{if(y9($,{checkOpen:!1})&&W1.on!==void 0)return pV($);if(typeof $?.[Symbol.asyncIterator]==="function")return $;if(uV.call($)==="[object ReadableStream]")return E6.call($);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:uV}=Object.prototype,pV=async function*($){let K=new AbortController,J={};mV($,K,J);try{for await(let[X]of W1.on($,"data",{signal:K.signal}))yield X}catch(X){if(J.error!==void 0)throw J.error;else if(!K.signal.aborted)throw X}finally{$.destroy()}},mV=async($,K,J)=>{try{await W1.finished($,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(X){J.error=X}finally{K.abort()}},W1={};var c9=async($,{init:K,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:Q,getFinalChunk:W,finalize:Y},{maxBuffer:V=Number.POSITIVE_INFINITY}={})=>{let z=x9($),U=K();U.length=0;try{for await(let B of z){let w=iV(B),F=J[w](B,U);d9({convertedChunk:F,state:U,getSize:X,truncateChunk:Z,addChunk:Q,maxBuffer:V})}return lV({state:U,convertChunk:J,getSize:X,truncateChunk:Z,addChunk:Q,getFinalChunk:W,maxBuffer:V}),Y(U)}catch(B){let w=typeof B==="object"&&B!==null?B:new Error(B);throw w.bufferedData=Y(U),w}},lV=({state:$,getSize:K,truncateChunk:J,addChunk:X,getFinalChunk:Z,maxBuffer:Q})=>{let W=Z($);if(W!==void 0)d9({convertedChunk:W,state:$,getSize:K,truncateChunk:J,addChunk:X,maxBuffer:Q})},d9=({convertedChunk:$,state:K,getSize:J,truncateChunk:X,addChunk:Z,maxBuffer:Q})=>{let W=J($),Y=K.length+W;if(Y<=Q){v9($,K,Z,Y);return}let V=X($,Q-K.length);if(V!==void 0)v9(V,K,Z,Q);throw new q6},v9=($,K,J,X)=>{K.contents=J($,K,X),K.length=X},iV=($)=>{let K=typeof $;if(K==="string")return"string";if(K!=="object"||$===null)return"others";if(globalThis.Buffer?.isBuffer($))return"buffer";let J=g9.call($);if(J==="[object ArrayBuffer]")return"arrayBuffer";if(J==="[object DataView]")return"dataView";if(Number.isInteger($.byteLength)&&Number.isInteger($.byteOffset)&&g9.call($.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},{toString:g9}=Object.prototype;class q6 extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}var u9=()=>{return};var p9=($)=>{throw new Error(`Streams in object mode are not supported: ${String($)}`)},m9=($)=>$.length;async function N6($,K){return c9($,KG,K)}var nV=()=>({contents:new ArrayBuffer(0)}),oV=($)=>rV.encode($),rV=new TextEncoder,l9=($)=>new Uint8Array($),i9=($)=>new Uint8Array($.buffer,$.byteOffset,$.byteLength),sV=($,K)=>$.slice(0,K),tV=($,{contents:K,length:J},X)=>{let Z=r9()?eV(K,X):aV(K,X);return new Uint8Array(Z).set($,J),Z},aV=($,K)=>{if(K<=$.byteLength)return $;let J=new ArrayBuffer(o9(K));return new Uint8Array(J).set(new Uint8Array($),0),J},eV=($,K)=>{if(K<=$.maxByteLength)return $.resize(K),$;let J=new ArrayBuffer(K,{maxByteLength:o9(K)});return new Uint8Array(J).set(new Uint8Array($),0),J},o9=($)=>n9**Math.ceil(Math.log($)/Math.log(n9)),n9=2,$G=({contents:$,length:K})=>r9()?$:$.slice(0,K),r9=()=>("resize"in ArrayBuffer.prototype),KG={init:nV,convertChunk:{string:oV,buffer:l9,arrayBuffer:l9,dataView:i9,typedArray:i9,others:p9},getSize:m9,truncateChunk:sV,addChunk:tV,getFinalChunk:u9,finalize:$G};async function t1($,K){if(!("Buffer"in globalThis))throw new Error("getStreamAsBuffer() is only supported in Node.js");try{return s9(await N6($,K))}catch(J){if(J.bufferedData!==void 0)J.bufferedData=s9(J.bufferedData);throw J}}var s9=($)=>globalThis.Buffer.from($);Object.assign(W1,{on:JG,finished:XG});var e1=S0(a9(),1);import{Readable as zG}from"stream";function u0($){return Object.fromEntries(Object.entries($).map(([K,J])=>[K.toLowerCase(),J]))}class Y1 extends zG{statusCode;headers;body;url;constructor({statusCode:$,headers:K,body:J,url:X}){if(typeof $!=="number")throw new TypeError("Argument `statusCode` should be a number");if(typeof K!=="object")throw new TypeError("Argument `headers` should be an object");if(!(J instanceof Uint8Array))throw new TypeError("Argument `body` should be a buffer");if(typeof X!=="string")throw new TypeError("Argument `url` should be a string");super({read(){this.push(J),this.push(null)}});this.statusCode=$,this.headers=u0(K),this.body=J,this.url=X}}var V1=S0(ZJ(),1);var PG=["aborted","complete","headers","httpVersion","httpVersionMinor","httpVersionMajor","method","rawHeaders","rawTrailers","setTimeout","socket","statusCode","statusMessage","trailers","url"];function T6($,K){if(K._readableState.autoDestroy)throw new Error("The second stream must have the `autoDestroy` option set to `false`");let J=new Set([...Object.keys($),...PG]),X={};for(let Z of J){if(Z in K)continue;X[Z]={get(){let Q=$[Z];return typeof Q==="function"?Q.bind($):Q},set(Q){$[Z]=Q},enumerable:!0,configurable:!1}}return Object.defineProperties(K,X),$.once("aborted",()=>{K.destroy(),K.emit("aborted")}),$.once("close",()=>{if($.complete)if(K.readable)K.once("end",()=>{K.emit("close")});else K.emit("close");else K.emit("close")}),K}class O6 extends Error{constructor($){super($.message);Object.assign(this,$)}}class U0 extends Error{constructor($){super($.message);Object.assign(this,$)}}class WJ{constructor($,K){if(this.hooks=new Map,this.request=()=>(J,X)=>{let Z;if(typeof J==="string")Z=S6(a1.parse(J)),J={};else if(J instanceof a1.URL)Z=S6(a1.parse(J.toString())),J={};else{let[B,...w]=(J.path??"").split("?"),F=w.length>0?`?${w.join("?")}`:"";Z=S6({...J,pathname:B,search:F})}J={headers:{},method:"GET",cache:!0,strictTtl:!1,automaticFailover:!1,...J,...NG(Z)},J.headers=Object.fromEntries(EG(J.headers).map(([B,w])=>[B.toLowerCase(),w]));let Q=new HG,W=A6(a1.format(Z),{stripWWW:!1,removeTrailingSlash:!1,stripAuthentication:!1}),Y=`${J.method}:${W}`;if(J.body&&J.method!==void 0&&["POST","PATCH","PUT"].includes(J.method))if(J.body instanceof AG.Readable)J.cache=!1;else Y+=`:${fG.createHash("md5").update(J.body).digest("hex")}`;let V=!1,z=!1,U=(B)=>{z=!0;let w=!1,F=()=>{},L=new Promise((M)=>{F=()=>{if(!w)w=!0,M()}}),H=async(M)=>{if(V){M.status=M.statusCode;let R=e1.default.fromObject(V.cachePolicy).revalidatedPolicy(B,M);if(!R.modified){M.resume(),await new Promise((T)=>{M.once("end",T)});let q=QJ(R.policy.responseHeaders());M=new Y1({statusCode:V.statusCode,headers:q,body:V.body,url:V.url}),M.cachePolicy=R.policy,M.fromCache=!0}}if(!M.fromCache)M.cachePolicy=new e1.default(B,M,B),M.fromCache=!1;let N;if(B.cache&&M.cachePolicy.storable())N=qG(M),(async()=>{try{let R=t1(M);await Promise.race([L,new Promise((x)=>M.once("end",x)),new Promise((x)=>M.once("close",x))]);let q=await R,T={url:M.url,statusCode:M.fromCache?V.statusCode:M.statusCode,body:q,cachePolicy:M.cachePolicy.toObject()},b=B.strictTtl?M.cachePolicy.timeToLive():void 0;if(B.maxTtl)b=b?Math.min(b,B.maxTtl):B.maxTtl;if(this.hooks.size>0)for(let x of this.hooks.keys())T=await this.runHook(x,T,M);await this.cache.set(Y,T,b)}catch(R){Q.emit("error",new U0(R))}})();else if(B.cache&&V)(async()=>{try{await this.cache.delete(Y)}catch(R){Q.emit("error",new U0(R))}})();if(Q.emit("response",N??M),typeof X==="function")X(N??M)};try{let M=this.cacheRequest(B,H);M.once("error",F),M.once("abort",F),M.once("destroy",F),Q.emit("request",M)}catch(M){Q.emit("error",new O6(M))}};return(async()=>{let B=async(F)=>{await Promise.resolve();let L=F.cache?await this.cache.get(Y):void 0;if(L===void 0&&!F.forceRefresh){U(F);return}let H=e1.default.fromObject(L.cachePolicy);if(H.satisfiesWithoutRevalidation(F)&&!F.forceRefresh){let M=QJ(H.responseHeaders()),N=new Y1({statusCode:L.statusCode,headers:M,body:L.body,url:L.url});if(N.cachePolicy=H,N.fromCache=!0,Q.emit("response",N),typeof X==="function")X(N)}else if(H.satisfiesWithoutRevalidation(F)&&Date.now()>=H.timeToLive()&&F.forceRefresh)await this.cache.delete(Y),F.headers=H.revalidationHeaders(F),U(F);else V=L,F.headers=H.revalidationHeaders(F),U(F)},w=(F)=>Q.emit("error",new U0(F));if(this.cache instanceof V1.default){let F=this.cache;F.once("error",w),Q.on("error",()=>F.removeListener("error",w)),Q.on("response",()=>F.removeListener("error",w))}try{await B(J)}catch(F){if(J.automaticFailover&&!z)U(J);Q.emit("error",new U0(F))}})(),Q},this.addHook=(J,X)=>{if(!this.hooks.has(J))this.hooks.set(J,X)},this.removeHook=(J)=>this.hooks.delete(J),this.getHook=(J)=>this.hooks.get(J),this.runHook=async(J,...X)=>this.hooks.get(J)?.(...X),K instanceof V1.default)this.cache=K;else if(typeof K==="string")this.cache=new V1.default({uri:K,namespace:"cacheable-request"});else this.cache=new V1.default({store:K,namespace:"cacheable-request"});this.request=this.request.bind(this),this.cacheRequest=$}}var EG=Object.entries,qG=($)=>{let K=new RG({autoDestroy:!1});return T6($,K),$.pipe(K)},NG=($)=>{let K={...$};return K.path=`${$.pathname||"/"}${$.search||""}`,delete K.pathname,delete K.search,K},S6=($)=>({protocol:$.protocol,auth:$.auth,hostname:$.hostname||$.host||"localhost",port:$.port,pathname:$.pathname,search:$.search}),QJ=($)=>{let K=[];for(let J of Object.keys($))K[J.toLowerCase()]=$[J];return K},YJ=WJ;var nX=S0(zJ(),1);var _6=($,K,J)=>{if(!K.has($))throw TypeError("Cannot "+J)},C=($,K,J)=>{return _6($,K,"read from private field"),J?J.call($):K.get($)},$0=($,K,J)=>{if(K.has($))throw TypeError("Cannot add the same private member more than once");K instanceof WeakSet?K.add($):K.set($,J)},G1=($,K,J,X)=>{return _6($,K,"write to private field"),X?X.call($,J):K.set($,J),J},C6=($,K,J)=>{return _6($,K,"access private method"),J},X0=($)=>typeof $==="function",IG=($)=>X0($[Symbol.asyncIterator]),BJ=65536;function*HJ($){if($.byteLength<=BJ){yield $;return}let K=0;while(K<$.byteLength){let J=Math.min($.byteLength-K,BJ),X=$.buffer.slice(K,K+J);K+=X.byteLength,yield new Uint8Array(X)}}async function*CG($){let K=$.getReader();while(!0){let{done:J,value:X}=await K.read();if(J)break;yield X}}async function*wJ($){for await(let K of $)yield*HJ(K)}var DG=($)=>{if(IG($))return wJ($);if(X0($.getReader))return wJ(CG($));throw new TypeError("Unsupported data source: Expected either ReadableStream or async iterable.")},MJ="abcdefghijklmnopqrstuvwxyz0123456789";function _G(){let $=16,K="";while($--)K+=MJ[Math.random()*MJ.length<<0];return K}var fJ=($)=>String($).replace(/\r|\n/g,(K,J,X)=>{if(K==="\r"&&X[J+1]!==` +`||K===` +`&&X[J-1]!=="\r")return`\r +`;return K}),yG=($)=>Object.prototype.toString.call($).slice(8,-1).toLowerCase();function LJ($){if(yG($)!=="object")return!1;let K=Object.getPrototypeOf($);if(K===null||K===void 0)return!0;return(K.constructor&&K.constructor.toString())===Object.toString()}function FJ($,K){if(typeof K==="string"){for(let[J,X]of Object.entries($))if(K.toLowerCase()===J.toLowerCase())return X}return}var bG=($)=>new Proxy($,{get:(K,J)=>FJ(K,J),has:(K,J)=>FJ(K,J)!==void 0}),M1=($)=>Boolean($&&X0($.constructor)&&$[Symbol.toStringTag]==="FormData"&&X0($.append)&&X0($.getAll)&&X0($.entries)&&X0($[Symbol.iterator])),PJ=($)=>String($).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),p0=($)=>Boolean($&&typeof $==="object"&&X0($.constructor)&&$[Symbol.toStringTag]==="File"&&X0($.stream)&&$.name!=null),kG={enableAdditionalHeaders:!1},$$={writable:!1,configurable:!1},z0,U1,K$,z1,q0,B1,w1,J$,X$,y6,D6,AJ,RJ=class{constructor($,K,J){if($0(this,X$),$0(this,D6),$0(this,z0,`\r +`),$0(this,U1,void 0),$0(this,K$,void 0),$0(this,z1,"-".repeat(2)),$0(this,q0,new TextEncoder),$0(this,B1,void 0),$0(this,w1,void 0),$0(this,J$,void 0),!M1($))throw new TypeError("Expected first argument to be a FormData instance.");let X;if(LJ(K))J=K;else X=K;if(!X)X=_G();if(typeof X!=="string")throw new TypeError("Expected boundary argument to be a string.");if(J&&!LJ(J))throw new TypeError("Expected options argument to be an object.");G1(this,w1,Array.from($.entries())),G1(this,J$,{...kG,...J}),G1(this,U1,C(this,q0).encode(C(this,z0))),G1(this,K$,C(this,U1).byteLength),this.boundary=`form-data-boundary-${X}`,this.contentType=`multipart/form-data; boundary=${this.boundary}`,G1(this,B1,C(this,q0).encode(`${C(this,z1)}${this.boundary}${C(this,z1)}${C(this,z0).repeat(2)}`));let Z={"Content-Type":this.contentType},Q=C6(this,D6,AJ).call(this);if(Q)this.contentLength=Q,Z["Content-Length"]=Q;this.headers=bG(Object.freeze(Z)),Object.defineProperties(this,{boundary:$$,contentType:$$,contentLength:$$,headers:$$})}*values(){for(let[$,K]of C(this,w1)){let J=p0(K)?K:C(this,q0).encode(fJ(K));yield C6(this,X$,y6).call(this,$,J),yield J,yield C(this,U1)}yield C(this,B1)}async*encode(){for(let $ of this.values())if(p0($))yield*DG($.stream());else yield*HJ($)}[Symbol.iterator](){return this.values()}[Symbol.asyncIterator](){return this.encode()}};z0=new WeakMap;U1=new WeakMap;K$=new WeakMap;z1=new WeakMap;q0=new WeakMap;B1=new WeakMap;w1=new WeakMap;J$=new WeakMap;X$=new WeakSet;y6=function($,K){let J="";if(J+=`${C(this,z1)}${this.boundary}${C(this,z0)}`,J+=`Content-Disposition: form-data; name="${PJ($)}"`,p0(K))J+=`; filename="${PJ(K.name)}"${C(this,z0)}`,J+=`Content-Type: ${K.type||"application/octet-stream"}`;if(C(this,J$).enableAdditionalHeaders===!0){let X=p0(K)?K.size:K.byteLength;if(X!=null&&!isNaN(X))J+=`${C(this,z0)}Content-Length: ${X}`}return C(this,q0).encode(`${J}${C(this,z0).repeat(2)}`)};D6=new WeakSet;AJ=function(){let $=0;for(let[K,J]of C(this,w1)){let X=p0(J)?J:C(this,q0).encode(fJ(J)),Z=p0(X)?X.size:X.byteLength;if(Z==null||isNaN(Z))return;$+=C6(this,X$,y6).call(this,K,X).byteLength,$+=Z,$+=C(this,K$)}return String($+C(this,B1).byteLength)};import{Buffer as hG}from"buffer";import{promisify as xG}from"util";function L1($){return G.nodeStream($)&&G.function($.getBoundary)}async function b6($,K){if(K&&"content-length"in K)return Number(K["content-length"]);if(!$)return 0;if(G.string($))return hG.byteLength($);if(G.buffer($))return $.length;if(L1($))return xG($.getLength.bind($))();return}function F1($,K,J){let X={};for(let Z of J){let Q=(...W)=>{K.emit(Z,...W)};X[Z]=Q,$.on(Z,Q)}return()=>{for(let[Z,Q]of Object.entries(X))$.off(Z,Q)}}import vG from"net";function k6(){let $=[];return{once(K,J,X){K.once(J,X),$.push({origin:K,event:J,fn:X})},unhandleAll(){for(let K of $){let{origin:J,event:X,fn:Z}=K;J.removeListener(X,Z)}$.length=0}}}var EJ=Symbol("reentry"),gG=()=>{};class Z$ extends Error{event;code;constructor($,K){super(`Timeout awaiting '${K}' for ${$}ms`);this.event=K,this.name="TimeoutError",this.code="ETIMEDOUT"}}function h6($,K,J){if(EJ in $)return gG;$[EJ]=!0;let X=[],{once:Z,unhandleAll:Q}=k6(),W=new Map,Y=(M,N,R)=>{let q=setTimeout(N,M,M,R);q.unref?.();let T=()=>{W.set(R,!0),clearTimeout(q)};return X.push(T),T},{host:V,hostname:z}=J,U=(M,N)=>{setTimeout(()=>{if(!W.has(N))$.destroy(new Z$(M,N))},0)},B=()=>{for(let M of X)M();Q()};if($.once("error",(M)=>{if(B(),$.listenerCount("error")===0)throw M}),K.request!==void 0){let M=Y(K.request,U,"request");Z($,"response",(N)=>{Z(N,"end",M)})}if(K.socket!==void 0){let{socket:M}=K,N=()=>{U(M,"socket")};$.setTimeout(M,N),X.push(()=>{$.removeListener("timeout",N)})}let w=K.lookup!==void 0,F=K.connect!==void 0,L=K.secureConnect!==void 0,H=K.send!==void 0;if(w||F||L||H)Z($,"socket",(M)=>{let{socketPath:N}=$;if(M.connecting){let R=Boolean(N??vG.isIP(z??V??"")!==0);if(w&&!R&&M.address().address===void 0){let q=Y(K.lookup,U,"lookup");Z(M,"lookup",q)}if(F){let q=()=>Y(K.connect,U,"connect");if(R)Z(M,"connect",q());else Z(M,"lookup",(T)=>{if(T===null)Z(M,"connect",q())})}if(L&&J.protocol==="https:")Z(M,"connect",()=>{let q=Y(K.secureConnect,U,"secureConnect");Z(M,"secureConnect",q)})}if(H){let R=()=>Y(K.send,U,"send");if(M.connecting)Z(M,"connect",()=>{Z($,"upload-complete",R())});else Z($,"upload-complete",R())}});if(K.response!==void 0)Z($,"upload-complete",()=>{let M=Y(K.response,U,"response");Z($,"response",M)});if(K.read!==void 0)Z($,"response",(M)=>{let N=Y(K.read,U,"read");Z(M,"end",N)});return B}function x6($){$=$;let K={protocol:$.protocol,hostname:G.string($.hostname)&&$.hostname.startsWith("[")?$.hostname.slice(1,-1):$.hostname,host:$.host,hash:$.hash,search:$.search,pathname:$.pathname,href:$.href,path:`${$.pathname||""}${$.search||""}`};if(G.string($.port)&&$.port.length>0)K.port=Number($.port);if($.username||$.password)K.auth=`${$.username||""}:${$.password||""}`;return K}class Q${weakMap;map;constructor(){this.weakMap=new WeakMap,this.map=new Map}set($,K){if(typeof $==="object")this.weakMap.set($,K);else this.map.set($,K)}get($){if(typeof $==="object")return this.weakMap.get($);return this.map.get($)}has($){if(typeof $==="object")return this.weakMap.has($);return this.map.has($)}}var cG=({attemptCount:$,retryOptions:K,error:J,retryAfter:X,computedValue:Z})=>{if(J.name==="RetryError")return 1;if($>K.limit)return 0;let Q=K.methods.includes(J.options.method),W=K.errorCodes.includes(J.code),Y=J.response&&K.statusCodes.includes(J.response.statusCode);if(!Q||!W&&!Y)return 0;if(J.response){if(X){if(X>Z)return 0;return X}if(J.response.statusCode===413)return 0}let V=Math.random()*K.noise;return Math.min(2**($-1)*1000,K.backoffLimit)+V},qJ=cG;import fz from"process";import{promisify as cX,inspect as Az}from"util";import{checkServerIdentity as Rz}from"tls";import Ez from"https";import qz from"http";import{V4MAPPED as dG,ADDRCONFIG as uG,ALL as IJ,promises as pG,lookup as mG}from"dns";import{promisify as v6}from"util";import lG from"os";var{Resolver:NJ}=pG,m0=Symbol("cacheableLookupCreateConnection"),g6=Symbol("cacheableLookupInstance"),jJ=Symbol("expires"),iG=typeof IJ==="number",TJ=($)=>{if(!($&&typeof $.createConnection==="function"))throw new Error("Expected an Agent instance as the first argument")},nG=($)=>{for(let K of $){if(K.family===6)continue;K.address=`::ffff:${K.address}`,K.family=6}},OJ=()=>{let $=!1,K=!1;for(let J of Object.values(lG.networkInterfaces()))for(let X of J){if(X.internal)continue;if(X.family==="IPv6")K=!0;else $=!0;if($&&K)return{has4:$,has6:K}}return{has4:$,has6:K}},oG=($)=>{return Symbol.iterator in $},W$=($)=>{return $.catch((K)=>{if(K.code==="ENODATA"||K.code==="ENOTFOUND"||K.code==="ENOENT")return[];throw K})},SJ={ttl:!0},rG={all:!0},sG={all:!0,family:4},tG={all:!0,family:6};class Y${constructor({cache:$=new Map,maxTtl:K=1/0,fallbackDuration:J=3600,errorTtl:X=0.15,resolver:Z=new NJ,lookup:Q=mG}={}){if(this.maxTtl=K,this.errorTtl=X,this._cache=$,this._resolver=Z,this._dnsLookup=Q&&v6(Q),this.stats={cache:0,query:0},this._resolver instanceof NJ)this._resolve4=this._resolver.resolve4.bind(this._resolver),this._resolve6=this._resolver.resolve6.bind(this._resolver);else this._resolve4=v6(this._resolver.resolve4.bind(this._resolver)),this._resolve6=v6(this._resolver.resolve6.bind(this._resolver));if(this._iface=OJ(),this._pending={},this._nextRemovalTime=!1,this._hostnamesToFallback=new Set,this.fallbackDuration=J,J>0){let W=setInterval(()=>{this._hostnamesToFallback.clear()},J*1000);if(W.unref)W.unref();this._fallbackInterval=W}this.lookup=this.lookup.bind(this),this.lookupAsync=this.lookupAsync.bind(this)}set servers($){this.clear(),this._resolver.setServers($)}get servers(){return this._resolver.getServers()}lookup($,K,J){if(typeof K==="function")J=K,K={};else if(typeof K==="number")K={family:K};if(!J)throw new Error("Callback must be a function.");this.lookupAsync($,K).then((X)=>{if(K.all)J(null,X);else J(null,X.address,X.family,X.expires,X.ttl,X.source)},J)}async lookupAsync($,K={}){if(typeof K==="number")K={family:K};let J=await this.query($);if(K.family===6){let X=J.filter((Z)=>Z.family===6);if(K.hints&dG)if(iG&&K.hints&IJ||X.length===0)nG(J);else J=X;else J=X}else if(K.family===4)J=J.filter((X)=>X.family===4);if(K.hints&uG){let{_iface:X}=this;J=J.filter((Z)=>Z.family===6?X.has6:X.has4)}if(J.length===0){let X=new Error(`cacheableLookup ENOTFOUND ${$}`);throw X.code="ENOTFOUND",X.hostname=$,X}if(K.all)return J;return J[0]}async query($){let K="cache",J=await this._cache.get($);if(J)this.stats.cache++;if(!J){let X=this._pending[$];if(X)this.stats.cache++,J=await X;else{K="query";let Z=this.queryAndCache($);this._pending[$]=Z,this.stats.query++;try{J=await Z}finally{delete this._pending[$]}}}return J=J.map((X)=>{return{...X,source:K}}),J}async _resolve($){let[K,J]=await Promise.all([W$(this._resolve4($,SJ)),W$(this._resolve6($,SJ))]),X=0,Z=0,Q=0,W=Date.now();for(let Y of K)Y.family=4,Y.expires=W+Y.ttl*1000,X=Math.max(X,Y.ttl);for(let Y of J)Y.family=6,Y.expires=W+Y.ttl*1000,Z=Math.max(Z,Y.ttl);if(K.length>0)if(J.length>0)Q=Math.min(X,Z);else Q=X;else Q=Z;return{entries:[...K,...J],cacheTtl:Q}}async _lookup($){try{let[K,J]=await Promise.all([W$(this._dnsLookup($,sG)),W$(this._dnsLookup($,tG))]);return{entries:[...K,...J],cacheTtl:0}}catch{return{entries:[],cacheTtl:0}}}async _set($,K,J){if(this.maxTtl>0&&J>0){J=Math.min(J,this.maxTtl)*1000,K[jJ]=Date.now()+J;try{await this._cache.set($,K,J)}catch(X){this.lookupAsync=async()=>{let Z=new Error("Cache Error. Please recreate the CacheableLookup instance.");throw Z.cause=X,Z}}if(oG(this._cache))this._tick(J)}}async queryAndCache($){if(this._hostnamesToFallback.has($))return this._dnsLookup($,rG);let K=await this._resolve($);if(K.entries.length===0&&this._dnsLookup){if(K=await this._lookup($),K.entries.length!==0&&this.fallbackDuration>0)this._hostnamesToFallback.add($)}let J=K.entries.length===0?this.errorTtl:K.cacheTtl;return await this._set($,K.entries,J),K.entries}_tick($){let K=this._nextRemovalTime;if(!K||${this._nextRemovalTime=!1;let J=1/0,X=Date.now();for(let[Z,Q]of this._cache){let W=Q[jJ];if(X>=W)this._cache.delete(Z);else if(W{if(!("lookup"in K))K.lookup=this.lookup;return $[m0](K,J)}}uninstall($){if(TJ($),$[m0]){if($[g6]!==this)throw new Error("The agent is not owned by this CacheableLookup instance");$.createConnection=$[m0],delete $[m0],delete $[g6]}}updateInterfaceInfo(){let{_iface:$}=this;if(this._iface=OJ(),$.has4&&!this._iface.has4||$.has6&&!this._iface.has6)this._cache.clear()}clear($){if($){this._cache.delete($);return}this._cache.clear()}}var pX=S0(gX(),1);function J8($){let K=[],J=$.split(",");for(let X of J){let[Z,...Q]=X.split(";"),W=Z.trim();if(W[0]!=="<"||W.at(-1)!==">")throw new Error(`Invalid format of the Link header reference: ${W}`);let Y=W.slice(1,-1),V={};if(Q.length===0)throw new Error(`Unexpected end of Link header parameters: ${Q.join(";")}`);for(let z of Q){let U=z.trim(),B=U.indexOf("=");if(B===-1)throw new Error(`Failed to parse Link header: ${$}`);let w=U.slice(0,B).trim(),F=U.slice(B+1).trim();V[w]=F}K.push({reference:Y,parameters:V})}return K}var[dX,Nz]=fz.versions.node.split(".").map(Number);function jz($){for(let K in $){let J=$[K];P.any([G.string,G.number,G.boolean,G.null,G.undefined],J)}}var Tz=new Map,w$,Oz=()=>{if(w$)return w$;return w$=new Y$,w$},Sz={request:void 0,agent:{http:void 0,https:void 0,http2:void 0},h2session:void 0,decompress:!0,timeout:{connect:void 0,lookup:void 0,read:void 0,request:void 0,response:void 0,secureConnect:void 0,send:void 0,socket:void 0},prefixUrl:"",body:void 0,form:void 0,json:void 0,cookieJar:void 0,ignoreInvalidCookies:!1,searchParams:void 0,dnsLookup:void 0,dnsCache:void 0,context:{},hooks:{init:[],beforeRequest:[],beforeError:[],beforeRedirect:[],beforeRetry:[],afterResponse:[]},followRedirect:!0,maxRedirects:10,cache:void 0,throwHttpErrors:!0,username:"",password:"",http2:!1,allowGetBody:!1,headers:{"user-agent":"got (https://github.com/sindresorhus/got)"},methodRewriting:!1,dnsLookupIpVersion:void 0,parseJson:JSON.parse,stringifyJson:JSON.stringify,retry:{limit:2,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"],maxRetryAfter:void 0,calculateDelay:({computedValue:$})=>$,backoffLimit:Number.POSITIVE_INFINITY,noise:100},localAddress:void 0,method:"GET",createConnection:void 0,cacheOptions:{shared:void 0,cacheHeuristic:void 0,immutableMinTimeToLive:void 0,ignoreCargoCult:void 0},https:{alpnProtocols:void 0,rejectUnauthorized:void 0,checkServerIdentity:void 0,certificateAuthority:void 0,key:void 0,certificate:void 0,passphrase:void 0,pfx:void 0,ciphers:void 0,honorCipherOrder:void 0,minVersion:void 0,maxVersion:void 0,signatureAlgorithms:void 0,tlsSessionLifetime:void 0,dhparam:void 0,ecdhCurve:void 0,certificateRevocationLists:void 0},encoding:void 0,resolveBodyOnly:!1,isStream:!1,responseType:"text",url:void 0,pagination:{transform($){if($.request.options.responseType==="json")return $.body;return JSON.parse($.body)},paginate({response:$}){let K=$.headers.link;if(typeof K!=="string"||K.trim()==="")return!1;let X=J8(K).find((Z)=>Z.parameters.rel==="next"||Z.parameters.rel==='"next"');if(X)return{url:new URL(X.reference,$.url)};return!1},filter:()=>!0,shouldContinue:()=>!0,countLimit:Number.POSITIVE_INFINITY,backoff:0,requestLimit:1e4,stackAllItems:!1},setHost:!0,maxHeaderSize:void 0,signal:void 0,enableUnixSockets:!1},Iz=($)=>{let{hooks:K,retry:J}=$,X={...$,context:{...$.context},cacheOptions:{...$.cacheOptions},https:{...$.https},agent:{...$.agent},headers:{...$.headers},retry:{...J,errorCodes:[...J.errorCodes],methods:[...J.methods],statusCodes:[...J.statusCodes]},timeout:{...$.timeout},hooks:{init:[...K.init],beforeRequest:[...K.beforeRequest],beforeError:[...K.beforeError],beforeRedirect:[...K.beforeRedirect],beforeRetry:[...K.beforeRetry],afterResponse:[...K.afterResponse]},searchParams:$.searchParams?new URLSearchParams($.searchParams):void 0,pagination:{...$.pagination}};if(X.url!==void 0)X.prefixUrl="";return X},Cz=($)=>{let{hooks:K,retry:J}=$,X={...$};if(G.object($.context))X.context={...$.context};if(G.object($.cacheOptions))X.cacheOptions={...$.cacheOptions};if(G.object($.https))X.https={...$.https};if(G.object($.cacheOptions))X.cacheOptions={...X.cacheOptions};if(G.object($.agent))X.agent={...$.agent};if(G.object($.headers))X.headers={...$.headers};if(G.object(J)){if(X.retry={...J},G.array(J.errorCodes))X.retry.errorCodes=[...J.errorCodes];if(G.array(J.methods))X.retry.methods=[...J.methods];if(G.array(J.statusCodes))X.retry.statusCodes=[...J.statusCodes]}if(G.object($.timeout))X.timeout={...$.timeout};if(G.object(K)){if(X.hooks={...K},G.array(K.init))X.hooks.init=[...K.init];if(G.array(K.beforeRequest))X.hooks.beforeRequest=[...K.beforeRequest];if(G.array(K.beforeError))X.hooks.beforeError=[...K.beforeError];if(G.array(K.beforeRedirect))X.hooks.beforeRedirect=[...K.beforeRedirect];if(G.array(K.beforeRetry))X.hooks.beforeRetry=[...K.beforeRetry];if(G.array(K.afterResponse))X.hooks.afterResponse=[...K.afterResponse]}if(G.object($.pagination))X.pagination={...$.pagination};return X},Dz=($)=>{let K=[$.timeout.socket,$.timeout.connect,$.timeout.lookup,$.timeout.request,$.timeout.secureConnect].filter((J)=>typeof J==="number");if(K.length>0)return Math.min(...K);return},uX=($,K,J)=>{let X=$.hooks?.init;if(X)for(let Z of X)Z(K,J)};class u{_unixOptions;_internals;_merging;_init;constructor($,K,J){if(P.any([G.string,G.urlInstance,G.object,G.undefined],$),P.any([G.object,G.undefined],K),P.any([G.object,G.undefined],J),$ instanceof u||K instanceof u)throw new TypeError("The defaults must be passed as the third argument");this._internals=Iz(J?._internals??J??Sz),this._init=[...J?._init??[]],this._merging=!1,this._unixOptions=void 0;try{if(G.plainObject($))try{this.merge($),this.merge(K)}finally{this.url=$.url}else try{this.merge(K)}finally{if(K?.url!==void 0)if($===void 0)this.url=K.url;else throw new TypeError("The `url` option is mutually exclusive with the `input` argument");else if($!==void 0)this.url=$}}catch(X){throw X.options=this,X}}merge($){if(!$)return;if($ instanceof u){for(let K of $._init)this.merge(K);return}if($=Cz($),uX(this,$,this),uX($,$,this),this._merging=!0,"isStream"in $)this.isStream=$.isStream;try{let K=!1;for(let J in $){if(J==="mutableDefaults"||J==="handlers")continue;if(J==="url")continue;if(!(J in this))throw new Error(`Unexpected option: ${J}`);let X=$[J];if(X===void 0)continue;this[J]=X,K=!0}if(K)this._init.push($)}finally{this._merging=!1}}get request(){return this._internals.request}set request($){P.any([G.function,G.undefined],$),this._internals.request=$}get agent(){return this._internals.agent}set agent($){P.plainObject($);for(let K in $){if(!(K in this._internals.agent))throw new TypeError(`Unexpected agent option: ${K}`);P.any([G.object,G.undefined],$[K])}if(this._merging)Object.assign(this._internals.agent,$);else this._internals.agent={...$}}get h2session(){return this._internals.h2session}set h2session($){this._internals.h2session=$}get decompress(){return this._internals.decompress}set decompress($){P.boolean($),this._internals.decompress=$}get timeout(){return this._internals.timeout}set timeout($){P.plainObject($);for(let K in $){if(!(K in this._internals.timeout))throw new Error(`Unexpected timeout option: ${K}`);P.any([G.number,G.undefined],$[K])}if(this._merging)Object.assign(this._internals.timeout,$);else this._internals.timeout={...$}}get prefixUrl(){return this._internals.prefixUrl}set prefixUrl($){if(P.any([G.string,G.urlInstance],$),$===""){this._internals.prefixUrl="";return}if($=$.toString(),!$.endsWith("/"))$+="/";if(this._internals.prefixUrl&&this._internals.url){let{href:K}=this._internals.url;this._internals.url.href=$+K.slice(this._internals.prefixUrl.length)}this._internals.prefixUrl=$}get body(){return this._internals.body}set body($){if(P.any([G.string,G.buffer,G.nodeStream,G.generator,G.asyncGenerator,M1,G.undefined],$),G.nodeStream($))P.truthy($.readable);if($!==void 0)P.undefined(this._internals.form),P.undefined(this._internals.json);this._internals.body=$}get form(){return this._internals.form}set form($){if(P.any([G.plainObject,G.undefined],$),$!==void 0)P.undefined(this._internals.body),P.undefined(this._internals.json);this._internals.form=$}get json(){return this._internals.json}set json($){if($!==void 0)P.undefined(this._internals.body),P.undefined(this._internals.form);this._internals.json=$}get url(){return this._internals.url}set url($){if(P.any([G.string,G.urlInstance,G.undefined],$),$===void 0){this._internals.url=void 0;return}if(G.string($)&&$.startsWith("/"))throw new Error("`url` must not start with a slash");let K=`${this.prefixUrl}${$.toString()}`,J=new URL(K);if(this._internals.url=J,J.protocol==="unix:")J.href=`http://unix${J.pathname}${J.search}`;if(J.protocol!=="http:"&&J.protocol!=="https:"){let X=new Error(`Unsupported protocol: ${J.protocol}`);throw X.code="ERR_UNSUPPORTED_PROTOCOL",X}if(this._internals.username)J.username=this._internals.username,this._internals.username="";if(this._internals.password)J.password=this._internals.password,this._internals.password="";if(this._internals.searchParams)J.search=this._internals.searchParams.toString(),this._internals.searchParams=void 0;if(J.hostname==="unix"){if(!this._internals.enableUnixSockets)throw new Error("Using UNIX domain sockets but option `enableUnixSockets` is not enabled");let X=/(?.+?):(?.+)/.exec(`${J.pathname}${J.search}`);if(X?.groups){let{socketPath:Z,path:Q}=X.groups;this._unixOptions={socketPath:Z,path:Q,host:""}}else this._unixOptions=void 0;return}this._unixOptions=void 0}get cookieJar(){return this._internals.cookieJar}set cookieJar($){if(P.any([G.object,G.undefined],$),$===void 0){this._internals.cookieJar=void 0;return}let{setCookie:K,getCookieString:J}=$;if(P.function(K),P.function(J),K.length===4&&J.length===0)K=cX(K.bind($)),J=cX(J.bind($)),this._internals.cookieJar={setCookie:K,getCookieString:J};else this._internals.cookieJar=$}get signal(){return this._internals.signal}set signal($){P.object($),this._internals.signal=$}get ignoreInvalidCookies(){return this._internals.ignoreInvalidCookies}set ignoreInvalidCookies($){P.boolean($),this._internals.ignoreInvalidCookies=$}get searchParams(){if(this._internals.url)return this._internals.url.searchParams;if(this._internals.searchParams===void 0)this._internals.searchParams=new URLSearchParams;return this._internals.searchParams}set searchParams($){P.any([G.string,G.object,G.undefined],$);let K=this._internals.url;if($===void 0){if(this._internals.searchParams=void 0,K)K.search="";return}let J=this.searchParams,X;if(G.string($))X=new URLSearchParams($);else if($ instanceof URLSearchParams)X=$;else{jz($),X=new URLSearchParams;for(let Z in $){let Q=$[Z];if(Q===null)X.append(Z,"");else if(Q===void 0)J.delete(Z);else X.append(Z,Q)}}if(this._merging){for(let Z of X.keys())J.delete(Z);for(let[Z,Q]of X)J.append(Z,Q)}else if(K)K.search=J.toString();else this._internals.searchParams=J}get searchParameters(){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}set searchParameters($){throw new Error("The `searchParameters` option does not exist. Use `searchParams` instead.")}get dnsLookup(){return this._internals.dnsLookup}set dnsLookup($){P.any([G.function,G.undefined],$),this._internals.dnsLookup=$}get dnsCache(){return this._internals.dnsCache}set dnsCache($){if(P.any([G.object,G.boolean,G.undefined],$),$===!0)this._internals.dnsCache=Oz();else if($===!1)this._internals.dnsCache=void 0;else this._internals.dnsCache=$}get context(){return this._internals.context}set context($){if(P.object($),this._merging)Object.assign(this._internals.context,$);else this._internals.context={...$}}get hooks(){return this._internals.hooks}set hooks($){P.object($);for(let K in $){if(!(K in this._internals.hooks))throw new Error(`Unexpected hook event: ${K}`);let J=K,X=$[J];if(P.any([G.array,G.undefined],X),X)for(let Z of X)P.function(Z);if(this._merging){if(X)this._internals.hooks[J].push(...X)}else{if(!X)throw new Error(`Missing hook event: ${K}`);this._internals.hooks[K]=[...X]}}}get followRedirect(){return this._internals.followRedirect}set followRedirect($){P.any([G.boolean,G.function],$),this._internals.followRedirect=$}get followRedirects(){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}set followRedirects($){throw new TypeError("The `followRedirects` option does not exist. Use `followRedirect` instead.")}get maxRedirects(){return this._internals.maxRedirects}set maxRedirects($){P.number($),this._internals.maxRedirects=$}get cache(){return this._internals.cache}set cache($){if(P.any([G.object,G.string,G.boolean,G.undefined],$),$===!0)this._internals.cache=Tz;else if($===!1)this._internals.cache=void 0;else this._internals.cache=$}get throwHttpErrors(){return this._internals.throwHttpErrors}set throwHttpErrors($){P.boolean($),this._internals.throwHttpErrors=$}get username(){let $=this._internals.url,K=$?$.username:this._internals.username;return decodeURIComponent(K)}set username($){P.string($);let K=this._internals.url,J=encodeURIComponent($);if(K)K.username=J;else this._internals.username=J}get password(){let $=this._internals.url,K=$?$.password:this._internals.password;return decodeURIComponent(K)}set password($){P.string($);let K=this._internals.url,J=encodeURIComponent($);if(K)K.password=J;else this._internals.password=J}get http2(){return this._internals.http2}set http2($){P.boolean($),this._internals.http2=$}get allowGetBody(){return this._internals.allowGetBody}set allowGetBody($){P.boolean($),this._internals.allowGetBody=$}get headers(){return this._internals.headers}set headers($){if(P.plainObject($),this._merging)Object.assign(this._internals.headers,u0($));else this._internals.headers=u0($)}get methodRewriting(){return this._internals.methodRewriting}set methodRewriting($){P.boolean($),this._internals.methodRewriting=$}get dnsLookupIpVersion(){return this._internals.dnsLookupIpVersion}set dnsLookupIpVersion($){if($!==void 0&&$!==4&&$!==6)throw new TypeError(`Invalid DNS lookup IP version: ${$}`);this._internals.dnsLookupIpVersion=$}get parseJson(){return this._internals.parseJson}set parseJson($){P.function($),this._internals.parseJson=$}get stringifyJson(){return this._internals.stringifyJson}set stringifyJson($){P.function($),this._internals.stringifyJson=$}get retry(){return this._internals.retry}set retry($){if(P.plainObject($),P.any([G.function,G.undefined],$.calculateDelay),P.any([G.number,G.undefined],$.maxRetryAfter),P.any([G.number,G.undefined],$.limit),P.any([G.array,G.undefined],$.methods),P.any([G.array,G.undefined],$.statusCodes),P.any([G.array,G.undefined],$.errorCodes),P.any([G.number,G.undefined],$.noise),$.noise&&Math.abs($.noise)>100)throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${$.noise}`);for(let J in $)if(!(J in this._internals.retry))throw new Error(`Unexpected retry option: ${J}`);if(this._merging)Object.assign(this._internals.retry,$);else this._internals.retry={...$};let{retry:K}=this._internals;K.methods=[...new Set(K.methods.map((J)=>J.toUpperCase()))],K.statusCodes=[...new Set(K.statusCodes)],K.errorCodes=[...new Set(K.errorCodes)]}get localAddress(){return this._internals.localAddress}set localAddress($){P.any([G.string,G.undefined],$),this._internals.localAddress=$}get method(){return this._internals.method}set method($){P.string($),this._internals.method=$.toUpperCase()}get createConnection(){return this._internals.createConnection}set createConnection($){P.any([G.function,G.undefined],$),this._internals.createConnection=$}get cacheOptions(){return this._internals.cacheOptions}set cacheOptions($){P.plainObject($),P.any([G.boolean,G.undefined],$.shared),P.any([G.number,G.undefined],$.cacheHeuristic),P.any([G.number,G.undefined],$.immutableMinTimeToLive),P.any([G.boolean,G.undefined],$.ignoreCargoCult);for(let K in $)if(!(K in this._internals.cacheOptions))throw new Error(`Cache option \`${K}\` does not exist`);if(this._merging)Object.assign(this._internals.cacheOptions,$);else this._internals.cacheOptions={...$}}get https(){return this._internals.https}set https($){P.plainObject($),P.any([G.boolean,G.undefined],$.rejectUnauthorized),P.any([G.function,G.undefined],$.checkServerIdentity),P.any([G.string,G.object,G.array,G.undefined],$.certificateAuthority),P.any([G.string,G.object,G.array,G.undefined],$.key),P.any([G.string,G.object,G.array,G.undefined],$.certificate),P.any([G.string,G.undefined],$.passphrase),P.any([G.string,G.buffer,G.array,G.undefined],$.pfx),P.any([G.array,G.undefined],$.alpnProtocols),P.any([G.string,G.undefined],$.ciphers),P.any([G.string,G.buffer,G.undefined],$.dhparam),P.any([G.string,G.undefined],$.signatureAlgorithms),P.any([G.string,G.undefined],$.minVersion),P.any([G.string,G.undefined],$.maxVersion),P.any([G.boolean,G.undefined],$.honorCipherOrder),P.any([G.number,G.undefined],$.tlsSessionLifetime),P.any([G.string,G.undefined],$.ecdhCurve),P.any([G.string,G.buffer,G.array,G.undefined],$.certificateRevocationLists);for(let K in $)if(!(K in this._internals.https))throw new Error(`HTTPS option \`${K}\` does not exist`);if(this._merging)Object.assign(this._internals.https,$);else this._internals.https={...$}}get encoding(){return this._internals.encoding}set encoding($){if($===null)throw new TypeError("To get a Buffer, set `options.responseType` to `buffer` instead");P.any([G.string,G.undefined],$),this._internals.encoding=$}get resolveBodyOnly(){return this._internals.resolveBodyOnly}set resolveBodyOnly($){P.boolean($),this._internals.resolveBodyOnly=$}get isStream(){return this._internals.isStream}set isStream($){P.boolean($),this._internals.isStream=$}get responseType(){return this._internals.responseType}set responseType($){if($===void 0){this._internals.responseType="text";return}if($!=="text"&&$!=="buffer"&&$!=="json")throw new Error(`Invalid \`responseType\` option: ${$}`);this._internals.responseType=$}get pagination(){return this._internals.pagination}set pagination($){if(P.object($),this._merging)Object.assign(this._internals.pagination,$);else this._internals.pagination=$}get auth(){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}set auth($){throw new Error("Parameter `auth` is deprecated. Use `username` / `password` instead.")}get setHost(){return this._internals.setHost}set setHost($){P.boolean($),this._internals.setHost=$}get maxHeaderSize(){return this._internals.maxHeaderSize}set maxHeaderSize($){P.any([G.number,G.undefined],$),this._internals.maxHeaderSize=$}get enableUnixSockets(){return this._internals.enableUnixSockets}set enableUnixSockets($){P.boolean($),this._internals.enableUnixSockets=$}toJSON(){return{...this._internals}}[Symbol.for("nodejs.util.inspect.custom")]($,K){return Az(this._internals,K)}createNativeRequestOptions(){let $=this._internals,K=$.url,J;if(K.protocol==="https:")J=$.http2?$.agent:$.agent.https;else J=$.agent.http;let{https:X}=$,{pfx:Z}=X;if(G.array(Z)&&G.plainObject(Z[0]))Z=Z.map((Q)=>({buf:Q.buffer,passphrase:Q.passphrase}));return{...$.cacheOptions,...this._unixOptions,ALPNProtocols:X.alpnProtocols,ca:X.certificateAuthority,cert:X.certificate,key:X.key,passphrase:X.passphrase,pfx:X.pfx,rejectUnauthorized:X.rejectUnauthorized,checkServerIdentity:X.checkServerIdentity??Rz,ciphers:X.ciphers,honorCipherOrder:X.honorCipherOrder,minVersion:X.minVersion,maxVersion:X.maxVersion,sigalgs:X.signatureAlgorithms,sessionTimeout:X.tlsSessionLifetime,dhparam:X.dhparam,ecdhCurve:X.ecdhCurve,crl:X.certificateRevocationLists,lookup:$.dnsLookup??$.dnsCache?.lookup,family:$.dnsLookupIpVersion,agent:J,setHost:$.setHost,method:$.method,maxHeaderSize:$.maxHeaderSize,localAddress:$.localAddress,headers:$.headers,createConnection:$.createConnection,timeout:$.http2?Dz($):void 0,h2session:$.h2session}}getRequestFunction(){let $=this._internals.url,{request:K}=this._internals;if(!K&&$)return this.getFallbackRequestFunction();return K}getFallbackRequestFunction(){let $=this._internals.url;if(!$)return;if($.protocol==="https:"){if(this._internals.http2){if(dX<15||dX===15&&Nz<10){let K=new Error("To use the `http2` option, install Node.js 15.10.0 or above");throw K.code="EUNSUPPORTED",K}return pX.default.auto}return Ez.request}return qz.request}freeze(){let $=this._internals;Object.freeze($),Object.freeze($.hooks),Object.freeze($.hooks.afterResponse),Object.freeze($.hooks.beforeError),Object.freeze($.hooks.beforeRedirect),Object.freeze($.hooks.beforeRequest),Object.freeze($.hooks.beforeRetry),Object.freeze($.hooks.init),Object.freeze($.https),Object.freeze($.cacheOptions),Object.freeze($.agent),Object.freeze($.headers),Object.freeze($.timeout),Object.freeze($.retry),Object.freeze($.retry.errorCodes),Object.freeze($.retry.methods),Object.freeze($.retry.statusCodes)}}var o0=($)=>{let{statusCode:K}=$,{followRedirect:J}=$.request.options,Z=(typeof J==="function"?J($):J)?299:399;return K>=200&&K<=Z||K===304};class E1 extends I{constructor($,K){let{options:J}=K.request;super(`${$.message} in "${J.url.toString()}"`,$,K.request);this.name="ParseError",this.code="ERR_BODY_PARSE_FAILURE"}}var X8=($,K,J,X)=>{let{rawBody:Z}=$;try{if(K==="text")return Z.toString(X);if(K==="json")return Z.length===0?"":J(Z.toString(X));if(K==="buffer")return Z}catch(Q){throw new E1(Q,$)}throw new E1({message:`Unknown body type '${K}'`,name:"Error"},$)};function _z($){return $.writable&&!$.writableEnded}var mX=_z;function M$($){return $.protocol==="unix:"||$.hostname==="unix"}var kz=G.string(iX.versions.brotli),hz=new Set(["GET","HEAD"]),Z8=new Q$,xz=new Set([300,301,302,303,304,307,308]),vz=["socket","connect","continue","information","upgrade"],L$=()=>{};class T0 extends yz{["constructor"];_noPipe;options;response;requestUrl;redirectUrls;retryCount;_stopRetry;_downloadedSize;_uploadedSize;_stopReading;_pipedServerResponses;_request;_responseSize;_bodySize;_unproxyEvents;_isFromCache;_cannotHaveBody;_triggerRead;_cancelTimeouts;_removeListeners;_nativeResponse;_flushed;_aborted;_requestInitialized;constructor($,K,J){super({autoDestroy:!1,highWaterMark:0});this._downloadedSize=0,this._uploadedSize=0,this._stopReading=!1,this._pipedServerResponses=new Set,this._cannotHaveBody=!1,this._unproxyEvents=L$,this._triggerRead=!1,this._cancelTimeouts=L$,this._removeListeners=L$,this._jobs=[],this._flushed=!1,this._requestInitialized=!1,this._aborted=!1,this.redirectUrls=[],this.retryCount=0,this._stopRetry=L$,this.on("pipe",(Z)=>{if(Z?.headers)Object.assign(this.options.headers,Z.headers)}),this.on("newListener",(Z)=>{if(Z==="retry"&&this.listenerCount("retry")>0)throw new Error("A retry listener has been attached already.")});try{if(this.options=new u($,K,J),!this.options.url){if(this.options.prefixUrl==="")throw new TypeError("Missing `url` property");this.options.url=""}this.requestUrl=this.options.url}catch(Z){let{options:Q}=Z;if(Q)this.options=Q;this.flush=async()=>{this.flush=async()=>{},this.destroy(Z)};return}let{body:X}=this.options;if(G.nodeStream(X))X.once("error",(Z)=>{if(this._flushed)this._beforeError(new o1(Z,this));else this.flush=async()=>{this.flush=async()=>{},this._beforeError(new o1(Z,this))}});if(this.options.signal){let Z=()=>{if(this.options.signal?.reason?.name==="TimeoutError")this.destroy(new r1(this.options.signal.reason,this.timings,this));else this.destroy(new F6(this))};if(this.options.signal.aborted)Z();else this.options.signal.addEventListener("abort",Z),this._removeListeners=()=>{this.options.signal?.removeEventListener("abort",Z)}}}async flush(){if(this._flushed)return;this._flushed=!0;try{if(await this._finalizeBody(),this.destroyed)return;if(await this._makeRequest(),this.destroyed){this._request?.destroy();return}for(let $ of this._jobs)$();this._jobs.length=0,this._requestInitialized=!0}catch($){this._beforeError($)}}_beforeError($){if(this._stopReading)return;let{response:K,options:J}=this,X=this.retryCount+($.name==="RetryError"?0:1);if(this._stopReading=!0,!($ instanceof I))$=new I($.message,$,this);let Z=$;(async()=>{if(K?.readable&&!K.rawBody&&!this._request?.socket?.destroyed){if(K.setEncoding(this.readableEncoding),await this._setRawBody(K))K.body=K.rawBody.toString()}if(this.listenerCount("retry")!==0){let Q;try{let W;if(K&&"retry-after"in K.headers)if(W=Number(K.headers["retry-after"]),Number.isNaN(W)){if(W=Date.parse(K.headers["retry-after"])-Date.now(),W<=0)W=1}else W*=1000;let Y=J.retry;Q=await Y.calculateDelay({attemptCount:X,retryOptions:Y,error:Z,retryAfter:W,computedValue:qJ({attemptCount:X,retryOptions:Y,error:Z,retryAfter:W,computedValue:Y.maxRetryAfter??J.timeout.request??Number.POSITIVE_INFINITY})})}catch(W){this._error(new I(W.message,W,this));return}if(Q){if(await new Promise((W)=>{let Y=setTimeout(W,Q);this._stopRetry=()=>{clearTimeout(Y),W()}}),this.destroyed)return;try{for(let W of this.options.hooks.beforeRetry)await W(Z,this.retryCount+1)}catch(W){this._error(new I(W.message,$,this));return}if(this.destroyed)return;this.destroy(),this.emit("retry",this.retryCount+1,$,(W)=>{let Y=new T0(J.url,W,J);return Y.retryCount=this.retryCount+1,iX.nextTick(()=>{Y.flush()}),Y});return}}this._error(Z)})()}_read(){this._triggerRead=!0;let{response:$}=this;if($&&!this._stopReading){if($.readableLength)this._triggerRead=!1;let K;while((K=$.read())!==null){this._downloadedSize+=K.length;let J=this.downloadProgress;if(J.percent<1)this.emit("downloadProgress",J);this.push(K)}}}_write($,K,J){let X=()=>{this._writeRequest($,K,J)};if(this._requestInitialized)X();else this._jobs.push(X)}_final($){let K=()=>{if(!this._request||this._request.destroyed){$();return}this._request.end((J)=>{if(this._request?._writableState?.errored)return;if(!J)this._bodySize=this._uploadedSize,this.emit("uploadProgress",this.uploadProgress),this._request?.emit("upload-complete");$(J)})};if(this._requestInitialized)K();else this._jobs.push(K)}_destroy($,K){if(this._stopReading=!0,this.flush=async()=>{},this._stopRetry(),this._cancelTimeouts(),this._removeListeners(),this.options){let{body:J}=this.options;if(G.nodeStream(J))J.destroy()}if(this._request)this._request.destroy();if($!==null&&!G.undefined($)&&!($ instanceof I))$=new I($.message,$,this);K($)}pipe($,K){if($ instanceof lX)this._pipedServerResponses.add($);return super.pipe($,K)}unpipe($){if($ instanceof lX)this._pipedServerResponses.delete($);return super.unpipe($),this}async _finalizeBody(){let{options:$}=this,{headers:K}=$,J=!G.undefined($.form),X=!G.undefined($.json),Z=!G.undefined($.body),Q=hz.has($.method)&&!($.method==="GET"&&$.allowGetBody);if(this._cannotHaveBody=Q,J||X||Z){if(Q)throw new TypeError(`The \`${$.method}\` method cannot be used with a body`);let W=!G.string(K["content-type"]);if(Z){if(M1($.body)){let V=new RJ($.body);if(W)K["content-type"]=V.headers["Content-Type"];if("Content-Length"in V.headers)K["content-length"]=V.headers["Content-Length"];$.body=V.encode()}if(L1($.body)&&W)K["content-type"]=`multipart/form-data; boundary=${$.body.getBoundary()}`}else if(J){if(W)K["content-type"]="application/x-www-form-urlencoded";let{form:V}=$;$.form=void 0,$.body=new URLSearchParams(V).toString()}else{if(W)K["content-type"]="application/json";let{json:V}=$;$.json=void 0,$.body=$.stringifyJson(V)}let Y=await b6($.body,$.headers);if(G.undefined(K["content-length"])&&G.undefined(K["transfer-encoding"])&&!Q&&!G.undefined(Y))K["content-length"]=String(Y)}if($.responseType==="json"&&!("accept"in $.headers))$.headers.accept="application/json";this._bodySize=Number(K["content-length"])||void 0}async _onResponseBase($){if(this.isAborted)return;let{options:K}=this,{url:J}=K;if(this._nativeResponse=$,K.decompress)$=nX.default($);let X=$.statusCode,Z=$;Z.statusMessage=Z.statusMessage??bz.STATUS_CODES[X],Z.url=K.url.toString(),Z.requestUrl=this.requestUrl,Z.redirectUrls=this.redirectUrls,Z.request=this,Z.isFromCache=this._nativeResponse.fromCache??!1,Z.ip=this.ip,Z.retryCount=this.retryCount,Z.ok=o0(Z),this._isFromCache=Z.isFromCache,this._responseSize=Number($.headers["content-length"])||void 0,this.response=Z,$.once("end",()=>{this._responseSize=this._downloadedSize,this.emit("downloadProgress",this.downloadProgress)}),$.once("error",(W)=>{this._aborted=!0,$.destroy(),this._beforeError(new s1(W,this))}),$.once("aborted",()=>{this._aborted=!0,this._beforeError(new s1({name:"Error",message:"The server aborted pending request",code:"ECONNRESET"},this))}),this.emit("downloadProgress",this.downloadProgress);let Q=$.headers["set-cookie"];if(G.object(K.cookieJar)&&Q){let W=Q.map(async(Y)=>K.cookieJar.setCookie(Y,J.toString()));if(K.ignoreInvalidCookies)W=W.map(async(Y)=>{try{await Y}catch{}});try{await Promise.all(W)}catch(Y){this._beforeError(Y);return}}if(this.isAborted)return;if($.headers.location&&xz.has(X)){if(typeof K.followRedirect==="function"?K.followRedirect(Z):K.followRedirect){if($.resume(),this._cancelTimeouts(),this._unproxyEvents(),this.redirectUrls.length>=K.maxRedirects){this._beforeError(new w6(this));return}this._request=void 0;let Y=new u(void 0,void 0,this.options),V=X===303&&Y.method!=="GET"&&Y.method!=="HEAD",z=X!==307&&X!==308,U=Y.methodRewriting&&z;if(V||U)Y.method="GET",Y.body=void 0,Y.json=void 0,Y.form=void 0,delete Y.headers["content-length"];try{let B=q1.from($.headers.location,"binary").toString(),w=new URL(B,J);if(!M$(J)&&M$(w)){this._beforeError(new I("Cannot redirect to UNIX socket",{},this));return}if(w.hostname!==J.hostname||w.port!==J.port){if("host"in Y.headers)delete Y.headers.host;if("cookie"in Y.headers)delete Y.headers.cookie;if("authorization"in Y.headers)delete Y.headers.authorization;if(Y.username||Y.password)Y.username="",Y.password=""}else w.username=Y.username,w.password=Y.password;this.redirectUrls.push(w),Y.prefixUrl="",Y.url=w;for(let F of Y.hooks.beforeRedirect)await F(Y,Z);this.emit("redirect",Y,Z),this.options=Y,await this._makeRequest()}catch(B){this._beforeError(B);return}return}}if(K.isStream&&K.throwHttpErrors&&!o0(Z)){this._beforeError(new R0(Z));return}if($.on("readable",()=>{if(this._triggerRead)this._read()}),this.on("resume",()=>{$.resume()}),this.on("pause",()=>{$.pause()}),$.once("end",()=>{this.push(null)}),this._noPipe){if(await this._setRawBody())this.emit("response",$);return}this.emit("response",$);for(let W of this._pipedServerResponses){if(W.headersSent)continue;for(let Y in $.headers){let V=K.decompress?Y!=="content-encoding":!0,z=$.headers[Y];if(V)W.setHeader(Y,z)}W.statusCode=X}}async _setRawBody($=this){if($.readableEnded)return!1;try{let K=await $.toArray(),J=Z1(K.at(0))?q1.concat(K):q1.from(K.join(""));if(!this.isAborted)return this.response.rawBody=J,!0}catch{}return!1}async _onResponse($){try{await this._onResponseBase($)}catch(K){this._beforeError(K)}}_onRequest($){let{options:K}=this,{timeout:J,url:X}=K;if(_9($),this.options.http2)$.setTimeout(0);this._cancelTimeouts=h6($,J,X);let Z=K.cache?"cacheableResponse":"response";$.once(Z,(Q)=>{this._onResponse(Q)}),$.once("error",(Q)=>{this._aborted=!0,$.destroy(),Q=Q instanceof Z$?new r1(Q,this.timings,this):new I(Q.message,Q,this),this._beforeError(Q)}),this._unproxyEvents=F1($,this,vz),this._request=$,this.emit("uploadProgress",this.uploadProgress),this._sendBody(),this.emit("request",$)}async _asyncWrite($){return new Promise((K,J)=>{super.write($,(X)=>{if(X){J(X);return}K()})})}_sendBody(){let{body:$}=this.options,K=this.redirectUrls.length===0?this:this._request??this;if(G.nodeStream($))$.pipe(K);else if(G.generator($)||G.asyncGenerator($))(async()=>{try{for await(let J of $)await this._asyncWrite(J);super.end()}catch(J){this._beforeError(J)}})();else if(!G.undefined($))this._writeRequest($,void 0,()=>{}),K.end();else if(this._cannotHaveBody||this._noPipe)K.end()}_prepareCache($){if(!Z8.has($)){let K=new YJ((J,X)=>{let Z=J._request(J,X);if(G.promise(Z))Z.once=(Q,W)=>{if(Q==="error")(async()=>{try{await Z}catch(Y){W(Y)}})();else if(Q==="abort"||Q==="destroy")(async()=>{try{(await Z).once(Q,W)}catch{}})();else throw new Error(`Unknown HTTP2 promise event: ${Q}`);return Z};return Z},$);Z8.set($,K.request())}}async _createCacheableRequest($,K){return new Promise((J,X)=>{Object.assign(K,x6($));let Z,Q=Z8.get(K.cache)(K,async(W)=>{if(W._readableState.autoDestroy=!1,Z){let Y=()=>{if(W.req)W.complete=W.req.res.complete};W.prependOnceListener("end",Y),Y(),(await Z).emit("cacheableResponse",W)}J(W)});Q.once("error",X),Q.once("request",async(W)=>{Z=W,J(Z)})})}async _makeRequest(){let{options:$}=this,{headers:K,username:J,password:X}=$,Z=$.cookieJar;for(let V in K)if(G.undefined(K[V]))delete K[V];else if(G.null(K[V]))throw new TypeError(`Use \`undefined\` instead of \`null\` to delete the \`${V}\` header`);if($.decompress&&G.undefined(K["accept-encoding"]))K["accept-encoding"]=kz?"gzip, deflate, br":"gzip, deflate";if(J||X){let V=q1.from(`${J}:${X}`).toString("base64");K.authorization=`Basic ${V}`}if(Z){let V=await Z.getCookieString($.url.toString());if(G.nonEmptyString(V))K.cookie=V}$.prefixUrl="";let Q;for(let V of $.hooks.beforeRequest){let z=await V($);if(!G.undefined(z)){Q=()=>z;break}}Q||=$.getRequestFunction();let W=$.url;if(this._requestOptions=$.createNativeRequestOptions(),$.cache)this._requestOptions._request=Q,this._requestOptions.cache=$.cache,this._requestOptions.body=$.body,this._prepareCache($.cache);let Y=$.cache?this._createCacheableRequest:Q;try{let V=Y(W,this._requestOptions);if(G.promise(V))V=await V;if(G.undefined(V)){if(V=$.getFallbackRequestFunction()(W,this._requestOptions),G.promise(V))V=await V}if(mX(V))this._onRequest(V);else if(this.writable)this.once("finish",()=>{this._onResponse(V)}),this._sendBody();else this._onResponse(V)}catch(V){if(V instanceof U0)throw new M6(V,this);throw V}}async _error($){try{if($ instanceof R0&&!this.options.throwHttpErrors);else for(let K of this.options.hooks.beforeError)$=await K($)}catch(K){$=new I(K.message,K,this)}this.destroy($)}_writeRequest($,K,J){if(!this._request||this._request.destroyed)return;this._request.write($,K,(X)=>{if(!X&&!this._request.destroyed){this._uploadedSize+=q1.byteLength($,K);let Z=this.uploadProgress;if(Z.percent<1)this.emit("uploadProgress",Z)}J(X)})}get ip(){return this.socket?.remoteAddress}get isAborted(){return this._aborted}get socket(){return this._request?.socket??void 0}get downloadProgress(){let $;if(this._responseSize)$=this._downloadedSize/this._responseSize;else if(this._responseSize===this._downloadedSize)$=1;else $=0;return{percent:$,transferred:this._downloadedSize,total:this._responseSize}}get uploadProgress(){let $;if(this._bodySize)$=this._uploadedSize/this._bodySize;else if(this._bodySize===this._uploadedSize)$=1;else $=0;return{percent:$,transferred:this._uploadedSize,total:this._bodySize}}get timings(){return this._request?.timings}get isFromCache(){return this._isFromCache}get reusedSocket(){return this._request?.reusedSocket}}class Q8 extends I{constructor($){super("Promise was canceled",{},$);this.name="CancelError",this.code="ERR_CANCELED"}get isCanceled(){return!0}}var cz=["request","response","redirect","uploadProgress","downloadProgress"];function F$($){let K,J,X,Z=new gz,Q=new d0((Y,V,z)=>{z(()=>{K.destroy()}),z.shouldReject=!1,z(()=>{V(new Q8(K))});let U=(B)=>{z(()=>{});let w=$??new T0(void 0,void 0,X);w.retryCount=B,w._noPipe=!0,K=w,w.once("response",async(H)=>{let M=(H.headers["content-encoding"]??"").toLowerCase(),N=M==="gzip"||M==="deflate"||M==="br",{options:R}=w;if(N&&!R.decompress)H.body=H.rawBody;else try{H.body=X8(H,R.responseType,R.parseJson,R.encoding)}catch(q){try{H.body=H.rawBody.toString()}catch(T){w._beforeError(new E1(T,H));return}if(o0(H)){w._beforeError(q);return}}try{let q=R.hooks.afterResponse;for(let[T,b]of q.entries())if(H=await b(H,async(x)=>{if(R.merge(x),R.prefixUrl="",x.url)R.url=x.url;throw R.hooks.afterResponse=R.hooks.afterResponse.slice(0,T),new L6(w)}),!(G.object(H)&&G.number(H.statusCode)&&!G.nullOrUndefined(H.body)))throw new TypeError("The `afterResponse` hook returned an invalid value")}catch(q){w._beforeError(q);return}if(J=H,!o0(H)){w._beforeError(new R0(H));return}w.destroy(),Y(w.options.resolveBodyOnly?H.body:H)});let F=(H)=>{if(Q.isCanceled)return;let{options:M}=w;if(H instanceof R0&&!M.throwHttpErrors){let{response:N}=H;w.destroy(),Y(w.options.resolveBodyOnly?N.body:N);return}V(H)};w.once("error",F);let L=w.options?.body;if(w.once("retry",(H,M)=>{$=void 0;let N=w.options.body;if(L===N&&G.nodeStream(N)){M.message="Cannot retry with consumed body stream",F(M);return}X=w.options,U(H)}),F1(w,Z,cz),G.undefined($))w.flush()};U(0)});Q.on=(Y,V)=>{return Z.on(Y,V),Q},Q.off=(Y,V)=>{return Z.off(Y,V),Q};let W=(Y)=>{let V=(async()=>{await Q;let{options:z}=J.request;return X8(J,Y,z.parseJson,z.encoding)})();return Object.defineProperties(V,Object.getOwnPropertyDescriptors(Q)),V};return Q.json=()=>{if(K.options){let{headers:Y}=K.options;if(!K.writableFinished&&!("accept"in Y))Y.accept="application/json"}return W("json")},Q.buffer=()=>W("buffer"),Q.text=()=>W("text"),Q}var uz=($)=>G.function($),pz=["get","post","put","patch","head","delete"],oX=($)=>{$={options:new u(void 0,void 0,$.options),handlers:[...$.handlers],mutableDefaults:$.mutableDefaults},Object.defineProperty($,"mutableDefaults",{enumerable:!0,configurable:!1,writable:!1});let K=(X,Z,Q=$.options)=>{let W=new T0(X,Z,Q),Y,V=(B)=>{if(W.options=B,W._noPipe=!B?.isStream,W.flush(),B?.isStream)return W;return Y||=F$(W),Y},z=0,U=(B)=>{let F=($.handlers[z++]??V)(B,U);if(G.promise(F)&&!W.options?.isStream){if(Y||=F$(W),F!==Y){let L=Object.getOwnPropertyDescriptors(Y);for(let H in L)if(H in F)delete L[H];Object.defineProperties(F,L),F.cancel=Y.cancel}}return F};return U(W.options)};K.extend=(...X)=>{let Z=new u(void 0,void 0,$.options),Q=[...$.handlers],W;for(let Y of X)if(uz(Y))Z.merge(Y.defaults.options),Q.push(...Y.defaults.handlers),W=Y.defaults.mutableDefaults;else{if(Z.merge(Y),Y.handlers)Q.push(...Y.handlers);W=Y.mutableDefaults}return oX({options:Z,handlers:Q,mutableDefaults:Boolean(W)})};let J=async function*(X,Z){let Q=new u(X,Z,$.options);Q.resolveBodyOnly=!1;let{pagination:W}=Q;P.function(W.transform),P.function(W.shouldContinue),P.function(W.filter),P.function(W.paginate),P.number(W.countLimit),P.number(W.requestLimit),P.number(W.backoff);let Y=[],{countLimit:V}=W,z=0;while(z{let Q=[];for await(let W of J(X,Z))Q.push(W);return Q},K.paginate.each=J,K.stream=(X,Z)=>K(X,{...Z,isStream:!0});for(let X of pz)K[X]=(Z,Q)=>K(Z,{...Q,method:X}),K.stream[X]=(Z,Q)=>K(Z,{...Q,method:X,isStream:!0});if(!$.mutableDefaults)Object.freeze($.handlers),$.options.freeze();return Object.defineProperty(K,"defaults",{value:$,writable:!1,configurable:!1,enumerable:!0}),K},rX=oX;var mz={options:new u,handlers:[],mutableDefaults:!1},lz=rX(mz),Z0=lz;var iz=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",nz="[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]["+iz+"]*",oz=new RegExp("^"+nz+"$");function P$($,K){let J=[],X=K.exec($);while(X){let Z=[];Z.startIndex=K.lastIndex-X[0].length;let Q=X.length;for(let W=0;W"&&$[Q]!==" "&&$[Q]!=="\t"&&$[Q]!==` +`&&$[Q]!=="\r";Q++)V+=$[Q];if(V=V.trim(),V[V.length-1]==="/")V=V.substring(0,V.length-1),Q--;if(!XB(V)){let B;if(V.trim().length===0)B="Invalid space after '<'.";else B="Tag '"+V+"' is an invalid name.";return D("InvalidTag",B,c($,Q))}let z=az($,Q);if(z===!1)return D("InvalidAttr","Attributes for '"+V+"' have open quote.",c($,Q));let U=z.value;if(Q=z.index,U[U.length-1]==="/"){let B=Q-U.length;U=U.substring(0,U.length-1);let w=$Z(U,K);if(w===!0)X=!0;else return D(w.err.code,w.err.msg,c($,B+w.err.line))}else if(Y)if(!z.tagClosed)return D("InvalidTag","Closing tag '"+V+"' doesn't have proper closing.",c($,Q));else if(U.trim().length>0)return D("InvalidTag","Closing tag '"+V+"' can't have attributes or invalid starting.",c($,W));else if(J.length===0)return D("InvalidTag","Closing tag '"+V+"' has not been opened.",c($,W));else{let B=J.pop();if(V!==B.tagName){let w=c($,B.tagStartPos);return D("InvalidTag","Expected closing tag '"+B.tagName+"' (opened in line "+w.line+", col "+w.col+") instead of closing tag '"+V+"'.",c($,W))}if(J.length==0)Z=!0}else{let B=$Z(U,K);if(B!==!0)return D(B.err.code,B.err.msg,c($,Q-U.length+B.err.line));if(Z===!0)return D("InvalidXml","Multiple possible root nodes found.",c($,Q));else if(K.unpairedTags.indexOf(V)!==-1);else J.push({tagName:V,tagStartPos:W});X=!0}for(Q++;Q<$.length;Q++)if($[Q]==="<")if($[Q+1]==="!"){Q++,Q=eX($,Q);continue}else if($[Q+1]==="?"){if(Q=aX($,++Q),Q.err)return Q}else break;else if($[Q]==="&"){let B=KB($,Q);if(B==-1)return D("InvalidChar","char '&' is not expected.",c($,Q));Q=B}else if(Z===!0&&!tX($[Q]))return D("InvalidXml","Extra text at the end",c($,Q));if($[Q]==="<")Q--}}else{if(tX($[Q]))continue;return D("InvalidChar","char '"+$[Q]+"' is not expected.",c($,Q))}if(!X)return D("InvalidXml","Start tag expected.",1);else if(J.length==1)return D("InvalidTag","Unclosed tag '"+J[0].tagName+"'.",c($,J[0].tagStartPos));else if(J.length>0)return D("InvalidXml","Invalid '"+JSON.stringify(J.map((Q)=>Q.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1});return!0}function tX($){return $===" "||$==="\t"||$===` +`||$==="\r"}function aX($,K){let J=K;for(;K<$.length;K++)if($[K]=="?"||$[K]==" "){let X=$.substr(J,K-J);if(K>5&&X==="xml")return D("InvalidXml","XML declaration allowed only at the start of the document.",c($,K));else if($[K]=="?"&&$[K+1]==">"){K++;break}else continue}return K}function eX($,K){if($.length>K+5&&$[K+1]==="-"&&$[K+2]==="-"){for(K+=3;K<$.length;K++)if($[K]==="-"&&$[K+1]==="-"&&$[K+2]===">"){K+=2;break}}else if($.length>K+8&&$[K+1]==="D"&&$[K+2]==="O"&&$[K+3]==="C"&&$[K+4]==="T"&&$[K+5]==="Y"&&$[K+6]==="P"&&$[K+7]==="E"){let J=1;for(K+=8;K<$.length;K++)if($[K]==="<")J++;else if($[K]===">"){if(J--,J===0)break}}else if($.length>K+9&&$[K+1]==="["&&$[K+2]==="C"&&$[K+3]==="D"&&$[K+4]==="A"&&$[K+5]==="T"&&$[K+6]==="A"&&$[K+7]==="["){for(K+=8;K<$.length;K++)if($[K]==="]"&&$[K+1]==="]"&&$[K+2]===">"){K+=2;break}}return K}var sz='"',tz="'";function az($,K){let J="",X="",Z=!1;for(;K<$.length;K++){if($[K]===sz||$[K]===tz)if(X==="")X=$[K];else if(X!==$[K]);else X="";else if($[K]===">"){if(X===""){Z=!0;break}}J+=$[K]}if(X!=="")return!1;return{value:J,index:K,tagClosed:Z}}var ez=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function $Z($,K){let J=P$($,ez),X={};for(let Z=0;Z!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function($,K,J){return $},captureMetaData:!1},JZ=function($){return Object.assign({},ZB,$)};var H$;if(typeof Symbol!=="function")H$="@@xmlMetadata";else H$=Symbol("XML Node Metadata");class i{constructor($){this.tagname=$,this.child=[],this[":@"]={}}add($,K){if($==="__proto__")$="#__proto__";this.child.push({[$]:K})}addChild($,K){if($.tagname==="__proto__")$.tagname="#__proto__";if($[":@"]&&Object.keys($[":@"]).length>0)this.child.push({[$.tagname]:$.child,[":@"]:$[":@"]});else this.child.push({[$.tagname]:$.child});if(K!==void 0)this.child[this.child.length-1][H$]={startIndex:K}}static getMetaDataSymbol(){return H$}}function W8($,K){let J={};if($[K+3]==="O"&&$[K+4]==="C"&&$[K+5]==="T"&&$[K+6]==="Y"&&$[K+7]==="P"&&$[K+8]==="E"){K=K+9;let X=1,Z=!1,Q=!1,W="";for(;K<$.length;K++)if($[K]==="<"&&!Q){if(Z&&YB($,K)){K+=7;let Y,V;if([Y,V,K]=QB($,K+1),V.indexOf("&")===-1)J[zB(Y)]={regx:RegExp(`&${Y};`,"g"),val:V}}else if(Z&&VB($,K))K+=8;else if(Z&&GB($,K))K+=8;else if(Z&&UB($,K))K+=9;else if(WB)Q=!0;else throw new Error("Invalid DOCTYPE");X++,W=""}else if($[K]===">"){if(Q){if($[K-1]==="-"&&$[K-2]==="-")Q=!1,X--}else X--;if(X===0)break}else if($[K]==="[")Z=!0;else W+=$[K];if(X!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:J,i:K}}function QB($,K){let J="";for(;K<$.length&&($[K]!=="'"&&$[K]!=='"');K++)J+=$[K];if(J=J.trim(),J.indexOf(" ")!==-1)throw new Error("External entites are not supported");let X=$[K++],Z="";for(;K<$.length&&$[K]!==X;K++)Z+=$[K];return[J,Z,K]}function WB($,K){if($[K+1]==="!"&&$[K+2]==="-"&&$[K+3]==="-")return!0;return!1}function YB($,K){if($[K+1]==="!"&&$[K+2]==="E"&&$[K+3]==="N"&&$[K+4]==="T"&&$[K+5]==="I"&&$[K+6]==="T"&&$[K+7]==="Y")return!0;return!1}function VB($,K){if($[K+1]==="!"&&$[K+2]==="E"&&$[K+3]==="L"&&$[K+4]==="E"&&$[K+5]==="M"&&$[K+6]==="E"&&$[K+7]==="N"&&$[K+8]==="T")return!0;return!1}function GB($,K){if($[K+1]==="!"&&$[K+2]==="A"&&$[K+3]==="T"&&$[K+4]==="T"&&$[K+5]==="L"&&$[K+6]==="I"&&$[K+7]==="S"&&$[K+8]==="T")return!0;return!1}function UB($,K){if($[K+1]==="!"&&$[K+2]==="N"&&$[K+3]==="O"&&$[K+4]==="T"&&$[K+5]==="A"&&$[K+6]==="T"&&$[K+7]==="I"&&$[K+8]==="O"&&$[K+9]==="N")return!0;return!1}function zB($){if(N1($))return $;else throw new Error(`Invalid entity name ${$}`)}var BB=/^[-+]?0x[a-fA-F0-9]+$/,wB=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,MB={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Y8($,K={}){if(K=Object.assign({},MB,K),!$||typeof $!=="string")return $;let J=$.trim();if(K.skipLike!==void 0&&K.skipLike.test(J))return $;else if($==="0")return 0;else if(K.hex&&BB.test(J))return FB(J,16);else if(J.search(/[eE]/)!==-1){let X=J.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(X){if(K.leadingZeros)J=(X[1]||"")+X[3];else if(X[2]==="0"&&X[3][0]===".");else return $;return K.eNotation?Number(J):$}else return $}else{let X=wB.exec(J);if(X){let Z=X[1],Q=X[2],W=LB(X[3]);if(!K.leadingZeros&&Q.length>0&&Z&&J[2]!==".")return $;else if(!K.leadingZeros&&Q.length>0&&!Z&&J[1]!==".")return $;else if(K.leadingZeros&&Q===$)return 0;else{let Y=Number(J),V=""+Y;if(V.search(/[eE]/)!==-1)if(K.eNotation)return Y;else return $;else if(J.indexOf(".")!==-1)if(V==="0"&&W==="")return Y;else if(V===W)return Y;else if(Z&&V==="-"+W)return Y;else return $;if(Q)return W===V||Z+W===V?Y:$;else return J===V||J===Z+V?Y:$}}else return $}}function LB($){if($&&$.indexOf(".")!==-1){if($=$.replace(/0+$/,""),$===".")$="0";else if($[0]===".")$="0"+$;else if($[$.length-1]===".")$=$.substr(0,$.length-1);return $}return $}function FB($,K){if(parseInt)return parseInt($,K);else if(Number.parseInt)return Number.parseInt($,K);else if(window&&window.parseInt)return window.parseInt($,K);else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function V8($){if(typeof $==="function")return $;if(Array.isArray($))return(K)=>{for(let J of $){if(typeof J==="string"&&K===J)return!0;if(J instanceof RegExp&&J.test(K))return!0}};return()=>!1}class f${constructor($){this.options=$,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(K,J)=>String.fromCodePoint(Number.parseInt(J,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(K,J)=>String.fromCodePoint(Number.parseInt(J,16))}},this.addExternalEntities=PB,this.parseXml=EB,this.parseTextData=HB,this.resolveNameSpace=fB,this.buildAttributesMap=RB,this.isItStopNode=TB,this.replaceEntitiesValue=NB,this.readStopNodeData=SB,this.saveTextToParentTag=jB,this.addChild=qB,this.ignoreAttributesFn=V8(this.options.ignoreAttributes)}}function PB($){let K=Object.keys($);for(let J=0;J0){if(!W)$=this.replaceEntitiesValue($);let Y=this.options.tagValueProcessor(K,$,J,Z,Q);if(Y===null||Y===void 0)return $;else if(typeof Y!==typeof $||Y!==$)return Y;else if(this.options.trimValues)return U8($,this.options.parseTagValue,this.options.numberParseOptions);else if($.trim()===$)return U8($,this.options.parseTagValue,this.options.numberParseOptions);else return $}}}function fB($){if(this.options.removeNSPrefix){let K=$.split(":"),J=$.charAt(0)==="/"?"/":"";if(K[0]==="xmlns")return"";if(K.length===2)$=J+K[1]}return $}var AB=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function RB($,K,J){if(this.options.ignoreAttributes!==!0&&typeof $==="string"){let X=P$($,AB),Z=X.length,Q={};for(let W=0;W",Q,"Closing Tag is not closed."),V=$.substring(Q+2,Y).trim();if(this.options.removeNSPrefix){let B=V.indexOf(":");if(B!==-1)V=V.substr(B+1)}if(this.options.transformTagName)V=this.options.transformTagName(V);if(J)X=this.saveTextToParentTag(X,J,Z);let z=Z.substring(Z.lastIndexOf(".")+1);if(V&&this.options.unpairedTags.indexOf(V)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let U=0;if(z&&this.options.unpairedTags.indexOf(z)!==-1)U=Z.lastIndexOf(".",Z.lastIndexOf(".")-1),this.tagsNodeStack.pop();else U=Z.lastIndexOf(".");Z=Z.substring(0,U),J=this.tagsNodeStack.pop(),X="",Q=Y}else if($[Q+1]==="?"){let Y=G8($,Q,!1,"?>");if(!Y)throw new Error("Pi Tag is not closed.");if(X=this.saveTextToParentTag(X,J,Z),this.options.ignoreDeclaration&&Y.tagName==="?xml"||this.options.ignorePiTags);else{let V=new i(Y.tagName);if(V.add(this.options.textNodeName,""),Y.tagName!==Y.tagExp&&Y.attrExpPresent)V[":@"]=this.buildAttributesMap(Y.tagExp,Z,Y.tagName);this.addChild(J,V,Z,Q)}Q=Y.closeIndex+1}else if($.substr(Q+1,3)==="!--"){let Y=O0($,"-->",Q+4,"Comment is not closed.");if(this.options.commentPropName){let V=$.substring(Q+4,Y-2);X=this.saveTextToParentTag(X,J,Z),J.add(this.options.commentPropName,[{[this.options.textNodeName]:V}])}Q=Y}else if($.substr(Q+1,2)==="!D"){let Y=W8($,Q);this.docTypeEntities=Y.entities,Q=Y.i}else if($.substr(Q+1,2)==="!["){let Y=O0($,"]]>",Q,"CDATA is not closed.")-2,V=$.substring(Q+9,Y);X=this.saveTextToParentTag(X,J,Z);let z=this.parseTextData(V,J.tagname,Z,!0,!1,!0,!0);if(z==null)z="";if(this.options.cdataPropName)J.add(this.options.cdataPropName,[{[this.options.textNodeName]:V}]);else J.add(this.options.textNodeName,z);Q=Y+2}else{let Y=G8($,Q,this.options.removeNSPrefix),V=Y.tagName,z=Y.rawTagName,U=Y.tagExp,B=Y.attrExpPresent,w=Y.closeIndex;if(this.options.transformTagName)V=this.options.transformTagName(V);if(J&&X){if(J.tagname!=="!xml")X=this.saveTextToParentTag(X,J,Z,!1)}let F=J;if(F&&this.options.unpairedTags.indexOf(F.tagname)!==-1)J=this.tagsNodeStack.pop(),Z=Z.substring(0,Z.lastIndexOf("."));if(V!==K.tagname)Z+=Z?"."+V:V;let L=Q;if(this.isItStopNode(this.options.stopNodes,Z,V)){let H="";if(U.length>0&&U.lastIndexOf("/")===U.length-1){if(V[V.length-1]==="/")V=V.substr(0,V.length-1),Z=Z.substr(0,Z.length-1),U=V;else U=U.substr(0,U.length-1);Q=Y.closeIndex}else if(this.options.unpairedTags.indexOf(V)!==-1)Q=Y.closeIndex;else{let N=this.readStopNodeData($,z,w+1);if(!N)throw new Error(`Unexpected end of ${z}`);Q=N.i,H=N.tagContent}let M=new i(V);if(V!==U&&B)M[":@"]=this.buildAttributesMap(U,Z,V);if(H)H=this.parseTextData(H,V,Z,!0,B,!0,!0);Z=Z.substr(0,Z.lastIndexOf(".")),M.add(this.options.textNodeName,H),this.addChild(J,M,Z,L)}else{if(U.length>0&&U.lastIndexOf("/")===U.length-1){if(V[V.length-1]==="/")V=V.substr(0,V.length-1),Z=Z.substr(0,Z.length-1),U=V;else U=U.substr(0,U.length-1);if(this.options.transformTagName)V=this.options.transformTagName(V);let H=new i(V);if(V!==U&&B)H[":@"]=this.buildAttributesMap(U,Z,V);this.addChild(J,H,Z,L),Z=Z.substr(0,Z.lastIndexOf("."))}else{let H=new i(V);if(this.tagsNodeStack.push(J),V!==U&&B)H[":@"]=this.buildAttributesMap(U,Z,V);this.addChild(J,H,Z,L),J=H}X="",Q=w}}else X+=$[Q];return K.child};function qB($,K,J,X){if(!this.options.captureMetaData)X=void 0;let Z=this.options.updateTag(K.tagname,J,K[":@"]);if(Z===!1);else if(typeof Z==="string")K.tagname=Z,$.addChild(K,X);else $.addChild(K,X)}var NB=function($){if(this.options.processEntities){for(let K in this.docTypeEntities){let J=this.docTypeEntities[K];$=$.replace(J.regx,J.val)}for(let K in this.lastEntities){let J=this.lastEntities[K];$=$.replace(J.regex,J.val)}if(this.options.htmlEntities)for(let K in this.htmlEntities){let J=this.htmlEntities[K];$=$.replace(J.regex,J.val)}$=$.replace(this.ampEntity.regex,this.ampEntity.val)}return $};function jB($,K,J,X){if($){if(X===void 0)X=K.child.length===0;if($=this.parseTextData($,K.tagname,J,!1,K[":@"]?Object.keys(K[":@"]).length!==0:!1,X),$!==void 0&&$!=="")K.add(this.options.textNodeName,$);$=""}return $}function TB($,K,J){let X="*."+J;for(let Z in $){let Q=$[Z];if(X===Q||K===Q)return!0}return!1}function OB($,K,J=">"){let X,Z="";for(let Q=K;Q<$.length;Q++){let W=$[Q];if(X){if(W===X)X=""}else if(W==='"'||W==="'")X=W;else if(W===J[0])if(J[1]){if($[Q+1]===J[1])return{data:Z,index:Q}}else return{data:Z,index:Q};else if(W==="\t")W=" ";Z+=W}}function O0($,K,J,X){let Z=$.indexOf(K,J);if(Z===-1)throw new Error(X);else return Z+K.length-1}function G8($,K,J,X=">"){let Z=OB($,K+1,X);if(!Z)return;let{data:Q,index:W}=Z,Y=Q.search(/\s/),V=Q,z=!0;if(Y!==-1)V=Q.substring(0,Y),Q=Q.substring(Y+1).trimStart();let U=V;if(J){let B=V.indexOf(":");if(B!==-1)V=V.substr(B+1),z=V!==Z.data.substr(B+1)}return{tagName:V,tagExp:Q,closeIndex:W,attrExpPresent:z,rawTagName:U}}function SB($,K,J){let X=J,Z=1;for(;J<$.length;J++)if($[J]==="<")if($[J+1]==="/"){let Q=O0($,">",J,`${K} is not closed`);if($.substring(J+2,Q).trim()===K){if(Z--,Z===0)return{tagContent:$.substring(X,J),i:Q}}J=Q}else if($[J+1]==="?")J=O0($,"?>",J+1,"StopNode is not closed.");else if($.substr(J+1,3)==="!--")J=O0($,"-->",J+3,"StopNode is not closed.");else if($.substr(J+1,2)==="![")J=O0($,"]]>",J,"StopNode is not closed.")-2;else{let Q=G8($,J,">");if(Q){if((Q&&Q.tagName)===K&&Q.tagExp[Q.tagExp.length-1]!=="/")Z++;J=Q.closeIndex}}}function U8($,K,J){if(K&&typeof $==="string"){let X=$.trim();if(X==="true")return!0;else if(X==="false")return!1;else return Y8($,J)}else if(sX($))return $;else return""}var z8=i.getMetaDataSymbol();function B8($,K){return XZ($,K)}function XZ($,K,J){let X,Z={};for(let Q=0;Q<$.length;Q++){let W=$[Q],Y=IB(W),V="";if(J===void 0)V=Y;else V=J+"."+Y;if(Y===K.textNodeName)if(X===void 0)X=W[Y];else X+=""+W[Y];else if(Y===void 0)continue;else if(W[Y]){let z=XZ(W[Y],K,V),U=DB(z,K);if(W[z8]!==void 0)z[z8]=W[z8];if(W[":@"])CB(z,W[":@"],V,K);else if(Object.keys(z).length===1&&z[K.textNodeName]!==void 0&&!K.alwaysCreateTextNode)z=z[K.textNodeName];else if(Object.keys(z).length===0)if(K.alwaysCreateTextNode)z[K.textNodeName]="";else z="";if(Z[Y]!==void 0&&Z.hasOwnProperty(Y)){if(!Array.isArray(Z[Y]))Z[Y]=[Z[Y]];Z[Y].push(z)}else if(K.isArray(Y,V,U))Z[Y]=[z];else Z[Y]=z}}if(typeof X==="string"){if(X.length>0)Z[K.textNodeName]=X}else if(X!==void 0)Z[K.textNodeName]=X;return Z}function IB($){let K=Object.keys($);for(let J=0;J{let K=0,J=0,X=0,Z=0;try{let Q=await Z0.get("https://www.rbc.ru/quote/ajax/get-updated-finance-data-of-tickers/?tickersIds=338247&addSessionData=1").json();K=Math.round(Q["338247"].price*100)/100}catch(Q){}try{let Q=await Z0.get("https://www.cbr.ru/scripts/XML_daily.asp").text(),W=Number(new r0().parse(Q).ValCurs.Valute.find((Y)=>Y.NumCode===840).Value.replace(",","."));J=Math.round(W*100)/100}catch(Q){}try{let Q=await Z0.get("https://abcex.io/api/v1/exchange/public/market-data/order-book/depth?marketId=USDTRUB&lang=ru").json();X=Math.round(Q.ask[0].price*100)/100}catch(Q){}try{let Q=await Z0.get("https://grinex.io/api/v2/k?market=usdta7a5&period=1440").json();if(Q.length>0){let W=Q.at(-1);if(W)Z=Math.round(W.close*100)/100}}catch(Q){}T1.telegram.sendMessage($.chat.id,`USD F (RBC) - ${K} +USD (CBR) - ${J} +USDT (ABCEX) - ${X} +USDT (GRINEX) - ${Z}`)});T1.on("message",async({message:$})=>{if("text"in $&&$.text==="#\u043A\u0443\u0440\u0441\u044B"){let K=0,J=0,X=0,Z=0;try{let Q=await Z0.get("https://www.rbc.ru/quote/ajax/get-updated-finance-data-of-tickers/?tickersIds=338247&addSessionData=1").json();K=Math.round(Q["338247"].price*100)/100}catch(Q){}try{let Q=await Z0.get("https://www.cbr.ru/scripts/XML_daily.asp").text(),W=Number(new r0().parse(Q).ValCurs.Valute.find((Y)=>Y.NumCode===840).Value.replace(",","."));J=Math.round(W*100)/100}catch(Q){}try{let Q=await Z0.get("https://abcex.io/api/v1/exchange/public/market-data/order-book/depth?marketId=USDTRUB&lang=ru").json();X=Math.round(Q.ask[0].price*100)/100}catch(Q){}try{let Q=await Z0.get("https://grinex.io/api/v2/k?market=usdta7a5&period=1440").json();if(Q.length>0){let W=Q.at(-1);if(W)Z=Math.round(W.close*100)/100}}catch(Q){}T1.telegram.sendMessage($.chat.id,`USD F (RBC) - ${K} +USD (CBR) - ${J} +USDT (ABCEX) - ${X} +USDT (GRINEX) - ${Z}`)}});T1.launch(); diff --git a/package.json b/package.json index d7ee288..94493f8 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,18 @@ { "name": "node-exchange-rates", "version": "1.0.50", + "type": "module", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "dev": "bun run --watch src/index.ts" + "dev": "bun --watch ./src", + "build": "bun bun.build.ts", + "start": "bun ./dist/index.js" }, "dependencies": { - "elysia": "latest" + "fast-xml-parser": "^5.2.0", + "got": "^14.4.7", + "telegraf": "^4.16.3" }, "devDependencies": { "bun-types": "latest" - }, - "module": "src/index.js" + } } \ No newline at end of file diff --git a/pm2.config.js b/pm2.config.js new file mode 100644 index 0000000..52ab04f --- /dev/null +++ b/pm2.config.js @@ -0,0 +1,4 @@ +module.exports = { + name: "node-currency-rates-bot", + script: "bun ./dist/index.js", +}; diff --git a/src/index.ts b/src/index.ts index 9c1f7a1..3784a85 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,152 @@ -import { Elysia } from "elysia"; +import { Telegraf, Context } from "telegraf"; +import got from "got"; +import { XMLParser } from "fast-xml-parser"; -const app = new Elysia().get("/", () => "Hello Elysia").listen(3000); +const bot = new Telegraf("8138715095:AAH-BruHZl-zikHfSwkwWdONzt2qmTt68Z0"); -console.log( - `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}` -); +// Массив разрешенных ID групп +// const ALLOWED_GROUPS = [-4724771662, 41286432]; // Замените на ID ваших групп + +// Применяем middleware +// bot.use(async (ctx, next) => { +// const chatId = ctx.chat!.id; +// console.log(chatId); + +// if (!ALLOWED_GROUPS.some((id) => id === chatId)) { +// console.log("not allowed"); +// return; +// } + +// console.log("allowed"); + +// return next(); +// }); + +bot.command("get", async (ctx) => { + let price1 = 0; + let price2 = 0; + let price3 = 0; + let price4 = 0; + + try { + const response1 = await got + .get( + "https://www.rbc.ru/quote/ajax/get-updated-finance-data-of-tickers/?tickersIds=338247&addSessionData=1" + ) + .json<{ [key: string]: { price: number } }>(); + + price1 = Math.round(response1["338247"].price * 100) / 100; + } catch (error) {} + + try { + const response2 = await got + .get("https://www.cbr.ru/scripts/XML_daily.asp") + .text(); + + const value = Number( + new XMLParser() + .parse(response2) + .ValCurs.Valute.find( + (valute: { NumCode: number; Value: string }) => valute.NumCode === 840 + ) + .Value.replace(",", ".") + ); + + price2 = Math.round(value * 100) / 100; + } catch (error) {} + + try { + const response3 = await got + .get( + "https://abcex.io/api/v1/exchange/public/market-data/order-book/depth?marketId=USDTRUB&lang=ru" + ) + .json<{ ask: Array<{ price: number }> }>(); + + price3 = Math.round(response3.ask[0].price * 100) / 100; + } catch (error) {} + + try { + const response4 = await got + .get("https://grinex.io/api/v2/k?market=usdta7a5&period=1440") + .json>(); + if (response4.length > 0) { + const lastItem = response4.at(-1); + if (lastItem) { + price4 = Math.round(lastItem.close * 100) / 100; + } + } + } catch (error) {} + + bot.telegram.sendMessage( + ctx.chat!.id, + `USD F (RBC) - ${price1}\nUSD (CBR) - ${price2}\nUSDT (ABCEX) - ${price3}\nUSDT (GRINEX) - ${price4}` + ); +}); + +bot.on("message", async ({ message }) => { + // console.log(message); + + if ("text" in message && message.text === "#курсы") { + let price1 = 0; + let price2 = 0; + let price3 = 0; + let price4 = 0; + + try { + const response1 = await got + .get( + "https://www.rbc.ru/quote/ajax/get-updated-finance-data-of-tickers/?tickersIds=338247&addSessionData=1" + ) + .json<{ [key: string]: { price: number } }>(); + + price1 = Math.round(response1["338247"].price * 100) / 100; + } catch (error) {} + + try { + const response2 = await got + .get("https://www.cbr.ru/scripts/XML_daily.asp") + .text(); + + const value = Number( + new XMLParser() + .parse(response2) + .ValCurs.Valute.find( + (valute: { NumCode: number; Value: string }) => + valute.NumCode === 840 + ) + .Value.replace(",", ".") + ); + + price2 = Math.round(value * 100) / 100; + } catch (error) {} + + try { + const response3 = await got + .get( + "https://abcex.io/api/v1/exchange/public/market-data/order-book/depth?marketId=USDTRUB&lang=ru" + ) + .json<{ ask: Array<{ price: number }> }>(); + + price3 = Math.round(response3.ask[0].price * 100) / 100; + } catch (error) {} + + try { + const response4 = await got + .get("https://grinex.io/api/v2/k?market=usdta7a5&period=1440") + .json>(); + if (response4.length > 0) { + const lastItem = response4.at(-1); + if (lastItem) { + price4 = Math.round(lastItem.close * 100) / 100; + } + } + } catch (error) {} + + bot.telegram.sendMessage( + message.chat.id, + `USD F (RBC) - ${price1}\nUSD (CBR) - ${price2}\nUSDT (ABCEX) - ${price3}\nUSDT (GRINEX) - ${price4}` + ); + } +}); + +bot.launch(); diff --git a/tsconfig.json b/tsconfig.json index 1ca2350..f7ffae1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ @@ -25,9 +25,9 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "ES2022", /* Specify what module code is generated. */ + "module": "ESNext", /* Specify what module code is generated. */ // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */