pinme 2.0.10 → 2.0.11

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.
Files changed (3) hide show
  1. package/README.md +27 -0
  2. package/dist/index.js +908 -530
  3. package/package.json +22 -4
package/dist/index.js CHANGED
@@ -32,9 +32,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
32
  mod
33
33
  ));
34
34
 
35
- // node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json
35
+ // node_modules/dotenv/package.json
36
36
  var require_package = __commonJS({
37
- "node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json"(exports2, module2) {
37
+ "node_modules/dotenv/package.json"(exports2, module2) {
38
38
  module2.exports = {
39
39
  name: "dotenv",
40
40
  version: "16.5.0",
@@ -100,11 +100,11 @@ var require_package = __commonJS({
100
100
  }
101
101
  });
102
102
 
103
- // node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js
103
+ // node_modules/dotenv/lib/main.js
104
104
  var require_main = __commonJS({
105
- "node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js"(exports2, module2) {
106
- var fs18 = require("fs");
107
- var path19 = require("path");
105
+ "node_modules/dotenv/lib/main.js"(exports2, module2) {
106
+ var fs19 = require("fs");
107
+ var path20 = require("path");
108
108
  var os6 = require("os");
109
109
  var crypto3 = require("crypto");
110
110
  var packageJson = require_package();
@@ -207,7 +207,7 @@ var require_main = __commonJS({
207
207
  if (options && options.path && options.path.length > 0) {
208
208
  if (Array.isArray(options.path)) {
209
209
  for (const filepath of options.path) {
210
- if (fs18.existsSync(filepath)) {
210
+ if (fs19.existsSync(filepath)) {
211
211
  possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
212
212
  }
213
213
  }
@@ -215,15 +215,15 @@ var require_main = __commonJS({
215
215
  possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
216
216
  }
217
217
  } else {
218
- possibleVaultPath = path19.resolve(process.cwd(), ".env.vault");
218
+ possibleVaultPath = path20.resolve(process.cwd(), ".env.vault");
219
219
  }
220
- if (fs18.existsSync(possibleVaultPath)) {
220
+ if (fs19.existsSync(possibleVaultPath)) {
221
221
  return possibleVaultPath;
222
222
  }
223
223
  return null;
224
224
  }
225
225
  function _resolveHome(envPath) {
226
- return envPath[0] === "~" ? path19.join(os6.homedir(), envPath.slice(1)) : envPath;
226
+ return envPath[0] === "~" ? path20.join(os6.homedir(), envPath.slice(1)) : envPath;
227
227
  }
228
228
  function _configVault(options) {
229
229
  const debug = Boolean(options && options.debug);
@@ -239,7 +239,7 @@ var require_main = __commonJS({
239
239
  return { parsed };
240
240
  }
241
241
  function configDotenv(options) {
242
- const dotenvPath = path19.resolve(process.cwd(), ".env");
242
+ const dotenvPath = path20.resolve(process.cwd(), ".env");
243
243
  let encoding = "utf8";
244
244
  const debug = Boolean(options && options.debug);
245
245
  if (options && options.encoding) {
@@ -262,13 +262,13 @@ var require_main = __commonJS({
262
262
  }
263
263
  let lastError;
264
264
  const parsedAll = {};
265
- for (const path20 of optionPaths) {
265
+ for (const path21 of optionPaths) {
266
266
  try {
267
- const parsed = DotenvModule.parse(fs18.readFileSync(path20, { encoding }));
267
+ const parsed = DotenvModule.parse(fs19.readFileSync(path21, { encoding }));
268
268
  DotenvModule.populate(parsedAll, parsed, options);
269
269
  } catch (e) {
270
270
  if (debug) {
271
- _debug(`Failed to load ${path20} ${e.message}`);
271
+ _debug(`Failed to load ${path21} ${e.message}`);
272
272
  }
273
273
  lastError = e;
274
274
  }
@@ -367,19 +367,19 @@ var require_main = __commonJS({
367
367
  }
368
368
  });
369
369
 
370
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/bind.js
370
+ // node_modules/axios/lib/helpers/bind.js
371
371
  function bind(fn, thisArg) {
372
372
  return function wrap() {
373
373
  return fn.apply(thisArg, arguments);
374
374
  };
375
375
  }
376
376
  var init_bind = __esm({
377
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/bind.js"() {
377
+ "node_modules/axios/lib/helpers/bind.js"() {
378
378
  "use strict";
379
379
  }
380
380
  });
381
381
 
382
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/utils.js
382
+ // node_modules/axios/lib/utils.js
383
383
  function isBuffer(val) {
384
384
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
385
385
  }
@@ -453,7 +453,7 @@ function isSpecCompliantForm(thing) {
453
453
  }
454
454
  var toString, getPrototypeOf, kindOf, kindOfTest, typeOfTest, isArray, isUndefined, isArrayBuffer, isString, isFunction, isNumber, isObject, isBoolean, isPlainObject, isDate, isFile, isBlob, isFileList, isStream, isFormData, isURLSearchParams, trim, _global, isContextDefined, extend, stripBOM, inherits, toFlatObject, endsWith, toArray, isTypedArray, forEachEntry, matchAll, isHTMLForm, toCamelCase, hasOwnProperty, isRegExp, reduceDescriptors, freezeMethods, toObjectSet, noop, toFiniteNumber, ALPHA, DIGIT, ALPHABET, generateString, toJSONObject, utils_default;
455
455
  var init_utils = __esm({
456
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/utils.js"() {
456
+ "node_modules/axios/lib/utils.js"() {
457
457
  "use strict";
458
458
  init_bind();
459
459
  ({ toString } = Object.prototype);
@@ -733,7 +733,7 @@ var init_utils = __esm({
733
733
  }
734
734
  });
735
735
 
736
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/AxiosError.js
736
+ // node_modules/axios/lib/core/AxiosError.js
737
737
  function AxiosError(message, code, config, request, response) {
738
738
  Error.call(this);
739
739
  if (Error.captureStackTrace) {
@@ -750,7 +750,7 @@ function AxiosError(message, code, config, request, response) {
750
750
  }
751
751
  var prototype, descriptors, AxiosError_default;
752
752
  var init_AxiosError = __esm({
753
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/AxiosError.js"() {
753
+ "node_modules/axios/lib/core/AxiosError.js"() {
754
754
  "use strict";
755
755
  init_utils();
756
756
  utils_default.inherits(AxiosError, Error, {
@@ -812,25 +812,25 @@ var init_AxiosError = __esm({
812
812
  }
813
813
  });
814
814
 
815
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/node/classes/FormData.js
815
+ // node_modules/axios/lib/platform/node/classes/FormData.js
816
816
  var import_form_data, FormData_default;
817
817
  var init_FormData = __esm({
818
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/node/classes/FormData.js"() {
818
+ "node_modules/axios/lib/platform/node/classes/FormData.js"() {
819
819
  import_form_data = __toESM(require("form-data"), 1);
820
820
  FormData_default = import_form_data.default;
821
821
  }
822
822
  });
823
823
 
824
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/toFormData.js
824
+ // node_modules/axios/lib/helpers/toFormData.js
825
825
  function isVisitable(thing) {
826
826
  return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
827
827
  }
828
828
  function removeBrackets(key) {
829
829
  return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
830
830
  }
831
- function renderKey(path19, key, dots) {
832
- if (!path19) return key;
833
- return path19.concat(key).map(function each(token, i) {
831
+ function renderKey(path20, key, dots) {
832
+ if (!path20) return key;
833
+ return path20.concat(key).map(function each(token, i) {
834
834
  token = removeBrackets(token);
835
835
  return !dots && i ? "[" + token + "]" : token;
836
836
  }).join(dots ? "." : "");
@@ -872,9 +872,9 @@ function toFormData(obj, formData, options) {
872
872
  }
873
873
  return value;
874
874
  }
875
- function defaultVisitor(value, key, path19) {
875
+ function defaultVisitor(value, key, path20) {
876
876
  let arr = value;
877
- if (value && !path19 && typeof value === "object") {
877
+ if (value && !path20 && typeof value === "object") {
878
878
  if (utils_default.endsWith(key, "{}")) {
879
879
  key = metaTokens ? key : key.slice(0, -2);
880
880
  value = JSON.stringify(value);
@@ -893,7 +893,7 @@ function toFormData(obj, formData, options) {
893
893
  if (isVisitable(value)) {
894
894
  return true;
895
895
  }
896
- formData.append(renderKey(path19, key, dots), convertValue(value));
896
+ formData.append(renderKey(path20, key, dots), convertValue(value));
897
897
  return false;
898
898
  }
899
899
  const stack = [];
@@ -902,10 +902,10 @@ function toFormData(obj, formData, options) {
902
902
  convertValue,
903
903
  isVisitable
904
904
  });
905
- function build(value, path19) {
905
+ function build(value, path20) {
906
906
  if (utils_default.isUndefined(value)) return;
907
907
  if (stack.indexOf(value) !== -1) {
908
- throw Error("Circular reference detected in " + path19.join("."));
908
+ throw Error("Circular reference detected in " + path20.join("."));
909
909
  }
910
910
  stack.push(value);
911
911
  utils_default.forEach(value, function each(el, key) {
@@ -913,11 +913,11 @@ function toFormData(obj, formData, options) {
913
913
  formData,
914
914
  el,
915
915
  utils_default.isString(key) ? key.trim() : key,
916
- path19,
916
+ path20,
917
917
  exposedHelpers
918
918
  );
919
919
  if (result === true) {
920
- build(el, path19 ? path19.concat(key) : [key]);
920
+ build(el, path20 ? path20.concat(key) : [key]);
921
921
  }
922
922
  });
923
923
  stack.pop();
@@ -930,7 +930,7 @@ function toFormData(obj, formData, options) {
930
930
  }
931
931
  var predicates, toFormData_default;
932
932
  var init_toFormData = __esm({
933
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/toFormData.js"() {
933
+ "node_modules/axios/lib/helpers/toFormData.js"() {
934
934
  "use strict";
935
935
  init_utils();
936
936
  init_AxiosError();
@@ -942,7 +942,7 @@ var init_toFormData = __esm({
942
942
  }
943
943
  });
944
944
 
945
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/AxiosURLSearchParams.js
945
+ // node_modules/axios/lib/helpers/AxiosURLSearchParams.js
946
946
  function encode(str) {
947
947
  const charMap = {
948
948
  "!": "%21",
@@ -963,7 +963,7 @@ function AxiosURLSearchParams(params, options) {
963
963
  }
964
964
  var prototype2, AxiosURLSearchParams_default;
965
965
  var init_AxiosURLSearchParams = __esm({
966
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/AxiosURLSearchParams.js"() {
966
+ "node_modules/axios/lib/helpers/AxiosURLSearchParams.js"() {
967
967
  "use strict";
968
968
  init_toFormData();
969
969
  prototype2 = AxiosURLSearchParams.prototype;
@@ -982,7 +982,7 @@ var init_AxiosURLSearchParams = __esm({
982
982
  }
983
983
  });
984
984
 
985
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/buildURL.js
985
+ // node_modules/axios/lib/helpers/buildURL.js
986
986
  function encode2(val) {
987
987
  return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
988
988
  }
@@ -1008,17 +1008,17 @@ function buildURL(url2, params, options) {
1008
1008
  return url2;
1009
1009
  }
1010
1010
  var init_buildURL = __esm({
1011
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/buildURL.js"() {
1011
+ "node_modules/axios/lib/helpers/buildURL.js"() {
1012
1012
  "use strict";
1013
1013
  init_utils();
1014
1014
  init_AxiosURLSearchParams();
1015
1015
  }
1016
1016
  });
1017
1017
 
1018
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/InterceptorManager.js
1018
+ // node_modules/axios/lib/core/InterceptorManager.js
1019
1019
  var InterceptorManager, InterceptorManager_default;
1020
1020
  var init_InterceptorManager = __esm({
1021
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/InterceptorManager.js"() {
1021
+ "node_modules/axios/lib/core/InterceptorManager.js"() {
1022
1022
  "use strict";
1023
1023
  init_utils();
1024
1024
  InterceptorManager = class {
@@ -1086,10 +1086,10 @@ var init_InterceptorManager = __esm({
1086
1086
  }
1087
1087
  });
1088
1088
 
1089
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/defaults/transitional.js
1089
+ // node_modules/axios/lib/defaults/transitional.js
1090
1090
  var transitional_default;
1091
1091
  var init_transitional = __esm({
1092
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/defaults/transitional.js"() {
1092
+ "node_modules/axios/lib/defaults/transitional.js"() {
1093
1093
  "use strict";
1094
1094
  transitional_default = {
1095
1095
  silentJSONParsing: true,
@@ -1099,20 +1099,20 @@ var init_transitional = __esm({
1099
1099
  }
1100
1100
  });
1101
1101
 
1102
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/node/classes/URLSearchParams.js
1102
+ // node_modules/axios/lib/platform/node/classes/URLSearchParams.js
1103
1103
  var import_url, URLSearchParams_default;
1104
1104
  var init_URLSearchParams = __esm({
1105
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/node/classes/URLSearchParams.js"() {
1105
+ "node_modules/axios/lib/platform/node/classes/URLSearchParams.js"() {
1106
1106
  "use strict";
1107
1107
  import_url = __toESM(require("url"), 1);
1108
1108
  URLSearchParams_default = import_url.default.URLSearchParams;
1109
1109
  }
1110
1110
  });
1111
1111
 
1112
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/node/index.js
1112
+ // node_modules/axios/lib/platform/node/index.js
1113
1113
  var node_default;
1114
1114
  var init_node = __esm({
1115
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/node/index.js"() {
1115
+ "node_modules/axios/lib/platform/node/index.js"() {
1116
1116
  init_URLSearchParams();
1117
1117
  init_FormData();
1118
1118
  node_default = {
@@ -1127,17 +1127,17 @@ var init_node = __esm({
1127
1127
  }
1128
1128
  });
1129
1129
 
1130
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/index.js
1130
+ // node_modules/axios/lib/platform/index.js
1131
1131
  var init_platform = __esm({
1132
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/platform/index.js"() {
1132
+ "node_modules/axios/lib/platform/index.js"() {
1133
1133
  init_node();
1134
1134
  }
1135
1135
  });
1136
1136
 
1137
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/toURLEncodedForm.js
1137
+ // node_modules/axios/lib/helpers/toURLEncodedForm.js
1138
1138
  function toURLEncodedForm(data, options) {
1139
1139
  return toFormData_default(data, new node_default.classes.URLSearchParams(), Object.assign({
1140
- visitor: function(value, key, path19, helpers) {
1140
+ visitor: function(value, key, path20, helpers) {
1141
1141
  if (node_default.isNode && utils_default.isBuffer(value)) {
1142
1142
  this.append(key, value.toString("base64"));
1143
1143
  return false;
@@ -1147,7 +1147,7 @@ function toURLEncodedForm(data, options) {
1147
1147
  }, options));
1148
1148
  }
1149
1149
  var init_toURLEncodedForm = __esm({
1150
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/toURLEncodedForm.js"() {
1150
+ "node_modules/axios/lib/helpers/toURLEncodedForm.js"() {
1151
1151
  "use strict";
1152
1152
  init_utils();
1153
1153
  init_toFormData();
@@ -1155,7 +1155,7 @@ var init_toURLEncodedForm = __esm({
1155
1155
  }
1156
1156
  });
1157
1157
 
1158
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/formDataToJSON.js
1158
+ // node_modules/axios/lib/helpers/formDataToJSON.js
1159
1159
  function parsePropPath(name) {
1160
1160
  return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
1161
1161
  return match[0] === "[]" ? "" : match[1] || match[0];
@@ -1174,10 +1174,10 @@ function arrayToObject(arr) {
1174
1174
  return obj;
1175
1175
  }
1176
1176
  function formDataToJSON(formData) {
1177
- function buildPath(path19, value, target, index) {
1178
- let name = path19[index++];
1177
+ function buildPath(path20, value, target, index) {
1178
+ let name = path20[index++];
1179
1179
  const isNumericKey = Number.isFinite(+name);
1180
- const isLast = index >= path19.length;
1180
+ const isLast = index >= path20.length;
1181
1181
  name = !name && utils_default.isArray(target) ? target.length : name;
1182
1182
  if (isLast) {
1183
1183
  if (utils_default.hasOwnProp(target, name)) {
@@ -1190,7 +1190,7 @@ function formDataToJSON(formData) {
1190
1190
  if (!target[name] || !utils_default.isObject(target[name])) {
1191
1191
  target[name] = [];
1192
1192
  }
1193
- const result = buildPath(path19, value, target[name], index);
1193
+ const result = buildPath(path20, value, target[name], index);
1194
1194
  if (result && utils_default.isArray(target[name])) {
1195
1195
  target[name] = arrayToObject(target[name]);
1196
1196
  }
@@ -1207,14 +1207,14 @@ function formDataToJSON(formData) {
1207
1207
  }
1208
1208
  var formDataToJSON_default;
1209
1209
  var init_formDataToJSON = __esm({
1210
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/formDataToJSON.js"() {
1210
+ "node_modules/axios/lib/helpers/formDataToJSON.js"() {
1211
1211
  "use strict";
1212
1212
  init_utils();
1213
1213
  formDataToJSON_default = formDataToJSON;
1214
1214
  }
1215
1215
  });
1216
1216
 
1217
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/defaults/index.js
1217
+ // node_modules/axios/lib/defaults/index.js
1218
1218
  function stringifySafely(rawValue, parser, encoder) {
1219
1219
  if (utils_default.isString(rawValue)) {
1220
1220
  try {
@@ -1230,7 +1230,7 @@ function stringifySafely(rawValue, parser, encoder) {
1230
1230
  }
1231
1231
  var DEFAULT_CONTENT_TYPE, defaults, defaults_default;
1232
1232
  var init_defaults = __esm({
1233
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/defaults/index.js"() {
1233
+ "node_modules/axios/lib/defaults/index.js"() {
1234
1234
  "use strict";
1235
1235
  init_utils();
1236
1236
  init_AxiosError();
@@ -1341,10 +1341,10 @@ var init_defaults = __esm({
1341
1341
  }
1342
1342
  });
1343
1343
 
1344
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/parseHeaders.js
1344
+ // node_modules/axios/lib/helpers/parseHeaders.js
1345
1345
  var ignoreDuplicateOf, parseHeaders_default;
1346
1346
  var init_parseHeaders = __esm({
1347
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/parseHeaders.js"() {
1347
+ "node_modules/axios/lib/helpers/parseHeaders.js"() {
1348
1348
  "use strict";
1349
1349
  init_utils();
1350
1350
  ignoreDuplicateOf = utils_default.toObjectSet([
@@ -1393,7 +1393,7 @@ var init_parseHeaders = __esm({
1393
1393
  }
1394
1394
  });
1395
1395
 
1396
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/AxiosHeaders.js
1396
+ // node_modules/axios/lib/core/AxiosHeaders.js
1397
1397
  function normalizeHeader(header) {
1398
1398
  return header && String(header).trim().toLowerCase();
1399
1399
  }
@@ -1445,7 +1445,7 @@ function buildAccessors(obj, header) {
1445
1445
  }
1446
1446
  var $internals, AxiosHeaders, AxiosHeaders_default;
1447
1447
  var init_AxiosHeaders = __esm({
1448
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/AxiosHeaders.js"() {
1448
+ "node_modules/axios/lib/core/AxiosHeaders.js"() {
1449
1449
  "use strict";
1450
1450
  init_utils();
1451
1451
  init_parseHeaders();
@@ -1609,7 +1609,7 @@ var init_AxiosHeaders = __esm({
1609
1609
  }
1610
1610
  });
1611
1611
 
1612
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/transformData.js
1612
+ // node_modules/axios/lib/core/transformData.js
1613
1613
  function transformData(fns, response) {
1614
1614
  const config = this || defaults_default;
1615
1615
  const context = response || config;
@@ -1622,7 +1622,7 @@ function transformData(fns, response) {
1622
1622
  return data;
1623
1623
  }
1624
1624
  var init_transformData = __esm({
1625
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/transformData.js"() {
1625
+ "node_modules/axios/lib/core/transformData.js"() {
1626
1626
  "use strict";
1627
1627
  init_utils();
1628
1628
  init_defaults();
@@ -1630,24 +1630,24 @@ var init_transformData = __esm({
1630
1630
  }
1631
1631
  });
1632
1632
 
1633
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/cancel/isCancel.js
1633
+ // node_modules/axios/lib/cancel/isCancel.js
1634
1634
  function isCancel(value) {
1635
1635
  return !!(value && value.__CANCEL__);
1636
1636
  }
1637
1637
  var init_isCancel = __esm({
1638
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/cancel/isCancel.js"() {
1638
+ "node_modules/axios/lib/cancel/isCancel.js"() {
1639
1639
  "use strict";
1640
1640
  }
1641
1641
  });
1642
1642
 
1643
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/cancel/CanceledError.js
1643
+ // node_modules/axios/lib/cancel/CanceledError.js
1644
1644
  function CanceledError(message, config, request) {
1645
1645
  AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config, request);
1646
1646
  this.name = "CanceledError";
1647
1647
  }
1648
1648
  var CanceledError_default;
1649
1649
  var init_CanceledError = __esm({
1650
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/cancel/CanceledError.js"() {
1650
+ "node_modules/axios/lib/cancel/CanceledError.js"() {
1651
1651
  "use strict";
1652
1652
  init_AxiosError();
1653
1653
  init_utils();
@@ -1658,7 +1658,7 @@ var init_CanceledError = __esm({
1658
1658
  }
1659
1659
  });
1660
1660
 
1661
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/settle.js
1661
+ // node_modules/axios/lib/core/settle.js
1662
1662
  function settle(resolve, reject, response) {
1663
1663
  const validateStatus2 = response.config.validateStatus;
1664
1664
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
@@ -1674,33 +1674,33 @@ function settle(resolve, reject, response) {
1674
1674
  }
1675
1675
  }
1676
1676
  var init_settle = __esm({
1677
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/settle.js"() {
1677
+ "node_modules/axios/lib/core/settle.js"() {
1678
1678
  "use strict";
1679
1679
  init_AxiosError();
1680
1680
  }
1681
1681
  });
1682
1682
 
1683
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/isAbsoluteURL.js
1683
+ // node_modules/axios/lib/helpers/isAbsoluteURL.js
1684
1684
  function isAbsoluteURL(url2) {
1685
1685
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
1686
1686
  }
1687
1687
  var init_isAbsoluteURL = __esm({
1688
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/isAbsoluteURL.js"() {
1688
+ "node_modules/axios/lib/helpers/isAbsoluteURL.js"() {
1689
1689
  "use strict";
1690
1690
  }
1691
1691
  });
1692
1692
 
1693
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/combineURLs.js
1693
+ // node_modules/axios/lib/helpers/combineURLs.js
1694
1694
  function combineURLs(baseURL, relativeURL) {
1695
1695
  return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1696
1696
  }
1697
1697
  var init_combineURLs = __esm({
1698
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/combineURLs.js"() {
1698
+ "node_modules/axios/lib/helpers/combineURLs.js"() {
1699
1699
  "use strict";
1700
1700
  }
1701
1701
  });
1702
1702
 
1703
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/buildFullPath.js
1703
+ // node_modules/axios/lib/core/buildFullPath.js
1704
1704
  function buildFullPath(baseURL, requestedURL) {
1705
1705
  if (baseURL && !isAbsoluteURL(requestedURL)) {
1706
1706
  return combineURLs(baseURL, requestedURL);
@@ -1708,16 +1708,16 @@ function buildFullPath(baseURL, requestedURL) {
1708
1708
  return requestedURL;
1709
1709
  }
1710
1710
  var init_buildFullPath = __esm({
1711
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/buildFullPath.js"() {
1711
+ "node_modules/axios/lib/core/buildFullPath.js"() {
1712
1712
  "use strict";
1713
1713
  init_isAbsoluteURL();
1714
1714
  init_combineURLs();
1715
1715
  }
1716
1716
  });
1717
1717
 
1718
- // node_modules/.pnpm/proxy-from-env@1.1.0/node_modules/proxy-from-env/index.js
1718
+ // node_modules/proxy-from-env/index.js
1719
1719
  var require_proxy_from_env = __commonJS({
1720
- "node_modules/.pnpm/proxy-from-env@1.1.0/node_modules/proxy-from-env/index.js"(exports2) {
1720
+ "node_modules/proxy-from-env/index.js"(exports2) {
1721
1721
  "use strict";
1722
1722
  var parseUrl = require("url").parse;
1723
1723
  var DEFAULT_PORTS = {
@@ -1785,9 +1785,9 @@ var require_proxy_from_env = __commonJS({
1785
1785
  }
1786
1786
  });
1787
1787
 
1788
- // node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js
1788
+ // node_modules/ms/index.js
1789
1789
  var require_ms = __commonJS({
1790
- "node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js"(exports2, module2) {
1790
+ "node_modules/ms/index.js"(exports2, module2) {
1791
1791
  var s = 1e3;
1792
1792
  var m = s * 60;
1793
1793
  var h = m * 60;
@@ -1901,10 +1901,9 @@ var require_ms = __commonJS({
1901
1901
  }
1902
1902
  });
1903
1903
 
1904
- // node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/common.js
1904
+ // node_modules/debug/src/common.js
1905
1905
  var require_common = __commonJS({
1906
- "node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/common.js"(exports2, module2) {
1907
- "use strict";
1906
+ "node_modules/debug/src/common.js"(exports2, module2) {
1908
1907
  function setup(env) {
1909
1908
  createDebug.debug = createDebug;
1910
1909
  createDebug.default = createDebug;
@@ -1913,16 +1912,16 @@ var require_common = __commonJS({
1913
1912
  createDebug.enable = enable;
1914
1913
  createDebug.enabled = enabled;
1915
1914
  createDebug.humanize = require_ms();
1916
- Object.keys(env).forEach(function(key) {
1915
+ createDebug.destroy = destroy;
1916
+ Object.keys(env).forEach((key) => {
1917
1917
  createDebug[key] = env[key];
1918
1918
  });
1919
- createDebug.instances = [];
1920
1919
  createDebug.names = [];
1921
1920
  createDebug.skips = [];
1922
1921
  createDebug.formatters = {};
1923
1922
  function selectColor(namespace) {
1924
- var hash = 0;
1925
- for (var i = 0; i < namespace.length; i++) {
1923
+ let hash = 0;
1924
+ for (let i = 0; i < namespace.length; i++) {
1926
1925
  hash = (hash << 5) - hash + namespace.charCodeAt(i);
1927
1926
  hash |= 0;
1928
1927
  }
@@ -1930,17 +1929,17 @@ var require_common = __commonJS({
1930
1929
  }
1931
1930
  createDebug.selectColor = selectColor;
1932
1931
  function createDebug(namespace) {
1933
- var prevTime;
1934
- function debug() {
1932
+ let prevTime;
1933
+ let enableOverride = null;
1934
+ let namespacesCache;
1935
+ let enabledCache;
1936
+ function debug(...args) {
1935
1937
  if (!debug.enabled) {
1936
1938
  return;
1937
1939
  }
1938
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1939
- args[_key] = arguments[_key];
1940
- }
1941
- var self2 = debug;
1942
- var curr = Number(/* @__PURE__ */ new Date());
1943
- var ms = curr - (prevTime || curr);
1940
+ const self2 = debug;
1941
+ const curr = Number(/* @__PURE__ */ new Date());
1942
+ const ms = curr - (prevTime || curr);
1944
1943
  self2.diff = ms;
1945
1944
  self2.prev = prevTime;
1946
1945
  self2.curr = curr;
@@ -1949,15 +1948,15 @@ var require_common = __commonJS({
1949
1948
  if (typeof args[0] !== "string") {
1950
1949
  args.unshift("%O");
1951
1950
  }
1952
- var index = 0;
1953
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
1951
+ let index = 0;
1952
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
1954
1953
  if (match === "%%") {
1955
- return match;
1954
+ return "%";
1956
1955
  }
1957
1956
  index++;
1958
- var formatter = createDebug.formatters[format];
1957
+ const formatter = createDebug.formatters[format];
1959
1958
  if (typeof formatter === "function") {
1960
- var val = args[index];
1959
+ const val = args[index];
1961
1960
  match = formatter.call(self2, val);
1962
1961
  args.splice(index, 1);
1963
1962
  index--;
@@ -1965,71 +1964,99 @@ var require_common = __commonJS({
1965
1964
  return match;
1966
1965
  });
1967
1966
  createDebug.formatArgs.call(self2, args);
1968
- var logFn = self2.log || createDebug.log;
1967
+ const logFn = self2.log || createDebug.log;
1969
1968
  logFn.apply(self2, args);
1970
1969
  }
1971
1970
  debug.namespace = namespace;
1972
- debug.enabled = createDebug.enabled(namespace);
1973
1971
  debug.useColors = createDebug.useColors();
1974
- debug.color = selectColor(namespace);
1975
- debug.destroy = destroy;
1972
+ debug.color = createDebug.selectColor(namespace);
1976
1973
  debug.extend = extend2;
1974
+ debug.destroy = createDebug.destroy;
1975
+ Object.defineProperty(debug, "enabled", {
1976
+ enumerable: true,
1977
+ configurable: false,
1978
+ get: () => {
1979
+ if (enableOverride !== null) {
1980
+ return enableOverride;
1981
+ }
1982
+ if (namespacesCache !== createDebug.namespaces) {
1983
+ namespacesCache = createDebug.namespaces;
1984
+ enabledCache = createDebug.enabled(namespace);
1985
+ }
1986
+ return enabledCache;
1987
+ },
1988
+ set: (v) => {
1989
+ enableOverride = v;
1990
+ }
1991
+ });
1977
1992
  if (typeof createDebug.init === "function") {
1978
1993
  createDebug.init(debug);
1979
1994
  }
1980
- createDebug.instances.push(debug);
1981
1995
  return debug;
1982
1996
  }
1983
- function destroy() {
1984
- var index = createDebug.instances.indexOf(this);
1985
- if (index !== -1) {
1986
- createDebug.instances.splice(index, 1);
1987
- return true;
1988
- }
1989
- return false;
1990
- }
1991
1997
  function extend2(namespace, delimiter) {
1992
- return createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
1998
+ const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
1999
+ newDebug.log = this.log;
2000
+ return newDebug;
1993
2001
  }
1994
2002
  function enable(namespaces) {
1995
2003
  createDebug.save(namespaces);
2004
+ createDebug.namespaces = namespaces;
1996
2005
  createDebug.names = [];
1997
2006
  createDebug.skips = [];
1998
- var i;
1999
- var split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
2000
- var len = split.length;
2001
- for (i = 0; i < len; i++) {
2002
- if (!split[i]) {
2003
- continue;
2007
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
2008
+ for (const ns of split) {
2009
+ if (ns[0] === "-") {
2010
+ createDebug.skips.push(ns.slice(1));
2011
+ } else {
2012
+ createDebug.names.push(ns);
2004
2013
  }
2005
- namespaces = split[i].replace(/\*/g, ".*?");
2006
- if (namespaces[0] === "-") {
2007
- createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$"));
2014
+ }
2015
+ }
2016
+ function matchesTemplate(search, template) {
2017
+ let searchIndex = 0;
2018
+ let templateIndex = 0;
2019
+ let starIndex = -1;
2020
+ let matchIndex = 0;
2021
+ while (searchIndex < search.length) {
2022
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
2023
+ if (template[templateIndex] === "*") {
2024
+ starIndex = templateIndex;
2025
+ matchIndex = searchIndex;
2026
+ templateIndex++;
2027
+ } else {
2028
+ searchIndex++;
2029
+ templateIndex++;
2030
+ }
2031
+ } else if (starIndex !== -1) {
2032
+ templateIndex = starIndex + 1;
2033
+ matchIndex++;
2034
+ searchIndex = matchIndex;
2008
2035
  } else {
2009
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
2036
+ return false;
2010
2037
  }
2011
2038
  }
2012
- for (i = 0; i < createDebug.instances.length; i++) {
2013
- var instance = createDebug.instances[i];
2014
- instance.enabled = createDebug.enabled(instance.namespace);
2039
+ while (templateIndex < template.length && template[templateIndex] === "*") {
2040
+ templateIndex++;
2015
2041
  }
2042
+ return templateIndex === template.length;
2016
2043
  }
2017
2044
  function disable() {
2045
+ const namespaces = [
2046
+ ...createDebug.names,
2047
+ ...createDebug.skips.map((namespace) => "-" + namespace)
2048
+ ].join(",");
2018
2049
  createDebug.enable("");
2050
+ return namespaces;
2019
2051
  }
2020
2052
  function enabled(name) {
2021
- if (name[name.length - 1] === "*") {
2022
- return true;
2023
- }
2024
- var i;
2025
- var len;
2026
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
2027
- if (createDebug.skips[i].test(name)) {
2053
+ for (const skip of createDebug.skips) {
2054
+ if (matchesTemplate(name, skip)) {
2028
2055
  return false;
2029
2056
  }
2030
2057
  }
2031
- for (i = 0, len = createDebug.names.length; i < len; i++) {
2032
- if (createDebug.names[i].test(name)) {
2058
+ for (const ns of createDebug.names) {
2059
+ if (matchesTemplate(name, ns)) {
2033
2060
  return true;
2034
2061
  }
2035
2062
  }
@@ -2041,6 +2068,9 @@ var require_common = __commonJS({
2041
2068
  }
2042
2069
  return val;
2043
2070
  }
2071
+ function destroy() {
2072
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
2073
+ }
2044
2074
  createDebug.enable(createDebug.load());
2045
2075
  return createDebug;
2046
2076
  }
@@ -2048,29 +2078,101 @@ var require_common = __commonJS({
2048
2078
  }
2049
2079
  });
2050
2080
 
2051
- // node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/browser.js
2081
+ // node_modules/debug/src/browser.js
2052
2082
  var require_browser = __commonJS({
2053
- "node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/browser.js"(exports2, module2) {
2054
- "use strict";
2055
- function _typeof(obj) {
2056
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2057
- _typeof = function _typeof2(obj2) {
2058
- return typeof obj2;
2059
- };
2060
- } else {
2061
- _typeof = function _typeof2(obj2) {
2062
- return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
2063
- };
2064
- }
2065
- return _typeof(obj);
2066
- }
2067
- exports2.log = log;
2083
+ "node_modules/debug/src/browser.js"(exports2, module2) {
2068
2084
  exports2.formatArgs = formatArgs;
2069
2085
  exports2.save = save;
2070
2086
  exports2.load = load;
2071
2087
  exports2.useColors = useColors;
2072
2088
  exports2.storage = localstorage();
2073
- exports2.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"];
2089
+ exports2.destroy = /* @__PURE__ */ (() => {
2090
+ let warned = false;
2091
+ return () => {
2092
+ if (!warned) {
2093
+ warned = true;
2094
+ console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
2095
+ }
2096
+ };
2097
+ })();
2098
+ exports2.colors = [
2099
+ "#0000CC",
2100
+ "#0000FF",
2101
+ "#0033CC",
2102
+ "#0033FF",
2103
+ "#0066CC",
2104
+ "#0066FF",
2105
+ "#0099CC",
2106
+ "#0099FF",
2107
+ "#00CC00",
2108
+ "#00CC33",
2109
+ "#00CC66",
2110
+ "#00CC99",
2111
+ "#00CCCC",
2112
+ "#00CCFF",
2113
+ "#3300CC",
2114
+ "#3300FF",
2115
+ "#3333CC",
2116
+ "#3333FF",
2117
+ "#3366CC",
2118
+ "#3366FF",
2119
+ "#3399CC",
2120
+ "#3399FF",
2121
+ "#33CC00",
2122
+ "#33CC33",
2123
+ "#33CC66",
2124
+ "#33CC99",
2125
+ "#33CCCC",
2126
+ "#33CCFF",
2127
+ "#6600CC",
2128
+ "#6600FF",
2129
+ "#6633CC",
2130
+ "#6633FF",
2131
+ "#66CC00",
2132
+ "#66CC33",
2133
+ "#9900CC",
2134
+ "#9900FF",
2135
+ "#9933CC",
2136
+ "#9933FF",
2137
+ "#99CC00",
2138
+ "#99CC33",
2139
+ "#CC0000",
2140
+ "#CC0033",
2141
+ "#CC0066",
2142
+ "#CC0099",
2143
+ "#CC00CC",
2144
+ "#CC00FF",
2145
+ "#CC3300",
2146
+ "#CC3333",
2147
+ "#CC3366",
2148
+ "#CC3399",
2149
+ "#CC33CC",
2150
+ "#CC33FF",
2151
+ "#CC6600",
2152
+ "#CC6633",
2153
+ "#CC9900",
2154
+ "#CC9933",
2155
+ "#CCCC00",
2156
+ "#CCCC33",
2157
+ "#FF0000",
2158
+ "#FF0033",
2159
+ "#FF0066",
2160
+ "#FF0099",
2161
+ "#FF00CC",
2162
+ "#FF00FF",
2163
+ "#FF3300",
2164
+ "#FF3333",
2165
+ "#FF3366",
2166
+ "#FF3399",
2167
+ "#FF33CC",
2168
+ "#FF33FF",
2169
+ "#FF6600",
2170
+ "#FF6633",
2171
+ "#FF9900",
2172
+ "#FF9933",
2173
+ "#FFCC00",
2174
+ "#FFCC33"
2175
+ ];
2074
2176
  function useColors() {
2075
2177
  if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
2076
2178
  return true;
@@ -2078,10 +2180,11 @@ var require_browser = __commonJS({
2078
2180
  if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2079
2181
  return false;
2080
2182
  }
2183
+ let m;
2081
2184
  return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
2082
2185
  typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
2083
2186
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2084
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
2187
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
2085
2188
  typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
2086
2189
  }
2087
2190
  function formatArgs(args) {
@@ -2089,11 +2192,11 @@ var require_browser = __commonJS({
2089
2192
  if (!this.useColors) {
2090
2193
  return;
2091
2194
  }
2092
- var c = "color: " + this.color;
2195
+ const c = "color: " + this.color;
2093
2196
  args.splice(1, 0, c, "color: inherit");
2094
- var index = 0;
2095
- var lastC = 0;
2096
- args[0].replace(/%[a-zA-Z%]/g, function(match) {
2197
+ let index = 0;
2198
+ let lastC = 0;
2199
+ args[0].replace(/%[a-zA-Z%]/g, (match) => {
2097
2200
  if (match === "%%") {
2098
2201
  return;
2099
2202
  }
@@ -2104,10 +2207,8 @@ var require_browser = __commonJS({
2104
2207
  });
2105
2208
  args.splice(lastC, 0, c);
2106
2209
  }
2107
- function log() {
2108
- var _console;
2109
- return (typeof console === "undefined" ? "undefined" : _typeof(console)) === "object" && console.log && (_console = console).log.apply(_console, arguments);
2110
- }
2210
+ exports2.log = console.debug || console.log || (() => {
2211
+ });
2111
2212
  function save(namespaces) {
2112
2213
  try {
2113
2214
  if (namespaces) {
@@ -2119,9 +2220,9 @@ var require_browser = __commonJS({
2119
2220
  }
2120
2221
  }
2121
2222
  function load() {
2122
- var r;
2223
+ let r;
2123
2224
  try {
2124
- r = exports2.storage.getItem("debug");
2225
+ r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
2125
2226
  } catch (error) {
2126
2227
  }
2127
2228
  if (!r && typeof process !== "undefined" && "env" in process) {
@@ -2136,7 +2237,7 @@ var require_browser = __commonJS({
2136
2237
  }
2137
2238
  }
2138
2239
  module2.exports = require_common()(exports2);
2139
- var formatters = module2.exports.formatters;
2240
+ var { formatters } = module2.exports;
2140
2241
  formatters.j = function(v) {
2141
2242
  try {
2142
2243
  return JSON.stringify(v);
@@ -2147,9 +2248,9 @@ var require_browser = __commonJS({
2147
2248
  }
2148
2249
  });
2149
2250
 
2150
- // node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js
2251
+ // node_modules/has-flag/index.js
2151
2252
  var require_has_flag = __commonJS({
2152
- "node_modules/.pnpm/has-flag@3.0.0/node_modules/has-flag/index.js"(exports2, module2) {
2253
+ "node_modules/has-flag/index.js"(exports2, module2) {
2153
2254
  "use strict";
2154
2255
  module2.exports = (flag, argv) => {
2155
2256
  argv = argv || process.argv;
@@ -2161,9 +2262,9 @@ var require_has_flag = __commonJS({
2161
2262
  }
2162
2263
  });
2163
2264
 
2164
- // node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js
2265
+ // node_modules/supports-color/index.js
2165
2266
  var require_supports_color = __commonJS({
2166
- "node_modules/.pnpm/supports-color@5.5.0/node_modules/supports-color/index.js"(exports2, module2) {
2267
+ "node_modules/supports-color/index.js"(exports2, module2) {
2167
2268
  "use strict";
2168
2269
  var os6 = require("os");
2169
2270
  var hasFlag = require_has_flag();
@@ -2256,10 +2357,9 @@ var require_supports_color = __commonJS({
2256
2357
  }
2257
2358
  });
2258
2359
 
2259
- // node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/node.js
2360
+ // node_modules/debug/src/node.js
2260
2361
  var require_node = __commonJS({
2261
- "node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/node.js"(exports2, module2) {
2262
- "use strict";
2362
+ "node_modules/debug/src/node.js"(exports2, module2) {
2263
2363
  var tty = require("tty");
2264
2364
  var util2 = require("util");
2265
2365
  exports2.init = init;
@@ -2268,22 +2368,103 @@ var require_node = __commonJS({
2268
2368
  exports2.save = save;
2269
2369
  exports2.load = load;
2270
2370
  exports2.useColors = useColors;
2371
+ exports2.destroy = util2.deprecate(
2372
+ () => {
2373
+ },
2374
+ "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
2375
+ );
2271
2376
  exports2.colors = [6, 2, 3, 4, 5, 1];
2272
2377
  try {
2273
- supportsColor = require_supports_color();
2378
+ const supportsColor = require_supports_color();
2274
2379
  if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
2275
- exports2.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
2380
+ exports2.colors = [
2381
+ 20,
2382
+ 21,
2383
+ 26,
2384
+ 27,
2385
+ 32,
2386
+ 33,
2387
+ 38,
2388
+ 39,
2389
+ 40,
2390
+ 41,
2391
+ 42,
2392
+ 43,
2393
+ 44,
2394
+ 45,
2395
+ 56,
2396
+ 57,
2397
+ 62,
2398
+ 63,
2399
+ 68,
2400
+ 69,
2401
+ 74,
2402
+ 75,
2403
+ 76,
2404
+ 77,
2405
+ 78,
2406
+ 79,
2407
+ 80,
2408
+ 81,
2409
+ 92,
2410
+ 93,
2411
+ 98,
2412
+ 99,
2413
+ 112,
2414
+ 113,
2415
+ 128,
2416
+ 129,
2417
+ 134,
2418
+ 135,
2419
+ 148,
2420
+ 149,
2421
+ 160,
2422
+ 161,
2423
+ 162,
2424
+ 163,
2425
+ 164,
2426
+ 165,
2427
+ 166,
2428
+ 167,
2429
+ 168,
2430
+ 169,
2431
+ 170,
2432
+ 171,
2433
+ 172,
2434
+ 173,
2435
+ 178,
2436
+ 179,
2437
+ 184,
2438
+ 185,
2439
+ 196,
2440
+ 197,
2441
+ 198,
2442
+ 199,
2443
+ 200,
2444
+ 201,
2445
+ 202,
2446
+ 203,
2447
+ 204,
2448
+ 205,
2449
+ 206,
2450
+ 207,
2451
+ 208,
2452
+ 209,
2453
+ 214,
2454
+ 215,
2455
+ 220,
2456
+ 221
2457
+ ];
2276
2458
  }
2277
2459
  } catch (error) {
2278
2460
  }
2279
- var supportsColor;
2280
- exports2.inspectOpts = Object.keys(process.env).filter(function(key) {
2461
+ exports2.inspectOpts = Object.keys(process.env).filter((key) => {
2281
2462
  return /^debug_/i.test(key);
2282
- }).reduce(function(obj, key) {
2283
- var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function(_, k) {
2463
+ }).reduce((obj, key) => {
2464
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
2284
2465
  return k.toUpperCase();
2285
2466
  });
2286
- var val = process.env[key];
2467
+ let val = process.env[key];
2287
2468
  if (/^(yes|on|true|enabled)$/i.test(val)) {
2288
2469
  val = true;
2289
2470
  } else if (/^(no|off|false|disabled)$/i.test(val)) {
@@ -2300,11 +2481,11 @@ var require_node = __commonJS({
2300
2481
  return "colors" in exports2.inspectOpts ? Boolean(exports2.inspectOpts.colors) : tty.isatty(process.stderr.fd);
2301
2482
  }
2302
2483
  function formatArgs(args) {
2303
- var name = this.namespace, useColors2 = this.useColors;
2484
+ const { namespace: name, useColors: useColors2 } = this;
2304
2485
  if (useColors2) {
2305
- var c = this.color;
2306
- var colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
2307
- var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
2486
+ const c = this.color;
2487
+ const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
2488
+ const prefix = ` ${colorCode};1m${name} \x1B[0m`;
2308
2489
  args[0] = prefix + args[0].split("\n").join("\n" + prefix);
2309
2490
  args.push(colorCode + "m+" + module2.exports.humanize(this.diff) + "\x1B[0m");
2310
2491
  } else {
@@ -2317,8 +2498,8 @@ var require_node = __commonJS({
2317
2498
  }
2318
2499
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
2319
2500
  }
2320
- function log() {
2321
- return process.stderr.write(util2.format.apply(util2, arguments) + "\n");
2501
+ function log(...args) {
2502
+ return process.stderr.write(util2.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
2322
2503
  }
2323
2504
  function save(namespaces) {
2324
2505
  if (namespaces) {
@@ -2332,18 +2513,16 @@ var require_node = __commonJS({
2332
2513
  }
2333
2514
  function init(debug) {
2334
2515
  debug.inspectOpts = {};
2335
- var keys = Object.keys(exports2.inspectOpts);
2336
- for (var i = 0; i < keys.length; i++) {
2516
+ const keys = Object.keys(exports2.inspectOpts);
2517
+ for (let i = 0; i < keys.length; i++) {
2337
2518
  debug.inspectOpts[keys[i]] = exports2.inspectOpts[keys[i]];
2338
2519
  }
2339
2520
  }
2340
2521
  module2.exports = require_common()(exports2);
2341
- var formatters = module2.exports.formatters;
2522
+ var { formatters } = module2.exports;
2342
2523
  formatters.o = function(v) {
2343
2524
  this.inspectOpts.colors = this.useColors;
2344
- return util2.inspect(v, this.inspectOpts).split("\n").map(function(str) {
2345
- return str.trim();
2346
- }).join(" ");
2525
+ return util2.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
2347
2526
  };
2348
2527
  formatters.O = function(v) {
2349
2528
  this.inspectOpts.colors = this.useColors;
@@ -2352,10 +2531,9 @@ var require_node = __commonJS({
2352
2531
  }
2353
2532
  });
2354
2533
 
2355
- // node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/index.js
2534
+ // node_modules/debug/src/index.js
2356
2535
  var require_src = __commonJS({
2357
- "node_modules/.pnpm/debug@3.2.7/node_modules/debug/src/index.js"(exports2, module2) {
2358
- "use strict";
2536
+ "node_modules/debug/src/index.js"(exports2, module2) {
2359
2537
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
2360
2538
  module2.exports = require_browser();
2361
2539
  } else {
@@ -2364,9 +2542,9 @@ var require_src = __commonJS({
2364
2542
  }
2365
2543
  });
2366
2544
 
2367
- // node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/debug.js
2545
+ // node_modules/follow-redirects/debug.js
2368
2546
  var require_debug = __commonJS({
2369
- "node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/debug.js"(exports2, module2) {
2547
+ "node_modules/follow-redirects/debug.js"(exports2, module2) {
2370
2548
  var debug;
2371
2549
  module2.exports = function() {
2372
2550
  if (!debug) {
@@ -2384,9 +2562,9 @@ var require_debug = __commonJS({
2384
2562
  }
2385
2563
  });
2386
2564
 
2387
- // node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js
2565
+ // node_modules/follow-redirects/index.js
2388
2566
  var require_follow_redirects = __commonJS({
2389
- "node_modules/.pnpm/follow-redirects@1.15.2/node_modules/follow-redirects/index.js"(exports2, module2) {
2567
+ "node_modules/follow-redirects/index.js"(exports2, module2) {
2390
2568
  var url2 = require("url");
2391
2569
  var URL3 = url2.URL;
2392
2570
  var http3 = require("http");
@@ -2394,6 +2572,33 @@ var require_follow_redirects = __commonJS({
2394
2572
  var Writable = require("stream").Writable;
2395
2573
  var assert = require("assert");
2396
2574
  var debug = require_debug();
2575
+ (function detectUnsupportedEnvironment() {
2576
+ var looksLikeNode = typeof process !== "undefined";
2577
+ var looksLikeBrowser = typeof window !== "undefined" && typeof document !== "undefined";
2578
+ var looksLikeV8 = isFunction2(Error.captureStackTrace);
2579
+ if (!looksLikeNode && (looksLikeBrowser || !looksLikeV8)) {
2580
+ console.warn("The follow-redirects package should be excluded from browser builds.");
2581
+ }
2582
+ })();
2583
+ var useNativeURL = false;
2584
+ try {
2585
+ assert(new URL3(""));
2586
+ } catch (error) {
2587
+ useNativeURL = error.code === "ERR_INVALID_URL";
2588
+ }
2589
+ var preservedUrlFields = [
2590
+ "auth",
2591
+ "host",
2592
+ "hostname",
2593
+ "href",
2594
+ "path",
2595
+ "pathname",
2596
+ "port",
2597
+ "protocol",
2598
+ "query",
2599
+ "search",
2600
+ "hash"
2601
+ ];
2397
2602
  var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
2398
2603
  var eventHandlers = /* @__PURE__ */ Object.create(null);
2399
2604
  events.forEach(function(event) {
@@ -2412,7 +2617,8 @@ var require_follow_redirects = __commonJS({
2412
2617
  );
2413
2618
  var TooManyRedirectsError = createErrorType(
2414
2619
  "ERR_FR_TOO_MANY_REDIRECTS",
2415
- "Maximum number of redirects exceeded"
2620
+ "Maximum number of redirects exceeded",
2621
+ RedirectionError
2416
2622
  );
2417
2623
  var MaxBodyLengthExceededError = createErrorType(
2418
2624
  "ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
@@ -2422,6 +2628,7 @@ var require_follow_redirects = __commonJS({
2422
2628
  "ERR_STREAM_WRITE_AFTER_END",
2423
2629
  "write after end"
2424
2630
  );
2631
+ var destroy = Writable.prototype.destroy || noop2;
2425
2632
  function RedirectableRequest(options, responseCallback) {
2426
2633
  Writable.call(this);
2427
2634
  this._sanitizeOptions(options);
@@ -2437,15 +2644,25 @@ var require_follow_redirects = __commonJS({
2437
2644
  }
2438
2645
  var self2 = this;
2439
2646
  this._onNativeResponse = function(response) {
2440
- self2._processResponse(response);
2647
+ try {
2648
+ self2._processResponse(response);
2649
+ } catch (cause) {
2650
+ self2.emit("error", cause instanceof RedirectionError ? cause : new RedirectionError({ cause }));
2651
+ }
2441
2652
  };
2442
2653
  this._performRequest();
2443
2654
  }
2444
2655
  RedirectableRequest.prototype = Object.create(Writable.prototype);
2445
2656
  RedirectableRequest.prototype.abort = function() {
2446
- abortRequest(this._currentRequest);
2657
+ destroyRequest(this._currentRequest);
2658
+ this._currentRequest.abort();
2447
2659
  this.emit("abort");
2448
2660
  };
2661
+ RedirectableRequest.prototype.destroy = function(error) {
2662
+ destroyRequest(this._currentRequest, error);
2663
+ destroy.call(this, error);
2664
+ return this;
2665
+ };
2449
2666
  RedirectableRequest.prototype.write = function(data, encoding, callback) {
2450
2667
  if (this._ending) {
2451
2668
  throw new WriteAfterEndError();
@@ -2526,6 +2743,7 @@ var require_follow_redirects = __commonJS({
2526
2743
  self2.removeListener("abort", clearTimer);
2527
2744
  self2.removeListener("error", clearTimer);
2528
2745
  self2.removeListener("response", clearTimer);
2746
+ self2.removeListener("close", clearTimer);
2529
2747
  if (callback) {
2530
2748
  self2.removeListener("timeout", callback);
2531
2749
  }
@@ -2545,6 +2763,7 @@ var require_follow_redirects = __commonJS({
2545
2763
  this.on("abort", clearTimer);
2546
2764
  this.on("error", clearTimer);
2547
2765
  this.on("response", clearTimer);
2766
+ this.on("close", clearTimer);
2548
2767
  return this;
2549
2768
  };
2550
2769
  [
@@ -2588,8 +2807,7 @@ var require_follow_redirects = __commonJS({
2588
2807
  var protocol = this._options.protocol;
2589
2808
  var nativeProtocol = this._options.nativeProtocols[protocol];
2590
2809
  if (!nativeProtocol) {
2591
- this.emit("error", new TypeError("Unsupported protocol " + protocol));
2592
- return;
2810
+ throw new TypeError("Unsupported protocol " + protocol);
2593
2811
  }
2594
2812
  if (this._options.agents) {
2595
2813
  var scheme = protocol.slice(0, -1);
@@ -2642,11 +2860,10 @@ var require_follow_redirects = __commonJS({
2642
2860
  this._requestBodyBuffers = [];
2643
2861
  return;
2644
2862
  }
2645
- abortRequest(this._currentRequest);
2863
+ destroyRequest(this._currentRequest);
2646
2864
  response.destroy();
2647
2865
  if (++this._redirectCount > this._options.maxRedirects) {
2648
- this.emit("error", new TooManyRedirectsError());
2649
- return;
2866
+ throw new TooManyRedirectsError();
2650
2867
  }
2651
2868
  var requestHeaders;
2652
2869
  var beforeRedirect = this._options.beforeRedirect;
@@ -2667,22 +2884,15 @@ var require_follow_redirects = __commonJS({
2667
2884
  removeMatchingHeaders(/^content-/i, this._options.headers);
2668
2885
  }
2669
2886
  var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
2670
- var currentUrlParts = url2.parse(this._currentUrl);
2887
+ var currentUrlParts = parseUrl(this._currentUrl);
2671
2888
  var currentHost = currentHostHeader || currentUrlParts.host;
2672
2889
  var currentUrl = /^\w+:/.test(location) ? this._currentUrl : url2.format(Object.assign(currentUrlParts, { host: currentHost }));
2673
- var redirectUrl;
2674
- try {
2675
- redirectUrl = url2.resolve(currentUrl, location);
2676
- } catch (cause) {
2677
- this.emit("error", new RedirectionError({ cause }));
2678
- return;
2679
- }
2680
- debug("redirecting to", redirectUrl);
2890
+ var redirectUrl = resolveUrl(location, currentUrl);
2891
+ debug("redirecting to", redirectUrl.href);
2681
2892
  this._isRedirect = true;
2682
- var redirectUrlParts = url2.parse(redirectUrl);
2683
- Object.assign(this._options, redirectUrlParts);
2684
- if (redirectUrlParts.protocol !== currentUrlParts.protocol && redirectUrlParts.protocol !== "https:" || redirectUrlParts.host !== currentHost && !isSubdomain(redirectUrlParts.host, currentHost)) {
2685
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
2893
+ spreadUrlObject(redirectUrl, this._options);
2894
+ if (redirectUrl.protocol !== currentUrlParts.protocol && redirectUrl.protocol !== "https:" || redirectUrl.host !== currentHost && !isSubdomain(redirectUrl.host, currentHost)) {
2895
+ removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers);
2686
2896
  }
2687
2897
  if (isFunction2(beforeRedirect)) {
2688
2898
  var responseDetails = {
@@ -2694,19 +2904,10 @@ var require_follow_redirects = __commonJS({
2694
2904
  method,
2695
2905
  headers: requestHeaders
2696
2906
  };
2697
- try {
2698
- beforeRedirect(this._options, responseDetails, requestDetails);
2699
- } catch (err) {
2700
- this.emit("error", err);
2701
- return;
2702
- }
2907
+ beforeRedirect(this._options, responseDetails, requestDetails);
2703
2908
  this._sanitizeOptions(this._options);
2704
2909
  }
2705
- try {
2706
- this._performRequest();
2707
- } catch (cause) {
2708
- this.emit("error", new RedirectionError({ cause }));
2709
- }
2910
+ this._performRequest();
2710
2911
  };
2711
2912
  function wrap(protocols) {
2712
2913
  var exports3 = {
@@ -2719,22 +2920,13 @@ var require_follow_redirects = __commonJS({
2719
2920
  var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
2720
2921
  var wrappedProtocol = exports3[scheme] = Object.create(nativeProtocol);
2721
2922
  function request(input, options, callback) {
2722
- if (isString2(input)) {
2723
- var parsed;
2724
- try {
2725
- parsed = urlToOptions(new URL3(input));
2726
- } catch (err) {
2727
- parsed = url2.parse(input);
2728
- }
2729
- if (!isString2(parsed.protocol)) {
2730
- throw new InvalidUrlError({ input });
2731
- }
2732
- input = parsed;
2733
- } else if (URL3 && input instanceof URL3) {
2734
- input = urlToOptions(input);
2923
+ if (isURL(input)) {
2924
+ input = spreadUrlObject(input);
2925
+ } else if (isString2(input)) {
2926
+ input = spreadUrlObject(parseUrl(input));
2735
2927
  } else {
2736
2928
  callback = options;
2737
- options = input;
2929
+ options = validateUrl(input);
2738
2930
  input = { protocol };
2739
2931
  }
2740
2932
  if (isFunction2(options)) {
@@ -2767,23 +2959,43 @@ var require_follow_redirects = __commonJS({
2767
2959
  }
2768
2960
  function noop2() {
2769
2961
  }
2770
- function urlToOptions(urlObject) {
2771
- var options = {
2772
- protocol: urlObject.protocol,
2773
- hostname: urlObject.hostname.startsWith("[") ? (
2774
- /* istanbul ignore next */
2775
- urlObject.hostname.slice(1, -1)
2776
- ) : urlObject.hostname,
2777
- hash: urlObject.hash,
2778
- search: urlObject.search,
2779
- pathname: urlObject.pathname,
2780
- path: urlObject.pathname + urlObject.search,
2781
- href: urlObject.href
2782
- };
2783
- if (urlObject.port !== "") {
2784
- options.port = Number(urlObject.port);
2962
+ function parseUrl(input) {
2963
+ var parsed;
2964
+ if (useNativeURL) {
2965
+ parsed = new URL3(input);
2966
+ } else {
2967
+ parsed = validateUrl(url2.parse(input));
2968
+ if (!isString2(parsed.protocol)) {
2969
+ throw new InvalidUrlError({ input });
2970
+ }
2785
2971
  }
2786
- return options;
2972
+ return parsed;
2973
+ }
2974
+ function resolveUrl(relative, base) {
2975
+ return useNativeURL ? new URL3(relative, base) : parseUrl(url2.resolve(base, relative));
2976
+ }
2977
+ function validateUrl(input) {
2978
+ if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) {
2979
+ throw new InvalidUrlError({ input: input.href || input });
2980
+ }
2981
+ if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) {
2982
+ throw new InvalidUrlError({ input: input.href || input });
2983
+ }
2984
+ return input;
2985
+ }
2986
+ function spreadUrlObject(urlObject, target) {
2987
+ var spread3 = target || {};
2988
+ for (var key of preservedUrlFields) {
2989
+ spread3[key] = urlObject[key];
2990
+ }
2991
+ if (spread3.hostname.startsWith("[")) {
2992
+ spread3.hostname = spread3.hostname.slice(1, -1);
2993
+ }
2994
+ if (spread3.port !== "") {
2995
+ spread3.port = Number(spread3.port);
2996
+ }
2997
+ spread3.path = spread3.search ? spread3.pathname + spread3.search : spread3.pathname;
2998
+ return spread3;
2787
2999
  }
2788
3000
  function removeMatchingHeaders(regex, headers) {
2789
3001
  var lastValue;
@@ -2797,22 +3009,32 @@ var require_follow_redirects = __commonJS({
2797
3009
  }
2798
3010
  function createErrorType(code, message, baseClass) {
2799
3011
  function CustomError(properties) {
2800
- Error.captureStackTrace(this, this.constructor);
3012
+ if (isFunction2(Error.captureStackTrace)) {
3013
+ Error.captureStackTrace(this, this.constructor);
3014
+ }
2801
3015
  Object.assign(this, properties || {});
2802
3016
  this.code = code;
2803
3017
  this.message = this.cause ? message + ": " + this.cause.message : message;
2804
3018
  }
2805
3019
  CustomError.prototype = new (baseClass || Error)();
2806
- CustomError.prototype.constructor = CustomError;
2807
- CustomError.prototype.name = "Error [" + code + "]";
3020
+ Object.defineProperties(CustomError.prototype, {
3021
+ constructor: {
3022
+ value: CustomError,
3023
+ enumerable: false
3024
+ },
3025
+ name: {
3026
+ value: "Error [" + code + "]",
3027
+ enumerable: false
3028
+ }
3029
+ });
2808
3030
  return CustomError;
2809
3031
  }
2810
- function abortRequest(request) {
3032
+ function destroyRequest(request, error) {
2811
3033
  for (var event of events) {
2812
3034
  request.removeListener(event, eventHandlers[event]);
2813
3035
  }
2814
3036
  request.on("error", noop2);
2815
- request.abort();
3037
+ request.destroy(error);
2816
3038
  }
2817
3039
  function isSubdomain(subdomain, domain) {
2818
3040
  assert(isString2(subdomain) && isString2(domain));
@@ -2828,31 +3050,34 @@ var require_follow_redirects = __commonJS({
2828
3050
  function isBuffer2(value) {
2829
3051
  return typeof value === "object" && "length" in value;
2830
3052
  }
3053
+ function isURL(value) {
3054
+ return URL3 && value instanceof URL3;
3055
+ }
2831
3056
  module2.exports = wrap({ http: http3, https: https2 });
2832
3057
  module2.exports.wrap = wrap;
2833
3058
  }
2834
3059
  });
2835
3060
 
2836
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/env/data.js
3061
+ // node_modules/axios/lib/env/data.js
2837
3062
  var VERSION;
2838
3063
  var init_data = __esm({
2839
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/env/data.js"() {
3064
+ "node_modules/axios/lib/env/data.js"() {
2840
3065
  VERSION = "1.3.2";
2841
3066
  }
2842
3067
  });
2843
3068
 
2844
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/parseProtocol.js
3069
+ // node_modules/axios/lib/helpers/parseProtocol.js
2845
3070
  function parseProtocol(url2) {
2846
3071
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
2847
3072
  return match && match[1] || "";
2848
3073
  }
2849
3074
  var init_parseProtocol = __esm({
2850
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/parseProtocol.js"() {
3075
+ "node_modules/axios/lib/helpers/parseProtocol.js"() {
2851
3076
  "use strict";
2852
3077
  }
2853
3078
  });
2854
3079
 
2855
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/fromDataURI.js
3080
+ // node_modules/axios/lib/helpers/fromDataURI.js
2856
3081
  function fromDataURI(uri, asBlob, options) {
2857
3082
  const _Blob = options && options.Blob || node_default.classes.Blob;
2858
3083
  const protocol = parseProtocol(uri);
@@ -2881,7 +3106,7 @@ function fromDataURI(uri, asBlob, options) {
2881
3106
  }
2882
3107
  var DATA_URL_PATTERN;
2883
3108
  var init_fromDataURI = __esm({
2884
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/fromDataURI.js"() {
3109
+ "node_modules/axios/lib/helpers/fromDataURI.js"() {
2885
3110
  "use strict";
2886
3111
  init_AxiosError();
2887
3112
  init_parseProtocol();
@@ -2890,7 +3115,7 @@ var init_fromDataURI = __esm({
2890
3115
  }
2891
3116
  });
2892
3117
 
2893
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/throttle.js
3118
+ // node_modules/axios/lib/helpers/throttle.js
2894
3119
  function throttle(fn, freq) {
2895
3120
  let timestamp = 0;
2896
3121
  const threshold = 1e3 / freq;
@@ -2916,13 +3141,13 @@ function throttle(fn, freq) {
2916
3141
  }
2917
3142
  var throttle_default;
2918
3143
  var init_throttle = __esm({
2919
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/throttle.js"() {
3144
+ "node_modules/axios/lib/helpers/throttle.js"() {
2920
3145
  "use strict";
2921
3146
  throttle_default = throttle;
2922
3147
  }
2923
3148
  });
2924
3149
 
2925
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/speedometer.js
3150
+ // node_modules/axios/lib/helpers/speedometer.js
2926
3151
  function speedometer(samplesCount, min) {
2927
3152
  samplesCount = samplesCount || 10;
2928
3153
  const bytes = new Array(samplesCount);
@@ -2958,16 +3183,16 @@ function speedometer(samplesCount, min) {
2958
3183
  }
2959
3184
  var speedometer_default;
2960
3185
  var init_speedometer = __esm({
2961
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/speedometer.js"() {
3186
+ "node_modules/axios/lib/helpers/speedometer.js"() {
2962
3187
  "use strict";
2963
3188
  speedometer_default = speedometer;
2964
3189
  }
2965
3190
  });
2966
3191
 
2967
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/AxiosTransformStream.js
3192
+ // node_modules/axios/lib/helpers/AxiosTransformStream.js
2968
3193
  var import_stream, kInternals, AxiosTransformStream, AxiosTransformStream_default;
2969
3194
  var init_AxiosTransformStream = __esm({
2970
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/AxiosTransformStream.js"() {
3195
+ "node_modules/axios/lib/helpers/AxiosTransformStream.js"() {
2971
3196
  "use strict";
2972
3197
  import_stream = __toESM(require("stream"), 1);
2973
3198
  init_utils();
@@ -3123,10 +3348,10 @@ var init_AxiosTransformStream = __esm({
3123
3348
  }
3124
3349
  });
3125
3350
 
3126
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/readBlob.js
3351
+ // node_modules/axios/lib/helpers/readBlob.js
3127
3352
  var asyncIterator, readBlob, readBlob_default;
3128
3353
  var init_readBlob = __esm({
3129
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/readBlob.js"() {
3354
+ "node_modules/axios/lib/helpers/readBlob.js"() {
3130
3355
  ({ asyncIterator } = Symbol);
3131
3356
  readBlob = async function* (blob) {
3132
3357
  if (blob.stream) {
@@ -3143,10 +3368,10 @@ var init_readBlob = __esm({
3143
3368
  }
3144
3369
  });
3145
3370
 
3146
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/formDataToStream.js
3371
+ // node_modules/axios/lib/helpers/formDataToStream.js
3147
3372
  var import_util, import_stream2, BOUNDARY_ALPHABET, textEncoder, CRLF, CRLF_BYTES, CRLF_BYTES_COUNT, FormDataPart, formDataToStream, formDataToStream_default;
3148
3373
  var init_formDataToStream = __esm({
3149
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/formDataToStream.js"() {
3374
+ "node_modules/axios/lib/helpers/formDataToStream.js"() {
3150
3375
  import_util = require("util");
3151
3376
  import_stream2 = require("stream");
3152
3377
  init_utils();
@@ -3231,10 +3456,10 @@ var init_formDataToStream = __esm({
3231
3456
  }
3232
3457
  });
3233
3458
 
3234
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js
3459
+ // node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js
3235
3460
  var import_stream3, ZlibHeaderTransformStream, ZlibHeaderTransformStream_default;
3236
3461
  var init_ZlibHeaderTransformStream = __esm({
3237
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js"() {
3462
+ "node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js"() {
3238
3463
  "use strict";
3239
3464
  import_stream3 = __toESM(require("stream"), 1);
3240
3465
  ZlibHeaderTransformStream = class extends import_stream3.default.Transform {
@@ -3259,7 +3484,7 @@ var init_ZlibHeaderTransformStream = __esm({
3259
3484
  }
3260
3485
  });
3261
3486
 
3262
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/adapters/http.js
3487
+ // node_modules/axios/lib/adapters/http.js
3263
3488
  function dispatchBeforeRedirect(options) {
3264
3489
  if (options.beforeRedirects.proxy) {
3265
3490
  options.beforeRedirects.proxy(options);
@@ -3303,7 +3528,7 @@ function setProxy(options, configProxy, location) {
3303
3528
  }
3304
3529
  var import_proxy_from_env, import_http, import_https, import_util2, import_follow_redirects, import_zlib, import_stream4, import_events, zlibOptions, brotliOptions, isBrotliSupported, httpFollow, httpsFollow, isHttps, supportedProtocols, isHttpAdapterSupported, http_default;
3305
3530
  var init_http = __esm({
3306
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/adapters/http.js"() {
3531
+ "node_modules/axios/lib/adapters/http.js"() {
3307
3532
  "use strict";
3308
3533
  init_utils();
3309
3534
  init_settle();
@@ -3516,9 +3741,9 @@ var init_http = __esm({
3516
3741
  auth = urlUsername + ":" + urlPassword;
3517
3742
  }
3518
3743
  auth && headers.delete("authorization");
3519
- let path19;
3744
+ let path20;
3520
3745
  try {
3521
- path19 = buildURL(
3746
+ path20 = buildURL(
3522
3747
  parsed.pathname + parsed.search,
3523
3748
  config.params,
3524
3749
  config.paramsSerializer
@@ -3536,7 +3761,7 @@ var init_http = __esm({
3536
3761
  false
3537
3762
  );
3538
3763
  const options = {
3539
- path: path19,
3764
+ path: path20,
3540
3765
  method,
3541
3766
  headers: headers.toJSON(),
3542
3767
  agents: { http: config.httpAgent, https: config.httpsAgent },
@@ -3752,10 +3977,10 @@ var init_http = __esm({
3752
3977
  }
3753
3978
  });
3754
3979
 
3755
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/cookies.js
3980
+ // node_modules/axios/lib/helpers/cookies.js
3756
3981
  var cookies_default;
3757
3982
  var init_cookies = __esm({
3758
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/cookies.js"() {
3983
+ "node_modules/axios/lib/helpers/cookies.js"() {
3759
3984
  "use strict";
3760
3985
  init_utils();
3761
3986
  init_platform();
@@ -3763,14 +3988,14 @@ var init_cookies = __esm({
3763
3988
  // Standard browser envs support document.cookie
3764
3989
  /* @__PURE__ */ function standardBrowserEnv() {
3765
3990
  return {
3766
- write: function write(name, value, expires, path19, domain, secure) {
3991
+ write: function write(name, value, expires, path20, domain, secure) {
3767
3992
  const cookie = [];
3768
3993
  cookie.push(name + "=" + encodeURIComponent(value));
3769
3994
  if (utils_default.isNumber(expires)) {
3770
3995
  cookie.push("expires=" + new Date(expires).toGMTString());
3771
3996
  }
3772
- if (utils_default.isString(path19)) {
3773
- cookie.push("path=" + path19);
3997
+ if (utils_default.isString(path20)) {
3998
+ cookie.push("path=" + path20);
3774
3999
  }
3775
4000
  if (utils_default.isString(domain)) {
3776
4001
  cookie.push("domain=" + domain);
@@ -3806,10 +4031,10 @@ var init_cookies = __esm({
3806
4031
  }
3807
4032
  });
3808
4033
 
3809
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/isURLSameOrigin.js
4034
+ // node_modules/axios/lib/helpers/isURLSameOrigin.js
3810
4035
  var isURLSameOrigin_default;
3811
4036
  var init_isURLSameOrigin = __esm({
3812
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/isURLSameOrigin.js"() {
4037
+ "node_modules/axios/lib/helpers/isURLSameOrigin.js"() {
3813
4038
  "use strict";
3814
4039
  init_utils();
3815
4040
  init_platform();
@@ -3855,7 +4080,7 @@ var init_isURLSameOrigin = __esm({
3855
4080
  }
3856
4081
  });
3857
4082
 
3858
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/adapters/xhr.js
4083
+ // node_modules/axios/lib/adapters/xhr.js
3859
4084
  function progressEventReducer(listener, isDownloadStream) {
3860
4085
  let bytesNotified = 0;
3861
4086
  const _speedometer = speedometer_default(50, 250);
@@ -3881,7 +4106,7 @@ function progressEventReducer(listener, isDownloadStream) {
3881
4106
  }
3882
4107
  var isXHRAdapterSupported, xhr_default;
3883
4108
  var init_xhr = __esm({
3884
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/adapters/xhr.js"() {
4109
+ "node_modules/axios/lib/adapters/xhr.js"() {
3885
4110
  "use strict";
3886
4111
  init_utils();
3887
4112
  init_settle();
@@ -4035,10 +4260,10 @@ var init_xhr = __esm({
4035
4260
  }
4036
4261
  });
4037
4262
 
4038
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/adapters/adapters.js
4263
+ // node_modules/axios/lib/adapters/adapters.js
4039
4264
  var knownAdapters, adapters_default;
4040
4265
  var init_adapters = __esm({
4041
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/adapters/adapters.js"() {
4266
+ "node_modules/axios/lib/adapters/adapters.js"() {
4042
4267
  init_utils();
4043
4268
  init_http();
4044
4269
  init_xhr();
@@ -4089,7 +4314,7 @@ var init_adapters = __esm({
4089
4314
  }
4090
4315
  });
4091
4316
 
4092
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/dispatchRequest.js
4317
+ // node_modules/axios/lib/core/dispatchRequest.js
4093
4318
  function throwIfCancellationRequested(config) {
4094
4319
  if (config.cancelToken) {
4095
4320
  config.cancelToken.throwIfRequested();
@@ -4134,7 +4359,7 @@ function dispatchRequest(config) {
4134
4359
  });
4135
4360
  }
4136
4361
  var init_dispatchRequest = __esm({
4137
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/dispatchRequest.js"() {
4362
+ "node_modules/axios/lib/core/dispatchRequest.js"() {
4138
4363
  "use strict";
4139
4364
  init_transformData();
4140
4365
  init_isCancel();
@@ -4145,7 +4370,7 @@ var init_dispatchRequest = __esm({
4145
4370
  }
4146
4371
  });
4147
4372
 
4148
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/mergeConfig.js
4373
+ // node_modules/axios/lib/core/mergeConfig.js
4149
4374
  function mergeConfig(config1, config2) {
4150
4375
  config2 = config2 || {};
4151
4376
  const config = {};
@@ -4224,7 +4449,7 @@ function mergeConfig(config1, config2) {
4224
4449
  }
4225
4450
  var headersToObject;
4226
4451
  var init_mergeConfig = __esm({
4227
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/mergeConfig.js"() {
4452
+ "node_modules/axios/lib/core/mergeConfig.js"() {
4228
4453
  "use strict";
4229
4454
  init_utils();
4230
4455
  init_AxiosHeaders();
@@ -4232,7 +4457,7 @@ var init_mergeConfig = __esm({
4232
4457
  }
4233
4458
  });
4234
4459
 
4235
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/validator.js
4460
+ // node_modules/axios/lib/helpers/validator.js
4236
4461
  function assertOptions(options, schema, allowUnknown) {
4237
4462
  if (typeof options !== "object") {
4238
4463
  throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
@@ -4257,7 +4482,7 @@ function assertOptions(options, schema, allowUnknown) {
4257
4482
  }
4258
4483
  var validators, deprecatedWarnings, validator_default;
4259
4484
  var init_validator = __esm({
4260
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/validator.js"() {
4485
+ "node_modules/axios/lib/helpers/validator.js"() {
4261
4486
  "use strict";
4262
4487
  init_data();
4263
4488
  init_AxiosError();
@@ -4298,10 +4523,10 @@ var init_validator = __esm({
4298
4523
  }
4299
4524
  });
4300
4525
 
4301
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/Axios.js
4526
+ // node_modules/axios/lib/core/Axios.js
4302
4527
  var validators2, Axios, Axios_default;
4303
4528
  var init_Axios = __esm({
4304
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/core/Axios.js"() {
4529
+ "node_modules/axios/lib/core/Axios.js"() {
4305
4530
  "use strict";
4306
4531
  init_utils();
4307
4532
  init_buildURL();
@@ -4450,10 +4675,10 @@ var init_Axios = __esm({
4450
4675
  }
4451
4676
  });
4452
4677
 
4453
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/cancel/CancelToken.js
4678
+ // node_modules/axios/lib/cancel/CancelToken.js
4454
4679
  var CancelToken, CancelToken_default;
4455
4680
  var init_CancelToken = __esm({
4456
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/cancel/CancelToken.js"() {
4681
+ "node_modules/axios/lib/cancel/CancelToken.js"() {
4457
4682
  "use strict";
4458
4683
  init_CanceledError();
4459
4684
  CancelToken = class _CancelToken {
@@ -4546,33 +4771,33 @@ var init_CancelToken = __esm({
4546
4771
  }
4547
4772
  });
4548
4773
 
4549
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/spread.js
4774
+ // node_modules/axios/lib/helpers/spread.js
4550
4775
  function spread(callback) {
4551
4776
  return function wrap(arr) {
4552
4777
  return callback.apply(null, arr);
4553
4778
  };
4554
4779
  }
4555
4780
  var init_spread = __esm({
4556
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/spread.js"() {
4781
+ "node_modules/axios/lib/helpers/spread.js"() {
4557
4782
  "use strict";
4558
4783
  }
4559
4784
  });
4560
4785
 
4561
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/isAxiosError.js
4786
+ // node_modules/axios/lib/helpers/isAxiosError.js
4562
4787
  function isAxiosError(payload) {
4563
4788
  return utils_default.isObject(payload) && payload.isAxiosError === true;
4564
4789
  }
4565
4790
  var init_isAxiosError = __esm({
4566
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/isAxiosError.js"() {
4791
+ "node_modules/axios/lib/helpers/isAxiosError.js"() {
4567
4792
  "use strict";
4568
4793
  init_utils();
4569
4794
  }
4570
4795
  });
4571
4796
 
4572
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/HttpStatusCode.js
4797
+ // node_modules/axios/lib/helpers/HttpStatusCode.js
4573
4798
  var HttpStatusCode, HttpStatusCode_default;
4574
4799
  var init_HttpStatusCode = __esm({
4575
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/helpers/HttpStatusCode.js"() {
4800
+ "node_modules/axios/lib/helpers/HttpStatusCode.js"() {
4576
4801
  HttpStatusCode = {
4577
4802
  Continue: 100,
4578
4803
  SwitchingProtocols: 101,
@@ -4645,7 +4870,7 @@ var init_HttpStatusCode = __esm({
4645
4870
  }
4646
4871
  });
4647
4872
 
4648
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/axios.js
4873
+ // node_modules/axios/lib/axios.js
4649
4874
  function createInstance(defaultConfig) {
4650
4875
  const context = new Axios_default(defaultConfig);
4651
4876
  const instance = bind(Axios_default.prototype.request, context);
@@ -4658,7 +4883,7 @@ function createInstance(defaultConfig) {
4658
4883
  }
4659
4884
  var axios, axios_default;
4660
4885
  var init_axios = __esm({
4661
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/lib/axios.js"() {
4886
+ "node_modules/axios/lib/axios.js"() {
4662
4887
  "use strict";
4663
4888
  init_utils();
4664
4889
  init_bind();
@@ -4699,10 +4924,10 @@ var init_axios = __esm({
4699
4924
  }
4700
4925
  });
4701
4926
 
4702
- // node_modules/.pnpm/axios@1.3.2/node_modules/axios/index.js
4927
+ // node_modules/axios/index.js
4703
4928
  var Axios2, AxiosError2, CanceledError2, isCancel2, CancelToken2, VERSION2, all2, Cancel, isAxiosError2, spread2, toFormData2, AxiosHeaders2, HttpStatusCode2, formToJSON, mergeConfig2;
4704
4929
  var init_axios2 = __esm({
4705
- "node_modules/.pnpm/axios@1.3.2/node_modules/axios/index.js"() {
4930
+ "node_modules/axios/index.js"() {
4706
4931
  init_axios();
4707
4932
  ({
4708
4933
  Axios: Axios2,
@@ -5978,7 +6203,7 @@ var import_chalk26 = __toESM(require("chalk"));
5978
6203
  var import_figlet5 = __toESM(require("figlet"));
5979
6204
 
5980
6205
  // package.json
5981
- var version = "2.0.10";
6206
+ var version = "2.0.11";
5982
6207
 
5983
6208
  // bin/upload.ts
5984
6209
  var import_path7 = __toESM(require("path"));
@@ -6147,9 +6372,68 @@ function sanitizeTrackValue(value, maxLength = TRACK_VALUE_LIMIT) {
6147
6372
  return String(value).trim().slice(0, maxLength);
6148
6373
  }
6149
6374
  function getTrackErrorReason(error) {
6375
+ return sanitizeTrackValue(resolveErrorReason(error), TRACK_REASON_LIMIT) || "unknown_error";
6376
+ }
6377
+ function responseDataMessage(data) {
6150
6378
  var _a2, _b, _c, _d, _e;
6151
- const candidate = ((_b = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.msg) || ((_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.message) || (error == null ? void 0 : error.message) || ((_e = error == null ? void 0 : error.toString) == null ? void 0 : _e.call(error)) || "unknown_error";
6152
- return sanitizeTrackValue(candidate) || "unknown_error";
6379
+ if (typeof data === "string") {
6380
+ return data;
6381
+ }
6382
+ return (data == null ? void 0 : data.msg) || (data == null ? void 0 : data.message) || (data == null ? void 0 : data.error) || ((_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.msg) || ((_b = data == null ? void 0 : data.data) == null ? void 0 : _b.message) || ((_c = data == null ? void 0 : data.data) == null ? void 0 : _c.error) || ((_e = (_d = data == null ? void 0 : data.errors) == null ? void 0 : _d[0]) == null ? void 0 : _e.message);
6383
+ }
6384
+ function normalizeReason(candidate, status) {
6385
+ const value = sanitizeTrackValue(candidate, TRACK_REASON_LIMIT);
6386
+ if (!value) {
6387
+ return void 0;
6388
+ }
6389
+ const lower = value.toLowerCase();
6390
+ if (/^\s*<!doctype\s+html/i.test(value) || /^\s*<html[\s>]/i.test(value)) {
6391
+ return "api_returned_html";
6392
+ }
6393
+ const statusMatch = lower.match(/request failed with status code (\d{3})/);
6394
+ const statusCode = status || (statusMatch ? Number(statusMatch[1]) : void 0);
6395
+ if (statusCode === 520) {
6396
+ return "gateway_520";
6397
+ }
6398
+ if (lower.includes("token authentication failed") || lower.includes("invalid token") || lower.includes("token expired") || lower.includes("authentication failed") || lower.includes("auth failed") || lower.includes("unauthorized")) {
6399
+ return "token_auth_failed";
6400
+ }
6401
+ if (lower.includes("auth not set") || lower.includes("please login first")) {
6402
+ return "auth_not_set";
6403
+ }
6404
+ if (lower.includes("login timeout")) {
6405
+ return "login_timeout";
6406
+ }
6407
+ return value;
6408
+ }
6409
+ function resolveErrorReason(error, seen = /* @__PURE__ */ new Set()) {
6410
+ var _a2, _b, _c;
6411
+ if (error === void 0 || error === null || seen.has(error)) {
6412
+ return "unknown_error";
6413
+ }
6414
+ seen.add(error);
6415
+ const maybeError = error;
6416
+ const responseData = (_a2 = maybeError == null ? void 0 : maybeError.response) == null ? void 0 : _a2.data;
6417
+ const responseStatus = (_b = maybeError == null ? void 0 : maybeError.response) == null ? void 0 : _b.status;
6418
+ const responseReason = normalizeReason(
6419
+ responseDataMessage(responseData),
6420
+ responseStatus
6421
+ );
6422
+ if (responseReason) {
6423
+ return responseReason;
6424
+ }
6425
+ if (maybeError == null ? void 0 : maybeError.cause) {
6426
+ const causeReason = resolveErrorReason(maybeError.cause, seen);
6427
+ if (causeReason && causeReason !== "unknown_error") {
6428
+ return causeReason;
6429
+ }
6430
+ }
6431
+ const messageReason = normalizeReason(maybeError == null ? void 0 : maybeError.message, responseStatus);
6432
+ if (messageReason) {
6433
+ return messageReason;
6434
+ }
6435
+ const stringReason = normalizeReason((_c = maybeError == null ? void 0 : maybeError.toString) == null ? void 0 : _c.call(maybeError), responseStatus);
6436
+ return stringReason || "unknown_error";
6153
6437
  }
6154
6438
  function resolveTrackAction(event, data = {}) {
6155
6439
  const explicitAction = data.a;
@@ -6581,6 +6865,7 @@ var COMPLETE_TO_STATUS_DELAY = 5e3;
6581
6865
  var PROGRESS_UPDATE_INTERVAL = 200;
6582
6866
  var EXPECTED_UPLOAD_TIME = 6e4;
6583
6867
  var MAX_PROGRESS = 0.9;
6868
+ var MAX_CONCURRENT_CHUNK_UPLOADS = 5;
6584
6869
  function getUploadAuthHeaders() {
6585
6870
  return getAuthHeaders();
6586
6871
  }
@@ -6926,6 +7211,19 @@ async function delayWithAbortCheck(delay2, signal) {
6926
7211
  }, 50);
6927
7212
  });
6928
7213
  }
7214
+ async function runTasksWithConcurrency(tasks, limit) {
7215
+ let nextIndex = 0;
7216
+ async function worker() {
7217
+ while (nextIndex < tasks.length) {
7218
+ const task = tasks[nextIndex++];
7219
+ await task();
7220
+ }
7221
+ }
7222
+ const workerCount = Math.min(limit, tasks.length);
7223
+ return Promise.allSettled(
7224
+ Array.from({ length: workerCount }, () => worker())
7225
+ );
7226
+ }
6929
7227
  async function uploadFileChunks(filePath, sessionId, totalChunks, chunkSize, deviceId, progressBar) {
6930
7228
  const fileData = import_fs_extra4.default.readFileSync(filePath);
6931
7229
  const abortController = new AbortController();
@@ -6961,7 +7259,10 @@ async function uploadFileChunks(filePath, sessionId, totalChunks, chunkSize, dev
6961
7259
  };
6962
7260
  });
6963
7261
  try {
6964
- const results = await Promise.allSettled(uploadTasks.map((task) => task()));
7262
+ const results = await runTasksWithConcurrency(
7263
+ uploadTasks,
7264
+ MAX_CONCURRENT_CHUNK_UPLOADS
7265
+ );
6965
7266
  const failedResults = results.filter(
6966
7267
  (result) => result.status === "rejected"
6967
7268
  );
@@ -9074,12 +9375,11 @@ Login failed: ${(e == null ? void 0 : e.message) || e}`));
9074
9375
 
9075
9376
  // bin/create.ts
9076
9377
  var import_chalk20 = __toESM(require("chalk"));
9077
- var import_fs_extra7 = __toESM(require("fs-extra"));
9078
- var import_path13 = __toESM(require("path"));
9378
+ var import_fs_extra8 = __toESM(require("fs-extra"));
9379
+ var import_path14 = __toESM(require("path"));
9079
9380
  var import_inquirer8 = __toESM(require("inquirer"));
9080
9381
  init_axios2();
9081
9382
  var import_adm_zip = __toESM(require("adm-zip"));
9082
- var import_child_process4 = require("child_process");
9083
9383
  init_webLogin();
9084
9384
 
9085
9385
  // bin/utils/installProjectDependencies.ts
@@ -9232,15 +9532,42 @@ ${capturedOutput}`));
9232
9532
  });
9233
9533
  });
9234
9534
  }
9235
- function quoteForShell(value) {
9236
- if (process.platform === "win32") {
9535
+ function quoteForShell(value, platform = process.platform) {
9536
+ if (platform === "win32") {
9237
9537
  return `"${value}"`;
9238
9538
  }
9239
9539
  return `'${value.replace(/'/g, `'\\''`)}'`;
9240
9540
  }
9541
+ function buildBackgroundInstallCommand(script, logPath, exitCodePath, platform = process.platform) {
9542
+ const args = getInstallArgs(script);
9543
+ const npmCmd = platform === "win32" ? "npm" : getNpmCommand();
9544
+ const installCommand = `${npmCmd} ${args.map((arg) => quoteForShell(arg, platform)).join(" ")}`;
9545
+ const qLog = quoteForShell(logPath, platform);
9546
+ const qExit = quoteForShell(exitCodePath, platform);
9547
+ if (platform === "win32") {
9548
+ return {
9549
+ shellBin: process.env.ComSpec || "cmd.exe",
9550
+ shellArgs: [
9551
+ "/d",
9552
+ "/s",
9553
+ "/v:on",
9554
+ "/c",
9555
+ `${installCommand} >> ${qLog} 2>&1 & echo !errorlevel! > ${qExit}`
9556
+ ],
9557
+ installCommand
9558
+ };
9559
+ }
9560
+ return {
9561
+ shellBin: "/bin/sh",
9562
+ shellArgs: [
9563
+ "-c",
9564
+ `${installCommand} >> ${qLog} 2>&1; printf '%s' "$?" > ${qExit}`
9565
+ ],
9566
+ installCommand
9567
+ };
9568
+ }
9241
9569
  function startBackgroundInstall(cwd) {
9242
9570
  const script = getInstallScript(cwd, "auto");
9243
- const args = getInstallArgs(script);
9244
9571
  const logPath = import_path11.default.join(cwd, INSTALL_LOG_FILE);
9245
9572
  const exitCodePath = import_path11.default.join(cwd, INSTALL_EXITCODE_FILE);
9246
9573
  const pidPath = import_path11.default.join(cwd, INSTALL_PID_FILE);
@@ -9248,21 +9575,7 @@ function startBackgroundInstall(cwd) {
9248
9575
  import_fs_extra5.default.removeSync(pidPath);
9249
9576
  import_fs_extra5.default.writeFileSync(logPath, `[pinme] ${(/* @__PURE__ */ new Date()).toISOString()} starting "npm ${script}"
9250
9577
  `);
9251
- const npmCmd = process.platform === "win32" ? "npm" : getNpmCommand();
9252
- const installCmd = `${npmCmd} ${args.map(quoteForShell).join(" ")}`;
9253
- const qLog = quoteForShell(logPath);
9254
- const qExit = quoteForShell(exitCodePath);
9255
- let shellBin;
9256
- let shellArgs;
9257
- if (process.platform === "win32") {
9258
- const command = `${installCmd} >> ${qLog} 2>&1 & echo %errorlevel% > ${qExit}`;
9259
- shellBin = process.env.ComSpec || "cmd.exe";
9260
- shellArgs = ["/d", "/s", "/c", command];
9261
- } else {
9262
- const command = `${installCmd} >> ${qLog} 2>&1; printf '%s' "$?" > ${qExit}`;
9263
- shellBin = "/bin/sh";
9264
- shellArgs = ["-c", command];
9265
- }
9578
+ const { shellBin, shellArgs } = buildBackgroundInstallCommand(script, logPath, exitCodePath);
9266
9579
  const child = (0, import_child_process3.spawn)(shellBin, shellArgs, {
9267
9580
  cwd,
9268
9581
  detached: true,
@@ -9602,6 +9915,73 @@ function getValidatedWorkerMetadataContent(metadata, projectName) {
9602
9915
  return metadataContent;
9603
9916
  }
9604
9917
 
9918
+ // bin/utils/downloadFile.ts
9919
+ init_axios2();
9920
+ var import_fs_extra7 = __toESM(require("fs-extra"));
9921
+ var import_path13 = __toESM(require("path"));
9922
+ var import_fs6 = require("fs");
9923
+ var import_stream5 = require("stream");
9924
+ var import_util3 = require("util");
9925
+ var pipelineAsync = (0, import_util3.promisify)(import_stream5.pipeline);
9926
+ function sleep2(ms) {
9927
+ return new Promise((resolve) => setTimeout(resolve, ms));
9928
+ }
9929
+ function getDownloadErrorMessage(error) {
9930
+ var _a2, _b;
9931
+ const status = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.status;
9932
+ const statusText = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.statusText;
9933
+ if (status) {
9934
+ return `HTTP ${status}${statusText ? ` ${statusText}` : ""}`;
9935
+ }
9936
+ if ((error == null ? void 0 : error.code) && (error == null ? void 0 : error.message)) {
9937
+ return `${error.code}: ${error.message}`;
9938
+ }
9939
+ return (error == null ? void 0 : error.message) || String(error);
9940
+ }
9941
+ async function requestDownload(url2, options) {
9942
+ return axios_default.get(url2, {
9943
+ responseType: "stream",
9944
+ timeout: options.timeoutMs,
9945
+ headers: options.headers
9946
+ });
9947
+ }
9948
+ async function downloadFileWithRetries(url2, destinationPath, options = {}) {
9949
+ var _a2, _b;
9950
+ const attempts = options.attempts ?? 3;
9951
+ const retryDelayMs = options.retryDelayMs ?? 2e3;
9952
+ const minBytes = options.minBytes ?? 1;
9953
+ const timeoutMs = options.timeoutMs ?? 12e4;
9954
+ const request = options.request ?? requestDownload;
9955
+ const headers = {
9956
+ "User-Agent": "pinme-cli"
9957
+ };
9958
+ let lastError;
9959
+ import_fs_extra7.default.ensureDirSync(import_path13.default.dirname(destinationPath));
9960
+ import_fs_extra7.default.removeSync(destinationPath);
9961
+ for (let attempt = 1; attempt <= attempts; attempt++) {
9962
+ const tempPath = `${destinationPath}.download-${process.pid}-${Date.now()}-${attempt}.tmp`;
9963
+ try {
9964
+ (_a2 = options.onAttempt) == null ? void 0 : _a2.call(options, attempt, attempts);
9965
+ const response = await request(url2, { timeoutMs, headers });
9966
+ await pipelineAsync(response.data, (0, import_fs6.createWriteStream)(tempPath));
9967
+ const bytes = import_fs_extra7.default.statSync(tempPath).size;
9968
+ if (bytes < minBytes) {
9969
+ throw new Error(`Downloaded file is too small (${bytes} bytes; expected at least ${minBytes} bytes).`);
9970
+ }
9971
+ import_fs_extra7.default.moveSync(tempPath, destinationPath, { overwrite: true });
9972
+ return { attempts: attempt, bytes };
9973
+ } catch (error) {
9974
+ lastError = error;
9975
+ import_fs_extra7.default.removeSync(tempPath);
9976
+ (_b = options.onAttemptFailure) == null ? void 0 : _b.call(options, attempt, error);
9977
+ if (attempt < attempts) {
9978
+ await sleep2(retryDelayMs);
9979
+ }
9980
+ }
9981
+ }
9982
+ throw new Error(`Failed to download ${url2} after ${attempts} attempts: ${getDownloadErrorMessage(lastError)}`);
9983
+ }
9984
+
9605
9985
  // bin/create.ts
9606
9986
  var PROJECT_DIR = process.cwd();
9607
9987
  var TEMPLATE_BRANCH = process.env.PINME_TEMPLATE_BRANCH || "main";
@@ -9631,7 +10011,7 @@ ${configExport}
9631
10011
  `;
9632
10012
  }
9633
10013
  function resolveExtractedTemplateDir(extractDir) {
9634
- const entries = import_fs_extra7.default.readdirSync(extractDir, { withFileTypes: true });
10014
+ const entries = import_fs_extra8.default.readdirSync(extractDir, { withFileTypes: true });
9635
10015
  const templateDir = entries.find((entry) => entry.isDirectory() && entry.name.startsWith(`${TEMPLATE_REPO_NAME}-`));
9636
10016
  if (!templateDir) {
9637
10017
  throw createConfigError("Downloaded template archive structure is invalid.", [
@@ -9639,10 +10019,10 @@ function resolveExtractedTemplateDir(extractDir) {
9639
10019
  `Template branch: ${TEMPLATE_BRANCH}`
9640
10020
  ]);
9641
10021
  }
9642
- return import_path13.default.join(extractDir, templateDir.name);
10022
+ return import_path14.default.join(extractDir, templateDir.name);
9643
10023
  }
9644
10024
  function updateFrontendUrlInConfig(configPath, frontendUrl) {
9645
- let config = import_fs_extra7.default.readFileSync(configPath, "utf-8");
10025
+ let config = import_fs_extra8.default.readFileSync(configPath, "utf-8");
9646
10026
  if (config.includes("frontend_url")) {
9647
10027
  config = config.replace(
9648
10028
  /frontend_url\s*=\s*"[^"]*"/,
@@ -9655,7 +10035,7 @@ function updateFrontendUrlInConfig(configPath, frontendUrl) {
9655
10035
  `
9656
10036
  );
9657
10037
  }
9658
- import_fs_extra7.default.writeFileSync(configPath, config);
10038
+ import_fs_extra8.default.writeFileSync(configPath, config);
9659
10039
  }
9660
10040
  function getProjectManagementUrl(projectName) {
9661
10041
  return `${APP_CONFIG.projectPeviewUrl}${projectName}`;
@@ -9688,8 +10068,8 @@ async function createCmd(options) {
9688
10068
  ]);
9689
10069
  projectName = answers.projectName;
9690
10070
  }
9691
- const targetDir = import_path13.default.join(PROJECT_DIR, projectName);
9692
- if (import_fs_extra7.default.existsSync(targetDir) && !options.force) {
10071
+ const targetDir = import_path14.default.join(PROJECT_DIR, projectName);
10072
+ if (import_fs_extra8.default.existsSync(targetDir) && !options.force) {
9693
10073
  console.log(import_chalk20.default.yellow(`
9694
10074
  Directory "${projectName}" already exists.`));
9695
10075
  const answers = await import_inquirer8.default.prompt([
@@ -9704,7 +10084,7 @@ Directory "${projectName}" already exists.`));
9704
10084
  console.log(import_chalk20.default.gray("Cancelled."));
9705
10085
  process.exit(0);
9706
10086
  }
9707
- import_fs_extra7.default.removeSync(targetDir);
10087
+ import_fs_extra8.default.removeSync(targetDir);
9708
10088
  }
9709
10089
  console.log(import_chalk20.default.blue("\n1. Creating worker and database..."));
9710
10090
  const apiUrl = getPinmeApiUrl("/create_worker");
@@ -9739,48 +10119,46 @@ Directory "${projectName}" already exists.`));
9739
10119
  ]);
9740
10120
  }
9741
10121
  console.log(import_chalk20.default.blue("\n2. Downloading template from repository..."));
9742
- const zipPath = import_path13.default.join(PROJECT_DIR, "template.zip");
9743
- const extractDir = import_path13.default.join(PROJECT_DIR, `.pinme-template-${Date.now()}`);
9744
- const templateZipUrl = getTemplateZipUrl(TEMPLATE_BRANCH);
9745
- let downloadSuccess = false;
10122
+ const zipPath = import_path14.default.join(PROJECT_DIR, "template.zip");
10123
+ const extractDir = import_path14.default.join(PROJECT_DIR, `.pinme-template-${Date.now()}`);
10124
+ const templateZipUrl = process.env.PINME_TEMPLATE_ZIP_URL || getTemplateZipUrl(TEMPLATE_BRANCH);
9746
10125
  console.log(import_chalk20.default.gray(` Template branch: ${TEMPLATE_BRANCH}`));
9747
- for (let attempt = 1; attempt <= 3 && !downloadSuccess; attempt++) {
9748
- try {
9749
- console.log(import_chalk20.default.gray(` Download attempt ${attempt}/3...`));
9750
- (0, import_child_process4.execSync)(`curl -L --retry 3 --retry-delay 2 -o "${zipPath}" "${templateZipUrl}"`, {
9751
- stdio: "inherit"
9752
- });
9753
- if (!import_fs_extra7.default.existsSync(zipPath) || import_fs_extra7.default.statSync(zipPath).size < 100) {
9754
- throw new Error("Downloaded file is too small or empty");
9755
- }
9756
- downloadSuccess = true;
9757
- } catch (downloadError) {
9758
- console.log(import_chalk20.default.yellow(` Attempt ${attempt} failed: ${downloadError.message}`));
9759
- if (import_fs_extra7.default.existsSync(zipPath)) {
9760
- import_fs_extra7.default.removeSync(zipPath);
9761
- }
9762
- if (attempt === 3) {
9763
- throw new Error(`Failed to download template after 3 attempts: ${downloadError.message}`);
10126
+ try {
10127
+ const downloadResult = await downloadFileWithRetries(templateZipUrl, zipPath, {
10128
+ attempts: 3,
10129
+ retryDelayMs: 2e3,
10130
+ minBytes: 100,
10131
+ onAttempt: (attempt, attempts) => {
10132
+ console.log(import_chalk20.default.gray(` Download attempt ${attempt}/${attempts}...`));
10133
+ },
10134
+ onAttemptFailure: (attempt, error) => {
10135
+ console.log(import_chalk20.default.yellow(` Attempt ${attempt} failed: ${getDownloadErrorMessage(error)}`));
9764
10136
  }
9765
- }
10137
+ });
10138
+ console.log(import_chalk20.default.green(` Template archive downloaded (${downloadResult.bytes} bytes)`));
10139
+ } catch (error) {
10140
+ throw createCommandError("template download", `download "${templateZipUrl}" to "${zipPath}"`, error, [
10141
+ "Check your network connection and retry `pinme create`.",
10142
+ `Verify that the template branch exists: ${TEMPLATE_BRANCH}`
10143
+ ]);
9766
10144
  }
9767
10145
  try {
9768
- import_fs_extra7.default.ensureDirSync(extractDir);
10146
+ import_fs_extra8.default.ensureDirSync(extractDir);
9769
10147
  const templateZip = new import_adm_zip.default(zipPath);
9770
10148
  templateZip.extractAllTo(extractDir, true);
9771
10149
  const subDir = resolveExtractedTemplateDir(extractDir);
9772
- import_fs_extra7.default.copySync(subDir, targetDir);
9773
- import_fs_extra7.default.removeSync(zipPath);
9774
- import_fs_extra7.default.removeSync(extractDir);
9775
- const nodeModulesPath = import_path13.default.join(targetDir, "node_modules");
9776
- if (import_fs_extra7.default.existsSync(nodeModulesPath)) {
10150
+ import_fs_extra8.default.copySync(subDir, targetDir);
10151
+ import_fs_extra8.default.removeSync(zipPath);
10152
+ import_fs_extra8.default.removeSync(extractDir);
10153
+ const nodeModulesPath = import_path14.default.join(targetDir, "node_modules");
10154
+ if (import_fs_extra8.default.existsSync(nodeModulesPath)) {
9777
10155
  console.log(import_chalk20.default.gray(" Removing existing node_modules..."));
9778
- import_fs_extra7.default.removeSync(nodeModulesPath);
10156
+ import_fs_extra8.default.removeSync(nodeModulesPath);
9779
10157
  }
9780
- const frontendNodeModules = import_path13.default.join(targetDir, "frontend", "node_modules");
9781
- const backendNodeModules = import_path13.default.join(targetDir, "backend", "node_modules");
9782
- if (import_fs_extra7.default.existsSync(frontendNodeModules)) import_fs_extra7.default.removeSync(frontendNodeModules);
9783
- if (import_fs_extra7.default.existsSync(backendNodeModules)) import_fs_extra7.default.removeSync(backendNodeModules);
10158
+ const frontendNodeModules = import_path14.default.join(targetDir, "frontend", "node_modules");
10159
+ const backendNodeModules = import_path14.default.join(targetDir, "backend", "node_modules");
10160
+ if (import_fs_extra8.default.existsSync(frontendNodeModules)) import_fs_extra8.default.removeSync(frontendNodeModules);
10161
+ if (import_fs_extra8.default.existsSync(backendNodeModules)) import_fs_extra8.default.removeSync(backendNodeModules);
9784
10162
  console.log(import_chalk20.default.green(` Template downloaded to: ${targetDir}`));
9785
10163
  } catch (error) {
9786
10164
  throw createCommandError("template extraction", `extract "${zipPath}" to "${extractDir}"`, error, [
@@ -9788,61 +10166,61 @@ Directory "${projectName}" already exists.`));
9788
10166
  ]);
9789
10167
  }
9790
10168
  console.log(import_chalk20.default.blue("\n3. Updating configuration..."));
9791
- const configPath = import_path13.default.join(targetDir, "pinme.toml");
9792
- const config = import_fs_extra7.default.readFileSync(configPath, "utf-8");
10169
+ const configPath = import_path14.default.join(targetDir, "pinme.toml");
10170
+ const config = import_fs_extra8.default.readFileSync(configPath, "utf-8");
9793
10171
  let updatedConfig = config.replace(
9794
10172
  /project_name = ".*"/,
9795
10173
  `project_name = "${workerData.project_name}"`
9796
10174
  );
9797
- import_fs_extra7.default.writeFileSync(configPath, updatedConfig);
10175
+ import_fs_extra8.default.writeFileSync(configPath, updatedConfig);
9798
10176
  console.log(import_chalk20.default.green(` Updated pinme.toml`));
9799
10177
  console.log(import_chalk20.default.gray(` metadata: ${workerData.metadata}`));
9800
10178
  const workerMetadataContent = getValidatedWorkerMetadataContent(
9801
10179
  workerData.metadata,
9802
10180
  workerData.project_name
9803
10181
  );
9804
- const backendDir = import_path13.default.join(targetDir, "backend");
9805
- if (import_fs_extra7.default.existsSync(backendDir)) {
9806
- import_fs_extra7.default.writeFileSync(
9807
- import_path13.default.join(backendDir, "metadata.json"),
10182
+ const backendDir = import_path14.default.join(targetDir, "backend");
10183
+ if (import_fs_extra8.default.existsSync(backendDir)) {
10184
+ import_fs_extra8.default.writeFileSync(
10185
+ import_path14.default.join(backendDir, "metadata.json"),
9808
10186
  workerMetadataContent
9809
10187
  );
9810
10188
  console.log(import_chalk20.default.green(` Saved metadata.json`));
9811
10189
  }
9812
- const wranglerPath = import_path13.default.join(backendDir, "wrangler.toml");
9813
- if (import_fs_extra7.default.existsSync(wranglerPath) && workerData.api_key) {
9814
- let wranglerContent = import_fs_extra7.default.readFileSync(wranglerPath, "utf-8");
10190
+ const wranglerPath = import_path14.default.join(backendDir, "wrangler.toml");
10191
+ if (import_fs_extra8.default.existsSync(wranglerPath) && workerData.api_key) {
10192
+ let wranglerContent = import_fs_extra8.default.readFileSync(wranglerPath, "utf-8");
9815
10193
  wranglerContent = wranglerContent.replace(
9816
10194
  /^name = ".*"$/m,
9817
10195
  `name = "${workerData.project_name}"`
9818
10196
  );
9819
- import_fs_extra7.default.writeFileSync(wranglerPath, wranglerContent);
10197
+ import_fs_extra8.default.writeFileSync(wranglerPath, wranglerContent);
9820
10198
  console.log(import_chalk20.default.green(` Updated backend/wrangler.toml API_KEY`));
9821
10199
  }
9822
- const frontendConfigPath = import_path13.default.join(targetDir, "frontend", "src", "utils", "config.ts");
10200
+ const frontendConfigPath = import_path14.default.join(targetDir, "frontend", "src", "utils", "config.ts");
9823
10201
  if (workerData.public_client_config) {
9824
- const frontendConfigContent = import_fs_extra7.default.existsSync(frontendConfigPath) ? import_fs_extra7.default.readFileSync(frontendConfigPath, "utf-8") : "";
9825
- import_fs_extra7.default.ensureDirSync(import_path13.default.dirname(frontendConfigPath));
9826
- import_fs_extra7.default.writeFileSync(
10202
+ const frontendConfigContent = import_fs_extra8.default.existsSync(frontendConfigPath) ? import_fs_extra8.default.readFileSync(frontendConfigPath, "utf-8") : "";
10203
+ import_fs_extra8.default.ensureDirSync(import_path14.default.dirname(frontendConfigPath));
10204
+ import_fs_extra8.default.writeFileSync(
9827
10205
  frontendConfigPath,
9828
10206
  injectPublicClientConfigIntoFile(frontendConfigContent, workerData.public_client_config)
9829
10207
  );
9830
10208
  console.log(import_chalk20.default.green(` Updated frontend/src/utils/config.ts public_client_config`));
9831
10209
  }
9832
- const envExamplePath = import_path13.default.join(targetDir, "frontend", ".env.example");
9833
- const envPath = import_path13.default.join(targetDir, "frontend", ".env");
9834
- if (import_fs_extra7.default.existsSync(envExamplePath)) {
9835
- let envContent = import_fs_extra7.default.readFileSync(envExamplePath, "utf-8");
10210
+ const envExamplePath = import_path14.default.join(targetDir, "frontend", ".env.example");
10211
+ const envPath = import_path14.default.join(targetDir, "frontend", ".env");
10212
+ if (import_fs_extra8.default.existsSync(envExamplePath)) {
10213
+ let envContent = import_fs_extra8.default.readFileSync(envExamplePath, "utf-8");
9836
10214
  envContent = envContent.replace(/your-project/g, workerData.project_name);
9837
10215
  envContent = envContent.replace(
9838
10216
  /^VITE_API_URL=.*$/m,
9839
10217
  `VITE_API_URL=${workerData.api_domain}`
9840
10218
  );
9841
- import_fs_extra7.default.writeFileSync(envPath, envContent);
10219
+ import_fs_extra8.default.writeFileSync(envPath, envContent);
9842
10220
  console.log(import_chalk20.default.green(` Created frontend/.env file`));
9843
10221
  console.log(import_chalk20.default.gray(` VITE_API_URL: ${workerData.api_domain}`));
9844
10222
  }
9845
- let pinmeConfig = import_fs_extra7.default.readFileSync(configPath, "utf-8");
10223
+ let pinmeConfig = import_fs_extra8.default.readFileSync(configPath, "utf-8");
9846
10224
  if (pinmeConfig.includes("api_url")) {
9847
10225
  pinmeConfig = pinmeConfig.replace(
9848
10226
  /api_url\s*=\s*"[^"]*"/,
@@ -9859,7 +10237,7 @@ Directory "${projectName}" already exists.`));
9859
10237
  }
9860
10238
  pinmeConfig = newLines.join("\n");
9861
10239
  }
9862
- import_fs_extra7.default.writeFileSync(configPath, pinmeConfig);
10240
+ import_fs_extra8.default.writeFileSync(configPath, pinmeConfig);
9863
10241
  console.log(import_chalk20.default.green(` Updated pinme.toml with api_url`));
9864
10242
  console.log(import_chalk20.default.blue("\n4. Installing dependencies in the background..."));
9865
10243
  try {
@@ -9872,27 +10250,27 @@ Directory "${projectName}" already exists.`));
9872
10250
  console.log(import_chalk20.default.yellow(" Run `npm install` inside the project before `pinme save`."));
9873
10251
  }
9874
10252
  console.log(import_chalk20.default.blue("\n5. Preparing backend worker..."));
9875
- const distWorkerDir = import_path13.default.join(targetDir, "dist-worker");
9876
- const workerJsPath = import_path13.default.join(distWorkerDir, "worker.js");
9877
- if (!import_fs_extra7.default.existsSync(distWorkerDir) || !import_fs_extra7.default.existsSync(workerJsPath)) {
10253
+ const distWorkerDir = import_path14.default.join(targetDir, "dist-worker");
10254
+ const workerJsPath = import_path14.default.join(distWorkerDir, "worker.js");
10255
+ if (!import_fs_extra8.default.existsSync(distWorkerDir) || !import_fs_extra8.default.existsSync(workerJsPath)) {
9878
10256
  throw createConfigError("Prebuilt worker output not found: `dist-worker/worker.js`.", [
9879
10257
  "The template should ship a prebuilt `dist-worker/`.",
9880
10258
  "Once dependencies finish installing, run `npm run build:worker` in the project, then `pinme save`."
9881
10259
  ]);
9882
10260
  }
9883
10261
  const modulePaths = [];
9884
- const files = import_fs_extra7.default.readdirSync(distWorkerDir);
10262
+ const files = import_fs_extra8.default.readdirSync(distWorkerDir);
9885
10263
  for (const file of files) {
9886
10264
  if (file.endsWith(".js") && file !== "worker.js") {
9887
- modulePaths.push(import_path13.default.join(distWorkerDir, file));
10265
+ modulePaths.push(import_path14.default.join(distWorkerDir, file));
9888
10266
  }
9889
10267
  }
9890
- const sqlDir = import_path13.default.join(targetDir, "db");
10268
+ const sqlDir = import_path14.default.join(targetDir, "db");
9891
10269
  const sqlFiles = [];
9892
- if (import_fs_extra7.default.existsSync(sqlDir)) {
9893
- const sqlFileNames = import_fs_extra7.default.readdirSync(sqlDir).filter((f) => f.endsWith(".sql")).sort();
10270
+ if (import_fs_extra8.default.existsSync(sqlDir)) {
10271
+ const sqlFileNames = import_fs_extra8.default.readdirSync(sqlDir).filter((f) => f.endsWith(".sql")).sort();
9894
10272
  for (const filename of sqlFileNames) {
9895
- sqlFiles.push(import_path13.default.join(sqlDir, filename));
10273
+ sqlFiles.push(import_path14.default.join(sqlDir, filename));
9896
10274
  console.log(import_chalk20.default.gray(` Including SQL: ${filename}`));
9897
10275
  }
9898
10276
  }
@@ -9906,20 +10284,20 @@ Directory "${projectName}" already exists.`));
9906
10284
  formData.append("metadata", new Blob2([workerMetadataContent], {
9907
10285
  type: "application/json"
9908
10286
  }), "metadata.json");
9909
- const workerCode = import_fs_extra7.default.readFileSync(workerJsPath, "utf-8");
10287
+ const workerCode = import_fs_extra8.default.readFileSync(workerJsPath, "utf-8");
9910
10288
  formData.append("worker.js", new Blob2([workerCode], {
9911
10289
  type: "application/javascript+module"
9912
10290
  }), "worker.js");
9913
10291
  for (const modulePath of modulePaths) {
9914
- const filename = import_path13.default.basename(modulePath);
9915
- const content = import_fs_extra7.default.readFileSync(modulePath, "utf-8");
10292
+ const filename = import_path14.default.basename(modulePath);
10293
+ const content = import_fs_extra8.default.readFileSync(modulePath, "utf-8");
9916
10294
  formData.append(filename, new Blob2([content], {
9917
10295
  type: "application/javascript+module"
9918
10296
  }), filename);
9919
10297
  }
9920
10298
  for (const sqlFile of sqlFiles) {
9921
- const filename = import_path13.default.basename(sqlFile);
9922
- const content = import_fs_extra7.default.readFileSync(sqlFile, "utf-8");
10299
+ const filename = import_path14.default.basename(sqlFile);
10300
+ const content = import_fs_extra8.default.readFileSync(sqlFile, "utf-8");
9923
10301
  formData.append("sql_file", new Blob2([content], {
9924
10302
  type: "application/sql"
9925
10303
  }), filename);
@@ -9952,10 +10330,10 @@ Directory "${projectName}" already exists.`));
9952
10330
  ]);
9953
10331
  }
9954
10332
  console.log(import_chalk20.default.blue("\n7. Preparing frontend..."));
9955
- const frontendDir = import_path13.default.join(targetDir, "frontend");
9956
- const frontendDistDir = import_path13.default.join(frontendDir, "dist");
9957
- if (import_fs_extra7.default.existsSync(frontendDir)) {
9958
- if (!import_fs_extra7.default.existsSync(frontendDistDir)) {
10333
+ const frontendDir = import_path14.default.join(targetDir, "frontend");
10334
+ const frontendDistDir = import_path14.default.join(frontendDir, "dist");
10335
+ if (import_fs_extra8.default.existsSync(frontendDir)) {
10336
+ if (!import_fs_extra8.default.existsSync(frontendDistDir)) {
9959
10337
  throw createConfigError("Prebuilt frontend output not found: `frontend/dist/`.", [
9960
10338
  "The template should ship a prebuilt `frontend/dist/`.",
9961
10339
  "Once dependencies finish installing, run `npm run build:frontend` in the project, then `pinme save`."
@@ -9975,7 +10353,7 @@ Directory "${projectName}" already exists.`));
9975
10353
  });
9976
10354
  printHighlightedUrl("Frontend URL", uploadResult.publicUrl, "primary");
9977
10355
  updateFrontendUrlInConfig(
9978
- import_path13.default.join(targetDir, "pinme.toml"),
10356
+ import_path14.default.join(targetDir, "pinme.toml"),
9979
10357
  uploadResult.publicUrl
9980
10358
  );
9981
10359
  console.log(import_chalk20.default.green(" Updated pinme.toml with frontend URL"));
@@ -10028,10 +10406,10 @@ Next steps:`));
10028
10406
  // bin/save.ts
10029
10407
  var import_chalk21 = __toESM(require("chalk"));
10030
10408
  var import_ora3 = __toESM(require("ora"));
10031
- var import_fs_extra8 = __toESM(require("fs-extra"));
10032
- var import_path14 = __toESM(require("path"));
10409
+ var import_fs_extra9 = __toESM(require("fs-extra"));
10410
+ var import_path15 = __toESM(require("path"));
10033
10411
  init_axios2();
10034
- var import_child_process5 = require("child_process");
10412
+ var import_child_process4 = require("child_process");
10035
10413
  init_webLogin();
10036
10414
  init_pinmeApi();
10037
10415
  init_domainValidator();
@@ -10039,14 +10417,14 @@ init_cliError();
10039
10417
  init_config();
10040
10418
  var PROJECT_DIR2 = process.cwd();
10041
10419
  function loadConfig() {
10042
- const configPath = import_path14.default.join(PROJECT_DIR2, "pinme.toml");
10043
- if (!import_fs_extra8.default.existsSync(configPath)) {
10420
+ const configPath = import_path15.default.join(PROJECT_DIR2, "pinme.toml");
10421
+ if (!import_fs_extra9.default.existsSync(configPath)) {
10044
10422
  throw createConfigError("`pinme.toml` not found in the current directory.", [
10045
10423
  "Run this command from the Pinme project root.",
10046
10424
  "If the project has not been initialized yet, create or restore `pinme.toml` first."
10047
10425
  ]);
10048
10426
  }
10049
- const configContent = import_fs_extra8.default.readFileSync(configPath, "utf-8");
10427
+ const configContent = import_fs_extra9.default.readFileSync(configPath, "utf-8");
10050
10428
  const projectNameMatch = configContent.match(/project_name\s*=\s*"([^"]+)"/);
10051
10429
  return {
10052
10430
  project_name: (projectNameMatch == null ? void 0 : projectNameMatch[1]) || ""
@@ -10056,17 +10434,17 @@ function getProjectManagementUrl2(projectName) {
10056
10434
  return `${APP_CONFIG.projectPeviewUrl}${projectName}`;
10057
10435
  }
10058
10436
  function getMetadata() {
10059
- const metadataPath = import_path14.default.join(PROJECT_DIR2, "backend", "metadata.json");
10060
- if (!import_fs_extra8.default.existsSync(metadataPath)) {
10437
+ const metadataPath = import_path15.default.join(PROJECT_DIR2, "backend", "metadata.json");
10438
+ if (!import_fs_extra9.default.existsSync(metadataPath)) {
10061
10439
  console.log(import_chalk21.default.yellow(" Warning: metadata.json not found, using empty metadata"));
10062
10440
  return {};
10063
10441
  }
10064
- return import_fs_extra8.default.readJsonSync(metadataPath);
10442
+ return import_fs_extra9.default.readJsonSync(metadataPath);
10065
10443
  }
10066
10444
  function buildWorker() {
10067
10445
  console.log(import_chalk21.default.blue("Building worker..."));
10068
10446
  try {
10069
- (0, import_child_process5.execSync)("npm run build:worker", {
10447
+ (0, import_child_process4.execSync)("npm run build:worker", {
10070
10448
  cwd: PROJECT_DIR2,
10071
10449
  stdio: "inherit"
10072
10450
  });
@@ -10083,11 +10461,11 @@ function buildWorker() {
10083
10461
  }
10084
10462
  }
10085
10463
  function dependenciesMissingError(summary, logTail) {
10086
- const installLogPath = import_path14.default.join(PROJECT_DIR2, ".pinme-install.log");
10464
+ const installLogPath = import_path15.default.join(PROJECT_DIR2, ".pinme-install.log");
10087
10465
  const suggestions = [
10088
10466
  "Run `npm install` in the project root, wait for it to finish, then rerun `pinme save`."
10089
10467
  ];
10090
- if (import_fs_extra8.default.existsSync(installLogPath)) {
10468
+ if (import_fs_extra9.default.existsSync(installLogPath)) {
10091
10469
  suggestions.push(
10092
10470
  `Background install log: ${installLogPath}`
10093
10471
  );
@@ -10114,7 +10492,7 @@ function isMissingDependencyError(error) {
10114
10492
  function dependenciesPresent() {
10115
10493
  return hasLocalBinary("wrangler") && hasLocalBinary("vite");
10116
10494
  }
10117
- function sleep2(ms) {
10495
+ function sleep3(ms) {
10118
10496
  return new Promise((resolve) => setTimeout(resolve, ms));
10119
10497
  }
10120
10498
  var WAIT_FOR_INSTALL_TIMEOUT_MS = 15 * 1e3;
@@ -10144,7 +10522,7 @@ async function ensureDependenciesReady() {
10144
10522
  const spinner = (0, import_ora3.default)("Waiting briefly for background dependency install...").start();
10145
10523
  const startedAt = Date.now();
10146
10524
  while (true) {
10147
- await sleep2(WAIT_POLL_INTERVAL_MS);
10525
+ await sleep3(WAIT_POLL_INTERVAL_MS);
10148
10526
  if (dependenciesPresent()) {
10149
10527
  spinner.succeed("Dependencies installed.");
10150
10528
  return;
@@ -10198,50 +10576,50 @@ async function installDependenciesInForeground() {
10198
10576
  }
10199
10577
  function cleanupInstallMarkers() {
10200
10578
  try {
10201
- import_fs_extra8.default.removeSync(import_path14.default.join(PROJECT_DIR2, INSTALL_LOG_FILE));
10202
- import_fs_extra8.default.removeSync(import_path14.default.join(PROJECT_DIR2, INSTALL_EXITCODE_FILE));
10203
- import_fs_extra8.default.removeSync(import_path14.default.join(PROJECT_DIR2, INSTALL_PID_FILE));
10579
+ import_fs_extra9.default.removeSync(import_path15.default.join(PROJECT_DIR2, INSTALL_LOG_FILE));
10580
+ import_fs_extra9.default.removeSync(import_path15.default.join(PROJECT_DIR2, INSTALL_EXITCODE_FILE));
10581
+ import_fs_extra9.default.removeSync(import_path15.default.join(PROJECT_DIR2, INSTALL_PID_FILE));
10204
10582
  } catch {
10205
10583
  }
10206
10584
  }
10207
10585
  function hasLocalBinary(name) {
10208
10586
  const binDirs = [
10209
- import_path14.default.join(PROJECT_DIR2, "node_modules", ".bin"),
10210
- import_path14.default.join(PROJECT_DIR2, "backend", "node_modules", ".bin"),
10211
- import_path14.default.join(PROJECT_DIR2, "frontend", "node_modules", ".bin")
10587
+ import_path15.default.join(PROJECT_DIR2, "node_modules", ".bin"),
10588
+ import_path15.default.join(PROJECT_DIR2, "backend", "node_modules", ".bin"),
10589
+ import_path15.default.join(PROJECT_DIR2, "frontend", "node_modules", ".bin")
10212
10590
  ];
10213
10591
  const candidates = process.platform === "win32" ? [name, `${name}.cmd`, `${name}.exe`, `${name}.ps1`] : [name];
10214
- return binDirs.some((dir) => candidates.some((candidate) => import_fs_extra8.default.existsSync(import_path14.default.join(dir, candidate))));
10592
+ return binDirs.some((dir) => candidates.some((candidate) => import_fs_extra9.default.existsSync(import_path15.default.join(dir, candidate))));
10215
10593
  }
10216
10594
  function getBuiltWorker() {
10217
- const distWorkerDir = import_path14.default.join(PROJECT_DIR2, "dist-worker");
10218
- if (!import_fs_extra8.default.existsSync(distWorkerDir)) {
10595
+ const distWorkerDir = import_path15.default.join(PROJECT_DIR2, "dist-worker");
10596
+ if (!import_fs_extra9.default.existsSync(distWorkerDir)) {
10219
10597
  throw createConfigError("Built worker output not found: `dist-worker/`.", [
10220
10598
  "Make sure `npm run build:worker` completed successfully."
10221
10599
  ]);
10222
10600
  }
10223
- const workerJsPath = import_path14.default.join(distWorkerDir, "worker.js");
10224
- if (!import_fs_extra8.default.existsSync(workerJsPath)) {
10601
+ const workerJsPath = import_path15.default.join(distWorkerDir, "worker.js");
10602
+ if (!import_fs_extra9.default.existsSync(workerJsPath)) {
10225
10603
  throw createConfigError("Built worker entry file not found: `dist-worker/worker.js`.", [
10226
10604
  "Check the worker build output and bundler config."
10227
10605
  ]);
10228
10606
  }
10229
10607
  const modulePaths = [];
10230
- const files = import_fs_extra8.default.readdirSync(distWorkerDir);
10608
+ const files = import_fs_extra9.default.readdirSync(distWorkerDir);
10231
10609
  for (const file of files) {
10232
10610
  if (file.endsWith(".js") && file !== "worker.js") {
10233
- modulePaths.push(import_path14.default.join(distWorkerDir, file));
10611
+ modulePaths.push(import_path15.default.join(distWorkerDir, file));
10234
10612
  }
10235
10613
  }
10236
10614
  return { workerJsPath, modulePaths };
10237
10615
  }
10238
10616
  function getSqlFiles() {
10239
- const sqlDir = import_path14.default.join(PROJECT_DIR2, "db");
10240
- if (!import_fs_extra8.default.existsSync(sqlDir)) {
10617
+ const sqlDir = import_path15.default.join(PROJECT_DIR2, "db");
10618
+ if (!import_fs_extra9.default.existsSync(sqlDir)) {
10241
10619
  return [];
10242
10620
  }
10243
- const files = import_fs_extra8.default.readdirSync(sqlDir).filter((f) => f.endsWith(".sql")).sort();
10244
- return files.map((f) => import_path14.default.join(sqlDir, f));
10621
+ const files = import_fs_extra9.default.readdirSync(sqlDir).filter((f) => f.endsWith(".sql")).sort();
10622
+ return files.map((f) => import_path15.default.join(sqlDir, f));
10245
10623
  }
10246
10624
  async function saveWorker(workerJsPath, modulePaths, sqlFiles, metadata, projectName) {
10247
10625
  var _a2, _b;
@@ -10261,20 +10639,20 @@ async function saveWorker(workerJsPath, modulePaths, sqlFiles, metadata, project
10261
10639
  formData.append("metadata", new Blob2([JSON.stringify(metadata)], {
10262
10640
  type: "application/json"
10263
10641
  }), "metadata.json");
10264
- const workerCode = import_fs_extra8.default.readFileSync(workerJsPath, "utf-8");
10642
+ const workerCode = import_fs_extra9.default.readFileSync(workerJsPath, "utf-8");
10265
10643
  formData.append("worker.js", new Blob2([workerCode], {
10266
10644
  type: "application/javascript+module"
10267
10645
  }), "worker.js");
10268
10646
  for (const modulePath of modulePaths) {
10269
- const filename = import_path14.default.basename(modulePath);
10270
- const content = import_fs_extra8.default.readFileSync(modulePath, "utf-8");
10647
+ const filename = import_path15.default.basename(modulePath);
10648
+ const content = import_fs_extra9.default.readFileSync(modulePath, "utf-8");
10271
10649
  formData.append(filename, new Blob2([content], {
10272
10650
  type: "application/javascript+module"
10273
10651
  }), filename);
10274
10652
  }
10275
10653
  for (const sqlFile of sqlFiles) {
10276
- const filename = import_path14.default.basename(sqlFile);
10277
- const content = import_fs_extra8.default.readFileSync(sqlFile, "utf-8");
10654
+ const filename = import_path15.default.basename(sqlFile);
10655
+ const content = import_fs_extra9.default.readFileSync(sqlFile, "utf-8");
10278
10656
  formData.append("sql_file", new Blob2([content], {
10279
10657
  type: "application/sql"
10280
10658
  }), filename);
@@ -10312,7 +10690,7 @@ async function saveWorker(workerJsPath, modulePaths, sqlFiles, metadata, project
10312
10690
  function buildFrontend() {
10313
10691
  console.log(import_chalk21.default.blue("Building frontend..."));
10314
10692
  try {
10315
- (0, import_child_process5.execSync)("npm run build:frontend", {
10693
+ (0, import_child_process4.execSync)("npm run build:frontend", {
10316
10694
  cwd: PROJECT_DIR2,
10317
10695
  stdio: "inherit"
10318
10696
  });
@@ -10329,7 +10707,7 @@ function buildFrontend() {
10329
10707
  }
10330
10708
  }
10331
10709
  function updateFrontendUrlInConfig2(configPath, frontendUrl) {
10332
- let config = import_fs_extra8.default.readFileSync(configPath, "utf-8");
10710
+ let config = import_fs_extra9.default.readFileSync(configPath, "utf-8");
10333
10711
  if (config.includes("frontend_url")) {
10334
10712
  config = config.replace(
10335
10713
  /frontend_url\s*=\s*"[^"]*"/,
@@ -10342,18 +10720,18 @@ function updateFrontendUrlInConfig2(configPath, frontendUrl) {
10342
10720
  `
10343
10721
  );
10344
10722
  }
10345
- import_fs_extra8.default.writeFileSync(configPath, config);
10723
+ import_fs_extra9.default.writeFileSync(configPath, config);
10346
10724
  }
10347
10725
  async function deployFrontend(projectName) {
10348
10726
  console.log(import_chalk21.default.blue("Deploying frontend to IPFS..."));
10349
10727
  try {
10350
10728
  const headers = getAuthHeaders();
10351
- const uploadResult = await uploadPath(import_path14.default.join(PROJECT_DIR2, "frontend", "dist"), {
10729
+ const uploadResult = await uploadPath(import_path15.default.join(PROJECT_DIR2, "frontend", "dist"), {
10352
10730
  action: "project_save",
10353
10731
  projectName,
10354
10732
  uid: headers["token-address"]
10355
10733
  });
10356
- updateFrontendUrlInConfig2(import_path14.default.join(PROJECT_DIR2, "pinme.toml"), uploadResult.publicUrl);
10734
+ updateFrontendUrlInConfig2(import_path15.default.join(PROJECT_DIR2, "pinme.toml"), uploadResult.publicUrl);
10357
10735
  return {
10358
10736
  contentHash: uploadResult.contentHash,
10359
10737
  publicUrl: uploadResult.publicUrl
@@ -10403,11 +10781,11 @@ async function saveCmd(options) {
10403
10781
  "Run `pinme login` and retry."
10404
10782
  ]);
10405
10783
  }
10406
- const projectDir = options.projectName || options.name ? import_path14.default.join(PROJECT_DIR2, options.projectName || options.name) : PROJECT_DIR2;
10407
- const tokenFileSrc = import_path14.default.join(PROJECT_DIR2, ".token.json");
10408
- const tokenFileDst = import_path14.default.join(projectDir, ".token.json");
10409
- if (import_fs_extra8.default.existsSync(tokenFileSrc) && !import_fs_extra8.default.existsSync(tokenFileDst)) {
10410
- import_fs_extra8.default.copySync(tokenFileSrc, tokenFileDst);
10784
+ const projectDir = options.projectName || options.name ? import_path15.default.join(PROJECT_DIR2, options.projectName || options.name) : PROJECT_DIR2;
10785
+ const tokenFileSrc = import_path15.default.join(PROJECT_DIR2, ".token.json");
10786
+ const tokenFileDst = import_path15.default.join(projectDir, ".token.json");
10787
+ if (import_fs_extra9.default.existsSync(tokenFileSrc) && !import_fs_extra9.default.existsSync(tokenFileDst)) {
10788
+ import_fs_extra9.default.copySync(tokenFileSrc, tokenFileDst);
10411
10789
  }
10412
10790
  console.log(import_chalk21.default.blue("Deploying to platform...\n"));
10413
10791
  console.log(import_chalk21.default.gray(`Project dir: ${PROJECT_DIR2}`));
@@ -10473,40 +10851,40 @@ async function saveCmd(options) {
10473
10851
 
10474
10852
  // bin/updateDb.ts
10475
10853
  var import_chalk22 = __toESM(require("chalk"));
10476
- var import_fs_extra9 = __toESM(require("fs-extra"));
10477
- var import_path15 = __toESM(require("path"));
10854
+ var import_fs_extra10 = __toESM(require("fs-extra"));
10855
+ var import_path16 = __toESM(require("path"));
10478
10856
  init_axios2();
10479
10857
  init_webLogin();
10480
10858
  init_cliError();
10481
10859
  init_config();
10482
10860
  var PROJECT_DIR3 = process.cwd();
10483
10861
  function loadConfig2() {
10484
- const configPath = import_path15.default.join(PROJECT_DIR3, "pinme.toml");
10485
- if (!import_fs_extra9.default.existsSync(configPath)) {
10862
+ const configPath = import_path16.default.join(PROJECT_DIR3, "pinme.toml");
10863
+ if (!import_fs_extra10.default.existsSync(configPath)) {
10486
10864
  throw createConfigError("`pinme.toml` not found in the current directory.", [
10487
10865
  "Run this command from the Pinme project root."
10488
10866
  ]);
10489
10867
  }
10490
- const configContent = import_fs_extra9.default.readFileSync(configPath, "utf-8");
10868
+ const configContent = import_fs_extra10.default.readFileSync(configPath, "utf-8");
10491
10869
  const projectNameMatch = configContent.match(/project_name\s*=\s*"([^"]+)"/);
10492
10870
  return {
10493
10871
  project_name: (projectNameMatch == null ? void 0 : projectNameMatch[1]) || ""
10494
10872
  };
10495
10873
  }
10496
10874
  function getSqlFiles2() {
10497
- const sqlDir = import_path15.default.join(PROJECT_DIR3, "db");
10498
- if (!import_fs_extra9.default.existsSync(sqlDir)) {
10875
+ const sqlDir = import_path16.default.join(PROJECT_DIR3, "db");
10876
+ if (!import_fs_extra10.default.existsSync(sqlDir)) {
10499
10877
  throw createConfigError("SQL directory not found: `db/`.", [
10500
10878
  "Create a `db/` directory and add at least one `.sql` migration file."
10501
10879
  ]);
10502
10880
  }
10503
- const files = import_fs_extra9.default.readdirSync(sqlDir).filter((f) => f.endsWith(".sql")).sort();
10881
+ const files = import_fs_extra10.default.readdirSync(sqlDir).filter((f) => f.endsWith(".sql")).sort();
10504
10882
  if (files.length === 0) {
10505
10883
  throw createConfigError("No `.sql` files were found in `db/`.", [
10506
10884
  "Add one or more migration files before running `pinme update-db`."
10507
10885
  ]);
10508
10886
  }
10509
- return files.map((f) => import_path15.default.join(sqlDir, f));
10887
+ return files.map((f) => import_path16.default.join(sqlDir, f));
10510
10888
  }
10511
10889
  async function updateDb(sqlFiles, projectName) {
10512
10890
  console.log(import_chalk22.default.blue("Importing SQL files to database..."));
@@ -10521,8 +10899,8 @@ async function updateDb(sqlFiles, projectName) {
10521
10899
  const formData = new FormData4();
10522
10900
  let totalSize = 0;
10523
10901
  for (const sqlFile of sqlFiles) {
10524
- const filename = import_path15.default.basename(sqlFile);
10525
- const content = import_fs_extra9.default.readFileSync(sqlFile);
10902
+ const filename = import_path16.default.basename(sqlFile);
10903
+ const content = import_fs_extra10.default.readFileSync(sqlFile);
10526
10904
  totalSize += content.length;
10527
10905
  if (totalSize > 10 * 1024 * 1024) {
10528
10906
  throw createConfigError("Total SQL payload exceeds the 10MB platform limit.", [
@@ -10577,11 +10955,11 @@ async function updateDbCmd(options) {
10577
10955
  "Run `pinme login` and retry."
10578
10956
  ]);
10579
10957
  }
10580
- const projectDir = (options == null ? void 0 : options.projectName) || (options == null ? void 0 : options.name) ? import_path15.default.join(PROJECT_DIR3, options.projectName || options.name) : PROJECT_DIR3;
10581
- const tokenFileSrc = import_path15.default.join(PROJECT_DIR3, ".token.json");
10582
- const tokenFileDst = import_path15.default.join(projectDir, ".token.json");
10583
- if (import_fs_extra9.default.existsSync(tokenFileSrc) && !import_fs_extra9.default.existsSync(tokenFileDst)) {
10584
- import_fs_extra9.default.copySync(tokenFileSrc, tokenFileDst);
10958
+ const projectDir = (options == null ? void 0 : options.projectName) || (options == null ? void 0 : options.name) ? import_path16.default.join(PROJECT_DIR3, options.projectName || options.name) : PROJECT_DIR3;
10959
+ const tokenFileSrc = import_path16.default.join(PROJECT_DIR3, ".token.json");
10960
+ const tokenFileDst = import_path16.default.join(projectDir, ".token.json");
10961
+ if (import_fs_extra10.default.existsSync(tokenFileSrc) && !import_fs_extra10.default.existsSync(tokenFileDst)) {
10962
+ import_fs_extra10.default.copySync(tokenFileSrc, tokenFileDst);
10585
10963
  }
10586
10964
  console.log(import_chalk22.default.blue("Importing SQL to database...\n"));
10587
10965
  console.log(import_chalk22.default.gray(`Project dir: ${PROJECT_DIR3}`));
@@ -10624,40 +11002,40 @@ async function updateDbCmd(options) {
10624
11002
 
10625
11003
  // bin/updateWorker.ts
10626
11004
  var import_chalk23 = __toESM(require("chalk"));
10627
- var import_fs_extra10 = __toESM(require("fs-extra"));
10628
- var import_path16 = __toESM(require("path"));
11005
+ var import_fs_extra11 = __toESM(require("fs-extra"));
11006
+ var import_path17 = __toESM(require("path"));
10629
11007
  init_axios2();
10630
- var import_child_process6 = require("child_process");
11008
+ var import_child_process5 = require("child_process");
10631
11009
  init_webLogin();
10632
11010
  init_cliError();
10633
11011
  init_config();
10634
11012
  var PROJECT_DIR4 = process.cwd();
10635
11013
  function loadConfig3() {
10636
- const configPath = import_path16.default.join(PROJECT_DIR4, "pinme.toml");
10637
- if (!import_fs_extra10.default.existsSync(configPath)) {
11014
+ const configPath = import_path17.default.join(PROJECT_DIR4, "pinme.toml");
11015
+ if (!import_fs_extra11.default.existsSync(configPath)) {
10638
11016
  throw createConfigError("`pinme.toml` not found in the current directory.", [
10639
11017
  "Run this command from the Pinme project root."
10640
11018
  ]);
10641
11019
  }
10642
- const configContent = import_fs_extra10.default.readFileSync(configPath, "utf-8");
11020
+ const configContent = import_fs_extra11.default.readFileSync(configPath, "utf-8");
10643
11021
  const projectNameMatch = configContent.match(/project_name\s*=\s*"([^"]+)"/);
10644
11022
  return {
10645
11023
  project_name: (projectNameMatch == null ? void 0 : projectNameMatch[1]) || ""
10646
11024
  };
10647
11025
  }
10648
11026
  function getMetadata2() {
10649
- const metadataPath = import_path16.default.join(PROJECT_DIR4, "backend", "metadata.json");
10650
- if (!import_fs_extra10.default.existsSync(metadataPath)) {
11027
+ const metadataPath = import_path17.default.join(PROJECT_DIR4, "backend", "metadata.json");
11028
+ if (!import_fs_extra11.default.existsSync(metadataPath)) {
10651
11029
  throw createConfigError("`backend/metadata.json` not found.", [
10652
11030
  "Create `backend/metadata.json` or restore it from the project template."
10653
11031
  ]);
10654
11032
  }
10655
- return import_fs_extra10.default.readJsonSync(metadataPath);
11033
+ return import_fs_extra11.default.readJsonSync(metadataPath);
10656
11034
  }
10657
11035
  function buildWorker2() {
10658
11036
  console.log(import_chalk23.default.blue("Building worker..."));
10659
11037
  try {
10660
- (0, import_child_process6.execSync)("npm run build:worker", {
11038
+ (0, import_child_process5.execSync)("npm run build:worker", {
10661
11039
  cwd: PROJECT_DIR4,
10662
11040
  stdio: "inherit"
10663
11041
  });
@@ -10669,23 +11047,23 @@ function buildWorker2() {
10669
11047
  }
10670
11048
  }
10671
11049
  function getBuiltWorker2() {
10672
- const distWorkerDir = import_path16.default.join(PROJECT_DIR4, "dist-worker");
10673
- if (!import_fs_extra10.default.existsSync(distWorkerDir)) {
11050
+ const distWorkerDir = import_path17.default.join(PROJECT_DIR4, "dist-worker");
11051
+ if (!import_fs_extra11.default.existsSync(distWorkerDir)) {
10674
11052
  throw createConfigError("Built worker output not found: `dist-worker/`.", [
10675
11053
  "Make sure `npm run build:worker` completed successfully."
10676
11054
  ]);
10677
11055
  }
10678
- const workerJsPath = import_path16.default.join(distWorkerDir, "worker.js");
10679
- if (!import_fs_extra10.default.existsSync(workerJsPath)) {
11056
+ const workerJsPath = import_path17.default.join(distWorkerDir, "worker.js");
11057
+ if (!import_fs_extra11.default.existsSync(workerJsPath)) {
10680
11058
  throw createConfigError("Built worker entry file not found: `dist-worker/worker.js`.", [
10681
11059
  "Check the worker build output and bundler config."
10682
11060
  ]);
10683
11061
  }
10684
11062
  const modulePaths = [];
10685
- const files = import_fs_extra10.default.readdirSync(distWorkerDir);
11063
+ const files = import_fs_extra11.default.readdirSync(distWorkerDir);
10686
11064
  for (const file of files) {
10687
11065
  if (file.endsWith(".js") && file !== "worker.js") {
10688
- modulePaths.push(import_path16.default.join(distWorkerDir, file));
11066
+ modulePaths.push(import_path17.default.join(distWorkerDir, file));
10689
11067
  }
10690
11068
  }
10691
11069
  return { workerJsPath, modulePaths };
@@ -10706,13 +11084,13 @@ async function updateWorker(workerJsPath, modulePaths, metadata, projectName) {
10706
11084
  formData.append("metadata", new Blob2([JSON.stringify(metadata)], {
10707
11085
  type: "application/json"
10708
11086
  }), "metadata.json");
10709
- const workerCode = import_fs_extra10.default.readFileSync(workerJsPath, "utf-8");
11087
+ const workerCode = import_fs_extra11.default.readFileSync(workerJsPath, "utf-8");
10710
11088
  formData.append("worker.js", new Blob2([workerCode], {
10711
11089
  type: "application/javascript+module"
10712
11090
  }), "worker.js");
10713
11091
  for (const modulePath of modulePaths) {
10714
- const filename = import_path16.default.basename(modulePath);
10715
- const content = import_fs_extra10.default.readFileSync(modulePath, "utf-8");
11092
+ const filename = import_path17.default.basename(modulePath);
11093
+ const content = import_fs_extra11.default.readFileSync(modulePath, "utf-8");
10716
11094
  formData.append(filename, new Blob2([content], {
10717
11095
  type: "application/javascript+module"
10718
11096
  }), filename);
@@ -10774,11 +11152,11 @@ async function updateWorkerCmd(options) {
10774
11152
  "Run `pinme login` and retry."
10775
11153
  ]);
10776
11154
  }
10777
- const projectDir = (options == null ? void 0 : options.projectName) || (options == null ? void 0 : options.name) ? import_path16.default.join(PROJECT_DIR4, options.projectName || options.name) : PROJECT_DIR4;
10778
- const tokenFileSrc = import_path16.default.join(PROJECT_DIR4, ".token.json");
10779
- const tokenFileDst = import_path16.default.join(projectDir, ".token.json");
10780
- if (import_fs_extra10.default.existsSync(tokenFileSrc) && !import_fs_extra10.default.existsSync(tokenFileDst)) {
10781
- import_fs_extra10.default.copySync(tokenFileSrc, tokenFileDst);
11155
+ const projectDir = (options == null ? void 0 : options.projectName) || (options == null ? void 0 : options.name) ? import_path17.default.join(PROJECT_DIR4, options.projectName || options.name) : PROJECT_DIR4;
11156
+ const tokenFileSrc = import_path17.default.join(PROJECT_DIR4, ".token.json");
11157
+ const tokenFileDst = import_path17.default.join(projectDir, ".token.json");
11158
+ if (import_fs_extra11.default.existsSync(tokenFileSrc) && !import_fs_extra11.default.existsSync(tokenFileDst)) {
11159
+ import_fs_extra11.default.copySync(tokenFileSrc, tokenFileDst);
10782
11160
  }
10783
11161
  console.log(import_chalk23.default.blue("Updating worker...\n"));
10784
11162
  console.log(import_chalk23.default.gray(`Project dir: ${PROJECT_DIR4}`));
@@ -10826,21 +11204,21 @@ async function updateWorkerCmd(options) {
10826
11204
 
10827
11205
  // bin/updateWeb.ts
10828
11206
  var import_chalk24 = __toESM(require("chalk"));
10829
- var import_fs_extra11 = __toESM(require("fs-extra"));
10830
- var import_path17 = __toESM(require("path"));
10831
- var import_child_process7 = require("child_process");
11207
+ var import_fs_extra12 = __toESM(require("fs-extra"));
11208
+ var import_path18 = __toESM(require("path"));
11209
+ var import_child_process6 = require("child_process");
10832
11210
  init_webLogin();
10833
11211
  init_cliError();
10834
11212
  init_config();
10835
11213
  var PROJECT_DIR5 = process.cwd();
10836
11214
  function loadConfig4() {
10837
- const configPath = import_path17.default.join(PROJECT_DIR5, "pinme.toml");
10838
- if (!import_fs_extra11.default.existsSync(configPath)) {
11215
+ const configPath = import_path18.default.join(PROJECT_DIR5, "pinme.toml");
11216
+ if (!import_fs_extra12.default.existsSync(configPath)) {
10839
11217
  throw createConfigError("`pinme.toml` not found in the current directory.", [
10840
11218
  "Run this command from the Pinme project root."
10841
11219
  ]);
10842
11220
  }
10843
- const configContent = import_fs_extra11.default.readFileSync(configPath, "utf-8");
11221
+ const configContent = import_fs_extra12.default.readFileSync(configPath, "utf-8");
10844
11222
  const projectNameMatch = configContent.match(/project_name\s*=\s*"([^"]+)"/);
10845
11223
  return {
10846
11224
  project_name: (projectNameMatch == null ? void 0 : projectNameMatch[1]) || ""
@@ -10852,7 +11230,7 @@ function getProjectManagementUrl3(projectName) {
10852
11230
  function buildFrontend2() {
10853
11231
  console.log(import_chalk24.default.blue("Building frontend..."));
10854
11232
  try {
10855
- (0, import_child_process7.execSync)("npm run build:frontend", {
11233
+ (0, import_child_process6.execSync)("npm run build:frontend", {
10856
11234
  cwd: PROJECT_DIR5,
10857
11235
  stdio: "inherit"
10858
11236
  });
@@ -10867,7 +11245,7 @@ async function deployFrontend2(projectName) {
10867
11245
  console.log(import_chalk24.default.blue("Deploying frontend to IPFS..."));
10868
11246
  try {
10869
11247
  const headers = getAuthHeaders();
10870
- const uploadResult = await uploadPath(import_path17.default.join(PROJECT_DIR5, "frontend", "dist"), {
11248
+ const uploadResult = await uploadPath(import_path18.default.join(PROJECT_DIR5, "frontend", "dist"), {
10871
11249
  action: "project_update_web",
10872
11250
  projectName,
10873
11251
  uid: headers["token-address"]
@@ -10892,11 +11270,11 @@ async function updateWebCmd(options) {
10892
11270
  "Run `pinme login` and retry."
10893
11271
  ]);
10894
11272
  }
10895
- const projectDir = (options == null ? void 0 : options.projectName) || (options == null ? void 0 : options.name) ? import_path17.default.join(PROJECT_DIR5, options.projectName || options.name) : PROJECT_DIR5;
10896
- const tokenFileSrc = import_path17.default.join(PROJECT_DIR5, ".token.json");
10897
- const tokenFileDst = import_path17.default.join(projectDir, ".token.json");
10898
- if (import_fs_extra11.default.existsSync(tokenFileSrc) && !import_fs_extra11.default.existsSync(tokenFileDst)) {
10899
- import_fs_extra11.default.copySync(tokenFileSrc, tokenFileDst);
11273
+ const projectDir = (options == null ? void 0 : options.projectName) || (options == null ? void 0 : options.name) ? import_path18.default.join(PROJECT_DIR5, options.projectName || options.name) : PROJECT_DIR5;
11274
+ const tokenFileSrc = import_path18.default.join(PROJECT_DIR5, ".token.json");
11275
+ const tokenFileDst = import_path18.default.join(projectDir, ".token.json");
11276
+ if (import_fs_extra12.default.existsSync(tokenFileSrc) && !import_fs_extra12.default.existsSync(tokenFileDst)) {
11277
+ import_fs_extra12.default.copySync(tokenFileSrc, tokenFileDst);
10900
11278
  }
10901
11279
  console.log(import_chalk24.default.blue("Updating web (frontend)...\n"));
10902
11280
  console.log(import_chalk24.default.gray(`Project dir: ${PROJECT_DIR5}`));
@@ -10940,16 +11318,16 @@ async function updateWebCmd(options) {
10940
11318
  var import_chalk25 = __toESM(require("chalk"));
10941
11319
  var import_inquirer9 = __toESM(require("inquirer"));
10942
11320
  init_axios2();
10943
- var import_fs_extra12 = __toESM(require("fs-extra"));
10944
- var import_path18 = __toESM(require("path"));
11321
+ var import_fs_extra13 = __toESM(require("fs-extra"));
11322
+ var import_path19 = __toESM(require("path"));
10945
11323
  init_webLogin();
10946
11324
  init_config();
10947
11325
  function getProjectName() {
10948
- const configPath = import_path18.default.join(process.cwd(), "pinme.toml");
10949
- if (!import_fs_extra12.default.existsSync(configPath)) {
11326
+ const configPath = import_path19.default.join(process.cwd(), "pinme.toml");
11327
+ if (!import_fs_extra13.default.existsSync(configPath)) {
10950
11328
  return null;
10951
11329
  }
10952
- const config = import_fs_extra12.default.readFileSync(configPath, "utf-8");
11330
+ const config = import_fs_extra13.default.readFileSync(configPath, "utf-8");
10953
11331
  const match = config.match(/project_name\s*=\s*"([^"]+)"/);
10954
11332
  return (match == null ? void 0 : match[1]) || null;
10955
11333
  }