@posty5/social-publisher-post 5.0.0 → 5.2.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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import crypto from 'crypto';
2
- import url from 'url';
2
+ import url, { domainToASCII } from 'url';
3
3
  import http from 'http';
4
4
  import https from 'https';
5
5
  import http2 from 'http2';
@@ -11741,7 +11741,7 @@ var require_follow_redirects = __commonJS({
11741
11741
  options.headers[headerList[i]] = headerList[i + 1];
11742
11742
  }
11743
11743
  }
11744
- if (!isArray2(options.sensitiveHeaders)) {
11744
+ if (!Array.isArray(options.sensitiveHeaders)) {
11745
11745
  options.sensitiveHeaders = [];
11746
11746
  }
11747
11747
  if (options.host) {
@@ -11998,9 +11998,6 @@ var require_follow_redirects = __commonJS({
11998
11998
  var dot = subdomain.length - domain.length - 1;
11999
11999
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
12000
12000
  }
12001
- function isArray2(value) {
12002
- return value instanceof Array;
12003
- }
12004
12001
  function isString2(value) {
12005
12002
  return typeof value === "string" || value instanceof String;
12006
12003
  }
@@ -12014,7 +12011,7 @@ var require_follow_redirects = __commonJS({
12014
12011
  return URL2 && value instanceof URL2;
12015
12012
  }
12016
12013
  function escapeRegex(regex) {
12017
- return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
12014
+ return regex.replace(/[\^$\\.*+?()[\]{}|]/g, "\\$&");
12018
12015
  }
12019
12016
  module.exports = wrap({ http: http3, https: https2 });
12020
12017
  module.exports.wrap = wrap;
@@ -12183,10 +12180,16 @@ var isPlainObject = (val) => {
12183
12180
  return false;
12184
12181
  }
12185
12182
  const prototype2 = getPrototypeOf(val);
12186
- return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat safe own/inherited Symbol.toStringTag or Symbol.iterator members as
12187
- // evidence the value is tagged/iterable, while ignoring members reachable
12188
- // only through shared or terminal prototype boundaries.
12189
- !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
12183
+ return (prototype2 === null || prototype2 === Object.prototype || getPrototypeOf(prototype2) === null) && // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
12184
+ // value is tagged/iterable, ignoring members reachable only through shared
12185
+ // or terminal prototype boundaries. This is exactly what
12186
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
12187
+ // above (null, Object.prototype, or a terminal null-prototype template) is
12188
+ // a boundary, so the walk never inspects anything but `val`'s own members,
12189
+ // and stops before even those when `val` is itself the boundary
12190
+ // Object.prototype. Checking that inline avoids allocating the walker's
12191
+ // `seen` list twice per call on the mergeConfig / merge hot path.
12192
+ (isPrototypeBoundary(val, prototype2, true) || !hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator));
12190
12193
  };
12191
12194
  var isEmptyObject = (val) => {
12192
12195
  if (!isObject(val) || isBuffer(val)) {
@@ -12287,11 +12290,21 @@ var isContextDefined = (context) => !isUndefined(context) && context !== _global
12287
12290
  function merge(...objs) {
12288
12291
  const { caseless, skipUndefined } = isContextDefined(this) && this || {};
12289
12292
  const result = {};
12293
+ const lowerCaseKeys = caseless ? /* @__PURE__ */ Object.create(null) : null;
12290
12294
  const assignValue = (val, key) => {
12291
12295
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
12292
12296
  return;
12293
12297
  }
12294
- const targetKey = caseless && typeof key === "string" && findKey(result, key) || key;
12298
+ let targetKey = key;
12299
+ if (lowerCaseKeys && typeof key === "string") {
12300
+ const lowerKey = key.toLowerCase();
12301
+ const knownKey = lowerCaseKeys[lowerKey];
12302
+ if (knownKey !== void 0 && hasOwnProperty(result, knownKey)) {
12303
+ targetKey = knownKey;
12304
+ } else {
12305
+ lowerCaseKeys[lowerKey] = key;
12306
+ }
12307
+ }
12295
12308
  const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : void 0;
12296
12309
  if (isPlainObject(existing) && isPlainObject(val)) {
12297
12310
  result[targetKey] = merge(existing, val);
@@ -12309,7 +12322,7 @@ function merge(...objs) {
12309
12322
  continue;
12310
12323
  }
12311
12324
  forEach(source, assignValue);
12312
- if (typeof source !== "object" || isArray(source)) {
12325
+ if (typeof source !== "object" || isArray(source) || !Object.getOwnPropertySymbols) {
12313
12326
  continue;
12314
12327
  }
12315
12328
  const symbols = Object.getOwnPropertySymbols(source);
@@ -12405,7 +12418,24 @@ var toArray = (thing) => {
12405
12418
  if (!thing) return null;
12406
12419
  if (isArray(thing)) return thing;
12407
12420
  let i = thing.length;
12408
- if (!isNumber(i)) return null;
12421
+ if (!Number.isSafeInteger(i) || i < 0 || i > 4294967295) return null;
12422
+ const indexes = /* @__PURE__ */ new Set();
12423
+ const seen = /* @__PURE__ */ new Set();
12424
+ let source = thing;
12425
+ while (source != null && indexes.size < i) {
12426
+ if (seen.has(source)) return null;
12427
+ seen.add(source);
12428
+ const prototype2 = getPrototypeOf(source);
12429
+ if (isPrototypeBoundary(source, prototype2, source === thing)) break;
12430
+ Object.getOwnPropertyNames(source).forEach((key) => {
12431
+ const index = +key;
12432
+ if (Number.isInteger(index) && index >= 0 && index < i && String(index) === key && hasOwnProperty(source, key)) {
12433
+ indexes.add(index);
12434
+ }
12435
+ });
12436
+ source = prototype2;
12437
+ }
12438
+ if (indexes.size !== i) return null;
12409
12439
  const arr = new Array(i);
12410
12440
  while (i-- > 0) {
12411
12441
  arr[i] = thing[i];
@@ -12637,7 +12667,7 @@ var ignoreDuplicateOf = utils_default.toObjectSet([
12637
12667
  "user-agent"
12638
12668
  ]);
12639
12669
  var parseHeaders_default = (rawHeaders) => {
12640
- const parsed = {};
12670
+ const parsed = /* @__PURE__ */ Object.create(null);
12641
12671
  let key;
12642
12672
  let val;
12643
12673
  let i;
@@ -12805,9 +12835,11 @@ function parseParameters(value) {
12805
12835
  return parameters;
12806
12836
  }
12807
12837
  var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
12838
+ var PROTO_HEADER_SLOT = "__Proto__";
12839
+ var headerSlot = (name) => name === "__proto__" ? PROTO_HEADER_SLOT : name;
12808
12840
  function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
12809
12841
  if (utils_default.isFunction(filter2)) {
12810
- return filter2.call(this, value, header);
12842
+ return filter2.call(context, value, header);
12811
12843
  }
12812
12844
  if (isHeaderNameFilter) {
12813
12845
  value = header;
@@ -12852,7 +12884,7 @@ var AxiosHeaders = class {
12852
12884
  }
12853
12885
  const key = utils_default.findKey(self2, lHeader);
12854
12886
  if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
12855
- self2[key || _header] = normalizeValue(_value);
12887
+ self2[headerSlot(key || _header)] = normalizeValue(_value);
12856
12888
  }
12857
12889
  }
12858
12890
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -12945,7 +12977,7 @@ var AxiosHeaders = class {
12945
12977
  }
12946
12978
  normalize(format) {
12947
12979
  const self2 = this;
12948
- const headers = {};
12980
+ const headers = /* @__PURE__ */ Object.create(null);
12949
12981
  utils_default.forEach(this, (value, header) => {
12950
12982
  const key = utils_default.findKey(headers, header);
12951
12983
  if (key) {
@@ -12953,7 +12985,7 @@ var AxiosHeaders = class {
12953
12985
  delete self2[header];
12954
12986
  return;
12955
12987
  }
12956
- const normalized = format ? formatHeader(header) : String(header).trim();
12988
+ const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
12957
12989
  if (normalized !== header) {
12958
12990
  delete self2[header];
12959
12991
  }
@@ -13103,6 +13135,28 @@ function aggregateErrorMessage(error) {
13103
13135
  }).filter(Boolean).join("; ");
13104
13136
  return message || error.name || "AggregateError";
13105
13137
  }
13138
+ var CAUSED_BY_SEPARATOR = "\nCaused by: ";
13139
+ var $causeStack = /* @__PURE__ */ Symbol("causeStack");
13140
+ function getCauseStackIndex(error, stack) {
13141
+ const causeStack = utils_default.hasOwnProp(error, $causeStack) && error[$causeStack];
13142
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
13143
+ }
13144
+ function appendCauseStack(target, source) {
13145
+ try {
13146
+ const sourceStack = source && source.stack;
13147
+ if (typeof sourceStack !== "string" || !sourceStack) {
13148
+ return;
13149
+ }
13150
+ const targetStack = target.stack;
13151
+ if (typeof targetStack !== "string" || !targetStack) {
13152
+ return;
13153
+ }
13154
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
13155
+ target.stack = targetStack + causeStack;
13156
+ Object.defineProperty(target, $causeStack, { __proto__: null, value: causeStack });
13157
+ } catch (e) {
13158
+ }
13159
+ }
13106
13160
  var AxiosError = class _AxiosError extends Error {
13107
13161
  static from(error, code, config, request, response, customProps) {
13108
13162
  let message = error.message;
@@ -13118,6 +13172,7 @@ var AxiosError = class _AxiosError extends Error {
13118
13172
  configurable: true
13119
13173
  });
13120
13174
  axiosError.name = error.name;
13175
+ appendCauseStack(axiosError, error);
13121
13176
  if (error.status != null && axiosError.status == null) {
13122
13177
  axiosError.status = error.status;
13123
13178
  }
@@ -13429,6 +13484,12 @@ function trimHandlers(handlers) {
13429
13484
  handlers.pop();
13430
13485
  }
13431
13486
  }
13487
+ function normalizeHandlerId(id) {
13488
+ if (typeof id === "string" && id !== "" && String(Number(id)) === id) {
13489
+ return Number(id);
13490
+ }
13491
+ return id;
13492
+ }
13432
13493
  function syncHandlerEntries(manager, internals) {
13433
13494
  const handlers = manager.handlers;
13434
13495
  const length = countHandlers(handlers);
@@ -13499,9 +13560,10 @@ var InterceptorManager = class {
13499
13560
  eject(id) {
13500
13561
  const internals = this[$internals2];
13501
13562
  syncHandlerEntries(this, internals);
13502
- const entry = internals.handlerEntries.get(id);
13563
+ const handlerId = normalizeHandlerId(id);
13564
+ const entry = internals.handlerEntries.get(handlerId);
13503
13565
  if (entry) {
13504
- internals.handlerEntries.delete(id);
13566
+ internals.handlerEntries.delete(handlerId);
13505
13567
  if (this.handlers[entry.index] !== entry.handler) {
13506
13568
  return;
13507
13569
  }
@@ -13561,7 +13623,8 @@ var transitional_default = {
13561
13623
  clarifyTimeoutError: false,
13562
13624
  legacyInterceptorReqResOrdering: true,
13563
13625
  advertiseZstdAcceptEncoding: false,
13564
- validateStatusUndefinedResolves: true
13626
+ validateStatusUndefinedResolves: true,
13627
+ encodeBasicAuthUsername: false
13565
13628
  };
13566
13629
  var URLSearchParams_default = url.URLSearchParams;
13567
13630
 
@@ -13665,6 +13728,24 @@ function arrayToObject(arr) {
13665
13728
  }
13666
13729
  return obj;
13667
13730
  }
13731
+ function normalizeArray(value) {
13732
+ if (!utils_default.isArray(value)) return value;
13733
+ const keys = Object.keys(value);
13734
+ return keys.length !== value.length || keys.some((key, index) => key !== String(index)) ? arrayToObject(value) : value;
13735
+ }
13736
+ function normalizeArrays(obj) {
13737
+ const pending = [obj];
13738
+ while (pending.length) {
13739
+ const target = pending.pop();
13740
+ Object.keys(target).forEach((key) => {
13741
+ const value = target[key] = normalizeArray(target[key]);
13742
+ if (utils_default.isArray(value) || utils_default.isPlainObject(value)) {
13743
+ pending.push(value);
13744
+ }
13745
+ });
13746
+ }
13747
+ return obj;
13748
+ }
13668
13749
  function formDataToJSON(formData) {
13669
13750
  function buildPath(path, value, target, index) {
13670
13751
  throwIfDepthExceeded(index);
@@ -13675,6 +13756,7 @@ function formDataToJSON(formData) {
13675
13756
  name = !name && utils_default.isArray(target) ? target.length : name;
13676
13757
  if (isLast) {
13677
13758
  if (utils_default.hasOwnProp(target, name)) {
13759
+ target[name] = normalizeArray(target[name]);
13678
13760
  target[name] = utils_default.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
13679
13761
  } else {
13680
13762
  target[name] = value;
@@ -13695,7 +13777,7 @@ function formDataToJSON(formData) {
13695
13777
  utils_default.forEachEntry(formData, (name, value) => {
13696
13778
  buildPath(parsePropPath(name), value, obj, 0);
13697
13779
  });
13698
- return obj;
13780
+ return normalizeArrays(obj);
13699
13781
  }
13700
13782
  return null;
13701
13783
  }
@@ -14037,16 +14119,16 @@ var import_https_proxy_agent = __toESM(require_dist());
14037
14119
  var import_follow_redirects = __toESM(require_follow_redirects());
14038
14120
 
14039
14121
  // ../node_modules/axios/lib/env/data.js
14040
- var VERSION = "1.20.0";
14122
+ var VERSION = "1.21.1";
14041
14123
 
14042
14124
  // ../node_modules/axios/lib/helpers/parseProtocol.js
14043
14125
  function parseProtocol(url2) {
14044
14126
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url2);
14045
- return match && match[1] || "";
14127
+ return match && match[1].toLowerCase() || "";
14046
14128
  }
14047
14129
 
14048
14130
  // ../node_modules/axios/lib/helpers/fromDataURI.js
14049
- var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
14131
+ var DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/i;
14050
14132
  function fromDataURI(uri, asBlob, options) {
14051
14133
  const _Blob = options && options.Blob || platform_default.classes.Blob;
14052
14134
  const protocol = parseProtocol(uri);
@@ -14069,7 +14151,10 @@ function fromDataURI(uri, asBlob, options) {
14069
14151
  } else if (params) {
14070
14152
  mime = "text/plain" + params;
14071
14153
  }
14072
- const buffer = encoding === "base64" ? Buffer.from(body, "base64") : Buffer.from(decodeURIComponent(body), encoding);
14154
+ const buffer = encoding === "base64" ? Buffer.from(
14155
+ body.replace(/%([\da-f]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16))),
14156
+ "base64"
14157
+ ) : Buffer.from(decodeURIComponent(body), encoding);
14073
14158
  if (asBlob) {
14074
14159
  if (!_Blob) {
14075
14160
  throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
@@ -14149,7 +14234,10 @@ var AxiosTransformStream = class extends stream3.Transform {
14149
14234
  const timeWindow = internals.timeWindow;
14150
14235
  const divider = 1e3 / timeWindow;
14151
14236
  const bytesThreshold = maxRate / divider;
14152
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
14237
+ let minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
14238
+ if (maxRate) {
14239
+ minChunkSize = Math.min(bytesThreshold, minChunkSize);
14240
+ }
14153
14241
  const pushChunk = (_chunk, _callback) => {
14154
14242
  const bytes = Buffer.byteLength(_chunk);
14155
14243
  internals.bytesSeen += bytes;
@@ -14165,6 +14253,9 @@ var AxiosTransformStream = class extends stream3.Transform {
14165
14253
  }
14166
14254
  };
14167
14255
  const transformChunk = (_chunk, _callback) => {
14256
+ if (this.destroyed) {
14257
+ return _callback();
14258
+ }
14168
14259
  const chunkSize = Buffer.byteLength(_chunk);
14169
14260
  let chunkRemainder = null;
14170
14261
  let maxChunkSize = readableHighWaterMark;
@@ -14187,7 +14278,7 @@ var AxiosTransformStream = class extends stream3.Transform {
14187
14278
  }, timeWindow - passed);
14188
14279
  }
14189
14280
  if (bytesLeft < maxChunkSize) {
14190
- maxChunkSize = bytesLeft;
14281
+ maxChunkSize = Math.max(1, Math.floor(bytesLeft));
14191
14282
  }
14192
14283
  }
14193
14284
  if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
@@ -14238,9 +14329,9 @@ var CRLF_BYTES = textEncoder.encode(CRLF);
14238
14329
  var CRLF_BYTES_COUNT = 2;
14239
14330
  var FormDataPart = class {
14240
14331
  constructor(name, value) {
14241
- const { escapeName } = this.constructor;
14332
+ const { escapeName: escapeName2 } = this.constructor;
14242
14333
  const isStringValue = utils_default.isString(value);
14243
- let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ""}${CRLF}`;
14334
+ let headers = `Content-Disposition: form-data; name="${escapeName2(name)}"${!isStringValue && value.name ? `; filename="${escapeName2(value.name)}"` : ""}${CRLF}`;
14244
14335
  if (isStringValue) {
14245
14336
  value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
14246
14337
  } else {
@@ -14394,7 +14485,7 @@ var Http2Sessions = class {
14394
14485
  timer = null;
14395
14486
  }
14396
14487
  stream4.once("close", () => {
14397
- if (!--streamsCount) {
14488
+ if (!--streamsCount && !removed) {
14398
14489
  timer = setTimeout(() => {
14399
14490
  timer = null;
14400
14491
  removeSession();
@@ -14406,6 +14497,7 @@ var Http2Sessions = class {
14406
14497
  }
14407
14498
  session.once("close", removeSession);
14408
14499
  session.once("error", removeSession);
14500
+ session.once("goaway", removeSession);
14409
14501
  let entry = [session, options];
14410
14502
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
14411
14503
  return session;
@@ -14427,8 +14519,6 @@ var callbackify = (fn, reducer) => {
14427
14519
  } : fn;
14428
14520
  };
14429
14521
  var callbackify_default = callbackify;
14430
-
14431
- // ../node_modules/axios/lib/helpers/shouldBypassProxy.js
14432
14522
  var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "0.0.0.0"]);
14433
14523
  var trimTrailingDots = (value) => {
14434
14524
  let end = value.length;
@@ -14622,7 +14712,20 @@ var normalizeNoProxyHost = (hostname) => {
14622
14712
  if (hostname.charAt(0) === "[" && hostname.charAt(hostname.length - 1) === "]") {
14623
14713
  hostname = hostname.slice(1, -1);
14624
14714
  }
14625
- const trimmed = trimTrailingDots(hostname);
14715
+ let trimmed = trimTrailingDots(hostname);
14716
+ if (trimmed.indexOf(":") !== -1) {
14717
+ try {
14718
+ trimmed = new URL("http://[" + trimmed + "]/").hostname.slice(1, -1);
14719
+ } catch (_err) {
14720
+ return trimmed;
14721
+ }
14722
+ } else if (/[\u0080-\uffff]/.test(trimmed)) {
14723
+ const prefix = /^[*.]+/.exec(trimmed);
14724
+ const start = prefix ? prefix[0] : "";
14725
+ const ascii = domainToASCII(trimmed.slice(start.length));
14726
+ if (!ascii) return "";
14727
+ trimmed = start + trimTrailingDots(ascii);
14728
+ }
14626
14729
  const ipv4 = normalizeIPAddress(trimmed);
14627
14730
  if (ipv4 !== trimmed) {
14628
14731
  return ipv4;
@@ -14893,6 +14996,26 @@ var estimateBase64BufferAllocation = (body) => {
14893
14996
  }
14894
14997
  return Math.floor((len - padding) * 3 / 4);
14895
14998
  };
14999
+ var estimatePercentDecodedBase64BufferAllocation = (body) => {
15000
+ if (body.indexOf("%") === -1) {
15001
+ return estimateBase64BufferAllocation(body);
15002
+ }
15003
+ let length = 0;
15004
+ let previous = 0;
15005
+ let last = 0;
15006
+ for (let i = 0, len = body.length; i < len; i++) {
15007
+ let code = body.charCodeAt(i);
15008
+ if (code === 37 && isPercentEncodedByte(body, i, len)) {
15009
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
15010
+ i += 2;
15011
+ }
15012
+ length++;
15013
+ previous = last;
15014
+ last = code;
15015
+ }
15016
+ const padding = last === 61 ? previous === 61 ? 2 : 1 : 0;
15017
+ return Math.floor((length - padding) * 3 / 4);
15018
+ };
14896
15019
  var estimatePercentDecodedBase64Bytes = (body) => {
14897
15020
  const len = body.length;
14898
15021
  let significant = 0;
@@ -14922,14 +15045,14 @@ var estimatePercentDecodedBase64Bytes = (body) => {
14922
15045
  }
14923
15046
  return base64Bytes(significant);
14924
15047
  };
14925
- var estimateDataURLBytes = (url2, estimateBase64) => {
15048
+ var estimateDataURLBytes = (url2, estimateBase64, base64Pattern) => {
14926
15049
  if (!url2 || typeof url2 !== "string") return 0;
14927
- if (!url2.startsWith("data:")) return 0;
15050
+ if (!/^data:/i.test(url2)) return 0;
14928
15051
  const comma = url2.indexOf(",");
14929
15052
  if (comma < 0) return 0;
14930
15053
  const meta = url2.slice(5, comma);
14931
15054
  const body = url2.slice(comma + 1);
14932
- const isBase64 = /;base64/i.test(meta);
15055
+ const isBase64 = base64Pattern.test(meta);
14933
15056
  if (isBase64) {
14934
15057
  return estimateBase64(body);
14935
15058
  }
@@ -14961,11 +15084,12 @@ function estimateDataURLDecodedBytes(url2) {
14961
15084
  const fragmentIndex = typeof url2 === "string" ? url2.indexOf("#") : -1;
14962
15085
  return estimateDataURLBytes(
14963
15086
  fragmentIndex === -1 ? url2 : url2.slice(0, fragmentIndex),
14964
- estimatePercentDecodedBase64Bytes
15087
+ estimatePercentDecodedBase64Bytes,
15088
+ /; *base64[\t\n\f\r ]*$/i
14965
15089
  );
14966
15090
  }
14967
15091
  function estimateDataURLBufferAllocation(url2) {
14968
- return estimateDataURLBytes(url2, estimateBase64BufferAllocation);
15092
+ return estimateDataURLBytes(url2, estimatePercentDecodedBase64BufferAllocation, /;base64$/i);
14969
15093
  }
14970
15094
 
14971
15095
  // ../node_modules/axios/lib/adapters/http.js
@@ -14999,6 +15123,18 @@ function handleSocketError(err) {
14999
15123
  var kAxiosInstalledTunnel = /* @__PURE__ */ Symbol("axios.http.installedTunnel");
15000
15124
  var tunnelingAgentCache = /* @__PURE__ */ new Map();
15001
15125
  var tunnelingAgentCacheUser = /* @__PURE__ */ new WeakMap();
15126
+ var directAgents = /* @__PURE__ */ new WeakMap();
15127
+ var directAgentHooks = ["createConnection", "getName"];
15128
+ var nativeAgentPoolHooks = [
15129
+ "addRequest",
15130
+ "createSocket",
15131
+ "removeSocket",
15132
+ "keepSocketAlive",
15133
+ "reuseSocket",
15134
+ "_getSession",
15135
+ "_cacheSession",
15136
+ "_evictSession"
15137
+ ];
15002
15138
  var NODE_NATIVE_ENV_PROXY_SUPPORT = {
15003
15139
  22: 21,
15004
15140
  24: 5
@@ -15028,6 +15164,49 @@ function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.
15028
15164
  function getProxyEnvAgent(options, configHttpAgent, configHttpsAgent) {
15029
15165
  return isHttps.test(options.protocol) ? configHttpsAgent || https.globalAgent : configHttpAgent || http.globalAgent;
15030
15166
  }
15167
+ function getDirectAgent(configuredAgent, transport) {
15168
+ if (!process.allowedNodeEnvironmentFlags || !process.allowedNodeEnvironmentFlags.has("--use-env-proxy")) {
15169
+ return configuredAgent;
15170
+ }
15171
+ const agent = configuredAgent || transport.globalAgent;
15172
+ const options = agent && agent.options;
15173
+ if (!(agent instanceof transport.Agent) || agent.protocol !== transport.globalAgent.protocol || !options || !utils_default.hasOwnProp(options, "proxyEnv") || typeof options.proxyEnv !== "object" || options.proxyEnv === null) {
15174
+ return configuredAgent;
15175
+ }
15176
+ for (const hook of nativeAgentPoolHooks) {
15177
+ if (utils_default.isFunction(transport.Agent.prototype[hook]) && agent[hook] !== transport.Agent.prototype[hook]) {
15178
+ throw new AxiosError_default(
15179
+ "proxy: false cannot adapt an agent overriding " + hook + "; use an agent constructed without proxyEnv",
15180
+ AxiosError_default.ERR_BAD_OPTION_VALUE
15181
+ );
15182
+ }
15183
+ }
15184
+ let direct = directAgents.get(agent);
15185
+ if (!direct) {
15186
+ direct = new transport.Agent({ ...options, proxyEnv: void 0 });
15187
+ const destroy = agent.destroy;
15188
+ agent.destroy = function destroyWithDirectAgent() {
15189
+ try {
15190
+ return destroy.apply(this, arguments);
15191
+ } finally {
15192
+ direct.destroy();
15193
+ }
15194
+ };
15195
+ directAgents.set(agent, direct);
15196
+ }
15197
+ for (const hook of directAgentHooks) {
15198
+ direct[hook] = agent[hook] === transport.Agent.prototype[hook] ? transport.Agent.prototype[hook] : bind(agent[hook], agent);
15199
+ }
15200
+ return direct;
15201
+ }
15202
+ function setDirectAgent(options, configHttpAgent, configHttpsAgent) {
15203
+ const secure = isHttps.test(options.protocol);
15204
+ const agent = getDirectAgent(secure ? configHttpsAgent : configHttpAgent, secure ? https : http);
15205
+ options.agent = agent;
15206
+ if (options.agents) {
15207
+ options.agents[secure ? "https" : "http"] = agent;
15208
+ }
15209
+ }
15031
15210
  function getTunnelingAgent(agentOptions, userHttpsAgent) {
15032
15211
  const key = agentOptions.protocol + "//" + agentOptions.hostname + ":" + (agentOptions.port || "") + "#" + (agentOptions.auth || "");
15033
15212
  const cache = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, /* @__PURE__ */ new Map()).get(userHttpsAgent) : tunnelingAgentCache;
@@ -15035,13 +15214,12 @@ function getTunnelingAgent(agentOptions, userHttpsAgent) {
15035
15214
  if (agent) return agent;
15036
15215
  const merged = userHttpsAgent && userHttpsAgent.options ? { ...userHttpsAgent.options, ...agentOptions } : agentOptions;
15037
15216
  agent = new import_https_proxy_agent.default(merged);
15038
- if (userHttpsAgent && userHttpsAgent.options) {
15039
- const originTLSOptions = { ...userHttpsAgent.options };
15040
- const callback = agent.callback;
15041
- agent.callback = function axiosTunnelingAgentCallback(req, opts) {
15042
- return callback.call(this, req, { ...originTLSOptions, ...opts });
15043
- };
15044
- }
15217
+ const callback = agent.callback;
15218
+ agent.callback = function axiosTunnelingAgentCallback(req, opts) {
15219
+ const originTLSAgent = userHttpsAgent || https.globalAgent;
15220
+ const originTLSOptions = originTLSAgent && originTLSAgent.options;
15221
+ return callback.call(this, req, { ...originTLSOptions, ...opts });
15222
+ };
15045
15223
  agent[kAxiosInstalledTunnel] = true;
15046
15224
  cache.set(key, agent);
15047
15225
  return agent;
@@ -15065,6 +15243,10 @@ var flushOnFinish = (stream4, [throttled, flush]) => {
15065
15243
  };
15066
15244
  var http2Sessions = new Http2Sessions_default();
15067
15245
  function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
15246
+ if (!isSameOriginRedirect(options, requestDetails)) {
15247
+ stripMatchingHeaders(options.headers, /* @__PURE__ */ new Set(["authorization", "cookie"]));
15248
+ delete options.auth;
15249
+ }
15068
15250
  if (options.beforeRedirects.proxy) {
15069
15251
  options.beforeRedirects.proxy(options);
15070
15252
  }
@@ -15074,6 +15256,9 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
15074
15256
  if (options.beforeRedirects.sensitiveHeaders) {
15075
15257
  options.beforeRedirects.sensitiveHeaders(options, requestDetails);
15076
15258
  }
15259
+ if (options.beforeRedirects.direct) {
15260
+ options.beforeRedirects.direct(options);
15261
+ }
15077
15262
  if (options.beforeRedirects.config) {
15078
15263
  options.beforeRedirects.config(options, responseDetails, requestDetails);
15079
15264
  }
@@ -15119,6 +15304,9 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent,
15119
15304
  if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
15120
15305
  options.agent = void 0;
15121
15306
  }
15307
+ if (isRedirect && options.agents && options.agents.https && options.agents.https[kAxiosInstalledTunnel]) {
15308
+ options.agents.https = configHttpsAgent;
15309
+ }
15122
15310
  if (proxy) {
15123
15311
  const isProxyURL = proxy instanceof URL;
15124
15312
  const readProxyField = (key) => isProxyURL || utils_default.hasOwnProp(proxy, key) ? proxy[key] : void 0;
@@ -15299,9 +15487,9 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15299
15487
  if (httpVersion === void 0) httpVersion = 1;
15300
15488
  const rawHttpVersion = httpVersion;
15301
15489
  let http2Options = own2("http2Options");
15490
+ const configProxy = own2("proxy");
15302
15491
  const httpAgent = own2("httpAgent");
15303
15492
  const httpsAgent = own2("httpsAgent");
15304
- const configProxy = own2("proxy");
15305
15493
  const responseType = own2("responseType");
15306
15494
  const responseEncoding = own2("responseEncoding");
15307
15495
  const socketPath = own2("socketPath");
@@ -15440,6 +15628,15 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15440
15628
  } catch (err) {
15441
15629
  throw AxiosError_default.from(err, AxiosError_default.ERR_BAD_REQUEST, config);
15442
15630
  }
15631
+ if (maxContentLength > -1 && (responseType === "blob" ? convertedData.size : convertedData.length) > maxContentLength) {
15632
+ return reject(
15633
+ new AxiosError_default(
15634
+ "maxContentLength size of " + maxContentLength + " exceeded",
15635
+ AxiosError_default.ERR_BAD_RESPONSE,
15636
+ config
15637
+ )
15638
+ );
15639
+ }
15443
15640
  if (responseType === "text") {
15444
15641
  convertedData = convertedData.toString(responseEncoding);
15445
15642
  if (!responseEncoding || responseEncoding === "utf8") {
@@ -15641,9 +15838,13 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15641
15838
  }
15642
15839
  let transport;
15643
15840
  let isNativeTransport = false;
15644
- let transportEnforcesMaxBodyLength = false;
15645
15841
  const isHttpsRequest = isHttps.test(options.protocol);
15646
- if (options.agent == null) {
15842
+ if (!isHttp2 && configProxy === false) {
15843
+ setDirectAgent(options, httpAgent, httpsAgent);
15844
+ options.beforeRedirects.direct = (redirectOptions) => {
15845
+ setDirectAgent(redirectOptions, httpAgent, httpsAgent);
15846
+ };
15847
+ } else if (options.agent == null) {
15647
15848
  options.agent = isHttpsRequest ? httpsAgent : httpAgent;
15648
15849
  }
15649
15850
  if (isHttp2) {
@@ -15665,7 +15866,6 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15665
15866
  transport = isHttpsRequest ? https : http;
15666
15867
  isNativeTransport = true;
15667
15868
  } else {
15668
- transportEnforcesMaxBodyLength = true;
15669
15869
  options.sensitiveHeaders = [];
15670
15870
  if (maxRedirects) {
15671
15871
  options.maxRedirects = maxRedirects;
@@ -15951,7 +16151,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15951
16151
  }
15952
16152
  });
15953
16153
  let uploadStream = data;
15954
- if (maxBodyLength > -1 && !transportEnforcesMaxBodyLength) {
16154
+ if (maxBodyLength > -1) {
15955
16155
  const limit = maxBodyLength;
15956
16156
  let bytesSent = 0;
15957
16157
  uploadStream = stream3.pipeline(
@@ -15988,16 +16188,14 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
15988
16188
  });
15989
16189
  };
15990
16190
 
15991
- // ../node_modules/axios/lib/helpers/isURLSameOrigin.js
15992
- var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
15993
- url2 = new URL(url2, platform_default.origin);
15994
- return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
15995
- })(
15996
- new URL(platform_default.origin),
15997
- platform_default.navigator && /(msie|trident)/i.test(platform_default.navigator.userAgent)
15998
- ) : () => true;
15999
-
16000
16191
  // ../node_modules/axios/lib/helpers/cookies.js
16192
+ var decodeCookieValue = (value) => {
16193
+ try {
16194
+ return decodeURIComponent(value);
16195
+ } catch (e) {
16196
+ return value;
16197
+ }
16198
+ };
16001
16199
  var cookies_default = platform_default.hasStandardBrowserEnv ? (
16002
16200
  // Standard browser envs support document.cookie
16003
16201
  {
@@ -16023,20 +16221,29 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
16023
16221
  },
16024
16222
  read(name) {
16025
16223
  if (typeof document === "undefined") return null;
16026
- const cookies = document.cookie.split(";");
16224
+ const cookieString = document.cookie;
16225
+ if (!cookieString) return null;
16226
+ const cookies = cookieString.split(";");
16027
16227
  for (let i = 0; i < cookies.length; i++) {
16028
16228
  const cookie = cookies[i].replace(/^\s+/, "");
16029
16229
  const eq = cookie.indexOf("=");
16030
16230
  if (eq !== -1 && cookie.slice(0, eq) === name) {
16031
- try {
16032
- return decodeURIComponent(cookie.slice(eq + 1));
16033
- } catch (e) {
16034
- return cookie.slice(eq + 1);
16035
- }
16231
+ return decodeCookieValue(cookie.slice(eq + 1));
16036
16232
  }
16037
16233
  }
16038
16234
  return null;
16039
16235
  },
16236
+ async readAsync(name) {
16237
+ try {
16238
+ const store = typeof window !== "undefined" && window.cookieStore;
16239
+ if (store && utils_default.isFunction(store.get)) {
16240
+ const cookie = await store.get(name);
16241
+ return cookie ? decodeCookieValue(cookie.value) : null;
16242
+ }
16243
+ } catch (e) {
16244
+ }
16245
+ return this.read(name);
16246
+ },
16040
16247
  remove(name) {
16041
16248
  this.write(name, "", Date.now() - 864e5, "/");
16042
16249
  }
@@ -16049,130 +16256,224 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? (
16049
16256
  read() {
16050
16257
  return null;
16051
16258
  },
16259
+ async readAsync() {
16260
+ return null;
16261
+ },
16052
16262
  remove() {
16053
16263
  }
16054
16264
  }
16055
16265
  );
16056
16266
 
16267
+ // ../node_modules/axios/lib/helpers/isURLSameOrigin.js
16268
+ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2) => (url2) => {
16269
+ url2 = new URL(url2, document.baseURI || platform_default.origin);
16270
+ return origin2.protocol === url2.protocol && origin2.host === url2.host && origin2.port === url2.port;
16271
+ })(new URL(platform_default.origin)) : () => true;
16272
+
16273
+ // ../node_modules/axios/lib/core/assertParamsAcyclic.js
16274
+ function assertParamsAcyclic(params) {
16275
+ const pending = [{ value: params }];
16276
+ const active = /* @__PURE__ */ new WeakSet();
16277
+ const visited = /* @__PURE__ */ new WeakSet();
16278
+ while (pending.length) {
16279
+ const { value, done } = pending.pop();
16280
+ if (!utils_default.isPlainObject(value) && !utils_default.isArray(value)) continue;
16281
+ if (done) {
16282
+ active.delete(value);
16283
+ continue;
16284
+ }
16285
+ if (active.has(value)) {
16286
+ throw new AxiosError_default(
16287
+ "Circular reference detected in params",
16288
+ AxiosError_default.ERR_BAD_OPTION_VALUE
16289
+ );
16290
+ }
16291
+ if (visited.has(value)) continue;
16292
+ visited.add(value);
16293
+ active.add(value);
16294
+ pending.push({ value, done: true });
16295
+ const keys = Object.keys(value);
16296
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
16297
+ Object.getOwnPropertySymbols(value).forEach((key) => {
16298
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
16299
+ if (descriptor && descriptor.enumerable) keys.push(key);
16300
+ });
16301
+ }
16302
+ keys.forEach((key) => {
16303
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
16304
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
16305
+ if (descriptor && utils_default.hasOwnProp(descriptor, "value")) {
16306
+ pending.push({ value: descriptor.value });
16307
+ }
16308
+ } else {
16309
+ pending.push({ value: value[key] });
16310
+ }
16311
+ });
16312
+ }
16313
+ }
16314
+
16057
16315
  // ../node_modules/axios/lib/core/mergeConfig.js
16058
16316
  var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? { ...thing } : thing;
16059
16317
  var ownEnumerableKeys = (thing) => {
16060
16318
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
16061
16319
  return Object.keys(thing).concat(
16062
- Object.getOwnPropertySymbols(thing).filter(
16063
- (symbol) => Object.getOwnPropertyDescriptor(thing, symbol).enumerable
16064
- )
16320
+ Object.getOwnPropertySymbols(thing).filter((symbol) => {
16321
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
16322
+ return descriptor && descriptor.enumerable;
16323
+ })
16065
16324
  );
16066
16325
  }
16067
16326
  return Object.keys(thing);
16068
16327
  };
16069
- function mergeConfig(config1, config2) {
16070
- config1 = config1 || {};
16071
- config2 = config2 || {};
16072
- const config = /* @__PURE__ */ Object.create(null);
16073
- Object.defineProperty(config, "hasOwnProperty", {
16074
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
16075
- // this data descriptor into an accessor descriptor on the way in.
16076
- __proto__: null,
16077
- value: Object.prototype.hasOwnProperty,
16078
- enumerable: false,
16079
- writable: true,
16080
- configurable: true
16081
- });
16082
- function getMergedValue(target, source, prop, caseless) {
16083
- if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
16084
- return utils_default.merge.call({ caseless }, target, source);
16085
- } else if (utils_default.isPlainObject(source)) {
16086
- return utils_default.merge({}, source);
16087
- } else if (utils_default.isArray(source)) {
16088
- return source.slice();
16089
- }
16090
- return source;
16328
+ function mergeParams(a, b) {
16329
+ const pending = [];
16330
+ const copies = /* @__PURE__ */ new WeakMap();
16331
+ const empty = {};
16332
+ function copy(target, source) {
16333
+ if (!utils_default.isPlainObject(source)) {
16334
+ return utils_default.isArray(source) ? source.slice() : source;
16335
+ }
16336
+ const base = utils_default.isPlainObject(target) ? target : empty;
16337
+ let bases = copies.get(source);
16338
+ if (!bases) {
16339
+ bases = /* @__PURE__ */ new WeakMap();
16340
+ copies.set(source, bases);
16341
+ }
16342
+ if (bases.has(base)) return bases.get(base);
16343
+ const result2 = {};
16344
+ bases.set(base, result2);
16345
+ pending.push({ base, source, result: result2 });
16346
+ return result2;
16347
+ }
16348
+ const result = utils_default.isUndefined(b) ? copy(void 0, a) : copy(a, b);
16349
+ while (pending.length) {
16350
+ const { base, source, result: target } = pending.pop();
16351
+ const baseKeys = new Set(ownEnumerableKeys(base));
16352
+ const sourceKeys = new Set(ownEnumerableKeys(source));
16353
+ const keys = /* @__PURE__ */ new Set([...baseKeys, ...sourceKeys]);
16354
+ keys.forEach((key) => {
16355
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return;
16356
+ const hasSource = sourceKeys.has(key);
16357
+ const value = hasSource ? source[key] : void 0;
16358
+ const previous = (!hasSource || utils_default.isPlainObject(value)) && baseKeys.has(key) ? base[key] : void 0;
16359
+ target[key] = hasSource ? copy(previous, value) : copy(void 0, previous);
16360
+ });
16091
16361
  }
16092
- function mergeDeepProperties(a, b, prop, caseless) {
16093
- if (!utils_default.isUndefined(b)) {
16094
- return getMergedValue(a, b, prop, caseless);
16095
- } else if (!utils_default.isUndefined(a)) {
16096
- return getMergedValue(void 0, a, prop, caseless);
16097
- }
16362
+ assertParamsAcyclic(result);
16363
+ return result;
16364
+ }
16365
+ function getMergedValue(target, source, prop, caseless) {
16366
+ if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
16367
+ return utils_default.merge.call({ caseless }, target, source);
16368
+ } else if (utils_default.isPlainObject(source)) {
16369
+ return utils_default.merge({}, source);
16370
+ } else if (utils_default.isArray(source)) {
16371
+ return source.slice();
16372
+ }
16373
+ return source;
16374
+ }
16375
+ function mergeDeepProperties(a, b, prop, caseless) {
16376
+ if (!utils_default.isUndefined(b)) {
16377
+ return getMergedValue(a, b, prop, caseless);
16378
+ } else if (!utils_default.isUndefined(a)) {
16379
+ return getMergedValue(void 0, a, prop, caseless);
16098
16380
  }
16099
- function valueFromConfig2(a, b) {
16100
- if (!utils_default.isUndefined(b)) {
16101
- return getMergedValue(void 0, b);
16102
- }
16381
+ }
16382
+ function valueFromConfig2(a, b) {
16383
+ if (!utils_default.isUndefined(b)) {
16384
+ return getMergedValue(void 0, b);
16103
16385
  }
16104
- function defaultToConfig2(a, b) {
16105
- if (!utils_default.isUndefined(b)) {
16106
- return getMergedValue(void 0, b);
16107
- } else if (!utils_default.isUndefined(a)) {
16108
- return getMergedValue(void 0, a);
16109
- }
16386
+ }
16387
+ function defaultToConfig2(a, b) {
16388
+ if (!utils_default.isUndefined(b)) {
16389
+ return getMergedValue(void 0, b);
16390
+ } else if (!utils_default.isUndefined(a)) {
16391
+ return getMergedValue(void 0, a);
16110
16392
  }
16111
- function getMergedTransitionalOption(prop) {
16112
- const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
16113
- if (!utils_default.isUndefined(transitional2)) {
16114
- if (utils_default.isPlainObject(transitional2)) {
16115
- if (utils_default.hasOwnProp(transitional2, prop)) {
16116
- return transitional2[prop];
16117
- }
16118
- } else {
16119
- return void 0;
16393
+ }
16394
+ function getMergedTransitionalOption(config1, config2, prop) {
16395
+ const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
16396
+ if (!utils_default.isUndefined(transitional2)) {
16397
+ if (utils_default.isPlainObject(transitional2)) {
16398
+ if (utils_default.hasOwnProp(transitional2, prop)) {
16399
+ return transitional2[prop];
16120
16400
  }
16401
+ } else {
16402
+ return void 0;
16121
16403
  }
16122
- const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
16123
- if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) {
16124
- return transitional1[prop];
16125
- }
16126
- return void 0;
16127
16404
  }
16128
- function mergeDirectKeys(a, b, prop) {
16129
- if (utils_default.hasOwnProp(config2, prop)) {
16130
- return getMergedValue(a, b);
16131
- } else if (utils_default.hasOwnProp(config1, prop)) {
16132
- return getMergedValue(void 0, a);
16133
- }
16134
- }
16135
- const mergeMap = {
16136
- url: valueFromConfig2,
16137
- method: valueFromConfig2,
16138
- data: valueFromConfig2,
16139
- baseURL: defaultToConfig2,
16140
- transformRequest: defaultToConfig2,
16141
- transformResponse: defaultToConfig2,
16142
- paramsSerializer: defaultToConfig2,
16143
- timeout: defaultToConfig2,
16144
- timeoutErrorMessage: defaultToConfig2,
16145
- withCredentials: defaultToConfig2,
16146
- withXSRFToken: defaultToConfig2,
16147
- adapter: defaultToConfig2,
16148
- responseType: defaultToConfig2,
16149
- xsrfCookieName: defaultToConfig2,
16150
- xsrfHeaderName: defaultToConfig2,
16151
- onUploadProgress: defaultToConfig2,
16152
- onDownloadProgress: defaultToConfig2,
16153
- decompress: defaultToConfig2,
16154
- maxContentLength: defaultToConfig2,
16155
- maxBodyLength: defaultToConfig2,
16156
- beforeRedirect: defaultToConfig2,
16157
- transport: defaultToConfig2,
16158
- httpAgent: defaultToConfig2,
16159
- httpsAgent: defaultToConfig2,
16160
- cancelToken: defaultToConfig2,
16161
- socketPath: defaultToConfig2,
16162
- allowedSocketPaths: defaultToConfig2,
16163
- responseEncoding: defaultToConfig2,
16164
- validateStatus: mergeDirectKeys,
16165
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
16166
- };
16167
- utils_default.forEach(ownEnumerableKeys({ ...config1, ...config2 }), function computeConfigValue(prop) {
16168
- if (prop === "__proto__" || prop === "constructor" || prop === "prototype") return;
16405
+ const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
16406
+ if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) {
16407
+ return transitional1[prop];
16408
+ }
16409
+ return void 0;
16410
+ }
16411
+ function mergeDirectKeys(a, b, prop, config1, config2) {
16412
+ if (utils_default.hasOwnProp(config2, prop)) {
16413
+ return getMergedValue(a, b);
16414
+ } else if (utils_default.hasOwnProp(config1, prop)) {
16415
+ return getMergedValue(void 0, a);
16416
+ }
16417
+ }
16418
+ function mergeHeaders(a, b, prop) {
16419
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
16420
+ }
16421
+ var hasOwnPropertyDescriptor = Object.freeze({
16422
+ __proto__: null,
16423
+ value: Object.prototype.hasOwnProperty,
16424
+ enumerable: false,
16425
+ writable: true,
16426
+ configurable: true
16427
+ });
16428
+ var mergeMap = {
16429
+ url: valueFromConfig2,
16430
+ method: valueFromConfig2,
16431
+ data: valueFromConfig2,
16432
+ baseURL: defaultToConfig2,
16433
+ transformRequest: defaultToConfig2,
16434
+ transformResponse: defaultToConfig2,
16435
+ params: mergeParams,
16436
+ paramsSerializer: defaultToConfig2,
16437
+ timeout: defaultToConfig2,
16438
+ timeoutErrorMessage: defaultToConfig2,
16439
+ withCredentials: defaultToConfig2,
16440
+ withXSRFToken: defaultToConfig2,
16441
+ adapter: defaultToConfig2,
16442
+ responseType: defaultToConfig2,
16443
+ xsrfCookieName: defaultToConfig2,
16444
+ xsrfHeaderName: defaultToConfig2,
16445
+ onUploadProgress: defaultToConfig2,
16446
+ onDownloadProgress: defaultToConfig2,
16447
+ decompress: defaultToConfig2,
16448
+ maxContentLength: defaultToConfig2,
16449
+ maxBodyLength: defaultToConfig2,
16450
+ beforeRedirect: defaultToConfig2,
16451
+ transport: defaultToConfig2,
16452
+ httpAgent: defaultToConfig2,
16453
+ httpsAgent: defaultToConfig2,
16454
+ cancelToken: defaultToConfig2,
16455
+ socketPath: defaultToConfig2,
16456
+ allowedSocketPaths: defaultToConfig2,
16457
+ responseEncoding: defaultToConfig2,
16458
+ validateStatus: mergeDirectKeys,
16459
+ headers: mergeHeaders
16460
+ };
16461
+ function mergeConfig(config1, config2) {
16462
+ config1 = config1 || {};
16463
+ config2 = config2 || {};
16464
+ const config = /* @__PURE__ */ Object.create(null);
16465
+ Object.defineProperty(config, "hasOwnProperty", hasOwnPropertyDescriptor);
16466
+ const keys = ownEnumerableKeys({ ...config1, ...config2 });
16467
+ for (let i = 0, len = keys.length; i < len; i++) {
16468
+ const prop = keys[i];
16469
+ if (prop === "__proto__" || prop === "constructor" || prop === "prototype") continue;
16169
16470
  const merge2 = utils_default.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
16170
16471
  const a = utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0;
16171
16472
  const b = utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0;
16172
- const configValue = merge2(a, b, prop);
16473
+ const configValue = merge2 === mergeDirectKeys ? merge2(a, b, prop, config1, config2) : merge2(a, b, prop);
16173
16474
  utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
16174
- });
16175
- if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) {
16475
+ }
16476
+ if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption(config1, config2, "validateStatusUndefinedResolves") === false) {
16176
16477
  if (utils_default.hasOwnProp(config1, "validateStatus")) {
16177
16478
  config.validateStatus = getMergedValue(void 0, config1.validateStatus);
16178
16479
  } else {
@@ -16187,7 +16488,8 @@ var encodeUTF8 = (str) => encodeURIComponent(str).replace(
16187
16488
  /%([0-9A-F]{2})/gi,
16188
16489
  (_, hex) => String.fromCharCode(parseInt(hex, 16))
16189
16490
  );
16190
- function resolveConfig(config) {
16491
+ var readCookie = (name) => cookies_default.read(name);
16492
+ function resolveConfig(config, readXsrfCookie = readCookie) {
16191
16493
  const newConfig = mergeConfig({}, config);
16192
16494
  const own2 = (key) => utils_default.hasOwnProp(newConfig, key) ? newConfig[key] : void 0;
16193
16495
  const data = own2("data");
@@ -16208,10 +16510,15 @@ function resolveConfig(config) {
16208
16510
  if (auth) {
16209
16511
  const username = utils_default.getSafeProp(auth, "username") || "";
16210
16512
  const password = utils_default.getSafeProp(auth, "password") || "";
16513
+ const transitional2 = own2("transitional");
16514
+ const encodeUsername = transitional2 && utils_default.hasOwnProp(transitional2, "encodeBasicAuthUsername") && transitional2.encodeBasicAuthUsername === true;
16211
16515
  try {
16212
16516
  headers.set(
16213
16517
  "Authorization",
16214
- "Basic " + btoa(username + ":" + (password ? encodeUTF8(password) : ""))
16518
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
16519
+ "Basic " + btoa(
16520
+ (encodeUsername ? encodeUTF8(username) : username) + ":" + (password ? encodeUTF8(password) : "")
16521
+ )
16215
16522
  );
16216
16523
  } catch (e) {
16217
16524
  throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_OPTION_VALUE, config);
@@ -16231,7 +16538,7 @@ function resolveConfig(config) {
16231
16538
  }
16232
16539
  const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin_default(newConfig.url);
16233
16540
  if (shouldSendXSRF) {
16234
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies_default.read(xsrfCookieName);
16541
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
16235
16542
  if (xsrfValue) {
16236
16543
  headers.set(xsrfHeaderName, xsrfValue);
16237
16544
  }
@@ -16245,16 +16552,50 @@ var resolveConfig_default = resolveConfig;
16245
16552
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
16246
16553
  var xhr_default = isXHRAdapterSupported && function(config) {
16247
16554
  return new Promise(function dispatchXhrRequest(resolve, reject) {
16248
- const _config = resolveConfig_default(config);
16555
+ let useAsyncXsrf;
16556
+ try {
16557
+ const store = platform_default.hasStandardBrowserEnv && typeof window !== "undefined" && window.cookieStore;
16558
+ useAsyncXsrf = store && utils_default.isFunction(store.get);
16559
+ } catch (e) {
16560
+ }
16561
+ let xsrfCookieName;
16562
+ const _config = resolveConfig_default(
16563
+ config,
16564
+ useAsyncXsrf ? (name) => {
16565
+ xsrfCookieName = name;
16566
+ return null;
16567
+ } : void 0
16568
+ );
16249
16569
  let requestData = _config.data;
16250
16570
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
16251
16571
  let { responseType, onUploadProgress, onDownloadProgress } = _config;
16252
16572
  let onCanceled;
16573
+ let timeoutId;
16253
16574
  let uploadThrottled, downloadThrottled;
16254
16575
  let flushUpload, flushDownload, flushDownloadWithEvent;
16255
16576
  function done() {
16256
- flushUpload && flushUpload();
16257
- flushDownload && flushDownload();
16577
+ clearTimeout(timeoutId);
16578
+ try {
16579
+ flushUpload && flushUpload();
16580
+ } catch (err) {
16581
+ setTimeout(() => {
16582
+ throw err;
16583
+ });
16584
+ }
16585
+ try {
16586
+ flushDownload && flushDownload();
16587
+ } catch (err) {
16588
+ setTimeout(() => {
16589
+ throw err;
16590
+ });
16591
+ }
16592
+ if (request) {
16593
+ downloadThrottled && request.removeEventListener("progress", downloadThrottled);
16594
+ if (request.upload) {
16595
+ uploadThrottled && request.upload.removeEventListener("progress", uploadThrottled);
16596
+ flushUpload && request.upload.removeEventListener("loadend", flushUpload);
16597
+ }
16598
+ }
16258
16599
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
16259
16600
  _config.signal && _config.signal.removeEventListener("abort", onCanceled);
16260
16601
  }
@@ -16340,6 +16681,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16340
16681
  request = null;
16341
16682
  };
16342
16683
  request.ontimeout = function handleTimeout() {
16684
+ if (!request) return;
16343
16685
  let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
16344
16686
  const transitional2 = _config.transitional || transitional_default;
16345
16687
  if (_config.timeoutErrorMessage) {
@@ -16357,11 +16699,6 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16357
16699
  request = null;
16358
16700
  };
16359
16701
  requestData === void 0 && requestHeaders.setContentType(null);
16360
- if ("setRequestHeader" in request) {
16361
- utils_default.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
16362
- request.setRequestHeader(key, val);
16363
- });
16364
- }
16365
16702
  if (!utils_default.isUndefined(_config.withCredentials)) {
16366
16703
  request.withCredentials = !!_config.withCredentials;
16367
16704
  }
@@ -16386,15 +16723,18 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16386
16723
  return;
16387
16724
  }
16388
16725
  reject(!cancel || cancel.type ? new CanceledError_default(null, config, request) : cancel);
16389
- request.abort();
16726
+ const xhr = request;
16390
16727
  done();
16391
16728
  request = null;
16729
+ xhr.abort();
16392
16730
  };
16393
16731
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
16732
+ if (!request) return;
16394
16733
  if (_config.signal) {
16395
16734
  _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
16396
16735
  }
16397
16736
  }
16737
+ if (!request) return;
16398
16738
  const protocol = parseProtocol(_config.url);
16399
16739
  if (protocol && !platform_default.protocols.includes(protocol)) {
16400
16740
  reject(
@@ -16407,7 +16747,58 @@ var xhr_default = isXHRAdapterSupported && function(config) {
16407
16747
  done();
16408
16748
  return;
16409
16749
  }
16410
- request.send(requestData || null);
16750
+ const sendRequest = () => {
16751
+ if (!request) return;
16752
+ if ("setRequestHeader" in request) {
16753
+ utils_default.forEach(
16754
+ toByteStringHeaderObject(requestHeaders),
16755
+ function setRequestHeader(val, key) {
16756
+ request.setRequestHeader(key, val);
16757
+ }
16758
+ );
16759
+ }
16760
+ request.send(requestData || null);
16761
+ };
16762
+ if (xsrfCookieName) {
16763
+ const now = typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
16764
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : void 0;
16765
+ const abortOnTimeout = () => {
16766
+ if (!request) return;
16767
+ const xhr = request;
16768
+ xhr.ontimeout();
16769
+ xhr.abort();
16770
+ };
16771
+ if (deadline !== void 0) {
16772
+ const scheduleTimeout = () => {
16773
+ const remaining = deadline - now();
16774
+ if (remaining > 0) {
16775
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 2147483647));
16776
+ } else {
16777
+ abortOnTimeout();
16778
+ }
16779
+ };
16780
+ scheduleTimeout();
16781
+ }
16782
+ cookies_default.readAsync(xsrfCookieName).then((value) => {
16783
+ if (!request) return;
16784
+ if (deadline !== void 0 && now() >= deadline) {
16785
+ abortOnTimeout();
16786
+ return;
16787
+ }
16788
+ if (value) {
16789
+ const headerName = utils_default.hasOwnProp(_config, "xsrfHeaderName") && _config.xsrfHeaderName;
16790
+ requestHeaders.set(headerName, value);
16791
+ }
16792
+ sendRequest();
16793
+ }).catch((error) => {
16794
+ if (!request) return;
16795
+ reject(AxiosError_default.from(error, null, config, request));
16796
+ done();
16797
+ request = null;
16798
+ });
16799
+ } else {
16800
+ sendRequest();
16801
+ }
16411
16802
  });
16412
16803
  };
16413
16804
 
@@ -16440,7 +16831,8 @@ var composeSignals = (signals, timeout) => {
16440
16831
  timer && clearTimeout(timer);
16441
16832
  timer = null;
16442
16833
  signals.forEach((signal2) => {
16443
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
16834
+ const unsubscribeSignal = utils_default.getSafeProp(signal2, "unsubscribe");
16835
+ utils_default.isFunction(unsubscribeSignal) ? unsubscribeSignal.call(signal2, onabort) : signal2.removeEventListener("abort", onabort);
16444
16836
  });
16445
16837
  signals = null;
16446
16838
  };
@@ -16540,6 +16932,110 @@ var trackStream = (stream4, chunkSize, onProgress, onFinish) => {
16540
16932
  );
16541
16933
  };
16542
16934
 
16935
+ // ../node_modules/axios/lib/helpers/formDataToBlob.js
16936
+ var CRLF2 = "\r\n";
16937
+ var normalizeLines = (value) => String(value).replace(/\r\n|\r|\n/g, CRLF2);
16938
+ var escapeName = (value) => String(value).replace(
16939
+ /[\r\n"]/g,
16940
+ (char) => char === "\r" ? "%0D" : char === "\n" ? "%0A" : "%22"
16941
+ );
16942
+ var stringBytes = (value, normalize) => {
16943
+ let length = 0;
16944
+ for (let i = 0; i < value.length; i++) {
16945
+ const code = value.charCodeAt(i);
16946
+ if (normalize && (code === 13 || code === 10)) {
16947
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
16948
+ length += 2;
16949
+ } else if (code < 128) {
16950
+ length++;
16951
+ } else if (code < 2048) {
16952
+ length += 2;
16953
+ } else if (code >= 55296 && code <= 56319 && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
16954
+ length += 4;
16955
+ i++;
16956
+ } else {
16957
+ length += 3;
16958
+ }
16959
+ }
16960
+ return length;
16961
+ };
16962
+ var FormDataError = class extends TypeError {
16963
+ constructor(message, reason) {
16964
+ super(message);
16965
+ this.name = "FormDataError";
16966
+ this.reason = reason;
16967
+ }
16968
+ };
16969
+ function formDataToBlob(form, Blob2, limit, limitError, boundary) {
16970
+ if (!utils_default.isFunction(Blob2)) {
16971
+ throw new FormDataError("Blob is not supported", "blob");
16972
+ }
16973
+ if (!utils_default.isString(boundary) || !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) || / $/.test(boundary)) {
16974
+ throw new FormDataError("Invalid multipart boundary", "boundary");
16975
+ }
16976
+ const footer = "--" + boundary + "--" + CRLF2;
16977
+ let length = footer.length;
16978
+ const parts = [];
16979
+ const checkLength = (extra) => {
16980
+ if (length + extra > limit) throw limitError();
16981
+ };
16982
+ checkLength(0);
16983
+ for (const [name, value] of form) {
16984
+ const isString2 = utils_default.isString(value);
16985
+ const valueLength = isString2 ? stringBytes(value, true) : value.size;
16986
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
16987
+ throw new FormDataError("Unsupported FormData part size", "part");
16988
+ }
16989
+ checkLength(
16990
+ valueLength + stringBytes(name, true) + (!isString2 && value.name ? stringBytes(value.name, false) : 0) + (!isString2 && value.type ? stringBytes(value.type, false) : 0)
16991
+ );
16992
+ let header = "--" + boundary + CRLF2 + 'Content-Disposition: form-data; name="' + escapeName(normalizeLines(name)) + '"';
16993
+ if (!isString2) {
16994
+ header += '; filename="' + escapeName(utils_default.isString(value.name) ? value.name : "blob") + '"' + CRLF2 + "Content-Type: " + String(value.type || "application/octet-stream").replace(/[\r\n]/g, "");
16995
+ }
16996
+ header += CRLF2 + CRLF2;
16997
+ const partLength = stringBytes(header, false) + valueLength + CRLF2.length;
16998
+ checkLength(partLength);
16999
+ length += partLength;
17000
+ parts.push({ header, value, isString: isString2 });
17001
+ }
17002
+ const blobParts = [];
17003
+ for (const part of parts) {
17004
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF2);
17005
+ }
17006
+ blobParts.push(footer);
17007
+ return new Blob2(blobParts, { type: "multipart/form-data; boundary=" + boundary });
17008
+ }
17009
+
17010
+ // ../node_modules/axios/lib/core/createMultipartBody.js
17011
+ function createMultipartBody(form, Blob2, limit, limitError, boundary) {
17012
+ if (!utils_default.isFunction(Blob2)) {
17013
+ throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
17014
+ }
17015
+ if (boundary === void 0) {
17016
+ if (utils_default.isFunction(platform_default.generateString)) {
17017
+ boundary = "axios-" + platform_default.generateString(36, "0123456789abcdef");
17018
+ } else {
17019
+ const crypto2 = utils_default.global.crypto;
17020
+ if (!crypto2 || !utils_default.isFunction(crypto2.getRandomValues)) {
17021
+ throw new AxiosError_default("Random byte generation is not supported", AxiosError_default.ERR_NOT_SUPPORT);
17022
+ }
17023
+ const random = new Uint8Array(18);
17024
+ crypto2.getRandomValues(random);
17025
+ boundary = "axios-" + Array.from(random, (value) => ("0" + value.toString(16)).slice(-2)).join("");
17026
+ }
17027
+ }
17028
+ try {
17029
+ return formDataToBlob(form, Blob2, limit, limitError, boundary);
17030
+ } catch (error) {
17031
+ if (error instanceof FormDataError) {
17032
+ const code = error.reason === "boundary" ? AxiosError_default.ERR_BAD_OPTION_VALUE : AxiosError_default.ERR_BAD_REQUEST;
17033
+ throw new AxiosError_default(error.message, code);
17034
+ }
17035
+ throw error;
17036
+ }
17037
+ }
17038
+
16543
17039
  // ../node_modules/axios/lib/adapters/fetch.js
16544
17040
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
16545
17041
  var DEFAULT_REQUEST_OPTIONS = {
@@ -16592,11 +17088,13 @@ var factory = (env) => {
16592
17088
  },
16593
17089
  {
16594
17090
  Request: globalObject.Request,
16595
- Response: globalObject.Response
17091
+ Response: globalObject.Response,
17092
+ Blob: globalObject.Blob
16596
17093
  },
16597
17094
  env
16598
17095
  );
16599
- const { fetch: envFetch, Request, Response } = env;
17096
+ const envFetch = utils_default.hasOwnProp(env, "fetch") ? env.fetch : void 0;
17097
+ const { Request, Response, Blob: Blob2 } = env;
16600
17098
  const isFetchSupported = envFetch ? isFunction2(envFetch) : typeof fetch === "function";
16601
17099
  const isRequestSupported = isFunction2(Request);
16602
17100
  const isResponseSupported = isFunction2(Response);
@@ -16622,6 +17120,13 @@ var factory = (env) => {
16622
17120
  return duplexAccessed && !hasContentType;
16623
17121
  });
16624
17122
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils_default.isReadableStream(new Response("").body));
17123
+ const requestDefaults = Object.assign(/* @__PURE__ */ Object.create(null), DEFAULT_REQUEST_OPTIONS);
17124
+ if (isRequestSupported && !test(() => new Request(platform_default.origin, requestDefaults))) {
17125
+ delete requestDefaults.cache;
17126
+ if (!test(() => new Request(platform_default.origin, requestDefaults))) {
17127
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
17128
+ }
17129
+ }
16625
17130
  const resolvers = {
16626
17131
  stream: supportsResponseStream && ((res) => res.body)
16627
17132
  };
@@ -16647,13 +17152,6 @@ var factory = (env) => {
16647
17152
  if (utils_default.isBlob(body)) {
16648
17153
  return body.size;
16649
17154
  }
16650
- if (utils_default.isSpecCompliantForm(body)) {
16651
- const _request = new Request(platform_default.origin, {
16652
- method: "POST",
16653
- body
16654
- });
16655
- return (await _request.arrayBuffer()).byteLength;
16656
- }
16657
17155
  if (utils_default.isArrayBufferView(body) || utils_default.isArrayBuffer(body)) {
16658
17156
  return body.byteLength;
16659
17157
  }
@@ -16701,6 +17199,7 @@ var factory = (env) => {
16701
17199
  });
16702
17200
  let requestContentLength;
16703
17201
  let pendingBodyError = null;
17202
+ let pendingResponseError = null;
16704
17203
  const maxBodyLengthError = () => new AxiosError_default(
16705
17204
  "Request body larger than maxBodyLength limit",
16706
17205
  AxiosError_default.ERR_BAD_REQUEST,
@@ -16718,8 +17217,9 @@ var factory = (env) => {
16718
17217
  password
16719
17218
  };
16720
17219
  }
17220
+ let parsedURL;
16721
17221
  if (maybeWithAuthCredentials(url2)) {
16722
- const parsedURL = new URL(url2, platform_default.origin);
17222
+ parsedURL = new URL(url2, platform_default.origin);
16723
17223
  if (!auth && (parsedURL.username || parsedURL.password)) {
16724
17224
  const urlUsername = decodeURIComponentSafe2(parsedURL.username);
16725
17225
  const urlPassword = decodeURIComponentSafe2(parsedURL.password);
@@ -16741,8 +17241,8 @@ var factory = (env) => {
16741
17241
  "Basic " + btoa(encodeUTF82((auth.username || "") + ":" + (auth.password || "")))
16742
17242
  );
16743
17243
  }
16744
- if (hasMaxContentLength && typeof url2 === "string" && url2.startsWith("data:")) {
16745
- const estimated = estimateDataURLDecodedBytes(url2);
17244
+ if (hasMaxContentLength && parsedURL && parsedURL.protocol === "data:") {
17245
+ const estimated = estimateDataURLDecodedBytes(parsedURL.href);
16746
17246
  if (estimated > maxContentLength) {
16747
17247
  throw new AxiosError_default(
16748
17248
  "maxContentLength size of " + maxContentLength + " exceeded",
@@ -16752,6 +17252,23 @@ var factory = (env) => {
16752
17252
  );
16753
17253
  }
16754
17254
  }
17255
+ const formContentType = utils_default.isSpecCompliantForm(data) && AxiosHeaders_default.from(own2("headers")).getContentType();
17256
+ let formBoundary;
17257
+ if (utils_default.isString(formContentType) && /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())) {
17258
+ const parameters = AxiosHeaders_default.parseParameters(formContentType);
17259
+ if (utils_default.hasOwnProp(parameters, "boundary")) formBoundary = parameters.boundary;
17260
+ }
17261
+ if (utils_default.isSpecCompliantForm(data) && method !== "get" && method !== "head" && (hasMaxBodyLength || onUploadProgress && supportsRequestStream || formBoundary !== void 0)) {
17262
+ data = createMultipartBody(
17263
+ data,
17264
+ Blob2,
17265
+ hasMaxBodyLength ? maxBodyLength : Infinity,
17266
+ maxBodyLengthError,
17267
+ formBoundary
17268
+ );
17269
+ headers.setContentType(formBoundary === void 0 ? data.type : formContentType);
17270
+ requestContentLength = data.size;
17271
+ }
16755
17272
  if (hasMaxBodyLength && method !== "get" && method !== "head") {
16756
17273
  const outboundLength = await getBodyLength(data);
16757
17274
  if (typeof outboundLength === "number" && isFinite(outboundLength)) {
@@ -16832,7 +17349,7 @@ var factory = (env) => {
16832
17349
  credentials: isCredentialsSupported ? withCredentials : void 0
16833
17350
  });
16834
17351
  if (isRequestSupported) {
16835
- utils_default.forEach(DEFAULT_REQUEST_OPTIONS, (value, key) => {
17352
+ utils_default.forEach(requestDefaults, (value, key) => {
16836
17353
  if (resolvedOptions[key] === void 0) {
16837
17354
  resolvedOptions[key] = value;
16838
17355
  }
@@ -16880,7 +17397,7 @@ var factory = (env) => {
16880
17397
  if (hasMaxContentLength) {
16881
17398
  bytesRead = loadedBytes;
16882
17399
  if (bytesRead > maxContentLength) {
16883
- throw new AxiosError_default(
17400
+ throw pendingResponseError = new AxiosError_default(
16884
17401
  "maxContentLength size of " + maxContentLength + " exceeded",
16885
17402
  AxiosError_default.ERR_BAD_RESPONSE,
16886
17403
  config,
@@ -16955,6 +17472,9 @@ var factory = (env) => {
16955
17472
  request && !pendingBodyError.request && (pendingBodyError.request = request);
16956
17473
  throw pendingBodyError;
16957
17474
  }
17475
+ if (pendingResponseError) {
17476
+ throw pendingResponseError;
17477
+ }
16958
17478
  if (err instanceof AxiosError_default) {
16959
17479
  request && !err.request && (err.request = request);
16960
17480
  throw err;
@@ -16982,9 +17502,15 @@ var factory = (env) => {
16982
17502
  };
16983
17503
  var seedCache = /* @__PURE__ */ new Map();
16984
17504
  var getFetch = (config) => {
16985
- let env = config && config.env || {};
16986
- const { fetch: fetch2, Request, Response } = env;
16987
- const seeds = [Request, Response, fetch2];
17505
+ const env = /* @__PURE__ */ Object.create(null);
17506
+ const configuredEnv = config && utils_default.hasOwnProp(config, "env") && config.env;
17507
+ ["fetch", "Request", "Response", "Blob"].forEach((key) => {
17508
+ if (configuredEnv && utils_default.hasOwnProp(configuredEnv, key)) {
17509
+ env[key] = configuredEnv[key];
17510
+ }
17511
+ });
17512
+ const { fetch: fetch2, Request, Response, Blob: Blob2 } = env;
17513
+ const seeds = [Request, Response, fetch2, Blob2];
16988
17514
  let len = seeds.length, i = len, seed, target, map = seedCache;
16989
17515
  while (i--) {
16990
17516
  seed = seeds[i];
@@ -17070,6 +17596,12 @@ function throwIfCancellationRequested(config) {
17070
17596
  throw new CanceledError_default(null, config);
17071
17597
  }
17072
17598
  }
17599
+ function resolveClock() {
17600
+ return typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
17601
+ }
17602
+ function elapsedSince(now, start) {
17603
+ return Math.max(0, Math.round(now() - start));
17604
+ }
17073
17605
  function dispatchRequest(_config) {
17074
17606
  const config = utils_default.toSafeFlatObject(_config);
17075
17607
  throwIfCancellationRequested(config);
@@ -17079,9 +17611,12 @@ function dispatchRequest(_config) {
17079
17611
  config.headers.setContentType("application/x-www-form-urlencoded", false);
17080
17612
  }
17081
17613
  const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
17614
+ const now = resolveClock();
17615
+ const start = now();
17082
17616
  return adapter2(config).then(
17083
17617
  function onAdapterResolution(response) {
17084
17618
  throwIfCancellationRequested(config);
17619
+ response.duration = elapsedSince(now, start);
17085
17620
  config.response = response;
17086
17621
  try {
17087
17622
  response.data = transformData.call(config, config.transformResponse, response);
@@ -17095,6 +17630,7 @@ function dispatchRequest(_config) {
17095
17630
  if (!isCancel(reason)) {
17096
17631
  throwIfCancellationRequested(config);
17097
17632
  if (reason && reason.response) {
17633
+ reason.response.duration = elapsedSince(now, start);
17098
17634
  config.response = reason.response;
17099
17635
  try {
17100
17636
  reason.response.data = transformData.call(
@@ -17182,6 +17718,27 @@ var validator_default = {
17182
17718
 
17183
17719
  // ../node_modules/axios/lib/core/Axios.js
17184
17720
  var validators2 = validator_default.validators;
17721
+ var isHeadersBucket = (value) => {
17722
+ if (value == null || utils_default.isPlainObject(value) || value instanceof AxiosHeaders_default) {
17723
+ return true;
17724
+ }
17725
+ try {
17726
+ return utils_default.isObject(value) && utils_default.getSafeProp(value, Symbol.toStringTag) === "AxiosHeaders" && [
17727
+ "toJSON",
17728
+ "set",
17729
+ "get",
17730
+ "has",
17731
+ "delete",
17732
+ "clear",
17733
+ "normalize",
17734
+ "concat",
17735
+ "toString",
17736
+ Symbol.iterator
17737
+ ].every((method) => utils_default.isFunction(utils_default.getSafeProp(value, method)));
17738
+ } catch (e) {
17739
+ return false;
17740
+ }
17741
+ };
17185
17742
  var Axios = class {
17186
17743
  constructor(instanceConfig) {
17187
17744
  this.defaults = instanceConfig || {};
@@ -17217,9 +17774,13 @@ var Axios = class {
17217
17774
  } else if (stack) {
17218
17775
  const firstNewlineIndex = stack.indexOf("\n");
17219
17776
  const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf("\n", firstNewlineIndex + 1);
17220
- const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? "" : stack.slice(secondNewlineIndex + 1);
17221
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
17222
- err.stack += "\n" + stack;
17777
+ const duplicateCheckSuffix = secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
17778
+ const currentStack = String(err.stack);
17779
+ const causeIndex = getCauseStackIndex(err, currentStack);
17780
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
17781
+ const causeSection = causeIndex === -1 ? "" : currentStack.slice(causeIndex);
17782
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
17783
+ err.stack = stackHead + "\n" + stack + causeSection;
17223
17784
  }
17224
17785
  }
17225
17786
  } catch (e) {
@@ -17246,7 +17807,8 @@ var Axios = class {
17246
17807
  clarifyTimeoutError: validators2.transitional(validators2.boolean),
17247
17808
  legacyInterceptorReqResOrdering: validators2.transitional(validators2.boolean),
17248
17809
  advertiseZstdAcceptEncoding: validators2.transitional(validators2.boolean),
17249
- validateStatusUndefinedResolves: validators2.transitional(validators2.boolean)
17810
+ validateStatusUndefinedResolves: validators2.transitional(validators2.boolean),
17811
+ encodeBasicAuthUsername: validators2.transitional(validators2.boolean)
17250
17812
  },
17251
17813
  false
17252
17814
  );
@@ -17267,7 +17829,7 @@ var Axios = class {
17267
17829
  );
17268
17830
  }
17269
17831
  }
17270
- if (config.allowAbsoluteUrls !== void 0) ; else if (this.defaults.allowAbsoluteUrls !== void 0) {
17832
+ if (config.allowAbsoluteUrls !== void 0) ; else if (utils_default.hasOwnProp(this.defaults, "allowAbsoluteUrls") && this.defaults.allowAbsoluteUrls !== void 0) {
17271
17833
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
17272
17834
  } else {
17273
17835
  config.allowAbsoluteUrls = true;
@@ -17281,9 +17843,16 @@ var Axios = class {
17281
17843
  true
17282
17844
  );
17283
17845
  config.method = (utils_default.getSafeProp(config, "method") || utils_default.getSafeProp(this.defaults, "method") || "get").toLowerCase();
17284
- let contextHeaders = headers && utils_default.merge(headers.common, headers[config.method]);
17846
+ const commonHeaders = utils_default.getSafeProp(headers, "common");
17847
+ const methodHeaders = utils_default.getSafeProp(headers, config.method);
17848
+ const contextHeaders = headers && utils_default.merge(
17849
+ isHeadersBucket(commonHeaders) ? commonHeaders : void 0,
17850
+ isHeadersBucket(methodHeaders) ? methodHeaders : void 0
17851
+ );
17285
17852
  headers && utils_default.forEach(methodList_default.concat("common"), (method) => {
17286
- delete headers[method];
17853
+ if (isHeadersBucket(utils_default.getSafeProp(headers, method))) {
17854
+ delete headers[method];
17855
+ }
17287
17856
  });
17288
17857
  config.headers = AxiosHeaders_default.concat(contextHeaders, headers);
17289
17858
  const requestInterceptorChain = [];
@@ -17365,7 +17934,7 @@ var Axios = class {
17365
17934
  }
17366
17935
  };
17367
17936
  utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
17368
- Axios.prototype[method] = function(url2, config) {
17937
+ Axios.prototype[method] = async function(url2, config) {
17369
17938
  return this.request(
17370
17939
  mergeConfig(config || {}, {
17371
17940
  method,
@@ -17377,7 +17946,7 @@ utils_default.forEach(["delete", "get", "head", "options"], function forEachMeth
17377
17946
  });
17378
17947
  utils_default.forEach(["post", "put", "patch", "query"], function forEachMethodWithData(method) {
17379
17948
  function generateHTTPMethod(isForm) {
17380
- return function httpMethod(url2, data, config) {
17949
+ return async function httpMethod(url2, data, config) {
17381
17950
  return this.request(
17382
17951
  mergeConfig(config || {}, {
17383
17952
  method,
@@ -17901,12 +18470,80 @@ var VersionRequiredError = class extends Posty5Error {
17901
18470
  this.name = "VersionRequiredError";
17902
18471
  }
17903
18472
  };
18473
+ var CORE_VERSION = "5.0.2";
18474
+ var DEFAULT_BASE_URL = "https://api.posty5.com";
18475
+ var DEFAULT_TIMEOUT_MS = 3e4;
18476
+ var DEFAULT_MAX_RETRIES = 3;
18477
+ var DEFAULT_RETRY_DELAY_MS = 1e3;
18478
+ var CLIENT_HEADER_NAME = "X-Posty5-Client";
18479
+ var SDK_CLIENT_NAME = "posty5-npm";
18480
+ var SDK_CLIENT_ID = `${SDK_CLIENT_NAME}/${CORE_VERSION}`;
18481
+ var DEFAULT_CREATED_FROM = "npmPackage";
18482
+ var IDEMPOTENT_METHODS = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"];
18483
+ var NEVER_CONNECTED_ERROR_CODES = ["ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN", "ENETUNREACH", "EHOSTUNREACH"];
18484
+ var API_KEY_HEADER_NAME = "X-API-Key";
18485
+ var REDACTED_VALUE = "[REDACTED]";
18486
+ var LOOPBACK_HOSTNAMES2 = ["localhost", "127.0.0.1", "[::1]", "::1"];
18487
+ var DOT_SEGMENT_PATTERN = /^(?:\.|%2e){1,2}$/i;
18488
+ function assertNoDotSegments(url2) {
18489
+ const path = url2.split(/[?#]/)[0];
18490
+ if (path.split("/").some((segment) => DOT_SEGMENT_PATTERN.test(segment))) {
18491
+ throw new Posty5Error(`Invalid request path "${url2}": "." and ".." segments are not allowed`, "INVALID_PATH");
18492
+ }
18493
+ }
18494
+ function redactHeaders(headers) {
18495
+ if (!headers || typeof headers !== "object") return;
18496
+ for (const name of Object.keys(headers)) {
18497
+ if (name.toLowerCase() === API_KEY_HEADER_NAME.toLowerCase()) headers[name] = REDACTED_VALUE;
18498
+ }
18499
+ }
18500
+ function hideProperty(target, key) {
18501
+ if (!target || !(key in target)) return;
18502
+ Object.defineProperty(target, key, { value: target[key], enumerable: false, configurable: true, writable: true });
18503
+ }
18504
+ function redactApiKey(error) {
18505
+ const axiosError = error;
18506
+ if (!axiosError || typeof axiosError !== "object") return error;
18507
+ redactHeaders(axiosError.config?.headers);
18508
+ redactHeaders(axiosError.response?.config?.headers);
18509
+ hideProperty(axiosError, "request");
18510
+ hideProperty(axiosError.response, "request");
18511
+ return error;
18512
+ }
18513
+ function originOf(protocol, hostname, port) {
18514
+ const resolvedPort = port ? String(port) : protocol === "https:" ? "443" : "80";
18515
+ return `${protocol}//${hostname.toLowerCase()}:${resolvedPort}`;
18516
+ }
18517
+ function apiKeyRedirectGuard(baseUrl) {
18518
+ let baseOrigin;
18519
+ try {
18520
+ const base = new URL(baseUrl);
18521
+ baseOrigin = originOf(base.protocol, base.hostname, base.port);
18522
+ } catch {
18523
+ baseOrigin = void 0;
18524
+ }
18525
+ return (options) => {
18526
+ const target = originOf(String(options.protocol || ""), String(options.hostname || options.host || ""), options.port);
18527
+ if (target === baseOrigin) return;
18528
+ for (const name of Object.keys(options.headers || {})) {
18529
+ if (name.toLowerCase() === API_KEY_HEADER_NAME.toLowerCase()) delete options.headers[name];
18530
+ }
18531
+ };
18532
+ }
18533
+ function isInsecureBaseUrl(baseUrl) {
18534
+ try {
18535
+ const url2 = new URL(baseUrl);
18536
+ return url2.protocol === "http:" && !LOOPBACK_HOSTNAMES2.includes(url2.hostname.toLowerCase());
18537
+ } catch {
18538
+ return false;
18539
+ }
18540
+ }
17904
18541
  function transformError(error) {
17905
18542
  if (error instanceof Posty5Error) {
17906
18543
  return error;
17907
18544
  }
17908
18545
  if (error.isAxiosError) {
17909
- const axiosError = error;
18546
+ const axiosError = redactApiKey(error);
17910
18547
  if (!axiosError.response) {
17911
18548
  if (axiosError.code === "ECONNABORTED" || axiosError.message.includes("timeout")) {
17912
18549
  return new NetworkError("Request timeout", { originalError: error });
@@ -17962,17 +18599,6 @@ function transformError(error) {
17962
18599
  }
17963
18600
  return new Posty5Error("An unknown error occurred", void 0, void 0, { originalError: error });
17964
18601
  }
17965
- var CORE_VERSION = "5.0.0";
17966
- var DEFAULT_BASE_URL = "https://api.posty5.com";
17967
- var DEFAULT_TIMEOUT_MS = 3e4;
17968
- var DEFAULT_MAX_RETRIES = 3;
17969
- var DEFAULT_RETRY_DELAY_MS = 1e3;
17970
- var CLIENT_HEADER_NAME = "X-Posty5-Client";
17971
- var SDK_CLIENT_NAME = "posty5-npm";
17972
- var SDK_CLIENT_ID = `${SDK_CLIENT_NAME}/${CORE_VERSION}`;
17973
- var DEFAULT_CREATED_FROM = "npmPackage";
17974
- var IDEMPOTENT_METHODS = ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"];
17975
- var NEVER_CONNECTED_ERROR_CODES = ["ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN", "ENETUNREACH", "EHOSTUNREACH"];
17976
18602
  var IF_MATCH_HEADER = "If-Match";
17977
18603
  var CONCURRENCY_REPORT_HEADER = "X-Posty5-Concurrency";
17978
18604
  var CONCURRENCY_REPORT_MISSING_VERSION = "missing-version";
@@ -18023,6 +18649,19 @@ function shouldRetryRequest(error) {
18023
18649
  }
18024
18650
  return idempotent && status >= 500;
18025
18651
  }
18652
+ function decodeBinaryErrorBody(error) {
18653
+ const response = error?.response;
18654
+ const data = response?.data;
18655
+ const isBytes = data instanceof ArrayBuffer || typeof Uint8Array !== "undefined" && data instanceof Uint8Array;
18656
+ if (!isBytes) return error;
18657
+ const text = new TextDecoder().decode(data).trim();
18658
+ if (!text) return error;
18659
+ try {
18660
+ response.data = JSON.parse(text);
18661
+ } catch {
18662
+ }
18663
+ return error;
18664
+ }
18026
18665
  function parseFileName(disposition) {
18027
18666
  if (!disposition) return void 0;
18028
18667
  const match = /filename\*?=(?:UTF-8'')?"?([^";]+)"?/i.exec(disposition);
@@ -18033,15 +18672,21 @@ function parseFileName(disposition) {
18033
18672
  return match[1];
18034
18673
  }
18035
18674
  }
18675
+ var apiKeys = /* @__PURE__ */ new WeakMap();
18036
18676
  var HttpClient = class {
18037
18677
  constructor(config = {}) {
18678
+ const { apiKey, ...publicConfig } = config;
18679
+ apiKeys.set(this, apiKey);
18038
18680
  this.config = {
18039
18681
  timeout: DEFAULT_TIMEOUT_MS,
18040
18682
  maxRetries: DEFAULT_MAX_RETRIES,
18041
18683
  retryDelay: DEFAULT_RETRY_DELAY_MS,
18042
- ...config,
18684
+ ...publicConfig,
18043
18685
  baseUrl: config.baseUrl || process.env.POSTY5_BASE_URL || DEFAULT_BASE_URL
18044
18686
  };
18687
+ if (isInsecureBaseUrl(this.config.baseUrl)) {
18688
+ console.warn(`[Posty5 SDK] baseUrl ${this.config.baseUrl} is plain http: the API key travels unencrypted. Use https.`);
18689
+ }
18045
18690
  this.axiosInstance = axios_default.create({
18046
18691
  baseURL: this.config.baseUrl,
18047
18692
  timeout: this.config.timeout,
@@ -18049,7 +18694,9 @@ var HttpClient = class {
18049
18694
  "Content-Type": "application/json",
18050
18695
  [CLIENT_HEADER_NAME]: SDK_CLIENT_ID,
18051
18696
  ...this.config.headers
18052
- }
18697
+ },
18698
+ // A redirect to another origin must not carry the API key along.
18699
+ beforeRedirect: apiKeyRedirectGuard(this.config.baseUrl)
18053
18700
  });
18054
18701
  esm_default(this.axiosInstance, {
18055
18702
  retries: this.config.maxRetries ?? DEFAULT_MAX_RETRIES,
@@ -18060,11 +18707,12 @@ var HttpClient = class {
18060
18707
  });
18061
18708
  this.axiosInstance.interceptors.request.use(
18062
18709
  (config2) => {
18063
- if (this.config.apiKey) {
18064
- config2.headers["X-API-Key"] = this.config.apiKey;
18710
+ const apiKey2 = apiKeys.get(this);
18711
+ if (apiKey2) {
18712
+ config2.headers[API_KEY_HEADER_NAME] = apiKey2;
18065
18713
  } else {
18066
18714
  if (process.env.POSTY5_API_KEY) {
18067
- config2.headers["X-API-Key"] = process.env.POSTY5_API_KEY;
18715
+ config2.headers[API_KEY_HEADER_NAME] = process.env.POSTY5_API_KEY;
18068
18716
  }
18069
18717
  }
18070
18718
  if (this.config.debug) {
@@ -18078,7 +18726,7 @@ var HttpClient = class {
18078
18726
  },
18079
18727
  (error) => {
18080
18728
  if (this.config.debug) {
18081
- console.log("[Posty5 SDK] Request Error:", error);
18729
+ console.log("[Posty5 SDK] Request Error:", error?.message);
18082
18730
  }
18083
18731
  return Promise.reject(transformError(error));
18084
18732
  }
@@ -18098,7 +18746,7 @@ var HttpClient = class {
18098
18746
  if (this.config.debug) {
18099
18747
  console.error("[Posty5 SDK] Error:", JSON.stringify(error.response?.data || error.message));
18100
18748
  }
18101
- return Promise.reject(transformError(error));
18749
+ return Promise.reject(transformError(decodeBinaryErrorBody(error)));
18102
18750
  }
18103
18751
  );
18104
18752
  }
@@ -18110,19 +18758,20 @@ var HttpClient = class {
18110
18758
  * Set or update the API key
18111
18759
  */
18112
18760
  setApiKey(apiKey) {
18113
- this.config.apiKey = apiKey;
18761
+ apiKeys.set(this, apiKey);
18114
18762
  }
18115
18763
  /**
18116
18764
  * Clear authentication credentials
18117
18765
  */
18118
18766
  clearAuth() {
18119
- this.config.apiKey = void 0;
18767
+ apiKeys.set(this, void 0);
18120
18768
  }
18121
18769
  /**
18122
18770
  * Make a GET request
18123
18771
  */
18124
18772
  async get(url2, config) {
18125
18773
  try {
18774
+ assertNoDotSegments(url2);
18126
18775
  const response = await this.axiosInstance.get(url2, this.buildConfig(config));
18127
18776
  return response.data;
18128
18777
  } catch (error) {
@@ -18134,6 +18783,7 @@ var HttpClient = class {
18134
18783
  */
18135
18784
  async post(url2, data, config) {
18136
18785
  try {
18786
+ assertNoDotSegments(url2);
18137
18787
  const response = await this.axiosInstance.post(url2, data, this.buildConfig(config));
18138
18788
  return response.data;
18139
18789
  } catch (error) {
@@ -18145,6 +18795,7 @@ var HttpClient = class {
18145
18795
  */
18146
18796
  async put(url2, data, config) {
18147
18797
  try {
18798
+ assertNoDotSegments(url2);
18148
18799
  const response = await this.axiosInstance.put(url2, data, this.buildConfig(config));
18149
18800
  return response.data;
18150
18801
  } catch (error) {
@@ -18156,11 +18807,12 @@ var HttpClient = class {
18156
18807
  */
18157
18808
  async patch(url2, data, config) {
18158
18809
  try {
18810
+ assertNoDotSegments(url2);
18159
18811
  const response = await this.axiosInstance.patch(url2, data, this.buildConfig(config));
18160
18812
  return response.data;
18161
18813
  } catch (error) {
18162
18814
  if (this.config.debug) {
18163
- console.log("[Posty5 SDK] PATCH Request Error:", error);
18815
+ console.log("[Posty5 SDK] PATCH Request Error:", error?.message);
18164
18816
  }
18165
18817
  throw transformError(error);
18166
18818
  }
@@ -18170,11 +18822,12 @@ var HttpClient = class {
18170
18822
  */
18171
18823
  async delete(url2, config) {
18172
18824
  try {
18825
+ assertNoDotSegments(url2);
18173
18826
  const response = await this.axiosInstance.delete(url2, this.buildConfig(config));
18174
18827
  return response.data;
18175
18828
  } catch (error) {
18176
18829
  if (this.config.debug) {
18177
- console.log("[Posty5 SDK] DELETE Request Error:", error);
18830
+ console.log("[Posty5 SDK] DELETE Request Error:", error?.message);
18178
18831
  }
18179
18832
  throw transformError(error);
18180
18833
  }
@@ -18188,6 +18841,7 @@ var HttpClient = class {
18188
18841
  */
18189
18842
  async getBinary(url2, config) {
18190
18843
  try {
18844
+ assertNoDotSegments(url2);
18191
18845
  const response = await this.axiosInstance.get(url2, {
18192
18846
  ...this.buildConfig(config),
18193
18847
  responseType: "arraybuffer"
@@ -18479,7 +19133,7 @@ var SocialPublisherPostClient = class {
18479
19133
  * @param id - Post ID
18480
19134
  */
18481
19135
  async getStatus(id) {
18482
- const response = await this.http.get(`${this.basePath}/${id}/status`);
19136
+ const response = await this.http.get(`${this.basePath}/${encodeURIComponent(id)}/status`);
18483
19137
  return response.result;
18484
19138
  }
18485
19139
  /**
@@ -18501,7 +19155,15 @@ var SocialPublisherPostClient = class {
18501
19155
  * cannot be removed programmatically and no credits are charged.
18502
19156
  *
18503
19157
  * @param id - Post ID
19158
+ * Pass `platform` to remove the post from that one platform only. The other
19159
+ * platforms keep their copies and the post becomes `partiallyRemoved`. The
19160
+ * post must have been published there (platform status `done` or
19161
+ * `removeFailed`), or the API refuses the call. A `partiallyRemoved` post can
19162
+ * be removed again. Needs the API with per-platform removal.
19163
+ *
19164
+ * @param id - Post ID
18504
19165
  * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
19166
+ * @param platform - Optional (5.2.0): remove from this platform only. Omit to remove from every platform.
18505
19167
  * @returns Per-platform removal results, `__v` set to the post's new version
18506
19168
  *
18507
19169
  * @example
@@ -18509,11 +19171,15 @@ var SocialPublisherPostClient = class {
18509
19171
  * const post = await client.getStatus("post_123");
18510
19172
  * const { results } = await client.removePost("post_123", post.__v);
18511
19173
  * // results.youtube?.success === true
19174
+ *
19175
+ * // Only the YouTube copy:
19176
+ * await client.removePost("post_123", post.__v, "youtube");
18512
19177
  * ```
18513
19178
  */
18514
- async removePost(id, version) {
19179
+ async removePost(id, version, platform) {
18515
19180
  assertVersion(version);
18516
- const response = await this.http.post(`${this.basePath}/${id}/remove`, {}, { version });
19181
+ const body = platform ? { platform } : {};
19182
+ const response = await this.http.post(`${this.basePath}/${encodeURIComponent(id)}/remove`, body, { version });
18517
19183
  return withVersion(response, id);
18518
19184
  }
18519
19185
  /**
@@ -18521,7 +19187,7 @@ var SocialPublisherPostClient = class {
18521
19187
  * @param id - Current Post ID
18522
19188
  */
18523
19189
  async getNextAndPrevious(id) {
18524
- const response = await this.http.get(`${this.basePath}/${id}/next-previous`);
19190
+ const response = await this.http.get(`${this.basePath}/${encodeURIComponent(id)}/next-previous`);
18525
19191
  return response.result;
18526
19192
  }
18527
19193
  /**
@@ -18530,7 +19196,7 @@ var SocialPublisherPostClient = class {
18530
19196
  * @param id - Optional ID for updating/retrying? (Based on route :id?)
18531
19197
  */
18532
19198
  async createToWorkspaceByFile(data, id) {
18533
- const url2 = id ? `${this.basePath}/short-video/workspace/by-file/${id}` : `${this.basePath}/short-video/workspace/by-file`;
19199
+ const url2 = id ? `${this.basePath}/short-video/workspace/by-file/${encodeURIComponent(id)}` : `${this.basePath}/short-video/workspace/by-file`;
18534
19200
  const response = await this.http.post(url2, {
18535
19201
  ...data,
18536
19202
  createdFrom: this.http.createdFrom
@@ -18543,7 +19209,7 @@ var SocialPublisherPostClient = class {
18543
19209
  * @param id - Optional ID for updating/retrying? (Based on route :id?)
18544
19210
  */
18545
19211
  async createToWorkspaceByURL(data, id) {
18546
- const url2 = id ? `${this.basePath}/short-video/workspace/by-url/${id}` : `${this.basePath}/short-video/workspace/by-url`;
19212
+ const url2 = id ? `${this.basePath}/short-video/workspace/by-url/${encodeURIComponent(id)}` : `${this.basePath}/short-video/workspace/by-url`;
18547
19213
  const response = await this.http.post(url2, {
18548
19214
  ...data,
18549
19215
  createdFrom: this.http.createdFrom
@@ -18556,7 +19222,7 @@ var SocialPublisherPostClient = class {
18556
19222
  * @param id - Optional ID for updating/retrying?
18557
19223
  */
18558
19224
  async createToAccountByFile(data, id) {
18559
- const url2 = id ? `${this.basePath}/short-video/account/by-file/${id}` : `${this.basePath}/short-video/account/by-file`;
19225
+ const url2 = id ? `${this.basePath}/short-video/account/by-file/${encodeURIComponent(id)}` : `${this.basePath}/short-video/account/by-file`;
18560
19226
  const response = await this.http.post(url2, {
18561
19227
  ...data,
18562
19228
  createdFrom: this.http.createdFrom
@@ -18569,7 +19235,7 @@ var SocialPublisherPostClient = class {
18569
19235
  * @param id - Optional ID for updating/retrying?
18570
19236
  */
18571
19237
  async createToAccountByURL(data, id) {
18572
- const url2 = id ? `${this.basePath}/short-video/account/by-url/${id}` : `${this.basePath}/short-video/account/by-url`;
19238
+ const url2 = id ? `${this.basePath}/short-video/account/by-url/${encodeURIComponent(id)}` : `${this.basePath}/short-video/account/by-url`;
18573
19239
  const response = await this.http.post(url2, {
18574
19240
  ...data,
18575
19241
  createdFrom: this.http.createdFrom
@@ -18593,7 +19259,7 @@ var SocialPublisherPostClient = class {
18593
19259
  * ```
18594
19260
  */
18595
19261
  async createImagePostToWorkspace(data, id) {
18596
- const url2 = id ? `${this.basePath}/image/workspace/${id}` : `${this.basePath}/image/workspace`;
19262
+ const url2 = id ? `${this.basePath}/image/workspace/${encodeURIComponent(id)}` : `${this.basePath}/image/workspace`;
18597
19263
  const response = await this.http.post(url2, {
18598
19264
  ...data,
18599
19265
  createdFrom: this.http.createdFrom
@@ -18606,7 +19272,7 @@ var SocialPublisherPostClient = class {
18606
19272
  * platforms in the request are ignored.
18607
19273
  */
18608
19274
  async createImagePostToAccount(data, id) {
18609
- const url2 = id ? `${this.basePath}/image/account/${id}` : `${this.basePath}/image/account`;
19275
+ const url2 = id ? `${this.basePath}/image/account/${encodeURIComponent(id)}` : `${this.basePath}/image/account`;
18610
19276
  const response = await this.http.post(url2, {
18611
19277
  ...data,
18612
19278
  createdFrom: this.http.createdFrom
@@ -18999,7 +19665,7 @@ var SocialPublisherPostClient = class {
18999
19665
  };
19000
19666
  const target = isFile2 ? "by-file" : "by-url";
19001
19667
  const id = postId ?? thumb?.postId;
19002
- const url2 = id ? `${this.basePath}/long-video/workspace/${target}/${id}` : `${this.basePath}/long-video/workspace/${target}`;
19668
+ const url2 = id ? `${this.basePath}/long-video/workspace/${target}/${encodeURIComponent(id)}` : `${this.basePath}/long-video/workspace/${target}`;
19003
19669
  const response = await this.http.post(url2, { ...body, createdFrom: this.http.createdFrom });
19004
19670
  return this.normaliseLongVideoResult(response.result);
19005
19671
  }
@@ -19051,7 +19717,7 @@ var SocialPublisherPostClient = class {
19051
19717
  };
19052
19718
  const target = isFile2 ? "by-file" : "by-url";
19053
19719
  const id = postId ?? thumb?.postId;
19054
- const url2 = id ? `${this.basePath}/long-video/account/${target}/${id}` : `${this.basePath}/long-video/account/${target}`;
19720
+ const url2 = id ? `${this.basePath}/long-video/account/${target}/${encodeURIComponent(id)}` : `${this.basePath}/long-video/account/${target}`;
19055
19721
  const response = await this.http.post(url2, { ...body, createdFrom: this.http.createdFrom });
19056
19722
  return this.normaliseLongVideoResult(response.result);
19057
19723
  }
@@ -19078,7 +19744,7 @@ var SocialPublisherPostClient = class {
19078
19744
  }
19079
19745
  assertVersion(version);
19080
19746
  const response = await this.http.put(
19081
- `${this.basePath}/${id}`,
19747
+ `${this.basePath}/${encodeURIComponent(id)}`,
19082
19748
  {
19083
19749
  ...data.schedule === "now" ? { scheduleType: "now" } : { scheduleType: "schedule", scheduledAt: data.schedule.toISOString() },
19084
19750
  ...data.caption !== void 0 ? { caption: data.caption } : {}
@@ -19108,7 +19774,7 @@ var SocialPublisherPostClient = class {
19108
19774
  throw new Error("id is required");
19109
19775
  }
19110
19776
  assertVersion(version);
19111
- await this.http.delete(`${this.basePath}/${id}`, { version });
19777
+ await this.http.delete(`${this.basePath}/${encodeURIComponent(id)}`, { version });
19112
19778
  }
19113
19779
  /**
19114
19780
  * Upload a long video and return the URL to publish from.