@devkong/cli 0.0.48 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -33368,19 +33368,19 @@ var require_form_data = __commonJS({
33368
33368
  var contentDisposition = this._getContentDisposition(value, options);
33369
33369
  var contentType = this._getContentType(value, options);
33370
33370
  var contents = "";
33371
- var headers2 = {
33371
+ var headers = {
33372
33372
  // add custom disposition as third element or keep it two elements if not
33373
33373
  "Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
33374
33374
  // if no content type. allow it to be empty array
33375
33375
  "Content-Type": [].concat(contentType || [])
33376
33376
  };
33377
33377
  if (typeof options.header === "object") {
33378
- populate(headers2, options.header);
33378
+ populate(headers, options.header);
33379
33379
  }
33380
33380
  var header;
33381
- for (var prop in headers2) {
33382
- if (hasOwn(headers2, prop)) {
33383
- header = headers2[prop];
33381
+ for (var prop in headers) {
33382
+ if (hasOwn(headers, prop)) {
33383
+ header = headers[prop];
33384
33384
  if (header == null) {
33385
33385
  continue;
33386
33386
  }
@@ -34870,12 +34870,12 @@ var require_follow_redirects = __commonJS({
34870
34870
  spread3.path = spread3.search ? spread3.pathname + spread3.search : spread3.pathname;
34871
34871
  return spread3;
34872
34872
  }
34873
- function removeMatchingHeaders(regex5, headers2) {
34873
+ function removeMatchingHeaders(regex5, headers) {
34874
34874
  var lastValue;
34875
- for (var header in headers2) {
34875
+ for (var header in headers) {
34876
34876
  if (regex5.test(header)) {
34877
- lastValue = headers2[header];
34878
- delete headers2[header];
34877
+ lastValue = headers[header];
34878
+ delete headers[header];
34879
34879
  }
34880
34880
  }
34881
34881
  return lastValue === null || typeof lastValue === "undefined" ? void 0 : String(lastValue).trim();
@@ -42513,7 +42513,8 @@ var require_child_process_utils = __commonJS({
42513
42513
  var error_utils_1 = require_error_utils();
42514
42514
  function spawnAndWait(command, args, cwd) {
42515
42515
  return new Promise((res, rej) => {
42516
- const childProcess = (0, child_process_1.spawn)(command, args, {
42516
+ const fullCommand = [command, ...args].map((arg) => arg.includes(" ") ? `"${arg}"` : arg).join(" ");
42517
+ const childProcess = (0, child_process_1.spawn)(fullCommand, {
42517
42518
  cwd,
42518
42519
  stdio: "inherit",
42519
42520
  env: {
@@ -43447,7 +43448,7 @@ var require_package2 = __commonJS({
43447
43448
  "node_modules/create-nx-workspace/package.json"(exports2, module2) {
43448
43449
  module2.exports = {
43449
43450
  name: "create-nx-workspace",
43450
- version: "22.1.1",
43451
+ version: "22.2.0",
43451
43452
  private: false,
43452
43453
  description: "Smart Repos \xB7 Fast Builds",
43453
43454
  repository: {
@@ -48101,203 +48102,3919 @@ var require_git = __commonJS({
48101
48102
  }
48102
48103
  return username;
48103
48104
  }
48105
+ var existingReposPromise;
48106
+ function populateExistingRepos(directory) {
48107
+ existingReposPromise ??= getUserRepositories(directory);
48108
+ }
48104
48109
  async function getUserRepositories(directory) {
48105
48110
  try {
48106
- const allRepos = /* @__PURE__ */ new Set();
48107
- const [userRepos, orgsResult] = await Promise.all([
48108
- (0, child_process_utils_1.execAndWait)('gh repo list --limit 1000 --json nameWithOwner --jq ".[].nameWithOwner"', directory),
48109
- (0, child_process_utils_1.execAndWait)('gh api user/orgs --jq ".[].login"', directory)
48110
- ]);
48111
- userRepos.stdout.trim().split("\n").filter((repo) => repo.length > 0).forEach((repo) => allRepos.add(repo));
48112
- const orgs = orgsResult.stdout.trim().split("\n").filter((org) => org.length > 0);
48113
- const orgRepoPromises = orgs.map(async (org) => {
48111
+ const allRepos = /* @__PURE__ */ new Set();
48112
+ const [userRepos, orgsResult] = await Promise.all([
48113
+ (0, child_process_utils_1.execAndWait)('gh repo list --limit 100 --json nameWithOwner --jq ".[].nameWithOwner"', directory),
48114
+ (0, child_process_utils_1.execAndWait)('gh api user/orgs --jq ".[].login"', directory)
48115
+ ]);
48116
+ userRepos.stdout.trim().split("\n").filter((repo) => repo.length > 0).forEach((repo) => allRepos.add(repo));
48117
+ const orgs = orgsResult.stdout.trim().split("\n").filter((org) => org.length > 0);
48118
+ const orgRepoPromises = orgs.map(async (org) => {
48119
+ try {
48120
+ const orgRepos = await (0, child_process_utils_1.execAndWait)(`gh repo list ${org} --limit 100 --json nameWithOwner --jq ".[].nameWithOwner"`, directory);
48121
+ return orgRepos.stdout.trim().split("\n").filter((repo) => repo.length > 0);
48122
+ } catch {
48123
+ return [];
48124
+ }
48125
+ });
48126
+ const orgRepoResults = await Promise.all(orgRepoPromises);
48127
+ orgRepoResults.flat().forEach((repo) => allRepos.add(repo));
48128
+ return allRepos;
48129
+ } catch {
48130
+ return /* @__PURE__ */ new Set();
48131
+ }
48132
+ }
48133
+ async function initializeGitRepo(directory, options) {
48134
+ if (options.commit?.name) {
48135
+ process.env.GIT_AUTHOR_NAME = options.commit.name;
48136
+ process.env.GIT_COMMITTER_NAME = options.commit.name;
48137
+ }
48138
+ if (options.commit?.email) {
48139
+ process.env.GIT_AUTHOR_EMAIL = options.commit.email;
48140
+ process.env.GIT_COMMITTER_EMAIL = options.commit.email;
48141
+ }
48142
+ const gitVersion = await checkGitVersion();
48143
+ if (!gitVersion) {
48144
+ return;
48145
+ }
48146
+ const insideRepo = await (0, child_process_utils_1.execAndWait)("git rev-parse --is-inside-work-tree", directory, true).then(() => true, () => false);
48147
+ if (insideRepo) {
48148
+ output_1.output.log({
48149
+ title: "Directory is already under version control. Skipping initialization of git."
48150
+ });
48151
+ return;
48152
+ }
48153
+ const defaultBase = options.defaultBase || (0, default_base_1.deduceDefaultBase)();
48154
+ const [gitMajor, gitMinor] = gitVersion.split(".");
48155
+ if (+gitMajor > 2 || +gitMajor === 2 && +gitMinor >= 28) {
48156
+ await (0, child_process_utils_1.execAndWait)(`git init -b ${defaultBase}`, directory);
48157
+ } else {
48158
+ await (0, child_process_utils_1.execAndWait)("git init", directory);
48159
+ await (0, child_process_utils_1.execAndWait)(`git checkout -b ${defaultBase}`, directory);
48160
+ }
48161
+ await (0, child_process_utils_1.execAndWait)("git add .", directory);
48162
+ if (options.commit) {
48163
+ let message2 = `${options.commit.message}` || "initial commit";
48164
+ if (options.connectUrl) {
48165
+ message2 = `${message2}
48166
+
48167
+ To connect your workspace to Nx Cloud, push your repository
48168
+ to your git hosting provider and go to the following URL:
48169
+
48170
+ ${options.connectUrl}
48171
+ `;
48172
+ }
48173
+ await (0, child_process_utils_1.execAndWait)(`git commit -m "${message2}"`, directory);
48174
+ }
48175
+ }
48176
+ async function pushToGitHub(directory, options) {
48177
+ try {
48178
+ if (process.env["NX_SKIP_GH_PUSH"] === "true") {
48179
+ throw new GitHubPushSkippedError("NX_SKIP_GH_PUSH is true so skipping GitHub push.");
48180
+ }
48181
+ const username = await getGitHubUsername(directory);
48182
+ populateExistingRepos(directory);
48183
+ const { push } = await enquirer.prompt([
48184
+ {
48185
+ name: "push",
48186
+ message: "Would you like to push this workspace to GitHub?",
48187
+ type: "autocomplete",
48188
+ choices: [{ name: "Yes" }, { name: "No" }],
48189
+ initial: 0
48190
+ }
48191
+ ]);
48192
+ if (push !== "Yes") {
48193
+ return VcsPushStatus.OptedOutOfPushingToVcs;
48194
+ }
48195
+ const defaultRepo = `${username}/${options.name}`;
48196
+ const createRepoUrl = `https://github.com/new?name=${encodeURIComponent(options.name)}`;
48197
+ const { repoName } = await enquirer.prompt([
48198
+ {
48199
+ name: "repoName",
48200
+ message: "Repository name (format: username/repo-name):",
48201
+ type: "input",
48202
+ initial: defaultRepo,
48203
+ validate: async (value) => {
48204
+ if (!value.includes("/")) {
48205
+ return "Repository name must be in format: username/repo-name";
48206
+ }
48207
+ const existingRepos = await existingReposPromise;
48208
+ if (existingRepos?.has(value)) {
48209
+ return `Repository '${value}' already exists. Choose a different name or create manually: ${createRepoUrl}`;
48210
+ }
48211
+ return true;
48212
+ }
48213
+ }
48214
+ ]);
48215
+ output_1.output.log({
48216
+ title: "Creating GitHub repository and pushing (this may take a moment)..."
48217
+ });
48218
+ await (0, child_process_utils_1.spawnAndWait)("gh", [
48219
+ "repo",
48220
+ "create",
48221
+ repoName,
48222
+ "--private",
48223
+ "--push",
48224
+ "--source",
48225
+ directory
48226
+ ], directory);
48227
+ const repoResult = await (0, child_process_utils_1.execAndWait)("gh repo view --json url -q .url", directory);
48228
+ const repoUrl = repoResult.stdout.trim();
48229
+ output_1.output.success({
48230
+ title: `Successfully pushed to GitHub repository: ${repoUrl}`
48231
+ });
48232
+ return VcsPushStatus.PushedToVcs;
48233
+ } catch (e) {
48234
+ const isVerbose = options.verbose || process.env.NX_VERBOSE_LOGGING === "true";
48235
+ const errorMessage = e instanceof Error ? e.message : String(e);
48236
+ const title = e instanceof GitHubPushSkippedError || e?.code === 127 ? "Push your workspace to GitHub." : "Could not push. Push repo to complete setup.";
48237
+ const createRepoUrl = `https://github.com/new?name=${encodeURIComponent(options.name)}`;
48238
+ output_1.output.log({
48239
+ title,
48240
+ bodyLines: isVerbose ? [
48241
+ `Go to ${createRepoUrl} and push this workspace.`,
48242
+ "Error details:",
48243
+ errorMessage
48244
+ ] : [`Go to ${createRepoUrl} and push this workspace.`]
48245
+ });
48246
+ return VcsPushStatus.FailedToPushToVcs;
48247
+ }
48248
+ }
48249
+ }
48250
+ });
48251
+
48252
+ // node_modules/create-nx-workspace/src/utils/nx/messages.js
48253
+ var require_messages = __commonJS({
48254
+ "node_modules/create-nx-workspace/src/utils/nx/messages.js"(exports2) {
48255
+ "use strict";
48256
+ Object.defineProperty(exports2, "__esModule", { value: true });
48257
+ exports2.getCompletionMessage = getCompletionMessage;
48258
+ exports2.getSkippedCloudMessage = getSkippedCloudMessage;
48259
+ var git_1 = require_git();
48260
+ function getSetupMessage(url2, pushedToVcs) {
48261
+ if (pushedToVcs === git_1.VcsPushStatus.PushedToVcs) {
48262
+ return url2 ? `Go to Nx Cloud and finish the setup: ${url2}` : "Return to Nx Cloud and finish the setup.";
48263
+ }
48264
+ const action = url2 ? "go" : "return";
48265
+ const urlSuffix = url2 ? `: ${url2}` : ".";
48266
+ return `Push your repo, then ${action} to Nx Cloud and finish the setup${urlSuffix}`;
48267
+ }
48268
+ var completionMessages = {
48269
+ "ci-setup": {
48270
+ title: "Your CI setup is almost complete."
48271
+ },
48272
+ "cache-setup": {
48273
+ title: "Your remote cache setup is almost complete."
48274
+ },
48275
+ "platform-setup": {
48276
+ title: "Your platform setup is almost complete."
48277
+ }
48278
+ };
48279
+ function getCompletionMessage(completionMessageKey, url2, pushedToVcs) {
48280
+ const key = completionMessageKey ?? "ci-setup";
48281
+ return {
48282
+ title: completionMessages[key].title,
48283
+ bodyLines: [getSetupMessage(url2, pushedToVcs)]
48284
+ };
48285
+ }
48286
+ function getSkippedCloudMessage() {
48287
+ return {
48288
+ title: "Next steps",
48289
+ bodyLines: [
48290
+ 'Run "nx connect" to enable remote caching and speed up your CI.',
48291
+ "",
48292
+ "70% faster CI, 60% less compute, automatically fix broken PRs.",
48293
+ "Learn more at https://nx.dev/nx-cloud"
48294
+ ]
48295
+ };
48296
+ }
48297
+ }
48298
+ });
48299
+
48300
+ // node_modules/axios/dist/node/axios.cjs
48301
+ var require_axios = __commonJS({
48302
+ "node_modules/axios/dist/node/axios.cjs"(exports2, module2) {
48303
+ "use strict";
48304
+ var FormData$1 = require_form_data();
48305
+ var crypto2 = require("crypto");
48306
+ var url2 = require("url");
48307
+ var proxyFromEnv2 = require_proxy_from_env();
48308
+ var http3 = require("http");
48309
+ var https2 = require("https");
48310
+ var http22 = require("http2");
48311
+ var util3 = require("util");
48312
+ var followRedirects2 = require_follow_redirects();
48313
+ var zlib2 = require("zlib");
48314
+ var stream4 = require("stream");
48315
+ var events = require("events");
48316
+ function _interopDefaultLegacy(e) {
48317
+ return e && typeof e === "object" && "default" in e ? e : { "default": e };
48318
+ }
48319
+ var FormData__default = /* @__PURE__ */ _interopDefaultLegacy(FormData$1);
48320
+ var crypto__default = /* @__PURE__ */ _interopDefaultLegacy(crypto2);
48321
+ var url__default = /* @__PURE__ */ _interopDefaultLegacy(url2);
48322
+ var proxyFromEnv__default = /* @__PURE__ */ _interopDefaultLegacy(proxyFromEnv2);
48323
+ var http__default = /* @__PURE__ */ _interopDefaultLegacy(http3);
48324
+ var https__default = /* @__PURE__ */ _interopDefaultLegacy(https2);
48325
+ var http2__default = /* @__PURE__ */ _interopDefaultLegacy(http22);
48326
+ var util__default = /* @__PURE__ */ _interopDefaultLegacy(util3);
48327
+ var followRedirects__default = /* @__PURE__ */ _interopDefaultLegacy(followRedirects2);
48328
+ var zlib__default = /* @__PURE__ */ _interopDefaultLegacy(zlib2);
48329
+ var stream__default = /* @__PURE__ */ _interopDefaultLegacy(stream4);
48330
+ function bind2(fn, thisArg) {
48331
+ return function wrap() {
48332
+ return fn.apply(thisArg, arguments);
48333
+ };
48334
+ }
48335
+ var { toString: toString3 } = Object.prototype;
48336
+ var { getPrototypeOf: getPrototypeOf2 } = Object;
48337
+ var { iterator: iterator2, toStringTag: toStringTag2 } = Symbol;
48338
+ var kindOf2 = /* @__PURE__ */ ((cache) => (thing) => {
48339
+ const str = toString3.call(thing);
48340
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
48341
+ })(/* @__PURE__ */ Object.create(null));
48342
+ var kindOfTest2 = (type) => {
48343
+ type = type.toLowerCase();
48344
+ return (thing) => kindOf2(thing) === type;
48345
+ };
48346
+ var typeOfTest2 = (type) => (thing) => typeof thing === type;
48347
+ var { isArray: isArray2 } = Array;
48348
+ var isUndefined2 = typeOfTest2("undefined");
48349
+ function isBuffer2(val) {
48350
+ return val !== null && !isUndefined2(val) && val.constructor !== null && !isUndefined2(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
48351
+ }
48352
+ var isArrayBuffer2 = kindOfTest2("ArrayBuffer");
48353
+ function isArrayBufferView2(val) {
48354
+ let result;
48355
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
48356
+ result = ArrayBuffer.isView(val);
48357
+ } else {
48358
+ result = val && val.buffer && isArrayBuffer2(val.buffer);
48359
+ }
48360
+ return result;
48361
+ }
48362
+ var isString3 = typeOfTest2("string");
48363
+ var isFunction$1 = typeOfTest2("function");
48364
+ var isNumber3 = typeOfTest2("number");
48365
+ var isObject2 = (thing) => thing !== null && typeof thing === "object";
48366
+ var isBoolean2 = (thing) => thing === true || thing === false;
48367
+ var isPlainObject3 = (val) => {
48368
+ if (kindOf2(val) !== "object") {
48369
+ return false;
48370
+ }
48371
+ const prototype4 = getPrototypeOf2(val);
48372
+ return (prototype4 === null || prototype4 === Object.prototype || Object.getPrototypeOf(prototype4) === null) && !(toStringTag2 in val) && !(iterator2 in val);
48373
+ };
48374
+ var isEmptyObject2 = (val) => {
48375
+ if (!isObject2(val) || isBuffer2(val)) {
48376
+ return false;
48377
+ }
48378
+ try {
48379
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
48380
+ } catch (e) {
48381
+ return false;
48382
+ }
48383
+ };
48384
+ var isDate3 = kindOfTest2("Date");
48385
+ var isFile2 = kindOfTest2("File");
48386
+ var isBlob2 = kindOfTest2("Blob");
48387
+ var isFileList2 = kindOfTest2("FileList");
48388
+ var isStream2 = (val) => isObject2(val) && isFunction$1(val.pipe);
48389
+ var isFormData2 = (thing) => {
48390
+ let kind;
48391
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf2(thing)) === "formdata" || // detect form-data instance
48392
+ kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
48393
+ };
48394
+ var isURLSearchParams2 = kindOfTest2("URLSearchParams");
48395
+ var [isReadableStream2, isRequest2, isResponse2, isHeaders2] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest2);
48396
+ var trim3 = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
48397
+ function forEach2(obj, fn, { allOwnKeys = false } = {}) {
48398
+ if (obj === null || typeof obj === "undefined") {
48399
+ return;
48400
+ }
48401
+ let i;
48402
+ let l;
48403
+ if (typeof obj !== "object") {
48404
+ obj = [obj];
48405
+ }
48406
+ if (isArray2(obj)) {
48407
+ for (i = 0, l = obj.length; i < l; i++) {
48408
+ fn.call(null, obj[i], i, obj);
48409
+ }
48410
+ } else {
48411
+ if (isBuffer2(obj)) {
48412
+ return;
48413
+ }
48414
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
48415
+ const len = keys.length;
48416
+ let key;
48417
+ for (i = 0; i < len; i++) {
48418
+ key = keys[i];
48419
+ fn.call(null, obj[key], key, obj);
48420
+ }
48421
+ }
48422
+ }
48423
+ function findKey3(obj, key) {
48424
+ if (isBuffer2(obj)) {
48425
+ return null;
48426
+ }
48427
+ key = key.toLowerCase();
48428
+ const keys = Object.keys(obj);
48429
+ let i = keys.length;
48430
+ let _key;
48431
+ while (i-- > 0) {
48432
+ _key = keys[i];
48433
+ if (key === _key.toLowerCase()) {
48434
+ return _key;
48435
+ }
48436
+ }
48437
+ return null;
48438
+ }
48439
+ var _global2 = (() => {
48440
+ if (typeof globalThis !== "undefined") return globalThis;
48441
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
48442
+ })();
48443
+ var isContextDefined2 = (context) => !isUndefined2(context) && context !== _global2;
48444
+ function merge3() {
48445
+ const { caseless, skipUndefined } = isContextDefined2(this) && this || {};
48446
+ const result = {};
48447
+ const assignValue = (val, key) => {
48448
+ const targetKey = caseless && findKey3(result, key) || key;
48449
+ if (isPlainObject3(result[targetKey]) && isPlainObject3(val)) {
48450
+ result[targetKey] = merge3(result[targetKey], val);
48451
+ } else if (isPlainObject3(val)) {
48452
+ result[targetKey] = merge3({}, val);
48453
+ } else if (isArray2(val)) {
48454
+ result[targetKey] = val.slice();
48455
+ } else if (!skipUndefined || !isUndefined2(val)) {
48456
+ result[targetKey] = val;
48457
+ }
48458
+ };
48459
+ for (let i = 0, l = arguments.length; i < l; i++) {
48460
+ arguments[i] && forEach2(arguments[i], assignValue);
48461
+ }
48462
+ return result;
48463
+ }
48464
+ var extend2 = (a, b, thisArg, { allOwnKeys } = {}) => {
48465
+ forEach2(b, (val, key) => {
48466
+ if (thisArg && isFunction$1(val)) {
48467
+ a[key] = bind2(val, thisArg);
48468
+ } else {
48469
+ a[key] = val;
48470
+ }
48471
+ }, { allOwnKeys });
48472
+ return a;
48473
+ };
48474
+ var stripBOM2 = (content) => {
48475
+ if (content.charCodeAt(0) === 65279) {
48476
+ content = content.slice(1);
48477
+ }
48478
+ return content;
48479
+ };
48480
+ var inherits2 = (constructor, superConstructor, props, descriptors3) => {
48481
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors3);
48482
+ constructor.prototype.constructor = constructor;
48483
+ Object.defineProperty(constructor, "super", {
48484
+ value: superConstructor.prototype
48485
+ });
48486
+ props && Object.assign(constructor.prototype, props);
48487
+ };
48488
+ var toFlatObject2 = (sourceObj, destObj, filter3, propFilter) => {
48489
+ let props;
48490
+ let i;
48491
+ let prop;
48492
+ const merged = {};
48493
+ destObj = destObj || {};
48494
+ if (sourceObj == null) return destObj;
48495
+ do {
48496
+ props = Object.getOwnPropertyNames(sourceObj);
48497
+ i = props.length;
48498
+ while (i-- > 0) {
48499
+ prop = props[i];
48500
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
48501
+ destObj[prop] = sourceObj[prop];
48502
+ merged[prop] = true;
48503
+ }
48504
+ }
48505
+ sourceObj = filter3 !== false && getPrototypeOf2(sourceObj);
48506
+ } while (sourceObj && (!filter3 || filter3(sourceObj, destObj)) && sourceObj !== Object.prototype);
48507
+ return destObj;
48508
+ };
48509
+ var endsWith2 = (str, searchString, position) => {
48510
+ str = String(str);
48511
+ if (position === void 0 || position > str.length) {
48512
+ position = str.length;
48513
+ }
48514
+ position -= searchString.length;
48515
+ const lastIndex = str.indexOf(searchString, position);
48516
+ return lastIndex !== -1 && lastIndex === position;
48517
+ };
48518
+ var toArray2 = (thing) => {
48519
+ if (!thing) return null;
48520
+ if (isArray2(thing)) return thing;
48521
+ let i = thing.length;
48522
+ if (!isNumber3(i)) return null;
48523
+ const arr = new Array(i);
48524
+ while (i-- > 0) {
48525
+ arr[i] = thing[i];
48526
+ }
48527
+ return arr;
48528
+ };
48529
+ var isTypedArray2 = /* @__PURE__ */ ((TypedArray) => {
48530
+ return (thing) => {
48531
+ return TypedArray && thing instanceof TypedArray;
48532
+ };
48533
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf2(Uint8Array));
48534
+ var forEachEntry2 = (obj, fn) => {
48535
+ const generator = obj && obj[iterator2];
48536
+ const _iterator = generator.call(obj);
48537
+ let result;
48538
+ while ((result = _iterator.next()) && !result.done) {
48539
+ const pair = result.value;
48540
+ fn.call(obj, pair[0], pair[1]);
48541
+ }
48542
+ };
48543
+ var matchAll2 = (regExp, str) => {
48544
+ let matches;
48545
+ const arr = [];
48546
+ while ((matches = regExp.exec(str)) !== null) {
48547
+ arr.push(matches);
48548
+ }
48549
+ return arr;
48550
+ };
48551
+ var isHTMLForm2 = kindOfTest2("HTMLFormElement");
48552
+ var toCamelCase2 = (str) => {
48553
+ return str.toLowerCase().replace(
48554
+ /[-_\s]([a-z\d])(\w*)/g,
48555
+ function replacer(m, p1, p2) {
48556
+ return p1.toUpperCase() + p2;
48557
+ }
48558
+ );
48559
+ };
48560
+ var hasOwnProperty2 = (({ hasOwnProperty: hasOwnProperty3 }) => (obj, prop) => hasOwnProperty3.call(obj, prop))(Object.prototype);
48561
+ var isRegExp2 = kindOfTest2("RegExp");
48562
+ var reduceDescriptors2 = (obj, reducer) => {
48563
+ const descriptors3 = Object.getOwnPropertyDescriptors(obj);
48564
+ const reducedDescriptors = {};
48565
+ forEach2(descriptors3, (descriptor, name) => {
48566
+ let ret;
48567
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
48568
+ reducedDescriptors[name] = ret || descriptor;
48569
+ }
48570
+ });
48571
+ Object.defineProperties(obj, reducedDescriptors);
48572
+ };
48573
+ var freezeMethods2 = (obj) => {
48574
+ reduceDescriptors2(obj, (descriptor, name) => {
48575
+ if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
48576
+ return false;
48577
+ }
48578
+ const value = obj[name];
48579
+ if (!isFunction$1(value)) return;
48580
+ descriptor.enumerable = false;
48581
+ if ("writable" in descriptor) {
48582
+ descriptor.writable = false;
48583
+ return;
48584
+ }
48585
+ if (!descriptor.set) {
48586
+ descriptor.set = () => {
48587
+ throw Error("Can not rewrite read-only method '" + name + "'");
48588
+ };
48589
+ }
48590
+ });
48591
+ };
48592
+ var toObjectSet2 = (arrayOrString, delimiter) => {
48593
+ const obj = {};
48594
+ const define2 = (arr) => {
48595
+ arr.forEach((value) => {
48596
+ obj[value] = true;
48597
+ });
48598
+ };
48599
+ isArray2(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
48600
+ return obj;
48601
+ };
48602
+ var noop3 = () => {
48603
+ };
48604
+ var toFiniteNumber2 = (value, defaultValue) => {
48605
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
48606
+ };
48607
+ function isSpecCompliantForm2(thing) {
48608
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag2] === "FormData" && thing[iterator2]);
48609
+ }
48610
+ var toJSONObject2 = (obj) => {
48611
+ const stack = new Array(10);
48612
+ const visit = (source, i) => {
48613
+ if (isObject2(source)) {
48614
+ if (stack.indexOf(source) >= 0) {
48615
+ return;
48616
+ }
48617
+ if (isBuffer2(source)) {
48618
+ return source;
48619
+ }
48620
+ if (!("toJSON" in source)) {
48621
+ stack[i] = source;
48622
+ const target = isArray2(source) ? [] : {};
48623
+ forEach2(source, (value, key) => {
48624
+ const reducedValue = visit(value, i + 1);
48625
+ !isUndefined2(reducedValue) && (target[key] = reducedValue);
48626
+ });
48627
+ stack[i] = void 0;
48628
+ return target;
48629
+ }
48630
+ }
48631
+ return source;
48632
+ };
48633
+ return visit(obj, 0);
48634
+ };
48635
+ var isAsyncFn2 = kindOfTest2("AsyncFunction");
48636
+ var isThenable2 = (thing) => thing && (isObject2(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
48637
+ var _setImmediate2 = ((setImmediateSupported, postMessageSupported) => {
48638
+ if (setImmediateSupported) {
48639
+ return setImmediate;
48640
+ }
48641
+ return postMessageSupported ? ((token, callbacks) => {
48642
+ _global2.addEventListener("message", ({ source, data }) => {
48643
+ if (source === _global2 && data === token) {
48644
+ callbacks.length && callbacks.shift()();
48645
+ }
48646
+ }, false);
48647
+ return (cb) => {
48648
+ callbacks.push(cb);
48649
+ _global2.postMessage(token, "*");
48650
+ };
48651
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
48652
+ })(
48653
+ typeof setImmediate === "function",
48654
+ isFunction$1(_global2.postMessage)
48655
+ );
48656
+ var asap2 = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global2) : typeof process !== "undefined" && process.nextTick || _setImmediate2;
48657
+ var isIterable2 = (thing) => thing != null && isFunction$1(thing[iterator2]);
48658
+ var utils$1 = {
48659
+ isArray: isArray2,
48660
+ isArrayBuffer: isArrayBuffer2,
48661
+ isBuffer: isBuffer2,
48662
+ isFormData: isFormData2,
48663
+ isArrayBufferView: isArrayBufferView2,
48664
+ isString: isString3,
48665
+ isNumber: isNumber3,
48666
+ isBoolean: isBoolean2,
48667
+ isObject: isObject2,
48668
+ isPlainObject: isPlainObject3,
48669
+ isEmptyObject: isEmptyObject2,
48670
+ isReadableStream: isReadableStream2,
48671
+ isRequest: isRequest2,
48672
+ isResponse: isResponse2,
48673
+ isHeaders: isHeaders2,
48674
+ isUndefined: isUndefined2,
48675
+ isDate: isDate3,
48676
+ isFile: isFile2,
48677
+ isBlob: isBlob2,
48678
+ isRegExp: isRegExp2,
48679
+ isFunction: isFunction$1,
48680
+ isStream: isStream2,
48681
+ isURLSearchParams: isURLSearchParams2,
48682
+ isTypedArray: isTypedArray2,
48683
+ isFileList: isFileList2,
48684
+ forEach: forEach2,
48685
+ merge: merge3,
48686
+ extend: extend2,
48687
+ trim: trim3,
48688
+ stripBOM: stripBOM2,
48689
+ inherits: inherits2,
48690
+ toFlatObject: toFlatObject2,
48691
+ kindOf: kindOf2,
48692
+ kindOfTest: kindOfTest2,
48693
+ endsWith: endsWith2,
48694
+ toArray: toArray2,
48695
+ forEachEntry: forEachEntry2,
48696
+ matchAll: matchAll2,
48697
+ isHTMLForm: isHTMLForm2,
48698
+ hasOwnProperty: hasOwnProperty2,
48699
+ hasOwnProp: hasOwnProperty2,
48700
+ // an alias to avoid ESLint no-prototype-builtins detection
48701
+ reduceDescriptors: reduceDescriptors2,
48702
+ freezeMethods: freezeMethods2,
48703
+ toObjectSet: toObjectSet2,
48704
+ toCamelCase: toCamelCase2,
48705
+ noop: noop3,
48706
+ toFiniteNumber: toFiniteNumber2,
48707
+ findKey: findKey3,
48708
+ global: _global2,
48709
+ isContextDefined: isContextDefined2,
48710
+ isSpecCompliantForm: isSpecCompliantForm2,
48711
+ toJSONObject: toJSONObject2,
48712
+ isAsyncFn: isAsyncFn2,
48713
+ isThenable: isThenable2,
48714
+ setImmediate: _setImmediate2,
48715
+ asap: asap2,
48716
+ isIterable: isIterable2
48717
+ };
48718
+ function AxiosError3(message2, code, config, request, response) {
48719
+ Error.call(this);
48720
+ if (Error.captureStackTrace) {
48721
+ Error.captureStackTrace(this, this.constructor);
48722
+ } else {
48723
+ this.stack = new Error().stack;
48724
+ }
48725
+ this.message = message2;
48726
+ this.name = "AxiosError";
48727
+ code && (this.code = code);
48728
+ config && (this.config = config);
48729
+ request && (this.request = request);
48730
+ if (response) {
48731
+ this.response = response;
48732
+ this.status = response.status ? response.status : null;
48733
+ }
48734
+ }
48735
+ utils$1.inherits(AxiosError3, Error, {
48736
+ toJSON: function toJSON2() {
48737
+ return {
48738
+ // Standard
48739
+ message: this.message,
48740
+ name: this.name,
48741
+ // Microsoft
48742
+ description: this.description,
48743
+ number: this.number,
48744
+ // Mozilla
48745
+ fileName: this.fileName,
48746
+ lineNumber: this.lineNumber,
48747
+ columnNumber: this.columnNumber,
48748
+ stack: this.stack,
48749
+ // Axios
48750
+ config: utils$1.toJSONObject(this.config),
48751
+ code: this.code,
48752
+ status: this.status
48753
+ };
48754
+ }
48755
+ });
48756
+ var prototype$1 = AxiosError3.prototype;
48757
+ var descriptors2 = {};
48758
+ [
48759
+ "ERR_BAD_OPTION_VALUE",
48760
+ "ERR_BAD_OPTION",
48761
+ "ECONNABORTED",
48762
+ "ETIMEDOUT",
48763
+ "ERR_NETWORK",
48764
+ "ERR_FR_TOO_MANY_REDIRECTS",
48765
+ "ERR_DEPRECATED",
48766
+ "ERR_BAD_RESPONSE",
48767
+ "ERR_BAD_REQUEST",
48768
+ "ERR_CANCELED",
48769
+ "ERR_NOT_SUPPORT",
48770
+ "ERR_INVALID_URL"
48771
+ // eslint-disable-next-line func-names
48772
+ ].forEach((code) => {
48773
+ descriptors2[code] = { value: code };
48774
+ });
48775
+ Object.defineProperties(AxiosError3, descriptors2);
48776
+ Object.defineProperty(prototype$1, "isAxiosError", { value: true });
48777
+ AxiosError3.from = (error, code, config, request, response, customProps) => {
48778
+ const axiosError = Object.create(prototype$1);
48779
+ utils$1.toFlatObject(error, axiosError, function filter3(obj) {
48780
+ return obj !== Error.prototype;
48781
+ }, (prop) => {
48782
+ return prop !== "isAxiosError";
48783
+ });
48784
+ const msg = error && error.message ? error.message : "Error";
48785
+ const errCode = code == null && error ? error.code : code;
48786
+ AxiosError3.call(axiosError, msg, errCode, config, request, response);
48787
+ if (error && axiosError.cause == null) {
48788
+ Object.defineProperty(axiosError, "cause", { value: error, configurable: true });
48789
+ }
48790
+ axiosError.name = error && error.name || "Error";
48791
+ customProps && Object.assign(axiosError, customProps);
48792
+ return axiosError;
48793
+ };
48794
+ function isVisitable2(thing) {
48795
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
48796
+ }
48797
+ function removeBrackets2(key) {
48798
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
48799
+ }
48800
+ function renderKey2(path7, key, dots) {
48801
+ if (!path7) return key;
48802
+ return path7.concat(key).map(function each(token, i) {
48803
+ token = removeBrackets2(token);
48804
+ return !dots && i ? "[" + token + "]" : token;
48805
+ }).join(dots ? "." : "");
48806
+ }
48807
+ function isFlatArray2(arr) {
48808
+ return utils$1.isArray(arr) && !arr.some(isVisitable2);
48809
+ }
48810
+ var predicates2 = utils$1.toFlatObject(utils$1, {}, null, function filter3(prop) {
48811
+ return /^is[A-Z]/.test(prop);
48812
+ });
48813
+ function toFormData3(obj, formData, options) {
48814
+ if (!utils$1.isObject(obj)) {
48815
+ throw new TypeError("target must be an object");
48816
+ }
48817
+ formData = formData || new (FormData__default["default"] || FormData)();
48818
+ options = utils$1.toFlatObject(options, {
48819
+ metaTokens: true,
48820
+ dots: false,
48821
+ indexes: false
48822
+ }, false, function defined(option, source) {
48823
+ return !utils$1.isUndefined(source[option]);
48824
+ });
48825
+ const metaTokens = options.metaTokens;
48826
+ const visitor = options.visitor || defaultVisitor;
48827
+ const dots = options.dots;
48828
+ const indexes = options.indexes;
48829
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
48830
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
48831
+ if (!utils$1.isFunction(visitor)) {
48832
+ throw new TypeError("visitor must be a function");
48833
+ }
48834
+ function convertValue(value) {
48835
+ if (value === null) return "";
48836
+ if (utils$1.isDate(value)) {
48837
+ return value.toISOString();
48838
+ }
48839
+ if (utils$1.isBoolean(value)) {
48840
+ return value.toString();
48841
+ }
48842
+ if (!useBlob && utils$1.isBlob(value)) {
48843
+ throw new AxiosError3("Blob is not supported. Use a Buffer instead.");
48844
+ }
48845
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
48846
+ return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
48847
+ }
48848
+ return value;
48849
+ }
48850
+ function defaultVisitor(value, key, path7) {
48851
+ let arr = value;
48852
+ if (value && !path7 && typeof value === "object") {
48853
+ if (utils$1.endsWith(key, "{}")) {
48854
+ key = metaTokens ? key : key.slice(0, -2);
48855
+ value = JSON.stringify(value);
48856
+ } else if (utils$1.isArray(value) && isFlatArray2(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
48857
+ key = removeBrackets2(key);
48858
+ arr.forEach(function each(el, index) {
48859
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
48860
+ // eslint-disable-next-line no-nested-ternary
48861
+ indexes === true ? renderKey2([key], index, dots) : indexes === null ? key : key + "[]",
48862
+ convertValue(el)
48863
+ );
48864
+ });
48865
+ return false;
48866
+ }
48867
+ }
48868
+ if (isVisitable2(value)) {
48869
+ return true;
48870
+ }
48871
+ formData.append(renderKey2(path7, key, dots), convertValue(value));
48872
+ return false;
48873
+ }
48874
+ const stack = [];
48875
+ const exposedHelpers = Object.assign(predicates2, {
48876
+ defaultVisitor,
48877
+ convertValue,
48878
+ isVisitable: isVisitable2
48879
+ });
48880
+ function build(value, path7) {
48881
+ if (utils$1.isUndefined(value)) return;
48882
+ if (stack.indexOf(value) !== -1) {
48883
+ throw Error("Circular reference detected in " + path7.join("."));
48884
+ }
48885
+ stack.push(value);
48886
+ utils$1.forEach(value, function each(el, key) {
48887
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
48888
+ formData,
48889
+ el,
48890
+ utils$1.isString(key) ? key.trim() : key,
48891
+ path7,
48892
+ exposedHelpers
48893
+ );
48894
+ if (result === true) {
48895
+ build(el, path7 ? path7.concat(key) : [key]);
48896
+ }
48897
+ });
48898
+ stack.pop();
48899
+ }
48900
+ if (!utils$1.isObject(obj)) {
48901
+ throw new TypeError("data must be an object");
48902
+ }
48903
+ build(obj);
48904
+ return formData;
48905
+ }
48906
+ function encode$1(str) {
48907
+ const charMap = {
48908
+ "!": "%21",
48909
+ "'": "%27",
48910
+ "(": "%28",
48911
+ ")": "%29",
48912
+ "~": "%7E",
48913
+ "%20": "+",
48914
+ "%00": "\0"
48915
+ };
48916
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match2) {
48917
+ return charMap[match2];
48918
+ });
48919
+ }
48920
+ function AxiosURLSearchParams2(params, options) {
48921
+ this._pairs = [];
48922
+ params && toFormData3(params, this, options);
48923
+ }
48924
+ var prototype3 = AxiosURLSearchParams2.prototype;
48925
+ prototype3.append = function append2(name, value) {
48926
+ this._pairs.push([name, value]);
48927
+ };
48928
+ prototype3.toString = function toString4(encoder) {
48929
+ const _encode = encoder ? function(value) {
48930
+ return encoder.call(this, value, encode$1);
48931
+ } : encode$1;
48932
+ return this._pairs.map(function each(pair) {
48933
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
48934
+ }, "").join("&");
48935
+ };
48936
+ function encode3(val) {
48937
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
48938
+ }
48939
+ function buildURL2(url3, params, options) {
48940
+ if (!params) {
48941
+ return url3;
48942
+ }
48943
+ const _encode = options && options.encode || encode3;
48944
+ if (utils$1.isFunction(options)) {
48945
+ options = {
48946
+ serialize: options
48947
+ };
48948
+ }
48949
+ const serializeFn = options && options.serialize;
48950
+ let serializedParams;
48951
+ if (serializeFn) {
48952
+ serializedParams = serializeFn(params, options);
48953
+ } else {
48954
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams2(params, options).toString(_encode);
48955
+ }
48956
+ if (serializedParams) {
48957
+ const hashmarkIndex = url3.indexOf("#");
48958
+ if (hashmarkIndex !== -1) {
48959
+ url3 = url3.slice(0, hashmarkIndex);
48960
+ }
48961
+ url3 += (url3.indexOf("?") === -1 ? "?" : "&") + serializedParams;
48962
+ }
48963
+ return url3;
48964
+ }
48965
+ var InterceptorManager2 = class {
48966
+ constructor() {
48967
+ this.handlers = [];
48968
+ }
48969
+ /**
48970
+ * Add a new interceptor to the stack
48971
+ *
48972
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
48973
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
48974
+ *
48975
+ * @return {Number} An ID used to remove interceptor later
48976
+ */
48977
+ use(fulfilled, rejected, options) {
48978
+ this.handlers.push({
48979
+ fulfilled,
48980
+ rejected,
48981
+ synchronous: options ? options.synchronous : false,
48982
+ runWhen: options ? options.runWhen : null
48983
+ });
48984
+ return this.handlers.length - 1;
48985
+ }
48986
+ /**
48987
+ * Remove an interceptor from the stack
48988
+ *
48989
+ * @param {Number} id The ID that was returned by `use`
48990
+ *
48991
+ * @returns {void}
48992
+ */
48993
+ eject(id) {
48994
+ if (this.handlers[id]) {
48995
+ this.handlers[id] = null;
48996
+ }
48997
+ }
48998
+ /**
48999
+ * Clear all interceptors from the stack
49000
+ *
49001
+ * @returns {void}
49002
+ */
49003
+ clear() {
49004
+ if (this.handlers) {
49005
+ this.handlers = [];
49006
+ }
49007
+ }
49008
+ /**
49009
+ * Iterate over all the registered interceptors
49010
+ *
49011
+ * This method is particularly useful for skipping over any
49012
+ * interceptors that may have become `null` calling `eject`.
49013
+ *
49014
+ * @param {Function} fn The function to call for each interceptor
49015
+ *
49016
+ * @returns {void}
49017
+ */
49018
+ forEach(fn) {
49019
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
49020
+ if (h !== null) {
49021
+ fn(h);
49022
+ }
49023
+ });
49024
+ }
49025
+ };
49026
+ var InterceptorManager$1 = InterceptorManager2;
49027
+ var transitionalDefaults = {
49028
+ silentJSONParsing: true,
49029
+ forcedJSONParsing: true,
49030
+ clarifyTimeoutError: false
49031
+ };
49032
+ var URLSearchParams = url__default["default"].URLSearchParams;
49033
+ var ALPHA2 = "abcdefghijklmnopqrstuvwxyz";
49034
+ var DIGIT2 = "0123456789";
49035
+ var ALPHABET2 = {
49036
+ DIGIT: DIGIT2,
49037
+ ALPHA: ALPHA2,
49038
+ ALPHA_DIGIT: ALPHA2 + ALPHA2.toUpperCase() + DIGIT2
49039
+ };
49040
+ var generateString2 = (size = 16, alphabet = ALPHABET2.ALPHA_DIGIT) => {
49041
+ let str = "";
49042
+ const { length } = alphabet;
49043
+ const randomValues = new Uint32Array(size);
49044
+ crypto__default["default"].randomFillSync(randomValues);
49045
+ for (let i = 0; i < size; i++) {
49046
+ str += alphabet[randomValues[i] % length];
49047
+ }
49048
+ return str;
49049
+ };
49050
+ var platform$1 = {
49051
+ isNode: true,
49052
+ classes: {
49053
+ URLSearchParams,
49054
+ FormData: FormData__default["default"],
49055
+ Blob: typeof Blob !== "undefined" && Blob || null
49056
+ },
49057
+ ALPHABET: ALPHABET2,
49058
+ generateString: generateString2,
49059
+ protocols: ["http", "https", "file", "data"]
49060
+ };
49061
+ var hasBrowserEnv2 = typeof window !== "undefined" && typeof document !== "undefined";
49062
+ var _navigator2 = typeof navigator === "object" && navigator || void 0;
49063
+ var hasStandardBrowserEnv2 = hasBrowserEnv2 && (!_navigator2 || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator2.product) < 0);
49064
+ var hasStandardBrowserWebWorkerEnv2 = (() => {
49065
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
49066
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
49067
+ })();
49068
+ var origin2 = hasBrowserEnv2 && window.location.href || "http://localhost";
49069
+ var utils = /* @__PURE__ */ Object.freeze({
49070
+ __proto__: null,
49071
+ hasBrowserEnv: hasBrowserEnv2,
49072
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv2,
49073
+ hasStandardBrowserEnv: hasStandardBrowserEnv2,
49074
+ navigator: _navigator2,
49075
+ origin: origin2
49076
+ });
49077
+ var platform3 = {
49078
+ ...utils,
49079
+ ...platform$1
49080
+ };
49081
+ function toURLEncodedForm2(data, options) {
49082
+ return toFormData3(data, new platform3.classes.URLSearchParams(), {
49083
+ visitor: function(value, key, path7, helpers) {
49084
+ if (platform3.isNode && utils$1.isBuffer(value)) {
49085
+ this.append(key, value.toString("base64"));
49086
+ return false;
49087
+ }
49088
+ return helpers.defaultVisitor.apply(this, arguments);
49089
+ },
49090
+ ...options
49091
+ });
49092
+ }
49093
+ function parsePropPath2(name) {
49094
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match2) => {
49095
+ return match2[0] === "[]" ? "" : match2[1] || match2[0];
49096
+ });
49097
+ }
49098
+ function arrayToObject2(arr) {
49099
+ const obj = {};
49100
+ const keys = Object.keys(arr);
49101
+ let i;
49102
+ const len = keys.length;
49103
+ let key;
49104
+ for (i = 0; i < len; i++) {
49105
+ key = keys[i];
49106
+ obj[key] = arr[key];
49107
+ }
49108
+ return obj;
49109
+ }
49110
+ function formDataToJSON2(formData) {
49111
+ function buildPath(path7, value, target, index) {
49112
+ let name = path7[index++];
49113
+ if (name === "__proto__") return true;
49114
+ const isNumericKey = Number.isFinite(+name);
49115
+ const isLast = index >= path7.length;
49116
+ name = !name && utils$1.isArray(target) ? target.length : name;
49117
+ if (isLast) {
49118
+ if (utils$1.hasOwnProp(target, name)) {
49119
+ target[name] = [target[name], value];
49120
+ } else {
49121
+ target[name] = value;
49122
+ }
49123
+ return !isNumericKey;
49124
+ }
49125
+ if (!target[name] || !utils$1.isObject(target[name])) {
49126
+ target[name] = [];
49127
+ }
49128
+ const result = buildPath(path7, value, target[name], index);
49129
+ if (result && utils$1.isArray(target[name])) {
49130
+ target[name] = arrayToObject2(target[name]);
49131
+ }
49132
+ return !isNumericKey;
49133
+ }
49134
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
49135
+ const obj = {};
49136
+ utils$1.forEachEntry(formData, (name, value) => {
49137
+ buildPath(parsePropPath2(name), value, obj, 0);
49138
+ });
49139
+ return obj;
49140
+ }
49141
+ return null;
49142
+ }
49143
+ function stringifySafely2(rawValue, parser, encoder) {
49144
+ if (utils$1.isString(rawValue)) {
49145
+ try {
49146
+ (parser || JSON.parse)(rawValue);
49147
+ return utils$1.trim(rawValue);
49148
+ } catch (e) {
49149
+ if (e.name !== "SyntaxError") {
49150
+ throw e;
49151
+ }
49152
+ }
49153
+ }
49154
+ return (encoder || JSON.stringify)(rawValue);
49155
+ }
49156
+ var defaults3 = {
49157
+ transitional: transitionalDefaults,
49158
+ adapter: ["xhr", "http", "fetch"],
49159
+ transformRequest: [function transformRequest2(data, headers) {
49160
+ const contentType = headers.getContentType() || "";
49161
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
49162
+ const isObjectPayload = utils$1.isObject(data);
49163
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
49164
+ data = new FormData(data);
49165
+ }
49166
+ const isFormData3 = utils$1.isFormData(data);
49167
+ if (isFormData3) {
49168
+ return hasJSONContentType ? JSON.stringify(formDataToJSON2(data)) : data;
49169
+ }
49170
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
49171
+ return data;
49172
+ }
49173
+ if (utils$1.isArrayBufferView(data)) {
49174
+ return data.buffer;
49175
+ }
49176
+ if (utils$1.isURLSearchParams(data)) {
49177
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
49178
+ return data.toString();
49179
+ }
49180
+ let isFileList3;
49181
+ if (isObjectPayload) {
49182
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
49183
+ return toURLEncodedForm2(data, this.formSerializer).toString();
49184
+ }
49185
+ if ((isFileList3 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
49186
+ const _FormData = this.env && this.env.FormData;
49187
+ return toFormData3(
49188
+ isFileList3 ? { "files[]": data } : data,
49189
+ _FormData && new _FormData(),
49190
+ this.formSerializer
49191
+ );
49192
+ }
49193
+ }
49194
+ if (isObjectPayload || hasJSONContentType) {
49195
+ headers.setContentType("application/json", false);
49196
+ return stringifySafely2(data);
49197
+ }
49198
+ return data;
49199
+ }],
49200
+ transformResponse: [function transformResponse2(data) {
49201
+ const transitional2 = this.transitional || defaults3.transitional;
49202
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
49203
+ const JSONRequested = this.responseType === "json";
49204
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
49205
+ return data;
49206
+ }
49207
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
49208
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
49209
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
49210
+ try {
49211
+ return JSON.parse(data, this.parseReviver);
49212
+ } catch (e) {
49213
+ if (strictJSONParsing) {
49214
+ if (e.name === "SyntaxError") {
49215
+ throw AxiosError3.from(e, AxiosError3.ERR_BAD_RESPONSE, this, null, this.response);
49216
+ }
49217
+ throw e;
49218
+ }
49219
+ }
49220
+ }
49221
+ return data;
49222
+ }],
49223
+ /**
49224
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
49225
+ * timeout is not created.
49226
+ */
49227
+ timeout: 0,
49228
+ xsrfCookieName: "XSRF-TOKEN",
49229
+ xsrfHeaderName: "X-XSRF-TOKEN",
49230
+ maxContentLength: -1,
49231
+ maxBodyLength: -1,
49232
+ env: {
49233
+ FormData: platform3.classes.FormData,
49234
+ Blob: platform3.classes.Blob
49235
+ },
49236
+ validateStatus: function validateStatus2(status) {
49237
+ return status >= 200 && status < 300;
49238
+ },
49239
+ headers: {
49240
+ common: {
49241
+ "Accept": "application/json, text/plain, */*",
49242
+ "Content-Type": void 0
49243
+ }
49244
+ }
49245
+ };
49246
+ utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
49247
+ defaults3.headers[method] = {};
49248
+ });
49249
+ var defaults$1 = defaults3;
49250
+ var ignoreDuplicateOf2 = utils$1.toObjectSet([
49251
+ "age",
49252
+ "authorization",
49253
+ "content-length",
49254
+ "content-type",
49255
+ "etag",
49256
+ "expires",
49257
+ "from",
49258
+ "host",
49259
+ "if-modified-since",
49260
+ "if-unmodified-since",
49261
+ "last-modified",
49262
+ "location",
49263
+ "max-forwards",
49264
+ "proxy-authorization",
49265
+ "referer",
49266
+ "retry-after",
49267
+ "user-agent"
49268
+ ]);
49269
+ var parseHeaders = (rawHeaders) => {
49270
+ const parsed = {};
49271
+ let key;
49272
+ let val;
49273
+ let i;
49274
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
49275
+ i = line.indexOf(":");
49276
+ key = line.substring(0, i).trim().toLowerCase();
49277
+ val = line.substring(i + 1).trim();
49278
+ if (!key || parsed[key] && ignoreDuplicateOf2[key]) {
49279
+ return;
49280
+ }
49281
+ if (key === "set-cookie") {
49282
+ if (parsed[key]) {
49283
+ parsed[key].push(val);
49284
+ } else {
49285
+ parsed[key] = [val];
49286
+ }
49287
+ } else {
49288
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
49289
+ }
49290
+ });
49291
+ return parsed;
49292
+ };
49293
+ var $internals2 = Symbol("internals");
49294
+ function normalizeHeader2(header) {
49295
+ return header && String(header).trim().toLowerCase();
49296
+ }
49297
+ function normalizeValue2(value) {
49298
+ if (value === false || value == null) {
49299
+ return value;
49300
+ }
49301
+ return utils$1.isArray(value) ? value.map(normalizeValue2) : String(value);
49302
+ }
49303
+ function parseTokens2(str) {
49304
+ const tokens = /* @__PURE__ */ Object.create(null);
49305
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
49306
+ let match2;
49307
+ while (match2 = tokensRE.exec(str)) {
49308
+ tokens[match2[1]] = match2[2];
49309
+ }
49310
+ return tokens;
49311
+ }
49312
+ var isValidHeaderName2 = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
49313
+ function matchHeaderValue2(context, value, header, filter3, isHeaderNameFilter) {
49314
+ if (utils$1.isFunction(filter3)) {
49315
+ return filter3.call(this, value, header);
49316
+ }
49317
+ if (isHeaderNameFilter) {
49318
+ value = header;
49319
+ }
49320
+ if (!utils$1.isString(value)) return;
49321
+ if (utils$1.isString(filter3)) {
49322
+ return value.indexOf(filter3) !== -1;
49323
+ }
49324
+ if (utils$1.isRegExp(filter3)) {
49325
+ return filter3.test(value);
49326
+ }
49327
+ }
49328
+ function formatHeader2(header) {
49329
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
49330
+ return char.toUpperCase() + str;
49331
+ });
49332
+ }
49333
+ function buildAccessors2(obj, header) {
49334
+ const accessorName = utils$1.toCamelCase(" " + header);
49335
+ ["get", "set", "has"].forEach((methodName) => {
49336
+ Object.defineProperty(obj, methodName + accessorName, {
49337
+ value: function(arg1, arg2, arg3) {
49338
+ return this[methodName].call(this, header, arg1, arg2, arg3);
49339
+ },
49340
+ configurable: true
49341
+ });
49342
+ });
49343
+ }
49344
+ var AxiosHeaders3 = class {
49345
+ constructor(headers) {
49346
+ headers && this.set(headers);
49347
+ }
49348
+ set(header, valueOrRewrite, rewrite) {
49349
+ const self2 = this;
49350
+ function setHeader(_value, _header, _rewrite) {
49351
+ const lHeader = normalizeHeader2(_header);
49352
+ if (!lHeader) {
49353
+ throw new Error("header name must be a non-empty string");
49354
+ }
49355
+ const key = utils$1.findKey(self2, lHeader);
49356
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
49357
+ self2[key || _header] = normalizeValue2(_value);
49358
+ }
49359
+ }
49360
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
49361
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
49362
+ setHeaders(header, valueOrRewrite);
49363
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName2(header)) {
49364
+ setHeaders(parseHeaders(header), valueOrRewrite);
49365
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
49366
+ let obj = {}, dest, key;
49367
+ for (const entry of header) {
49368
+ if (!utils$1.isArray(entry)) {
49369
+ throw TypeError("Object iterator must return a key-value pair");
49370
+ }
49371
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
49372
+ }
49373
+ setHeaders(obj, valueOrRewrite);
49374
+ } else {
49375
+ header != null && setHeader(valueOrRewrite, header, rewrite);
49376
+ }
49377
+ return this;
49378
+ }
49379
+ get(header, parser) {
49380
+ header = normalizeHeader2(header);
49381
+ if (header) {
49382
+ const key = utils$1.findKey(this, header);
49383
+ if (key) {
49384
+ const value = this[key];
49385
+ if (!parser) {
49386
+ return value;
49387
+ }
49388
+ if (parser === true) {
49389
+ return parseTokens2(value);
49390
+ }
49391
+ if (utils$1.isFunction(parser)) {
49392
+ return parser.call(this, value, key);
49393
+ }
49394
+ if (utils$1.isRegExp(parser)) {
49395
+ return parser.exec(value);
49396
+ }
49397
+ throw new TypeError("parser must be boolean|regexp|function");
49398
+ }
49399
+ }
49400
+ }
49401
+ has(header, matcher) {
49402
+ header = normalizeHeader2(header);
49403
+ if (header) {
49404
+ const key = utils$1.findKey(this, header);
49405
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue2(this, this[key], key, matcher)));
49406
+ }
49407
+ return false;
49408
+ }
49409
+ delete(header, matcher) {
49410
+ const self2 = this;
49411
+ let deleted = false;
49412
+ function deleteHeader(_header) {
49413
+ _header = normalizeHeader2(_header);
49414
+ if (_header) {
49415
+ const key = utils$1.findKey(self2, _header);
49416
+ if (key && (!matcher || matchHeaderValue2(self2, self2[key], key, matcher))) {
49417
+ delete self2[key];
49418
+ deleted = true;
49419
+ }
49420
+ }
49421
+ }
49422
+ if (utils$1.isArray(header)) {
49423
+ header.forEach(deleteHeader);
49424
+ } else {
49425
+ deleteHeader(header);
49426
+ }
49427
+ return deleted;
49428
+ }
49429
+ clear(matcher) {
49430
+ const keys = Object.keys(this);
49431
+ let i = keys.length;
49432
+ let deleted = false;
49433
+ while (i--) {
49434
+ const key = keys[i];
49435
+ if (!matcher || matchHeaderValue2(this, this[key], key, matcher, true)) {
49436
+ delete this[key];
49437
+ deleted = true;
49438
+ }
49439
+ }
49440
+ return deleted;
49441
+ }
49442
+ normalize(format4) {
49443
+ const self2 = this;
49444
+ const headers = {};
49445
+ utils$1.forEach(this, (value, header) => {
49446
+ const key = utils$1.findKey(headers, header);
49447
+ if (key) {
49448
+ self2[key] = normalizeValue2(value);
49449
+ delete self2[header];
49450
+ return;
49451
+ }
49452
+ const normalized = format4 ? formatHeader2(header) : String(header).trim();
49453
+ if (normalized !== header) {
49454
+ delete self2[header];
49455
+ }
49456
+ self2[normalized] = normalizeValue2(value);
49457
+ headers[normalized] = true;
49458
+ });
49459
+ return this;
49460
+ }
49461
+ concat(...targets) {
49462
+ return this.constructor.concat(this, ...targets);
49463
+ }
49464
+ toJSON(asStrings) {
49465
+ const obj = /* @__PURE__ */ Object.create(null);
49466
+ utils$1.forEach(this, (value, header) => {
49467
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
49468
+ });
49469
+ return obj;
49470
+ }
49471
+ [Symbol.iterator]() {
49472
+ return Object.entries(this.toJSON())[Symbol.iterator]();
49473
+ }
49474
+ toString() {
49475
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
49476
+ }
49477
+ getSetCookie() {
49478
+ return this.get("set-cookie") || [];
49479
+ }
49480
+ get [Symbol.toStringTag]() {
49481
+ return "AxiosHeaders";
49482
+ }
49483
+ static from(thing) {
49484
+ return thing instanceof this ? thing : new this(thing);
49485
+ }
49486
+ static concat(first, ...targets) {
49487
+ const computed = new this(first);
49488
+ targets.forEach((target) => computed.set(target));
49489
+ return computed;
49490
+ }
49491
+ static accessor(header) {
49492
+ const internals = this[$internals2] = this[$internals2] = {
49493
+ accessors: {}
49494
+ };
49495
+ const accessors = internals.accessors;
49496
+ const prototype4 = this.prototype;
49497
+ function defineAccessor(_header) {
49498
+ const lHeader = normalizeHeader2(_header);
49499
+ if (!accessors[lHeader]) {
49500
+ buildAccessors2(prototype4, _header);
49501
+ accessors[lHeader] = true;
49502
+ }
49503
+ }
49504
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
49505
+ return this;
49506
+ }
49507
+ };
49508
+ AxiosHeaders3.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
49509
+ utils$1.reduceDescriptors(AxiosHeaders3.prototype, ({ value }, key) => {
49510
+ let mapped = key[0].toUpperCase() + key.slice(1);
49511
+ return {
49512
+ get: () => value,
49513
+ set(headerValue) {
49514
+ this[mapped] = headerValue;
49515
+ }
49516
+ };
49517
+ });
49518
+ utils$1.freezeMethods(AxiosHeaders3);
49519
+ var AxiosHeaders$1 = AxiosHeaders3;
49520
+ function transformData2(fns, response) {
49521
+ const config = this || defaults$1;
49522
+ const context = response || config;
49523
+ const headers = AxiosHeaders$1.from(context.headers);
49524
+ let data = context.data;
49525
+ utils$1.forEach(fns, function transform(fn) {
49526
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
49527
+ });
49528
+ headers.normalize();
49529
+ return data;
49530
+ }
49531
+ function isCancel3(value) {
49532
+ return !!(value && value.__CANCEL__);
49533
+ }
49534
+ function CanceledError3(message2, config, request) {
49535
+ AxiosError3.call(this, message2 == null ? "canceled" : message2, AxiosError3.ERR_CANCELED, config, request);
49536
+ this.name = "CanceledError";
49537
+ }
49538
+ utils$1.inherits(CanceledError3, AxiosError3, {
49539
+ __CANCEL__: true
49540
+ });
49541
+ function settle2(resolve2, reject, response) {
49542
+ const validateStatus2 = response.config.validateStatus;
49543
+ if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
49544
+ resolve2(response);
49545
+ } else {
49546
+ reject(new AxiosError3(
49547
+ "Request failed with status code " + response.status,
49548
+ [AxiosError3.ERR_BAD_REQUEST, AxiosError3.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
49549
+ response.config,
49550
+ response.request,
49551
+ response
49552
+ ));
49553
+ }
49554
+ }
49555
+ function isAbsoluteURL2(url3) {
49556
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url3);
49557
+ }
49558
+ function combineURLs2(baseURL, relativeURL) {
49559
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
49560
+ }
49561
+ function buildFullPath2(baseURL, requestedURL, allowAbsoluteUrls) {
49562
+ let isRelativeUrl = !isAbsoluteURL2(requestedURL);
49563
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
49564
+ return combineURLs2(baseURL, requestedURL);
49565
+ }
49566
+ return requestedURL;
49567
+ }
49568
+ var VERSION3 = "1.13.2";
49569
+ function parseProtocol2(url3) {
49570
+ const match2 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url3);
49571
+ return match2 && match2[1] || "";
49572
+ }
49573
+ var DATA_URL_PATTERN2 = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
49574
+ function fromDataURI2(uri, asBlob, options) {
49575
+ const _Blob = options && options.Blob || platform3.classes.Blob;
49576
+ const protocol = parseProtocol2(uri);
49577
+ if (asBlob === void 0 && _Blob) {
49578
+ asBlob = true;
49579
+ }
49580
+ if (protocol === "data") {
49581
+ uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
49582
+ const match2 = DATA_URL_PATTERN2.exec(uri);
49583
+ if (!match2) {
49584
+ throw new AxiosError3("Invalid URL", AxiosError3.ERR_INVALID_URL);
49585
+ }
49586
+ const mime = match2[1];
49587
+ const isBase64 = match2[2];
49588
+ const body = match2[3];
49589
+ const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? "base64" : "utf8");
49590
+ if (asBlob) {
49591
+ if (!_Blob) {
49592
+ throw new AxiosError3("Blob is not supported", AxiosError3.ERR_NOT_SUPPORT);
49593
+ }
49594
+ return new _Blob([buffer], { type: mime });
49595
+ }
49596
+ return buffer;
49597
+ }
49598
+ throw new AxiosError3("Unsupported protocol " + protocol, AxiosError3.ERR_NOT_SUPPORT);
49599
+ }
49600
+ var kInternals2 = Symbol("internals");
49601
+ var AxiosTransformStream2 = class extends stream__default["default"].Transform {
49602
+ constructor(options) {
49603
+ options = utils$1.toFlatObject(options, {
49604
+ maxRate: 0,
49605
+ chunkSize: 64 * 1024,
49606
+ minChunkSize: 100,
49607
+ timeWindow: 500,
49608
+ ticksRate: 2,
49609
+ samplesCount: 15
49610
+ }, null, (prop, source) => {
49611
+ return !utils$1.isUndefined(source[prop]);
49612
+ });
49613
+ super({
49614
+ readableHighWaterMark: options.chunkSize
49615
+ });
49616
+ const internals = this[kInternals2] = {
49617
+ timeWindow: options.timeWindow,
49618
+ chunkSize: options.chunkSize,
49619
+ maxRate: options.maxRate,
49620
+ minChunkSize: options.minChunkSize,
49621
+ bytesSeen: 0,
49622
+ isCaptured: false,
49623
+ notifiedBytesLoaded: 0,
49624
+ ts: Date.now(),
49625
+ bytes: 0,
49626
+ onReadCallback: null
49627
+ };
49628
+ this.on("newListener", (event) => {
49629
+ if (event === "progress") {
49630
+ if (!internals.isCaptured) {
49631
+ internals.isCaptured = true;
49632
+ }
49633
+ }
49634
+ });
49635
+ }
49636
+ _read(size) {
49637
+ const internals = this[kInternals2];
49638
+ if (internals.onReadCallback) {
49639
+ internals.onReadCallback();
49640
+ }
49641
+ return super._read(size);
49642
+ }
49643
+ _transform(chunk, encoding, callback) {
49644
+ const internals = this[kInternals2];
49645
+ const maxRate = internals.maxRate;
49646
+ const readableHighWaterMark = this.readableHighWaterMark;
49647
+ const timeWindow = internals.timeWindow;
49648
+ const divider = 1e3 / timeWindow;
49649
+ const bytesThreshold = maxRate / divider;
49650
+ const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
49651
+ const pushChunk = (_chunk, _callback) => {
49652
+ const bytes = Buffer.byteLength(_chunk);
49653
+ internals.bytesSeen += bytes;
49654
+ internals.bytes += bytes;
49655
+ internals.isCaptured && this.emit("progress", internals.bytesSeen);
49656
+ if (this.push(_chunk)) {
49657
+ process.nextTick(_callback);
49658
+ } else {
49659
+ internals.onReadCallback = () => {
49660
+ internals.onReadCallback = null;
49661
+ process.nextTick(_callback);
49662
+ };
49663
+ }
49664
+ };
49665
+ const transformChunk = (_chunk, _callback) => {
49666
+ const chunkSize = Buffer.byteLength(_chunk);
49667
+ let chunkRemainder = null;
49668
+ let maxChunkSize = readableHighWaterMark;
49669
+ let bytesLeft;
49670
+ let passed = 0;
49671
+ if (maxRate) {
49672
+ const now = Date.now();
49673
+ if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
49674
+ internals.ts = now;
49675
+ bytesLeft = bytesThreshold - internals.bytes;
49676
+ internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
49677
+ passed = 0;
49678
+ }
49679
+ bytesLeft = bytesThreshold - internals.bytes;
49680
+ }
49681
+ if (maxRate) {
49682
+ if (bytesLeft <= 0) {
49683
+ return setTimeout(() => {
49684
+ _callback(null, _chunk);
49685
+ }, timeWindow - passed);
49686
+ }
49687
+ if (bytesLeft < maxChunkSize) {
49688
+ maxChunkSize = bytesLeft;
49689
+ }
49690
+ }
49691
+ if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
49692
+ chunkRemainder = _chunk.subarray(maxChunkSize);
49693
+ _chunk = _chunk.subarray(0, maxChunkSize);
49694
+ }
49695
+ pushChunk(_chunk, chunkRemainder ? () => {
49696
+ process.nextTick(_callback, null, chunkRemainder);
49697
+ } : _callback);
49698
+ };
49699
+ transformChunk(chunk, function transformNextChunk(err, _chunk) {
49700
+ if (err) {
49701
+ return callback(err);
49702
+ }
49703
+ if (_chunk) {
49704
+ transformChunk(_chunk, transformNextChunk);
49705
+ } else {
49706
+ callback(null);
49707
+ }
49708
+ });
49709
+ }
49710
+ };
49711
+ var AxiosTransformStream$1 = AxiosTransformStream2;
49712
+ var { asyncIterator: asyncIterator2 } = Symbol;
49713
+ var readBlob2 = async function* (blob) {
49714
+ if (blob.stream) {
49715
+ yield* blob.stream();
49716
+ } else if (blob.arrayBuffer) {
49717
+ yield await blob.arrayBuffer();
49718
+ } else if (blob[asyncIterator2]) {
49719
+ yield* blob[asyncIterator2]();
49720
+ } else {
49721
+ yield blob;
49722
+ }
49723
+ };
49724
+ var readBlob$1 = readBlob2;
49725
+ var BOUNDARY_ALPHABET2 = platform3.ALPHABET.ALPHA_DIGIT + "-_";
49726
+ var textEncoder2 = typeof TextEncoder === "function" ? new TextEncoder() : new util__default["default"].TextEncoder();
49727
+ var CRLF2 = "\r\n";
49728
+ var CRLF_BYTES2 = textEncoder2.encode(CRLF2);
49729
+ var CRLF_BYTES_COUNT2 = 2;
49730
+ var FormDataPart2 = class {
49731
+ constructor(name, value) {
49732
+ const { escapeName } = this.constructor;
49733
+ const isStringValue = utils$1.isString(value);
49734
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF2}`;
49735
+ if (isStringValue) {
49736
+ value = textEncoder2.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF2));
49737
+ } else {
49738
+ headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF2}`;
49739
+ }
49740
+ this.headers = textEncoder2.encode(headers + CRLF2);
49741
+ this.contentLength = isStringValue ? value.byteLength : value.size;
49742
+ this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT2;
49743
+ this.name = name;
49744
+ this.value = value;
49745
+ }
49746
+ async *encode() {
49747
+ yield this.headers;
49748
+ const { value } = this;
49749
+ if (utils$1.isTypedArray(value)) {
49750
+ yield value;
49751
+ } else {
49752
+ yield* readBlob$1(value);
49753
+ }
49754
+ yield CRLF_BYTES2;
49755
+ }
49756
+ static escapeName(name) {
49757
+ return String(name).replace(/[\r\n"]/g, (match2) => ({
49758
+ "\r": "%0D",
49759
+ "\n": "%0A",
49760
+ '"': "%22"
49761
+ })[match2]);
49762
+ }
49763
+ };
49764
+ var formDataToStream2 = (form, headersHandler, options) => {
49765
+ const {
49766
+ tag = "form-data-boundary",
49767
+ size = 25,
49768
+ boundary = tag + "-" + platform3.generateString(size, BOUNDARY_ALPHABET2)
49769
+ } = options || {};
49770
+ if (!utils$1.isFormData(form)) {
49771
+ throw TypeError("FormData instance required");
49772
+ }
49773
+ if (boundary.length < 1 || boundary.length > 70) {
49774
+ throw Error("boundary must be 10-70 characters long");
49775
+ }
49776
+ const boundaryBytes = textEncoder2.encode("--" + boundary + CRLF2);
49777
+ const footerBytes = textEncoder2.encode("--" + boundary + "--" + CRLF2);
49778
+ let contentLength = footerBytes.byteLength;
49779
+ const parts = Array.from(form.entries()).map(([name, value]) => {
49780
+ const part = new FormDataPart2(name, value);
49781
+ contentLength += part.size;
49782
+ return part;
49783
+ });
49784
+ contentLength += boundaryBytes.byteLength * parts.length;
49785
+ contentLength = utils$1.toFiniteNumber(contentLength);
49786
+ const computedHeaders = {
49787
+ "Content-Type": `multipart/form-data; boundary=${boundary}`
49788
+ };
49789
+ if (Number.isFinite(contentLength)) {
49790
+ computedHeaders["Content-Length"] = contentLength;
49791
+ }
49792
+ headersHandler && headersHandler(computedHeaders);
49793
+ return stream4.Readable.from((async function* () {
49794
+ for (const part of parts) {
49795
+ yield boundaryBytes;
49796
+ yield* part.encode();
49797
+ }
49798
+ yield footerBytes;
49799
+ })());
49800
+ };
49801
+ var formDataToStream$1 = formDataToStream2;
49802
+ var ZlibHeaderTransformStream2 = class extends stream__default["default"].Transform {
49803
+ __transform(chunk, encoding, callback) {
49804
+ this.push(chunk);
49805
+ callback();
49806
+ }
49807
+ _transform(chunk, encoding, callback) {
49808
+ if (chunk.length !== 0) {
49809
+ this._transform = this.__transform;
49810
+ if (chunk[0] !== 120) {
49811
+ const header = Buffer.alloc(2);
49812
+ header[0] = 120;
49813
+ header[1] = 156;
49814
+ this.push(header, encoding);
49815
+ }
49816
+ }
49817
+ this.__transform(chunk, encoding, callback);
49818
+ }
49819
+ };
49820
+ var ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream2;
49821
+ var callbackify2 = (fn, reducer) => {
49822
+ return utils$1.isAsyncFn(fn) ? function(...args) {
49823
+ const cb = args.pop();
49824
+ fn.apply(this, args).then((value) => {
49825
+ try {
49826
+ reducer ? cb(null, ...reducer(value)) : cb(null, value);
49827
+ } catch (err) {
49828
+ cb(err);
49829
+ }
49830
+ }, cb);
49831
+ } : fn;
49832
+ };
49833
+ var callbackify$1 = callbackify2;
49834
+ function speedometer2(samplesCount, min) {
49835
+ samplesCount = samplesCount || 10;
49836
+ const bytes = new Array(samplesCount);
49837
+ const timestamps = new Array(samplesCount);
49838
+ let head = 0;
49839
+ let tail = 0;
49840
+ let firstSampleTS;
49841
+ min = min !== void 0 ? min : 1e3;
49842
+ return function push(chunkLength) {
49843
+ const now = Date.now();
49844
+ const startedAt = timestamps[tail];
49845
+ if (!firstSampleTS) {
49846
+ firstSampleTS = now;
49847
+ }
49848
+ bytes[head] = chunkLength;
49849
+ timestamps[head] = now;
49850
+ let i = tail;
49851
+ let bytesCount = 0;
49852
+ while (i !== head) {
49853
+ bytesCount += bytes[i++];
49854
+ i = i % samplesCount;
49855
+ }
49856
+ head = (head + 1) % samplesCount;
49857
+ if (head === tail) {
49858
+ tail = (tail + 1) % samplesCount;
49859
+ }
49860
+ if (now - firstSampleTS < min) {
49861
+ return;
49862
+ }
49863
+ const passed = startedAt && now - startedAt;
49864
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
49865
+ };
49866
+ }
49867
+ function throttle2(fn, freq) {
49868
+ let timestamp = 0;
49869
+ let threshold = 1e3 / freq;
49870
+ let lastArgs;
49871
+ let timer;
49872
+ const invoke = (args, now = Date.now()) => {
49873
+ timestamp = now;
49874
+ lastArgs = null;
49875
+ if (timer) {
49876
+ clearTimeout(timer);
49877
+ timer = null;
49878
+ }
49879
+ fn(...args);
49880
+ };
49881
+ const throttled = (...args) => {
49882
+ const now = Date.now();
49883
+ const passed = now - timestamp;
49884
+ if (passed >= threshold) {
49885
+ invoke(args, now);
49886
+ } else {
49887
+ lastArgs = args;
49888
+ if (!timer) {
49889
+ timer = setTimeout(() => {
49890
+ timer = null;
49891
+ invoke(lastArgs);
49892
+ }, threshold - passed);
49893
+ }
49894
+ }
49895
+ };
49896
+ const flush = () => lastArgs && invoke(lastArgs);
49897
+ return [throttled, flush];
49898
+ }
49899
+ var progressEventReducer2 = (listener, isDownloadStream, freq = 3) => {
49900
+ let bytesNotified = 0;
49901
+ const _speedometer = speedometer2(50, 250);
49902
+ return throttle2((e) => {
49903
+ const loaded = e.loaded;
49904
+ const total = e.lengthComputable ? e.total : void 0;
49905
+ const progressBytes = loaded - bytesNotified;
49906
+ const rate = _speedometer(progressBytes);
49907
+ const inRange = loaded <= total;
49908
+ bytesNotified = loaded;
49909
+ const data = {
49910
+ loaded,
49911
+ total,
49912
+ progress: total ? loaded / total : void 0,
49913
+ bytes: progressBytes,
49914
+ rate: rate ? rate : void 0,
49915
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
49916
+ event: e,
49917
+ lengthComputable: total != null,
49918
+ [isDownloadStream ? "download" : "upload"]: true
49919
+ };
49920
+ listener(data);
49921
+ }, freq);
49922
+ };
49923
+ var progressEventDecorator2 = (total, throttled) => {
49924
+ const lengthComputable = total != null;
49925
+ return [(loaded) => throttled[0]({
49926
+ lengthComputable,
49927
+ total,
49928
+ loaded
49929
+ }), throttled[1]];
49930
+ };
49931
+ var asyncDecorator2 = (fn) => (...args) => utils$1.asap(() => fn(...args));
49932
+ function estimateDataURLDecodedBytes2(url3) {
49933
+ if (!url3 || typeof url3 !== "string") return 0;
49934
+ if (!url3.startsWith("data:")) return 0;
49935
+ const comma = url3.indexOf(",");
49936
+ if (comma < 0) return 0;
49937
+ const meta = url3.slice(5, comma);
49938
+ const body = url3.slice(comma + 1);
49939
+ const isBase64 = /;base64/i.test(meta);
49940
+ if (isBase64) {
49941
+ let effectiveLen = body.length;
49942
+ const len = body.length;
49943
+ for (let i = 0; i < len; i++) {
49944
+ if (body.charCodeAt(i) === 37 && i + 2 < len) {
49945
+ const a = body.charCodeAt(i + 1);
49946
+ const b = body.charCodeAt(i + 2);
49947
+ const isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
49948
+ if (isHex) {
49949
+ effectiveLen -= 2;
49950
+ i += 2;
49951
+ }
49952
+ }
49953
+ }
49954
+ let pad = 0;
49955
+ let idx = len - 1;
49956
+ const tailIsPct3D = (j) => j >= 2 && body.charCodeAt(j - 2) === 37 && // '%'
49957
+ body.charCodeAt(j - 1) === 51 && // '3'
49958
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
49959
+ if (idx >= 0) {
49960
+ if (body.charCodeAt(idx) === 61) {
49961
+ pad++;
49962
+ idx--;
49963
+ } else if (tailIsPct3D(idx)) {
49964
+ pad++;
49965
+ idx -= 3;
49966
+ }
49967
+ }
49968
+ if (pad === 1 && idx >= 0) {
49969
+ if (body.charCodeAt(idx) === 61) {
49970
+ pad++;
49971
+ } else if (tailIsPct3D(idx)) {
49972
+ pad++;
49973
+ }
49974
+ }
49975
+ const groups = Math.floor(effectiveLen / 4);
49976
+ const bytes = groups * 3 - (pad || 0);
49977
+ return bytes > 0 ? bytes : 0;
49978
+ }
49979
+ return Buffer.byteLength(body, "utf8");
49980
+ }
49981
+ var zlibOptions2 = {
49982
+ flush: zlib__default["default"].constants.Z_SYNC_FLUSH,
49983
+ finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH
49984
+ };
49985
+ var brotliOptions2 = {
49986
+ flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH,
49987
+ finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
49988
+ };
49989
+ var isBrotliSupported2 = utils$1.isFunction(zlib__default["default"].createBrotliDecompress);
49990
+ var { http: httpFollow2, https: httpsFollow2 } = followRedirects__default["default"];
49991
+ var isHttps2 = /https:?/;
49992
+ var supportedProtocols2 = platform3.protocols.map((protocol) => {
49993
+ return protocol + ":";
49994
+ });
49995
+ var flushOnFinish2 = (stream5, [throttled, flush]) => {
49996
+ stream5.on("end", flush).on("error", flush);
49997
+ return throttled;
49998
+ };
49999
+ var Http2Sessions2 = class {
50000
+ constructor() {
50001
+ this.sessions = /* @__PURE__ */ Object.create(null);
50002
+ }
50003
+ getSession(authority, options) {
50004
+ options = Object.assign({
50005
+ sessionTimeout: 1e3
50006
+ }, options);
50007
+ let authoritySessions = this.sessions[authority];
50008
+ if (authoritySessions) {
50009
+ let len = authoritySessions.length;
50010
+ for (let i = 0; i < len; i++) {
50011
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
50012
+ if (!sessionHandle.destroyed && !sessionHandle.closed && util__default["default"].isDeepStrictEqual(sessionOptions, options)) {
50013
+ return sessionHandle;
50014
+ }
50015
+ }
50016
+ }
50017
+ const session = http2__default["default"].connect(authority, options);
50018
+ let removed;
50019
+ const removeSession = () => {
50020
+ if (removed) {
50021
+ return;
50022
+ }
50023
+ removed = true;
50024
+ let entries = authoritySessions, len = entries.length, i = len;
50025
+ while (i--) {
50026
+ if (entries[i][0] === session) {
50027
+ if (len === 1) {
50028
+ delete this.sessions[authority];
50029
+ } else {
50030
+ entries.splice(i, 1);
50031
+ }
50032
+ return;
50033
+ }
50034
+ }
50035
+ };
50036
+ const originalRequestFn = session.request;
50037
+ const { sessionTimeout } = options;
50038
+ if (sessionTimeout != null) {
50039
+ let timer;
50040
+ let streamsCount = 0;
50041
+ session.request = function() {
50042
+ const stream5 = originalRequestFn.apply(this, arguments);
50043
+ streamsCount++;
50044
+ if (timer) {
50045
+ clearTimeout(timer);
50046
+ timer = null;
50047
+ }
50048
+ stream5.once("close", () => {
50049
+ if (!--streamsCount) {
50050
+ timer = setTimeout(() => {
50051
+ timer = null;
50052
+ removeSession();
50053
+ }, sessionTimeout);
50054
+ }
50055
+ });
50056
+ return stream5;
50057
+ };
50058
+ }
50059
+ session.once("close", removeSession);
50060
+ let entry = [
50061
+ session,
50062
+ options
50063
+ ];
50064
+ authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
50065
+ return session;
50066
+ }
50067
+ };
50068
+ var http2Sessions2 = new Http2Sessions2();
50069
+ function dispatchBeforeRedirect2(options, responseDetails) {
50070
+ if (options.beforeRedirects.proxy) {
50071
+ options.beforeRedirects.proxy(options);
50072
+ }
50073
+ if (options.beforeRedirects.config) {
50074
+ options.beforeRedirects.config(options, responseDetails);
50075
+ }
50076
+ }
50077
+ function setProxy2(options, configProxy, location2) {
50078
+ let proxy2 = configProxy;
50079
+ if (!proxy2 && proxy2 !== false) {
50080
+ const proxyUrl = proxyFromEnv__default["default"].getProxyForUrl(location2);
50081
+ if (proxyUrl) {
50082
+ proxy2 = new URL(proxyUrl);
50083
+ }
50084
+ }
50085
+ if (proxy2) {
50086
+ if (proxy2.username) {
50087
+ proxy2.auth = (proxy2.username || "") + ":" + (proxy2.password || "");
50088
+ }
50089
+ if (proxy2.auth) {
50090
+ if (proxy2.auth.username || proxy2.auth.password) {
50091
+ proxy2.auth = (proxy2.auth.username || "") + ":" + (proxy2.auth.password || "");
50092
+ }
50093
+ const base64 = Buffer.from(proxy2.auth, "utf8").toString("base64");
50094
+ options.headers["Proxy-Authorization"] = "Basic " + base64;
50095
+ }
50096
+ options.headers.host = options.hostname + (options.port ? ":" + options.port : "");
50097
+ const proxyHost = proxy2.hostname || proxy2.host;
50098
+ options.hostname = proxyHost;
50099
+ options.host = proxyHost;
50100
+ options.port = proxy2.port;
50101
+ options.path = location2;
50102
+ if (proxy2.protocol) {
50103
+ options.protocol = proxy2.protocol.includes(":") ? proxy2.protocol : `${proxy2.protocol}:`;
50104
+ }
50105
+ }
50106
+ options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
50107
+ setProxy2(redirectOptions, configProxy, redirectOptions.href);
50108
+ };
50109
+ }
50110
+ var isHttpAdapterSupported2 = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
50111
+ var wrapAsync2 = (asyncExecutor) => {
50112
+ return new Promise((resolve2, reject) => {
50113
+ let onDone;
50114
+ let isDone;
50115
+ const done = (value, isRejected) => {
50116
+ if (isDone) return;
50117
+ isDone = true;
50118
+ onDone && onDone(value, isRejected);
50119
+ };
50120
+ const _resolve = (value) => {
50121
+ done(value);
50122
+ resolve2(value);
50123
+ };
50124
+ const _reject = (reason) => {
50125
+ done(reason, true);
50126
+ reject(reason);
50127
+ };
50128
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => onDone = onDoneHandler).catch(_reject);
50129
+ });
50130
+ };
50131
+ var resolveFamily2 = ({ address, family }) => {
50132
+ if (!utils$1.isString(address)) {
50133
+ throw TypeError("address must be a string");
50134
+ }
50135
+ return {
50136
+ address,
50137
+ family: family || (address.indexOf(".") < 0 ? 6 : 4)
50138
+ };
50139
+ };
50140
+ var buildAddressEntry2 = (address, family) => resolveFamily2(utils$1.isObject(address) ? address : { address, family });
50141
+ var http2Transport2 = {
50142
+ request(options, cb) {
50143
+ const authority = options.protocol + "//" + options.hostname + ":" + (options.port || 80);
50144
+ const { http2Options, headers } = options;
50145
+ const session = http2Sessions2.getSession(authority, http2Options);
50146
+ const {
50147
+ HTTP2_HEADER_SCHEME,
50148
+ HTTP2_HEADER_METHOD,
50149
+ HTTP2_HEADER_PATH,
50150
+ HTTP2_HEADER_STATUS
50151
+ } = http2__default["default"].constants;
50152
+ const http2Headers = {
50153
+ [HTTP2_HEADER_SCHEME]: options.protocol.replace(":", ""),
50154
+ [HTTP2_HEADER_METHOD]: options.method,
50155
+ [HTTP2_HEADER_PATH]: options.path
50156
+ };
50157
+ utils$1.forEach(headers, (header, name) => {
50158
+ name.charAt(0) !== ":" && (http2Headers[name] = header);
50159
+ });
50160
+ const req = session.request(http2Headers);
50161
+ req.once("response", (responseHeaders) => {
50162
+ const response = req;
50163
+ responseHeaders = Object.assign({}, responseHeaders);
50164
+ const status = responseHeaders[HTTP2_HEADER_STATUS];
50165
+ delete responseHeaders[HTTP2_HEADER_STATUS];
50166
+ response.headers = responseHeaders;
50167
+ response.statusCode = +status;
50168
+ cb(response);
50169
+ });
50170
+ return req;
50171
+ }
50172
+ };
50173
+ var httpAdapter2 = isHttpAdapterSupported2 && function httpAdapter3(config) {
50174
+ return wrapAsync2(async function dispatchHttpRequest(resolve2, reject, onDone) {
50175
+ let { data, lookup, family, httpVersion = 1, http2Options } = config;
50176
+ const { responseType, responseEncoding } = config;
50177
+ const method = config.method.toUpperCase();
50178
+ let isDone;
50179
+ let rejected = false;
50180
+ let req;
50181
+ httpVersion = +httpVersion;
50182
+ if (Number.isNaN(httpVersion)) {
50183
+ throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
50184
+ }
50185
+ if (httpVersion !== 1 && httpVersion !== 2) {
50186
+ throw TypeError(`Unsupported protocol version '${httpVersion}'`);
50187
+ }
50188
+ const isHttp2 = httpVersion === 2;
50189
+ if (lookup) {
50190
+ const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]);
50191
+ lookup = (hostname, opt, cb) => {
50192
+ _lookup(hostname, opt, (err, arg0, arg1) => {
50193
+ if (err) {
50194
+ return cb(err);
50195
+ }
50196
+ const addresses = utils$1.isArray(arg0) ? arg0.map((addr) => buildAddressEntry2(addr)) : [buildAddressEntry2(arg0, arg1)];
50197
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
50198
+ });
50199
+ };
50200
+ }
50201
+ const abortEmitter = new events.EventEmitter();
50202
+ function abort(reason) {
50203
+ try {
50204
+ abortEmitter.emit("abort", !reason || reason.type ? new CanceledError3(null, config, req) : reason);
50205
+ } catch (err) {
50206
+ console.warn("emit error", err);
50207
+ }
50208
+ }
50209
+ abortEmitter.once("abort", reject);
50210
+ const onFinished = () => {
50211
+ if (config.cancelToken) {
50212
+ config.cancelToken.unsubscribe(abort);
50213
+ }
50214
+ if (config.signal) {
50215
+ config.signal.removeEventListener("abort", abort);
50216
+ }
50217
+ abortEmitter.removeAllListeners();
50218
+ };
50219
+ if (config.cancelToken || config.signal) {
50220
+ config.cancelToken && config.cancelToken.subscribe(abort);
50221
+ if (config.signal) {
50222
+ config.signal.aborted ? abort() : config.signal.addEventListener("abort", abort);
50223
+ }
50224
+ }
50225
+ onDone((response, isRejected) => {
50226
+ isDone = true;
50227
+ if (isRejected) {
50228
+ rejected = true;
50229
+ onFinished();
50230
+ return;
50231
+ }
50232
+ const { data: data2 } = response;
50233
+ if (data2 instanceof stream__default["default"].Readable || data2 instanceof stream__default["default"].Duplex) {
50234
+ const offListeners = stream__default["default"].finished(data2, () => {
50235
+ offListeners();
50236
+ onFinished();
50237
+ });
50238
+ } else {
50239
+ onFinished();
50240
+ }
50241
+ });
50242
+ const fullPath = buildFullPath2(config.baseURL, config.url, config.allowAbsoluteUrls);
50243
+ const parsed = new URL(fullPath, platform3.hasBrowserEnv ? platform3.origin : void 0);
50244
+ const protocol = parsed.protocol || supportedProtocols2[0];
50245
+ if (protocol === "data:") {
50246
+ if (config.maxContentLength > -1) {
50247
+ const dataUrl = String(config.url || fullPath || "");
50248
+ const estimated = estimateDataURLDecodedBytes2(dataUrl);
50249
+ if (estimated > config.maxContentLength) {
50250
+ return reject(new AxiosError3(
50251
+ "maxContentLength size of " + config.maxContentLength + " exceeded",
50252
+ AxiosError3.ERR_BAD_RESPONSE,
50253
+ config
50254
+ ));
50255
+ }
50256
+ }
50257
+ let convertedData;
50258
+ if (method !== "GET") {
50259
+ return settle2(resolve2, reject, {
50260
+ status: 405,
50261
+ statusText: "method not allowed",
50262
+ headers: {},
50263
+ config
50264
+ });
50265
+ }
50266
+ try {
50267
+ convertedData = fromDataURI2(config.url, responseType === "blob", {
50268
+ Blob: config.env && config.env.Blob
50269
+ });
50270
+ } catch (err) {
50271
+ throw AxiosError3.from(err, AxiosError3.ERR_BAD_REQUEST, config);
50272
+ }
50273
+ if (responseType === "text") {
50274
+ convertedData = convertedData.toString(responseEncoding);
50275
+ if (!responseEncoding || responseEncoding === "utf8") {
50276
+ convertedData = utils$1.stripBOM(convertedData);
50277
+ }
50278
+ } else if (responseType === "stream") {
50279
+ convertedData = stream__default["default"].Readable.from(convertedData);
50280
+ }
50281
+ return settle2(resolve2, reject, {
50282
+ data: convertedData,
50283
+ status: 200,
50284
+ statusText: "OK",
50285
+ headers: new AxiosHeaders$1(),
50286
+ config
50287
+ });
50288
+ }
50289
+ if (supportedProtocols2.indexOf(protocol) === -1) {
50290
+ return reject(new AxiosError3(
50291
+ "Unsupported protocol " + protocol,
50292
+ AxiosError3.ERR_BAD_REQUEST,
50293
+ config
50294
+ ));
50295
+ }
50296
+ const headers = AxiosHeaders$1.from(config.headers).normalize();
50297
+ headers.set("User-Agent", "axios/" + VERSION3, false);
50298
+ const { onUploadProgress, onDownloadProgress } = config;
50299
+ const maxRate = config.maxRate;
50300
+ let maxUploadRate = void 0;
50301
+ let maxDownloadRate = void 0;
50302
+ if (utils$1.isSpecCompliantForm(data)) {
50303
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
50304
+ data = formDataToStream$1(data, (formHeaders) => {
50305
+ headers.set(formHeaders);
50306
+ }, {
50307
+ tag: `axios-${VERSION3}-boundary`,
50308
+ boundary: userBoundary && userBoundary[1] || void 0
50309
+ });
50310
+ } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
50311
+ headers.set(data.getHeaders());
50312
+ if (!headers.hasContentLength()) {
50313
+ try {
50314
+ const knownLength = await util__default["default"].promisify(data.getLength).call(data);
50315
+ Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
50316
+ } catch (e) {
50317
+ }
50318
+ }
50319
+ } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
50320
+ data.size && headers.setContentType(data.type || "application/octet-stream");
50321
+ headers.setContentLength(data.size || 0);
50322
+ data = stream__default["default"].Readable.from(readBlob$1(data));
50323
+ } else if (data && !utils$1.isStream(data)) {
50324
+ if (Buffer.isBuffer(data)) ;
50325
+ else if (utils$1.isArrayBuffer(data)) {
50326
+ data = Buffer.from(new Uint8Array(data));
50327
+ } else if (utils$1.isString(data)) {
50328
+ data = Buffer.from(data, "utf-8");
50329
+ } else {
50330
+ return reject(new AxiosError3(
50331
+ "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",
50332
+ AxiosError3.ERR_BAD_REQUEST,
50333
+ config
50334
+ ));
50335
+ }
50336
+ headers.setContentLength(data.length, false);
50337
+ if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
50338
+ return reject(new AxiosError3(
50339
+ "Request body larger than maxBodyLength limit",
50340
+ AxiosError3.ERR_BAD_REQUEST,
50341
+ config
50342
+ ));
50343
+ }
50344
+ }
50345
+ const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
50346
+ if (utils$1.isArray(maxRate)) {
50347
+ maxUploadRate = maxRate[0];
50348
+ maxDownloadRate = maxRate[1];
50349
+ } else {
50350
+ maxUploadRate = maxDownloadRate = maxRate;
50351
+ }
50352
+ if (data && (onUploadProgress || maxUploadRate)) {
50353
+ if (!utils$1.isStream(data)) {
50354
+ data = stream__default["default"].Readable.from(data, { objectMode: false });
50355
+ }
50356
+ data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
50357
+ maxRate: utils$1.toFiniteNumber(maxUploadRate)
50358
+ })], utils$1.noop);
50359
+ onUploadProgress && data.on("progress", flushOnFinish2(
50360
+ data,
50361
+ progressEventDecorator2(
50362
+ contentLength,
50363
+ progressEventReducer2(asyncDecorator2(onUploadProgress), false, 3)
50364
+ )
50365
+ ));
50366
+ }
50367
+ let auth = void 0;
50368
+ if (config.auth) {
50369
+ const username = config.auth.username || "";
50370
+ const password = config.auth.password || "";
50371
+ auth = username + ":" + password;
50372
+ }
50373
+ if (!auth && parsed.username) {
50374
+ const urlUsername = parsed.username;
50375
+ const urlPassword = parsed.password;
50376
+ auth = urlUsername + ":" + urlPassword;
50377
+ }
50378
+ auth && headers.delete("authorization");
50379
+ let path7;
50380
+ try {
50381
+ path7 = buildURL2(
50382
+ parsed.pathname + parsed.search,
50383
+ config.params,
50384
+ config.paramsSerializer
50385
+ ).replace(/^\?/, "");
50386
+ } catch (err) {
50387
+ const customErr = new Error(err.message);
50388
+ customErr.config = config;
50389
+ customErr.url = config.url;
50390
+ customErr.exists = true;
50391
+ return reject(customErr);
50392
+ }
50393
+ headers.set(
50394
+ "Accept-Encoding",
50395
+ "gzip, compress, deflate" + (isBrotliSupported2 ? ", br" : ""),
50396
+ false
50397
+ );
50398
+ const options = {
50399
+ path: path7,
50400
+ method,
50401
+ headers: headers.toJSON(),
50402
+ agents: { http: config.httpAgent, https: config.httpsAgent },
50403
+ auth,
50404
+ protocol,
50405
+ family,
50406
+ beforeRedirect: dispatchBeforeRedirect2,
50407
+ beforeRedirects: {},
50408
+ http2Options
50409
+ };
50410
+ !utils$1.isUndefined(lookup) && (options.lookup = lookup);
50411
+ if (config.socketPath) {
50412
+ options.socketPath = config.socketPath;
50413
+ } else {
50414
+ options.hostname = parsed.hostname.startsWith("[") ? parsed.hostname.slice(1, -1) : parsed.hostname;
50415
+ options.port = parsed.port;
50416
+ setProxy2(options, config.proxy, protocol + "//" + parsed.hostname + (parsed.port ? ":" + parsed.port : "") + options.path);
50417
+ }
50418
+ let transport;
50419
+ const isHttpsRequest = isHttps2.test(options.protocol);
50420
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
50421
+ if (isHttp2) {
50422
+ transport = http2Transport2;
50423
+ } else {
50424
+ if (config.transport) {
50425
+ transport = config.transport;
50426
+ } else if (config.maxRedirects === 0) {
50427
+ transport = isHttpsRequest ? https__default["default"] : http__default["default"];
50428
+ } else {
50429
+ if (config.maxRedirects) {
50430
+ options.maxRedirects = config.maxRedirects;
50431
+ }
50432
+ if (config.beforeRedirect) {
50433
+ options.beforeRedirects.config = config.beforeRedirect;
50434
+ }
50435
+ transport = isHttpsRequest ? httpsFollow2 : httpFollow2;
50436
+ }
50437
+ }
50438
+ if (config.maxBodyLength > -1) {
50439
+ options.maxBodyLength = config.maxBodyLength;
50440
+ } else {
50441
+ options.maxBodyLength = Infinity;
50442
+ }
50443
+ if (config.insecureHTTPParser) {
50444
+ options.insecureHTTPParser = config.insecureHTTPParser;
50445
+ }
50446
+ req = transport.request(options, function handleResponse(res) {
50447
+ if (req.destroyed) return;
50448
+ const streams = [res];
50449
+ const responseLength = utils$1.toFiniteNumber(res.headers["content-length"]);
50450
+ if (onDownloadProgress || maxDownloadRate) {
50451
+ const transformStream = new AxiosTransformStream$1({
50452
+ maxRate: utils$1.toFiniteNumber(maxDownloadRate)
50453
+ });
50454
+ onDownloadProgress && transformStream.on("progress", flushOnFinish2(
50455
+ transformStream,
50456
+ progressEventDecorator2(
50457
+ responseLength,
50458
+ progressEventReducer2(asyncDecorator2(onDownloadProgress), true, 3)
50459
+ )
50460
+ ));
50461
+ streams.push(transformStream);
50462
+ }
50463
+ let responseStream = res;
50464
+ const lastRequest = res.req || req;
50465
+ if (config.decompress !== false && res.headers["content-encoding"]) {
50466
+ if (method === "HEAD" || res.statusCode === 204) {
50467
+ delete res.headers["content-encoding"];
50468
+ }
50469
+ switch ((res.headers["content-encoding"] || "").toLowerCase()) {
50470
+ /*eslint default-case:0*/
50471
+ case "gzip":
50472
+ case "x-gzip":
50473
+ case "compress":
50474
+ case "x-compress":
50475
+ streams.push(zlib__default["default"].createUnzip(zlibOptions2));
50476
+ delete res.headers["content-encoding"];
50477
+ break;
50478
+ case "deflate":
50479
+ streams.push(new ZlibHeaderTransformStream$1());
50480
+ streams.push(zlib__default["default"].createUnzip(zlibOptions2));
50481
+ delete res.headers["content-encoding"];
50482
+ break;
50483
+ case "br":
50484
+ if (isBrotliSupported2) {
50485
+ streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions2));
50486
+ delete res.headers["content-encoding"];
50487
+ }
50488
+ }
50489
+ }
50490
+ responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0];
50491
+ const response = {
50492
+ status: res.statusCode,
50493
+ statusText: res.statusMessage,
50494
+ headers: new AxiosHeaders$1(res.headers),
50495
+ config,
50496
+ request: lastRequest
50497
+ };
50498
+ if (responseType === "stream") {
50499
+ response.data = responseStream;
50500
+ settle2(resolve2, reject, response);
50501
+ } else {
50502
+ const responseBuffer = [];
50503
+ let totalResponseBytes = 0;
50504
+ responseStream.on("data", function handleStreamData(chunk) {
50505
+ responseBuffer.push(chunk);
50506
+ totalResponseBytes += chunk.length;
50507
+ if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
50508
+ rejected = true;
50509
+ responseStream.destroy();
50510
+ abort(new AxiosError3(
50511
+ "maxContentLength size of " + config.maxContentLength + " exceeded",
50512
+ AxiosError3.ERR_BAD_RESPONSE,
50513
+ config,
50514
+ lastRequest
50515
+ ));
50516
+ }
50517
+ });
50518
+ responseStream.on("aborted", function handlerStreamAborted() {
50519
+ if (rejected) {
50520
+ return;
50521
+ }
50522
+ const err = new AxiosError3(
50523
+ "stream has been aborted",
50524
+ AxiosError3.ERR_BAD_RESPONSE,
50525
+ config,
50526
+ lastRequest
50527
+ );
50528
+ responseStream.destroy(err);
50529
+ reject(err);
50530
+ });
50531
+ responseStream.on("error", function handleStreamError(err) {
50532
+ if (req.destroyed) return;
50533
+ reject(AxiosError3.from(err, null, config, lastRequest));
50534
+ });
50535
+ responseStream.on("end", function handleStreamEnd() {
50536
+ try {
50537
+ let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
50538
+ if (responseType !== "arraybuffer") {
50539
+ responseData = responseData.toString(responseEncoding);
50540
+ if (!responseEncoding || responseEncoding === "utf8") {
50541
+ responseData = utils$1.stripBOM(responseData);
50542
+ }
50543
+ }
50544
+ response.data = responseData;
50545
+ } catch (err) {
50546
+ return reject(AxiosError3.from(err, null, config, response.request, response));
50547
+ }
50548
+ settle2(resolve2, reject, response);
50549
+ });
50550
+ }
50551
+ abortEmitter.once("abort", (err) => {
50552
+ if (!responseStream.destroyed) {
50553
+ responseStream.emit("error", err);
50554
+ responseStream.destroy();
50555
+ }
50556
+ });
50557
+ });
50558
+ abortEmitter.once("abort", (err) => {
50559
+ if (req.close) {
50560
+ req.close();
50561
+ } else {
50562
+ req.destroy(err);
50563
+ }
50564
+ });
50565
+ req.on("error", function handleRequestError(err) {
50566
+ reject(AxiosError3.from(err, null, config, req));
50567
+ });
50568
+ req.on("socket", function handleRequestSocket(socket) {
50569
+ socket.setKeepAlive(true, 1e3 * 60);
50570
+ });
50571
+ if (config.timeout) {
50572
+ const timeout = parseInt(config.timeout, 10);
50573
+ if (Number.isNaN(timeout)) {
50574
+ abort(new AxiosError3(
50575
+ "error trying to parse `config.timeout` to int",
50576
+ AxiosError3.ERR_BAD_OPTION_VALUE,
50577
+ config,
50578
+ req
50579
+ ));
50580
+ return;
50581
+ }
50582
+ req.setTimeout(timeout, function handleRequestTimeout() {
50583
+ if (isDone) return;
50584
+ let timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded";
50585
+ const transitional2 = config.transitional || transitionalDefaults;
50586
+ if (config.timeoutErrorMessage) {
50587
+ timeoutErrorMessage = config.timeoutErrorMessage;
50588
+ }
50589
+ abort(new AxiosError3(
50590
+ timeoutErrorMessage,
50591
+ transitional2.clarifyTimeoutError ? AxiosError3.ETIMEDOUT : AxiosError3.ECONNABORTED,
50592
+ config,
50593
+ req
50594
+ ));
50595
+ });
50596
+ } else {
50597
+ req.setTimeout(0);
50598
+ }
50599
+ if (utils$1.isStream(data)) {
50600
+ let ended = false;
50601
+ let errored = false;
50602
+ data.on("end", () => {
50603
+ ended = true;
50604
+ });
50605
+ data.once("error", (err) => {
50606
+ errored = true;
50607
+ req.destroy(err);
50608
+ });
50609
+ data.on("close", () => {
50610
+ if (!ended && !errored) {
50611
+ abort(new CanceledError3("Request stream has been aborted", config, req));
50612
+ }
50613
+ });
50614
+ data.pipe(req);
50615
+ } else {
50616
+ data && req.write(data);
50617
+ req.end();
50618
+ }
50619
+ });
50620
+ };
50621
+ var isURLSameOrigin = platform3.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin3, isMSIE) => (url3) => {
50622
+ url3 = new URL(url3, platform3.origin);
50623
+ return origin3.protocol === url3.protocol && origin3.host === url3.host && (isMSIE || origin3.port === url3.port);
50624
+ })(
50625
+ new URL(platform3.origin),
50626
+ platform3.navigator && /(msie|trident)/i.test(platform3.navigator.userAgent)
50627
+ ) : () => true;
50628
+ var cookies = platform3.hasStandardBrowserEnv ? (
50629
+ // Standard browser envs support document.cookie
50630
+ {
50631
+ write(name, value, expires, path7, domain, secure, sameSite) {
50632
+ if (typeof document === "undefined") return;
50633
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
50634
+ if (utils$1.isNumber(expires)) {
50635
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
50636
+ }
50637
+ if (utils$1.isString(path7)) {
50638
+ cookie.push(`path=${path7}`);
50639
+ }
50640
+ if (utils$1.isString(domain)) {
50641
+ cookie.push(`domain=${domain}`);
50642
+ }
50643
+ if (secure === true) {
50644
+ cookie.push("secure");
50645
+ }
50646
+ if (utils$1.isString(sameSite)) {
50647
+ cookie.push(`SameSite=${sameSite}`);
50648
+ }
50649
+ document.cookie = cookie.join("; ");
50650
+ },
50651
+ read(name) {
50652
+ if (typeof document === "undefined") return null;
50653
+ const match2 = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
50654
+ return match2 ? decodeURIComponent(match2[1]) : null;
50655
+ },
50656
+ remove(name) {
50657
+ this.write(name, "", Date.now() - 864e5, "/");
50658
+ }
50659
+ }
50660
+ ) : (
50661
+ // Non-standard browser env (web workers, react-native) lack needed support.
50662
+ {
50663
+ write() {
50664
+ },
50665
+ read() {
50666
+ return null;
50667
+ },
50668
+ remove() {
50669
+ }
50670
+ }
50671
+ );
50672
+ var headersToObject2 = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
50673
+ function mergeConfig3(config1, config2) {
50674
+ config2 = config2 || {};
50675
+ const config = {};
50676
+ function getMergedValue(target, source, prop, caseless) {
50677
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
50678
+ return utils$1.merge.call({ caseless }, target, source);
50679
+ } else if (utils$1.isPlainObject(source)) {
50680
+ return utils$1.merge({}, source);
50681
+ } else if (utils$1.isArray(source)) {
50682
+ return source.slice();
50683
+ }
50684
+ return source;
50685
+ }
50686
+ function mergeDeepProperties(a, b, prop, caseless) {
50687
+ if (!utils$1.isUndefined(b)) {
50688
+ return getMergedValue(a, b, prop, caseless);
50689
+ } else if (!utils$1.isUndefined(a)) {
50690
+ return getMergedValue(void 0, a, prop, caseless);
50691
+ }
50692
+ }
50693
+ function valueFromConfig2(a, b) {
50694
+ if (!utils$1.isUndefined(b)) {
50695
+ return getMergedValue(void 0, b);
50696
+ }
50697
+ }
50698
+ function defaultToConfig2(a, b) {
50699
+ if (!utils$1.isUndefined(b)) {
50700
+ return getMergedValue(void 0, b);
50701
+ } else if (!utils$1.isUndefined(a)) {
50702
+ return getMergedValue(void 0, a);
50703
+ }
50704
+ }
50705
+ function mergeDirectKeys(a, b, prop) {
50706
+ if (prop in config2) {
50707
+ return getMergedValue(a, b);
50708
+ } else if (prop in config1) {
50709
+ return getMergedValue(void 0, a);
50710
+ }
50711
+ }
50712
+ const mergeMap = {
50713
+ url: valueFromConfig2,
50714
+ method: valueFromConfig2,
50715
+ data: valueFromConfig2,
50716
+ baseURL: defaultToConfig2,
50717
+ transformRequest: defaultToConfig2,
50718
+ transformResponse: defaultToConfig2,
50719
+ paramsSerializer: defaultToConfig2,
50720
+ timeout: defaultToConfig2,
50721
+ timeoutMessage: defaultToConfig2,
50722
+ withCredentials: defaultToConfig2,
50723
+ withXSRFToken: defaultToConfig2,
50724
+ adapter: defaultToConfig2,
50725
+ responseType: defaultToConfig2,
50726
+ xsrfCookieName: defaultToConfig2,
50727
+ xsrfHeaderName: defaultToConfig2,
50728
+ onUploadProgress: defaultToConfig2,
50729
+ onDownloadProgress: defaultToConfig2,
50730
+ decompress: defaultToConfig2,
50731
+ maxContentLength: defaultToConfig2,
50732
+ maxBodyLength: defaultToConfig2,
50733
+ beforeRedirect: defaultToConfig2,
50734
+ transport: defaultToConfig2,
50735
+ httpAgent: defaultToConfig2,
50736
+ httpsAgent: defaultToConfig2,
50737
+ cancelToken: defaultToConfig2,
50738
+ socketPath: defaultToConfig2,
50739
+ responseEncoding: defaultToConfig2,
50740
+ validateStatus: mergeDirectKeys,
50741
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject2(a), headersToObject2(b), prop, true)
50742
+ };
50743
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
50744
+ const merge4 = mergeMap[prop] || mergeDeepProperties;
50745
+ const configValue = merge4(config1[prop], config2[prop], prop);
50746
+ utils$1.isUndefined(configValue) && merge4 !== mergeDirectKeys || (config[prop] = configValue);
50747
+ });
50748
+ return config;
50749
+ }
50750
+ var resolveConfig = (config) => {
50751
+ const newConfig = mergeConfig3({}, config);
50752
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
50753
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
50754
+ newConfig.url = buildURL2(buildFullPath2(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
50755
+ if (auth) {
50756
+ headers.set(
50757
+ "Authorization",
50758
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
50759
+ );
50760
+ }
50761
+ if (utils$1.isFormData(data)) {
50762
+ if (platform3.hasStandardBrowserEnv || platform3.hasStandardBrowserWebWorkerEnv) {
50763
+ headers.setContentType(void 0);
50764
+ } else if (utils$1.isFunction(data.getHeaders)) {
50765
+ const formHeaders = data.getHeaders();
50766
+ const allowedHeaders = ["content-type", "content-length"];
50767
+ Object.entries(formHeaders).forEach(([key, val]) => {
50768
+ if (allowedHeaders.includes(key.toLowerCase())) {
50769
+ headers.set(key, val);
50770
+ }
50771
+ });
50772
+ }
50773
+ }
50774
+ if (platform3.hasStandardBrowserEnv) {
50775
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
50776
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
50777
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
50778
+ if (xsrfValue) {
50779
+ headers.set(xsrfHeaderName, xsrfValue);
50780
+ }
50781
+ }
50782
+ }
50783
+ return newConfig;
50784
+ };
50785
+ var isXHRAdapterSupported2 = typeof XMLHttpRequest !== "undefined";
50786
+ var xhrAdapter = isXHRAdapterSupported2 && function(config) {
50787
+ return new Promise(function dispatchXhrRequest(resolve2, reject) {
50788
+ const _config = resolveConfig(config);
50789
+ let requestData = _config.data;
50790
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
50791
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
50792
+ let onCanceled;
50793
+ let uploadThrottled, downloadThrottled;
50794
+ let flushUpload, flushDownload;
50795
+ function done() {
50796
+ flushUpload && flushUpload();
50797
+ flushDownload && flushDownload();
50798
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
50799
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
50800
+ }
50801
+ let request = new XMLHttpRequest();
50802
+ request.open(_config.method.toUpperCase(), _config.url, true);
50803
+ request.timeout = _config.timeout;
50804
+ function onloadend() {
50805
+ if (!request) {
50806
+ return;
50807
+ }
50808
+ const responseHeaders = AxiosHeaders$1.from(
50809
+ "getAllResponseHeaders" in request && request.getAllResponseHeaders()
50810
+ );
50811
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
50812
+ const response = {
50813
+ data: responseData,
50814
+ status: request.status,
50815
+ statusText: request.statusText,
50816
+ headers: responseHeaders,
50817
+ config,
50818
+ request
50819
+ };
50820
+ settle2(function _resolve(value) {
50821
+ resolve2(value);
50822
+ done();
50823
+ }, function _reject(err) {
50824
+ reject(err);
50825
+ done();
50826
+ }, response);
50827
+ request = null;
50828
+ }
50829
+ if ("onloadend" in request) {
50830
+ request.onloadend = onloadend;
50831
+ } else {
50832
+ request.onreadystatechange = function handleLoad() {
50833
+ if (!request || request.readyState !== 4) {
50834
+ return;
50835
+ }
50836
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
50837
+ return;
50838
+ }
50839
+ setTimeout(onloadend);
50840
+ };
50841
+ }
50842
+ request.onabort = function handleAbort() {
50843
+ if (!request) {
50844
+ return;
50845
+ }
50846
+ reject(new AxiosError3("Request aborted", AxiosError3.ECONNABORTED, config, request));
50847
+ request = null;
50848
+ };
50849
+ request.onerror = function handleError(event) {
50850
+ const msg = event && event.message ? event.message : "Network Error";
50851
+ const err = new AxiosError3(msg, AxiosError3.ERR_NETWORK, config, request);
50852
+ err.event = event || null;
50853
+ reject(err);
50854
+ request = null;
50855
+ };
50856
+ request.ontimeout = function handleTimeout() {
50857
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
50858
+ const transitional2 = _config.transitional || transitionalDefaults;
50859
+ if (_config.timeoutErrorMessage) {
50860
+ timeoutErrorMessage = _config.timeoutErrorMessage;
50861
+ }
50862
+ reject(new AxiosError3(
50863
+ timeoutErrorMessage,
50864
+ transitional2.clarifyTimeoutError ? AxiosError3.ETIMEDOUT : AxiosError3.ECONNABORTED,
50865
+ config,
50866
+ request
50867
+ ));
50868
+ request = null;
50869
+ };
50870
+ requestData === void 0 && requestHeaders.setContentType(null);
50871
+ if ("setRequestHeader" in request) {
50872
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
50873
+ request.setRequestHeader(key, val);
50874
+ });
50875
+ }
50876
+ if (!utils$1.isUndefined(_config.withCredentials)) {
50877
+ request.withCredentials = !!_config.withCredentials;
50878
+ }
50879
+ if (responseType && responseType !== "json") {
50880
+ request.responseType = _config.responseType;
50881
+ }
50882
+ if (onDownloadProgress) {
50883
+ [downloadThrottled, flushDownload] = progressEventReducer2(onDownloadProgress, true);
50884
+ request.addEventListener("progress", downloadThrottled);
50885
+ }
50886
+ if (onUploadProgress && request.upload) {
50887
+ [uploadThrottled, flushUpload] = progressEventReducer2(onUploadProgress);
50888
+ request.upload.addEventListener("progress", uploadThrottled);
50889
+ request.upload.addEventListener("loadend", flushUpload);
50890
+ }
50891
+ if (_config.cancelToken || _config.signal) {
50892
+ onCanceled = (cancel) => {
50893
+ if (!request) {
50894
+ return;
50895
+ }
50896
+ reject(!cancel || cancel.type ? new CanceledError3(null, config, request) : cancel);
50897
+ request.abort();
50898
+ request = null;
50899
+ };
50900
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
50901
+ if (_config.signal) {
50902
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
50903
+ }
50904
+ }
50905
+ const protocol = parseProtocol2(_config.url);
50906
+ if (protocol && platform3.protocols.indexOf(protocol) === -1) {
50907
+ reject(new AxiosError3("Unsupported protocol " + protocol + ":", AxiosError3.ERR_BAD_REQUEST, config));
50908
+ return;
50909
+ }
50910
+ request.send(requestData || null);
50911
+ });
50912
+ };
50913
+ var composeSignals2 = (signals3, timeout) => {
50914
+ const { length } = signals3 = signals3 ? signals3.filter(Boolean) : [];
50915
+ if (timeout || length) {
50916
+ let controller = new AbortController();
50917
+ let aborted;
50918
+ const onabort = function(reason) {
50919
+ if (!aborted) {
50920
+ aborted = true;
50921
+ unsubscribe();
50922
+ const err = reason instanceof Error ? reason : this.reason;
50923
+ controller.abort(err instanceof AxiosError3 ? err : new CanceledError3(err instanceof Error ? err.message : err));
50924
+ }
50925
+ };
50926
+ let timer = timeout && setTimeout(() => {
50927
+ timer = null;
50928
+ onabort(new AxiosError3(`timeout ${timeout} of ms exceeded`, AxiosError3.ETIMEDOUT));
50929
+ }, timeout);
50930
+ const unsubscribe = () => {
50931
+ if (signals3) {
50932
+ timer && clearTimeout(timer);
50933
+ timer = null;
50934
+ signals3.forEach((signal2) => {
50935
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
50936
+ });
50937
+ signals3 = null;
50938
+ }
50939
+ };
50940
+ signals3.forEach((signal2) => signal2.addEventListener("abort", onabort));
50941
+ const { signal } = controller;
50942
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
50943
+ return signal;
50944
+ }
50945
+ };
50946
+ var composeSignals$1 = composeSignals2;
50947
+ var streamChunk2 = function* (chunk, chunkSize) {
50948
+ let len = chunk.byteLength;
50949
+ if (!chunkSize || len < chunkSize) {
50950
+ yield chunk;
50951
+ return;
50952
+ }
50953
+ let pos = 0;
50954
+ let end;
50955
+ while (pos < len) {
50956
+ end = pos + chunkSize;
50957
+ yield chunk.slice(pos, end);
50958
+ pos = end;
50959
+ }
50960
+ };
50961
+ var readBytes2 = async function* (iterable, chunkSize) {
50962
+ for await (const chunk of readStream2(iterable)) {
50963
+ yield* streamChunk2(chunk, chunkSize);
50964
+ }
50965
+ };
50966
+ var readStream2 = async function* (stream5) {
50967
+ if (stream5[Symbol.asyncIterator]) {
50968
+ yield* stream5;
50969
+ return;
50970
+ }
50971
+ const reader = stream5.getReader();
50972
+ try {
50973
+ for (; ; ) {
50974
+ const { done, value } = await reader.read();
50975
+ if (done) {
50976
+ break;
50977
+ }
50978
+ yield value;
50979
+ }
50980
+ } finally {
50981
+ await reader.cancel();
50982
+ }
50983
+ };
50984
+ var trackStream2 = (stream5, chunkSize, onProgress, onFinish) => {
50985
+ const iterator3 = readBytes2(stream5, chunkSize);
50986
+ let bytes = 0;
50987
+ let done;
50988
+ let _onFinish = (e) => {
50989
+ if (!done) {
50990
+ done = true;
50991
+ onFinish && onFinish(e);
50992
+ }
50993
+ };
50994
+ return new ReadableStream({
50995
+ async pull(controller) {
48114
50996
  try {
48115
- const orgRepos = await (0, child_process_utils_1.execAndWait)(`gh repo list ${org} --limit 1000 --json nameWithOwner --jq ".[].nameWithOwner"`, directory);
48116
- return orgRepos.stdout.trim().split("\n").filter((repo) => repo.length > 0);
48117
- } catch {
48118
- return [];
50997
+ const { done: done2, value } = await iterator3.next();
50998
+ if (done2) {
50999
+ _onFinish();
51000
+ controller.close();
51001
+ return;
51002
+ }
51003
+ let len = value.byteLength;
51004
+ if (onProgress) {
51005
+ let loadedBytes = bytes += len;
51006
+ onProgress(loadedBytes);
51007
+ }
51008
+ controller.enqueue(new Uint8Array(value));
51009
+ } catch (err) {
51010
+ _onFinish(err);
51011
+ throw err;
51012
+ }
51013
+ },
51014
+ cancel(reason) {
51015
+ _onFinish(reason);
51016
+ return iterator3.return();
51017
+ }
51018
+ }, {
51019
+ highWaterMark: 2
51020
+ });
51021
+ };
51022
+ var DEFAULT_CHUNK_SIZE2 = 64 * 1024;
51023
+ var { isFunction: isFunction4 } = utils$1;
51024
+ var globalFetchAPI2 = (({ Request, Response }) => ({
51025
+ Request,
51026
+ Response
51027
+ }))(utils$1.global);
51028
+ var {
51029
+ ReadableStream: ReadableStream$1,
51030
+ TextEncoder: TextEncoder$1
51031
+ } = utils$1.global;
51032
+ var test2 = (fn, ...args) => {
51033
+ try {
51034
+ return !!fn(...args);
51035
+ } catch (e) {
51036
+ return false;
51037
+ }
51038
+ };
51039
+ var factory2 = (env2) => {
51040
+ env2 = utils$1.merge.call({
51041
+ skipUndefined: true
51042
+ }, globalFetchAPI2, env2);
51043
+ const { fetch: envFetch, Request, Response } = env2;
51044
+ const isFetchSupported = envFetch ? isFunction4(envFetch) : typeof fetch === "function";
51045
+ const isRequestSupported = isFunction4(Request);
51046
+ const isResponseSupported = isFunction4(Response);
51047
+ if (!isFetchSupported) {
51048
+ return false;
51049
+ }
51050
+ const isReadableStreamSupported = isFetchSupported && isFunction4(ReadableStream$1);
51051
+ const encodeText = isFetchSupported && (typeof TextEncoder$1 === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder$1()) : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
51052
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test2(() => {
51053
+ let duplexAccessed = false;
51054
+ const hasContentType = new Request(platform3.origin, {
51055
+ body: new ReadableStream$1(),
51056
+ method: "POST",
51057
+ get duplex() {
51058
+ duplexAccessed = true;
51059
+ return "half";
48119
51060
  }
51061
+ }).headers.has("Content-Type");
51062
+ return duplexAccessed && !hasContentType;
51063
+ });
51064
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test2(() => utils$1.isReadableStream(new Response("").body));
51065
+ const resolvers = {
51066
+ stream: supportsResponseStream && ((res) => res.body)
51067
+ };
51068
+ isFetchSupported && (() => {
51069
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
51070
+ !resolvers[type] && (resolvers[type] = (res, config) => {
51071
+ let method = res && res[type];
51072
+ if (method) {
51073
+ return method.call(res);
51074
+ }
51075
+ throw new AxiosError3(`Response type '${type}' is not supported`, AxiosError3.ERR_NOT_SUPPORT, config);
51076
+ });
48120
51077
  });
48121
- const orgRepoResults = await Promise.all(orgRepoPromises);
48122
- orgRepoResults.flat().forEach((repo) => allRepos.add(repo));
48123
- return allRepos;
48124
- } catch {
48125
- return /* @__PURE__ */ new Set();
51078
+ })();
51079
+ const getBodyLength = async (body) => {
51080
+ if (body == null) {
51081
+ return 0;
51082
+ }
51083
+ if (utils$1.isBlob(body)) {
51084
+ return body.size;
51085
+ }
51086
+ if (utils$1.isSpecCompliantForm(body)) {
51087
+ const _request = new Request(platform3.origin, {
51088
+ method: "POST",
51089
+ body
51090
+ });
51091
+ return (await _request.arrayBuffer()).byteLength;
51092
+ }
51093
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
51094
+ return body.byteLength;
51095
+ }
51096
+ if (utils$1.isURLSearchParams(body)) {
51097
+ body = body + "";
51098
+ }
51099
+ if (utils$1.isString(body)) {
51100
+ return (await encodeText(body)).byteLength;
51101
+ }
51102
+ };
51103
+ const resolveBodyLength = async (headers, body) => {
51104
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
51105
+ return length == null ? getBodyLength(body) : length;
51106
+ };
51107
+ return async (config) => {
51108
+ let {
51109
+ url: url3,
51110
+ method,
51111
+ data,
51112
+ signal,
51113
+ cancelToken,
51114
+ timeout,
51115
+ onDownloadProgress,
51116
+ onUploadProgress,
51117
+ responseType,
51118
+ headers,
51119
+ withCredentials = "same-origin",
51120
+ fetchOptions
51121
+ } = resolveConfig(config);
51122
+ let _fetch = envFetch || fetch;
51123
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
51124
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
51125
+ let request = null;
51126
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
51127
+ composedSignal.unsubscribe();
51128
+ });
51129
+ let requestContentLength;
51130
+ try {
51131
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
51132
+ let _request = new Request(url3, {
51133
+ method: "POST",
51134
+ body: data,
51135
+ duplex: "half"
51136
+ });
51137
+ let contentTypeHeader;
51138
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
51139
+ headers.setContentType(contentTypeHeader);
51140
+ }
51141
+ if (_request.body) {
51142
+ const [onProgress, flush] = progressEventDecorator2(
51143
+ requestContentLength,
51144
+ progressEventReducer2(asyncDecorator2(onUploadProgress))
51145
+ );
51146
+ data = trackStream2(_request.body, DEFAULT_CHUNK_SIZE2, onProgress, flush);
51147
+ }
51148
+ }
51149
+ if (!utils$1.isString(withCredentials)) {
51150
+ withCredentials = withCredentials ? "include" : "omit";
51151
+ }
51152
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
51153
+ const resolvedOptions = {
51154
+ ...fetchOptions,
51155
+ signal: composedSignal,
51156
+ method: method.toUpperCase(),
51157
+ headers: headers.normalize().toJSON(),
51158
+ body: data,
51159
+ duplex: "half",
51160
+ credentials: isCredentialsSupported ? withCredentials : void 0
51161
+ };
51162
+ request = isRequestSupported && new Request(url3, resolvedOptions);
51163
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url3, resolvedOptions));
51164
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
51165
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
51166
+ const options = {};
51167
+ ["status", "statusText", "headers"].forEach((prop) => {
51168
+ options[prop] = response[prop];
51169
+ });
51170
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
51171
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator2(
51172
+ responseContentLength,
51173
+ progressEventReducer2(asyncDecorator2(onDownloadProgress), true)
51174
+ ) || [];
51175
+ response = new Response(
51176
+ trackStream2(response.body, DEFAULT_CHUNK_SIZE2, onProgress, () => {
51177
+ flush && flush();
51178
+ unsubscribe && unsubscribe();
51179
+ }),
51180
+ options
51181
+ );
51182
+ }
51183
+ responseType = responseType || "text";
51184
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
51185
+ !isStreamResponse && unsubscribe && unsubscribe();
51186
+ return await new Promise((resolve2, reject) => {
51187
+ settle2(resolve2, reject, {
51188
+ data: responseData,
51189
+ headers: AxiosHeaders$1.from(response.headers),
51190
+ status: response.status,
51191
+ statusText: response.statusText,
51192
+ config,
51193
+ request
51194
+ });
51195
+ });
51196
+ } catch (err) {
51197
+ unsubscribe && unsubscribe();
51198
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
51199
+ throw Object.assign(
51200
+ new AxiosError3("Network Error", AxiosError3.ERR_NETWORK, config, request),
51201
+ {
51202
+ cause: err.cause || err
51203
+ }
51204
+ );
51205
+ }
51206
+ throw AxiosError3.from(err, err && err.code, config, request);
51207
+ }
51208
+ };
51209
+ };
51210
+ var seedCache2 = /* @__PURE__ */ new Map();
51211
+ var getFetch2 = (config) => {
51212
+ let env2 = config && config.env || {};
51213
+ const { fetch: fetch2, Request, Response } = env2;
51214
+ const seeds = [
51215
+ Request,
51216
+ Response,
51217
+ fetch2
51218
+ ];
51219
+ let len = seeds.length, i = len, seed, target, map = seedCache2;
51220
+ while (i--) {
51221
+ seed = seeds[i];
51222
+ target = map.get(seed);
51223
+ target === void 0 && map.set(seed, target = i ? /* @__PURE__ */ new Map() : factory2(env2));
51224
+ map = target;
48126
51225
  }
48127
- }
48128
- async function initializeGitRepo(directory, options) {
48129
- if (options.commit?.name) {
48130
- process.env.GIT_AUTHOR_NAME = options.commit.name;
48131
- process.env.GIT_COMMITTER_NAME = options.commit.name;
51226
+ return target;
51227
+ };
51228
+ getFetch2();
51229
+ var knownAdapters2 = {
51230
+ http: httpAdapter2,
51231
+ xhr: xhrAdapter,
51232
+ fetch: {
51233
+ get: getFetch2
48132
51234
  }
48133
- if (options.commit?.email) {
48134
- process.env.GIT_AUTHOR_EMAIL = options.commit.email;
48135
- process.env.GIT_COMMITTER_EMAIL = options.commit.email;
51235
+ };
51236
+ utils$1.forEach(knownAdapters2, (fn, value) => {
51237
+ if (fn) {
51238
+ try {
51239
+ Object.defineProperty(fn, "name", { value });
51240
+ } catch (e) {
51241
+ }
51242
+ Object.defineProperty(fn, "adapterName", { value });
48136
51243
  }
48137
- const gitVersion = await checkGitVersion();
48138
- if (!gitVersion) {
48139
- return;
51244
+ });
51245
+ var renderReason2 = (reason) => `- ${reason}`;
51246
+ var isResolvedHandle2 = (adapter2) => utils$1.isFunction(adapter2) || adapter2 === null || adapter2 === false;
51247
+ function getAdapter3(adapters2, config) {
51248
+ adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
51249
+ const { length } = adapters2;
51250
+ let nameOrAdapter;
51251
+ let adapter2;
51252
+ const rejectedReasons = {};
51253
+ for (let i = 0; i < length; i++) {
51254
+ nameOrAdapter = adapters2[i];
51255
+ let id;
51256
+ adapter2 = nameOrAdapter;
51257
+ if (!isResolvedHandle2(nameOrAdapter)) {
51258
+ adapter2 = knownAdapters2[(id = String(nameOrAdapter)).toLowerCase()];
51259
+ if (adapter2 === void 0) {
51260
+ throw new AxiosError3(`Unknown adapter '${id}'`);
51261
+ }
51262
+ }
51263
+ if (adapter2 && (utils$1.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
51264
+ break;
51265
+ }
51266
+ rejectedReasons[id || "#" + i] = adapter2;
48140
51267
  }
48141
- const insideRepo = await (0, child_process_utils_1.execAndWait)("git rev-parse --is-inside-work-tree", directory, true).then(() => true, () => false);
48142
- if (insideRepo) {
48143
- output_1.output.log({
48144
- title: "Directory is already under version control. Skipping initialization of git."
48145
- });
48146
- return;
51268
+ if (!adapter2) {
51269
+ const reasons = Object.entries(rejectedReasons).map(
51270
+ ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
51271
+ );
51272
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason2).join("\n") : " " + renderReason2(reasons[0]) : "as no adapter specified";
51273
+ throw new AxiosError3(
51274
+ `There is no suitable adapter to dispatch the request ` + s,
51275
+ "ERR_NOT_SUPPORT"
51276
+ );
48147
51277
  }
48148
- const defaultBase = options.defaultBase || (0, default_base_1.deduceDefaultBase)();
48149
- const [gitMajor, gitMinor] = gitVersion.split(".");
48150
- if (+gitMajor > 2 || +gitMajor === 2 && +gitMinor >= 28) {
48151
- await (0, child_process_utils_1.execAndWait)(`git init -b ${defaultBase}`, directory);
48152
- } else {
48153
- await (0, child_process_utils_1.execAndWait)("git init", directory);
48154
- await (0, child_process_utils_1.execAndWait)(`git checkout -b ${defaultBase}`, directory);
51278
+ return adapter2;
51279
+ }
51280
+ var adapters = {
51281
+ /**
51282
+ * Resolve an adapter from a list of adapter names or functions.
51283
+ * @type {Function}
51284
+ */
51285
+ getAdapter: getAdapter3,
51286
+ /**
51287
+ * Exposes all known adapters
51288
+ * @type {Object<string, Function|Object>}
51289
+ */
51290
+ adapters: knownAdapters2
51291
+ };
51292
+ function throwIfCancellationRequested2(config) {
51293
+ if (config.cancelToken) {
51294
+ config.cancelToken.throwIfRequested();
48155
51295
  }
48156
- await (0, child_process_utils_1.execAndWait)("git add .", directory);
48157
- if (options.commit) {
48158
- let message2 = `${options.commit.message}` || "initial commit";
48159
- if (options.connectUrl) {
48160
- message2 = `${message2}
48161
-
48162
- To connect your workspace to Nx Cloud, push your repository
48163
- to your git hosting provider and go to the following URL:
48164
-
48165
- ${options.connectUrl}
48166
- `;
48167
- }
48168
- await (0, child_process_utils_1.execAndWait)(`git commit -m "${message2}"`, directory);
51296
+ if (config.signal && config.signal.aborted) {
51297
+ throw new CanceledError3(null, config);
48169
51298
  }
48170
51299
  }
48171
- async function pushToGitHub(directory, options) {
48172
- try {
48173
- if (process.env["NX_SKIP_GH_PUSH"] === "true") {
48174
- throw new GitHubPushSkippedError("NX_SKIP_GH_PUSH is true so skipping GitHub push.");
51300
+ function dispatchRequest2(config) {
51301
+ throwIfCancellationRequested2(config);
51302
+ config.headers = AxiosHeaders$1.from(config.headers);
51303
+ config.data = transformData2.call(
51304
+ config,
51305
+ config.transformRequest
51306
+ );
51307
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
51308
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
51309
+ }
51310
+ const adapter2 = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
51311
+ return adapter2(config).then(function onAdapterResolution(response) {
51312
+ throwIfCancellationRequested2(config);
51313
+ response.data = transformData2.call(
51314
+ config,
51315
+ config.transformResponse,
51316
+ response
51317
+ );
51318
+ response.headers = AxiosHeaders$1.from(response.headers);
51319
+ return response;
51320
+ }, function onAdapterRejection(reason) {
51321
+ if (!isCancel3(reason)) {
51322
+ throwIfCancellationRequested2(config);
51323
+ if (reason && reason.response) {
51324
+ reason.response.data = transformData2.call(
51325
+ config,
51326
+ config.transformResponse,
51327
+ reason.response
51328
+ );
51329
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
51330
+ }
48175
51331
  }
48176
- const username = await getGitHubUsername(directory);
48177
- const { push } = await enquirer.prompt([
48178
- {
48179
- name: "push",
48180
- message: "Would you like to push this workspace to Github?",
48181
- type: "autocomplete",
48182
- choices: [{ name: "Yes" }, { name: "No" }],
48183
- initial: 0
51332
+ return Promise.reject(reason);
51333
+ });
51334
+ }
51335
+ var validators$1 = {};
51336
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
51337
+ validators$1[type] = function validator2(thing) {
51338
+ return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
51339
+ };
51340
+ });
51341
+ var deprecatedWarnings2 = {};
51342
+ validators$1.transitional = function transitional2(validator2, version, message2) {
51343
+ function formatMessage(opt, desc) {
51344
+ return "[Axios v" + VERSION3 + "] Transitional option '" + opt + "'" + desc + (message2 ? ". " + message2 : "");
51345
+ }
51346
+ return (value, opt, opts) => {
51347
+ if (validator2 === false) {
51348
+ throw new AxiosError3(
51349
+ formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
51350
+ AxiosError3.ERR_DEPRECATED
51351
+ );
51352
+ }
51353
+ if (version && !deprecatedWarnings2[opt]) {
51354
+ deprecatedWarnings2[opt] = true;
51355
+ console.warn(
51356
+ formatMessage(
51357
+ opt,
51358
+ " has been deprecated since v" + version + " and will be removed in the near future"
51359
+ )
51360
+ );
51361
+ }
51362
+ return validator2 ? validator2(value, opt, opts) : true;
51363
+ };
51364
+ };
51365
+ validators$1.spelling = function spelling2(correctSpelling) {
51366
+ return (value, opt) => {
51367
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
51368
+ return true;
51369
+ };
51370
+ };
51371
+ function assertOptions2(options, schema, allowUnknown) {
51372
+ if (typeof options !== "object") {
51373
+ throw new AxiosError3("options must be an object", AxiosError3.ERR_BAD_OPTION_VALUE);
51374
+ }
51375
+ const keys = Object.keys(options);
51376
+ let i = keys.length;
51377
+ while (i-- > 0) {
51378
+ const opt = keys[i];
51379
+ const validator2 = schema[opt];
51380
+ if (validator2) {
51381
+ const value = options[opt];
51382
+ const result = value === void 0 || validator2(value, opt, options);
51383
+ if (result !== true) {
51384
+ throw new AxiosError3("option " + opt + " must be " + result, AxiosError3.ERR_BAD_OPTION_VALUE);
48184
51385
  }
48185
- ]);
48186
- if (push !== "Yes") {
48187
- return VcsPushStatus.OptedOutOfPushingToVcs;
51386
+ continue;
48188
51387
  }
48189
- const existingRepos = await getUserRepositories(directory);
48190
- const defaultRepo = `${username}/${options.name}`;
48191
- const { repoName } = await enquirer.prompt([
48192
- {
48193
- name: "repoName",
48194
- message: "Repository name (format: username/repo-name):",
48195
- type: "input",
48196
- initial: defaultRepo,
48197
- validate: async (value) => {
48198
- if (!value.includes("/")) {
48199
- return "Repository name must be in format: username/repo-name";
48200
- }
48201
- if (existingRepos.has(value)) {
48202
- return `Repository '${value}' already exists. Please choose a different name.`;
51388
+ if (allowUnknown !== true) {
51389
+ throw new AxiosError3("Unknown option " + opt, AxiosError3.ERR_BAD_OPTION);
51390
+ }
51391
+ }
51392
+ }
51393
+ var validator = {
51394
+ assertOptions: assertOptions2,
51395
+ validators: validators$1
51396
+ };
51397
+ var validators3 = validator.validators;
51398
+ var Axios3 = class {
51399
+ constructor(instanceConfig) {
51400
+ this.defaults = instanceConfig || {};
51401
+ this.interceptors = {
51402
+ request: new InterceptorManager$1(),
51403
+ response: new InterceptorManager$1()
51404
+ };
51405
+ }
51406
+ /**
51407
+ * Dispatch a request
51408
+ *
51409
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
51410
+ * @param {?Object} config
51411
+ *
51412
+ * @returns {Promise} The Promise to be fulfilled
51413
+ */
51414
+ async request(configOrUrl, config) {
51415
+ try {
51416
+ return await this._request(configOrUrl, config);
51417
+ } catch (err) {
51418
+ if (err instanceof Error) {
51419
+ let dummy = {};
51420
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
51421
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
51422
+ try {
51423
+ if (!err.stack) {
51424
+ err.stack = stack;
51425
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
51426
+ err.stack += "\n" + stack;
48203
51427
  }
48204
- return true;
51428
+ } catch (e) {
48205
51429
  }
48206
51430
  }
48207
- ]);
48208
- await (0, child_process_utils_1.spawnAndWait)("gh", [
48209
- "repo",
48210
- "create",
48211
- repoName,
48212
- "--private",
48213
- "--push",
48214
- "--source",
48215
- directory
48216
- ], directory);
48217
- const repoResult = await (0, child_process_utils_1.execAndWait)("gh repo view --json url -q .url", directory);
48218
- const repoUrl = repoResult.stdout.trim();
48219
- output_1.output.success({
48220
- title: `Successfully pushed to GitHub repository: ${repoUrl}`
51431
+ throw err;
51432
+ }
51433
+ }
51434
+ _request(configOrUrl, config) {
51435
+ if (typeof configOrUrl === "string") {
51436
+ config = config || {};
51437
+ config.url = configOrUrl;
51438
+ } else {
51439
+ config = configOrUrl || {};
51440
+ }
51441
+ config = mergeConfig3(this.defaults, config);
51442
+ const { transitional: transitional2, paramsSerializer, headers } = config;
51443
+ if (transitional2 !== void 0) {
51444
+ validator.assertOptions(transitional2, {
51445
+ silentJSONParsing: validators3.transitional(validators3.boolean),
51446
+ forcedJSONParsing: validators3.transitional(validators3.boolean),
51447
+ clarifyTimeoutError: validators3.transitional(validators3.boolean)
51448
+ }, false);
51449
+ }
51450
+ if (paramsSerializer != null) {
51451
+ if (utils$1.isFunction(paramsSerializer)) {
51452
+ config.paramsSerializer = {
51453
+ serialize: paramsSerializer
51454
+ };
51455
+ } else {
51456
+ validator.assertOptions(paramsSerializer, {
51457
+ encode: validators3.function,
51458
+ serialize: validators3.function
51459
+ }, true);
51460
+ }
51461
+ }
51462
+ if (config.allowAbsoluteUrls !== void 0) ;
51463
+ else if (this.defaults.allowAbsoluteUrls !== void 0) {
51464
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
51465
+ } else {
51466
+ config.allowAbsoluteUrls = true;
51467
+ }
51468
+ validator.assertOptions(config, {
51469
+ baseUrl: validators3.spelling("baseURL"),
51470
+ withXsrfToken: validators3.spelling("withXSRFToken")
51471
+ }, true);
51472
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
51473
+ let contextHeaders = headers && utils$1.merge(
51474
+ headers.common,
51475
+ headers[config.method]
51476
+ );
51477
+ headers && utils$1.forEach(
51478
+ ["delete", "get", "head", "post", "put", "patch", "common"],
51479
+ (method) => {
51480
+ delete headers[method];
51481
+ }
51482
+ );
51483
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
51484
+ const requestInterceptorChain = [];
51485
+ let synchronousRequestInterceptors = true;
51486
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
51487
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
51488
+ return;
51489
+ }
51490
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
51491
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
48221
51492
  });
48222
- return VcsPushStatus.PushedToVcs;
48223
- } catch (e) {
48224
- const isVerbose = options.verbose || process.env.NX_VERBOSE_LOGGING === "true";
48225
- const errorMessage = e instanceof Error ? e.message : String(e);
48226
- const title = e instanceof GitHubPushSkippedError || e?.code === 127 ? "Push your workspace to GitHub." : "Failed to push workspace to GitHub.";
48227
- const createRepoUrl = `https://github.com/new?name=${encodeURIComponent(options.name)}`;
48228
- output_1.output.log({
48229
- title,
48230
- bodyLines: isVerbose ? [
48231
- `Please create a repo at ${createRepoUrl} and push this workspace.`,
48232
- "Error details:",
48233
- errorMessage
48234
- ] : [`Please create a repo at ${createRepoUrl} and push this workspace.`]
51493
+ const responseInterceptorChain = [];
51494
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
51495
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
48235
51496
  });
48236
- return VcsPushStatus.FailedToPushToVcs;
51497
+ let promise;
51498
+ let i = 0;
51499
+ let len;
51500
+ if (!synchronousRequestInterceptors) {
51501
+ const chain = [dispatchRequest2.bind(this), void 0];
51502
+ chain.unshift(...requestInterceptorChain);
51503
+ chain.push(...responseInterceptorChain);
51504
+ len = chain.length;
51505
+ promise = Promise.resolve(config);
51506
+ while (i < len) {
51507
+ promise = promise.then(chain[i++], chain[i++]);
51508
+ }
51509
+ return promise;
51510
+ }
51511
+ len = requestInterceptorChain.length;
51512
+ let newConfig = config;
51513
+ while (i < len) {
51514
+ const onFulfilled = requestInterceptorChain[i++];
51515
+ const onRejected = requestInterceptorChain[i++];
51516
+ try {
51517
+ newConfig = onFulfilled(newConfig);
51518
+ } catch (error) {
51519
+ onRejected.call(this, error);
51520
+ break;
51521
+ }
51522
+ }
51523
+ try {
51524
+ promise = dispatchRequest2.call(this, newConfig);
51525
+ } catch (error) {
51526
+ return Promise.reject(error);
51527
+ }
51528
+ i = 0;
51529
+ len = responseInterceptorChain.length;
51530
+ while (i < len) {
51531
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
51532
+ }
51533
+ return promise;
51534
+ }
51535
+ getUri(config) {
51536
+ config = mergeConfig3(this.defaults, config);
51537
+ const fullPath = buildFullPath2(config.baseURL, config.url, config.allowAbsoluteUrls);
51538
+ return buildURL2(fullPath, config.params, config.paramsSerializer);
51539
+ }
51540
+ };
51541
+ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
51542
+ Axios3.prototype[method] = function(url3, config) {
51543
+ return this.request(mergeConfig3(config || {}, {
51544
+ method,
51545
+ url: url3,
51546
+ data: (config || {}).data
51547
+ }));
51548
+ };
51549
+ });
51550
+ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
51551
+ function generateHTTPMethod(isForm) {
51552
+ return function httpMethod(url3, data, config) {
51553
+ return this.request(mergeConfig3(config || {}, {
51554
+ method,
51555
+ headers: isForm ? {
51556
+ "Content-Type": "multipart/form-data"
51557
+ } : {},
51558
+ url: url3,
51559
+ data
51560
+ }));
51561
+ };
51562
+ }
51563
+ Axios3.prototype[method] = generateHTTPMethod();
51564
+ Axios3.prototype[method + "Form"] = generateHTTPMethod(true);
51565
+ });
51566
+ var Axios$1 = Axios3;
51567
+ var CancelToken3 = class _CancelToken {
51568
+ constructor(executor) {
51569
+ if (typeof executor !== "function") {
51570
+ throw new TypeError("executor must be a function.");
51571
+ }
51572
+ let resolvePromise;
51573
+ this.promise = new Promise(function promiseExecutor(resolve2) {
51574
+ resolvePromise = resolve2;
51575
+ });
51576
+ const token = this;
51577
+ this.promise.then((cancel) => {
51578
+ if (!token._listeners) return;
51579
+ let i = token._listeners.length;
51580
+ while (i-- > 0) {
51581
+ token._listeners[i](cancel);
51582
+ }
51583
+ token._listeners = null;
51584
+ });
51585
+ this.promise.then = (onfulfilled) => {
51586
+ let _resolve;
51587
+ const promise = new Promise((resolve2) => {
51588
+ token.subscribe(resolve2);
51589
+ _resolve = resolve2;
51590
+ }).then(onfulfilled);
51591
+ promise.cancel = function reject() {
51592
+ token.unsubscribe(_resolve);
51593
+ };
51594
+ return promise;
51595
+ };
51596
+ executor(function cancel(message2, config, request) {
51597
+ if (token.reason) {
51598
+ return;
51599
+ }
51600
+ token.reason = new CanceledError3(message2, config, request);
51601
+ resolvePromise(token.reason);
51602
+ });
51603
+ }
51604
+ /**
51605
+ * Throws a `CanceledError` if cancellation has been requested.
51606
+ */
51607
+ throwIfRequested() {
51608
+ if (this.reason) {
51609
+ throw this.reason;
51610
+ }
51611
+ }
51612
+ /**
51613
+ * Subscribe to the cancel signal
51614
+ */
51615
+ subscribe(listener) {
51616
+ if (this.reason) {
51617
+ listener(this.reason);
51618
+ return;
51619
+ }
51620
+ if (this._listeners) {
51621
+ this._listeners.push(listener);
51622
+ } else {
51623
+ this._listeners = [listener];
51624
+ }
51625
+ }
51626
+ /**
51627
+ * Unsubscribe from the cancel signal
51628
+ */
51629
+ unsubscribe(listener) {
51630
+ if (!this._listeners) {
51631
+ return;
51632
+ }
51633
+ const index = this._listeners.indexOf(listener);
51634
+ if (index !== -1) {
51635
+ this._listeners.splice(index, 1);
51636
+ }
51637
+ }
51638
+ toAbortSignal() {
51639
+ const controller = new AbortController();
51640
+ const abort = (err) => {
51641
+ controller.abort(err);
51642
+ };
51643
+ this.subscribe(abort);
51644
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
51645
+ return controller.signal;
51646
+ }
51647
+ /**
51648
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
51649
+ * cancels the `CancelToken`.
51650
+ */
51651
+ static source() {
51652
+ let cancel;
51653
+ const token = new _CancelToken(function executor(c) {
51654
+ cancel = c;
51655
+ });
51656
+ return {
51657
+ token,
51658
+ cancel
51659
+ };
48237
51660
  }
51661
+ };
51662
+ var CancelToken$1 = CancelToken3;
51663
+ function spread3(callback) {
51664
+ return function wrap(arr) {
51665
+ return callback.apply(null, arr);
51666
+ };
48238
51667
  }
48239
- }
48240
- });
48241
-
48242
- // node_modules/create-nx-workspace/src/utils/nx/messages.js
48243
- var require_messages = __commonJS({
48244
- "node_modules/create-nx-workspace/src/utils/nx/messages.js"(exports2) {
51668
+ function isAxiosError3(payload) {
51669
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
51670
+ }
51671
+ var HttpStatusCode3 = {
51672
+ Continue: 100,
51673
+ SwitchingProtocols: 101,
51674
+ Processing: 102,
51675
+ EarlyHints: 103,
51676
+ Ok: 200,
51677
+ Created: 201,
51678
+ Accepted: 202,
51679
+ NonAuthoritativeInformation: 203,
51680
+ NoContent: 204,
51681
+ ResetContent: 205,
51682
+ PartialContent: 206,
51683
+ MultiStatus: 207,
51684
+ AlreadyReported: 208,
51685
+ ImUsed: 226,
51686
+ MultipleChoices: 300,
51687
+ MovedPermanently: 301,
51688
+ Found: 302,
51689
+ SeeOther: 303,
51690
+ NotModified: 304,
51691
+ UseProxy: 305,
51692
+ Unused: 306,
51693
+ TemporaryRedirect: 307,
51694
+ PermanentRedirect: 308,
51695
+ BadRequest: 400,
51696
+ Unauthorized: 401,
51697
+ PaymentRequired: 402,
51698
+ Forbidden: 403,
51699
+ NotFound: 404,
51700
+ MethodNotAllowed: 405,
51701
+ NotAcceptable: 406,
51702
+ ProxyAuthenticationRequired: 407,
51703
+ RequestTimeout: 408,
51704
+ Conflict: 409,
51705
+ Gone: 410,
51706
+ LengthRequired: 411,
51707
+ PreconditionFailed: 412,
51708
+ PayloadTooLarge: 413,
51709
+ UriTooLong: 414,
51710
+ UnsupportedMediaType: 415,
51711
+ RangeNotSatisfiable: 416,
51712
+ ExpectationFailed: 417,
51713
+ ImATeapot: 418,
51714
+ MisdirectedRequest: 421,
51715
+ UnprocessableEntity: 422,
51716
+ Locked: 423,
51717
+ FailedDependency: 424,
51718
+ TooEarly: 425,
51719
+ UpgradeRequired: 426,
51720
+ PreconditionRequired: 428,
51721
+ TooManyRequests: 429,
51722
+ RequestHeaderFieldsTooLarge: 431,
51723
+ UnavailableForLegalReasons: 451,
51724
+ InternalServerError: 500,
51725
+ NotImplemented: 501,
51726
+ BadGateway: 502,
51727
+ ServiceUnavailable: 503,
51728
+ GatewayTimeout: 504,
51729
+ HttpVersionNotSupported: 505,
51730
+ VariantAlsoNegotiates: 506,
51731
+ InsufficientStorage: 507,
51732
+ LoopDetected: 508,
51733
+ NotExtended: 510,
51734
+ NetworkAuthenticationRequired: 511,
51735
+ WebServerIsDown: 521,
51736
+ ConnectionTimedOut: 522,
51737
+ OriginIsUnreachable: 523,
51738
+ TimeoutOccurred: 524,
51739
+ SslHandshakeFailed: 525,
51740
+ InvalidSslCertificate: 526
51741
+ };
51742
+ Object.entries(HttpStatusCode3).forEach(([key, value]) => {
51743
+ HttpStatusCode3[value] = key;
51744
+ });
51745
+ var HttpStatusCode$1 = HttpStatusCode3;
51746
+ function createInstance2(defaultConfig) {
51747
+ const context = new Axios$1(defaultConfig);
51748
+ const instance = bind2(Axios$1.prototype.request, context);
51749
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
51750
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
51751
+ instance.create = function create(instanceConfig) {
51752
+ return createInstance2(mergeConfig3(defaultConfig, instanceConfig));
51753
+ };
51754
+ return instance;
51755
+ }
51756
+ var axios2 = createInstance2(defaults$1);
51757
+ axios2.Axios = Axios$1;
51758
+ axios2.CanceledError = CanceledError3;
51759
+ axios2.CancelToken = CancelToken$1;
51760
+ axios2.isCancel = isCancel3;
51761
+ axios2.VERSION = VERSION3;
51762
+ axios2.toFormData = toFormData3;
51763
+ axios2.AxiosError = AxiosError3;
51764
+ axios2.Cancel = axios2.CanceledError;
51765
+ axios2.all = function all3(promises) {
51766
+ return Promise.all(promises);
51767
+ };
51768
+ axios2.spread = spread3;
51769
+ axios2.isAxiosError = isAxiosError3;
51770
+ axios2.mergeConfig = mergeConfig3;
51771
+ axios2.AxiosHeaders = AxiosHeaders$1;
51772
+ axios2.formToJSON = (thing) => formDataToJSON2(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
51773
+ axios2.getAdapter = adapters.getAdapter;
51774
+ axios2.HttpStatusCode = HttpStatusCode$1;
51775
+ axios2.default = axios2;
51776
+ module2.exports = axios2;
51777
+ }
51778
+ });
51779
+
51780
+ // node_modules/create-nx-workspace/src/utils/nx/ab-testing.js
51781
+ var require_ab_testing = __commonJS({
51782
+ "node_modules/create-nx-workspace/src/utils/nx/ab-testing.js"(exports2) {
48245
51783
  "use strict";
48246
51784
  Object.defineProperty(exports2, "__esModule", { value: true });
48247
- exports2.getMessageFactory = getMessageFactory;
48248
- var git_1 = require_git();
48249
- function getSetupMessage(url2, pushedToVcs) {
48250
- if (pushedToVcs === git_1.VcsPushStatus.PushedToVcs) {
48251
- return url2 ? `Go to Nx Cloud and finish the setup: ${url2}` : "Return to Nx Cloud and finish the setup.";
51785
+ exports2.messages = exports2.PromptMessages = exports2.NxCloudChoices = void 0;
51786
+ exports2.shouldUseTemplateFlow = shouldUseTemplateFlow;
51787
+ exports2.getFlowVariant = getFlowVariant;
51788
+ exports2.recordStat = recordStat;
51789
+ var node_child_process_1 = require("node:child_process");
51790
+ var node_fs_1 = require("node:fs");
51791
+ var node_path_1 = require("node:path");
51792
+ var node_os_1 = require("node:os");
51793
+ var is_ci_1 = require_is_ci();
51794
+ var FLOW_VARIANT_CACHE_FILE = (0, node_path_1.join)((0, node_os_1.tmpdir)(), "nx-cnw-flow-variant");
51795
+ var FLOW_VARIANT_EXPIRY_MS = 7 * 24 * 60 * 60 * 1e3;
51796
+ var flowVariantCache = null;
51797
+ function readCachedFlowVariant() {
51798
+ try {
51799
+ if (!(0, node_fs_1.existsSync)(FLOW_VARIANT_CACHE_FILE))
51800
+ return null;
51801
+ const stats = (0, node_fs_1.statSync)(FLOW_VARIANT_CACHE_FILE);
51802
+ if (Date.now() - stats.mtimeMs > FLOW_VARIANT_EXPIRY_MS)
51803
+ return null;
51804
+ const value = (0, node_fs_1.readFileSync)(FLOW_VARIANT_CACHE_FILE, "utf-8").trim();
51805
+ return value === "0" || value === "1" ? value : null;
51806
+ } catch {
51807
+ return null;
51808
+ }
51809
+ }
51810
+ function writeCachedFlowVariant(variant) {
51811
+ try {
51812
+ (0, node_fs_1.writeFileSync)(FLOW_VARIANT_CACHE_FILE, variant, "utf-8");
51813
+ } catch {
48252
51814
  }
48253
- const action = url2 ? "go" : "return";
48254
- const urlSuffix = url2 ? `: ${url2}` : ".";
48255
- return `Push your repo, then ${action} to Nx Cloud and finish the setup${urlSuffix}`;
48256
51815
  }
48257
- var outputMessages = {
48258
- "create-nx-workspace-success-ci-setup": [
51816
+ function getFlowVariantInternal() {
51817
+ if (flowVariantCache)
51818
+ return flowVariantCache;
51819
+ const variant = process.env.NX_CNW_FLOW_VARIANT ?? readCachedFlowVariant() ?? (Math.random() < 0.5 ? "0" : "1");
51820
+ flowVariantCache = variant;
51821
+ if (!process.env.NX_CNW_FLOW_VARIANT && !(0, node_fs_1.existsSync)(FLOW_VARIANT_CACHE_FILE)) {
51822
+ writeCachedFlowVariant(variant);
51823
+ }
51824
+ return variant;
51825
+ }
51826
+ function shouldUseTemplateFlow() {
51827
+ if (process.env.NX_GENERATE_DOCS_PROCESS === "true") {
51828
+ flowVariantCache = "0";
51829
+ return false;
51830
+ }
51831
+ return getFlowVariantInternal() === "1";
51832
+ }
51833
+ function getFlowVariant() {
51834
+ if (process.env.NX_GENERATE_DOCS_PROCESS === "true") {
51835
+ return "0";
51836
+ }
51837
+ return flowVariantCache ?? getFlowVariantInternal();
51838
+ }
51839
+ exports2.NxCloudChoices = [
51840
+ "github",
51841
+ "gitlab",
51842
+ "azure",
51843
+ "bitbucket-pipelines",
51844
+ "circleci",
51845
+ "skip",
51846
+ "yes"
51847
+ // Deprecated but still handled
51848
+ ];
51849
+ var messageOptions = {
51850
+ /**
51851
+ * These messages are for setting up CI as part of create-nx-workspace and nx init
51852
+ */
51853
+ setupCI: [
48259
51854
  {
48260
- code: "ci-setup-visit",
48261
- createMessage: (url2, pushedToVcs) => {
48262
- return {
48263
- title: `Your CI setup is almost complete.`,
48264
- type: "success",
48265
- bodyLines: [getSetupMessage(url2, pushedToVcs)]
48266
- };
48267
- }
51855
+ code: "which-ci-provider",
51856
+ message: `Which CI provider would you like to use?`,
51857
+ initial: 0,
51858
+ choices: [
51859
+ { value: "github", name: "GitHub Actions" },
51860
+ { value: "gitlab", name: "Gitlab" },
51861
+ { value: "azure", name: "Azure DevOps" },
51862
+ { value: "bitbucket-pipelines", name: "BitBucket Pipelines" },
51863
+ { value: "circleci", name: "Circle CI" },
51864
+ { value: "skip", name: "\nDo it later" }
51865
+ ],
51866
+ footer: "\nSelf-healing CI, remote caching, and task distribution are provided by Nx Cloud: https://nx.dev/nx-cloud",
51867
+ fallback: { value: "skip", key: "setupNxCloud" },
51868
+ completionMessage: "ci-setup"
51869
+ }
51870
+ ],
51871
+ /**
51872
+ * These messages are a fallback for setting up CI as well as when migrating major versions
51873
+ */
51874
+ setupNxCloud: [
51875
+ {
51876
+ code: "enable-caching2",
51877
+ message: `Would you like remote caching to make your build faster?`,
51878
+ initial: 0,
51879
+ choices: [
51880
+ { value: "yes", name: "Yes" },
51881
+ {
51882
+ value: "skip",
51883
+ name: "No - I would not like remote caching"
51884
+ }
51885
+ ],
51886
+ footer: "\nRead more about remote caching at https://nx.dev/ci/features/remote-cache",
51887
+ hint: `
51888
+ (can be disabled any time).`,
51889
+ fallback: void 0,
51890
+ completionMessage: "cache-setup"
48268
51891
  }
48269
51892
  ],
48270
- "create-nx-workspace-success-cache-setup": [
51893
+ /**
51894
+ * Simplified Cloud prompt for template flow
51895
+ */
51896
+ setupNxCloudV2: [
48271
51897
  {
48272
- code: "remote-cache-visit",
48273
- createMessage: (url2, pushedToVcs) => {
48274
- return {
48275
- title: `Your remote cache is almost complete.`,
48276
- type: "success",
48277
- bodyLines: [getSetupMessage(url2, pushedToVcs)]
48278
- };
48279
- }
51898
+ code: "cloud-v2-remote-cache-visit",
51899
+ message: "Enable remote caching with Nx Cloud?",
51900
+ initial: 0,
51901
+ choices: [
51902
+ { value: "yes", name: "Yes" },
51903
+ { value: "skip", name: "Skip" }
51904
+ ],
51905
+ footer: "\nRemote caching makes your builds faster for development and in CI: https://nx.dev/ci/features/remote-cache",
51906
+ fallback: void 0,
51907
+ completionMessage: "cache-setup"
51908
+ },
51909
+ {
51910
+ code: "cloud-v2-fast-ci-visit",
51911
+ message: "Speed up CI and reduce compute costs with Nx Cloud?",
51912
+ initial: 0,
51913
+ choices: [
51914
+ { value: "yes", name: "Yes" },
51915
+ { value: "skip", name: "Skip" }
51916
+ ],
51917
+ footer: "\n70% faster CI, 60% less compute, Automatically fix broken PRs: https://nx.dev/nx-cloud",
51918
+ fallback: void 0,
51919
+ completionMessage: "ci-setup"
51920
+ },
51921
+ {
51922
+ code: "cloud-v2-green-prs-visit",
51923
+ message: "Get to green PRs faster with Nx Cloud?",
51924
+ initial: 0,
51925
+ choices: [
51926
+ { value: "yes", name: "Yes" },
51927
+ { value: "skip", name: "Skip" }
51928
+ ],
51929
+ footer: "\nAutomatically fix broken PRs, 70% faster CI: https://nx.dev/nx-cloud",
51930
+ fallback: void 0,
51931
+ completionMessage: "ci-setup"
51932
+ },
51933
+ {
51934
+ code: "cloud-v2-full-platform-visit",
51935
+ message: "Try the full Nx platform?",
51936
+ initial: 0,
51937
+ choices: [
51938
+ { value: "yes", name: "Yes" },
51939
+ { value: "skip", name: "Skip" }
51940
+ ],
51941
+ footer: "\nAutomatically fix broken PRs, 70% faster CI: https://nx.dev/nx-cloud",
51942
+ fallback: void 0,
51943
+ completionMessage: "platform-setup"
48280
51944
  }
48281
51945
  ]
48282
51946
  };
48283
- var ABTestingMessages = class {
51947
+ var PromptMessages = class {
48284
51948
  constructor() {
48285
51949
  this.selectedMessages = {};
48286
51950
  }
48287
- getMessageFactory(key) {
51951
+ getPrompt(key) {
48288
51952
  if (this.selectedMessages[key] === void 0) {
48289
51953
  if (process.env.NX_GENERATE_DOCS_PROCESS === "true") {
48290
51954
  this.selectedMessages[key] = 0;
48291
51955
  } else {
48292
- this.selectedMessages[key] = Math.floor(Math.random() * outputMessages[key].length);
51956
+ this.selectedMessages[key] = Math.floor(Math.random() * messageOptions[key].length);
48293
51957
  }
48294
51958
  }
48295
- return outputMessages[key][this.selectedMessages[key]];
51959
+ return messageOptions[key][this.selectedMessages[key]];
51960
+ }
51961
+ codeOfSelectedPromptMessage(key) {
51962
+ const selected = this.selectedMessages[key];
51963
+ if (selected === void 0) {
51964
+ return "";
51965
+ }
51966
+ return messageOptions[key][selected].code;
51967
+ }
51968
+ completionMessageOfSelectedPrompt(key) {
51969
+ const selected = this.selectedMessages[key];
51970
+ if (selected === void 0) {
51971
+ return "ci-setup";
51972
+ } else {
51973
+ return messageOptions[key][selected].completionMessage;
51974
+ }
48296
51975
  }
48297
51976
  };
48298
- var messages = new ABTestingMessages();
48299
- function getMessageFactory(key) {
48300
- return messages.getMessageFactory(key);
51977
+ exports2.PromptMessages = PromptMessages;
51978
+ exports2.messages = new PromptMessages();
51979
+ async function recordStat(opts) {
51980
+ try {
51981
+ if (!shouldRecordStats()) {
51982
+ return;
51983
+ }
51984
+ const { getCloudUrl: getCloudUrl2 } = require(require.resolve(
51985
+ "nx/src/nx-cloud/utilities/get-cloud-options",
51986
+ {
51987
+ paths: [opts.directory]
51988
+ }
51989
+ // nx-ignore-next-line
51990
+ ));
51991
+ const axios2 = require_axios();
51992
+ await (axios2["default"] ?? axios2).create({
51993
+ baseURL: getCloudUrl2(),
51994
+ timeout: 400
51995
+ }).post("/nx-cloud/stats", {
51996
+ command: opts.command,
51997
+ isCI: (0, is_ci_1.isCI)(),
51998
+ useCloud: opts.useCloud,
51999
+ meta: [opts.nxVersion, ...opts.meta].filter((v) => !!v).join(",")
52000
+ });
52001
+ } catch (e) {
52002
+ if (process.env.NX_VERBOSE_LOGGING === "true") {
52003
+ console.error(e);
52004
+ }
52005
+ }
52006
+ }
52007
+ function shouldRecordStats() {
52008
+ try {
52009
+ const stdout = (0, node_child_process_1.execSync)("npm config get registry", {
52010
+ encoding: "utf-8",
52011
+ windowsHide: false
52012
+ });
52013
+ const url2 = new URL(stdout.trim());
52014
+ return url2.hostname !== "localhost";
52015
+ } catch {
52016
+ return true;
52017
+ }
48301
52018
  }
48302
52019
  }
48303
52020
  });
@@ -48307,12 +52024,36 @@ var require_nx_cloud = __commonJS({
48307
52024
  "node_modules/create-nx-workspace/src/utils/nx/nx-cloud.js"(exports2) {
48308
52025
  "use strict";
48309
52026
  Object.defineProperty(exports2, "__esModule", { value: true });
52027
+ exports2.connectToNxCloudForTemplate = connectToNxCloudForTemplate;
48310
52028
  exports2.readNxCloudToken = readNxCloudToken;
48311
52029
  exports2.createNxCloudOnboardingUrl = createNxCloudOnboardingUrl;
48312
52030
  exports2.getNxCloudInfo = getNxCloudInfo;
52031
+ exports2.getSkippedNxCloudInfo = getSkippedNxCloudInfo;
48313
52032
  var output_1 = require_output();
48314
52033
  var messages_1 = require_messages();
52034
+ var ab_testing_1 = require_ab_testing();
48315
52035
  var ora = require_ora();
52036
+ async function connectToNxCloudForTemplate(directory, installationSource, useGitHub) {
52037
+ const { connectToNxCloud } = require(require.resolve(
52038
+ "nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud",
52039
+ {
52040
+ paths: [directory]
52041
+ }
52042
+ // nx-ignore-next-line
52043
+ ));
52044
+ const { FsTree, flushChanges } = require(require.resolve("nx/src/generators/tree", {
52045
+ paths: [directory]
52046
+ // nx-ignore-next-line
52047
+ }));
52048
+ const tree = new FsTree(directory, false);
52049
+ const result = await connectToNxCloud(tree, {
52050
+ installationSource,
52051
+ directory: "",
52052
+ github: useGitHub
52053
+ });
52054
+ flushChanges(directory, tree.listChanges());
52055
+ return result;
52056
+ }
48316
52057
  function readNxCloudToken(directory) {
48317
52058
  const nxCloudSpinner = ora(`Checking Nx Cloud setup`).start();
48318
52059
  const { getCloudOptions } = require(require.resolve(
@@ -48335,19 +52076,22 @@ var require_nx_cloud = __commonJS({
48335
52076
  // nx-ignore-next-line
48336
52077
  ));
48337
52078
  const source = nxCloud === "yes" ? "create-nx-workspace-success-cache-setup" : "create-nx-workspace-success-ci-setup";
48338
- const { code } = (0, messages_1.getMessageFactory)(source);
48339
- return await createNxCloudOnboardingURL(source, token, code, false, useGitHub ?? (nxCloud === "yes" || nxCloud === "github" || nxCloud === "circleci"));
52079
+ const flowVariant = (0, ab_testing_1.getFlowVariant)();
52080
+ const prefix = flowVariant === "1" ? "start-v2" : "start";
52081
+ const promptCode = flowVariant === "1" ? ab_testing_1.messages.codeOfSelectedPromptMessage("setupNxCloudV2") : "";
52082
+ const code = promptCode || (nxCloud === "yes" ? "remote-cache-visit" : "ci-setup-visit");
52083
+ const meta = `${prefix}-${code}`;
52084
+ return createNxCloudOnboardingURL(source, token, meta, false, useGitHub ?? (nxCloud === "yes" || nxCloud === "github" || nxCloud === "circleci"), directory);
52085
+ }
52086
+ async function getNxCloudInfo(connectCloudUrl, pushedToVcs, completionMessageKey) {
52087
+ const out = new output_1.CLIOutput(false);
52088
+ const message2 = (0, messages_1.getCompletionMessage)(completionMessageKey, connectCloudUrl, pushedToVcs);
52089
+ out.success(message2);
52090
+ return out.getOutput();
48340
52091
  }
48341
- async function getNxCloudInfo(nxCloud, connectCloudUrl, pushedToVcs, rawNxCloud) {
48342
- const source = nxCloud === "yes" ? "create-nx-workspace-success-cache-setup" : "create-nx-workspace-success-ci-setup";
48343
- const { createMessage } = (0, messages_1.getMessageFactory)(source);
52092
+ function getSkippedNxCloudInfo() {
48344
52093
  const out = new output_1.CLIOutput(false);
48345
- const message2 = createMessage(typeof rawNxCloud === "string" ? null : connectCloudUrl, pushedToVcs);
48346
- if (message2.type === "success") {
48347
- out.success(message2);
48348
- } else {
48349
- out.warn(message2);
48350
- }
52094
+ out.success((0, messages_1.getSkippedCloudMessage)());
48351
52095
  return out.getOutput();
48352
52096
  }
48353
52097
  }
@@ -48488,13 +52232,52 @@ var require_get_third_party_preset = __commonJS({
48488
52232
  }
48489
52233
  });
48490
52234
 
52235
+ // node_modules/create-nx-workspace/src/utils/template/clone-template.js
52236
+ var require_clone_template = __commonJS({
52237
+ "node_modules/create-nx-workspace/src/utils/template/clone-template.js"(exports2) {
52238
+ "use strict";
52239
+ Object.defineProperty(exports2, "__esModule", { value: true });
52240
+ exports2.cloneTemplate = cloneTemplate;
52241
+ var child_process_utils_1 = require_child_process_utils();
52242
+ var fs_1 = require("fs");
52243
+ var promises_1 = require("fs/promises");
52244
+ var path_1 = require("path");
52245
+ var output_1 = require_output();
52246
+ var error_utils_1 = require_error_utils();
52247
+ async function cloneTemplate(templateUrl, targetDirectory) {
52248
+ if ((0, fs_1.existsSync)(targetDirectory)) {
52249
+ throw new Error(`The directory '${targetDirectory}' already exists and is not empty. Choose a different name or remove the existing directory.`);
52250
+ }
52251
+ try {
52252
+ await (0, child_process_utils_1.execAndWait)(`git clone --depth 1 "${templateUrl}" "${targetDirectory}"`, process.cwd());
52253
+ const gitDir = (0, path_1.join)(targetDirectory, ".git");
52254
+ if ((0, fs_1.existsSync)(gitDir)) {
52255
+ await (0, promises_1.rm)(gitDir, { recursive: true, force: true });
52256
+ }
52257
+ } catch (e) {
52258
+ if (e instanceof Error) {
52259
+ output_1.output.error({
52260
+ title: "Failed to create starter workspace",
52261
+ bodyLines: (0, error_utils_1.mapErrorToBodyLines)(e)
52262
+ });
52263
+ } else {
52264
+ console.error(e);
52265
+ }
52266
+ process.exit(1);
52267
+ }
52268
+ }
52269
+ }
52270
+ });
52271
+
48491
52272
  // node_modules/create-nx-workspace/src/create-workspace.js
48492
52273
  var require_create_workspace = __commonJS({
48493
52274
  "node_modules/create-nx-workspace/src/create-workspace.js"(exports2) {
48494
52275
  "use strict";
48495
52276
  Object.defineProperty(exports2, "__esModule", { value: true });
52277
+ exports2.getInterruptedWorkspaceState = getInterruptedWorkspaceState;
48496
52278
  exports2.createWorkspace = createWorkspace2;
48497
52279
  exports2.extractConnectUrl = extractConnectUrl;
52280
+ var path_1 = require("path");
48498
52281
  var create_empty_workspace_1 = require_create_empty_workspace();
48499
52282
  var create_preset_1 = require_create_preset();
48500
52283
  var create_sandbox_1 = require_create_sandbox();
@@ -48505,32 +52288,62 @@ var require_create_workspace = __commonJS({
48505
52288
  var output_1 = require_output();
48506
52289
  var get_third_party_preset_1 = require_get_third_party_preset();
48507
52290
  var preset_1 = require_preset();
52291
+ var clone_template_1 = require_clone_template();
52292
+ var child_process_utils_1 = require_child_process_utils();
52293
+ var workspaceDirectory;
52294
+ var cloudConnectUrl;
52295
+ function getInterruptedWorkspaceState() {
52296
+ return { directory: workspaceDirectory, connectUrl: cloudConnectUrl };
52297
+ }
48508
52298
  async function createWorkspace2(preset, options, rawArgs) {
48509
52299
  const { packageManager, name, nxCloud, skipGit = false, defaultBase = "main", commit, cliName, useGitHub, skipGitHubPush = false, verbose = false } = options;
48510
52300
  if (cliName) {
48511
52301
  output_1.output.setCliName(cliName ?? "NX");
48512
52302
  }
48513
- const tmpDir = await (0, create_sandbox_1.createSandbox)(packageManager);
48514
- const workspaceGlobs = getWorkspaceGlobsFromPreset(preset);
48515
- const directory = await (0, create_empty_workspace_1.createEmptyWorkspace)(tmpDir, name, packageManager, { ...options, preset, workspaceGlobs });
48516
- const thirdPartyPackageName = (0, get_third_party_preset_1.getPackageNameFromThirdPartyPreset)(preset);
48517
- if (thirdPartyPackageName) {
48518
- await (0, create_preset_1.createPreset)(thirdPartyPackageName, options, packageManager, directory);
48519
- }
48520
- let connectUrl;
48521
- let nxCloudInfo;
48522
- if (nxCloud !== "skip") {
48523
- const token = (0, nx_cloud_1.readNxCloudToken)(directory);
48524
- if (nxCloud !== "yes") {
48525
- await (0, setup_ci_1.setupCI)(directory, nxCloud, packageManager);
52303
+ let directory;
52304
+ if (options.template) {
52305
+ if (!options.template.startsWith("nrwl/"))
52306
+ throw new Error(`Invalid template. Only templates from the 'nrwl' GitHub org are supported.`);
52307
+ const templateUrl = `https://github.com/${options.template}`;
52308
+ const workingDir = process.cwd().replace(/\\/g, "/");
52309
+ directory = (0, path_1.join)(workingDir, name);
52310
+ const ora = require_ora();
52311
+ const workspaceSetupSpinner = ora(`Creating workspace from template`).start();
52312
+ try {
52313
+ await (0, clone_template_1.cloneTemplate)(templateUrl, name);
52314
+ await (0, child_process_utils_1.execAndWait)("npm install --silent --ignore-scripts", directory);
52315
+ workspaceDirectory = directory;
52316
+ workspaceSetupSpinner.succeed(`Successfully created the workspace: ${directory}`);
52317
+ } catch (e) {
52318
+ workspaceSetupSpinner.fail();
52319
+ throw e;
52320
+ }
52321
+ if (nxCloud !== "skip") {
52322
+ await (0, nx_cloud_1.connectToNxCloudForTemplate)(directory, "create-nx-workspace", useGitHub);
52323
+ }
52324
+ } else {
52325
+ const tmpDir = await (0, create_sandbox_1.createSandbox)(packageManager);
52326
+ const workspaceGlobs = getWorkspaceGlobsFromPreset(preset);
52327
+ directory = await (0, create_empty_workspace_1.createEmptyWorkspace)(tmpDir, name, packageManager, {
52328
+ ...options,
52329
+ preset,
52330
+ workspaceGlobs
52331
+ });
52332
+ workspaceDirectory = directory;
52333
+ const thirdPartyPackageName = (0, get_third_party_preset_1.getPackageNameFromThirdPartyPreset)(preset);
52334
+ if (thirdPartyPackageName) {
52335
+ await (0, create_preset_1.createPreset)(thirdPartyPackageName, options, packageManager, directory);
48526
52336
  }
48527
- connectUrl = await (0, nx_cloud_1.createNxCloudOnboardingUrl)(nxCloud, token, directory, useGitHub);
52337
+ }
52338
+ const isTemplate = !!options.template;
52339
+ if (nxCloud !== "skip" && !isTemplate && nxCloud !== "yes") {
52340
+ await (0, setup_ci_1.setupCI)(directory, nxCloud, packageManager);
48528
52341
  }
48529
52342
  let pushedToVcs = git_1.VcsPushStatus.SkippedGit;
48530
52343
  if (!skipGit) {
48531
52344
  try {
48532
- await (0, git_1.initializeGitRepo)(directory, { defaultBase, commit, connectUrl });
48533
- if (commit && !skipGitHubPush && nxCloud === "github") {
52345
+ await (0, git_1.initializeGitRepo)(directory, { defaultBase, commit });
52346
+ if (commit && !skipGitHubPush && (nxCloud === "github" || isTemplate && nxCloud === "yes")) {
48534
52347
  pushedToVcs = await (0, git_1.pushToGitHub)(directory, {
48535
52348
  skipGitHubPush,
48536
52349
  name,
@@ -48549,8 +52362,15 @@ var require_create_workspace = __commonJS({
48549
52362
  }
48550
52363
  }
48551
52364
  }
48552
- if (connectUrl) {
48553
- nxCloudInfo = await (0, nx_cloud_1.getNxCloudInfo)(nxCloud, connectUrl, pushedToVcs, rawArgs?.nxCloud);
52365
+ let connectUrl;
52366
+ let nxCloudInfo;
52367
+ if (nxCloud !== "skip") {
52368
+ const token = (0, nx_cloud_1.readNxCloudToken)(directory);
52369
+ connectUrl = await (0, nx_cloud_1.createNxCloudOnboardingUrl)(nxCloud, token, directory, useGitHub);
52370
+ cloudConnectUrl = connectUrl;
52371
+ nxCloudInfo = await (0, nx_cloud_1.getNxCloudInfo)(connectUrl, pushedToVcs, options.completionMessageKey);
52372
+ } else if (isTemplate && nxCloud === "skip") {
52373
+ nxCloudInfo = (0, nx_cloud_1.getSkippedNxCloudInfo)();
48554
52374
  }
48555
52375
  return {
48556
52376
  nxCloudInfo,
@@ -75956,8 +79776,8 @@ function stringifySafely(rawValue, parser, encoder) {
75956
79776
  var defaults2 = {
75957
79777
  transitional: transitional_default,
75958
79778
  adapter: ["xhr", "http", "fetch"],
75959
- transformRequest: [function transformRequest(data, headers2) {
75960
- const contentType = headers2.getContentType() || "";
79779
+ transformRequest: [function transformRequest(data, headers) {
79780
+ const contentType = headers.getContentType() || "";
75961
79781
  const hasJSONContentType = contentType.indexOf("application/json") > -1;
75962
79782
  const isObjectPayload = utils_default2.isObject(data);
75963
79783
  if (isObjectPayload && utils_default2.isHTMLForm(data)) {
@@ -75974,7 +79794,7 @@ var defaults2 = {
75974
79794
  return data.buffer;
75975
79795
  }
75976
79796
  if (utils_default2.isURLSearchParams(data)) {
75977
- headers2.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
79797
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
75978
79798
  return data.toString();
75979
79799
  }
75980
79800
  let isFileList2;
@@ -75992,7 +79812,7 @@ var defaults2 = {
75992
79812
  }
75993
79813
  }
75994
79814
  if (isObjectPayload || hasJSONContentType) {
75995
- headers2.setContentType("application/json", false);
79815
+ headers.setContentType("application/json", false);
75996
79816
  return stringifySafely(data);
75997
79817
  }
75998
79818
  return data;
@@ -76146,8 +79966,8 @@ function buildAccessors(obj, header) {
76146
79966
  });
76147
79967
  }
76148
79968
  var AxiosHeaders = class {
76149
- constructor(headers2) {
76150
- headers2 && this.set(headers2);
79969
+ constructor(headers) {
79970
+ headers && this.set(headers);
76151
79971
  }
76152
79972
  set(header, valueOrRewrite, rewrite) {
76153
79973
  const self2 = this;
@@ -76161,7 +79981,7 @@ var AxiosHeaders = class {
76161
79981
  self2[key || _header] = normalizeValue(_value);
76162
79982
  }
76163
79983
  }
76164
- const setHeaders = (headers2, _rewrite) => utils_default2.forEach(headers2, (_value, _header) => setHeader(_value, _header, _rewrite));
79984
+ const setHeaders = (headers, _rewrite) => utils_default2.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
76165
79985
  if (utils_default2.isPlainObject(header) || header instanceof this.constructor) {
76166
79986
  setHeaders(header, valueOrRewrite);
76167
79987
  } else if (utils_default2.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
@@ -76245,9 +80065,9 @@ var AxiosHeaders = class {
76245
80065
  }
76246
80066
  normalize(format4) {
76247
80067
  const self2 = this;
76248
- const headers2 = {};
80068
+ const headers = {};
76249
80069
  utils_default2.forEach(this, (value, header) => {
76250
- const key = utils_default2.findKey(headers2, header);
80070
+ const key = utils_default2.findKey(headers, header);
76251
80071
  if (key) {
76252
80072
  self2[key] = normalizeValue(value);
76253
80073
  delete self2[header];
@@ -76258,7 +80078,7 @@ var AxiosHeaders = class {
76258
80078
  delete self2[header];
76259
80079
  }
76260
80080
  self2[normalized] = normalizeValue(value);
76261
- headers2[normalized] = true;
80081
+ headers[normalized] = true;
76262
80082
  });
76263
80083
  return this;
76264
80084
  }
@@ -76326,12 +80146,12 @@ var AxiosHeaders_default = AxiosHeaders;
76326
80146
  function transformData(fns, response) {
76327
80147
  const config = this || defaults_default2;
76328
80148
  const context = response || config;
76329
- const headers2 = AxiosHeaders_default.from(context.headers);
80149
+ const headers = AxiosHeaders_default.from(context.headers);
76330
80150
  let data = context.data;
76331
80151
  utils_default2.forEach(fns, function transform(fn) {
76332
- data = fn.call(config, data, headers2.normalize(), response ? response.status : void 0);
80152
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
76333
80153
  });
76334
- headers2.normalize();
80154
+ headers.normalize();
76335
80155
  return data;
76336
80156
  }
76337
80157
 
@@ -76582,13 +80402,13 @@ var FormDataPart = class {
76582
80402
  constructor(name, value) {
76583
80403
  const { escapeName } = this.constructor;
76584
80404
  const isStringValue = utils_default2.isString(value);
76585
- let headers2 = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`;
80405
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`;
76586
80406
  if (isStringValue) {
76587
80407
  value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
76588
80408
  } else {
76589
- headers2 += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
80409
+ headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
76590
80410
  }
76591
- this.headers = textEncoder.encode(headers2 + CRLF);
80411
+ this.headers = textEncoder.encode(headers + CRLF);
76592
80412
  this.contentLength = isStringValue ? value.byteLength : value.size;
76593
80413
  this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
76594
80414
  this.name = name;
@@ -77009,7 +80829,7 @@ var buildAddressEntry = (address, family) => resolveFamily(utils_default2.isObje
77009
80829
  var http2Transport = {
77010
80830
  request(options, cb) {
77011
80831
  const authority = options.protocol + "//" + options.hostname + ":" + (options.port || 80);
77012
- const { http2Options, headers: headers2 } = options;
80832
+ const { http2Options, headers } = options;
77013
80833
  const session = http2Sessions.getSession(authority, http2Options);
77014
80834
  const {
77015
80835
  HTTP2_HEADER_SCHEME,
@@ -77022,7 +80842,7 @@ var http2Transport = {
77022
80842
  [HTTP2_HEADER_METHOD]: options.method,
77023
80843
  [HTTP2_HEADER_PATH]: options.path
77024
80844
  };
77025
- utils_default2.forEach(headers2, (header, name) => {
80845
+ utils_default2.forEach(headers, (header, name) => {
77026
80846
  name.charAt(0) !== ":" && (http2Headers[name] = header);
77027
80847
  });
77028
80848
  const req = session.request(http2Headers);
@@ -77161,32 +80981,32 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
77161
80981
  config
77162
80982
  ));
77163
80983
  }
77164
- const headers2 = AxiosHeaders_default.from(config.headers).normalize();
77165
- headers2.set("User-Agent", "axios/" + VERSION, false);
80984
+ const headers = AxiosHeaders_default.from(config.headers).normalize();
80985
+ headers.set("User-Agent", "axios/" + VERSION, false);
77166
80986
  const { onUploadProgress, onDownloadProgress } = config;
77167
80987
  const maxRate = config.maxRate;
77168
80988
  let maxUploadRate = void 0;
77169
80989
  let maxDownloadRate = void 0;
77170
80990
  if (utils_default2.isSpecCompliantForm(data)) {
77171
- const userBoundary = headers2.getContentType(/boundary=([-_\w\d]{10,70})/i);
80991
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
77172
80992
  data = formDataToStream_default(data, (formHeaders) => {
77173
- headers2.set(formHeaders);
80993
+ headers.set(formHeaders);
77174
80994
  }, {
77175
80995
  tag: `axios-${VERSION}-boundary`,
77176
80996
  boundary: userBoundary && userBoundary[1] || void 0
77177
80997
  });
77178
80998
  } else if (utils_default2.isFormData(data) && utils_default2.isFunction(data.getHeaders)) {
77179
- headers2.set(data.getHeaders());
77180
- if (!headers2.hasContentLength()) {
80999
+ headers.set(data.getHeaders());
81000
+ if (!headers.hasContentLength()) {
77181
81001
  try {
77182
81002
  const knownLength = await import_util2.default.promisify(data.getLength).call(data);
77183
- Number.isFinite(knownLength) && knownLength >= 0 && headers2.setContentLength(knownLength);
81003
+ Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
77184
81004
  } catch (e) {
77185
81005
  }
77186
81006
  }
77187
81007
  } else if (utils_default2.isBlob(data) || utils_default2.isFile(data)) {
77188
- data.size && headers2.setContentType(data.type || "application/octet-stream");
77189
- headers2.setContentLength(data.size || 0);
81008
+ data.size && headers.setContentType(data.type || "application/octet-stream");
81009
+ headers.setContentLength(data.size || 0);
77190
81010
  data = import_stream4.default.Readable.from(readBlob_default(data));
77191
81011
  } else if (data && !utils_default2.isStream(data)) {
77192
81012
  if (Buffer.isBuffer(data)) {
@@ -77201,7 +81021,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
77201
81021
  config
77202
81022
  ));
77203
81023
  }
77204
- headers2.setContentLength(data.length, false);
81024
+ headers.setContentLength(data.length, false);
77205
81025
  if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
77206
81026
  return reject(new AxiosError_default(
77207
81027
  "Request body larger than maxBodyLength limit",
@@ -77210,7 +81030,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
77210
81030
  ));
77211
81031
  }
77212
81032
  }
77213
- const contentLength = utils_default2.toFiniteNumber(headers2.getContentLength());
81033
+ const contentLength = utils_default2.toFiniteNumber(headers.getContentLength());
77214
81034
  if (utils_default2.isArray(maxRate)) {
77215
81035
  maxUploadRate = maxRate[0];
77216
81036
  maxDownloadRate = maxRate[1];
@@ -77243,7 +81063,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
77243
81063
  const urlPassword = parsed.password;
77244
81064
  auth = urlUsername + ":" + urlPassword;
77245
81065
  }
77246
- auth && headers2.delete("authorization");
81066
+ auth && headers.delete("authorization");
77247
81067
  let path7;
77248
81068
  try {
77249
81069
  path7 = buildURL(
@@ -77258,7 +81078,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
77258
81078
  customErr.exists = true;
77259
81079
  return reject(customErr);
77260
81080
  }
77261
- headers2.set(
81081
+ headers.set(
77262
81082
  "Accept-Encoding",
77263
81083
  "gzip, compress, deflate" + (isBrotliSupported ? ", br" : ""),
77264
81084
  false
@@ -77266,7 +81086,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
77266
81086
  const options = {
77267
81087
  path: path7,
77268
81088
  method,
77269
- headers: headers2.toJSON(),
81089
+ headers: headers.toJSON(),
77270
81090
  agents: { http: config.httpAgent, https: config.httpsAgent },
77271
81091
  auth,
77272
81092
  protocol,
@@ -77625,24 +81445,24 @@ function mergeConfig(config1, config2) {
77625
81445
  // node_modules/axios/lib/helpers/resolveConfig.js
77626
81446
  var resolveConfig_default = (config) => {
77627
81447
  const newConfig = mergeConfig({}, config);
77628
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers: headers2, auth } = newConfig;
77629
- newConfig.headers = headers2 = AxiosHeaders_default.from(headers2);
81448
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
81449
+ newConfig.headers = headers = AxiosHeaders_default.from(headers);
77630
81450
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
77631
81451
  if (auth) {
77632
- headers2.set(
81452
+ headers.set(
77633
81453
  "Authorization",
77634
81454
  "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
77635
81455
  );
77636
81456
  }
77637
81457
  if (utils_default2.isFormData(data)) {
77638
81458
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
77639
- headers2.setContentType(void 0);
81459
+ headers.setContentType(void 0);
77640
81460
  } else if (utils_default2.isFunction(data.getHeaders)) {
77641
81461
  const formHeaders = data.getHeaders();
77642
81462
  const allowedHeaders = ["content-type", "content-length"];
77643
81463
  Object.entries(formHeaders).forEach(([key, val]) => {
77644
81464
  if (allowedHeaders.includes(key.toLowerCase())) {
77645
- headers2.set(key, val);
81465
+ headers.set(key, val);
77646
81466
  }
77647
81467
  });
77648
81468
  }
@@ -77652,7 +81472,7 @@ var resolveConfig_default = (config) => {
77652
81472
  if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(newConfig.url)) {
77653
81473
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
77654
81474
  if (xsrfValue) {
77655
- headers2.set(xsrfHeaderName, xsrfValue);
81475
+ headers.set(xsrfHeaderName, xsrfValue);
77656
81476
  }
77657
81477
  }
77658
81478
  }
@@ -77984,8 +81804,8 @@ var factory = (env2) => {
77984
81804
  return (await encodeText(body)).byteLength;
77985
81805
  }
77986
81806
  };
77987
- const resolveBodyLength = async (headers2, body) => {
77988
- const length = utils_default2.toFiniteNumber(headers2.getContentLength());
81807
+ const resolveBodyLength = async (headers, body) => {
81808
+ const length = utils_default2.toFiniteNumber(headers.getContentLength());
77989
81809
  return length == null ? getBodyLength(body) : length;
77990
81810
  };
77991
81811
  return async (config) => {
@@ -77999,7 +81819,7 @@ var factory = (env2) => {
77999
81819
  onDownloadProgress,
78000
81820
  onUploadProgress,
78001
81821
  responseType,
78002
- headers: headers2,
81822
+ headers,
78003
81823
  withCredentials = "same-origin",
78004
81824
  fetchOptions
78005
81825
  } = resolveConfig_default(config);
@@ -78012,7 +81832,7 @@ var factory = (env2) => {
78012
81832
  });
78013
81833
  let requestContentLength;
78014
81834
  try {
78015
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers2, data)) !== 0) {
81835
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
78016
81836
  let _request = new Request(url2, {
78017
81837
  method: "POST",
78018
81838
  body: data,
@@ -78020,7 +81840,7 @@ var factory = (env2) => {
78020
81840
  });
78021
81841
  let contentTypeHeader;
78022
81842
  if (utils_default2.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
78023
- headers2.setContentType(contentTypeHeader);
81843
+ headers.setContentType(contentTypeHeader);
78024
81844
  }
78025
81845
  if (_request.body) {
78026
81846
  const [onProgress, flush] = progressEventDecorator(
@@ -78038,7 +81858,7 @@ var factory = (env2) => {
78038
81858
  ...fetchOptions,
78039
81859
  signal: composedSignal,
78040
81860
  method: method.toUpperCase(),
78041
- headers: headers2.normalize().toJSON(),
81861
+ headers: headers.normalize().toJSON(),
78042
81862
  body: data,
78043
81863
  duplex: "half",
78044
81864
  credentials: isCredentialsSupported ? withCredentials : void 0
@@ -78331,7 +82151,7 @@ var Axios = class {
78331
82151
  config = configOrUrl || {};
78332
82152
  }
78333
82153
  config = mergeConfig(this.defaults, config);
78334
- const { transitional: transitional2, paramsSerializer, headers: headers2 } = config;
82154
+ const { transitional: transitional2, paramsSerializer, headers } = config;
78335
82155
  if (transitional2 !== void 0) {
78336
82156
  validator_default.assertOptions(transitional2, {
78337
82157
  silentJSONParsing: validators2.transitional(validators2.boolean),
@@ -78362,17 +82182,17 @@ var Axios = class {
78362
82182
  withXsrfToken: validators2.spelling("withXSRFToken")
78363
82183
  }, true);
78364
82184
  config.method = (config.method || this.defaults.method || "get").toLowerCase();
78365
- let contextHeaders = headers2 && utils_default2.merge(
78366
- headers2.common,
78367
- headers2[config.method]
82185
+ let contextHeaders = headers && utils_default2.merge(
82186
+ headers.common,
82187
+ headers[config.method]
78368
82188
  );
78369
- headers2 && utils_default2.forEach(
82189
+ headers && utils_default2.forEach(
78370
82190
  ["delete", "get", "head", "post", "put", "patch", "common"],
78371
82191
  (method) => {
78372
- delete headers2[method];
82192
+ delete headers[method];
78373
82193
  }
78374
82194
  );
78375
- config.headers = AxiosHeaders_default.concat(contextHeaders, headers2);
82195
+ config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
78376
82196
  const requestInterceptorChain = [];
78377
82197
  let synchronousRequestInterceptors = true;
78378
82198
  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
@@ -81799,40 +85619,6 @@ var InstallCommand = class {
81799
85619
  }
81800
85620
  };
81801
85621
 
81802
- // packages/kong-cli/src/services/managementClient.ts
81803
- var ManagementClient = class {
81804
- constructor(baseUrl, headerProvider2) {
81805
- this.headerProvider = headerProvider2;
81806
- this.baseUrl = joinUrlAndPath(baseUrl, "/api/management");
81807
- }
81808
- async updateExtension(extension) {
81809
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
81810
- await axios_default.put(url2, extension, await this.headerProvider());
81811
- }
81812
- async createExtensionSnapshot(extensionId, snapshot) {
81813
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
81814
- await axios_default.post(url2, snapshot, await this.headerProvider());
81815
- }
81816
- async getExtensionSnapshot(extensionName, extensionSnapshotVersion) {
81817
- const url2 = joinUrlAndPath(
81818
- this.baseUrl,
81819
- "v1/extensions",
81820
- extensionName,
81821
- "snapshots",
81822
- extensionSnapshotVersion
81823
- );
81824
- return (await axios_default.get(url2, await this.headerProvider())).data;
81825
- }
81826
- async getExtensionSnapshotVersions(extensionId) {
81827
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/snapshots/versions");
81828
- return (await axios_default.get(url2, await this.headerProvider())).data;
81829
- }
81830
- async getExtensionSnapshotAliases(extensionId) {
81831
- const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
81832
- return (await axios_default.get(url2, await this.headerProvider())).data;
81833
- }
81834
- };
81835
-
81836
85622
  // packages/kong-cli/src/services/api.ts
81837
85623
  var import_keyring2 = __toESM(require_keyring());
81838
85624
 
@@ -81893,20 +85679,15 @@ function jwtDecode(token, options) {
81893
85679
  }
81894
85680
 
81895
85681
  // packages/kong-cli/src/services/api.ts
81896
- var headers = {
81897
- headers: {
81898
- "Content-Type": "application/json"
81899
- }
81900
- };
81901
- async function provideHeaders(profile) {
81902
- if ("Authorization" in headers.headers) {
81903
- const auth = headers.headers.Authorization;
81904
- const access_token = auth.split("Bearer ")[1].trim();
81905
- const decoded = jwtDecode(access_token);
85682
+ async function provideRequestConfig(profile, cachedConfig) {
85683
+ if ("Authorization" in cachedConfig.headers) {
85684
+ const auth = cachedConfig.headers.Authorization;
85685
+ const accessToken = auth.split("Bearer ")[1].trim();
85686
+ const decoded = jwtDecode(accessToken);
81906
85687
  if (decoded.exp !== void 0) {
81907
85688
  const nowSeconds = Date.now() / 1e3;
81908
85689
  if (decoded.exp < nowSeconds - 30) {
81909
- return headers;
85690
+ return cachedConfig;
81910
85691
  }
81911
85692
  }
81912
85693
  }
@@ -81926,20 +85707,62 @@ async function provideHeaders(profile) {
81926
85707
  "Content-Type": "application/x-www-form-urlencoded"
81927
85708
  }
81928
85709
  })).data;
81929
- headers.headers["Authorization"] = `Bearer ${token.access_token}`;
81930
- headers.headers["X-App-Tenant"] = parseTenant(profile.kongBaseUrl);
81931
- return headers;
85710
+ cachedConfig.headers["Authorization"] = `Bearer ${token.access_token}`;
85711
+ cachedConfig.headers["X-App-Tenant"] = parseTenant(profile.kongBaseUrl);
85712
+ return cachedConfig;
81932
85713
  }
81933
- function headerProvider(profile) {
81934
- return async () => await provideHeaders(profile);
85714
+ function requestConfigProvider(profile) {
85715
+ const cached = {
85716
+ headers: {
85717
+ "Content-Type": "application/json"
85718
+ }
85719
+ };
85720
+ return async () => await provideRequestConfig(profile, cached);
81935
85721
  }
81936
85722
 
85723
+ // packages/kong-cli/src/services/managementClient.ts
85724
+ var ManagementClient = class {
85725
+ constructor(kongBaseUrl, requestConfigProvider2) {
85726
+ this.requestConfigProvider = requestConfigProvider2;
85727
+ this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/management");
85728
+ }
85729
+ async updateExtension(extension) {
85730
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions");
85731
+ await axios_default.put(url2, extension, await this.requestConfigProvider());
85732
+ }
85733
+ async createExtensionSnapshot(extensionId, snapshot) {
85734
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "snapshots");
85735
+ await axios_default.post(url2, snapshot, await this.requestConfigProvider());
85736
+ }
85737
+ async getExtensionSnapshot(extensionId, extensionSnapshotVersion) {
85738
+ const url2 = joinUrlAndPath(
85739
+ this.baseUrl,
85740
+ "v1/extensions",
85741
+ extensionId,
85742
+ "snapshots",
85743
+ extensionSnapshotVersion
85744
+ );
85745
+ return (await axios_default.get(url2, await this.requestConfigProvider())).data;
85746
+ }
85747
+ async getExtensionSnapshotVersions(extensionId) {
85748
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/snapshots/versions");
85749
+ return (await axios_default.get(url2, await this.requestConfigProvider())).data;
85750
+ }
85751
+ async getExtensionSnapshotAliases(extensionId) {
85752
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions", extensionId, "/aliases");
85753
+ return (await axios_default.get(url2, await this.requestConfigProvider())).data;
85754
+ }
85755
+ };
85756
+
81937
85757
  // packages/kong-cli/src/commands/listAliasesCommand.ts
81938
85758
  var ListAliasesCommand = class {
81939
85759
  constructor(profile, verbose) {
81940
85760
  this.profile = profile;
81941
85761
  this.verbose = verbose;
81942
- this.managementClient = new ManagementClient(this.profile.kongBaseUrl, headerProvider(profile));
85762
+ this.managementClient = new ManagementClient(
85763
+ this.profile.kongBaseUrl,
85764
+ requestConfigProvider(profile)
85765
+ );
81943
85766
  }
81944
85767
  async execute() {
81945
85768
  await new Listr(
@@ -81982,7 +85805,10 @@ var ListAliasesCommand = class {
81982
85805
  var ListVersionsCommand = class {
81983
85806
  constructor(profile, verbose) {
81984
85807
  this.verbose = verbose;
81985
- this.managementClient = new ManagementClient(profile.kongBaseUrl, headerProvider(profile));
85808
+ this.managementClient = new ManagementClient(
85809
+ profile.kongBaseUrl,
85810
+ requestConfigProvider(profile)
85811
+ );
81986
85812
  }
81987
85813
  async execute() {
81988
85814
  await new Listr(
@@ -82040,13 +85866,13 @@ function getExtensionContract(filePath) {
82040
85866
 
82041
85867
  // packages/kong-cli/src/services/registryClient.ts
82042
85868
  var RegistryClient = class {
82043
- constructor(baseUrl, headerProvider2) {
82044
- this.headerProvider = headerProvider2;
82045
- this.baseUrl = joinUrlAndPath(baseUrl, "/api/registry");
85869
+ constructor(kongBaseUrl, requestConfigProvider2) {
85870
+ this.requestConfigProvider = requestConfigProvider2;
85871
+ this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/registry");
82046
85872
  }
82047
85873
  async getPublishDetails(appName) {
82048
85874
  const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", appName, "publish/details");
82049
- return (await axios_default.post(url2, {}, await this.headerProvider())).data;
85875
+ return (await axios_default.post(url2, {}, await this.requestConfigProvider())).data;
82050
85876
  }
82051
85877
  };
82052
85878
 
@@ -82061,9 +85887,9 @@ var PublishVersionCommand = class {
82061
85887
  bottomBar: this.verbose ? Infinity : true,
82062
85888
  persistentOutput: true
82063
85889
  };
82064
- const clientHeaderProvider = headerProvider(profile);
82065
- this.registryClient = new RegistryClient(profile.kongBaseUrl, clientHeaderProvider);
82066
- this.managementClient = new ManagementClient(profile.kongBaseUrl, clientHeaderProvider);
85890
+ const clientRequestConfigProvider = requestConfigProvider(profile);
85891
+ this.registryClient = new RegistryClient(profile.kongBaseUrl, clientRequestConfigProvider);
85892
+ this.managementClient = new ManagementClient(profile.kongBaseUrl, clientRequestConfigProvider);
82067
85893
  const dockerVersion = (0, import_child_process3.spawnSync)("docker", ["--version"]);
82068
85894
  this.hasDocker = !dockerVersion.error;
82069
85895
  }
@@ -82214,13 +86040,13 @@ var PublishVersionCommand = class {
82214
86040
 
82215
86041
  // packages/kong-cli/src/services/publicClient.ts
82216
86042
  var PublicClient = class {
82217
- constructor(baseUrl, headerProvider2) {
82218
- this.headerProvider = headerProvider2;
82219
- this.baseUrl = joinUrlAndPath(baseUrl, "/api/public");
86043
+ constructor(kongBaseUrl, requestConfigProvider2) {
86044
+ this.requestConfigProvider = requestConfigProvider2;
86045
+ this.baseUrl = joinUrlAndPath(kongBaseUrl, "/api/public");
82220
86046
  }
82221
86047
  async assignExtensionAlias(extensionId, alias) {
82222
86048
  const url2 = joinUrlAndPath(this.baseUrl, `v1/extensions/${extensionId}/aliases`);
82223
- await axios_default.post(url2, alias, await this.headerProvider());
86049
+ await axios_default.post(url2, alias, await this.requestConfigProvider());
82224
86050
  }
82225
86051
  };
82226
86052
 
@@ -82238,7 +86064,7 @@ function validateName(value) {
82238
86064
  var SetAliasCommand = class {
82239
86065
  constructor(profile) {
82240
86066
  this.profile = profile;
82241
- const clientHeaderProvider = headerProvider(profile);
86067
+ const clientHeaderProvider = requestConfigProvider(profile);
82242
86068
  this.publicClient = new PublicClient(profile.kongBaseUrl, clientHeaderProvider);
82243
86069
  this.managementClient = new ManagementClient(profile.kongBaseUrl, clientHeaderProvider);
82244
86070
  }
@@ -82251,7 +86077,7 @@ var SetAliasCommand = class {
82251
86077
  task: async (ctx, task) => {
82252
86078
  ctx.kongJson = getKongJson();
82253
86079
  ctx.snapshot = await this.managementClient.getExtensionSnapshot(
82254
- ctx.kongJson.name,
86080
+ ctx.kongJson.id,
82255
86081
  extensionVersion
82256
86082
  );
82257
86083
  if (!ctx.snapshot || !ctx.snapshot.id) {
@@ -82427,6 +86253,9 @@ tmp/lib/tmp.js:
82427
86253
  * MIT Licensed
82428
86254
  *)
82429
86255
 
86256
+ axios/dist/node/axios.cjs:
86257
+ (*! Axios v1.13.2 Copyright (c) 2025 Matt Zabriskie and contributors *)
86258
+
82430
86259
  json-schema-faker/dist/vendor.js:
82431
86260
  (*!
82432
86261
  * JSON Schema $Ref Parser v6.1.0 (February 21st 2019)