@posty5/social-publisher-post 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11754,7 +11754,7 @@ var require_follow_redirects = __commonJS({
11754
11754
  options.headers[headerList[i]] = headerList[i + 1];
11755
11755
  }
11756
11756
  }
11757
- if (!isArray2(options.sensitiveHeaders)) {
11757
+ if (!Array.isArray(options.sensitiveHeaders)) {
11758
11758
  options.sensitiveHeaders = [];
11759
11759
  }
11760
11760
  if (options.host) {
@@ -12011,9 +12011,6 @@ var require_follow_redirects = __commonJS({
12011
12011
  var dot = subdomain.length - domain.length - 1;
12012
12012
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
12013
12013
  }
12014
- function isArray2(value) {
12015
- return value instanceof Array;
12016
- }
12017
12014
  function isString2(value) {
12018
12015
  return typeof value === "string" || value instanceof String;
12019
12016
  }
@@ -12196,10 +12193,16 @@ var isPlainObject = (val) => {
12196
12193
  return false;
12197
12194
  }
12198
12195
  const prototype2 = getPrototypeOf(val);
12199
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
12200
- // evidence the value is tagged/iterable, while ignoring members reachable
12201
- // only through shared or terminal prototype boundaries.
12202
- !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
12196
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
12197
+ // value is tagged/iterable, ignoring members reachable only through shared
12198
+ // or terminal prototype boundaries. This is exactly what
12199
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
12200
+ // above (null, Object.prototype, or a terminal null-prototype template) is
12201
+ // a boundary, so the walk never inspects anything but `val`'s own members,
12202
+ // and stops before even those when `val` is itself the boundary
12203
+ // Object.prototype. Checking that inline avoids allocating the walker's
12204
+ // `seen` list twice per call on the mergeConfig / merge hot path.
12205
+ (isPrototypeBoundary(val, prototype2, true) || !hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator));
12203
12206
  };
12204
12207
  var isEmptyObject = (val) => {
12205
12208
  if (!isObject(val) || isBuffer(val)) {
@@ -12300,11 +12303,21 @@ var isContextDefined = (context) => !isUndefined(context) && context !== _global
12300
12303
  function merge(...objs) {
12301
12304
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
12302
12305
  const result = {};
12306
+ const lowerCaseKeys = caseless ? /* @__PURE__ */ Object.create(null) : null;
12303
12307
  const assignValue = (val, key) => {
12304
12308
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
12305
12309
  return;
12306
12310
  }
12307
- const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
12311
+ let targetKey = key;
12312
+ if (lowerCaseKeys && typeof key === "string") {
12313
+ const lowerKey = key.toLowerCase();
12314
+ const knownKey = lowerCaseKeys[lowerKey];
12315
+ if (knownKey !== void 0 && hasOwnProperty(result, knownKey)) {
12316
+ targetKey = knownKey;
12317
+ } else {
12318
+ lowerCaseKeys[lowerKey] = key;
12319
+ }
12320
+ }
12308
12321
  const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
12309
12322
  if (isPlainObject(existing) && isPlainObject(val)) {
12310
12323
  result[targetKey] = merge(existing, val);
@@ -12322,7 +12335,7 @@ function merge(...objs) {
12322
12335
  continue;
12323
12336
  }
12324
12337
  forEach(source, assignValue);
12325
- if (typeof source !== "object" || isArray(source)) {
12338
+ if (typeof source !== "object" || isArray(source) || !Object.getOwnPropertySymbols) {
12326
12339
  continue;
12327
12340
  }
12328
12341
  const symbols = Object.getOwnPropertySymbols(source);
@@ -12418,7 +12431,24 @@ var toArray = (thing) => {
12418
12431
  if (!thing) return null;
12419
12432
  if (isArray(thing)) return thing;
12420
12433
  let i = thing.length;
12421
- if (!isNumber(i)) return null;
12434
+ if (!Number.isSafeInteger(i) || i < 0 || i > 4294967295) return null;
12435
+ const indexes = /* @__PURE__ */ new Set();
12436
+ const seen = /* @__PURE__ */ new Set();
12437
+ let source = thing;
12438
+ while (source != null && indexes.size < i) {
12439
+ if (seen.has(source)) return null;
12440
+ seen.add(source);
12441
+ const prototype2 = getPrototypeOf(source);
12442
+ if (isPrototypeBoundary(source, prototype2, source === thing)) break;
12443
+ Object.getOwnPropertyNames(source).forEach((key) => {
12444
+ const index = +key;
12445
+ if (Number.isInteger(index) && index >= 0 && index < i && String(index) === key && hasOwnProperty(source, key)) {
12446
+ indexes.add(index);
12447
+ }
12448
+ });
12449
+ source = prototype2;
12450
+ }
12451
+ if (indexes.size !== i) return null;
12422
12452
  const arr = new Array(i);
12423
12453
  while (i-- > 0) {
12424
12454
  arr[i] = thing[i];
@@ -12650,7 +12680,7 @@ var ignoreDuplicateOf = utils_default.toObjectSet([
12650
12680
  "user-agent"
12651
12681
  ]);
12652
12682
  var parseHeaders_default = (rawHeaders) => {
12653
- const parsed = {};
12683
+ const parsed = /* @__PURE__ */ Object.create(null);
12654
12684
  let key;
12655
12685
  let val;
12656
12686
  let i;
@@ -12818,9 +12848,11 @@ function parseParameters(value) {
12818
12848
  return parameters;
12819
12849
  }
12820
12850
  var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
12851
+ var PROTO_HEADER_SLOT = "__Proto__";
12852
+ var headerSlot = (name) => name === "__proto__" ? PROTO_HEADER_SLOT : name;
12821
12853
  function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
12822
12854
  if (utils_default.isFunction(filter2)) {
12823
- return filter2.call(this, value, header);
12855
+ return filter2.call(context, value, header);
12824
12856
  }
12825
12857
  if (isHeaderNameFilter) {
12826
12858
  value = header;
@@ -12865,7 +12897,7 @@ var AxiosHeaders = class {
12865
12897
  }
12866
12898
  const key = utils_default.findKey(self2, lHeader);
12867
12899
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
12868
- self2[key || _header] = normalizeValue(_value);
12900
+ self2[headerSlot(key || _header)] = normalizeValue(_value);
12869
12901
  }
12870
12902
  }
12871
12903
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -12958,7 +12990,7 @@ var AxiosHeaders = class {
12958
12990
  }
12959
12991
  normalize(format) {
12960
12992
  const self2 = this;
12961
- const headers = {};
12993
+ const headers = /* @__PURE__ */ Object.create(null);
12962
12994
  utils_default.forEach(this, (value, header) => {
12963
12995
  const key = utils_default.findKey(headers, header);
12964
12996
  if (key) {
@@ -12966,7 +12998,7 @@ var AxiosHeaders = class {
12966
12998
  delete self2[header];
12967
12999
  return;
12968
13000
  }
12969
- const normalized = format ? formatHeader(header) : String(header).trim();
13001
+ const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
12970
13002
  if (normalized !== header) {
12971
13003
  delete self2[header];
12972
13004
  }
@@ -13116,6 +13148,28 @@ function aggregateErrorMessage(error) {
13116
13148
  }).filter(Boolean).join("; ");
13117
13149
  return message || error.name || "AggregateError";
13118
13150
  }
13151
+ var CAUSED_BY_SEPARATOR = "\nCaused by: ";
13152
+ var $causeStack = /* @__PURE__ */ Symbol("causeStack");
13153
+ function getCauseStackIndex(error, stack) {
13154
+ const causeStack = utils_default.hasOwnProp(error, $causeStack) && error[$causeStack];
13155
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
13156
+ }
13157
+ function appendCauseStack(target, source) {
13158
+ try {
13159
+ const sourceStack = source && source.stack;
13160
+ if (typeof sourceStack !== "string" || !sourceStack) {
13161
+ return;
13162
+ }
13163
+ const targetStack = target.stack;
13164
+ if (typeof targetStack !== "string" || !targetStack) {
13165
+ return;
13166
+ }
13167
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
13168
+ target.stack = targetStack + causeStack;
13169
+ Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
13170
+ } catch (e) {
13171
+ }
13172
+ }
13119
13173
  var AxiosError = class _AxiosError extends Error {
13120
13174
  static from(error, code, config, request, response, customProps) {
13121
13175
  let message = error.message;
@@ -13131,6 +13185,7 @@ var AxiosError = class _AxiosError extends Error {
13131
13185
  configurable: true
13132
13186
  });
13133
13187
  axiosError.name = error.name;
13188
+ appendCauseStack(axiosError, error);
13134
13189
  if (error.status != null && axiosError.status == null) {
13135
13190
  axiosError.status = error.status;
13136
13191
  }
@@ -13442,6 +13497,12 @@ function trimHandlers(handlers) {
13442
13497
  handlers.pop();
13443
13498
  }
13444
13499
  }
13500
+ function normalizeHandlerId(id) {
13501
+ if (typeof id === "string" && id !== "" && String(Number(id)) === id) {
13502
+ return Number(id);
13503
+ }
13504
+ return id;
13505
+ }
13445
13506
  function syncHandlerEntries(manager, internals) {
13446
13507
  const handlers = manager.handlers;
13447
13508
  const length = countHandlers(handlers);
@@ -13512,9 +13573,10 @@ var InterceptorManager = class {
13512
13573
  eject(id) {
13513
13574
  const internals = this[$internals2];
13514
13575
  syncHandlerEntries(this, internals);
13515
- const entry = internals.handlerEntries.get(id);
13576
+ const handlerId = normalizeHandlerId(id);
13577
+ const entry = internals.handlerEntries.get(handlerId);
13516
13578
  if (entry) {
13517
- internals.handlerEntries.delete(id);
13579
+ internals.handlerEntries.delete(handlerId);
13518
13580
  if (this.handlers[entry.index] !== entry.handler) {
13519
13581
  return;
13520
13582
  }
@@ -13574,7 +13636,8 @@ var transitional_default = {
13574
13636
  clarifyTimeoutError: false,
13575
13637
  legacyInterceptorReqResOrdering: true,
13576
13638
  advertiseZstdAcceptEncoding: false,
13577
- validateStatusUndefinedResolves: true
13639
+ validateStatusUndefinedResolves: true,
13640
+ encodeBasicAuthUsername: false
13578
13641
  };
13579
13642
  var URLSearchParams_default = url__default.default.URLSearchParams;
13580
13643
 
@@ -13678,6 +13741,24 @@ function arrayToObject(arr) {
13678
13741
  }
13679
13742
  return obj;
13680
13743
  }
13744
+ function normalizeArray(value) {
13745
+ if (!utils_default.isArray(value)) return value;
13746
+ const keys = Object.keys(value);
13747
+ return keys.length !== value.length || keys.some((key, index) => key !== String(index)) ? arrayToObject(value) : value;
13748
+ }
13749
+ function normalizeArrays(obj) {
13750
+ const pending = [obj];
13751
+ while (pending.length) {
13752
+ const target = pending.pop();
13753
+ Object.keys(target).forEach((key) => {
13754
+ const value = target[key] = normalizeArray(target[key]);
13755
+ if (utils_default.isArray(value) || utils_default.isPlainObject(value)) {
13756
+ pending.push(value);
13757
+ }
13758
+ });
13759
+ }
13760
+ return obj;
13761
+ }
13681
13762
  function formDataToJSON(formData) {
13682
13763
  function buildPath(path, value, target, index) {
13683
13764
  throwIfDepthExceeded(index);
@@ -13688,6 +13769,7 @@ function formDataToJSON(formData) {
13688
13769
  name = !name && utils_default.isArray(target) ? target.length : name;
13689
13770
  if (isLast) {
13690
13771
  if (utils_default.hasOwnProp(target, name)) {
13772
+ target[name] = normalizeArray(target[name]);
13691
13773
  target[name] = utils_default.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
13692
13774
  } else {
13693
13775
  target[name] = value;
@@ -13708,7 +13790,7 @@ function formDataToJSON(formData) {
13708
13790
  utils_default.forEachEntry(formData, (name, value) => {
13709
13791
  buildPath(parsePropPath(name), value, obj, 0);
13710
13792
  });
13711
- return obj;
13793
+ return normalizeArrays(obj);
13712
13794
  }
13713
13795
  return null;
13714
13796
  }
@@ -14050,16 +14132,16 @@ var import_https_proxy_agent = __toESM(require_dist());
14050
14132
  var import_follow_redirects = __toESM(require_follow_redirects());
14051
14133
 
14052
14134
  // ../node_modules/axios/lib/env/data.js
14053
- var VERSION = "1.20.0";
14135
+ var VERSION = "1.21.0";
14054
14136
 
14055
14137
  // ../node_modules/axios/lib/helpers/parseProtocol.js
14056
14138
  function parseProtocol(url2) {
14057
14139
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url2);
14058
- return match && match[1] || "";
14140
+ return match && match[1].toLowerCase() || "";
14059
14141
  }
14060
14142
 
14061
14143
  // ../node_modules/axios/lib/helpers/fromDataURI.js
14062
- var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
14144
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/i;
14063
14145
  function fromDataURI(uri, asBlob, options) {
14064
14146
  const _Blob = options && options.Blob || platform_default.classes.Blob;
14065
14147
  const protocol = parseProtocol(uri);
@@ -14082,7 +14164,10 @@ function fromDataURI(uri, asBlob, options) {
14082
14164
  } else if (params) {
14083
14165
  mime = "text/plain" + params;
14084
14166
  }
14085
- const buffer = encoding === "base64" ? Buffer.from(body, "base64") : Buffer.from(decodeURIComponent(body), encoding);
14167
+ const buffer = encoding === "base64" ? Buffer.from(
14168
+ body.replace(/%([\da-f]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16))),
14169
+ "base64"
14170
+ ) : Buffer.from(decodeURIComponent(body), encoding);
14086
14171
  if (asBlob) {
14087
14172
  if (!_Blob) {
14088
14173
  throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
@@ -14162,7 +14247,10 @@ var AxiosTransformStream = class extends stream3__default.default.Transform {
14162
14247
  const timeWindow = internals.timeWindow;
14163
14248
  const divider = 1e3 / timeWindow;
14164
14249
  const bytesThreshold = maxRate / divider;
14165
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
14250
+ let minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
14251
+ if (maxRate) {
14252
+ minChunkSize = Math.min(bytesThreshold, minChunkSize);
14253
+ }
14166
14254
  const pushChunk = (_chunk, _callback) => {
14167
14255
  const bytes = Buffer.byteLength(_chunk);
14168
14256
  internals.bytesSeen += bytes;
@@ -14178,6 +14266,9 @@ var AxiosTransformStream = class extends stream3__default.default.Transform {
14178
14266
  }
14179
14267
  };
14180
14268
  const transformChunk = (_chunk, _callback) => {
14269
+ if (this.destroyed) {
14270
+ return _callback();
14271
+ }
14181
14272
  const chunkSize = Buffer.byteLength(_chunk);
14182
14273
  let chunkRemainder = null;
14183
14274
  let maxChunkSize = readableHighWaterMark;
@@ -14200,7 +14291,7 @@ var AxiosTransformStream = class extends stream3__default.default.Transform {
14200
14291
  }, timeWindow - passed);
14201
14292
  }
14202
14293
  if (bytesLeft < maxChunkSize) {
14203
- maxChunkSize = bytesLeft;
14294
+ maxChunkSize = Math.max(1, Math.floor(bytesLeft));
14204
14295
  }
14205
14296
  }
14206
14297
  if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
@@ -14251,9 +14342,9 @@ var CRLF_BYTES = textEncoder.encode(CRLF);
14251
14342
  var CRLF_BYTES_COUNT = 2;
14252
14343
  var FormDataPart = class {
14253
14344
  constructor(name, value) {
14254
- const { escapeName } = this.constructor;
14345
+ const { escapeName: escapeName2 } = this.constructor;
14255
14346
  const isStringValue = utils_default.isString(value);
14256
- let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`;
14347
+ let headers = `Content-Disposition: form-data; name="${escapeName2(name)}"${!isStringValue && value.name ? `; filename="${escapeName2(value.name)}"` : ""}${CRLF}`;
14257
14348
  if (isStringValue) {
14258
14349
  value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
14259
14350
  } else {
@@ -14407,7 +14498,7 @@ var Http2Sessions = class {
14407
14498
  timer = null;
14408
14499
  }
14409
14500
  stream4.once("close", () => {
14410
- if (!--streamsCount) {
14501
+ if (!--streamsCount && !removed) {
14411
14502
  timer = setTimeout(() => {
14412
14503
  timer = null;
14413
14504
  removeSession();
@@ -14419,6 +14510,7 @@ var Http2Sessions = class {
14419
14510
  }
14420
14511
  session.once("close", removeSession);
14421
14512
  session.once("error", removeSession);
14513
+ session.once("goaway", removeSession);
14422
14514
  let entry = [session, options];
14423
14515
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
14424
14516
  return session;
@@ -14440,8 +14532,6 @@ var callbackify = (fn, reducer) => {
14440
14532
  } : fn;
14441
14533
  };
14442
14534
  var callbackify_default = callbackify;
14443
-
14444
- // ../node_modules/axios/lib/helpers/shouldBypassProxy.js
14445
14535
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
14446
14536
  var trimTrailingDots = (value) => {
14447
14537
  let end = value.length;
@@ -14635,7 +14725,20 @@ var normalizeNoProxyHost = (hostname) => {
14635
14725
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
14636
14726
  hostname = hostname.slice(1, -1);
14637
14727
  }
14638
- const trimmed = trimTrailingDots(hostname);
14728
+ let trimmed = trimTrailingDots(hostname);
14729
+ if (trimmed.indexOf(":") !== -1) {
14730
+ try {
14731
+ trimmed = new URL("http://[" + trimmed + "]/").hostname.slice(1, -1);
14732
+ } catch (_err) {
14733
+ return trimmed;
14734
+ }
14735
+ } else if (/[\u0080-\uffff]/.test(trimmed)) {
14736
+ const prefix = /^[*.]+/.exec(trimmed);
14737
+ const start = prefix ? prefix[0] : "";
14738
+ const ascii = url.domainToASCII(trimmed.slice(start.length));
14739
+ if (!ascii) return "";
14740
+ trimmed = start + trimTrailingDots(ascii);
14741
+ }
14639
14742
  const ipv4 = normalizeIPAddress(trimmed);
14640
14743
  if (ipv4 !== trimmed) {
14641
14744
  return ipv4;
@@ -14906,6 +15009,26 @@ var estimateBase64BufferAllocation = (body) => {
14906
15009
  }
14907
15010
  return Math.floor((len - padding) * 3 / 4);
14908
15011
  };
15012
+ var estimatePercentDecodedBase64BufferAllocation = (body) => {
15013
+ if (body.indexOf("%") === -1) {
15014
+ return estimateBase64BufferAllocation(body);
15015
+ }
15016
+ let length = 0;
15017
+ let previous = 0;
15018
+ let last = 0;
15019
+ for (let i = 0, len = body.length; i < len; i++) {
15020
+ let code = body.charCodeAt(i);
15021
+ if (code === 37 && isPercentEncodedByte(body, i, len)) {
15022
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
15023
+ i += 2;
15024
+ }
15025
+ length++;
15026
+ previous = last;
15027
+ last = code;
15028
+ }
15029
+ const padding = last === 61 ? previous === 61 ? 2 : 1 : 0;
15030
+ return Math.floor((length - padding) * 3 / 4);
15031
+ };
14909
15032
  var estimatePercentDecodedBase64Bytes = (body) => {
14910
15033
  const len = body.length;
14911
15034
  let significant = 0;
@@ -14935,14 +15058,14 @@ var estimatePercentDecodedBase64Bytes = (body) => {
14935
15058
  }
14936
15059
  return base64Bytes(significant);
14937
15060
  };
14938
- var estimateDataURLBytes = (url2, estimateBase64) => {
15061
+ var estimateDataURLBytes = (url2, estimateBase64, base64Pattern) => {
14939
15062
  if (!url2 || typeof url2 !== "string") return 0;
14940
- if (!url2.startsWith("data:")) return 0;
15063
+ if (!/^data:/i.test(url2)) return 0;
14941
15064
  const comma = url2.indexOf(",");
14942
15065
  if (comma < 0) return 0;
14943
15066
  const meta = url2.slice(5, comma);
14944
15067
  const body = url2.slice(comma + 1);
14945
- const isBase64 = /;base64/i.test(meta);
15068
+ const isBase64 = base64Pattern.test(meta);
14946
15069
  if (isBase64) {
14947
15070
  return estimateBase64(body);
14948
15071
  }
@@ -14974,11 +15097,12 @@ function estimateDataURLDecodedBytes(url2) {
14974
15097
  const fragmentIndex = typeof url2 === "string" ? url2.indexOf("#") : -1;
14975
15098
  return estimateDataURLBytes(
14976
15099
  fragmentIndex === -1 ? url2 : url2.slice(0, fragmentIndex),
14977
- estimatePercentDecodedBase64Bytes
15100
+ estimatePercentDecodedBase64Bytes,
15101
+ /; *base64[\t\n\f\r ]*$/i
14978
15102
  );
14979
15103
  }
14980
15104
  function estimateDataURLBufferAllocation(url2) {
14981
- return estimateDataURLBytes(url2, estimateBase64BufferAllocation);
15105
+ return estimateDataURLBytes(url2, estimatePercentDecodedBase64BufferAllocation, /;base64$/i);
14982
15106
  }
14983
15107
 
14984
15108
  // ../node_modules/axios/lib/adapters/http.js
@@ -15012,6 +15136,18 @@ function handleSocketError(err) {
15012
15136
  var kAxiosInstalledTunnel = /* @__PURE__ */ Symbol("axios.http.installedTunnel");
15013
15137
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
15014
15138
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
15139
+ var directAgents = /* @__PURE__ */ new WeakMap();
15140
+ var directAgentHooks = ["createConnection", "getName"];
15141
+ var nativeAgentPoolHooks = [
15142
+ "addRequest",
15143
+ "createSocket",
15144
+ "removeSocket",
15145
+ "keepSocketAlive",
15146
+ "reuseSocket",
15147
+ "_getSession",
15148
+ "_cacheSession",
15149
+ "_evictSession"
15150
+ ];
15015
15151
  var NODE_NATIVE_ENV_PROXY_SUPPORT = {
15016
15152
  22: 21,
15017
15153
  24: 5
@@ -15041,6 +15177,49 @@ function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.
15041
15177
  function getProxyEnvAgent(options, configHttpAgent, configHttpsAgent) {
15042
15178
  return isHttps.test(options.protocol) ? configHttpsAgent || https__default.default.globalAgent : configHttpAgent || http__default.default.globalAgent;
15043
15179
  }
15180
+ function getDirectAgent(configuredAgent, transport) {
15181
+ if (!process.allowedNodeEnvironmentFlags || !process.allowedNodeEnvironmentFlags.has("--use-env-proxy")) {
15182
+ return configuredAgent;
15183
+ }
15184
+ const agent = configuredAgent || transport.globalAgent;
15185
+ const options = agent && agent.options;
15186
+ if (!(agent instanceof transport.Agent) || agent.protocol !== transport.globalAgent.protocol || !options || !utils_default.hasOwnProp(options, "proxyEnv") || typeof options.proxyEnv !== "object" || options.proxyEnv === null) {
15187
+ return configuredAgent;
15188
+ }
15189
+ for (const hook of nativeAgentPoolHooks) {
15190
+ if (utils_default.isFunction(transport.Agent.prototype[hook]) && agent[hook] !== transport.Agent.prototype[hook]) {
15191
+ throw new AxiosError_default(
15192
+ "proxy: false cannot adapt an agent overriding " + hook + "; use an agent constructed without proxyEnv",
15193
+ AxiosError_default.ERR_BAD_OPTION_VALUE
15194
+ );
15195
+ }
15196
+ }
15197
+ let direct = directAgents.get(agent);
15198
+ if (!direct) {
15199
+ direct = new transport.Agent({ ...options, proxyEnv: void 0 });
15200
+ const destroy = agent.destroy;
15201
+ agent.destroy = function destroyWithDirectAgent() {
15202
+ try {
15203
+ return destroy.apply(this, arguments);
15204
+ } finally {
15205
+ direct.destroy();
15206
+ }
15207
+ };
15208
+ directAgents.set(agent, direct);
15209
+ }
15210
+ for (const hook of directAgentHooks) {
15211
+ direct[hook] = agent[hook] === transport.Agent.prototype[hook] ? transport.Agent.prototype[hook] : bind(agent[hook], agent);
15212
+ }
15213
+ return direct;
15214
+ }
15215
+ function setDirectAgent(options, configHttpAgent, configHttpsAgent) {
15216
+ const secure = isHttps.test(options.protocol);
15217
+ const agent = getDirectAgent(secure ? configHttpsAgent : configHttpAgent, secure ? https__default.default : http__default.default);
15218
+ options.agent = agent;
15219
+ if (options.agents) {
15220
+ options.agents[secure ? "https" : "http"] = agent;
15221
+ }
15222
+ }
15044
15223
  function getTunnelingAgent(agentOptions, userHttpsAgent) {
15045
15224
  const key = agentOptions.protocol + "//" + agentOptions.hostname + ":" + (agentOptions.port || "") + "#" + (agentOptions.auth || "");
15046
15225
  const cache = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, /* @__PURE__ */ new Map()).get(userHttpsAgent) : tunnelingAgentCache;
@@ -15048,13 +15227,12 @@ function getTunnelingAgent(agentOptions, userHttpsAgent) {
15048
15227
  if (agent) return agent;
15049
15228
  const merged = userHttpsAgent && userHttpsAgent.options ? { ...userHttpsAgent.options, ...agentOptions } : agentOptions;
15050
15229
  agent = new import_https_proxy_agent.default(merged);
15051
- if (userHttpsAgent && userHttpsAgent.options) {
15052
- const originTLSOptions = { ...userHttpsAgent.options };
15053
- const callback = agent.callback;
15054
- agent.callback = function axiosTunnelingAgentCallback(req, opts) {
15055
- return callback.call(this, req, { ...originTLSOptions, ...opts });
15056
- };
15057
- }
15230
+ const callback = agent.callback;
15231
+ agent.callback = function axiosTunnelingAgentCallback(req, opts) {
15232
+ const originTLSAgent = userHttpsAgent || https__default.default.globalAgent;
15233
+ const originTLSOptions = originTLSAgent && originTLSAgent.options;
15234
+ return callback.call(this, req, { ...originTLSOptions, ...opts });
15235
+ };
15058
15236
  agent[kAxiosInstalledTunnel] = true;
15059
15237
  cache.set(key, agent);
15060
15238
  return agent;
@@ -15078,6 +15256,10 @@ var flushOnFinish = (stream4, [throttled, flush]) => {
15078
15256
  };
15079
15257
  var http2Sessions = new Http2Sessions_default();
15080
15258
  function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
15259
+ if (!isSameOriginRedirect(options, requestDetails)) {
15260
+ stripMatchingHeaders(options.headers, /* @__PURE__ */ new Set(["authorization", "cookie"]));
15261
+ delete options.auth;
15262
+ }
15081
15263
  if (options.beforeRedirects.proxy) {
15082
15264
  options.beforeRedirects.proxy(options);
15083
15265
  }
@@ -15087,6 +15269,9 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
15087
15269
  if (options.beforeRedirects.sensitiveHeaders) {
15088
15270
  options.beforeRedirects.sensitiveHeaders(options, requestDetails);
15089
15271
  }
15272
+ if (options.beforeRedirects.direct) {
15273
+ options.beforeRedirects.direct(options);
15274
+ }
15090
15275
  if (options.beforeRedirects.config) {
15091
15276
  options.beforeRedirects.config(options, responseDetails, requestDetails);
15092
15277
  }
@@ -15132,6 +15317,9 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
15132
15317
  if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
15133
15318
  options.agent = void 0;
15134
15319
  }
15320
+ if (isRedirect && options.agents && options.agents.https && options.agents.https[kAxiosInstalledTunnel]) {
15321
+ options.agents.https = configHttpsAgent;
15322
+ }
15135
15323
  if (proxy) {
15136
15324
  const isProxyURL = proxy instanceof URL;
15137
15325
  const readProxyField = (key) => isProxyURL || utils_default.hasOwnProp(proxy, key) ? proxy[key] : void 0;
@@ -15312,9 +15500,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15312
15500
  if (httpVersion === void 0) httpVersion = 1;
15313
15501
  const rawHttpVersion = httpVersion;
15314
15502
  let http2Options = own2("http2Options");
15503
+ const configProxy = own2("proxy");
15315
15504
  const httpAgent = own2("httpAgent");
15316
15505
  const httpsAgent = own2("httpsAgent");
15317
- const configProxy = own2("proxy");
15318
15506
  const responseType = own2("responseType");
15319
15507
  const responseEncoding = own2("responseEncoding");
15320
15508
  const socketPath = own2("socketPath");
@@ -15453,6 +15641,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15453
15641
  } catch (err) {
15454
15642
  throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST, config);
15455
15643
  }
15644
+ if (maxContentLength > -1 && (responseType === "blob" ? convertedData.size : convertedData.length) > maxContentLength) {
15645
+ return reject(
15646
+ new AxiosError_default(
15647
+ "maxContentLength size of " + maxContentLength + " exceeded",
15648
+ AxiosError_default.ERR_BAD_RESPONSE,
15649
+ config
15650
+ )
15651
+ );
15652
+ }
15456
15653
  if (responseType === "text") {
15457
15654
  convertedData = convertedData.toString(responseEncoding);
15458
15655
  if (!responseEncoding || responseEncoding === "utf8") {
@@ -15654,9 +15851,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15654
15851
  }
15655
15852
  let transport;
15656
15853
  let isNativeTransport = false;
15657
- let transportEnforcesMaxBodyLength = false;
15658
15854
  const isHttpsRequest = isHttps.test(options.protocol);
15659
- if (options.agent == null) {
15855
+ if (!isHttp2 && configProxy === false) {
15856
+ setDirectAgent(options, httpAgent, httpsAgent);
15857
+ options.beforeRedirects.direct = (redirectOptions) => {
15858
+ setDirectAgent(redirectOptions, httpAgent, httpsAgent);
15859
+ };
15860
+ } else if (options.agent == null) {
15660
15861
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
15661
15862
  }
15662
15863
  if (isHttp2) {
@@ -15678,7 +15879,6 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15678
15879
  transport = isHttpsRequest ? https__default.default : http__default.default;
15679
15880
  isNativeTransport = true;
15680
15881
  } else {
15681
- transportEnforcesMaxBodyLength = true;
15682
15882
  options.sensitiveHeaders = [];
15683
15883
  if (maxRedirects) {
15684
15884
  options.maxRedirects = maxRedirects;
@@ -15964,7 +16164,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15964
16164
  }
15965
16165
  });
15966
16166
  let uploadStream = data;
15967
- if (maxBodyLength > -1 && !transportEnforcesMaxBodyLength) {
16167
+ if (maxBodyLength > -1) {
15968
16168
  const limit = maxBodyLength;
15969
16169
  let bytesSent = 0;
15970
16170
  uploadStream = stream3__default.default.pipeline(
@@ -16001,16 +16201,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
16001
16201
  });
16002
16202
  };
16003
16203
 
16004
- // ../node_modules/axios/lib/helpers/isURLSameOrigin.js
16005
- var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
16006
- url2 = new URL(url2, platform_default.origin);
16007
- return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
16008
- })(
16009
- new URL(platform_default.origin),
16010
- platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)
16011
- ) : () => true;
16012
-
16013
16204
  // ../node_modules/axios/lib/helpers/cookies.js
16205
+ var decodeCookieValue = (value) => {
16206
+ try {
16207
+ return decodeURIComponent(value);
16208
+ } catch (e) {
16209
+ return value;
16210
+ }
16211
+ };
16014
16212
  var cookies_default = platform_default.hasStandardBrowserEnv ? (
16015
16213
  // Standard browser envs support document.cookie
16016
16214
  {
@@ -16036,20 +16234,29 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
16036
16234
  },
16037
16235
  read(name) {
16038
16236
  if (typeof document === "undefined") return null;
16039
- const cookies = document.cookie.split(";");
16237
+ const cookieString = document.cookie;
16238
+ if (!cookieString) return null;
16239
+ const cookies = cookieString.split(";");
16040
16240
  for (let i = 0; i < cookies.length; i++) {
16041
16241
  const cookie = cookies[i].replace(/^\s+/, "");
16042
16242
  const eq = cookie.indexOf("=");
16043
16243
  if (eq !== -1 && cookie.slice(0, eq) === name) {
16044
- try {
16045
- return decodeURIComponent(cookie.slice(eq + 1));
16046
- } catch (e) {
16047
- return cookie.slice(eq + 1);
16048
- }
16244
+ return decodeCookieValue(cookie.slice(eq + 1));
16049
16245
  }
16050
16246
  }
16051
16247
  return null;
16052
16248
  },
16249
+ async readAsync(name) {
16250
+ try {
16251
+ const store = typeof window !== "undefined" && window.cookieStore;
16252
+ if (store && utils_default.isFunction(store.get)) {
16253
+ const cookie = await store.get(name);
16254
+ return cookie ? decodeCookieValue(cookie.value) : null;
16255
+ }
16256
+ } catch (e) {
16257
+ }
16258
+ return this.read(name);
16259
+ },
16053
16260
  remove(name) {
16054
16261
  this.write(name, "", Date.now() - 864e5, "/");
16055
16262
  }
@@ -16062,130 +16269,224 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
16062
16269
  read() {
16063
16270
  return null;
16064
16271
  },
16272
+ async readAsync() {
16273
+ return null;
16274
+ },
16065
16275
  remove() {
16066
16276
  }
16067
16277
  }
16068
16278
  );
16069
16279
 
16280
+ // ../node_modules/axios/lib/helpers/isURLSameOrigin.js
16281
+ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2) => (url2) => {
16282
+ url2 = new URL(url2, document.baseURI || platform_default.origin);
16283
+ return origin2.protocol === url2.protocol && origin2.host === url2.host && origin2.port === url2.port;
16284
+ })(new URL(platform_default.origin)) : () => true;
16285
+
16286
+ // ../node_modules/axios/lib/core/assertParamsAcyclic.js
16287
+ function assertParamsAcyclic(params) {
16288
+ const pending = [{ value: params }];
16289
+ const active = /* @__PURE__ */ new WeakSet();
16290
+ const visited = /* @__PURE__ */ new WeakSet();
16291
+ while (pending.length) {
16292
+ const { value, done } = pending.pop();
16293
+ if (!utils_default.isPlainObject(value) && !utils_default.isArray(value)) continue;
16294
+ if (done) {
16295
+ active.delete(value);
16296
+ continue;
16297
+ }
16298
+ if (active.has(value)) {
16299
+ throw new AxiosError_default(
16300
+ "Circular reference detected in params",
16301
+ AxiosError_default.ERR_BAD_OPTION_VALUE
16302
+ );
16303
+ }
16304
+ if (visited.has(value)) continue;
16305
+ visited.add(value);
16306
+ active.add(value);
16307
+ pending.push({ value, done: true });
16308
+ const keys = Object.keys(value);
16309
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
16310
+ Object.getOwnPropertySymbols(value).forEach((key) => {
16311
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
16312
+ if (descriptor && descriptor.enumerable) keys.push(key);
16313
+ });
16314
+ }
16315
+ keys.forEach((key) => {
16316
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
16317
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
16318
+ if (descriptor && utils_default.hasOwnProp(descriptor, "value")) {
16319
+ pending.push({ value: descriptor.value });
16320
+ }
16321
+ } else {
16322
+ pending.push({ value: value[key] });
16323
+ }
16324
+ });
16325
+ }
16326
+ }
16327
+
16070
16328
  // ../node_modules/axios/lib/core/mergeConfig.js
16071
16329
  var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
16072
16330
  var ownEnumerableKeys = (thing) => {
16073
16331
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
16074
16332
  return Object.keys(thing).concat(
16075
- Object.getOwnPropertySymbols(thing).filter(
16076
- (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
16077
- )
16333
+ Object.getOwnPropertySymbols(thing).filter((symbol) => {
16334
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
16335
+ return descriptor && descriptor.enumerable;
16336
+ })
16078
16337
  );
16079
16338
  }
16080
16339
  return Object.keys(thing);
16081
16340
  };
16082
- function mergeConfig(config1, config2) {
16083
- config1 = config1 || {};
16084
- config2 = config2 || {};
16085
- const config = /* @__PURE__ */ Object.create(null);
16086
- Object.defineProperty(config, "hasOwnProperty", {
16087
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
16088
- // this data descriptor into an accessor descriptor on the way in.
16089
- __proto__: null,
16090
- value: Object.prototype.hasOwnProperty,
16091
- enumerable: false,
16092
- writable: true,
16093
- configurable: true
16094
- });
16095
- function getMergedValue(target, source, prop, caseless) {
16096
- if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
16097
- return utils_default.merge.call({ caseless }, target, source);
16098
- } else if (utils_default.isPlainObject(source)) {
16099
- return utils_default.merge({}, source);
16100
- } else if (utils_default.isArray(source)) {
16101
- return source.slice();
16102
- }
16103
- return source;
16341
+ function mergeParams(a, b) {
16342
+ const pending = [];
16343
+ const copies = /* @__PURE__ */ new WeakMap();
16344
+ const empty = {};
16345
+ function copy(target, source) {
16346
+ if (!utils_default.isPlainObject(source)) {
16347
+ return utils_default.isArray(source) ? source.slice() : source;
16348
+ }
16349
+ const base = utils_default.isPlainObject(target) ? target : empty;
16350
+ let bases = copies.get(source);
16351
+ if (!bases) {
16352
+ bases = /* @__PURE__ */ new WeakMap();
16353
+ copies.set(source, bases);
16354
+ }
16355
+ if (bases.has(base)) return bases.get(base);
16356
+ const result2 = {};
16357
+ bases.set(base, result2);
16358
+ pending.push({ base, source, result: result2 });
16359
+ return result2;
16360
+ }
16361
+ const result = utils_default.isUndefined(b) ? copy(void 0, a) : copy(a, b);
16362
+ while (pending.length) {
16363
+ const { base, source, result: target } = pending.pop();
16364
+ const baseKeys = new Set(ownEnumerableKeys(base));
16365
+ const sourceKeys = new Set(ownEnumerableKeys(source));
16366
+ const keys = /* @__PURE__ */ new Set([...baseKeys, ...sourceKeys]);
16367
+ keys.forEach((key) => {
16368
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return;
16369
+ const hasSource = sourceKeys.has(key);
16370
+ const value = hasSource ? source[key] : void 0;
16371
+ const previous = (!hasSource || utils_default.isPlainObject(value)) && baseKeys.has(key) ? base[key] : void 0;
16372
+ target[key] = hasSource ? copy(previous, value) : copy(void 0, previous);
16373
+ });
16104
16374
  }
16105
- function mergeDeepProperties(a, b, prop, caseless) {
16106
- if (!utils_default.isUndefined(b)) {
16107
- return getMergedValue(a, b, prop, caseless);
16108
- } else if (!utils_default.isUndefined(a)) {
16109
- return getMergedValue(void 0, a, prop, caseless);
16110
- }
16375
+ assertParamsAcyclic(result);
16376
+ return result;
16377
+ }
16378
+ function getMergedValue(target, source, prop, caseless) {
16379
+ if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
16380
+ return utils_default.merge.call({ caseless }, target, source);
16381
+ } else if (utils_default.isPlainObject(source)) {
16382
+ return utils_default.merge({}, source);
16383
+ } else if (utils_default.isArray(source)) {
16384
+ return source.slice();
16385
+ }
16386
+ return source;
16387
+ }
16388
+ function mergeDeepProperties(a, b, prop, caseless) {
16389
+ if (!utils_default.isUndefined(b)) {
16390
+ return getMergedValue(a, b, prop, caseless);
16391
+ } else if (!utils_default.isUndefined(a)) {
16392
+ return getMergedValue(void 0, a, prop, caseless);
16111
16393
  }
16112
- function valueFromConfig2(a, b) {
16113
- if (!utils_default.isUndefined(b)) {
16114
- return getMergedValue(void 0, b);
16115
- }
16394
+ }
16395
+ function valueFromConfig2(a, b) {
16396
+ if (!utils_default.isUndefined(b)) {
16397
+ return getMergedValue(void 0, b);
16116
16398
  }
16117
- function defaultToConfig2(a, b) {
16118
- if (!utils_default.isUndefined(b)) {
16119
- return getMergedValue(void 0, b);
16120
- } else if (!utils_default.isUndefined(a)) {
16121
- return getMergedValue(void 0, a);
16122
- }
16399
+ }
16400
+ function defaultToConfig2(a, b) {
16401
+ if (!utils_default.isUndefined(b)) {
16402
+ return getMergedValue(void 0, b);
16403
+ } else if (!utils_default.isUndefined(a)) {
16404
+ return getMergedValue(void 0, a);
16123
16405
  }
16124
- function getMergedTransitionalOption(prop) {
16125
- const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
16126
- if (!utils_default.isUndefined(transitional2)) {
16127
- if (utils_default.isPlainObject(transitional2)) {
16128
- if (utils_default.hasOwnProp(transitional2, prop)) {
16129
- return transitional2[prop];
16130
- }
16131
- } else {
16132
- return void 0;
16406
+ }
16407
+ function getMergedTransitionalOption(config1, config2, prop) {
16408
+ const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
16409
+ if (!utils_default.isUndefined(transitional2)) {
16410
+ if (utils_default.isPlainObject(transitional2)) {
16411
+ if (utils_default.hasOwnProp(transitional2, prop)) {
16412
+ return transitional2[prop];
16133
16413
  }
16414
+ } else {
16415
+ return void 0;
16134
16416
  }
16135
- const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
16136
- if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) {
16137
- return transitional1[prop];
16138
- }
16139
- return void 0;
16140
16417
  }
16141
- function mergeDirectKeys(a, b, prop) {
16142
- if (utils_default.hasOwnProp(config2, prop)) {
16143
- return getMergedValue(a, b);
16144
- } else if (utils_default.hasOwnProp(config1, prop)) {
16145
- return getMergedValue(void 0, a);
16146
- }
16147
- }
16148
- const mergeMap = {
16149
- url: valueFromConfig2,
16150
- method: valueFromConfig2,
16151
- data: valueFromConfig2,
16152
- baseURL: defaultToConfig2,
16153
- transformRequest: defaultToConfig2,
16154
- transformResponse: defaultToConfig2,
16155
- paramsSerializer: defaultToConfig2,
16156
- timeout: defaultToConfig2,
16157
- timeoutErrorMessage: defaultToConfig2,
16158
- withCredentials: defaultToConfig2,
16159
- withXSRFToken: defaultToConfig2,
16160
- adapter: defaultToConfig2,
16161
- responseType: defaultToConfig2,
16162
- xsrfCookieName: defaultToConfig2,
16163
- xsrfHeaderName: defaultToConfig2,
16164
- onUploadProgress: defaultToConfig2,
16165
- onDownloadProgress: defaultToConfig2,
16166
- decompress: defaultToConfig2,
16167
- maxContentLength: defaultToConfig2,
16168
- maxBodyLength: defaultToConfig2,
16169
- beforeRedirect: defaultToConfig2,
16170
- transport: defaultToConfig2,
16171
- httpAgent: defaultToConfig2,
16172
- httpsAgent: defaultToConfig2,
16173
- cancelToken: defaultToConfig2,
16174
- socketPath: defaultToConfig2,
16175
- allowedSocketPaths: defaultToConfig2,
16176
- responseEncoding: defaultToConfig2,
16177
- validateStatus: mergeDirectKeys,
16178
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
16179
- };
16180
- utils_default.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
16181
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
16418
+ const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
16419
+ if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) {
16420
+ return transitional1[prop];
16421
+ }
16422
+ return void 0;
16423
+ }
16424
+ function mergeDirectKeys(a, b, prop, config1, config2) {
16425
+ if (utils_default.hasOwnProp(config2, prop)) {
16426
+ return getMergedValue(a, b);
16427
+ } else if (utils_default.hasOwnProp(config1, prop)) {
16428
+ return getMergedValue(void 0, a);
16429
+ }
16430
+ }
16431
+ function mergeHeaders(a, b, prop) {
16432
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
16433
+ }
16434
+ var hasOwnPropertyDescriptor = Object.freeze({
16435
+ __proto__: null,
16436
+ value: Object.prototype.hasOwnProperty,
16437
+ enumerable: false,
16438
+ writable: true,
16439
+ configurable: true
16440
+ });
16441
+ var mergeMap = {
16442
+ url: valueFromConfig2,
16443
+ method: valueFromConfig2,
16444
+ data: valueFromConfig2,
16445
+ baseURL: defaultToConfig2,
16446
+ transformRequest: defaultToConfig2,
16447
+ transformResponse: defaultToConfig2,
16448
+ params: mergeParams,
16449
+ paramsSerializer: defaultToConfig2,
16450
+ timeout: defaultToConfig2,
16451
+ timeoutErrorMessage: defaultToConfig2,
16452
+ withCredentials: defaultToConfig2,
16453
+ withXSRFToken: defaultToConfig2,
16454
+ adapter: defaultToConfig2,
16455
+ responseType: defaultToConfig2,
16456
+ xsrfCookieName: defaultToConfig2,
16457
+ xsrfHeaderName: defaultToConfig2,
16458
+ onUploadProgress: defaultToConfig2,
16459
+ onDownloadProgress: defaultToConfig2,
16460
+ decompress: defaultToConfig2,
16461
+ maxContentLength: defaultToConfig2,
16462
+ maxBodyLength: defaultToConfig2,
16463
+ beforeRedirect: defaultToConfig2,
16464
+ transport: defaultToConfig2,
16465
+ httpAgent: defaultToConfig2,
16466
+ httpsAgent: defaultToConfig2,
16467
+ cancelToken: defaultToConfig2,
16468
+ socketPath: defaultToConfig2,
16469
+ allowedSocketPaths: defaultToConfig2,
16470
+ responseEncoding: defaultToConfig2,
16471
+ validateStatus: mergeDirectKeys,
16472
+ headers: mergeHeaders
16473
+ };
16474
+ function mergeConfig(config1, config2) {
16475
+ config1 = config1 || {};
16476
+ config2 = config2 || {};
16477
+ const config = /* @__PURE__ */ Object.create(null);
16478
+ Object.defineProperty(config, "hasOwnProperty", hasOwnPropertyDescriptor);
16479
+ const keys = ownEnumerableKeys({ ...config1, ...config2 });
16480
+ for (let i = 0, len = keys.length; i < len; i++) {
16481
+ const prop = keys[i];
16482
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") continue;
16182
16483
  const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
16183
16484
  const a = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
16184
16485
  const b = utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0;
16185
- const configValue = merge2(a, b, prop);
16486
+ const configValue = merge2 === mergeDirectKeys ? merge2(a, b, prop, config1, config2) : merge2(a, b, prop);
16186
16487
  utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
16187
- });
16188
- if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
16488
+ }
16489
+ if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption(config1, config2, "validateStatusUndefinedResolves") === false) {
16189
16490
  if (utils_default.hasOwnProp(config1, "validateStatus")) {
16190
16491
  config.validateStatus = getMergedValue(void 0, config1.validateStatus);
16191
16492
  } else {
@@ -16200,7 +16501,8 @@ var encodeUTF8 = (str) => encodeURIComponent(str).replace(
16200
16501
  /%([0-9A-F]{2})/gi,
16201
16502
  (_, hex) => String.fromCharCode(parseInt(hex, 16))
16202
16503
  );
16203
- function resolveConfig(config) {
16504
+ var readCookie = (name) => cookies_default.read(name);
16505
+ function resolveConfig(config, readXsrfCookie = readCookie) {
16204
16506
  const newConfig = mergeConfig({}, config);
16205
16507
  const own2 = (key) => utils_default.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
16206
16508
  const data = own2("data");
@@ -16221,10 +16523,15 @@ function resolveConfig(config) {
16221
16523
  if (auth) {
16222
16524
  const username = utils_default.getSafeProp(auth, "username") || "";
16223
16525
  const password = utils_default.getSafeProp(auth, "password") || "";
16526
+ const transitional2 = own2("transitional");
16527
+ const encodeUsername = transitional2 && utils_default.hasOwnProp(transitional2, "encodeBasicAuthUsername") && transitional2.encodeBasicAuthUsername === true;
16224
16528
  try {
16225
16529
  headers.set(
16226
16530
  "Authorization",
16227
- "Basic " + btoa(username + ":" + (password ? encodeUTF8(password) : ""))
16531
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
16532
+ "Basic " + btoa(
16533
+ (encodeUsername ? encodeUTF8(username) : username) + ":" + (password ? encodeUTF8(password) : "")
16534
+ )
16228
16535
  );
16229
16536
  } catch (e) {
16230
16537
  throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_OPTION_VALUE, config);
@@ -16244,7 +16551,7 @@ function resolveConfig(config) {
16244
16551
  }
16245
16552
  const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin_default(newConfig.url);
16246
16553
  if (shouldSendXSRF) {
16247
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
16554
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
16248
16555
  if (xsrfValue) {
16249
16556
  headers.set(xsrfHeaderName, xsrfValue);
16250
16557
  }
@@ -16258,16 +16565,50 @@ var resolveConfig_default = resolveConfig;
16258
16565
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
16259
16566
  var xhr_default = isXHRAdapterSupported && function(config) {
16260
16567
  return new Promise(function dispatchXhrRequest(resolve, reject) {
16261
- const _config = resolveConfig_default(config);
16568
+ let useAsyncXsrf;
16569
+ try {
16570
+ const store = platform_default.hasStandardBrowserEnv && typeof window !== "undefined" && window.cookieStore;
16571
+ useAsyncXsrf = store && utils_default.isFunction(store.get);
16572
+ } catch (e) {
16573
+ }
16574
+ let xsrfCookieName;
16575
+ const _config = resolveConfig_default(
16576
+ config,
16577
+ useAsyncXsrf ? (name) => {
16578
+ xsrfCookieName = name;
16579
+ return null;
16580
+ } : void 0
16581
+ );
16262
16582
  let requestData = _config.data;
16263
16583
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
16264
16584
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
16265
16585
  let onCanceled;
16586
+ let timeoutId;
16266
16587
  let uploadThrottled, downloadThrottled;
16267
16588
  let flushUpload, flushDownload, flushDownloadWithEvent;
16268
16589
  function done() {
16269
- flushUpload && flushUpload();
16270
- flushDownload && flushDownload();
16590
+ clearTimeout(timeoutId);
16591
+ try {
16592
+ flushUpload && flushUpload();
16593
+ } catch (err) {
16594
+ setTimeout(() => {
16595
+ throw err;
16596
+ });
16597
+ }
16598
+ try {
16599
+ flushDownload && flushDownload();
16600
+ } catch (err) {
16601
+ setTimeout(() => {
16602
+ throw err;
16603
+ });
16604
+ }
16605
+ if (request) {
16606
+ downloadThrottled && request.removeEventListener("progress", downloadThrottled);
16607
+ if (request.upload) {
16608
+ uploadThrottled && request.upload.removeEventListener("progress", uploadThrottled);
16609
+ flushUpload && request.upload.removeEventListener("loadend", flushUpload);
16610
+ }
16611
+ }
16271
16612
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
16272
16613
  _config.signal && _config.signal.removeEventListener("abort", onCanceled);
16273
16614
  }
@@ -16353,6 +16694,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16353
16694
  request = null;
16354
16695
  };
16355
16696
  request.ontimeout = function handleTimeout() {
16697
+ if (!request) return;
16356
16698
  let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
16357
16699
  const transitional2 = _config.transitional || transitional_default;
16358
16700
  if (_config.timeoutErrorMessage) {
@@ -16370,11 +16712,6 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16370
16712
  request = null;
16371
16713
  };
16372
16714
  requestData === void 0 && requestHeaders.setContentType(null);
16373
- if ("setRequestHeader" in request) {
16374
- utils_default.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
16375
- request.setRequestHeader(key, val);
16376
- });
16377
- }
16378
16715
  if (!utils_default.isUndefined(_config.withCredentials)) {
16379
16716
  request.withCredentials = !!_config.withCredentials;
16380
16717
  }
@@ -16399,15 +16736,18 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16399
16736
  return;
16400
16737
  }
16401
16738
  reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
16402
- request.abort();
16739
+ const xhr = request;
16403
16740
  done();
16404
16741
  request = null;
16742
+ xhr.abort();
16405
16743
  };
16406
16744
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
16745
+ if (!request) return;
16407
16746
  if (_config.signal) {
16408
16747
  _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
16409
16748
  }
16410
16749
  }
16750
+ if (!request) return;
16411
16751
  const protocol = parseProtocol(_config.url);
16412
16752
  if (protocol && !platform_default.protocols.includes(protocol)) {
16413
16753
  reject(
@@ -16420,7 +16760,58 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16420
16760
  done();
16421
16761
  return;
16422
16762
  }
16423
- request.send(requestData || null);
16763
+ const sendRequest = () => {
16764
+ if (!request) return;
16765
+ if ("setRequestHeader" in request) {
16766
+ utils_default.forEach(
16767
+ toByteStringHeaderObject(requestHeaders),
16768
+ function setRequestHeader(val, key) {
16769
+ request.setRequestHeader(key, val);
16770
+ }
16771
+ );
16772
+ }
16773
+ request.send(requestData || null);
16774
+ };
16775
+ if (xsrfCookieName) {
16776
+ const now = typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
16777
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : void 0;
16778
+ const abortOnTimeout = () => {
16779
+ if (!request) return;
16780
+ const xhr = request;
16781
+ xhr.ontimeout();
16782
+ xhr.abort();
16783
+ };
16784
+ if (deadline !== void 0) {
16785
+ const scheduleTimeout = () => {
16786
+ const remaining = deadline - now();
16787
+ if (remaining > 0) {
16788
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 2147483647));
16789
+ } else {
16790
+ abortOnTimeout();
16791
+ }
16792
+ };
16793
+ scheduleTimeout();
16794
+ }
16795
+ cookies_default.readAsync(xsrfCookieName).then((value) => {
16796
+ if (!request) return;
16797
+ if (deadline !== void 0 && now() >= deadline) {
16798
+ abortOnTimeout();
16799
+ return;
16800
+ }
16801
+ if (value) {
16802
+ const headerName = utils_default.hasOwnProp(_config, "xsrfHeaderName") && _config.xsrfHeaderName;
16803
+ requestHeaders.set(headerName, value);
16804
+ }
16805
+ sendRequest();
16806
+ }).catch((error) => {
16807
+ if (!request) return;
16808
+ reject(AxiosError_default.from(error, null, config, request));
16809
+ done();
16810
+ request = null;
16811
+ });
16812
+ } else {
16813
+ sendRequest();
16814
+ }
16424
16815
  });
16425
16816
  };
16426
16817
 
@@ -16453,7 +16844,8 @@ var composeSignals = (signals, timeout) => {
16453
16844
  timer && clearTimeout(timer);
16454
16845
  timer = null;
16455
16846
  signals.forEach((signal2) => {
16456
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
16847
+ const unsubscribeSignal = utils_default.getSafeProp(signal2, "unsubscribe");
16848
+ utils_default.isFunction(unsubscribeSignal) ? unsubscribeSignal.call(signal2, onabort) : signal2.removeEventListener("abort", onabort);
16457
16849
  });
16458
16850
  signals = null;
16459
16851
  };
@@ -16553,6 +16945,110 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
16553
16945
  );
16554
16946
  };
16555
16947
 
16948
+ // ../node_modules/axios/lib/helpers/formDataToBlob.js
16949
+ var CRLF2 = "\r\n";
16950
+ var normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF2);
16951
+ var escapeName = (value) => String(value).replace(
16952
+ /[\r\n"]/g,
16953
+ (char) => char === "\r" ? "%0D" : char === "\n" ? "%0A" : "%22"
16954
+ );
16955
+ var stringBytes = (value, normalize) => {
16956
+ let length = 0;
16957
+ for (let i = 0; i < value.length; i++) {
16958
+ const code = value.charCodeAt(i);
16959
+ if (normalize && (code === 13 || code === 10)) {
16960
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
16961
+ length += 2;
16962
+ } else if (code < 128) {
16963
+ length++;
16964
+ } else if (code < 2048) {
16965
+ length += 2;
16966
+ } else if (code >= 55296 && code <= 56319 && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
16967
+ length += 4;
16968
+ i++;
16969
+ } else {
16970
+ length += 3;
16971
+ }
16972
+ }
16973
+ return length;
16974
+ };
16975
+ var FormDataError = class extends TypeError {
16976
+ constructor(message, reason) {
16977
+ super(message);
16978
+ this.name = "FormDataError";
16979
+ this.reason = reason;
16980
+ }
16981
+ };
16982
+ function formDataToBlob(form, Blob2, limit, limitError, boundary) {
16983
+ if (!utils_default.isFunction(Blob2)) {
16984
+ throw new FormDataError("Blob is not supported", "blob");
16985
+ }
16986
+ if (!utils_default.isString(boundary) || !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) || / $/.test(boundary)) {
16987
+ throw new FormDataError("Invalid multipart boundary", "boundary");
16988
+ }
16989
+ const footer = "--" + boundary + "--" + CRLF2;
16990
+ let length = footer.length;
16991
+ const parts = [];
16992
+ const checkLength = (extra) => {
16993
+ if (length + extra > limit) throw limitError();
16994
+ };
16995
+ checkLength(0);
16996
+ for (const [name, value] of form) {
16997
+ const isString2 = utils_default.isString(value);
16998
+ const valueLength = isString2 ? stringBytes(value, true) : value.size;
16999
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
17000
+ throw new FormDataError("Unsupported FormData part size", "part");
17001
+ }
17002
+ checkLength(
17003
+ valueLength + stringBytes(name, true) + (!isString2 && value.name ? stringBytes(value.name, false) : 0) + (!isString2 && value.type ? stringBytes(value.type, false) : 0)
17004
+ );
17005
+ let header = "--" + boundary + CRLF2 + 'Content-Disposition: form-data; name="' + escapeName(normalizeLines(name)) + '"';
17006
+ if (!isString2) {
17007
+ header += '; filename="' + escapeName(utils_default.isString(value.name) ? value.name : "blob") + '"' + CRLF2 + "Content-Type: " + String(value.type || "application/octet-stream").replace(/[\r\n]/g, "");
17008
+ }
17009
+ header += CRLF2 + CRLF2;
17010
+ const partLength = stringBytes(header, false) + valueLength + CRLF2.length;
17011
+ checkLength(partLength);
17012
+ length += partLength;
17013
+ parts.push({ header, value, isString: isString2 });
17014
+ }
17015
+ const blobParts = [];
17016
+ for (const part of parts) {
17017
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF2);
17018
+ }
17019
+ blobParts.push(footer);
17020
+ return new Blob2(blobParts, { type: "multipart/form-data; boundary=" + boundary });
17021
+ }
17022
+
17023
+ // ../node_modules/axios/lib/core/createMultipartBody.js
17024
+ function createMultipartBody(form, Blob2, limit, limitError, boundary) {
17025
+ if (!utils_default.isFunction(Blob2)) {
17026
+ throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
17027
+ }
17028
+ if (boundary === void 0) {
17029
+ if (utils_default.isFunction(platform_default.generateString)) {
17030
+ boundary = "axios-" + platform_default.generateString(36, "0123456789abcdef");
17031
+ } else {
17032
+ const crypto2 = utils_default.global.crypto;
17033
+ if (!crypto2 || !utils_default.isFunction(crypto2.getRandomValues)) {
17034
+ throw new AxiosError_default("Random byte generation is not supported", AxiosError_default.ERR_NOT_SUPPORT);
17035
+ }
17036
+ const random = new Uint8Array(18);
17037
+ crypto2.getRandomValues(random);
17038
+ boundary = "axios-" + Array.from(random, (value) => ("0" + value.toString(16)).slice(-2)).join("");
17039
+ }
17040
+ }
17041
+ try {
17042
+ return formDataToBlob(form, Blob2, limit, limitError, boundary);
17043
+ } catch (error) {
17044
+ if (error instanceof FormDataError) {
17045
+ const code = error.reason === "boundary" ? AxiosError_default.ERR_BAD_OPTION_VALUE : AxiosError_default.ERR_BAD_REQUEST;
17046
+ throw new AxiosError_default(error.message, code);
17047
+ }
17048
+ throw error;
17049
+ }
17050
+ }
17051
+
16556
17052
  // ../node_modules/axios/lib/adapters/fetch.js
16557
17053
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
16558
17054
  var DEFAULT_REQUEST_OPTIONS = {
@@ -16605,11 +17101,13 @@ var factory = (env) => {
16605
17101
  },
16606
17102
  {
16607
17103
  Request: globalObject.Request,
16608
- Response: globalObject.Response
17104
+ Response: globalObject.Response,
17105
+ Blob: globalObject.Blob
16609
17106
  },
16610
17107
  env
16611
17108
  );
16612
- const { fetch: envFetch, Request, Response } = env;
17109
+ const envFetch = utils_default.hasOwnProp(env, "fetch") ? env.fetch : void 0;
17110
+ const { Request, Response, Blob: Blob2 } = env;
16613
17111
  const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
16614
17112
  const isRequestSupported = isFunction2(Request);
16615
17113
  const isResponseSupported = isFunction2(Response);
@@ -16635,6 +17133,13 @@ var factory = (env) => {
16635
17133
  return duplexAccessed && !hasContentType;
16636
17134
  });
16637
17135
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
17136
+ const requestDefaults = Object.assign(/* @__PURE__ */ Object.create(null), DEFAULT_REQUEST_OPTIONS);
17137
+ if (isRequestSupported && !test(() => new Request(platform_default.origin, requestDefaults))) {
17138
+ delete requestDefaults.cache;
17139
+ if (!test(() => new Request(platform_default.origin, requestDefaults))) {
17140
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
17141
+ }
17142
+ }
16638
17143
  const resolvers = {
16639
17144
  stream: supportsResponseStream && ((res) => res.body)
16640
17145
  };
@@ -16660,13 +17165,6 @@ var factory = (env) => {
16660
17165
  if (utils_default.isBlob(body)) {
16661
17166
  return body.size;
16662
17167
  }
16663
- if (utils_default.isSpecCompliantForm(body)) {
16664
- const _request = new Request(platform_default.origin, {
16665
- method: "POST",
16666
- body
16667
- });
16668
- return (await _request.arrayBuffer()).byteLength;
16669
- }
16670
17168
  if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
16671
17169
  return body.byteLength;
16672
17170
  }
@@ -16714,6 +17212,7 @@ var factory = (env) => {
16714
17212
  });
16715
17213
  let requestContentLength;
16716
17214
  let pendingBodyError = null;
17215
+ let pendingResponseError = null;
16717
17216
  const maxBodyLengthError = () => new AxiosError_default(
16718
17217
  "Request body larger than maxBodyLength limit",
16719
17218
  AxiosError_default.ERR_BAD_REQUEST,
@@ -16731,8 +17230,9 @@ var factory = (env) => {
16731
17230
  password
16732
17231
  };
16733
17232
  }
17233
+ let parsedURL;
16734
17234
  if (maybeWithAuthCredentials(url2)) {
16735
- const parsedURL = new URL(url2, platform_default.origin);
17235
+ parsedURL = new URL(url2, platform_default.origin);
16736
17236
  if (!auth && (parsedURL.username || parsedURL.password)) {
16737
17237
  const urlUsername = decodeURIComponentSafe2(parsedURL.username);
16738
17238
  const urlPassword = decodeURIComponentSafe2(parsedURL.password);
@@ -16754,8 +17254,8 @@ var factory = (env) => {
16754
17254
  "Basic " + btoa(encodeUTF82((auth.username || "") + ":" + (auth.password || "")))
16755
17255
  );
16756
17256
  }
16757
- if (hasMaxContentLength && typeof url2 === "string" && url2.startsWith("data:")) {
16758
- const estimated = estimateDataURLDecodedBytes(url2);
17257
+ if (hasMaxContentLength && parsedURL && parsedURL.protocol === "data:") {
17258
+ const estimated = estimateDataURLDecodedBytes(parsedURL.href);
16759
17259
  if (estimated > maxContentLength) {
16760
17260
  throw new AxiosError_default(
16761
17261
  "maxContentLength size of " + maxContentLength + " exceeded",
@@ -16765,6 +17265,23 @@ var factory = (env) => {
16765
17265
  );
16766
17266
  }
16767
17267
  }
17268
+ const formContentType = utils_default.isSpecCompliantForm(data) && AxiosHeaders_default.from(own2("headers")).getContentType();
17269
+ let formBoundary;
17270
+ if (utils_default.isString(formContentType) && /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())) {
17271
+ const parameters = AxiosHeaders_default.parseParameters(formContentType);
17272
+ if (utils_default.hasOwnProp(parameters, "boundary")) formBoundary = parameters.boundary;
17273
+ }
17274
+ if (utils_default.isSpecCompliantForm(data) && method !== "get" && method !== "head" && (hasMaxBodyLength || onUploadProgress && supportsRequestStream || formBoundary !== void 0)) {
17275
+ data = createMultipartBody(
17276
+ data,
17277
+ Blob2,
17278
+ hasMaxBodyLength ? maxBodyLength : Infinity,
17279
+ maxBodyLengthError,
17280
+ formBoundary
17281
+ );
17282
+ headers.setContentType(formBoundary === void 0 ? data.type : formContentType);
17283
+ requestContentLength = data.size;
17284
+ }
16768
17285
  if (hasMaxBodyLength && method !== "get" && method !== "head") {
16769
17286
  const outboundLength = await getBodyLength(data);
16770
17287
  if (typeof outboundLength === "number" && isFinite(outboundLength)) {
@@ -16845,7 +17362,7 @@ var factory = (env) => {
16845
17362
  credentials: isCredentialsSupported ? withCredentials : void 0
16846
17363
  });
16847
17364
  if (isRequestSupported) {
16848
- utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
17365
+ utils_default.forEach(requestDefaults, (value, key) => {
16849
17366
  if (resolvedOptions[key] === void 0) {
16850
17367
  resolvedOptions[key] = value;
16851
17368
  }
@@ -16893,7 +17410,7 @@ var factory = (env) => {
16893
17410
  if (hasMaxContentLength) {
16894
17411
  bytesRead = loadedBytes;
16895
17412
  if (bytesRead > maxContentLength) {
16896
- throw new AxiosError_default(
17413
+ throw pendingResponseError = new AxiosError_default(
16897
17414
  "maxContentLength size of " + maxContentLength + " exceeded",
16898
17415
  AxiosError_default.ERR_BAD_RESPONSE,
16899
17416
  config,
@@ -16968,6 +17485,9 @@ var factory = (env) => {
16968
17485
  request && !pendingBodyError.request && (pendingBodyError.request = request);
16969
17486
  throw pendingBodyError;
16970
17487
  }
17488
+ if (pendingResponseError) {
17489
+ throw pendingResponseError;
17490
+ }
16971
17491
  if (err instanceof AxiosError_default) {
16972
17492
  request && !err.request && (err.request = request);
16973
17493
  throw err;
@@ -16995,9 +17515,15 @@ var factory = (env) => {
16995
17515
  };
16996
17516
  var seedCache = /* @__PURE__ */ new Map();
16997
17517
  var getFetch = (config) => {
16998
- let env = config && config.env || {};
16999
- const { fetch: fetch2, Request, Response } = env;
17000
- const seeds = [Request, Response, fetch2];
17518
+ const env = /* @__PURE__ */ Object.create(null);
17519
+ const configuredEnv = config && utils_default.hasOwnProp(config, "env") && config.env;
17520
+ ["fetch", "Request", "Response", "Blob"].forEach((key) => {
17521
+ if (configuredEnv && utils_default.hasOwnProp(configuredEnv, key)) {
17522
+ env[key] = configuredEnv[key];
17523
+ }
17524
+ });
17525
+ const { fetch: fetch2, Request, Response, Blob: Blob2 } = env;
17526
+ const seeds = [Request, Response, fetch2, Blob2];
17001
17527
  let len = seeds.length, i = len, seed, target, map = seedCache;
17002
17528
  while (i--) {
17003
17529
  seed = seeds[i];
@@ -17083,6 +17609,9 @@ function throwIfCancellationRequested(config) {
17083
17609
  throw new CanceledError_default(null, config);
17084
17610
  }
17085
17611
  }
17612
+ function elapsedSince(start) {
17613
+ return Math.max(0, Date.now() - start);
17614
+ }
17086
17615
  function dispatchRequest(_config) {
17087
17616
  const config = utils_default.toSafeFlatObject(_config);
17088
17617
  throwIfCancellationRequested(config);
@@ -17092,9 +17621,11 @@ function dispatchRequest(_config) {
17092
17621
  config.headers.setContentType("application/x-www-form-urlencoded", false);
17093
17622
  }
17094
17623
  const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
17624
+ const start = Date.now();
17095
17625
  return adapter2(config).then(
17096
17626
  function onAdapterResolution(response) {
17097
17627
  throwIfCancellationRequested(config);
17628
+ response.duration = elapsedSince(start);
17098
17629
  config.response = response;
17099
17630
  try {
17100
17631
  response.data = transformData.call(config, config.transformResponse, response);
@@ -17108,6 +17639,7 @@ function dispatchRequest(_config) {
17108
17639
  if (!isCancel(reason)) {
17109
17640
  throwIfCancellationRequested(config);
17110
17641
  if (reason && reason.response) {
17642
+ reason.response.duration = elapsedSince(start);
17111
17643
  config.response = reason.response;
17112
17644
  try {
17113
17645
  reason.response.data = transformData.call(
@@ -17195,6 +17727,27 @@ var validator_default = {
17195
17727
 
17196
17728
  // ../node_modules/axios/lib/core/Axios.js
17197
17729
  var validators2 = validator_default.validators;
17730
+ var isHeadersBucket = (value) => {
17731
+ if (value == null || utils_default.isPlainObject(value) || value instanceof AxiosHeaders_default) {
17732
+ return true;
17733
+ }
17734
+ try {
17735
+ return utils_default.isObject(value) && utils_default.getSafeProp(value, Symbol.toStringTag) === "AxiosHeaders" && [
17736
+ "toJSON",
17737
+ "set",
17738
+ "get",
17739
+ "has",
17740
+ "delete",
17741
+ "clear",
17742
+ "normalize",
17743
+ "concat",
17744
+ "toString",
17745
+ Symbol.iterator
17746
+ ].every((method) => utils_default.isFunction(utils_default.getSafeProp(value, method)));
17747
+ } catch (e) {
17748
+ return false;
17749
+ }
17750
+ };
17198
17751
  var Axios = class {
17199
17752
  constructor(instanceConfig) {
17200
17753
  this.defaults = instanceConfig || {};
@@ -17230,9 +17783,13 @@ var Axios = class {
17230
17783
  } else if (stack) {
17231
17784
  const firstNewlineIndex = stack.indexOf("\n");
17232
17785
  const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
17233
- const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
17234
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
17235
- err.stack += "\n" + stack;
17786
+ const duplicateCheckSuffix = secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
17787
+ const currentStack = String(err.stack);
17788
+ const causeIndex = getCauseStackIndex(err, currentStack);
17789
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
17790
+ const causeSection = causeIndex === -1 ? "" : currentStack.slice(causeIndex);
17791
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
17792
+ err.stack = stackHead + "\n" + stack + causeSection;
17236
17793
  }
17237
17794
  }
17238
17795
  } catch (e) {
@@ -17259,7 +17816,8 @@ var Axios = class {
17259
17816
  clarifyTimeoutError: validators2.transitional(validators2.boolean),
17260
17817
  legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean),
17261
17818
  advertiseZstdAcceptEncoding: validators2.transitional(validators2.boolean),
17262
- validateStatusUndefinedResolves: validators2.transitional(validators2.boolean)
17819
+ validateStatusUndefinedResolves: validators2.transitional(validators2.boolean),
17820
+ encodeBasicAuthUsername: validators2.transitional(validators2.boolean)
17263
17821
  },
17264
17822
  false
17265
17823
  );
@@ -17280,7 +17838,7 @@ var Axios = class {
17280
17838
  );
17281
17839
  }
17282
17840
  }
17283
- if (config.allowAbsoluteUrls !== void 0) ; else if (this.defaults.allowAbsoluteUrls !== void 0) {
17841
+ if (config.allowAbsoluteUrls !== void 0) ; else if (utils_default.hasOwnProp(this.defaults, "allowAbsoluteUrls") && this.defaults.allowAbsoluteUrls !== void 0) {
17284
17842
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
17285
17843
  } else {
17286
17844
  config.allowAbsoluteUrls = true;
@@ -17294,9 +17852,16 @@ var Axios = class {
17294
17852
  true
17295
17853
  );
17296
17854
  config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
17297
- let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
17855
+ const commonHeaders = utils_default.getSafeProp(headers, "common");
17856
+ const methodHeaders = utils_default.getSafeProp(headers, config.method);
17857
+ const contextHeaders = headers && utils_default.merge(
17858
+ isHeadersBucket(commonHeaders) ? commonHeaders : void 0,
17859
+ isHeadersBucket(methodHeaders) ? methodHeaders : void 0
17860
+ );
17298
17861
  headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
17299
- delete headers[method];
17862
+ if (isHeadersBucket(utils_default.getSafeProp(headers, method))) {
17863
+ delete headers[method];
17864
+ }
17300
17865
  });
17301
17866
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
17302
17867
  const requestInterceptorChain = [];
@@ -17378,7 +17943,7 @@ var Axios = class {
17378
17943
  }
17379
17944
  };
17380
17945
  utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
17381
- Axios.prototype[method] = function(url2, config) {
17946
+ Axios.prototype[method] = async function(url2, config) {
17382
17947
  return this.request(
17383
17948
  mergeConfig(config || {}, {
17384
17949
  method,
@@ -17390,7 +17955,7 @@ utils_default.forEach(["delete", "get", "head", "options"], function forEachMeth
17390
17955
  });
17391
17956
  utils_default.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
17392
17957
  function generateHTTPMethod(isForm) {
17393
- return function httpMethod(url2, data, config) {
17958
+ return async function httpMethod(url2, data, config) {
17394
17959
  return this.request(
17395
17960
  mergeConfig(config || {}, {
17396
17961
  method,
@@ -17914,12 +18479,80 @@ var VersionRequiredError = class extends Posty5Error {
17914
18479
  this.name = "VersionRequiredError";
17915
18480
  }
17916
18481
  };
18482
+ var CORE_VERSION = "5.0.2";
18483
+ var DEFAULT_BASE_URL = "https://api.posty5.com";
18484
+ var DEFAULT_TIMEOUT_MS = 3e4;
18485
+ var DEFAULT_MAX_RETRIES = 3;
18486
+ var DEFAULT_RETRY_DELAY_MS = 1e3;
18487
+ var CLIENT_HEADER_NAME = "X-Posty5-Client";
18488
+ var SDK_CLIENT_NAME = "posty5-npm";
18489
+ var SDK_CLIENT_ID = `${SDK_CLIENT_NAME}/${CORE_VERSION}`;
18490
+ var DEFAULT_CREATED_FROM = "npmPackage";
18491
+ var IDEMPOTENT_METHODS = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"];
18492
+ var NEVER_CONNECTED_ERROR_CODES = ["ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN", "ENETUNREACH", "EHOSTUNREACH"];
18493
+ var API_KEY_HEADER_NAME = "X-API-Key";
18494
+ var REDACTED_VALUE = "[REDACTED]";
18495
+ var LOOPBACK_HOSTNAMES2 = ["localhost", "127.0.0.1", "[::1]", "::1"];
18496
+ var DOT_SEGMENT_PATTERN = /^(?:\.|%2e){1,2}$/i;
18497
+ function assertNoDotSegments(url2) {
18498
+ const path = url2.split(/[?#]/)[0];
18499
+ if (path.split("/").some((segment) => DOT_SEGMENT_PATTERN.test(segment))) {
18500
+ throw new Posty5Error(`Invalid request path "${url2}": "." and ".." segments are not allowed`, "INVALID_PATH");
18501
+ }
18502
+ }
18503
+ function redactHeaders(headers) {
18504
+ if (!headers || typeof headers !== "object") return;
18505
+ for (const name of Object.keys(headers)) {
18506
+ if (name.toLowerCase() === API_KEY_HEADER_NAME.toLowerCase()) headers[name] = REDACTED_VALUE;
18507
+ }
18508
+ }
18509
+ function hideProperty(target, key) {
18510
+ if (!target || !(key in target)) return;
18511
+ Object.defineProperty(target, key, { value: target[key], enumerable: false, configurable: true, writable: true });
18512
+ }
18513
+ function redactApiKey(error) {
18514
+ const axiosError = error;
18515
+ if (!axiosError || typeof axiosError !== "object") return error;
18516
+ redactHeaders(axiosError.config?.headers);
18517
+ redactHeaders(axiosError.response?.config?.headers);
18518
+ hideProperty(axiosError, "request");
18519
+ hideProperty(axiosError.response, "request");
18520
+ return error;
18521
+ }
18522
+ function originOf(protocol, hostname, port) {
18523
+ const resolvedPort = port ? String(port) : protocol === "https:" ? "443" : "80";
18524
+ return `${protocol}//${hostname.toLowerCase()}:${resolvedPort}`;
18525
+ }
18526
+ function apiKeyRedirectGuard(baseUrl) {
18527
+ let baseOrigin;
18528
+ try {
18529
+ const base = new URL(baseUrl);
18530
+ baseOrigin = originOf(base.protocol, base.hostname, base.port);
18531
+ } catch {
18532
+ baseOrigin = void 0;
18533
+ }
18534
+ return (options) => {
18535
+ const target = originOf(String(options.protocol || ""), String(options.hostname || options.host || ""), options.port);
18536
+ if (target === baseOrigin) return;
18537
+ for (const name of Object.keys(options.headers || {})) {
18538
+ if (name.toLowerCase() === API_KEY_HEADER_NAME.toLowerCase()) delete options.headers[name];
18539
+ }
18540
+ };
18541
+ }
18542
+ function isInsecureBaseUrl(baseUrl) {
18543
+ try {
18544
+ const url2 = new URL(baseUrl);
18545
+ return url2.protocol === "http:" && !LOOPBACK_HOSTNAMES2.includes(url2.hostname.toLowerCase());
18546
+ } catch {
18547
+ return false;
18548
+ }
18549
+ }
17917
18550
  function transformError(error) {
17918
18551
  if (error instanceof Posty5Error) {
17919
18552
  return error;
17920
18553
  }
17921
18554
  if (error.isAxiosError) {
17922
- const axiosError = error;
18555
+ const axiosError = redactApiKey(error);
17923
18556
  if (!axiosError.response) {
17924
18557
  if (axiosError.code === "ECONNABORTED" || axiosError.message.includes("timeout")) {
17925
18558
  return new NetworkError("Request timeout", { originalError: error });
@@ -17975,17 +18608,6 @@ function transformError(error) {
17975
18608
  }
17976
18609
  return new Posty5Error("An unknown error occurred", void 0, void 0, { originalError: error });
17977
18610
  }
17978
- var CORE_VERSION = "5.0.0";
17979
- var DEFAULT_BASE_URL = "https://api.posty5.com";
17980
- var DEFAULT_TIMEOUT_MS = 3e4;
17981
- var DEFAULT_MAX_RETRIES = 3;
17982
- var DEFAULT_RETRY_DELAY_MS = 1e3;
17983
- var CLIENT_HEADER_NAME = "X-Posty5-Client";
17984
- var SDK_CLIENT_NAME = "posty5-npm";
17985
- var SDK_CLIENT_ID = `${SDK_CLIENT_NAME}/${CORE_VERSION}`;
17986
- var DEFAULT_CREATED_FROM = "npmPackage";
17987
- var IDEMPOTENT_METHODS = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"];
17988
- var NEVER_CONNECTED_ERROR_CODES = ["ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN", "ENETUNREACH", "EHOSTUNREACH"];
17989
18611
  var IF_MATCH_HEADER = "If-Match";
17990
18612
  var CONCURRENCY_REPORT_HEADER = "X-Posty5-Concurrency";
17991
18613
  var CONCURRENCY_REPORT_MISSING_VERSION = "missing-version";
@@ -18036,6 +18658,19 @@ function shouldRetryRequest(error) {
18036
18658
  }
18037
18659
  return idempotent && status >= 500;
18038
18660
  }
18661
+ function decodeBinaryErrorBody(error) {
18662
+ const response = error?.response;
18663
+ const data = response?.data;
18664
+ const isBytes = data instanceof ArrayBuffer || typeof Uint8Array !== "undefined" && data instanceof Uint8Array;
18665
+ if (!isBytes) return error;
18666
+ const text = new TextDecoder().decode(data).trim();
18667
+ if (!text) return error;
18668
+ try {
18669
+ response.data = JSON.parse(text);
18670
+ } catch {
18671
+ }
18672
+ return error;
18673
+ }
18039
18674
  function parseFileName(disposition) {
18040
18675
  if (!disposition) return void 0;
18041
18676
  const match = /filename\*?=(?:UTF-8'')?"?([^";]+)"?/i.exec(disposition);
@@ -18046,15 +18681,21 @@ function parseFileName(disposition) {
18046
18681
  return match[1];
18047
18682
  }
18048
18683
  }
18684
+ var apiKeys = /* @__PURE__ */ new WeakMap();
18049
18685
  var HttpClient = class {
18050
18686
  constructor(config = {}) {
18687
+ const { apiKey, ...publicConfig } = config;
18688
+ apiKeys.set(this, apiKey);
18051
18689
  this.config = {
18052
18690
  timeout: DEFAULT_TIMEOUT_MS,
18053
18691
  maxRetries: DEFAULT_MAX_RETRIES,
18054
18692
  retryDelay: DEFAULT_RETRY_DELAY_MS,
18055
- ...config,
18693
+ ...publicConfig,
18056
18694
  baseUrl: config.baseUrl || process.env.POSTY5_BASE_URL || DEFAULT_BASE_URL
18057
18695
  };
18696
+ if (isInsecureBaseUrl(this.config.baseUrl)) {
18697
+ console.warn(`[Posty5 SDK] baseUrl ${this.config.baseUrl} is plain http: the API key travels unencrypted. Use https.`);
18698
+ }
18058
18699
  this.axiosInstance = axios_default.create({
18059
18700
  baseURL: this.config.baseUrl,
18060
18701
  timeout: this.config.timeout,
@@ -18062,7 +18703,9 @@ var HttpClient = class {
18062
18703
  "Content-Type": "application/json",
18063
18704
  [CLIENT_HEADER_NAME]: SDK_CLIENT_ID,
18064
18705
  ...this.config.headers
18065
- }
18706
+ },
18707
+ // A redirect to another origin must not carry the API key along.
18708
+ beforeRedirect: apiKeyRedirectGuard(this.config.baseUrl)
18066
18709
  });
18067
18710
  esm_default(this.axiosInstance, {
18068
18711
  retries: this.config.maxRetries ?? DEFAULT_MAX_RETRIES,
@@ -18073,11 +18716,12 @@ var HttpClient = class {
18073
18716
  });
18074
18717
  this.axiosInstance.interceptors.request.use(
18075
18718
  (config2) => {
18076
- if (this.config.apiKey) {
18077
- config2.headers["X-API-Key"] = this.config.apiKey;
18719
+ const apiKey2 = apiKeys.get(this);
18720
+ if (apiKey2) {
18721
+ config2.headers[API_KEY_HEADER_NAME] = apiKey2;
18078
18722
  } else {
18079
18723
  if (process.env.POSTY5_API_KEY) {
18080
- config2.headers["X-API-Key"] = process.env.POSTY5_API_KEY;
18724
+ config2.headers[API_KEY_HEADER_NAME] = process.env.POSTY5_API_KEY;
18081
18725
  }
18082
18726
  }
18083
18727
  if (this.config.debug) {
@@ -18091,7 +18735,7 @@ var HttpClient = class {
18091
18735
  },
18092
18736
  (error) => {
18093
18737
  if (this.config.debug) {
18094
- console.log("[Posty5 SDK] Request Error:", error);
18738
+ console.log("[Posty5 SDK] Request Error:", error?.message);
18095
18739
  }
18096
18740
  return Promise.reject(transformError(error));
18097
18741
  }
@@ -18111,7 +18755,7 @@ var HttpClient = class {
18111
18755
  if (this.config.debug) {
18112
18756
  console.error("[Posty5 SDK] Error:", JSON.stringify(error.response?.data || error.message));
18113
18757
  }
18114
- return Promise.reject(transformError(error));
18758
+ return Promise.reject(transformError(decodeBinaryErrorBody(error)));
18115
18759
  }
18116
18760
  );
18117
18761
  }
@@ -18123,19 +18767,20 @@ var HttpClient = class {
18123
18767
  * Set or update the API key
18124
18768
  */
18125
18769
  setApiKey(apiKey) {
18126
- this.config.apiKey = apiKey;
18770
+ apiKeys.set(this, apiKey);
18127
18771
  }
18128
18772
  /**
18129
18773
  * Clear authentication credentials
18130
18774
  */
18131
18775
  clearAuth() {
18132
- this.config.apiKey = void 0;
18776
+ apiKeys.set(this, void 0);
18133
18777
  }
18134
18778
  /**
18135
18779
  * Make a GET request
18136
18780
  */
18137
18781
  async get(url2, config) {
18138
18782
  try {
18783
+ assertNoDotSegments(url2);
18139
18784
  const response = await this.axiosInstance.get(url2, this.buildConfig(config));
18140
18785
  return response.data;
18141
18786
  } catch (error) {
@@ -18147,6 +18792,7 @@ var HttpClient = class {
18147
18792
  */
18148
18793
  async post(url2, data, config) {
18149
18794
  try {
18795
+ assertNoDotSegments(url2);
18150
18796
  const response = await this.axiosInstance.post(url2, data, this.buildConfig(config));
18151
18797
  return response.data;
18152
18798
  } catch (error) {
@@ -18158,6 +18804,7 @@ var HttpClient = class {
18158
18804
  */
18159
18805
  async put(url2, data, config) {
18160
18806
  try {
18807
+ assertNoDotSegments(url2);
18161
18808
  const response = await this.axiosInstance.put(url2, data, this.buildConfig(config));
18162
18809
  return response.data;
18163
18810
  } catch (error) {
@@ -18169,11 +18816,12 @@ var HttpClient = class {
18169
18816
  */
18170
18817
  async patch(url2, data, config) {
18171
18818
  try {
18819
+ assertNoDotSegments(url2);
18172
18820
  const response = await this.axiosInstance.patch(url2, data, this.buildConfig(config));
18173
18821
  return response.data;
18174
18822
  } catch (error) {
18175
18823
  if (this.config.debug) {
18176
- console.log("[Posty5 SDK] PATCH Request Error:", error);
18824
+ console.log("[Posty5 SDK] PATCH Request Error:", error?.message);
18177
18825
  }
18178
18826
  throw transformError(error);
18179
18827
  }
@@ -18183,11 +18831,12 @@ var HttpClient = class {
18183
18831
  */
18184
18832
  async delete(url2, config) {
18185
18833
  try {
18834
+ assertNoDotSegments(url2);
18186
18835
  const response = await this.axiosInstance.delete(url2, this.buildConfig(config));
18187
18836
  return response.data;
18188
18837
  } catch (error) {
18189
18838
  if (this.config.debug) {
18190
- console.log("[Posty5 SDK] DELETE Request Error:", error);
18839
+ console.log("[Posty5 SDK] DELETE Request Error:", error?.message);
18191
18840
  }
18192
18841
  throw transformError(error);
18193
18842
  }
@@ -18201,6 +18850,7 @@ var HttpClient = class {
18201
18850
  */
18202
18851
  async getBinary(url2, config) {
18203
18852
  try {
18853
+ assertNoDotSegments(url2);
18204
18854
  const response = await this.axiosInstance.get(url2, {
18205
18855
  ...this.buildConfig(config),
18206
18856
  responseType: "arraybuffer"
@@ -18492,7 +19142,7 @@ var SocialPublisherPostClient = class {
18492
19142
  * @param id - Post ID
18493
19143
  */
18494
19144
  async getStatus(id) {
18495
- const response = await this.http.get(`${this.basePath}/${id}/status`);
19145
+ const response = await this.http.get(`${this.basePath}/${encodeURIComponent(id)}/status`);
18496
19146
  return response.result;
18497
19147
  }
18498
19148
  /**
@@ -18526,7 +19176,7 @@ var SocialPublisherPostClient = class {
18526
19176
  */
18527
19177
  async removePost(id, version) {
18528
19178
  assertVersion(version);
18529
- const response = await this.http.post(`${this.basePath}/${id}/remove`, {}, { version });
19179
+ const response = await this.http.post(`${this.basePath}/${encodeURIComponent(id)}/remove`, {}, { version });
18530
19180
  return withVersion(response, id);
18531
19181
  }
18532
19182
  /**
@@ -18534,7 +19184,7 @@ var SocialPublisherPostClient = class {
18534
19184
  * @param id - Current Post ID
18535
19185
  */
18536
19186
  async getNextAndPrevious(id) {
18537
- const response = await this.http.get(`${this.basePath}/${id}/next-previous`);
19187
+ const response = await this.http.get(`${this.basePath}/${encodeURIComponent(id)}/next-previous`);
18538
19188
  return response.result;
18539
19189
  }
18540
19190
  /**
@@ -18543,7 +19193,7 @@ var SocialPublisherPostClient = class {
18543
19193
  * @param id - Optional ID for updating/retrying? (Based on route :id?)
18544
19194
  */
18545
19195
  async createToWorkspaceByFile(data, id) {
18546
- const url2 = id ? `${this.basePath}/short-video/workspace/by-file/${id}` : `${this.basePath}/short-video/workspace/by-file`;
19196
+ const url2 = id ? `${this.basePath}/short-video/workspace/by-file/${encodeURIComponent(id)}` : `${this.basePath}/short-video/workspace/by-file`;
18547
19197
  const response = await this.http.post(url2, {
18548
19198
  ...data,
18549
19199
  createdFrom: this.http.createdFrom
@@ -18556,7 +19206,7 @@ var SocialPublisherPostClient = class {
18556
19206
  * @param id - Optional ID for updating/retrying? (Based on route :id?)
18557
19207
  */
18558
19208
  async createToWorkspaceByURL(data, id) {
18559
- const url2 = id ? `${this.basePath}/short-video/workspace/by-url/${id}` : `${this.basePath}/short-video/workspace/by-url`;
19209
+ const url2 = id ? `${this.basePath}/short-video/workspace/by-url/${encodeURIComponent(id)}` : `${this.basePath}/short-video/workspace/by-url`;
18560
19210
  const response = await this.http.post(url2, {
18561
19211
  ...data,
18562
19212
  createdFrom: this.http.createdFrom
@@ -18569,7 +19219,7 @@ var SocialPublisherPostClient = class {
18569
19219
  * @param id - Optional ID for updating/retrying?
18570
19220
  */
18571
19221
  async createToAccountByFile(data, id) {
18572
- const url2 = id ? `${this.basePath}/short-video/account/by-file/${id}` : `${this.basePath}/short-video/account/by-file`;
19222
+ const url2 = id ? `${this.basePath}/short-video/account/by-file/${encodeURIComponent(id)}` : `${this.basePath}/short-video/account/by-file`;
18573
19223
  const response = await this.http.post(url2, {
18574
19224
  ...data,
18575
19225
  createdFrom: this.http.createdFrom
@@ -18582,7 +19232,7 @@ var SocialPublisherPostClient = class {
18582
19232
  * @param id - Optional ID for updating/retrying?
18583
19233
  */
18584
19234
  async createToAccountByURL(data, id) {
18585
- const url2 = id ? `${this.basePath}/short-video/account/by-url/${id}` : `${this.basePath}/short-video/account/by-url`;
19235
+ const url2 = id ? `${this.basePath}/short-video/account/by-url/${encodeURIComponent(id)}` : `${this.basePath}/short-video/account/by-url`;
18586
19236
  const response = await this.http.post(url2, {
18587
19237
  ...data,
18588
19238
  createdFrom: this.http.createdFrom
@@ -18606,7 +19256,7 @@ var SocialPublisherPostClient = class {
18606
19256
  * ```
18607
19257
  */
18608
19258
  async createImagePostToWorkspace(data, id) {
18609
- const url2 = id ? `${this.basePath}/image/workspace/${id}` : `${this.basePath}/image/workspace`;
19259
+ const url2 = id ? `${this.basePath}/image/workspace/${encodeURIComponent(id)}` : `${this.basePath}/image/workspace`;
18610
19260
  const response = await this.http.post(url2, {
18611
19261
  ...data,
18612
19262
  createdFrom: this.http.createdFrom
@@ -18619,7 +19269,7 @@ var SocialPublisherPostClient = class {
18619
19269
  * platforms in the request are ignored.
18620
19270
  */
18621
19271
  async createImagePostToAccount(data, id) {
18622
- const url2 = id ? `${this.basePath}/image/account/${id}` : `${this.basePath}/image/account`;
19272
+ const url2 = id ? `${this.basePath}/image/account/${encodeURIComponent(id)}` : `${this.basePath}/image/account`;
18623
19273
  const response = await this.http.post(url2, {
18624
19274
  ...data,
18625
19275
  createdFrom: this.http.createdFrom
@@ -19012,7 +19662,7 @@ var SocialPublisherPostClient = class {
19012
19662
  };
19013
19663
  const target = isFile2 ? "by-file" : "by-url";
19014
19664
  const id = postId ?? thumb?.postId;
19015
- const url2 = id ? `${this.basePath}/long-video/workspace/${target}/${id}` : `${this.basePath}/long-video/workspace/${target}`;
19665
+ const url2 = id ? `${this.basePath}/long-video/workspace/${target}/${encodeURIComponent(id)}` : `${this.basePath}/long-video/workspace/${target}`;
19016
19666
  const response = await this.http.post(url2, { ...body, createdFrom: this.http.createdFrom });
19017
19667
  return this.normaliseLongVideoResult(response.result);
19018
19668
  }
@@ -19064,7 +19714,7 @@ var SocialPublisherPostClient = class {
19064
19714
  };
19065
19715
  const target = isFile2 ? "by-file" : "by-url";
19066
19716
  const id = postId ?? thumb?.postId;
19067
- const url2 = id ? `${this.basePath}/long-video/account/${target}/${id}` : `${this.basePath}/long-video/account/${target}`;
19717
+ const url2 = id ? `${this.basePath}/long-video/account/${target}/${encodeURIComponent(id)}` : `${this.basePath}/long-video/account/${target}`;
19068
19718
  const response = await this.http.post(url2, { ...body, createdFrom: this.http.createdFrom });
19069
19719
  return this.normaliseLongVideoResult(response.result);
19070
19720
  }
@@ -19091,7 +19741,7 @@ var SocialPublisherPostClient = class {
19091
19741
  }
19092
19742
  assertVersion(version);
19093
19743
  const response = await this.http.put(
19094
- `${this.basePath}/${id}`,
19744
+ `${this.basePath}/${encodeURIComponent(id)}`,
19095
19745
  {
19096
19746
  ...data.schedule === "now" ? { scheduleType: "now" } : { scheduleType: "schedule", scheduledAt: data.schedule.toISOString() },
19097
19747
  ...data.caption !== void 0 ? { caption: data.caption } : {}
@@ -19121,7 +19771,7 @@ var SocialPublisherPostClient = class {
19121
19771
  throw new Error("id is required");
19122
19772
  }
19123
19773
  assertVersion(version);
19124
- await this.http.delete(`${this.basePath}/${id}`, { version });
19774
+ await this.http.delete(`${this.basePath}/${encodeURIComponent(id)}`, { version });
19125
19775
  }
19126
19776
  /**
19127
19777
  * Upload a long video and return the URL to publish from.