@jingx/lottery-components-react-jsx 1.0.44 → 1.0.45

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.cjs.js CHANGED
@@ -3190,10 +3190,10 @@ var applyBind = function applyBind() {
3190
3190
 
3191
3191
  module.exports = function callBind(originalFunction) {
3192
3192
  var func = callBindBasic(arguments);
3193
- var adjustedLength = originalFunction.length - (arguments.length - 1);
3193
+ var adjustedLength = 1 + originalFunction.length - (arguments.length - 1);
3194
3194
  return setFunctionLength$1(
3195
3195
  func,
3196
- 1 + (adjustedLength > 0 ? adjustedLength : 0),
3196
+ adjustedLength > 0 ? adjustedLength : 0,
3197
3197
  true
3198
3198
  );
3199
3199
  };
@@ -6252,7 +6252,7 @@ Popper$1.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
6252
6252
  Popper$1.placements = placements;
6253
6253
  Popper$1.Defaults = Defaults;
6254
6254
 
6255
- var lib$1 = {exports: {}};
6255
+ var lib = {exports: {}};
6256
6256
 
6257
6257
  var implementation = {exports: {}};
6258
6258
 
@@ -6541,10 +6541,10 @@ var implementationExports = implementation.exports;
6541
6541
 
6542
6542
  exports$1.default = _react2.default.createContext || _implementation2.default;
6543
6543
  module.exports = exports$1['default'];
6544
- } (lib$1, lib$1.exports));
6544
+ } (lib, lib.exports));
6545
6545
 
6546
- var libExports$1 = lib$1.exports;
6547
- var createContext = /*@__PURE__*/getDefaultExportFromCjs(libExports$1);
6546
+ var libExports = lib.exports;
6547
+ var createContext = /*@__PURE__*/getDefaultExportFromCjs(libExports);
6548
6548
 
6549
6549
  var ManagerReferenceNodeContext = createContext();
6550
6550
  var ManagerReferenceNodeSetterContext = createContext();
@@ -12295,7 +12295,7 @@ lodash.exports;
12295
12295
  var undefined$1;
12296
12296
 
12297
12297
  /** Used as the semantic version number. */
12298
- var VERSION = '4.17.21';
12298
+ var VERSION = '4.18.1';
12299
12299
 
12300
12300
  /** Used as the size to enable large array optimizations. */
12301
12301
  var LARGE_ARRAY_SIZE = 200;
@@ -12303,7 +12303,8 @@ lodash.exports;
12303
12303
  /** Error message constants. */
12304
12304
  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
12305
12305
  FUNC_ERROR_TEXT = 'Expected a function',
12306
- INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
12306
+ INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`',
12307
+ INVALID_TEMPL_IMPORTS_ERROR_TEXT = 'Invalid `imports` option passed into `_.template`';
12307
12308
 
12308
12309
  /** Used to stand-in for `undefined` hash values. */
12309
12310
  var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -14035,6 +14036,10 @@ lodash.exports;
14035
14036
  * embedded Ruby (ERB) as well as ES2015 template strings. Change the
14036
14037
  * following template settings to use alternative delimiters.
14037
14038
  *
14039
+ * **Security:** See
14040
+ * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
14041
+ * — `_.template` is insecure and will be removed in v5.
14042
+ *
14038
14043
  * @static
14039
14044
  * @memberOf _
14040
14045
  * @type {Object}
@@ -14583,7 +14588,7 @@ lodash.exports;
14583
14588
  * @name has
14584
14589
  * @memberOf SetCache
14585
14590
  * @param {*} value The value to search for.
14586
- * @returns {number} Returns `true` if `value` is found, else `false`.
14591
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
14587
14592
  */
14588
14593
  function setCacheHas(value) {
14589
14594
  return this.__data__.has(value);
@@ -16049,7 +16054,7 @@ lodash.exports;
16049
16054
  if (isArray(iteratee)) {
16050
16055
  return function(value) {
16051
16056
  return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
16052
- }
16057
+ };
16053
16058
  }
16054
16059
  return iteratee;
16055
16060
  });
@@ -16653,8 +16658,34 @@ lodash.exports;
16653
16658
  */
16654
16659
  function baseUnset(object, path) {
16655
16660
  path = castPath(path, object);
16656
- object = parent(object, path);
16657
- return object == null || delete object[toKey(last(path))];
16661
+
16662
+ // Prevent prototype pollution:
16663
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
16664
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
16665
+ var index = -1,
16666
+ length = path.length;
16667
+
16668
+ if (!length) {
16669
+ return true;
16670
+ }
16671
+
16672
+ while (++index < length) {
16673
+ var key = toKey(path[index]);
16674
+
16675
+ // Always block "__proto__" anywhere in the path if it's not expected
16676
+ if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
16677
+ return false;
16678
+ }
16679
+
16680
+ // Block constructor/prototype as non-terminal traversal keys to prevent
16681
+ // escaping the object graph into built-in constructors and prototypes.
16682
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
16683
+ return false;
16684
+ }
16685
+ }
16686
+
16687
+ var obj = parent(object, path);
16688
+ return obj == null || delete obj[toKey(last(path))];
16658
16689
  }
16659
16690
 
16660
16691
  /**
@@ -19205,7 +19236,7 @@ lodash.exports;
19205
19236
 
19206
19237
  /**
19207
19238
  * Creates an array with all falsey values removed. The values `false`, `null`,
19208
- * `0`, `""`, `undefined`, and `NaN` are falsey.
19239
+ * `0`, `-0`, `0n`, `""`, `undefined`, and `NaN` are falsy.
19209
19240
  *
19210
19241
  * @static
19211
19242
  * @memberOf _
@@ -19744,7 +19775,7 @@ lodash.exports;
19744
19775
 
19745
19776
  while (++index < length) {
19746
19777
  var pair = pairs[index];
19747
- result[pair[0]] = pair[1];
19778
+ baseAssignValue(result, pair[0], pair[1]);
19748
19779
  }
19749
19780
  return result;
19750
19781
  }
@@ -26404,6 +26435,8 @@ lodash.exports;
26404
26435
  * **Note:** JavaScript follows the IEEE-754 standard for resolving
26405
26436
  * floating-point values which can produce unexpected results.
26406
26437
  *
26438
+ * **Note:** If `lower` is greater than `upper`, the values are swapped.
26439
+ *
26407
26440
  * @static
26408
26441
  * @memberOf _
26409
26442
  * @since 0.7.0
@@ -26417,9 +26450,16 @@ lodash.exports;
26417
26450
  * _.random(0, 5);
26418
26451
  * // => an integer between 0 and 5
26419
26452
  *
26453
+ * // when lower is greater than upper the values are swapped
26454
+ * _.random(5, 0);
26455
+ * // => an integer between 0 and 5
26456
+ *
26420
26457
  * _.random(5);
26421
26458
  * // => also an integer between 0 and 5
26422
26459
  *
26460
+ * _.random(-5);
26461
+ * // => an integer between -5 and 0
26462
+ *
26423
26463
  * _.random(5, true);
26424
26464
  * // => a floating-point number between 0 and 5
26425
26465
  *
@@ -27021,6 +27061,10 @@ lodash.exports;
27021
27061
  * properties may be accessed as free variables in the template. If a setting
27022
27062
  * object is given, it takes precedence over `_.templateSettings` values.
27023
27063
  *
27064
+ * **Security:** `_.template` is insecure and should not be used. It will be
27065
+ * removed in Lodash v5. Avoid untrusted input. See
27066
+ * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
27067
+ *
27024
27068
  * **Note:** In the development build `_.template` utilizes
27025
27069
  * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
27026
27070
  * for easier debugging.
@@ -27128,12 +27172,18 @@ lodash.exports;
27128
27172
  options = undefined$1;
27129
27173
  }
27130
27174
  string = toString(string);
27131
- options = assignInWith({}, options, settings, customDefaultsAssignIn);
27175
+ options = assignWith({}, options, settings, customDefaultsAssignIn);
27132
27176
 
27133
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
27177
+ var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn),
27134
27178
  importsKeys = keys(imports),
27135
27179
  importsValues = baseValues(imports, importsKeys);
27136
27180
 
27181
+ arrayEach(importsKeys, function(key) {
27182
+ if (reForbiddenIdentifierChars.test(key)) {
27183
+ throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
27184
+ }
27185
+ });
27186
+
27137
27187
  var isEscaping,
27138
27188
  isEvaluating,
27139
27189
  index = 0,
@@ -29482,9 +29532,9 @@ var lodashExports = lodash.exports;
29482
29532
  var _ = /*@__PURE__*/getDefaultExportFromCjs(lodashExports);
29483
29533
 
29484
29534
  /**
29485
- * react-number-format - 5.4.4
29535
+ * react-number-format - 5.4.5
29486
29536
  * Author : Sudhanshu Yadav
29487
- * Copyright (c) 2016, 2025 to Sudhanshu Yadav, released under the MIT license.
29537
+ * Copyright (c) 2016, 2026 to Sudhanshu Yadav, released under the MIT license.
29488
29538
  * https://github.com/s-yadav/react-number-format
29489
29539
  */
29490
29540
 
@@ -29926,7 +29976,7 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format, re
29926
29976
  });
29927
29977
  var values = ref[0];
29928
29978
  var setValues = ref[1];
29929
- var _onValueChange = function (newValues, sourceInfo) {
29979
+ var _onValueChange = usePersistentCallback(function (newValues, sourceInfo) {
29930
29980
  if (newValues.formattedValue !== values.formattedValue) {
29931
29981
  setValues({
29932
29982
  formattedValue: newValues.formattedValue,
@@ -29935,7 +29985,7 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format, re
29935
29985
  }
29936
29986
  // call parent on value change if only if formatted value is changed
29937
29987
  onValueChange(newValues, sourceInfo);
29938
- };
29988
+ });
29939
29989
  // if value is switch from controlled to uncontrolled, use the internal state's value to format with new props
29940
29990
  var _value = value;
29941
29991
  var _valueIsNumericString = valueIsNumericString;
@@ -29947,6 +29997,21 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format, re
29947
29997
  React.useMemo(function () {
29948
29998
  setValues(newValues);
29949
29999
  }, [newValues.formattedValue]);
30000
+ /**
30001
+ * When only a defaultValue is provided (value prop is nil), the initial formatted value is
30002
+ * derived by the library — the parent has not yet been informed of this formatted result.
30003
+ * Fire onValueChange once on mount so the parent can sync to the formatted value.
30004
+ */
30005
+ React.useEffect(function () {
30006
+ if (!isNil(defaultValue) && isNil(value) && values.formattedValue !== '') {
30007
+ var floatValue = parseFloat(values.numAsString);
30008
+ _onValueChange({
30009
+ formattedValue: values.formattedValue,
30010
+ value: values.numAsString,
30011
+ floatValue: isNaN(floatValue) ? undefined : floatValue,
30012
+ }, { event: undefined, source: SourceType.props });
30013
+ }
30014
+ }, []);
29950
30015
  return [values, _onValueChange];
29951
30016
  }
29952
30017
 
@@ -30501,7 +30566,9 @@ function getCaretBoundary(formattedValue, props) {
30501
30566
  var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
30502
30567
  var hasNegation = formattedValue[0] === '-';
30503
30568
  // fill for prefix and negation
30504
- boundaryAry.fill(false, 0, prefix.length + (hasNegation ? 1 : 0));
30569
+ // Cap the fill range so we never exceed the array length when the formatted value
30570
+ // is just '-' (negation only, e.g. during intermediate typing with a multi-char prefix)
30571
+ boundaryAry.fill(false, 0, Math.min(prefix.length + (hasNegation ? 1 : 0), formattedValue.length));
30505
30572
  // fill for suffix
30506
30573
  var valLn = formattedValue.length;
30507
30574
  boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
@@ -30586,7 +30653,10 @@ function useNumericFormat(props) {
30586
30653
  var selectionEnd = el.selectionEnd;
30587
30654
  var value = el.value; if ( value === void 0 ) value = '';
30588
30655
  // if user tries to delete partial prefix then ignore it
30589
- if ((key === 'Backspace' || key === 'Delete') && selectionEnd < prefix.length) {
30656
+ // Exception: when value is just '-' (negation-only, no prefix shown yet), the cursor
30657
+ // is at position 1 which is < prefix.length for multi-char prefixes — we must allow
30658
+ // backspace to delete the lone negation sign in this state
30659
+ if ((key === 'Backspace' || key === 'Delete') && selectionEnd < prefix.length && value !== '-') {
30590
30660
  e.preventDefault();
30591
30661
  return;
30592
30662
  }
@@ -30926,6 +30996,19 @@ const lotteryLabel = {
30926
30996
  HOSO: "\u1786\u17D2\u1793\u17C4\u178F HOSO",
30927
30997
  KP: "\u1780\u17C6\u1796\u178F KP"
30928
30998
  };
30999
+ const lotteryCodes = {
31000
+ LEAP: "LMHSB",
31001
+ HOSO: "HOSO",
31002
+ VN4: "VN4",
31003
+ VN3: "VN3",
31004
+ VN2: "MT",
31005
+ VN1: "MC",
31006
+ TN: "TC",
31007
+ KH: "KH",
31008
+ SC: "SC",
31009
+ TH: "TH",
31010
+ KP: "KP"
31011
+ };
30929
31012
  const lotteryLabelKH = {
30930
31013
  LEAP: "\u179B\u17B6\u1797",
30931
31014
  VN2: "\u1798\u17A0\u17B6\u1791\u17C1\u1796",
@@ -37574,13 +37657,389 @@ const ProtestTicket = ({
37574
37657
  ] }) }) });
37575
37658
  };
37576
37659
 
37577
- var lib = {exports: {}};
37578
-
37579
- (function (module, exports$1) {
37580
- !function(e,t){module.exports=t(React);}("undefined"!=typeof self?self:commonjsGlobal,function(e){return function(){var t={155:function(t){t.exports=e;}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:true,get:t[o]});},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:true});};var r={};n.r(r),n.d(r,{useReactToPrint:function(){return g}});var s=n(155);const i="printWindow";function l({level:e="error",messages:t,suppressErrors:o=false}){o||("error"===e?console.error(t):"warning"===e?console.warn(t):console.debug(t));}function a(e,t){if(t||!e){const e=document.getElementById(i);e&&document.body.removeChild(e);}}function c(e){return e instanceof Error?e:new Error("Unknown Error")}function d(e,t){const{documentTitle:o,onAfterPrint:n,onPrintError:r,preserveAfterPrint:s,print:i,suppressErrors:d}=t;setTimeout(()=>{var t,u;if(e.contentWindow){function p(){null==n||n(),a(s);}if(e.contentWindow.focus(),i)i(e).then(p).catch(e=>{r?r("print",c(e)):l({messages:["An error was thrown by the specified `print` function"],suppressErrors:d});});else {if(e.contentWindow.print){const f=null!==(u=null===(t=e.contentDocument)||void 0===t?void 0:t.title)&&void 0!==u?u:"",h=e.ownerDocument.title;o&&(e.ownerDocument.title=o,e.contentDocument&&(e.contentDocument.title=o)),e.contentWindow.print(),o&&(e.ownerDocument.title=h,e.contentDocument&&(e.contentDocument.title=f));}else l({messages:["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],suppressErrors:d});[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>{var t,o;return (null!==(o=null!==(t=navigator.userAgent)&&void 0!==t?t:navigator.vendor)&&void 0!==o?o:"opera"in window&&window.opera).match(e)})?setTimeout(p,500):p();}}else l({messages:["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],suppressErrors:d});},500);}function u(e){const t=[],o=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null);let n=o.nextNode();for(;n;)t.push(n),n=o.nextNode();return t}function p(e,t,o){const n=u(e),r=u(t);if(n.length===r.length)for(let e=0;e<n.length;e++){const t=n[e],s=r[e],i=t.shadowRoot;if(null!==i){const e=s.attachShadow({mode:i.mode});e.innerHTML=i.innerHTML,p(i,e,o);}}else l({messages:["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.",e,t],suppressErrors:o});}const f='\n @page {\n /* Remove browser default header (title) and footer (url) */\n margin: 0;\n }\n @media print {\n body {\n /* Tell browsers to print background colors */\n color-adjust: exact; /* Firefox. This is an older version of "print-color-adjust" */\n print-color-adjust: exact; /* Firefox/Safari */\n -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */\n }\n }\n';function h(e,t,o,n){var r,s,i,a,u;const{contentNode:h,clonedContentNode:g,clonedImgNodes:m,clonedVideoNodes:b,numResourcesToLoad:y,originalCanvasNodes:v}=o,{bodyClass:w,fonts:E,ignoreGlobalStyles:A,pageStyle:P,nonce:T,suppressErrors:S,copyShadowRoots:x}=n;e.onload=null;const k=null!==(r=e.contentDocument)&&void 0!==r?r:null===(s=e.contentWindow)||void 0===s?void 0:s.document;if(k){const o=k.body.appendChild(g);x&&p(h,o,!!S),E&&((null===(i=e.contentDocument)||void 0===i?void 0:i.fonts)&&(null===(a=e.contentWindow)||void 0===a?void 0:a.FontFace)?E.forEach(o=>{const n=new FontFace(o.family,o.source,{weight:o.weight,style:o.style});e.contentDocument.fonts.add(n),n.loaded.then(()=>{t(n);}).catch(e=>{t(n,["Failed loading the font:",n,"Load error:",c(e)]);});}):(E.forEach(e=>{t(e);}),l({messages:['"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page'],suppressErrors:S})));const n=null!=P?P:f,r=k.createElement("style");T&&(r.setAttribute("nonce",T),k.head.setAttribute("nonce",T)),r.appendChild(k.createTextNode(n)),k.head.appendChild(r),w&&k.body.classList.add(...w.split(" "));const s=k.querySelectorAll("canvas");for(let e=0;e<v.length;++e){const t=v[e],o=s[e];if(void 0===o){l({messages:["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.",t],suppressErrors:S});continue}const n=o.getContext("2d");n&&n.drawImage(t,0,0);}for(let e=0;e<m.length;e++){const o=m[e],n=o.getAttribute("src");if(n){const e=new Image;e.onload=()=>{t(o);},e.onerror=(e,n,r,s,i)=>{t(o,["Error loading <img>",o,"Error",i]);},e.src=n;}else t(o,['Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.',o]);}for(let e=0;e<b.length;e++){const o=b[e];o.preload="auto";const n=o.getAttribute("poster");if(n){const e=new Image;e.onload=()=>{t(o);},e.onerror=(e,r,s,i,l)=>{t(o,["Error loading video poster",n,"for video",o,"Error:",l]);},e.src=n;}else o.readyState>=2?t(o):o.src?(o.onloadeddata=()=>{t(o);},o.onerror=(e,n,r,s,i)=>{t(o,["Error loading video",o,"Error",i]);},o.onstalled=()=>{t(o,["Loading video stalled, skipping",o]);}):t(o,["Error loading video, `src` is empty",o]);}const d="select",y=h.querySelectorAll(d),C=k.querySelectorAll(d);for(let e=0;e<y.length;e++)C[e].value=y[e].value;if(!A){const e=document.querySelectorAll("style, link[rel~='stylesheet'], link[as='style']");for(let o=0,n=e.length;o<n;++o){const n=e[o];if("style"===n.tagName.toLowerCase()){const e=k.createElement(n.tagName),t=n.sheet;if(t){let r="";try{const e=t.cssRules.length;for(let o=0;o<e;++o)"string"==typeof t.cssRules[o].cssText&&(r+=`${t.cssRules[o].cssText}\r\n`);}catch(e){l({messages:["A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",n,`Original error: ${c(e).message}`],level:"warning"});}e.setAttribute("id",`react-to-print-${o}`),T&&e.setAttribute("nonce",T),e.appendChild(k.createTextNode(r)),k.head.appendChild(e);}}else if(n.getAttribute("href"))if(n.hasAttribute("disabled"))l({messages:["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:",n],level:"warning"}),t(n);else {const e=k.createElement(n.tagName);for(let t=0,o=n.attributes.length;t<o;++t){const o=n.attributes[t];o&&e.setAttribute(o.nodeName,null!==(u=o.nodeValue)&&void 0!==u?u:"");}e.onload=()=>{t(e);},e.onerror=(o,n,r,s,i)=>{t(e,["Failed to load",e,"Error:",i]);},T&&e.setAttribute("nonce",T),k.head.appendChild(e);}else l({messages:["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:",n],level:"warning"}),t(n);}}}0===y&&d(e,n);}function g({bodyClass:e,contentRef:t,copyShadowRoots:o,documentTitle:n,fonts:r,ignoreGlobalStyles:u,nonce:p,onAfterPrint:f,onBeforePrint:g,onPrintError:m,pageStyle:b,preserveAfterPrint:y,print:v,printIframeProps:w,suppressErrors:E}){const A=(0, s.useCallback)(s=>{function A(){const a={bodyClass:e,contentRef:t,copyShadowRoots:o,documentTitle:n,fonts:r,ignoreGlobalStyles:u,nonce:p,onAfterPrint:f,onPrintError:m,pageStyle:b,preserveAfterPrint:y,print:v,suppressErrors:E},c=function(e){const t=document.createElement("iframe");return t.width=`${document.documentElement.clientWidth}px`,t.height=`${document.documentElement.clientHeight}px`,t.style.position="absolute",t.style.top=`-${document.documentElement.clientHeight+100}px`,t.style.left=`-${document.documentElement.clientWidth+100}px`,t.id=i,t.srcdoc="<!DOCTYPE html>",e&&(e.allow&&(t.allow=e.allow),void 0!==e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),void 0!==e.sandbox&&(t.sandbox=e.sandbox)),t}(w),A=function(e,t){const{contentRef:o,fonts:n,ignoreGlobalStyles:r,suppressErrors:s}=t,i=function({contentRef:e,optionalContent:t,suppressErrors:o}){return t&&"function"==typeof t?(e&&l({level:"warning",messages:['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']}),t()):e?e.current:void l({messages:['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],suppressErrors:o})}({contentRef:o,optionalContent:e,suppressErrors:s});if(!i)return;const a=i.cloneNode(true),c=document.querySelectorAll("link[rel~='stylesheet'], link[as='style']"),d=a.querySelectorAll("img"),u=a.querySelectorAll("video"),p=n?n.length:0;return {contentNode:i,clonedContentNode:a,clonedImgNodes:d,clonedVideoNodes:u,numResourcesToLoad:(r?0:c.length)+d.length+u.length+p,originalCanvasNodes:i.querySelectorAll("canvas")}}(s,a);if(!A)return void l({messages:["There is nothing to print"],suppressErrors:E});const P=function(e,t,o){const{suppressErrors:n}=e,r=[],s=[];return function(i,a){r.includes(i)?l({level:"debug",messages:["Tried to mark a resource that has already been handled",i],suppressErrors:n}):(a?(l({messages:['"react-to-print" was unable to load a resource but will continue attempting to print the page',...a],suppressErrors:n}),s.push(i)):r.push(i),r.length+s.length===t&&d(o,e));}}(a,A.numResourcesToLoad,c);!function(e,t,o,n){e.onload=()=>{h(e,t,o,n);},document.body.appendChild(e);}(c,P,A,a);}a(y,true),g?g().then(()=>{A();}).catch(e=>{null==m||m("onBeforePrint",c(e));}):A();},[e,t,o,n,r,u,p,f,g,m,b,y,v,E]);return A}return r}()});
37581
- } (lib));
37582
-
37583
- var libExports = lib.exports;
37660
+ const q = "printWindow";
37661
+ function V(e) {
37662
+ const t = document.createElement("iframe");
37663
+ return t.width = `${document.documentElement.clientWidth}px`, t.height = `${document.documentElement.clientHeight}px`, t.style.position = "absolute", t.style.top = `-${document.documentElement.clientHeight + 100}px`, t.style.left = `-${document.documentElement.clientWidth + 100}px`, t.id = q, t.srcdoc = "<!DOCTYPE html>", e && (e.allow && (t.allow = e.allow), e.referrerPolicy !== void 0 && (t.referrerPolicy = e.referrerPolicy), e.sandbox !== void 0 && (t.sandbox = e.sandbox)), t;
37664
+ }
37665
+ function f({ level: e = "error", messages: t, suppressErrors: n = false }) {
37666
+ n || (e === "error" ? console.error(t) : e === "warning" ? console.warn(t) : console.debug(t));
37667
+ }
37668
+ function $(e, t) {
37669
+ if (t || !e) {
37670
+ const n = document.getElementById(q);
37671
+ n && document.body.removeChild(n);
37672
+ }
37673
+ }
37674
+ function P(e) {
37675
+ return e instanceof Error ? e : new Error("Unknown Error");
37676
+ }
37677
+ function H(e, t) {
37678
+ const {
37679
+ documentTitle: n,
37680
+ onAfterPrint: l,
37681
+ onPrintError: p,
37682
+ preserveAfterPrint: m,
37683
+ print: h,
37684
+ suppressErrors: g
37685
+ } = t;
37686
+ setTimeout(() => {
37687
+ if (e.contentWindow) {
37688
+ let a = function() {
37689
+ l?.(), $(m);
37690
+ };
37691
+ if (e.contentWindow.focus(), h)
37692
+ h(e).then(a).catch((c) => {
37693
+ p ? p("print", P(c)) : f({
37694
+ messages: ["An error was thrown by the specified `print` function"],
37695
+ suppressErrors: g
37696
+ });
37697
+ });
37698
+ else {
37699
+ if (e.contentWindow.print) {
37700
+ const c = e.contentDocument?.title ?? "", E = e.ownerDocument.title, y = typeof n == "function" ? n() : n;
37701
+ y && (e.ownerDocument.title = y, e.contentDocument && (e.contentDocument.title = y)), e.contentWindow.print(), y && (e.ownerDocument.title = E, e.contentDocument && (e.contentDocument.title = c));
37702
+ } else
37703
+ f({
37704
+ messages: ["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],
37705
+ suppressErrors: g
37706
+ });
37707
+ z() ? setTimeout(a, 500) : a();
37708
+ }
37709
+ } else
37710
+ f({
37711
+ messages: ["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],
37712
+ suppressErrors: g
37713
+ });
37714
+ }, 500);
37715
+ }
37716
+ function z() {
37717
+ return [
37718
+ /Android/i,
37719
+ /webOS/i,
37720
+ /iPhone/i,
37721
+ /iPad/i,
37722
+ /iPod/i,
37723
+ /BlackBerry/i,
37724
+ /Windows Phone/i
37725
+ ].some((t) => (
37726
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
37727
+ (navigator.userAgent ?? // Retained for compatibility with browsers that use `navigator.vendor` to identify the browser.
37728
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
37729
+ navigator.vendor ?? // Retained for compatibility with older versions of Opera that use `window.opera`.
37730
+ ("opera" in window && window.opera)).match(t)
37731
+ ));
37732
+ }
37733
+ function O(e) {
37734
+ const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, null);
37735
+ let l = n.nextNode();
37736
+ for (; l; )
37737
+ t.push(l), l = n.nextNode();
37738
+ return t;
37739
+ }
37740
+ function j$1(e, t, n) {
37741
+ const l = O(e), p = O(t);
37742
+ if (l.length !== p.length) {
37743
+ f({
37744
+ messages: ["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.", e, t],
37745
+ suppressErrors: n
37746
+ });
37747
+ return;
37748
+ }
37749
+ for (let m = 0; m < l.length; m++) {
37750
+ const h = l[m], g = p[m], a = h.shadowRoot;
37751
+ if (a !== null) {
37752
+ const c = g.attachShadow({ mode: a.mode });
37753
+ c.innerHTML = a.innerHTML, j$1(a, c, n);
37754
+ }
37755
+ }
37756
+ }
37757
+ const G$1 = `
37758
+ @page {
37759
+ /* Remove browser default header (title) and footer (url) */
37760
+ margin: 0;
37761
+ }
37762
+ @media print {
37763
+ body {
37764
+ /* Tell browsers to print background colors */
37765
+ color-adjust: exact; /* Firefox. This is an older version of "print-color-adjust" */
37766
+ print-color-adjust: exact; /* Firefox/Safari */
37767
+ -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */
37768
+ }
37769
+ }
37770
+ `;
37771
+ function W(e, t, n) {
37772
+ const {
37773
+ contentNode: l,
37774
+ clonedContentNode: p,
37775
+ clonedImgNodes: m,
37776
+ clonedVideoNodes: h,
37777
+ numResourcesToLoad: g,
37778
+ originalCanvasNodes: a
37779
+ } = t, {
37780
+ bodyClass: c,
37781
+ fonts: E,
37782
+ ignoreGlobalStyles: y,
37783
+ pageStyle: C,
37784
+ nonce: T,
37785
+ suppressErrors: A,
37786
+ copyShadowRoots: F
37787
+ } = n, L = [], _ = [];
37788
+ function i(k, x) {
37789
+ if (L.includes(k)) {
37790
+ f({
37791
+ level: "debug",
37792
+ messages: ["Tried to mark a resource that has already been handled", k],
37793
+ suppressErrors: A
37794
+ });
37795
+ return;
37796
+ }
37797
+ x ? (f({
37798
+ messages: [
37799
+ '"react-to-print" was unable to load a resource but will continue attempting to print the page',
37800
+ ...x
37801
+ ],
37802
+ suppressErrors: A
37803
+ }), _.push(k)) : L.push(k), L.length + _.length === g && H(e, n);
37804
+ }
37805
+ e.onload = null;
37806
+ const d = e.contentDocument ?? e.contentWindow?.document;
37807
+ if (d) {
37808
+ const k = d.body.appendChild(p);
37809
+ F && j$1(l, k, !!A), E && (e.contentDocument?.fonts && e.contentWindow?.FontFace ? E.forEach((s) => {
37810
+ const o = new FontFace(
37811
+ s.family,
37812
+ s.source,
37813
+ { weight: s.weight, style: s.style }
37814
+ );
37815
+ e.contentDocument.fonts.add(o), o.loaded.then(() => {
37816
+ i(o);
37817
+ }).catch((b) => {
37818
+ i(o, ["Failed loading the font:", o, "Load error:", P(b)]);
37819
+ });
37820
+ }) : (E.forEach((s) => {
37821
+ i(s);
37822
+ }), f({
37823
+ messages: ['"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page'],
37824
+ suppressErrors: A
37825
+ })));
37826
+ const x = C ?? G$1, D = d.createElement("style");
37827
+ T && (D.setAttribute("nonce", T), d.head.setAttribute("nonce", T)), D.appendChild(d.createTextNode(x)), d.head.appendChild(D), c && d.body.classList.add(...c.split(" "));
37828
+ const U = d.querySelectorAll("canvas");
37829
+ for (let s = 0; s < a.length; ++s) {
37830
+ const o = a[s], b = U[s];
37831
+ if (b === void 0) {
37832
+ f({
37833
+ messages: ["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.", o],
37834
+ suppressErrors: A
37835
+ });
37836
+ continue;
37837
+ }
37838
+ const r = b.getContext("2d");
37839
+ r && r.drawImage(o, 0, 0);
37840
+ }
37841
+ for (let s = 0; s < m.length; s++) {
37842
+ const o = m[s], b = o.getAttribute("src");
37843
+ if (!b)
37844
+ i(o, ['Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.', o]);
37845
+ else {
37846
+ const r = new Image();
37847
+ r.onload = () => {
37848
+ i(o);
37849
+ }, r.onerror = (u, w, S, v, N) => {
37850
+ i(o, ["Error loading <img>", o, "Error", N]);
37851
+ }, r.src = b;
37852
+ }
37853
+ }
37854
+ for (let s = 0; s < h.length; s++) {
37855
+ const o = h[s];
37856
+ o.preload = "auto";
37857
+ const b = o.getAttribute("poster");
37858
+ if (b) {
37859
+ const r = new Image();
37860
+ r.onload = () => {
37861
+ i(o);
37862
+ }, r.onerror = (u, w, S, v, N) => {
37863
+ i(o, ["Error loading video poster", b, "for video", o, "Error:", N]);
37864
+ }, r.src = b;
37865
+ } else
37866
+ o.readyState >= 2 ? i(o) : o.src ? (o.onloadeddata = () => {
37867
+ i(o);
37868
+ }, o.onerror = (r, u, w, S, v) => {
37869
+ i(o, ["Error loading video", o, "Error", v]);
37870
+ }, o.onstalled = () => {
37871
+ i(o, ["Loading video stalled, skipping", o]);
37872
+ }) : i(o, ["Error loading video, `src` is empty", o]);
37873
+ }
37874
+ const R = "select", M = l.querySelectorAll(R), B = d.querySelectorAll(R);
37875
+ for (let s = 0; s < M.length; s++)
37876
+ B[s].value = M[s].value;
37877
+ if (!y) {
37878
+ const s = document.querySelectorAll("style, link[rel~='stylesheet'], link[as='style']");
37879
+ for (let o = 0, b = s.length; o < b; ++o) {
37880
+ const r = s[o];
37881
+ if (r.tagName.toLowerCase() === "style") {
37882
+ const u = d.createElement(r.tagName), w = r.sheet;
37883
+ if (w) {
37884
+ let S = "";
37885
+ try {
37886
+ const v = w.cssRules.length;
37887
+ for (let N = 0; N < v; ++N)
37888
+ typeof w.cssRules[N].cssText == "string" && (S += `${w.cssRules[N].cssText}\r
37889
+ `);
37890
+ } catch (v) {
37891
+ f({
37892
+ messages: [
37893
+ "A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",
37894
+ // eslint-disable-line max-len
37895
+ r,
37896
+ `Original error: ${P(v).message}`
37897
+ ],
37898
+ level: "warning"
37899
+ });
37900
+ }
37901
+ u.setAttribute("id", `react-to-print-${o}`), T && u.setAttribute("nonce", T), u.appendChild(d.createTextNode(S)), d.head.appendChild(u);
37902
+ }
37903
+ } else if (r.getAttribute("href"))
37904
+ if (r.hasAttribute("disabled"))
37905
+ f({
37906
+ messages: ["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:", r],
37907
+ level: "warning"
37908
+ }), i(r);
37909
+ else {
37910
+ const u = d.createElement(r.tagName);
37911
+ for (let w = 0, S = r.attributes.length; w < S; ++w) {
37912
+ const v = r.attributes[w];
37913
+ v && u.setAttribute(v.nodeName, v.nodeValue ?? "");
37914
+ }
37915
+ u.onload = () => {
37916
+ i(u);
37917
+ }, u.onerror = (w, S, v, N, I) => {
37918
+ i(u, ["Failed to load", u, "Error:", I]);
37919
+ }, T && u.setAttribute("nonce", T), d.head.appendChild(u);
37920
+ }
37921
+ else
37922
+ f({
37923
+ messages: ["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:", r],
37924
+ level: "warning"
37925
+ }), i(r);
37926
+ }
37927
+ }
37928
+ }
37929
+ g === 0 && H(e, n);
37930
+ }
37931
+ function J(e, t, n) {
37932
+ e.onload = () => {
37933
+ W(
37934
+ e,
37935
+ t,
37936
+ n
37937
+ );
37938
+ }, document.body.appendChild(e);
37939
+ }
37940
+ function K({ contentRef: e, optionalContent: t, suppressErrors: n }) {
37941
+ if (t && typeof t == "function")
37942
+ return e && f({
37943
+ level: "warning",
37944
+ messages: ['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']
37945
+ }), t();
37946
+ if (e)
37947
+ return e.current;
37948
+ f({
37949
+ messages: ['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],
37950
+ suppressErrors: n
37951
+ });
37952
+ }
37953
+ function Q(e, t) {
37954
+ const {
37955
+ contentRef: n,
37956
+ fonts: l,
37957
+ ignoreGlobalStyles: p,
37958
+ suppressErrors: m
37959
+ } = t, h = K({
37960
+ contentRef: n,
37961
+ optionalContent: e,
37962
+ suppressErrors: m
37963
+ });
37964
+ if (!h)
37965
+ return;
37966
+ const g = h.cloneNode(true), a = document.querySelectorAll("link[rel~='stylesheet'], link[as='style']"), c = g.querySelectorAll("img"), E = g.querySelectorAll("video"), y = l ? l.length : 0, C = (p ? 0 : a.length) + c.length + E.length + y;
37967
+ return {
37968
+ contentNode: h,
37969
+ clonedContentNode: g,
37970
+ clonedImgNodes: c,
37971
+ clonedVideoNodes: E,
37972
+ numResourcesToLoad: C,
37973
+ originalCanvasNodes: h.querySelectorAll("canvas")
37974
+ };
37975
+ }
37976
+ function Z({
37977
+ bodyClass: e,
37978
+ contentRef: t,
37979
+ copyShadowRoots: n,
37980
+ documentTitle: l,
37981
+ fonts: p,
37982
+ ignoreGlobalStyles: m,
37983
+ nonce: h,
37984
+ onAfterPrint: g,
37985
+ onBeforePrint: a,
37986
+ onPrintError: c,
37987
+ pageStyle: E,
37988
+ preserveAfterPrint: y,
37989
+ print: C,
37990
+ printIframeProps: T,
37991
+ suppressErrors: A
37992
+ }) {
37993
+ return React.useCallback((L) => {
37994
+ $(y, true);
37995
+ function _() {
37996
+ const i = {
37997
+ bodyClass: e,
37998
+ contentRef: t,
37999
+ copyShadowRoots: n,
38000
+ documentTitle: l,
38001
+ fonts: p,
38002
+ ignoreGlobalStyles: m,
38003
+ nonce: h,
38004
+ onAfterPrint: g,
38005
+ onPrintError: c,
38006
+ pageStyle: E,
38007
+ preserveAfterPrint: y,
38008
+ print: C,
38009
+ suppressErrors: A
38010
+ }, d = V(T), k = Q(L, i);
38011
+ if (!k) {
38012
+ f({
38013
+ messages: ["There is nothing to print"],
38014
+ suppressErrors: A
38015
+ });
38016
+ return;
38017
+ }
38018
+ J(d, k, i);
38019
+ }
38020
+ a ? a().then(() => {
38021
+ _();
38022
+ }).catch((i) => {
38023
+ c?.("onBeforePrint", P(i));
38024
+ }) : _();
38025
+ }, [
38026
+ e,
38027
+ t,
38028
+ n,
38029
+ l,
38030
+ p,
38031
+ m,
38032
+ h,
38033
+ g,
38034
+ a,
38035
+ c,
38036
+ E,
38037
+ y,
38038
+ T,
38039
+ C,
38040
+ A
38041
+ ]);
38042
+ }
37584
38043
 
37585
38044
  var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
37586
38045
  var __hasOwnProp$l = Object.prototype.hasOwnProperty;
@@ -37615,7 +38074,7 @@ const BasePrinter = (_a) => {
37615
38074
  "onAfterPrint"
37616
38075
  ]);
37617
38076
  const contentRef = React.useRef(null);
37618
- const reactToPrintFn = libExports.useReactToPrint({ contentRef, onAfterPrint });
38077
+ const reactToPrintFn = Z({ contentRef, onAfterPrint });
37619
38078
  return /* @__PURE__ */ jsxRuntime.jsxs(ScopeHost, { className: "", children: [
37620
38079
  /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: `cur-pointer ${className}`, onClick: reactToPrintFn, children }),
37621
38080
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -45688,7 +46147,7 @@ const TicketModalWrapper = (props) => {
45688
46147
  const reportRef = React.useRef(null);
45689
46148
  const actionButtonsRef = React.useRef(null);
45690
46149
  const contentRef = React.useRef(null);
45691
- const reactToPrintFn = libExports.useReactToPrint({ contentRef, onAfterPrint });
46150
+ const reactToPrintFn = Z({ contentRef, onAfterPrint });
45692
46151
  const handleCopyImage = async () => {
45693
46152
  await copyImageToClipboard(contentRef, actionButtonsRef, lotteryLabel[lotteryType], object == null ? void 0 : object.ticketNumber);
45694
46153
  await onAfterPrint();
@@ -53461,7 +53920,7 @@ var StateManagedSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
53461
53920
  });
53462
53921
  var StateManagedSelect$1 = StateManagedSelect;
53463
53922
 
53464
- /*! Axios v1.15.2 Copyright (c) 2026 Matt Zabriskie and contributors */
53923
+ /*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors */
53465
53924
 
53466
53925
  /**
53467
53926
  * Create a bound version of a function with a specified `this` context
@@ -53666,9 +54125,9 @@ const isFile = kindOfTest('File');
53666
54125
  * also have a `name` and `type` attribute to specify filename and content type
53667
54126
  *
53668
54127
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
53669
- *
54128
+ *
53670
54129
  * @param {*} value The value to test
53671
- *
54130
+ *
53672
54131
  * @returns {boolean} True if value is a React Native Blob, otherwise false
53673
54132
  */
53674
54133
  const isReactNativeBlob = (value) => {
@@ -53678,9 +54137,9 @@ const isReactNativeBlob = (value) => {
53678
54137
  /**
53679
54138
  * Determine if environment is React Native
53680
54139
  * ReactNative `FormData` has a non-standard `getParts()` method
53681
- *
54140
+ *
53682
54141
  * @param {*} formData The formData to test
53683
- *
54142
+ *
53684
54143
  * @returns {boolean} True if environment is React Native, otherwise false
53685
54144
  */
53686
54145
  const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
@@ -53699,7 +54158,7 @@ const isBlob = kindOfTest('Blob');
53699
54158
  *
53700
54159
  * @param {*} val The value to test
53701
54160
  *
53702
- * @returns {boolean} True if value is a File, otherwise false
54161
+ * @returns {boolean} True if value is a FileList, otherwise false
53703
54162
  */
53704
54163
  const isFileList = kindOfTest('FileList');
53705
54164
 
@@ -53733,14 +54192,16 @@ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
53733
54192
  const isFormData = (thing) => {
53734
54193
  if (!thing) return false;
53735
54194
  if (FormDataCtor && thing instanceof FormDataCtor) return true;
53736
- // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
54195
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
53737
54196
  const proto = getPrototypeOf(thing);
53738
54197
  if (!proto || proto === Object.prototype) return false;
53739
54198
  if (!isFunction$1(thing.append)) return false;
53740
54199
  const kind = kindOf(thing);
53741
- return kind === 'formdata' ||
54200
+ return (
54201
+ kind === 'formdata' ||
53742
54202
  // detect form-data instance
53743
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]');
54203
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
54204
+ );
53744
54205
  };
53745
54206
 
53746
54207
  /**
@@ -53875,7 +54336,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
53875
54336
  *
53876
54337
  * @returns {Object} Result of all merge properties
53877
54338
  */
53878
- function merge(/* obj1, obj2, obj3, ... */) {
54339
+ function merge(...objs) {
53879
54340
  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
53880
54341
  const result = {};
53881
54342
  const assignValue = (val, key) => {
@@ -53885,8 +54346,12 @@ function merge(/* obj1, obj2, obj3, ... */) {
53885
54346
  }
53886
54347
 
53887
54348
  const targetKey = (caseless && findKey(result, key)) || key;
53888
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
53889
- result[targetKey] = merge(result[targetKey], val);
54349
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
54350
+ // chain, so a polluted Object.prototype value could surface here and get
54351
+ // copied into the merged result.
54352
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
54353
+ if (isPlainObject(existing) && isPlainObject(val)) {
54354
+ result[targetKey] = merge(existing, val);
53890
54355
  } else if (isPlainObject(val)) {
53891
54356
  result[targetKey] = merge({}, val);
53892
54357
  } else if (isArray(val)) {
@@ -53896,8 +54361,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
53896
54361
  }
53897
54362
  };
53898
54363
 
53899
- for (let i = 0, l = arguments.length; i < l; i++) {
53900
- arguments[i] && forEach(arguments[i], assignValue);
54364
+ for (let i = 0, l = objs.length; i < l; i++) {
54365
+ objs[i] && forEach(objs[i], assignValue);
53901
54366
  }
53902
54367
  return result;
53903
54368
  }
@@ -53919,6 +54384,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
53919
54384
  (val, key) => {
53920
54385
  if (thisArg && isFunction$1(val)) {
53921
54386
  Object.defineProperty(a, key, {
54387
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
54388
+ // hijack defineProperty's accessor-vs-data resolution.
54389
+ __proto__: null,
53922
54390
  value: bind(val, thisArg),
53923
54391
  writable: true,
53924
54392
  enumerable: true,
@@ -53926,6 +54394,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
53926
54394
  });
53927
54395
  } else {
53928
54396
  Object.defineProperty(a, key, {
54397
+ __proto__: null,
53929
54398
  value: val,
53930
54399
  writable: true,
53931
54400
  enumerable: true,
@@ -53964,12 +54433,14 @@ const stripBOM = (content) => {
53964
54433
  const inherits = (constructor, superConstructor, props, descriptors) => {
53965
54434
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
53966
54435
  Object.defineProperty(constructor.prototype, 'constructor', {
54436
+ __proto__: null,
53967
54437
  value: constructor,
53968
54438
  writable: true,
53969
54439
  enumerable: false,
53970
54440
  configurable: true,
53971
54441
  });
53972
54442
  Object.defineProperty(constructor, 'super', {
54443
+ __proto__: null,
53973
54444
  value: superConstructor.prototype,
53974
54445
  });
53975
54446
  props && Object.assign(constructor.prototype, props);
@@ -54151,7 +54622,7 @@ const reduceDescriptors = (obj, reducer) => {
54151
54622
  const freezeMethods = (obj) => {
54152
54623
  reduceDescriptors(obj, (descriptor, name) => {
54153
54624
  // skip restricted props in strict mode
54154
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
54625
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
54155
54626
  return false;
54156
54627
  }
54157
54628
 
@@ -54225,11 +54696,11 @@ function isSpecCompliantForm(thing) {
54225
54696
  * @returns {Object} The JSON-compatible object.
54226
54697
  */
54227
54698
  const toJSONObject = (obj) => {
54228
- const stack = new Array(10);
54699
+ const visited = new WeakSet();
54229
54700
 
54230
- const visit = (source, i) => {
54701
+ const visit = (source) => {
54231
54702
  if (isObject(source)) {
54232
- if (stack.indexOf(source) >= 0) {
54703
+ if (visited.has(source)) {
54233
54704
  return;
54234
54705
  }
54235
54706
 
@@ -54239,15 +54710,16 @@ const toJSONObject = (obj) => {
54239
54710
  }
54240
54711
 
54241
54712
  if (!('toJSON' in source)) {
54242
- stack[i] = source;
54713
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
54714
+ visited.add(source);
54243
54715
  const target = isArray(source) ? [] : {};
54244
54716
 
54245
54717
  forEach(source, (value, key) => {
54246
- const reducedValue = visit(value, i + 1);
54718
+ const reducedValue = visit(value);
54247
54719
  !isUndefined(reducedValue) && (target[key] = reducedValue);
54248
54720
  });
54249
54721
 
54250
- stack[i] = undefined;
54722
+ visited.delete(source);
54251
54723
 
54252
54724
  return target;
54253
54725
  }
@@ -54256,7 +54728,7 @@ const toJSONObject = (obj) => {
54256
54728
  return source;
54257
54729
  };
54258
54730
 
54259
- return visit(obj, 0);
54731
+ return visit(obj);
54260
54732
  };
54261
54733
 
54262
54734
  /**
@@ -54392,1311 +54864,1422 @@ var utils$1 = {
54392
54864
  isIterable,
54393
54865
  };
54394
54866
 
54395
- class AxiosError extends Error {
54396
- static from(error, code, config, request, response, customProps) {
54397
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
54398
- axiosError.cause = error;
54399
- axiosError.name = error.name;
54400
-
54401
- // Preserve status from the original error if not already set from response
54402
- if (error.status != null && axiosError.status == null) {
54403
- axiosError.status = error.status;
54404
- }
54405
-
54406
- customProps && Object.assign(axiosError, customProps);
54407
- return axiosError;
54408
- }
54409
-
54410
- /**
54411
- * Create an Error with the specified message, config, error code, request and response.
54412
- *
54413
- * @param {string} message The error message.
54414
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
54415
- * @param {Object} [config] The config.
54416
- * @param {Object} [request] The request.
54417
- * @param {Object} [response] The response.
54418
- *
54419
- * @returns {Error} The created error.
54420
- */
54421
- constructor(message, code, config, request, response) {
54422
- super(message);
54423
-
54424
- // Make message enumerable to maintain backward compatibility
54425
- // The native Error constructor sets message as non-enumerable,
54426
- // but axios < v1.13.3 had it as enumerable
54427
- Object.defineProperty(this, 'message', {
54428
- value: message,
54429
- enumerable: true,
54430
- writable: true,
54431
- configurable: true,
54432
- });
54433
-
54434
- this.name = 'AxiosError';
54435
- this.isAxiosError = true;
54436
- code && (this.code = code);
54437
- config && (this.config = config);
54438
- request && (this.request = request);
54439
- if (response) {
54440
- this.response = response;
54441
- this.status = response.status;
54442
- }
54443
- }
54444
-
54445
- toJSON() {
54446
- return {
54447
- // Standard
54448
- message: this.message,
54449
- name: this.name,
54450
- // Microsoft
54451
- description: this.description,
54452
- number: this.number,
54453
- // Mozilla
54454
- fileName: this.fileName,
54455
- lineNumber: this.lineNumber,
54456
- columnNumber: this.columnNumber,
54457
- stack: this.stack,
54458
- // Axios
54459
- config: utils$1.toJSONObject(this.config),
54460
- code: this.code,
54461
- status: this.status,
54462
- };
54463
- }
54464
- }
54465
-
54466
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
54467
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
54468
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
54469
- AxiosError.ECONNABORTED = 'ECONNABORTED';
54470
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
54471
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
54472
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
54473
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
54474
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
54475
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
54476
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
54477
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
54478
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
54479
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
54480
-
54481
- // eslint-disable-next-line strict
54482
- var httpAdapter = null;
54867
+ // RawAxiosHeaders whose duplicates are ignored by node
54868
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
54869
+ const ignoreDuplicateOf = utils$1.toObjectSet([
54870
+ 'age',
54871
+ 'authorization',
54872
+ 'content-length',
54873
+ 'content-type',
54874
+ 'etag',
54875
+ 'expires',
54876
+ 'from',
54877
+ 'host',
54878
+ 'if-modified-since',
54879
+ 'if-unmodified-since',
54880
+ 'last-modified',
54881
+ 'location',
54882
+ 'max-forwards',
54883
+ 'proxy-authorization',
54884
+ 'referer',
54885
+ 'retry-after',
54886
+ 'user-agent',
54887
+ ]);
54483
54888
 
54484
54889
  /**
54485
- * Determines if the given thing is a array or js object.
54486
- *
54487
- * @param {string} thing - The object or array to be visited.
54890
+ * Parse headers into an object
54488
54891
  *
54489
- * @returns {boolean}
54490
- */
54491
- function isVisitable(thing) {
54492
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
54493
- }
54494
-
54495
- /**
54496
- * It removes the brackets from the end of a string
54892
+ * ```
54893
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
54894
+ * Content-Type: application/json
54895
+ * Connection: keep-alive
54896
+ * Transfer-Encoding: chunked
54897
+ * ```
54497
54898
  *
54498
- * @param {string} key - The key of the parameter.
54899
+ * @param {String} rawHeaders Headers needing to be parsed
54499
54900
  *
54500
- * @returns {string} the key without the brackets.
54901
+ * @returns {Object} Headers parsed into an object
54501
54902
  */
54502
- function removeBrackets(key) {
54503
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
54504
- }
54903
+ var parseHeaders = (rawHeaders) => {
54904
+ const parsed = {};
54905
+ let key;
54906
+ let val;
54907
+ let i;
54505
54908
 
54506
- /**
54507
- * It takes a path, a key, and a boolean, and returns a string
54508
- *
54509
- * @param {string} path - The path to the current key.
54510
- * @param {string} key - The key of the current object being iterated over.
54511
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
54512
- *
54513
- * @returns {string} The path to the current key.
54514
- */
54515
- function renderKey(path, key, dots) {
54516
- if (!path) return key;
54517
- return path
54518
- .concat(key)
54519
- .map(function each(token, i) {
54520
- // eslint-disable-next-line no-param-reassign
54521
- token = removeBrackets(token);
54522
- return !dots && i ? '[' + token + ']' : token;
54523
- })
54524
- .join(dots ? '.' : '');
54525
- }
54909
+ rawHeaders &&
54910
+ rawHeaders.split('\n').forEach(function parser(line) {
54911
+ i = line.indexOf(':');
54912
+ key = line.substring(0, i).trim().toLowerCase();
54913
+ val = line.substring(i + 1).trim();
54526
54914
 
54527
- /**
54528
- * If the array is an array and none of its elements are visitable, then it's a flat array.
54529
- *
54530
- * @param {Array<any>} arr - The array to check
54531
- *
54532
- * @returns {boolean}
54533
- */
54534
- function isFlatArray(arr) {
54535
- return utils$1.isArray(arr) && !arr.some(isVisitable);
54536
- }
54915
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
54916
+ return;
54917
+ }
54537
54918
 
54538
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
54539
- return /^is[A-Z]/.test(prop);
54540
- });
54919
+ if (key === 'set-cookie') {
54920
+ if (parsed[key]) {
54921
+ parsed[key].push(val);
54922
+ } else {
54923
+ parsed[key] = [val];
54924
+ }
54925
+ } else {
54926
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
54927
+ }
54928
+ });
54541
54929
 
54542
- /**
54543
- * Convert a data object to FormData
54544
- *
54545
- * @param {Object} obj
54546
- * @param {?Object} [formData]
54547
- * @param {?Object} [options]
54548
- * @param {Function} [options.visitor]
54549
- * @param {Boolean} [options.metaTokens = true]
54550
- * @param {Boolean} [options.dots = false]
54551
- * @param {?Boolean} [options.indexes = false]
54552
- *
54553
- * @returns {Object}
54554
- **/
54930
+ return parsed;
54931
+ };
54555
54932
 
54556
- /**
54557
- * It converts an object into a FormData object
54558
- *
54559
- * @param {Object<any, any>} obj - The object to convert to form data.
54560
- * @param {string} formData - The FormData object to append to.
54561
- * @param {Object<string, any>} options
54562
- *
54563
- * @returns
54564
- */
54565
- function toFormData(obj, formData, options) {
54566
- if (!utils$1.isObject(obj)) {
54567
- throw new TypeError('target must be an object');
54568
- }
54933
+ function trimSPorHTAB(str) {
54934
+ let start = 0;
54935
+ let end = str.length;
54569
54936
 
54570
- // eslint-disable-next-line no-param-reassign
54571
- formData = formData || new (FormData)();
54937
+ while (start < end) {
54938
+ const code = str.charCodeAt(start);
54572
54939
 
54573
- // eslint-disable-next-line no-param-reassign
54574
- options = utils$1.toFlatObject(
54575
- options,
54576
- {
54577
- metaTokens: true,
54578
- dots: false,
54579
- indexes: false,
54580
- },
54581
- false,
54582
- function defined(option, source) {
54583
- // eslint-disable-next-line no-eq-null,eqeqeq
54584
- return !utils$1.isUndefined(source[option]);
54940
+ if (code !== 0x09 && code !== 0x20) {
54941
+ break;
54585
54942
  }
54586
- );
54587
-
54588
- const metaTokens = options.metaTokens;
54589
- // eslint-disable-next-line no-use-before-define
54590
- const visitor = options.visitor || defaultVisitor;
54591
- const dots = options.dots;
54592
- const indexes = options.indexes;
54593
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
54594
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
54595
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
54596
54943
 
54597
- if (!utils$1.isFunction(visitor)) {
54598
- throw new TypeError('visitor must be a function');
54944
+ start += 1;
54599
54945
  }
54600
54946
 
54601
- function convertValue(value) {
54602
- if (value === null) return '';
54947
+ while (end > start) {
54948
+ const code = str.charCodeAt(end - 1);
54603
54949
 
54604
- if (utils$1.isDate(value)) {
54605
- return value.toISOString();
54950
+ if (code !== 0x09 && code !== 0x20) {
54951
+ break;
54606
54952
  }
54607
54953
 
54608
- if (utils$1.isBoolean(value)) {
54609
- return value.toString();
54610
- }
54954
+ end -= 1;
54955
+ }
54611
54956
 
54612
- if (!useBlob && utils$1.isBlob(value)) {
54613
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
54614
- }
54957
+ return start === 0 && end === str.length ? str : str.slice(start, end);
54958
+ }
54615
54959
 
54616
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
54617
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
54618
- }
54960
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
54961
+ // eslint-disable-next-line no-control-regex
54962
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
54963
+ // eslint-disable-next-line no-control-regex
54964
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
54619
54965
 
54620
- return value;
54966
+ function sanitizeValue(value, invalidChars) {
54967
+ if (utils$1.isArray(value)) {
54968
+ return value.map((item) => sanitizeValue(item, invalidChars));
54621
54969
  }
54622
54970
 
54623
- /**
54624
- * Default visitor.
54625
- *
54626
- * @param {*} value
54627
- * @param {String|Number} key
54628
- * @param {Array<String|Number>} path
54629
- * @this {FormData}
54630
- *
54631
- * @returns {boolean} return true to visit the each prop of the value recursively
54632
- */
54633
- function defaultVisitor(value, key, path) {
54634
- let arr = value;
54635
-
54636
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
54637
- formData.append(renderKey(path, key, dots), convertValue(value));
54638
- return false;
54639
- }
54971
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
54972
+ }
54640
54973
 
54641
- if (value && !path && typeof value === 'object') {
54642
- if (utils$1.endsWith(key, '{}')) {
54643
- // eslint-disable-next-line no-param-reassign
54644
- key = metaTokens ? key : key.slice(0, -2);
54645
- // eslint-disable-next-line no-param-reassign
54646
- value = JSON.stringify(value);
54647
- } else if (
54648
- (utils$1.isArray(value) && isFlatArray(value)) ||
54649
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
54650
- ) {
54651
- // eslint-disable-next-line no-param-reassign
54652
- key = removeBrackets(key);
54974
+ const sanitizeHeaderValue = (value) =>
54975
+ sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
54653
54976
 
54654
- arr.forEach(function each(el, index) {
54655
- !(utils$1.isUndefined(el) || el === null) &&
54656
- formData.append(
54657
- // eslint-disable-next-line no-nested-ternary
54658
- indexes === true
54659
- ? renderKey([key], index, dots)
54660
- : indexes === null
54661
- ? key
54662
- : key + '[]',
54663
- convertValue(el)
54664
- );
54665
- });
54666
- return false;
54667
- }
54668
- }
54977
+ const sanitizeByteStringHeaderValue = (value) =>
54978
+ sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
54669
54979
 
54670
- if (isVisitable(value)) {
54671
- return true;
54672
- }
54980
+ function toByteStringHeaderObject(headers) {
54981
+ const byteStringHeaders = Object.create(null);
54673
54982
 
54674
- formData.append(renderKey(path, key, dots), convertValue(value));
54983
+ utils$1.forEach(headers.toJSON(), (value, header) => {
54984
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
54985
+ });
54675
54986
 
54676
- return false;
54677
- }
54987
+ return byteStringHeaders;
54988
+ }
54678
54989
 
54679
- const stack = [];
54990
+ const $internals = Symbol('internals');
54680
54991
 
54681
- const exposedHelpers = Object.assign(predicates, {
54682
- defaultVisitor,
54683
- convertValue,
54684
- isVisitable,
54685
- });
54992
+ function normalizeHeader(header) {
54993
+ return header && String(header).trim().toLowerCase();
54994
+ }
54686
54995
 
54687
- function build(value, path, depth = 0) {
54688
- if (utils$1.isUndefined(value)) return;
54996
+ function normalizeValue(value) {
54997
+ if (value === false || value == null) {
54998
+ return value;
54999
+ }
54689
55000
 
54690
- if (depth > maxDepth) {
54691
- throw new AxiosError(
54692
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
54693
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
54694
- );
54695
- }
55001
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
55002
+ }
54696
55003
 
54697
- if (stack.indexOf(value) !== -1) {
54698
- throw Error('Circular reference detected in ' + path.join('.'));
54699
- }
55004
+ function parseTokens(str) {
55005
+ const tokens = Object.create(null);
55006
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
55007
+ let match;
54700
55008
 
54701
- stack.push(value);
55009
+ while ((match = tokensRE.exec(str))) {
55010
+ tokens[match[1]] = match[2];
55011
+ }
54702
55012
 
54703
- utils$1.forEach(value, function each(el, key) {
54704
- const result =
54705
- !(utils$1.isUndefined(el) || el === null) &&
54706
- visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
55013
+ return tokens;
55014
+ }
54707
55015
 
54708
- if (result === true) {
54709
- build(el, path ? path.concat(key) : [key], depth + 1);
54710
- }
54711
- });
55016
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
54712
55017
 
54713
- stack.pop();
55018
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
55019
+ if (utils$1.isFunction(filter)) {
55020
+ return filter.call(this, value, header);
54714
55021
  }
54715
55022
 
54716
- if (!utils$1.isObject(obj)) {
54717
- throw new TypeError('data must be an object');
55023
+ if (isHeaderNameFilter) {
55024
+ value = header;
54718
55025
  }
54719
55026
 
54720
- build(obj);
55027
+ if (!utils$1.isString(value)) return;
54721
55028
 
54722
- return formData;
55029
+ if (utils$1.isString(filter)) {
55030
+ return value.indexOf(filter) !== -1;
55031
+ }
55032
+
55033
+ if (utils$1.isRegExp(filter)) {
55034
+ return filter.test(value);
55035
+ }
54723
55036
  }
54724
55037
 
54725
- /**
54726
- * It encodes a string by replacing all characters that are not in the unreserved set with
54727
- * their percent-encoded equivalents
54728
- *
54729
- * @param {string} str - The string to encode.
54730
- *
54731
- * @returns {string} The encoded string.
54732
- */
54733
- function encode$1(str) {
54734
- const charMap = {
54735
- '!': '%21',
54736
- "'": '%27',
54737
- '(': '%28',
54738
- ')': '%29',
54739
- '~': '%7E',
54740
- '%20': '+',
54741
- };
54742
- return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
54743
- return charMap[match];
54744
- });
55038
+ function formatHeader(header) {
55039
+ return header
55040
+ .trim()
55041
+ .toLowerCase()
55042
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
55043
+ return char.toUpperCase() + str;
55044
+ });
54745
55045
  }
54746
55046
 
54747
- /**
54748
- * It takes a params object and converts it to a FormData object
54749
- *
54750
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
54751
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
54752
- *
54753
- * @returns {void}
54754
- */
54755
- function AxiosURLSearchParams(params, options) {
54756
- this._pairs = [];
55047
+ function buildAccessors(obj, header) {
55048
+ const accessorName = utils$1.toCamelCase(' ' + header);
54757
55049
 
54758
- params && toFormData(params, this, options);
55050
+ ['get', 'set', 'has'].forEach((methodName) => {
55051
+ Object.defineProperty(obj, methodName + accessorName, {
55052
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
55053
+ // this data descriptor into an accessor descriptor on the way in.
55054
+ __proto__: null,
55055
+ value: function (arg1, arg2, arg3) {
55056
+ return this[methodName].call(this, header, arg1, arg2, arg3);
55057
+ },
55058
+ configurable: true,
55059
+ });
55060
+ });
54759
55061
  }
54760
55062
 
54761
- const prototype = AxiosURLSearchParams.prototype;
55063
+ class AxiosHeaders {
55064
+ constructor(headers) {
55065
+ headers && this.set(headers);
55066
+ }
54762
55067
 
54763
- prototype.append = function append(name, value) {
54764
- this._pairs.push([name, value]);
54765
- };
55068
+ set(header, valueOrRewrite, rewrite) {
55069
+ const self = this;
54766
55070
 
54767
- prototype.toString = function toString(encoder) {
54768
- const _encode = encoder
54769
- ? function (value) {
54770
- return encoder.call(this, value, encode$1);
55071
+ function setHeader(_value, _header, _rewrite) {
55072
+ const lHeader = normalizeHeader(_header);
55073
+
55074
+ if (!lHeader) {
55075
+ throw new Error('header name must be a non-empty string');
54771
55076
  }
54772
- : encode$1;
54773
55077
 
54774
- return this._pairs
54775
- .map(function each(pair) {
54776
- return _encode(pair[0]) + '=' + _encode(pair[1]);
54777
- }, '')
54778
- .join('&');
54779
- };
55078
+ const key = utils$1.findKey(self, lHeader);
54780
55079
 
54781
- /**
54782
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
54783
- * their plain counterparts (`:`, `$`, `,`, `+`).
54784
- *
54785
- * @param {string} val The value to be encoded.
54786
- *
54787
- * @returns {string} The encoded value.
54788
- */
54789
- function encode(val) {
54790
- return encodeURIComponent(val)
54791
- .replace(/%3A/gi, ':')
54792
- .replace(/%24/g, '$')
54793
- .replace(/%2C/gi, ',')
54794
- .replace(/%20/g, '+');
54795
- }
55080
+ if (
55081
+ !key ||
55082
+ self[key] === undefined ||
55083
+ _rewrite === true ||
55084
+ (_rewrite === undefined && self[key] !== false)
55085
+ ) {
55086
+ self[key || _header] = normalizeValue(_value);
55087
+ }
55088
+ }
54796
55089
 
54797
- /**
54798
- * Build a URL by appending params to the end
54799
- *
54800
- * @param {string} url The base of the url (e.g., http://www.google.com)
54801
- * @param {object} [params] The params to be appended
54802
- * @param {?(object|Function)} options
54803
- *
54804
- * @returns {string} The formatted url
54805
- */
54806
- function buildURL(url, params, options) {
54807
- if (!params) {
54808
- return url;
54809
- }
55090
+ const setHeaders = (headers, _rewrite) =>
55091
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
54810
55092
 
54811
- const _encode = (options && options.encode) || encode;
55093
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
55094
+ setHeaders(header, valueOrRewrite);
55095
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
55096
+ setHeaders(parseHeaders(header), valueOrRewrite);
55097
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
55098
+ let obj = {},
55099
+ dest,
55100
+ key;
55101
+ for (const entry of header) {
55102
+ if (!utils$1.isArray(entry)) {
55103
+ throw TypeError('Object iterator must return a key-value pair');
55104
+ }
54812
55105
 
54813
- const _options = utils$1.isFunction(options)
54814
- ? {
54815
- serialize: options,
55106
+ obj[(key = entry[0])] = (dest = obj[key])
55107
+ ? utils$1.isArray(dest)
55108
+ ? [...dest, entry[1]]
55109
+ : [dest, entry[1]]
55110
+ : entry[1];
54816
55111
  }
54817
- : options;
54818
-
54819
- const serializeFn = _options && _options.serialize;
54820
55112
 
54821
- let serializedParams;
55113
+ setHeaders(obj, valueOrRewrite);
55114
+ } else {
55115
+ header != null && setHeader(valueOrRewrite, header, rewrite);
55116
+ }
54822
55117
 
54823
- if (serializeFn) {
54824
- serializedParams = serializeFn(params, _options);
54825
- } else {
54826
- serializedParams = utils$1.isURLSearchParams(params)
54827
- ? params.toString()
54828
- : new AxiosURLSearchParams(params, _options).toString(_encode);
55118
+ return this;
54829
55119
  }
54830
55120
 
54831
- if (serializedParams) {
54832
- const hashmarkIndex = url.indexOf('#');
55121
+ get(header, parser) {
55122
+ header = normalizeHeader(header);
54833
55123
 
54834
- if (hashmarkIndex !== -1) {
54835
- url = url.slice(0, hashmarkIndex);
54836
- }
54837
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
54838
- }
55124
+ if (header) {
55125
+ const key = utils$1.findKey(this, header);
54839
55126
 
54840
- return url;
54841
- }
55127
+ if (key) {
55128
+ const value = this[key];
54842
55129
 
54843
- class InterceptorManager {
54844
- constructor() {
54845
- this.handlers = [];
54846
- }
55130
+ if (!parser) {
55131
+ return value;
55132
+ }
54847
55133
 
54848
- /**
54849
- * Add a new interceptor to the stack
54850
- *
54851
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
54852
- * @param {Function} rejected The function to handle `reject` for a `Promise`
54853
- * @param {Object} options The options for the interceptor, synchronous and runWhen
54854
- *
54855
- * @return {Number} An ID used to remove interceptor later
54856
- */
54857
- use(fulfilled, rejected, options) {
54858
- this.handlers.push({
54859
- fulfilled,
54860
- rejected,
54861
- synchronous: options ? options.synchronous : false,
54862
- runWhen: options ? options.runWhen : null,
54863
- });
54864
- return this.handlers.length - 1;
54865
- }
55134
+ if (parser === true) {
55135
+ return parseTokens(value);
55136
+ }
54866
55137
 
54867
- /**
54868
- * Remove an interceptor from the stack
54869
- *
54870
- * @param {Number} id The ID that was returned by `use`
54871
- *
54872
- * @returns {void}
54873
- */
54874
- eject(id) {
54875
- if (this.handlers[id]) {
54876
- this.handlers[id] = null;
54877
- }
54878
- }
55138
+ if (utils$1.isFunction(parser)) {
55139
+ return parser.call(this, value, key);
55140
+ }
54879
55141
 
54880
- /**
54881
- * Clear all interceptors from the stack
54882
- *
54883
- * @returns {void}
54884
- */
54885
- clear() {
54886
- if (this.handlers) {
54887
- this.handlers = [];
54888
- }
54889
- }
55142
+ if (utils$1.isRegExp(parser)) {
55143
+ return parser.exec(value);
55144
+ }
54890
55145
 
54891
- /**
54892
- * Iterate over all the registered interceptors
54893
- *
54894
- * This method is particularly useful for skipping over any
54895
- * interceptors that may have become `null` calling `eject`.
54896
- *
54897
- * @param {Function} fn The function to call for each interceptor
54898
- *
54899
- * @returns {void}
54900
- */
54901
- forEach(fn) {
54902
- utils$1.forEach(this.handlers, function forEachHandler(h) {
54903
- if (h !== null) {
54904
- fn(h);
55146
+ throw new TypeError('parser must be boolean|regexp|function');
54905
55147
  }
54906
- });
55148
+ }
54907
55149
  }
54908
- }
54909
55150
 
54910
- var transitionalDefaults = {
54911
- silentJSONParsing: true,
54912
- forcedJSONParsing: true,
54913
- clarifyTimeoutError: false,
54914
- legacyInterceptorReqResOrdering: true,
54915
- };
55151
+ has(header, matcher) {
55152
+ header = normalizeHeader(header);
54916
55153
 
54917
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
55154
+ if (header) {
55155
+ const key = utils$1.findKey(this, header);
54918
55156
 
54919
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
55157
+ return !!(
55158
+ key &&
55159
+ this[key] !== undefined &&
55160
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
55161
+ );
55162
+ }
54920
55163
 
54921
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
55164
+ return false;
55165
+ }
54922
55166
 
54923
- var platform$1 = {
54924
- isBrowser: true,
54925
- classes: {
54926
- URLSearchParams: URLSearchParams$1,
54927
- FormData: FormData$1,
54928
- Blob: Blob$1,
54929
- },
54930
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
54931
- };
55167
+ delete(header, matcher) {
55168
+ const self = this;
55169
+ let deleted = false;
54932
55170
 
54933
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
55171
+ function deleteHeader(_header) {
55172
+ _header = normalizeHeader(_header);
54934
55173
 
54935
- const _navigator = (typeof navigator === 'object' && navigator) || undefined;
55174
+ if (_header) {
55175
+ const key = utils$1.findKey(self, _header);
54936
55176
 
54937
- /**
54938
- * Determine if we're running in a standard browser environment
54939
- *
54940
- * This allows axios to run in a web worker, and react-native.
54941
- * Both environments support XMLHttpRequest, but not fully standard globals.
54942
- *
54943
- * web workers:
54944
- * typeof window -> undefined
54945
- * typeof document -> undefined
54946
- *
54947
- * react-native:
54948
- * navigator.product -> 'ReactNative'
54949
- * nativescript
54950
- * navigator.product -> 'NativeScript' or 'NS'
54951
- *
54952
- * @returns {boolean}
54953
- */
54954
- const hasStandardBrowserEnv =
54955
- hasBrowserEnv &&
54956
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
55177
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
55178
+ delete self[key];
54957
55179
 
54958
- /**
54959
- * Determine if we're running in a standard browser webWorker environment
54960
- *
54961
- * Although the `isStandardBrowserEnv` method indicates that
54962
- * `allows axios to run in a web worker`, the WebWorker will still be
54963
- * filtered out due to its judgment standard
54964
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
54965
- * This leads to a problem when axios post `FormData` in webWorker
54966
- */
54967
- const hasStandardBrowserWebWorkerEnv = (() => {
54968
- return (
54969
- typeof WorkerGlobalScope !== 'undefined' &&
54970
- // eslint-disable-next-line no-undef
54971
- self instanceof WorkerGlobalScope &&
54972
- typeof self.importScripts === 'function'
54973
- );
54974
- })();
55180
+ deleted = true;
55181
+ }
55182
+ }
55183
+ }
54975
55184
 
54976
- const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
55185
+ if (utils$1.isArray(header)) {
55186
+ header.forEach(deleteHeader);
55187
+ } else {
55188
+ deleteHeader(header);
55189
+ }
54977
55190
 
54978
- var utils = /*#__PURE__*/Object.freeze({
54979
- __proto__: null,
54980
- hasBrowserEnv: hasBrowserEnv,
54981
- hasStandardBrowserEnv: hasStandardBrowserEnv,
54982
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
54983
- navigator: _navigator,
54984
- origin: origin
54985
- });
55191
+ return deleted;
55192
+ }
54986
55193
 
54987
- var platform = {
54988
- ...utils,
54989
- ...platform$1,
54990
- };
55194
+ clear(matcher) {
55195
+ const keys = Object.keys(this);
55196
+ let i = keys.length;
55197
+ let deleted = false;
54991
55198
 
54992
- function toURLEncodedForm(data, options) {
54993
- return toFormData(data, new platform.classes.URLSearchParams(), {
54994
- visitor: function (value, key, path, helpers) {
54995
- if (platform.isNode && utils$1.isBuffer(value)) {
54996
- this.append(key, value.toString('base64'));
54997
- return false;
55199
+ while (i--) {
55200
+ const key = keys[i];
55201
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
55202
+ delete this[key];
55203
+ deleted = true;
54998
55204
  }
55205
+ }
54999
55206
 
55000
- return helpers.defaultVisitor.apply(this, arguments);
55001
- },
55002
- ...options,
55003
- });
55004
- }
55005
-
55006
- /**
55007
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
55008
- *
55009
- * @param {string} name - The name of the property to get.
55010
- *
55011
- * @returns An array of strings.
55012
- */
55013
- function parsePropPath(name) {
55014
- // foo[x][y][z]
55015
- // foo.x.y.z
55016
- // foo-x-y-z
55017
- // foo x y z
55018
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
55019
- return match[0] === '[]' ? '' : match[1] || match[0];
55020
- });
55021
- }
55022
-
55023
- /**
55024
- * Convert an array to an object.
55025
- *
55026
- * @param {Array<any>} arr - The array to convert to an object.
55027
- *
55028
- * @returns An object with the same keys and values as the array.
55029
- */
55030
- function arrayToObject(arr) {
55031
- const obj = {};
55032
- const keys = Object.keys(arr);
55033
- let i;
55034
- const len = keys.length;
55035
- let key;
55036
- for (i = 0; i < len; i++) {
55037
- key = keys[i];
55038
- obj[key] = arr[key];
55207
+ return deleted;
55039
55208
  }
55040
- return obj;
55041
- }
55042
-
55043
- /**
55044
- * It takes a FormData object and returns a JavaScript object
55045
- *
55046
- * @param {string} formData The FormData object to convert to JSON.
55047
- *
55048
- * @returns {Object<string, any> | null} The converted object.
55049
- */
55050
- function formDataToJSON(formData) {
55051
- function buildPath(path, value, target, index) {
55052
- let name = path[index++];
55053
55209
 
55054
- if (name === '__proto__') return true;
55210
+ normalize(format) {
55211
+ const self = this;
55212
+ const headers = {};
55055
55213
 
55056
- const isNumericKey = Number.isFinite(+name);
55057
- const isLast = index >= path.length;
55058
- name = !name && utils$1.isArray(target) ? target.length : name;
55214
+ utils$1.forEach(this, (value, header) => {
55215
+ const key = utils$1.findKey(headers, header);
55059
55216
 
55060
- if (isLast) {
55061
- if (utils$1.hasOwnProp(target, name)) {
55062
- target[name] = utils$1.isArray(target[name])
55063
- ? target[name].concat(value)
55064
- : [target[name], value];
55065
- } else {
55066
- target[name] = value;
55217
+ if (key) {
55218
+ self[key] = normalizeValue(value);
55219
+ delete self[header];
55220
+ return;
55067
55221
  }
55068
55222
 
55069
- return !isNumericKey;
55070
- }
55223
+ const normalized = format ? formatHeader(header) : String(header).trim();
55071
55224
 
55072
- if (!target[name] || !utils$1.isObject(target[name])) {
55073
- target[name] = [];
55074
- }
55225
+ if (normalized !== header) {
55226
+ delete self[header];
55227
+ }
55075
55228
 
55076
- const result = buildPath(path, value, target[name], index);
55229
+ self[normalized] = normalizeValue(value);
55077
55230
 
55078
- if (result && utils$1.isArray(target[name])) {
55079
- target[name] = arrayToObject(target[name]);
55080
- }
55231
+ headers[normalized] = true;
55232
+ });
55081
55233
 
55082
- return !isNumericKey;
55234
+ return this;
55083
55235
  }
55084
55236
 
55085
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
55086
- const obj = {};
55237
+ concat(...targets) {
55238
+ return this.constructor.concat(this, ...targets);
55239
+ }
55087
55240
 
55088
- utils$1.forEachEntry(formData, (name, value) => {
55089
- buildPath(parsePropPath(name), value, obj, 0);
55241
+ toJSON(asStrings) {
55242
+ const obj = Object.create(null);
55243
+
55244
+ utils$1.forEach(this, (value, header) => {
55245
+ value != null &&
55246
+ value !== false &&
55247
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
55090
55248
  });
55091
55249
 
55092
55250
  return obj;
55093
55251
  }
55094
55252
 
55095
- return null;
55096
- }
55097
-
55098
- const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
55253
+ [Symbol.iterator]() {
55254
+ return Object.entries(this.toJSON())[Symbol.iterator]();
55255
+ }
55099
55256
 
55100
- /**
55101
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
55102
- * of the input
55103
- *
55104
- * @param {any} rawValue - The value to be stringified.
55105
- * @param {Function} parser - A function that parses a string into a JavaScript object.
55106
- * @param {Function} encoder - A function that takes a value and returns a string.
55107
- *
55108
- * @returns {string} A stringified version of the rawValue.
55109
- */
55110
- function stringifySafely(rawValue, parser, encoder) {
55111
- if (utils$1.isString(rawValue)) {
55112
- try {
55113
- (parser || JSON.parse)(rawValue);
55114
- return utils$1.trim(rawValue);
55115
- } catch (e) {
55116
- if (e.name !== 'SyntaxError') {
55117
- throw e;
55118
- }
55119
- }
55257
+ toString() {
55258
+ return Object.entries(this.toJSON())
55259
+ .map(([header, value]) => header + ': ' + value)
55260
+ .join('\n');
55120
55261
  }
55121
55262
 
55122
- return (encoder || JSON.stringify)(rawValue);
55123
- }
55263
+ getSetCookie() {
55264
+ return this.get('set-cookie') || [];
55265
+ }
55124
55266
 
55125
- const defaults = {
55126
- transitional: transitionalDefaults,
55267
+ get [Symbol.toStringTag]() {
55268
+ return 'AxiosHeaders';
55269
+ }
55127
55270
 
55128
- adapter: ['xhr', 'http', 'fetch'],
55271
+ static from(thing) {
55272
+ return thing instanceof this ? thing : new this(thing);
55273
+ }
55129
55274
 
55130
- transformRequest: [
55131
- function transformRequest(data, headers) {
55132
- const contentType = headers.getContentType() || '';
55133
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
55134
- const isObjectPayload = utils$1.isObject(data);
55275
+ static concat(first, ...targets) {
55276
+ const computed = new this(first);
55135
55277
 
55136
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
55137
- data = new FormData(data);
55138
- }
55278
+ targets.forEach((target) => computed.set(target));
55139
55279
 
55140
- const isFormData = utils$1.isFormData(data);
55280
+ return computed;
55281
+ }
55141
55282
 
55142
- if (isFormData) {
55143
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
55144
- }
55283
+ static accessor(header) {
55284
+ const internals =
55285
+ (this[$internals] =
55286
+ this[$internals] =
55287
+ {
55288
+ accessors: {},
55289
+ });
55145
55290
 
55146
- if (
55147
- utils$1.isArrayBuffer(data) ||
55148
- utils$1.isBuffer(data) ||
55149
- utils$1.isStream(data) ||
55150
- utils$1.isFile(data) ||
55151
- utils$1.isBlob(data) ||
55152
- utils$1.isReadableStream(data)
55153
- ) {
55154
- return data;
55155
- }
55156
- if (utils$1.isArrayBufferView(data)) {
55157
- return data.buffer;
55158
- }
55159
- if (utils$1.isURLSearchParams(data)) {
55160
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
55161
- return data.toString();
55162
- }
55291
+ const accessors = internals.accessors;
55292
+ const prototype = this.prototype;
55163
55293
 
55164
- let isFileList;
55294
+ function defineAccessor(_header) {
55295
+ const lHeader = normalizeHeader(_header);
55165
55296
 
55166
- if (isObjectPayload) {
55167
- const formSerializer = own(this, 'formSerializer');
55168
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
55169
- return toURLEncodedForm(data, formSerializer).toString();
55170
- }
55297
+ if (!accessors[lHeader]) {
55298
+ buildAccessors(prototype, _header);
55299
+ accessors[lHeader] = true;
55300
+ }
55301
+ }
55171
55302
 
55172
- if (
55173
- (isFileList = utils$1.isFileList(data)) ||
55174
- contentType.indexOf('multipart/form-data') > -1
55175
- ) {
55176
- const env = own(this, 'env');
55177
- const _FormData = env && env.FormData;
55303
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
55178
55304
 
55179
- return toFormData(
55180
- isFileList ? { 'files[]': data } : data,
55181
- _FormData && new _FormData(),
55182
- formSerializer
55183
- );
55184
- }
55185
- }
55305
+ return this;
55306
+ }
55307
+ }
55186
55308
 
55187
- if (isObjectPayload || hasJSONContentType) {
55188
- headers.setContentType('application/json', false);
55189
- return stringifySafely(data);
55190
- }
55309
+ AxiosHeaders.accessor([
55310
+ 'Content-Type',
55311
+ 'Content-Length',
55312
+ 'Accept',
55313
+ 'Accept-Encoding',
55314
+ 'User-Agent',
55315
+ 'Authorization',
55316
+ ]);
55191
55317
 
55192
- return data;
55318
+ // reserved names hotfix
55319
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
55320
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
55321
+ return {
55322
+ get: () => value,
55323
+ set(headerValue) {
55324
+ this[mapped] = headerValue;
55193
55325
  },
55194
- ],
55326
+ };
55327
+ });
55195
55328
 
55196
- transformResponse: [
55197
- function transformResponse(data) {
55198
- const transitional = own(this, 'transitional') || defaults.transitional;
55199
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
55200
- const responseType = own(this, 'responseType');
55201
- const JSONRequested = responseType === 'json';
55329
+ utils$1.freezeMethods(AxiosHeaders);
55202
55330
 
55203
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
55204
- return data;
55205
- }
55331
+ const REDACTED = '[REDACTED ****]';
55206
55332
 
55207
- if (
55208
- data &&
55209
- utils$1.isString(data) &&
55210
- ((forcedJSONParsing && !responseType) || JSONRequested)
55211
- ) {
55212
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
55213
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
55333
+ function hasOwnOrPrototypeToJSON(source) {
55334
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
55335
+ return true;
55336
+ }
55214
55337
 
55215
- try {
55216
- return JSON.parse(data, own(this, 'parseReviver'));
55217
- } catch (e) {
55218
- if (strictJSONParsing) {
55219
- if (e.name === 'SyntaxError') {
55220
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
55221
- }
55222
- throw e;
55223
- }
55338
+ let prototype = Object.getPrototypeOf(source);
55339
+
55340
+ while (prototype && prototype !== Object.prototype) {
55341
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
55342
+ return true;
55343
+ }
55344
+
55345
+ prototype = Object.getPrototypeOf(prototype);
55346
+ }
55347
+
55348
+ return false;
55349
+ }
55350
+
55351
+ // Build a plain-object snapshot of `config` and replace the value of any key
55352
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
55353
+ // and AxiosHeaders, and short-circuits on circular references.
55354
+ function redactConfig(config, redactKeys) {
55355
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
55356
+ const seen = [];
55357
+
55358
+ const visit = (source) => {
55359
+ if (source === null || typeof source !== 'object') return source;
55360
+ if (utils$1.isBuffer(source)) return source;
55361
+ if (seen.indexOf(source) !== -1) return undefined;
55362
+
55363
+ if (source instanceof AxiosHeaders) {
55364
+ source = source.toJSON();
55365
+ }
55366
+
55367
+ seen.push(source);
55368
+
55369
+ let result;
55370
+ if (utils$1.isArray(source)) {
55371
+ result = [];
55372
+ source.forEach((v, i) => {
55373
+ const reducedValue = visit(v);
55374
+ if (!utils$1.isUndefined(reducedValue)) {
55375
+ result[i] = reducedValue;
55224
55376
  }
55377
+ });
55378
+ } else {
55379
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
55380
+ seen.pop();
55381
+ return source;
55225
55382
  }
55226
55383
 
55227
- return data;
55228
- },
55229
- ],
55384
+ result = Object.create(null);
55385
+ for (const [key, value] of Object.entries(source)) {
55386
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
55387
+ if (!utils$1.isUndefined(reducedValue)) {
55388
+ result[key] = reducedValue;
55389
+ }
55390
+ }
55391
+ }
55392
+
55393
+ seen.pop();
55394
+ return result;
55395
+ };
55396
+
55397
+ return visit(config);
55398
+ }
55399
+
55400
+ class AxiosError extends Error {
55401
+ static from(error, code, config, request, response, customProps) {
55402
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
55403
+ axiosError.cause = error;
55404
+ axiosError.name = error.name;
55405
+
55406
+ // Preserve status from the original error if not already set from response
55407
+ if (error.status != null && axiosError.status == null) {
55408
+ axiosError.status = error.status;
55409
+ }
55410
+
55411
+ customProps && Object.assign(axiosError, customProps);
55412
+ return axiosError;
55413
+ }
55230
55414
 
55231
55415
  /**
55232
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
55233
- * timeout is not created.
55416
+ * Create an Error with the specified message, config, error code, request and response.
55417
+ *
55418
+ * @param {string} message The error message.
55419
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
55420
+ * @param {Object} [config] The config.
55421
+ * @param {Object} [request] The request.
55422
+ * @param {Object} [response] The response.
55423
+ *
55424
+ * @returns {Error} The created error.
55234
55425
  */
55235
- timeout: 0,
55426
+ constructor(message, code, config, request, response) {
55427
+ super(message);
55236
55428
 
55237
- xsrfCookieName: 'XSRF-TOKEN',
55238
- xsrfHeaderName: 'X-XSRF-TOKEN',
55429
+ // Make message enumerable to maintain backward compatibility
55430
+ // The native Error constructor sets message as non-enumerable,
55431
+ // but axios < v1.13.3 had it as enumerable
55432
+ Object.defineProperty(this, 'message', {
55433
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
55434
+ // this data descriptor into an accessor descriptor on the way in.
55435
+ __proto__: null,
55436
+ value: message,
55437
+ enumerable: true,
55438
+ writable: true,
55439
+ configurable: true,
55440
+ });
55239
55441
 
55240
- maxContentLength: -1,
55241
- maxBodyLength: -1,
55442
+ this.name = 'AxiosError';
55443
+ this.isAxiosError = true;
55444
+ code && (this.code = code);
55445
+ config && (this.config = config);
55446
+ request && (this.request = request);
55447
+ if (response) {
55448
+ this.response = response;
55449
+ this.status = response.status;
55450
+ }
55451
+ }
55242
55452
 
55243
- env: {
55244
- FormData: platform.classes.FormData,
55245
- Blob: platform.classes.Blob,
55246
- },
55453
+ toJSON() {
55454
+ // Opt-in redaction: when the request config carries a `redact` array, the
55455
+ // value of any matching key (case-insensitive, at any depth) is replaced
55456
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
55457
+ // existing serialization behavior unchanged.
55458
+ const config = this.config;
55459
+ const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
55460
+ const serializedConfig =
55461
+ utils$1.isArray(redactKeys) && redactKeys.length > 0
55462
+ ? redactConfig(config, redactKeys)
55463
+ : utils$1.toJSONObject(config);
55247
55464
 
55248
- validateStatus: function validateStatus(status) {
55249
- return status >= 200 && status < 300;
55250
- },
55465
+ return {
55466
+ // Standard
55467
+ message: this.message,
55468
+ name: this.name,
55469
+ // Microsoft
55470
+ description: this.description,
55471
+ number: this.number,
55472
+ // Mozilla
55473
+ fileName: this.fileName,
55474
+ lineNumber: this.lineNumber,
55475
+ columnNumber: this.columnNumber,
55476
+ stack: this.stack,
55477
+ // Axios
55478
+ config: serializedConfig,
55479
+ code: this.code,
55480
+ status: this.status,
55481
+ };
55482
+ }
55483
+ }
55251
55484
 
55252
- headers: {
55253
- common: {
55254
- Accept: 'application/json, text/plain, */*',
55255
- 'Content-Type': undefined,
55256
- },
55257
- },
55258
- };
55485
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
55486
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
55487
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
55488
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
55489
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
55490
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
55491
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
55492
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
55493
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
55494
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
55495
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
55496
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
55497
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
55498
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
55499
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
55259
55500
 
55260
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
55261
- defaults.headers[method] = {};
55262
- });
55501
+ // eslint-disable-next-line strict
55502
+ var httpAdapter = null;
55263
55503
 
55264
- // RawAxiosHeaders whose duplicates are ignored by node
55265
- // c.f. https://nodejs.org/api/http.html#http_message_headers
55266
- const ignoreDuplicateOf = utils$1.toObjectSet([
55267
- 'age',
55268
- 'authorization',
55269
- 'content-length',
55270
- 'content-type',
55271
- 'etag',
55272
- 'expires',
55273
- 'from',
55274
- 'host',
55275
- 'if-modified-since',
55276
- 'if-unmodified-since',
55277
- 'last-modified',
55278
- 'location',
55279
- 'max-forwards',
55280
- 'proxy-authorization',
55281
- 'referer',
55282
- 'retry-after',
55283
- 'user-agent',
55284
- ]);
55504
+ /**
55505
+ * Determines if the given thing is a array or js object.
55506
+ *
55507
+ * @param {string} thing - The object or array to be visited.
55508
+ *
55509
+ * @returns {boolean}
55510
+ */
55511
+ function isVisitable(thing) {
55512
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
55513
+ }
55285
55514
 
55286
55515
  /**
55287
- * Parse headers into an object
55516
+ * It removes the brackets from the end of a string
55288
55517
  *
55289
- * ```
55290
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
55291
- * Content-Type: application/json
55292
- * Connection: keep-alive
55293
- * Transfer-Encoding: chunked
55294
- * ```
55518
+ * @param {string} key - The key of the parameter.
55295
55519
  *
55296
- * @param {String} rawHeaders Headers needing to be parsed
55520
+ * @returns {string} the key without the brackets.
55521
+ */
55522
+ function removeBrackets(key) {
55523
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
55524
+ }
55525
+
55526
+ /**
55527
+ * It takes a path, a key, and a boolean, and returns a string
55297
55528
  *
55298
- * @returns {Object} Headers parsed into an object
55529
+ * @param {string} path - The path to the current key.
55530
+ * @param {string} key - The key of the current object being iterated over.
55531
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
55532
+ *
55533
+ * @returns {string} The path to the current key.
55299
55534
  */
55300
- var parseHeaders = (rawHeaders) => {
55301
- const parsed = {};
55302
- let key;
55303
- let val;
55304
- let i;
55535
+ function renderKey(path, key, dots) {
55536
+ if (!path) return key;
55537
+ return path
55538
+ .concat(key)
55539
+ .map(function each(token, i) {
55540
+ // eslint-disable-next-line no-param-reassign
55541
+ token = removeBrackets(token);
55542
+ return !dots && i ? '[' + token + ']' : token;
55543
+ })
55544
+ .join(dots ? '.' : '');
55545
+ }
55305
55546
 
55306
- rawHeaders &&
55307
- rawHeaders.split('\n').forEach(function parser(line) {
55308
- i = line.indexOf(':');
55309
- key = line.substring(0, i).trim().toLowerCase();
55310
- val = line.substring(i + 1).trim();
55547
+ /**
55548
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
55549
+ *
55550
+ * @param {Array<any>} arr - The array to check
55551
+ *
55552
+ * @returns {boolean}
55553
+ */
55554
+ function isFlatArray(arr) {
55555
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
55556
+ }
55311
55557
 
55312
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
55313
- return;
55314
- }
55558
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
55559
+ return /^is[A-Z]/.test(prop);
55560
+ });
55315
55561
 
55316
- if (key === 'set-cookie') {
55317
- if (parsed[key]) {
55318
- parsed[key].push(val);
55319
- } else {
55320
- parsed[key] = [val];
55321
- }
55322
- } else {
55323
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
55324
- }
55325
- });
55562
+ /**
55563
+ * Convert a data object to FormData
55564
+ *
55565
+ * @param {Object} obj
55566
+ * @param {?Object} [formData]
55567
+ * @param {?Object} [options]
55568
+ * @param {Function} [options.visitor]
55569
+ * @param {Boolean} [options.metaTokens = true]
55570
+ * @param {Boolean} [options.dots = false]
55571
+ * @param {?Boolean} [options.indexes = false]
55572
+ *
55573
+ * @returns {Object}
55574
+ **/
55326
55575
 
55327
- return parsed;
55328
- };
55576
+ /**
55577
+ * It converts an object into a FormData object
55578
+ *
55579
+ * @param {Object<any, any>} obj - The object to convert to form data.
55580
+ * @param {string} formData - The FormData object to append to.
55581
+ * @param {Object<string, any>} options
55582
+ *
55583
+ * @returns
55584
+ */
55585
+ function toFormData(obj, formData, options) {
55586
+ if (!utils$1.isObject(obj)) {
55587
+ throw new TypeError('target must be an object');
55588
+ }
55329
55589
 
55330
- const $internals = Symbol('internals');
55590
+ // eslint-disable-next-line no-param-reassign
55591
+ formData = formData || new (FormData)();
55331
55592
 
55332
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
55593
+ // eslint-disable-next-line no-param-reassign
55594
+ options = utils$1.toFlatObject(
55595
+ options,
55596
+ {
55597
+ metaTokens: true,
55598
+ dots: false,
55599
+ indexes: false,
55600
+ },
55601
+ false,
55602
+ function defined(option, source) {
55603
+ // eslint-disable-next-line no-eq-null,eqeqeq
55604
+ return !utils$1.isUndefined(source[option]);
55605
+ }
55606
+ );
55333
55607
 
55334
- function trimSPorHTAB(str) {
55335
- let start = 0;
55336
- let end = str.length;
55608
+ const metaTokens = options.metaTokens;
55609
+ // eslint-disable-next-line no-use-before-define
55610
+ const visitor = options.visitor || defaultVisitor;
55611
+ const dots = options.dots;
55612
+ const indexes = options.indexes;
55613
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
55614
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
55615
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
55337
55616
 
55338
- while (start < end) {
55339
- const code = str.charCodeAt(start);
55617
+ if (!utils$1.isFunction(visitor)) {
55618
+ throw new TypeError('visitor must be a function');
55619
+ }
55340
55620
 
55341
- if (code !== 0x09 && code !== 0x20) {
55342
- break;
55621
+ function convertValue(value) {
55622
+ if (value === null) return '';
55623
+
55624
+ if (utils$1.isDate(value)) {
55625
+ return value.toISOString();
55343
55626
  }
55344
55627
 
55345
- start += 1;
55346
- }
55628
+ if (utils$1.isBoolean(value)) {
55629
+ return value.toString();
55630
+ }
55347
55631
 
55348
- while (end > start) {
55349
- const code = str.charCodeAt(end - 1);
55632
+ if (!useBlob && utils$1.isBlob(value)) {
55633
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
55634
+ }
55350
55635
 
55351
- if (code !== 0x09 && code !== 0x20) {
55352
- break;
55636
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
55637
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
55353
55638
  }
55354
55639
 
55355
- end -= 1;
55640
+ return value;
55356
55641
  }
55357
55642
 
55358
- return start === 0 && end === str.length ? str : str.slice(start, end);
55359
- }
55643
+ /**
55644
+ * Default visitor.
55645
+ *
55646
+ * @param {*} value
55647
+ * @param {String|Number} key
55648
+ * @param {Array<String|Number>} path
55649
+ * @this {FormData}
55650
+ *
55651
+ * @returns {boolean} return true to visit the each prop of the value recursively
55652
+ */
55653
+ function defaultVisitor(value, key, path) {
55654
+ let arr = value;
55360
55655
 
55361
- function normalizeHeader(header) {
55362
- return header && String(header).trim().toLowerCase();
55363
- }
55656
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
55657
+ formData.append(renderKey(path, key, dots), convertValue(value));
55658
+ return false;
55659
+ }
55364
55660
 
55365
- function sanitizeHeaderValue(str) {
55366
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
55367
- }
55661
+ if (value && !path && typeof value === 'object') {
55662
+ if (utils$1.endsWith(key, '{}')) {
55663
+ // eslint-disable-next-line no-param-reassign
55664
+ key = metaTokens ? key : key.slice(0, -2);
55665
+ // eslint-disable-next-line no-param-reassign
55666
+ value = JSON.stringify(value);
55667
+ } else if (
55668
+ (utils$1.isArray(value) && isFlatArray(value)) ||
55669
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
55670
+ ) {
55671
+ // eslint-disable-next-line no-param-reassign
55672
+ key = removeBrackets(key);
55368
55673
 
55369
- function normalizeValue(value) {
55370
- if (value === false || value == null) {
55371
- return value;
55372
- }
55674
+ arr.forEach(function each(el, index) {
55675
+ !(utils$1.isUndefined(el) || el === null) &&
55676
+ formData.append(
55677
+ // eslint-disable-next-line no-nested-ternary
55678
+ indexes === true
55679
+ ? renderKey([key], index, dots)
55680
+ : indexes === null
55681
+ ? key
55682
+ : key + '[]',
55683
+ convertValue(el)
55684
+ );
55685
+ });
55686
+ return false;
55687
+ }
55688
+ }
55373
55689
 
55374
- return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
55375
- }
55690
+ if (isVisitable(value)) {
55691
+ return true;
55692
+ }
55376
55693
 
55377
- function parseTokens(str) {
55378
- const tokens = Object.create(null);
55379
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
55380
- let match;
55694
+ formData.append(renderKey(path, key, dots), convertValue(value));
55381
55695
 
55382
- while ((match = tokensRE.exec(str))) {
55383
- tokens[match[1]] = match[2];
55696
+ return false;
55384
55697
  }
55385
55698
 
55386
- return tokens;
55387
- }
55699
+ const stack = [];
55388
55700
 
55389
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
55701
+ const exposedHelpers = Object.assign(predicates, {
55702
+ defaultVisitor,
55703
+ convertValue,
55704
+ isVisitable,
55705
+ });
55390
55706
 
55391
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
55392
- if (utils$1.isFunction(filter)) {
55393
- return filter.call(this, value, header);
55394
- }
55707
+ function build(value, path, depth = 0) {
55708
+ if (utils$1.isUndefined(value)) return;
55395
55709
 
55396
- if (isHeaderNameFilter) {
55397
- value = header;
55398
- }
55710
+ if (depth > maxDepth) {
55711
+ throw new AxiosError(
55712
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
55713
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
55714
+ );
55715
+ }
55399
55716
 
55400
- if (!utils$1.isString(value)) return;
55717
+ if (stack.indexOf(value) !== -1) {
55718
+ throw Error('Circular reference detected in ' + path.join('.'));
55719
+ }
55401
55720
 
55402
- if (utils$1.isString(filter)) {
55403
- return value.indexOf(filter) !== -1;
55721
+ stack.push(value);
55722
+
55723
+ utils$1.forEach(value, function each(el, key) {
55724
+ const result =
55725
+ !(utils$1.isUndefined(el) || el === null) &&
55726
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
55727
+
55728
+ if (result === true) {
55729
+ build(el, path ? path.concat(key) : [key], depth + 1);
55730
+ }
55731
+ });
55732
+
55733
+ stack.pop();
55404
55734
  }
55405
55735
 
55406
- if (utils$1.isRegExp(filter)) {
55407
- return filter.test(value);
55736
+ if (!utils$1.isObject(obj)) {
55737
+ throw new TypeError('data must be an object');
55408
55738
  }
55409
- }
55410
55739
 
55411
- function formatHeader(header) {
55412
- return header
55413
- .trim()
55414
- .toLowerCase()
55415
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
55416
- return char.toUpperCase() + str;
55417
- });
55418
- }
55740
+ build(obj);
55419
55741
 
55420
- function buildAccessors(obj, header) {
55421
- const accessorName = utils$1.toCamelCase(' ' + header);
55742
+ return formData;
55743
+ }
55422
55744
 
55423
- ['get', 'set', 'has'].forEach((methodName) => {
55424
- Object.defineProperty(obj, methodName + accessorName, {
55425
- value: function (arg1, arg2, arg3) {
55426
- return this[methodName].call(this, header, arg1, arg2, arg3);
55427
- },
55428
- configurable: true,
55429
- });
55745
+ /**
55746
+ * It encodes a string by replacing all characters that are not in the unreserved set with
55747
+ * their percent-encoded equivalents
55748
+ *
55749
+ * @param {string} str - The string to encode.
55750
+ *
55751
+ * @returns {string} The encoded string.
55752
+ */
55753
+ function encode$1(str) {
55754
+ const charMap = {
55755
+ '!': '%21',
55756
+ "'": '%27',
55757
+ '(': '%28',
55758
+ ')': '%29',
55759
+ '~': '%7E',
55760
+ '%20': '+',
55761
+ };
55762
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
55763
+ return charMap[match];
55430
55764
  });
55431
55765
  }
55432
55766
 
55433
- class AxiosHeaders {
55434
- constructor(headers) {
55435
- headers && this.set(headers);
55436
- }
55767
+ /**
55768
+ * It takes a params object and converts it to a FormData object
55769
+ *
55770
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
55771
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
55772
+ *
55773
+ * @returns {void}
55774
+ */
55775
+ function AxiosURLSearchParams(params, options) {
55776
+ this._pairs = [];
55437
55777
 
55438
- set(header, valueOrRewrite, rewrite) {
55439
- const self = this;
55778
+ params && toFormData(params, this, options);
55779
+ }
55440
55780
 
55441
- function setHeader(_value, _header, _rewrite) {
55442
- const lHeader = normalizeHeader(_header);
55781
+ const prototype = AxiosURLSearchParams.prototype;
55443
55782
 
55444
- if (!lHeader) {
55445
- throw new Error('header name must be a non-empty string');
55783
+ prototype.append = function append(name, value) {
55784
+ this._pairs.push([name, value]);
55785
+ };
55786
+
55787
+ prototype.toString = function toString(encoder) {
55788
+ const _encode = encoder
55789
+ ? function (value) {
55790
+ return encoder.call(this, value, encode$1);
55446
55791
  }
55792
+ : encode$1;
55447
55793
 
55448
- const key = utils$1.findKey(self, lHeader);
55794
+ return this._pairs
55795
+ .map(function each(pair) {
55796
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
55797
+ }, '')
55798
+ .join('&');
55799
+ };
55449
55800
 
55450
- if (
55451
- !key ||
55452
- self[key] === undefined ||
55453
- _rewrite === true ||
55454
- (_rewrite === undefined && self[key] !== false)
55455
- ) {
55456
- self[key || _header] = normalizeValue(_value);
55801
+ /**
55802
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
55803
+ * their plain counterparts (`:`, `$`, `,`, `+`).
55804
+ *
55805
+ * @param {string} val The value to be encoded.
55806
+ *
55807
+ * @returns {string} The encoded value.
55808
+ */
55809
+ function encode(val) {
55810
+ return encodeURIComponent(val)
55811
+ .replace(/%3A/gi, ':')
55812
+ .replace(/%24/g, '$')
55813
+ .replace(/%2C/gi, ',')
55814
+ .replace(/%20/g, '+');
55815
+ }
55816
+
55817
+ /**
55818
+ * Build a URL by appending params to the end
55819
+ *
55820
+ * @param {string} url The base of the url (e.g., http://www.google.com)
55821
+ * @param {object} [params] The params to be appended
55822
+ * @param {?(object|Function)} options
55823
+ *
55824
+ * @returns {string} The formatted url
55825
+ */
55826
+ function buildURL(url, params, options) {
55827
+ if (!params) {
55828
+ return url;
55829
+ }
55830
+
55831
+ const _encode = (options && options.encode) || encode;
55832
+
55833
+ const _options = utils$1.isFunction(options)
55834
+ ? {
55835
+ serialize: options,
55457
55836
  }
55837
+ : options;
55838
+
55839
+ const serializeFn = _options && _options.serialize;
55840
+
55841
+ let serializedParams;
55842
+
55843
+ if (serializeFn) {
55844
+ serializedParams = serializeFn(params, _options);
55845
+ } else {
55846
+ serializedParams = utils$1.isURLSearchParams(params)
55847
+ ? params.toString()
55848
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
55849
+ }
55850
+
55851
+ if (serializedParams) {
55852
+ const hashmarkIndex = url.indexOf('#');
55853
+
55854
+ if (hashmarkIndex !== -1) {
55855
+ url = url.slice(0, hashmarkIndex);
55458
55856
  }
55857
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
55858
+ }
55459
55859
 
55460
- const setHeaders = (headers, _rewrite) =>
55461
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
55860
+ return url;
55861
+ }
55462
55862
 
55463
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
55464
- setHeaders(header, valueOrRewrite);
55465
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
55466
- setHeaders(parseHeaders(header), valueOrRewrite);
55467
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
55468
- let obj = {},
55469
- dest,
55470
- key;
55471
- for (const entry of header) {
55472
- if (!utils$1.isArray(entry)) {
55473
- throw TypeError('Object iterator must return a key-value pair');
55474
- }
55863
+ class InterceptorManager {
55864
+ constructor() {
55865
+ this.handlers = [];
55866
+ }
55475
55867
 
55476
- obj[(key = entry[0])] = (dest = obj[key])
55477
- ? utils$1.isArray(dest)
55478
- ? [...dest, entry[1]]
55479
- : [dest, entry[1]]
55480
- : entry[1];
55481
- }
55868
+ /**
55869
+ * Add a new interceptor to the stack
55870
+ *
55871
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
55872
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
55873
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
55874
+ *
55875
+ * @return {Number} An ID used to remove interceptor later
55876
+ */
55877
+ use(fulfilled, rejected, options) {
55878
+ this.handlers.push({
55879
+ fulfilled,
55880
+ rejected,
55881
+ synchronous: options ? options.synchronous : false,
55882
+ runWhen: options ? options.runWhen : null,
55883
+ });
55884
+ return this.handlers.length - 1;
55885
+ }
55482
55886
 
55483
- setHeaders(obj, valueOrRewrite);
55484
- } else {
55485
- header != null && setHeader(valueOrRewrite, header, rewrite);
55887
+ /**
55888
+ * Remove an interceptor from the stack
55889
+ *
55890
+ * @param {Number} id The ID that was returned by `use`
55891
+ *
55892
+ * @returns {void}
55893
+ */
55894
+ eject(id) {
55895
+ if (this.handlers[id]) {
55896
+ this.handlers[id] = null;
55486
55897
  }
55898
+ }
55487
55899
 
55488
- return this;
55900
+ /**
55901
+ * Clear all interceptors from the stack
55902
+ *
55903
+ * @returns {void}
55904
+ */
55905
+ clear() {
55906
+ if (this.handlers) {
55907
+ this.handlers = [];
55908
+ }
55489
55909
  }
55490
55910
 
55491
- get(header, parser) {
55492
- header = normalizeHeader(header);
55911
+ /**
55912
+ * Iterate over all the registered interceptors
55913
+ *
55914
+ * This method is particularly useful for skipping over any
55915
+ * interceptors that may have become `null` calling `eject`.
55916
+ *
55917
+ * @param {Function} fn The function to call for each interceptor
55918
+ *
55919
+ * @returns {void}
55920
+ */
55921
+ forEach(fn) {
55922
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
55923
+ if (h !== null) {
55924
+ fn(h);
55925
+ }
55926
+ });
55927
+ }
55928
+ }
55493
55929
 
55494
- if (header) {
55495
- const key = utils$1.findKey(this, header);
55930
+ var transitionalDefaults = {
55931
+ silentJSONParsing: true,
55932
+ forcedJSONParsing: true,
55933
+ clarifyTimeoutError: false,
55934
+ legacyInterceptorReqResOrdering: true,
55935
+ };
55496
55936
 
55497
- if (key) {
55498
- const value = this[key];
55937
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
55499
55938
 
55500
- if (!parser) {
55501
- return value;
55502
- }
55939
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
55940
+
55941
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
55942
+
55943
+ var platform$1 = {
55944
+ isBrowser: true,
55945
+ classes: {
55946
+ URLSearchParams: URLSearchParams$1,
55947
+ FormData: FormData$1,
55948
+ Blob: Blob$1,
55949
+ },
55950
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
55951
+ };
55952
+
55953
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
55954
+
55955
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
55956
+
55957
+ /**
55958
+ * Determine if we're running in a standard browser environment
55959
+ *
55960
+ * This allows axios to run in a web worker, and react-native.
55961
+ * Both environments support XMLHttpRequest, but not fully standard globals.
55962
+ *
55963
+ * web workers:
55964
+ * typeof window -> undefined
55965
+ * typeof document -> undefined
55966
+ *
55967
+ * react-native:
55968
+ * navigator.product -> 'ReactNative'
55969
+ * nativescript
55970
+ * navigator.product -> 'NativeScript' or 'NS'
55971
+ *
55972
+ * @returns {boolean}
55973
+ */
55974
+ const hasStandardBrowserEnv =
55975
+ hasBrowserEnv &&
55976
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
55977
+
55978
+ /**
55979
+ * Determine if we're running in a standard browser webWorker environment
55980
+ *
55981
+ * Although the `isStandardBrowserEnv` method indicates that
55982
+ * `allows axios to run in a web worker`, the WebWorker will still be
55983
+ * filtered out due to its judgment standard
55984
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
55985
+ * This leads to a problem when axios post `FormData` in webWorker
55986
+ */
55987
+ const hasStandardBrowserWebWorkerEnv = (() => {
55988
+ return (
55989
+ typeof WorkerGlobalScope !== 'undefined' &&
55990
+ // eslint-disable-next-line no-undef
55991
+ self instanceof WorkerGlobalScope &&
55992
+ typeof self.importScripts === 'function'
55993
+ );
55994
+ })();
55503
55995
 
55504
- if (parser === true) {
55505
- return parseTokens(value);
55506
- }
55996
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
55507
55997
 
55508
- if (utils$1.isFunction(parser)) {
55509
- return parser.call(this, value, key);
55510
- }
55998
+ var utils = /*#__PURE__*/Object.freeze({
55999
+ __proto__: null,
56000
+ hasBrowserEnv: hasBrowserEnv,
56001
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
56002
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
56003
+ navigator: _navigator,
56004
+ origin: origin
56005
+ });
55511
56006
 
55512
- if (utils$1.isRegExp(parser)) {
55513
- return parser.exec(value);
55514
- }
56007
+ var platform = {
56008
+ ...utils,
56009
+ ...platform$1,
56010
+ };
55515
56011
 
55516
- throw new TypeError('parser must be boolean|regexp|function');
56012
+ function toURLEncodedForm(data, options) {
56013
+ return toFormData(data, new platform.classes.URLSearchParams(), {
56014
+ visitor: function (value, key, path, helpers) {
56015
+ if (platform.isNode && utils$1.isBuffer(value)) {
56016
+ this.append(key, value.toString('base64'));
56017
+ return false;
55517
56018
  }
55518
- }
55519
- }
55520
-
55521
- has(header, matcher) {
55522
- header = normalizeHeader(header);
55523
56019
 
55524
- if (header) {
55525
- const key = utils$1.findKey(this, header);
56020
+ return helpers.defaultVisitor.apply(this, arguments);
56021
+ },
56022
+ ...options,
56023
+ });
56024
+ }
55526
56025
 
55527
- return !!(
55528
- key &&
55529
- this[key] !== undefined &&
55530
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
55531
- );
55532
- }
56026
+ /**
56027
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
56028
+ *
56029
+ * @param {string} name - The name of the property to get.
56030
+ *
56031
+ * @returns An array of strings.
56032
+ */
56033
+ function parsePropPath(name) {
56034
+ // foo[x][y][z]
56035
+ // foo.x.y.z
56036
+ // foo-x-y-z
56037
+ // foo x y z
56038
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
56039
+ return match[0] === '[]' ? '' : match[1] || match[0];
56040
+ });
56041
+ }
55533
56042
 
55534
- return false;
56043
+ /**
56044
+ * Convert an array to an object.
56045
+ *
56046
+ * @param {Array<any>} arr - The array to convert to an object.
56047
+ *
56048
+ * @returns An object with the same keys and values as the array.
56049
+ */
56050
+ function arrayToObject(arr) {
56051
+ const obj = {};
56052
+ const keys = Object.keys(arr);
56053
+ let i;
56054
+ const len = keys.length;
56055
+ let key;
56056
+ for (i = 0; i < len; i++) {
56057
+ key = keys[i];
56058
+ obj[key] = arr[key];
55535
56059
  }
56060
+ return obj;
56061
+ }
55536
56062
 
55537
- delete(header, matcher) {
55538
- const self = this;
55539
- let deleted = false;
55540
-
55541
- function deleteHeader(_header) {
55542
- _header = normalizeHeader(_header);
56063
+ /**
56064
+ * It takes a FormData object and returns a JavaScript object
56065
+ *
56066
+ * @param {string} formData The FormData object to convert to JSON.
56067
+ *
56068
+ * @returns {Object<string, any> | null} The converted object.
56069
+ */
56070
+ function formDataToJSON(formData) {
56071
+ function buildPath(path, value, target, index) {
56072
+ let name = path[index++];
55543
56073
 
55544
- if (_header) {
55545
- const key = utils$1.findKey(self, _header);
56074
+ if (name === '__proto__') return true;
55546
56075
 
55547
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
55548
- delete self[key];
56076
+ const isNumericKey = Number.isFinite(+name);
56077
+ const isLast = index >= path.length;
56078
+ name = !name && utils$1.isArray(target) ? target.length : name;
55549
56079
 
55550
- deleted = true;
55551
- }
56080
+ if (isLast) {
56081
+ if (utils$1.hasOwnProp(target, name)) {
56082
+ target[name] = utils$1.isArray(target[name])
56083
+ ? target[name].concat(value)
56084
+ : [target[name], value];
56085
+ } else {
56086
+ target[name] = value;
55552
56087
  }
56088
+
56089
+ return !isNumericKey;
55553
56090
  }
55554
56091
 
55555
- if (utils$1.isArray(header)) {
55556
- header.forEach(deleteHeader);
55557
- } else {
55558
- deleteHeader(header);
56092
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
56093
+ target[name] = [];
55559
56094
  }
55560
56095
 
55561
- return deleted;
56096
+ const result = buildPath(path, value, target[name], index);
56097
+
56098
+ if (result && utils$1.isArray(target[name])) {
56099
+ target[name] = arrayToObject(target[name]);
56100
+ }
56101
+
56102
+ return !isNumericKey;
55562
56103
  }
55563
56104
 
55564
- clear(matcher) {
55565
- const keys = Object.keys(this);
55566
- let i = keys.length;
55567
- let deleted = false;
56105
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
56106
+ const obj = {};
55568
56107
 
55569
- while (i--) {
55570
- const key = keys[i];
55571
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
55572
- delete this[key];
55573
- deleted = true;
55574
- }
55575
- }
56108
+ utils$1.forEachEntry(formData, (name, value) => {
56109
+ buildPath(parsePropPath(name), value, obj, 0);
56110
+ });
55576
56111
 
55577
- return deleted;
56112
+ return obj;
55578
56113
  }
55579
56114
 
55580
- normalize(format) {
55581
- const self = this;
55582
- const headers = {};
56115
+ return null;
56116
+ }
55583
56117
 
55584
- utils$1.forEach(this, (value, header) => {
55585
- const key = utils$1.findKey(headers, header);
56118
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
55586
56119
 
55587
- if (key) {
55588
- self[key] = normalizeValue(value);
55589
- delete self[header];
55590
- return;
56120
+ /**
56121
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
56122
+ * of the input
56123
+ *
56124
+ * @param {any} rawValue - The value to be stringified.
56125
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
56126
+ * @param {Function} encoder - A function that takes a value and returns a string.
56127
+ *
56128
+ * @returns {string} A stringified version of the rawValue.
56129
+ */
56130
+ function stringifySafely(rawValue, parser, encoder) {
56131
+ if (utils$1.isString(rawValue)) {
56132
+ try {
56133
+ (parser || JSON.parse)(rawValue);
56134
+ return utils$1.trim(rawValue);
56135
+ } catch (e) {
56136
+ if (e.name !== 'SyntaxError') {
56137
+ throw e;
55591
56138
  }
56139
+ }
56140
+ }
55592
56141
 
55593
- const normalized = format ? formatHeader(header) : String(header).trim();
56142
+ return (encoder || JSON.stringify)(rawValue);
56143
+ }
55594
56144
 
55595
- if (normalized !== header) {
55596
- delete self[header];
55597
- }
56145
+ const defaults = {
56146
+ transitional: transitionalDefaults,
55598
56147
 
55599
- self[normalized] = normalizeValue(value);
56148
+ adapter: ['xhr', 'http', 'fetch'],
55600
56149
 
55601
- headers[normalized] = true;
55602
- });
56150
+ transformRequest: [
56151
+ function transformRequest(data, headers) {
56152
+ const contentType = headers.getContentType() || '';
56153
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
56154
+ const isObjectPayload = utils$1.isObject(data);
55603
56155
 
55604
- return this;
55605
- }
56156
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
56157
+ data = new FormData(data);
56158
+ }
55606
56159
 
55607
- concat(...targets) {
55608
- return this.constructor.concat(this, ...targets);
55609
- }
56160
+ const isFormData = utils$1.isFormData(data);
55610
56161
 
55611
- toJSON(asStrings) {
55612
- const obj = Object.create(null);
56162
+ if (isFormData) {
56163
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
56164
+ }
55613
56165
 
55614
- utils$1.forEach(this, (value, header) => {
55615
- value != null &&
55616
- value !== false &&
55617
- (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
55618
- });
56166
+ if (
56167
+ utils$1.isArrayBuffer(data) ||
56168
+ utils$1.isBuffer(data) ||
56169
+ utils$1.isStream(data) ||
56170
+ utils$1.isFile(data) ||
56171
+ utils$1.isBlob(data) ||
56172
+ utils$1.isReadableStream(data)
56173
+ ) {
56174
+ return data;
56175
+ }
56176
+ if (utils$1.isArrayBufferView(data)) {
56177
+ return data.buffer;
56178
+ }
56179
+ if (utils$1.isURLSearchParams(data)) {
56180
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
56181
+ return data.toString();
56182
+ }
55619
56183
 
55620
- return obj;
55621
- }
56184
+ let isFileList;
55622
56185
 
55623
- [Symbol.iterator]() {
55624
- return Object.entries(this.toJSON())[Symbol.iterator]();
55625
- }
56186
+ if (isObjectPayload) {
56187
+ const formSerializer = own(this, 'formSerializer');
56188
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
56189
+ return toURLEncodedForm(data, formSerializer).toString();
56190
+ }
55626
56191
 
55627
- toString() {
55628
- return Object.entries(this.toJSON())
55629
- .map(([header, value]) => header + ': ' + value)
55630
- .join('\n');
55631
- }
56192
+ if (
56193
+ (isFileList = utils$1.isFileList(data)) ||
56194
+ contentType.indexOf('multipart/form-data') > -1
56195
+ ) {
56196
+ const env = own(this, 'env');
56197
+ const _FormData = env && env.FormData;
55632
56198
 
55633
- getSetCookie() {
55634
- return this.get('set-cookie') || [];
55635
- }
56199
+ return toFormData(
56200
+ isFileList ? { 'files[]': data } : data,
56201
+ _FormData && new _FormData(),
56202
+ formSerializer
56203
+ );
56204
+ }
56205
+ }
55636
56206
 
55637
- get [Symbol.toStringTag]() {
55638
- return 'AxiosHeaders';
55639
- }
56207
+ if (isObjectPayload || hasJSONContentType) {
56208
+ headers.setContentType('application/json', false);
56209
+ return stringifySafely(data);
56210
+ }
55640
56211
 
55641
- static from(thing) {
55642
- return thing instanceof this ? thing : new this(thing);
55643
- }
56212
+ return data;
56213
+ },
56214
+ ],
55644
56215
 
55645
- static concat(first, ...targets) {
55646
- const computed = new this(first);
56216
+ transformResponse: [
56217
+ function transformResponse(data) {
56218
+ const transitional = own(this, 'transitional') || defaults.transitional;
56219
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
56220
+ const responseType = own(this, 'responseType');
56221
+ const JSONRequested = responseType === 'json';
55647
56222
 
55648
- targets.forEach((target) => computed.set(target));
56223
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
56224
+ return data;
56225
+ }
55649
56226
 
55650
- return computed;
55651
- }
56227
+ if (
56228
+ data &&
56229
+ utils$1.isString(data) &&
56230
+ ((forcedJSONParsing && !responseType) || JSONRequested)
56231
+ ) {
56232
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
56233
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
55652
56234
 
55653
- static accessor(header) {
55654
- const internals =
55655
- (this[$internals] =
55656
- this[$internals] =
55657
- {
55658
- accessors: {},
55659
- });
56235
+ try {
56236
+ return JSON.parse(data, own(this, 'parseReviver'));
56237
+ } catch (e) {
56238
+ if (strictJSONParsing) {
56239
+ if (e.name === 'SyntaxError') {
56240
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
56241
+ }
56242
+ throw e;
56243
+ }
56244
+ }
56245
+ }
55660
56246
 
55661
- const accessors = internals.accessors;
55662
- const prototype = this.prototype;
56247
+ return data;
56248
+ },
56249
+ ],
55663
56250
 
55664
- function defineAccessor(_header) {
55665
- const lHeader = normalizeHeader(_header);
56251
+ /**
56252
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
56253
+ * timeout is not created.
56254
+ */
56255
+ timeout: 0,
55666
56256
 
55667
- if (!accessors[lHeader]) {
55668
- buildAccessors(prototype, _header);
55669
- accessors[lHeader] = true;
55670
- }
55671
- }
56257
+ xsrfCookieName: 'XSRF-TOKEN',
56258
+ xsrfHeaderName: 'X-XSRF-TOKEN',
55672
56259
 
55673
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
56260
+ maxContentLength: -1,
56261
+ maxBodyLength: -1,
55674
56262
 
55675
- return this;
55676
- }
55677
- }
56263
+ env: {
56264
+ FormData: platform.classes.FormData,
56265
+ Blob: platform.classes.Blob,
56266
+ },
55678
56267
 
55679
- AxiosHeaders.accessor([
55680
- 'Content-Type',
55681
- 'Content-Length',
55682
- 'Accept',
55683
- 'Accept-Encoding',
55684
- 'User-Agent',
55685
- 'Authorization',
55686
- ]);
56268
+ validateStatus: function validateStatus(status) {
56269
+ return status >= 200 && status < 300;
56270
+ },
55687
56271
 
55688
- // reserved names hotfix
55689
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
55690
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
55691
- return {
55692
- get: () => value,
55693
- set(headerValue) {
55694
- this[mapped] = headerValue;
56272
+ headers: {
56273
+ common: {
56274
+ Accept: 'application/json, text/plain, */*',
56275
+ 'Content-Type': undefined,
55695
56276
  },
55696
- };
55697
- });
56277
+ },
56278
+ };
55698
56279
 
55699
- utils$1.freezeMethods(AxiosHeaders);
56280
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
56281
+ defaults.headers[method] = {};
56282
+ });
55700
56283
 
55701
56284
  /**
55702
56285
  * Transform the data for a request or a response
@@ -55756,22 +56339,18 @@ function settle(resolve, reject, response) {
55756
56339
  if (!response.status || !validateStatus || validateStatus(response.status)) {
55757
56340
  resolve(response);
55758
56341
  } else {
55759
- reject(
55760
- new AxiosError(
55761
- 'Request failed with status code ' + response.status,
55762
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][
55763
- Math.floor(response.status / 100) - 4
55764
- ],
55765
- response.config,
55766
- response.request,
55767
- response
55768
- )
55769
- );
56342
+ reject(new AxiosError(
56343
+ 'Request failed with status code ' + response.status,
56344
+ response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
56345
+ response.config,
56346
+ response.request,
56347
+ response
56348
+ ));
55770
56349
  }
55771
56350
  }
55772
56351
 
55773
56352
  function parseProtocol(url) {
55774
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
56353
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
55775
56354
  return (match && match[1]) || '';
55776
56355
  }
55777
56356
 
@@ -55875,6 +56454,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
55875
56454
  const _speedometer = speedometer(50, 250);
55876
56455
 
55877
56456
  return throttle((e) => {
56457
+ if (!e || typeof e.loaded !== 'number') {
56458
+ return;
56459
+ }
55878
56460
  const rawLoaded = e.loaded;
55879
56461
  const total = e.lengthComputable ? e.total : undefined;
55880
56462
  const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -55962,8 +56544,20 @@ var cookies = platform.hasStandardBrowserEnv
55962
56544
 
55963
56545
  read(name) {
55964
56546
  if (typeof document === 'undefined') return null;
55965
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
55966
- return match ? decodeURIComponent(match[1]) : null;
56547
+ // Match name=value by splitting on the semicolon separator instead of building a
56548
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
56549
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
56550
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
56551
+ // "; ", so ignore optional whitespace before each cookie name.
56552
+ const cookies = document.cookie.split(';');
56553
+ for (let i = 0; i < cookies.length; i++) {
56554
+ const cookie = cookies[i].replace(/^\s+/, '');
56555
+ const eq = cookie.indexOf('=');
56556
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
56557
+ return decodeURIComponent(cookie.slice(eq + 1));
56558
+ }
56559
+ }
56560
+ return null;
55967
56561
  },
55968
56562
 
55969
56563
  remove(name) {
@@ -56045,11 +56639,14 @@ function mergeConfig(config1, config2) {
56045
56639
  config2 = config2 || {};
56046
56640
 
56047
56641
  // Use a null-prototype object so that downstream reads such as `config.auth`
56048
- // or `config.baseURL` cannot inherit polluted values from Object.prototype
56049
- // (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
56050
- // own slot to preserve ergonomics for user code that relies on it.
56642
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
56643
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
56644
+ // ergonomics for user code that relies on it.
56051
56645
  const config = Object.create(null);
56052
56646
  Object.defineProperty(config, 'hasOwnProperty', {
56647
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
56648
+ // this data descriptor into an accessor descriptor on the way in.
56649
+ __proto__: null,
56053
56650
  value: Object.prototype.hasOwnProperty,
56054
56651
  enumerable: false,
56055
56652
  writable: true,
@@ -56146,11 +56743,39 @@ function mergeConfig(config1, config2) {
56146
56743
  return config;
56147
56744
  }
56148
56745
 
56746
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
56747
+
56748
+ function setFormDataHeaders(headers, formHeaders, policy) {
56749
+ if (policy !== 'content-only') {
56750
+ headers.set(formHeaders);
56751
+ return;
56752
+ }
56753
+
56754
+ Object.entries(formHeaders).forEach(([key, val]) => {
56755
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
56756
+ headers.set(key, val);
56757
+ }
56758
+ });
56759
+ }
56760
+
56761
+ /**
56762
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
56763
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
56764
+ *
56765
+ * @param {string} str The string to encode
56766
+ *
56767
+ * @returns {string} UTF-8 bytes as a Latin-1 string
56768
+ */
56769
+ const encodeUTF8 = (str) =>
56770
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
56771
+ String.fromCharCode(parseInt(hex, 16))
56772
+ );
56773
+
56149
56774
  var resolveConfig = (config) => {
56150
56775
  const newConfig = mergeConfig({}, config);
56151
56776
 
56152
56777
  // Read only own properties to prevent prototype pollution gadgets
56153
- // (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
56778
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
56154
56779
  const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
56155
56780
 
56156
56781
  const data = own('data');
@@ -56176,11 +56801,7 @@ var resolveConfig = (config) => {
56176
56801
  headers.set(
56177
56802
  'Authorization',
56178
56803
  'Basic ' +
56179
- btoa(
56180
- (auth.username || '') +
56181
- ':' +
56182
- (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
56183
- )
56804
+ btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
56184
56805
  );
56185
56806
  }
56186
56807
 
@@ -56189,14 +56810,7 @@ var resolveConfig = (config) => {
56189
56810
  headers.setContentType(undefined); // browser handles it
56190
56811
  } else if (utils$1.isFunction(data.getHeaders)) {
56191
56812
  // Node.js FormData (like form-data package)
56192
- const formHeaders = data.getHeaders();
56193
- // Only set safe headers to avoid overwriting security headers
56194
- const allowedHeaders = ['content-type', 'content-length'];
56195
- Object.entries(formHeaders).forEach(([key, val]) => {
56196
- if (allowedHeaders.includes(key.toLowerCase())) {
56197
- headers.set(key, val);
56198
- }
56199
- });
56813
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
56200
56814
  }
56201
56815
  }
56202
56816
 
@@ -56211,10 +56825,9 @@ var resolveConfig = (config) => {
56211
56825
 
56212
56826
  // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
56213
56827
  // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
56214
- // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
56828
+ // the XSRF token cross-origin.
56215
56829
  const shouldSendXSRF =
56216
- withXSRFToken === true ||
56217
- (withXSRFToken == null && isURLSameOrigin(newConfig.url));
56830
+ withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
56218
56831
 
56219
56832
  if (shouldSendXSRF) {
56220
56833
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
@@ -56310,7 +56923,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56310
56923
  // will return status as 0 even though it's a successful request
56311
56924
  if (
56312
56925
  request.status === 0 &&
56313
- !(request.responseURL && request.responseURL.indexOf('file:') === 0)
56926
+ !(request.responseURL && request.responseURL.startsWith('file:'))
56314
56927
  ) {
56315
56928
  return;
56316
56929
  }
@@ -56327,6 +56940,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56327
56940
  }
56328
56941
 
56329
56942
  reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
56943
+ done();
56330
56944
 
56331
56945
  // Clean up request
56332
56946
  request = null;
@@ -56342,6 +56956,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56342
56956
  // attach the underlying event for consumers who want details
56343
56957
  err.event = event || null;
56344
56958
  reject(err);
56959
+ done();
56345
56960
  request = null;
56346
56961
  };
56347
56962
 
@@ -56362,6 +56977,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56362
56977
  request
56363
56978
  )
56364
56979
  );
56980
+ done();
56365
56981
 
56366
56982
  // Clean up request
56367
56983
  request = null;
@@ -56372,7 +56988,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56372
56988
 
56373
56989
  // Add headers to the request
56374
56990
  if ('setRequestHeader' in request) {
56375
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
56991
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
56376
56992
  request.setRequestHeader(key, val);
56377
56993
  });
56378
56994
  }
@@ -56411,6 +57027,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56411
57027
  }
56412
57028
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
56413
57029
  request.abort();
57030
+ done();
56414
57031
  request = null;
56415
57032
  };
56416
57033
 
@@ -56424,7 +57041,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56424
57041
 
56425
57042
  const protocol = parseProtocol(_config.url);
56426
57043
 
56427
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
57044
+ if (protocol && !platform.protocols.includes(protocol)) {
56428
57045
  reject(
56429
57046
  new AxiosError(
56430
57047
  'Unsupported protocol ' + protocol + ':',
@@ -56441,54 +57058,55 @@ var xhrAdapter = isXHRAdapterSupported &&
56441
57058
  };
56442
57059
 
56443
57060
  const composeSignals = (signals, timeout) => {
56444
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
56445
-
56446
- if (timeout || length) {
56447
- let controller = new AbortController();
56448
-
56449
- let aborted;
56450
-
56451
- const onabort = function (reason) {
56452
- if (!aborted) {
56453
- aborted = true;
56454
- unsubscribe();
56455
- const err = reason instanceof Error ? reason : this.reason;
56456
- controller.abort(
56457
- err instanceof AxiosError
56458
- ? err
56459
- : new CanceledError(err instanceof Error ? err.message : err)
56460
- );
56461
- }
56462
- };
57061
+ signals = signals ? signals.filter(Boolean) : [];
56463
57062
 
56464
- let timer =
56465
- timeout &&
56466
- setTimeout(() => {
56467
- timer = null;
56468
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
56469
- }, timeout);
56470
-
56471
- const unsubscribe = () => {
56472
- if (signals) {
56473
- timer && clearTimeout(timer);
56474
- timer = null;
56475
- signals.forEach((signal) => {
56476
- signal.unsubscribe
56477
- ? signal.unsubscribe(onabort)
56478
- : signal.removeEventListener('abort', onabort);
56479
- });
56480
- signals = null;
56481
- }
56482
- };
57063
+ if (!timeout && !signals.length) {
57064
+ return;
57065
+ }
57066
+
57067
+ const controller = new AbortController();
57068
+
57069
+ let aborted = false;
56483
57070
 
56484
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
57071
+ const onabort = function (reason) {
57072
+ if (!aborted) {
57073
+ aborted = true;
57074
+ unsubscribe();
57075
+ const err = reason instanceof Error ? reason : this.reason;
57076
+ controller.abort(
57077
+ err instanceof AxiosError
57078
+ ? err
57079
+ : new CanceledError(err instanceof Error ? err.message : err)
57080
+ );
57081
+ }
57082
+ };
57083
+
57084
+ let timer =
57085
+ timeout &&
57086
+ setTimeout(() => {
57087
+ timer = null;
57088
+ onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
57089
+ }, timeout);
57090
+
57091
+ const unsubscribe = () => {
57092
+ if (!signals) { return; }
57093
+ timer && clearTimeout(timer);
57094
+ timer = null;
57095
+ signals.forEach((signal) => {
57096
+ signal.unsubscribe
57097
+ ? signal.unsubscribe(onabort)
57098
+ : signal.removeEventListener('abort', onabort);
57099
+ });
57100
+ signals = null;
57101
+ };
56485
57102
 
56486
- const { signal } = controller;
57103
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
56487
57104
 
56488
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
57105
+ const { signal } = controller;
56489
57106
 
56490
- return signal;
56491
- }
57107
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
57108
+
57109
+ return signal;
56492
57110
  };
56493
57111
 
56494
57112
  const streamChunk = function* (chunk, chunkSize) {
@@ -56581,16 +57199,112 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
56581
57199
  );
56582
57200
  };
56583
57201
 
56584
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
57202
+ /**
57203
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
57204
+ * - For base64: compute exact decoded size using length and padding;
57205
+ * handle %XX at the character-count level (no string allocation).
57206
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
57207
+ *
57208
+ * @param {string} url
57209
+ * @returns {number}
57210
+ */
57211
+ function estimateDataURLDecodedBytes(url) {
57212
+ if (!url || typeof url !== 'string') return 0;
57213
+ if (!url.startsWith('data:')) return 0;
57214
+
57215
+ const comma = url.indexOf(',');
57216
+ if (comma < 0) return 0;
57217
+
57218
+ const meta = url.slice(5, comma);
57219
+ const body = url.slice(comma + 1);
57220
+ const isBase64 = /;base64/i.test(meta);
57221
+
57222
+ if (isBase64) {
57223
+ let effectiveLen = body.length;
57224
+ const len = body.length; // cache length
57225
+
57226
+ for (let i = 0; i < len; i++) {
57227
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
57228
+ const a = body.charCodeAt(i + 1);
57229
+ const b = body.charCodeAt(i + 2);
57230
+ const isHex =
57231
+ ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
57232
+ ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
57233
+
57234
+ if (isHex) {
57235
+ effectiveLen -= 2;
57236
+ i += 2;
57237
+ }
57238
+ }
57239
+ }
56585
57240
 
56586
- const { isFunction } = utils$1;
57241
+ let pad = 0;
57242
+ let idx = len - 1;
57243
+
57244
+ const tailIsPct3D = (j) =>
57245
+ j >= 2 &&
57246
+ body.charCodeAt(j - 2) === 37 && // '%'
57247
+ body.charCodeAt(j - 1) === 51 && // '3'
57248
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
57249
+
57250
+ if (idx >= 0) {
57251
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
57252
+ pad++;
57253
+ idx--;
57254
+ } else if (tailIsPct3D(idx)) {
57255
+ pad++;
57256
+ idx -= 3;
57257
+ }
57258
+ }
57259
+
57260
+ if (pad === 1 && idx >= 0) {
57261
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
57262
+ pad++;
57263
+ } else if (tailIsPct3D(idx)) {
57264
+ pad++;
57265
+ }
57266
+ }
57267
+
57268
+ const groups = Math.floor(effectiveLen / 4);
57269
+ const bytes = groups * 3 - (pad || 0);
57270
+ return bytes > 0 ? bytes : 0;
57271
+ }
57272
+
57273
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
57274
+ return Buffer.byteLength(body, 'utf8');
57275
+ }
57276
+
57277
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
57278
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
57279
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
57280
+ // but 3 UTF-8 bytes).
57281
+ let bytes = 0;
57282
+ for (let i = 0, len = body.length; i < len; i++) {
57283
+ const c = body.charCodeAt(i);
57284
+ if (c < 0x80) {
57285
+ bytes += 1;
57286
+ } else if (c < 0x800) {
57287
+ bytes += 2;
57288
+ } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
57289
+ const next = body.charCodeAt(i + 1);
57290
+ if (next >= 0xdc00 && next <= 0xdfff) {
57291
+ bytes += 4;
57292
+ i++;
57293
+ } else {
57294
+ bytes += 3;
57295
+ }
57296
+ } else {
57297
+ bytes += 3;
57298
+ }
57299
+ }
57300
+ return bytes;
57301
+ }
56587
57302
 
56588
- const globalFetchAPI = (({ Request, Response }) => ({
56589
- Request,
56590
- Response,
56591
- }))(utils$1.global);
57303
+ const VERSION = "1.16.1";
56592
57304
 
56593
- const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
57305
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
57306
+
57307
+ const { isFunction } = utils$1;
56594
57308
 
56595
57309
  const test = (fn, ...args) => {
56596
57310
  try {
@@ -56601,11 +57315,20 @@ const test = (fn, ...args) => {
56601
57315
  };
56602
57316
 
56603
57317
  const factory = (env) => {
57318
+ const globalObject =
57319
+ utils$1.global !== undefined && utils$1.global !== null
57320
+ ? utils$1.global
57321
+ : globalThis;
57322
+ const { ReadableStream, TextEncoder } = globalObject;
57323
+
56604
57324
  env = utils$1.merge.call(
56605
57325
  {
56606
57326
  skipUndefined: true,
56607
57327
  },
56608
- globalFetchAPI,
57328
+ {
57329
+ Request: globalObject.Request,
57330
+ Response: globalObject.Response,
57331
+ },
56609
57332
  env
56610
57333
  );
56611
57334
 
@@ -56618,7 +57341,7 @@ const factory = (env) => {
56618
57341
  return false;
56619
57342
  }
56620
57343
 
56621
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
57344
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
56622
57345
 
56623
57346
  const encodeText =
56624
57347
  isFetchSupported &&
@@ -56636,7 +57359,7 @@ const factory = (env) => {
56636
57359
  let duplexAccessed = false;
56637
57360
 
56638
57361
  const request = new Request(platform.origin, {
56639
- body: new ReadableStream$1(),
57362
+ body: new ReadableStream(),
56640
57363
  method: 'POST',
56641
57364
  get duplex() {
56642
57365
  duplexAccessed = true;
@@ -56732,8 +57455,13 @@ const factory = (env) => {
56732
57455
  headers,
56733
57456
  withCredentials = 'same-origin',
56734
57457
  fetchOptions,
57458
+ maxContentLength,
57459
+ maxBodyLength,
56735
57460
  } = resolveConfig(config);
56736
57461
 
57462
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
57463
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
57464
+
56737
57465
  let _fetch = envFetch || fetch;
56738
57466
 
56739
57467
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
@@ -56755,6 +57483,41 @@ const factory = (env) => {
56755
57483
  let requestContentLength;
56756
57484
 
56757
57485
  try {
57486
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
57487
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
57488
+ // "if (protocol === 'data:')" branch).
57489
+ if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
57490
+ const estimated = estimateDataURLDecodedBytes(url);
57491
+ if (estimated > maxContentLength) {
57492
+ throw new AxiosError(
57493
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57494
+ AxiosError.ERR_BAD_RESPONSE,
57495
+ config,
57496
+ request
57497
+ );
57498
+ }
57499
+ }
57500
+
57501
+ // Enforce maxBodyLength against the outbound request body before dispatch.
57502
+ // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
57503
+ // maxBodyLength limit'). Skip when the body length cannot be determined
57504
+ // (e.g. a live ReadableStream supplied by the caller).
57505
+ if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
57506
+ const outboundLength = await resolveBodyLength(headers, data);
57507
+ if (
57508
+ typeof outboundLength === 'number' &&
57509
+ isFinite(outboundLength) &&
57510
+ outboundLength > maxBodyLength
57511
+ ) {
57512
+ throw new AxiosError(
57513
+ 'Request body larger than maxBodyLength limit',
57514
+ AxiosError.ERR_BAD_REQUEST,
57515
+ config,
57516
+ request
57517
+ );
57518
+ }
57519
+ }
57520
+
56758
57521
  if (
56759
57522
  onUploadProgress &&
56760
57523
  supportsRequestStream &&
@@ -56805,11 +57568,14 @@ const factory = (env) => {
56805
57568
  }
56806
57569
  }
56807
57570
 
57571
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
57572
+ headers.set('User-Agent', 'axios/' + VERSION, false);
57573
+
56808
57574
  const resolvedOptions = {
56809
57575
  ...fetchOptions,
56810
57576
  signal: composedSignal,
56811
57577
  method: method.toUpperCase(),
56812
- headers: headers.normalize().toJSON(),
57578
+ headers: toByteStringHeaderObject(headers.normalize()),
56813
57579
  body: data,
56814
57580
  duplex: 'half',
56815
57581
  credentials: isCredentialsSupported ? withCredentials : undefined,
@@ -56821,10 +57587,28 @@ const factory = (env) => {
56821
57587
  ? _fetch(request, fetchOptions)
56822
57588
  : _fetch(url, resolvedOptions));
56823
57589
 
57590
+ // Cheap pre-check: if the server honestly declares a content-length that
57591
+ // already exceeds the cap, reject before we start streaming.
57592
+ if (hasMaxContentLength) {
57593
+ const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
57594
+ if (declaredLength != null && declaredLength > maxContentLength) {
57595
+ throw new AxiosError(
57596
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57597
+ AxiosError.ERR_BAD_RESPONSE,
57598
+ config,
57599
+ request
57600
+ );
57601
+ }
57602
+ }
57603
+
56824
57604
  const isStreamResponse =
56825
57605
  supportsResponseStream && (responseType === 'stream' || responseType === 'response');
56826
57606
 
56827
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
57607
+ if (
57608
+ supportsResponseStream &&
57609
+ response.body &&
57610
+ (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
57611
+ ) {
56828
57612
  const options = {};
56829
57613
 
56830
57614
  ['status', 'statusText', 'headers'].forEach((prop) => {
@@ -56841,8 +57625,24 @@ const factory = (env) => {
56841
57625
  )) ||
56842
57626
  [];
56843
57627
 
57628
+ let bytesRead = 0;
57629
+ const onChunkProgress = (loadedBytes) => {
57630
+ if (hasMaxContentLength) {
57631
+ bytesRead = loadedBytes;
57632
+ if (bytesRead > maxContentLength) {
57633
+ throw new AxiosError(
57634
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57635
+ AxiosError.ERR_BAD_RESPONSE,
57636
+ config,
57637
+ request
57638
+ );
57639
+ }
57640
+ }
57641
+ onProgress && onProgress(loadedBytes);
57642
+ };
57643
+
56844
57644
  response = new Response(
56845
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
57645
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
56846
57646
  flush && flush();
56847
57647
  unsubscribe && unsubscribe();
56848
57648
  }),
@@ -56857,6 +57657,33 @@ const factory = (env) => {
56857
57657
  config
56858
57658
  );
56859
57659
 
57660
+ // Fallback enforcement for environments without ReadableStream support
57661
+ // (legacy runtimes). Detect materialized size from typed output; skip
57662
+ // streams/Response passthrough since the user will read those themselves.
57663
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
57664
+ let materializedSize;
57665
+ if (responseData != null) {
57666
+ if (typeof responseData.byteLength === 'number') {
57667
+ materializedSize = responseData.byteLength;
57668
+ } else if (typeof responseData.size === 'number') {
57669
+ materializedSize = responseData.size;
57670
+ } else if (typeof responseData === 'string') {
57671
+ materializedSize =
57672
+ typeof TextEncoder === 'function'
57673
+ ? new TextEncoder().encode(responseData).byteLength
57674
+ : responseData.length;
57675
+ }
57676
+ }
57677
+ if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
57678
+ throw new AxiosError(
57679
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57680
+ AxiosError.ERR_BAD_RESPONSE,
57681
+ config,
57682
+ request
57683
+ );
57684
+ }
57685
+ }
57686
+
56860
57687
  !isStreamResponse && unsubscribe && unsubscribe();
56861
57688
 
56862
57689
  return await new Promise((resolve, reject) => {
@@ -56872,6 +57699,17 @@ const factory = (env) => {
56872
57699
  } catch (err) {
56873
57700
  unsubscribe && unsubscribe();
56874
57701
 
57702
+ // Safari can surface fetch aborts as a DOMException-like object whose
57703
+ // branded getters throw. Prefer our composed signal reason before reading
57704
+ // the caught error, preserving timeout vs cancellation semantics.
57705
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
57706
+ const canceledError = composedSignal.reason;
57707
+ canceledError.config = config;
57708
+ request && (canceledError.request = request);
57709
+ err !== canceledError && (canceledError.cause = err);
57710
+ throw canceledError;
57711
+ }
57712
+
56875
57713
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
56876
57714
  throw Object.assign(
56877
57715
  new AxiosError(
@@ -56940,11 +57778,13 @@ const knownAdapters = {
56940
57778
  utils$1.forEach(knownAdapters, (fn, value) => {
56941
57779
  if (fn) {
56942
57780
  try {
56943
- Object.defineProperty(fn, 'name', { value });
57781
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
57782
+ // these data descriptors into accessor descriptors on the way in.
57783
+ Object.defineProperty(fn, 'name', { __proto__: null, value });
56944
57784
  } catch (e) {
56945
57785
  // eslint-disable-next-line no-empty
56946
57786
  }
56947
- Object.defineProperty(fn, 'adapterName', { value });
57787
+ Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
56948
57788
  }
56949
57789
  });
56950
57790
 
@@ -57086,8 +57926,15 @@ function dispatchRequest(config) {
57086
57926
  function onAdapterResolution(response) {
57087
57927
  throwIfCancellationRequested(config);
57088
57928
 
57089
- // Transform response data
57090
- response.data = transformData.call(config, config.transformResponse, response);
57929
+ // Expose the current response on config so that transformResponse can
57930
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
57931
+ // We clean it up afterwards to avoid polluting the config object.
57932
+ config.response = response;
57933
+ try {
57934
+ response.data = transformData.call(config, config.transformResponse, response);
57935
+ } finally {
57936
+ delete config.response;
57937
+ }
57091
57938
 
57092
57939
  response.headers = AxiosHeaders.from(response.headers);
57093
57940
 
@@ -57099,11 +57946,16 @@ function dispatchRequest(config) {
57099
57946
 
57100
57947
  // Transform response data
57101
57948
  if (reason && reason.response) {
57102
- reason.response.data = transformData.call(
57103
- config,
57104
- config.transformResponse,
57105
- reason.response
57106
- );
57949
+ config.response = reason.response;
57950
+ try {
57951
+ reason.response.data = transformData.call(
57952
+ config,
57953
+ config.transformResponse,
57954
+ reason.response
57955
+ );
57956
+ } finally {
57957
+ delete config.response;
57958
+ }
57107
57959
  reason.response.headers = AxiosHeaders.from(reason.response.headers);
57108
57960
  }
57109
57961
  }
@@ -57113,8 +57965,6 @@ function dispatchRequest(config) {
57113
57965
  );
57114
57966
  }
57115
57967
 
57116
- const VERSION = "1.15.2";
57117
-
57118
57968
  const validators$1 = {};
57119
57969
 
57120
57970
  // eslint-disable-next-line func-names
@@ -57199,7 +58049,7 @@ function assertOptions(options, schema, allowUnknown) {
57199
58049
  while (i-- > 0) {
57200
58050
  const opt = keys[i];
57201
58051
  // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
57202
- // a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
58052
+ // a non-function validator and cause a TypeError.
57203
58053
  const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
57204
58054
  if (validator) {
57205
58055
  const value = options[opt];
@@ -57359,7 +58209,7 @@ class Axios {
57359
58209
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
57360
58210
 
57361
58211
  headers &&
57362
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
58212
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
57363
58213
  delete headers[method];
57364
58214
  });
57365
58215
 
@@ -57462,7 +58312,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
57462
58312
  };
57463
58313
  });
57464
58314
 
57465
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
58315
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
57466
58316
  function generateHTTPMethod(isForm) {
57467
58317
  return function httpMethod(url, data, config) {
57468
58318
  return this.request(
@@ -57482,7 +58332,11 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
57482
58332
 
57483
58333
  Axios.prototype[method] = generateHTTPMethod();
57484
58334
 
57485
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
58335
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
58336
+ // its semantics, so no queryForm shorthand is generated.
58337
+ if (method !== 'query') {
58338
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
58339
+ }
57486
58340
  });
57487
58341
 
57488
58342
  /**
@@ -60035,7 +60889,9 @@ const MainVn = (props) => {
60035
60889
  win4DKhr = 0,
60036
60890
  win4DUsd = 0,
60037
60891
  winLoseKhr = 0,
60038
- winLoseUsd = 0
60892
+ winLoseUsd = 0,
60893
+ shareAmountKhr = 0,
60894
+ shareAmountUsd = 0
60039
60895
  },
60040
60896
  hasLottery: {
60041
60897
  rebateRate1D = 0,
@@ -60120,6 +60976,7 @@ const MainVn = (props) => {
60120
60976
  });
60121
60977
  const isShow = (value) => !isMix && value;
60122
60978
  const titleColSpan = isShowUsd ? 2 + mergeAll + mergeKhr + mergeUsd : 2 + mergeKhr * 2;
60979
+ let isShare = shareAmountKhr !== winLoseKhr || shareAmountUsd !== winLoseUsd;
60123
60980
  return /* @__PURE__ */ jsxRuntime.jsx("div", { id: "wrap-tb", className: "mb-3 mr-3", children: /* @__PURE__ */ jsxRuntime.jsx("table", { id, className: `table table-hover table-striped ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs("tbody", { className: "pb-5", children: [
60124
60981
  renderReportTitleRows({
60125
60982
  preTitle,
@@ -60207,6 +61064,17 @@ const MainVn = (props) => {
60207
61064
  isShowUsd,
60208
61065
  winLoseKhr,
60209
61066
  winLoseUsd,
61067
+ borderClassName: isShare ? "" : "b-vio-b",
61068
+ khrAfterValue: [{ colSpan: isShowUsd ? getAllLength + 4 : mergeKhr + 8 }],
61069
+ usdAfterValue: [{ colSpan: 7 }]
61070
+ }),
61071
+ isShare && renderWinLoseRow({
61072
+ id,
61073
+ isShowUsd,
61074
+ khrLabel: "\u1780\u17B6\u178F\u17CB Share \u179A\u17BD\u1785",
61075
+ usdLabel: "\u1780\u17B6\u178F\u17CB Share \u179A\u17BD\u1785",
61076
+ winLoseKhr: shareAmountKhr,
61077
+ winLoseUsd: shareAmountUsd,
60210
61078
  khrAfterValue: [{ colSpan: isShowUsd ? getAllLength + 4 : mergeKhr + 8 }],
60211
61079
  usdAfterValue: [{ colSpan: 7 }]
60212
61080
  })
@@ -61306,8 +62174,16 @@ const SummaryImageActions = ({ children, fileName }) => {
61306
62174
  ] }) });
61307
62175
  };
61308
62176
 
61309
- const SummaryRow = ({ id, label, khr, usd, showUsd, className = "", labelClassName = "text-center" }) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "animate-slide-up", children: [
61310
- /* @__PURE__ */ jsxRuntime.jsx(THB, { colSpan: 4, className: labelClassName, children: label }),
62177
+ const SummaryRow = ({ id, label, khr, usd, showUsd, className = "", labelClassName = "text-center", share = 100 }) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "animate-slide-up", children: [
62178
+ /* @__PURE__ */ jsxRuntime.jsxs(THB, { colSpan: 4, className: labelClassName, children: [
62179
+ label,
62180
+ " ",
62181
+ share !== 100 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-info", children: [
62182
+ " (",
62183
+ share,
62184
+ "%)"
62185
+ ] }) : ""
62186
+ ] }),
61311
62187
  /* @__PURE__ */ jsxRuntime.jsx(RenderThWidthB, { colSpan: showUsd ? 3 : 6, className: `${className} t-right`, id, value: khr, currency: "KHR" }),
61312
62188
  showUsd && /* @__PURE__ */ jsxRuntime.jsx(RenderThWidthB, { colSpan: 3, className: `${className} t-right`, id, value: usd, currency: "USD" })
61313
62189
  ] });
@@ -61342,8 +62218,6 @@ const WinLoseSummary = ({ data, id, filter, showUsd }) => {
61342
62218
  } = data || {};
61343
62219
  const user = getSummaryUser({ data, filter });
61344
62220
  const totalStyle = { borderBottom: "2px solid black", borderTop: "2px solid black" };
61345
- const summaryValueKhr = (filter == null ? void 0 : filter.isSend) ? winLoseKhr : shareAmountKhr;
61346
- const summaryValueUsd = (filter == null ? void 0 : filter.isSend) ? winLoseUsd : shareAmountUsd;
61347
62221
  return /* @__PURE__ */ jsxRuntime.jsx(SummaryImageActions, { fileName: getSummaryImageFileName("win-lose-summary", filter), children: (actions) => /* @__PURE__ */ jsxRuntime.jsx(
61348
62222
  "table",
61349
62223
  {
@@ -61365,17 +62239,18 @@ const WinLoseSummary = ({ data, id, filter, showUsd }) => {
61365
62239
  /* @__PURE__ */ jsxRuntime.jsx(THB, { className: "blue-l-h", colSpan: showUsd ? 3 : 6, children: "(\u179A\u17C0\u179B)" }),
61366
62240
  showUsd && /* @__PURE__ */ jsxRuntime.jsx(THB, { colSpan: 3, className: "green-l-h text-left", children: "(\u178A\u17BB\u179B\u17D2\u179B\u17B6\u179A)" })
61367
62241
  ] }),
61368
- winLoses.map(({ winLoseKhr: winLoseKhr2, winLoseUsd: winLoseUsd2, lotteryType }, index) => {
62242
+ winLoses.map(({ winLoseKhr: winLoseKhr2, winLoseUsd: winLoseUsd2, lotteryType, share }, index) => {
61369
62243
  const lotteryName = lotteryLabelKH[lotteryType] || lotteryType;
61370
- const lotteryCode = lotteryLabel[lotteryType] || lotteryType;
62244
+ const lotteryCode2 = lotteryCodes[lotteryType] || lotteryType;
61371
62245
  return /* @__PURE__ */ jsxRuntime.jsx(
61372
62246
  SummaryRow,
61373
62247
  {
61374
62248
  id,
61375
- label: `\u1786\u17D2\u1793\u17C4\u178F${lotteryName} (${lotteryCode})`,
62249
+ label: `\u1786\u17D2\u1793\u17C4\u178F${lotteryName} (${lotteryCode2})`,
61376
62250
  khr: winLoseKhr2,
61377
62251
  usd: winLoseUsd2,
61378
62252
  showUsd,
62253
+ share,
61379
62254
  labelClassName: "t-left"
61380
62255
  },
61381
62256
  `${lotteryType}-${index}`
@@ -61383,8 +62258,8 @@ const WinLoseSummary = ({ data, id, filter, showUsd }) => {
61383
62258
  }),
61384
62259
  /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "animate-slide-up b-vio-b2", children: [
61385
62260
  /* @__PURE__ */ jsxRuntime.jsx(THB, { colSpan: 4, className: "t-left f-bold blue-l-h", children: "\u179F\u179A\u17BB\u1794\u179F\u17BB\u17B8\u1781\u17B6\u178F\u1794\u17D2\u179A\u1785\u17B6\u17C6\u1790\u17D2\u1784\u17C3" }),
61386
- /* @__PURE__ */ jsxRuntime.jsx(RenderThWidthB, { className: "t-right f-bold blue-l-h", colSpan: showUsd ? 3 : 6, id, value: summaryValueKhr, currency: "KHR" }),
61387
- showUsd && /* @__PURE__ */ jsxRuntime.jsx(RenderThWidthB, { colSpan: 3, className: "t-right f-bold green-l-h", id, value: summaryValueUsd, currency: "USD" })
62261
+ /* @__PURE__ */ jsxRuntime.jsx(RenderThWidthB, { className: "t-right f-bold blue-l-h", colSpan: showUsd ? 3 : 6, id, value: shareAmountKhr, currency: "KHR" }),
62262
+ showUsd && /* @__PURE__ */ jsxRuntime.jsx(RenderThWidthB, { colSpan: 3, className: "t-right f-bold green-l-h", id, value: shareAmountUsd, currency: "USD" })
61388
62263
  ] }),
61389
62264
  /* @__PURE__ */ jsxRuntime.jsx(SummaryRow, { id, label: "\u1794\u1789\u17D2\u1787\u17B8\u1785\u17B6\u179F\u17CB", khr: oldKhr, usd: oldUsd, showUsd }),
61390
62265
  /* @__PURE__ */ jsxRuntime.jsx(SummaryRow, { id, label: "\u179B\u17BB\u1799\u179F\u1784", khr: giveKhr, usd: giveUsd, showUsd }),
@@ -61541,6 +62416,7 @@ exports.getS3ImgPrint = getS3ImgPrint;
61541
62416
  exports.getStoredIsRemark = getStoredIsRemark;
61542
62417
  exports.isVNType = isVNType;
61543
62418
  exports.lType = lType;
62419
+ exports.lotteryCodes = lotteryCodes;
61544
62420
  exports.lotteryLabel = lotteryLabel;
61545
62421
  exports.lotteryLabelKH = lotteryLabelKH;
61546
62422
  exports.lotteryLabelOnline = lotteryLabelOnline;