@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.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as jsx$1, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { forwardRef, Component, useRef, useState, useEffect, useLayoutEffect, useMemo, memo, useCallback, useContext, createContext as createContext$1, Fragment as Fragment$1, isValidElement, createElement as createElement$3 } from 'react';
3
+ import React__default, { forwardRef, Component, useRef, useState, useEffect, useLayoutEffect, useMemo, useCallback, memo, useContext, createContext as createContext$1, Fragment as Fragment$1, isValidElement, createElement as createElement$3 } from 'react';
4
4
  import ReactDOM, { createPortal } from 'react-dom';
5
5
 
6
6
  function styleInject(css, ref) {
@@ -3170,10 +3170,10 @@ var applyBind = function applyBind() {
3170
3170
 
3171
3171
  module.exports = function callBind(originalFunction) {
3172
3172
  var func = callBindBasic(arguments);
3173
- var adjustedLength = originalFunction.length - (arguments.length - 1);
3173
+ var adjustedLength = 1 + originalFunction.length - (arguments.length - 1);
3174
3174
  return setFunctionLength$1(
3175
3175
  func,
3176
- 1 + (adjustedLength > 0 ? adjustedLength : 0),
3176
+ adjustedLength > 0 ? adjustedLength : 0,
3177
3177
  true
3178
3178
  );
3179
3179
  };
@@ -6232,7 +6232,7 @@ Popper$1.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
6232
6232
  Popper$1.placements = placements;
6233
6233
  Popper$1.Defaults = Defaults;
6234
6234
 
6235
- var lib$1 = {exports: {}};
6235
+ var lib = {exports: {}};
6236
6236
 
6237
6237
  var implementation = {exports: {}};
6238
6238
 
@@ -6521,10 +6521,10 @@ var implementationExports = implementation.exports;
6521
6521
 
6522
6522
  exports$1.default = _react2.default.createContext || _implementation2.default;
6523
6523
  module.exports = exports$1['default'];
6524
- } (lib$1, lib$1.exports));
6524
+ } (lib, lib.exports));
6525
6525
 
6526
- var libExports$1 = lib$1.exports;
6527
- var createContext = /*@__PURE__*/getDefaultExportFromCjs(libExports$1);
6526
+ var libExports = lib.exports;
6527
+ var createContext = /*@__PURE__*/getDefaultExportFromCjs(libExports);
6528
6528
 
6529
6529
  var ManagerReferenceNodeContext = createContext();
6530
6530
  var ManagerReferenceNodeSetterContext = createContext();
@@ -12275,7 +12275,7 @@ lodash.exports;
12275
12275
  var undefined$1;
12276
12276
 
12277
12277
  /** Used as the semantic version number. */
12278
- var VERSION = '4.17.21';
12278
+ var VERSION = '4.18.1';
12279
12279
 
12280
12280
  /** Used as the size to enable large array optimizations. */
12281
12281
  var LARGE_ARRAY_SIZE = 200;
@@ -12283,7 +12283,8 @@ lodash.exports;
12283
12283
  /** Error message constants. */
12284
12284
  var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
12285
12285
  FUNC_ERROR_TEXT = 'Expected a function',
12286
- INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`';
12286
+ INVALID_TEMPL_VAR_ERROR_TEXT = 'Invalid `variable` option passed into `_.template`',
12287
+ INVALID_TEMPL_IMPORTS_ERROR_TEXT = 'Invalid `imports` option passed into `_.template`';
12287
12288
 
12288
12289
  /** Used to stand-in for `undefined` hash values. */
12289
12290
  var HASH_UNDEFINED = '__lodash_hash_undefined__';
@@ -14015,6 +14016,10 @@ lodash.exports;
14015
14016
  * embedded Ruby (ERB) as well as ES2015 template strings. Change the
14016
14017
  * following template settings to use alternative delimiters.
14017
14018
  *
14019
+ * **Security:** See
14020
+ * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md)
14021
+ * — `_.template` is insecure and will be removed in v5.
14022
+ *
14018
14023
  * @static
14019
14024
  * @memberOf _
14020
14025
  * @type {Object}
@@ -14563,7 +14568,7 @@ lodash.exports;
14563
14568
  * @name has
14564
14569
  * @memberOf SetCache
14565
14570
  * @param {*} value The value to search for.
14566
- * @returns {number} Returns `true` if `value` is found, else `false`.
14571
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
14567
14572
  */
14568
14573
  function setCacheHas(value) {
14569
14574
  return this.__data__.has(value);
@@ -16029,7 +16034,7 @@ lodash.exports;
16029
16034
  if (isArray(iteratee)) {
16030
16035
  return function(value) {
16031
16036
  return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
16032
- }
16037
+ };
16033
16038
  }
16034
16039
  return iteratee;
16035
16040
  });
@@ -16633,8 +16638,34 @@ lodash.exports;
16633
16638
  */
16634
16639
  function baseUnset(object, path) {
16635
16640
  path = castPath(path, object);
16636
- object = parent(object, path);
16637
- return object == null || delete object[toKey(last(path))];
16641
+
16642
+ // Prevent prototype pollution:
16643
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
16644
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
16645
+ var index = -1,
16646
+ length = path.length;
16647
+
16648
+ if (!length) {
16649
+ return true;
16650
+ }
16651
+
16652
+ while (++index < length) {
16653
+ var key = toKey(path[index]);
16654
+
16655
+ // Always block "__proto__" anywhere in the path if it's not expected
16656
+ if (key === '__proto__' && !hasOwnProperty.call(object, '__proto__')) {
16657
+ return false;
16658
+ }
16659
+
16660
+ // Block constructor/prototype as non-terminal traversal keys to prevent
16661
+ // escaping the object graph into built-in constructors and prototypes.
16662
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
16663
+ return false;
16664
+ }
16665
+ }
16666
+
16667
+ var obj = parent(object, path);
16668
+ return obj == null || delete obj[toKey(last(path))];
16638
16669
  }
16639
16670
 
16640
16671
  /**
@@ -19185,7 +19216,7 @@ lodash.exports;
19185
19216
 
19186
19217
  /**
19187
19218
  * Creates an array with all falsey values removed. The values `false`, `null`,
19188
- * `0`, `""`, `undefined`, and `NaN` are falsey.
19219
+ * `0`, `-0`, `0n`, `""`, `undefined`, and `NaN` are falsy.
19189
19220
  *
19190
19221
  * @static
19191
19222
  * @memberOf _
@@ -19724,7 +19755,7 @@ lodash.exports;
19724
19755
 
19725
19756
  while (++index < length) {
19726
19757
  var pair = pairs[index];
19727
- result[pair[0]] = pair[1];
19758
+ baseAssignValue(result, pair[0], pair[1]);
19728
19759
  }
19729
19760
  return result;
19730
19761
  }
@@ -26384,6 +26415,8 @@ lodash.exports;
26384
26415
  * **Note:** JavaScript follows the IEEE-754 standard for resolving
26385
26416
  * floating-point values which can produce unexpected results.
26386
26417
  *
26418
+ * **Note:** If `lower` is greater than `upper`, the values are swapped.
26419
+ *
26387
26420
  * @static
26388
26421
  * @memberOf _
26389
26422
  * @since 0.7.0
@@ -26397,9 +26430,16 @@ lodash.exports;
26397
26430
  * _.random(0, 5);
26398
26431
  * // => an integer between 0 and 5
26399
26432
  *
26433
+ * // when lower is greater than upper the values are swapped
26434
+ * _.random(5, 0);
26435
+ * // => an integer between 0 and 5
26436
+ *
26400
26437
  * _.random(5);
26401
26438
  * // => also an integer between 0 and 5
26402
26439
  *
26440
+ * _.random(-5);
26441
+ * // => an integer between -5 and 0
26442
+ *
26403
26443
  * _.random(5, true);
26404
26444
  * // => a floating-point number between 0 and 5
26405
26445
  *
@@ -27001,6 +27041,10 @@ lodash.exports;
27001
27041
  * properties may be accessed as free variables in the template. If a setting
27002
27042
  * object is given, it takes precedence over `_.templateSettings` values.
27003
27043
  *
27044
+ * **Security:** `_.template` is insecure and should not be used. It will be
27045
+ * removed in Lodash v5. Avoid untrusted input. See
27046
+ * [threat model](https://github.com/lodash/lodash/blob/main/threat-model.md).
27047
+ *
27004
27048
  * **Note:** In the development build `_.template` utilizes
27005
27049
  * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
27006
27050
  * for easier debugging.
@@ -27108,12 +27152,18 @@ lodash.exports;
27108
27152
  options = undefined$1;
27109
27153
  }
27110
27154
  string = toString(string);
27111
- options = assignInWith({}, options, settings, customDefaultsAssignIn);
27155
+ options = assignWith({}, options, settings, customDefaultsAssignIn);
27112
27156
 
27113
- var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
27157
+ var imports = assignWith({}, options.imports, settings.imports, customDefaultsAssignIn),
27114
27158
  importsKeys = keys(imports),
27115
27159
  importsValues = baseValues(imports, importsKeys);
27116
27160
 
27161
+ arrayEach(importsKeys, function(key) {
27162
+ if (reForbiddenIdentifierChars.test(key)) {
27163
+ throw new Error(INVALID_TEMPL_IMPORTS_ERROR_TEXT);
27164
+ }
27165
+ });
27166
+
27117
27167
  var isEscaping,
27118
27168
  isEvaluating,
27119
27169
  index = 0,
@@ -29462,9 +29512,9 @@ var lodashExports = lodash.exports;
29462
29512
  var _ = /*@__PURE__*/getDefaultExportFromCjs(lodashExports);
29463
29513
 
29464
29514
  /**
29465
- * react-number-format - 5.4.4
29515
+ * react-number-format - 5.4.5
29466
29516
  * Author : Sudhanshu Yadav
29467
- * Copyright (c) 2016, 2025 to Sudhanshu Yadav, released under the MIT license.
29517
+ * Copyright (c) 2016, 2026 to Sudhanshu Yadav, released under the MIT license.
29468
29518
  * https://github.com/s-yadav/react-number-format
29469
29519
  */
29470
29520
 
@@ -29906,7 +29956,7 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format, re
29906
29956
  });
29907
29957
  var values = ref[0];
29908
29958
  var setValues = ref[1];
29909
- var _onValueChange = function (newValues, sourceInfo) {
29959
+ var _onValueChange = usePersistentCallback(function (newValues, sourceInfo) {
29910
29960
  if (newValues.formattedValue !== values.formattedValue) {
29911
29961
  setValues({
29912
29962
  formattedValue: newValues.formattedValue,
@@ -29915,7 +29965,7 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format, re
29915
29965
  }
29916
29966
  // call parent on value change if only if formatted value is changed
29917
29967
  onValueChange(newValues, sourceInfo);
29918
- };
29968
+ });
29919
29969
  // if value is switch from controlled to uncontrolled, use the internal state's value to format with new props
29920
29970
  var _value = value;
29921
29971
  var _valueIsNumericString = valueIsNumericString;
@@ -29927,6 +29977,21 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format, re
29927
29977
  useMemo(function () {
29928
29978
  setValues(newValues);
29929
29979
  }, [newValues.formattedValue]);
29980
+ /**
29981
+ * When only a defaultValue is provided (value prop is nil), the initial formatted value is
29982
+ * derived by the library — the parent has not yet been informed of this formatted result.
29983
+ * Fire onValueChange once on mount so the parent can sync to the formatted value.
29984
+ */
29985
+ useEffect(function () {
29986
+ if (!isNil(defaultValue) && isNil(value) && values.formattedValue !== '') {
29987
+ var floatValue = parseFloat(values.numAsString);
29988
+ _onValueChange({
29989
+ formattedValue: values.formattedValue,
29990
+ value: values.numAsString,
29991
+ floatValue: isNaN(floatValue) ? undefined : floatValue,
29992
+ }, { event: undefined, source: SourceType.props });
29993
+ }
29994
+ }, []);
29930
29995
  return [values, _onValueChange];
29931
29996
  }
29932
29997
 
@@ -30481,7 +30546,9 @@ function getCaretBoundary(formattedValue, props) {
30481
30546
  var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
30482
30547
  var hasNegation = formattedValue[0] === '-';
30483
30548
  // fill for prefix and negation
30484
- boundaryAry.fill(false, 0, prefix.length + (hasNegation ? 1 : 0));
30549
+ // Cap the fill range so we never exceed the array length when the formatted value
30550
+ // is just '-' (negation only, e.g. during intermediate typing with a multi-char prefix)
30551
+ boundaryAry.fill(false, 0, Math.min(prefix.length + (hasNegation ? 1 : 0), formattedValue.length));
30485
30552
  // fill for suffix
30486
30553
  var valLn = formattedValue.length;
30487
30554
  boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
@@ -30566,7 +30633,10 @@ function useNumericFormat(props) {
30566
30633
  var selectionEnd = el.selectionEnd;
30567
30634
  var value = el.value; if ( value === void 0 ) value = '';
30568
30635
  // if user tries to delete partial prefix then ignore it
30569
- if ((key === 'Backspace' || key === 'Delete') && selectionEnd < prefix.length) {
30636
+ // Exception: when value is just '-' (negation-only, no prefix shown yet), the cursor
30637
+ // is at position 1 which is < prefix.length for multi-char prefixes — we must allow
30638
+ // backspace to delete the lone negation sign in this state
30639
+ if ((key === 'Backspace' || key === 'Delete') && selectionEnd < prefix.length && value !== '-') {
30570
30640
  e.preventDefault();
30571
30641
  return;
30572
30642
  }
@@ -30906,6 +30976,19 @@ const lotteryLabel = {
30906
30976
  HOSO: "\u1786\u17D2\u1793\u17C4\u178F HOSO",
30907
30977
  KP: "\u1780\u17C6\u1796\u178F KP"
30908
30978
  };
30979
+ const lotteryCodes = {
30980
+ LEAP: "LMHSB",
30981
+ HOSO: "HOSO",
30982
+ VN4: "VN4",
30983
+ VN3: "VN3",
30984
+ VN2: "MT",
30985
+ VN1: "MC",
30986
+ TN: "TC",
30987
+ KH: "KH",
30988
+ SC: "SC",
30989
+ TH: "TH",
30990
+ KP: "KP"
30991
+ };
30909
30992
  const lotteryLabelKH = {
30910
30993
  LEAP: "\u179B\u17B6\u1797",
30911
30994
  VN2: "\u1798\u17A0\u17B6\u1791\u17C1\u1796",
@@ -37554,13 +37637,389 @@ const ProtestTicket = ({
37554
37637
  ] }) }) });
37555
37638
  };
37556
37639
 
37557
- var lib = {exports: {}};
37558
-
37559
- (function (module, exports$1) {
37560
- !function(e,t){module.exports=t(React__default);}("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}()});
37561
- } (lib));
37562
-
37563
- var libExports = lib.exports;
37640
+ const q = "printWindow";
37641
+ function V(e) {
37642
+ const t = document.createElement("iframe");
37643
+ 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;
37644
+ }
37645
+ function f({ level: e = "error", messages: t, suppressErrors: n = false }) {
37646
+ n || (e === "error" ? console.error(t) : e === "warning" ? console.warn(t) : console.debug(t));
37647
+ }
37648
+ function $(e, t) {
37649
+ if (t || !e) {
37650
+ const n = document.getElementById(q);
37651
+ n && document.body.removeChild(n);
37652
+ }
37653
+ }
37654
+ function P(e) {
37655
+ return e instanceof Error ? e : new Error("Unknown Error");
37656
+ }
37657
+ function H(e, t) {
37658
+ const {
37659
+ documentTitle: n,
37660
+ onAfterPrint: l,
37661
+ onPrintError: p,
37662
+ preserveAfterPrint: m,
37663
+ print: h,
37664
+ suppressErrors: g
37665
+ } = t;
37666
+ setTimeout(() => {
37667
+ if (e.contentWindow) {
37668
+ let a = function() {
37669
+ l?.(), $(m);
37670
+ };
37671
+ if (e.contentWindow.focus(), h)
37672
+ h(e).then(a).catch((c) => {
37673
+ p ? p("print", P(c)) : f({
37674
+ messages: ["An error was thrown by the specified `print` function"],
37675
+ suppressErrors: g
37676
+ });
37677
+ });
37678
+ else {
37679
+ if (e.contentWindow.print) {
37680
+ const c = e.contentDocument?.title ?? "", E = e.ownerDocument.title, y = typeof n == "function" ? n() : n;
37681
+ 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));
37682
+ } else
37683
+ f({
37684
+ messages: ["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],
37685
+ suppressErrors: g
37686
+ });
37687
+ z() ? setTimeout(a, 500) : a();
37688
+ }
37689
+ } else
37690
+ f({
37691
+ 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/"],
37692
+ suppressErrors: g
37693
+ });
37694
+ }, 500);
37695
+ }
37696
+ function z() {
37697
+ return [
37698
+ /Android/i,
37699
+ /webOS/i,
37700
+ /iPhone/i,
37701
+ /iPad/i,
37702
+ /iPod/i,
37703
+ /BlackBerry/i,
37704
+ /Windows Phone/i
37705
+ ].some((t) => (
37706
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
37707
+ (navigator.userAgent ?? // Retained for compatibility with browsers that use `navigator.vendor` to identify the browser.
37708
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
37709
+ navigator.vendor ?? // Retained for compatibility with older versions of Opera that use `window.opera`.
37710
+ ("opera" in window && window.opera)).match(t)
37711
+ ));
37712
+ }
37713
+ function O(e) {
37714
+ const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, null);
37715
+ let l = n.nextNode();
37716
+ for (; l; )
37717
+ t.push(l), l = n.nextNode();
37718
+ return t;
37719
+ }
37720
+ function j$1(e, t, n) {
37721
+ const l = O(e), p = O(t);
37722
+ if (l.length !== p.length) {
37723
+ f({
37724
+ messages: ["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.", e, t],
37725
+ suppressErrors: n
37726
+ });
37727
+ return;
37728
+ }
37729
+ for (let m = 0; m < l.length; m++) {
37730
+ const h = l[m], g = p[m], a = h.shadowRoot;
37731
+ if (a !== null) {
37732
+ const c = g.attachShadow({ mode: a.mode });
37733
+ c.innerHTML = a.innerHTML, j$1(a, c, n);
37734
+ }
37735
+ }
37736
+ }
37737
+ const G$1 = `
37738
+ @page {
37739
+ /* Remove browser default header (title) and footer (url) */
37740
+ margin: 0;
37741
+ }
37742
+ @media print {
37743
+ body {
37744
+ /* Tell browsers to print background colors */
37745
+ color-adjust: exact; /* Firefox. This is an older version of "print-color-adjust" */
37746
+ print-color-adjust: exact; /* Firefox/Safari */
37747
+ -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */
37748
+ }
37749
+ }
37750
+ `;
37751
+ function W(e, t, n) {
37752
+ const {
37753
+ contentNode: l,
37754
+ clonedContentNode: p,
37755
+ clonedImgNodes: m,
37756
+ clonedVideoNodes: h,
37757
+ numResourcesToLoad: g,
37758
+ originalCanvasNodes: a
37759
+ } = t, {
37760
+ bodyClass: c,
37761
+ fonts: E,
37762
+ ignoreGlobalStyles: y,
37763
+ pageStyle: C,
37764
+ nonce: T,
37765
+ suppressErrors: A,
37766
+ copyShadowRoots: F
37767
+ } = n, L = [], _ = [];
37768
+ function i(k, x) {
37769
+ if (L.includes(k)) {
37770
+ f({
37771
+ level: "debug",
37772
+ messages: ["Tried to mark a resource that has already been handled", k],
37773
+ suppressErrors: A
37774
+ });
37775
+ return;
37776
+ }
37777
+ x ? (f({
37778
+ messages: [
37779
+ '"react-to-print" was unable to load a resource but will continue attempting to print the page',
37780
+ ...x
37781
+ ],
37782
+ suppressErrors: A
37783
+ }), _.push(k)) : L.push(k), L.length + _.length === g && H(e, n);
37784
+ }
37785
+ e.onload = null;
37786
+ const d = e.contentDocument ?? e.contentWindow?.document;
37787
+ if (d) {
37788
+ const k = d.body.appendChild(p);
37789
+ F && j$1(l, k, !!A), E && (e.contentDocument?.fonts && e.contentWindow?.FontFace ? E.forEach((s) => {
37790
+ const o = new FontFace(
37791
+ s.family,
37792
+ s.source,
37793
+ { weight: s.weight, style: s.style }
37794
+ );
37795
+ e.contentDocument.fonts.add(o), o.loaded.then(() => {
37796
+ i(o);
37797
+ }).catch((b) => {
37798
+ i(o, ["Failed loading the font:", o, "Load error:", P(b)]);
37799
+ });
37800
+ }) : (E.forEach((s) => {
37801
+ i(s);
37802
+ }), f({
37803
+ 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'],
37804
+ suppressErrors: A
37805
+ })));
37806
+ const x = C ?? G$1, D = d.createElement("style");
37807
+ 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(" "));
37808
+ const U = d.querySelectorAll("canvas");
37809
+ for (let s = 0; s < a.length; ++s) {
37810
+ const o = a[s], b = U[s];
37811
+ if (b === void 0) {
37812
+ f({
37813
+ messages: ["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.", o],
37814
+ suppressErrors: A
37815
+ });
37816
+ continue;
37817
+ }
37818
+ const r = b.getContext("2d");
37819
+ r && r.drawImage(o, 0, 0);
37820
+ }
37821
+ for (let s = 0; s < m.length; s++) {
37822
+ const o = m[s], b = o.getAttribute("src");
37823
+ if (!b)
37824
+ i(o, ['Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.', o]);
37825
+ else {
37826
+ const r = new Image();
37827
+ r.onload = () => {
37828
+ i(o);
37829
+ }, r.onerror = (u, w, S, v, N) => {
37830
+ i(o, ["Error loading <img>", o, "Error", N]);
37831
+ }, r.src = b;
37832
+ }
37833
+ }
37834
+ for (let s = 0; s < h.length; s++) {
37835
+ const o = h[s];
37836
+ o.preload = "auto";
37837
+ const b = o.getAttribute("poster");
37838
+ if (b) {
37839
+ const r = new Image();
37840
+ r.onload = () => {
37841
+ i(o);
37842
+ }, r.onerror = (u, w, S, v, N) => {
37843
+ i(o, ["Error loading video poster", b, "for video", o, "Error:", N]);
37844
+ }, r.src = b;
37845
+ } else
37846
+ o.readyState >= 2 ? i(o) : o.src ? (o.onloadeddata = () => {
37847
+ i(o);
37848
+ }, o.onerror = (r, u, w, S, v) => {
37849
+ i(o, ["Error loading video", o, "Error", v]);
37850
+ }, o.onstalled = () => {
37851
+ i(o, ["Loading video stalled, skipping", o]);
37852
+ }) : i(o, ["Error loading video, `src` is empty", o]);
37853
+ }
37854
+ const R = "select", M = l.querySelectorAll(R), B = d.querySelectorAll(R);
37855
+ for (let s = 0; s < M.length; s++)
37856
+ B[s].value = M[s].value;
37857
+ if (!y) {
37858
+ const s = document.querySelectorAll("style, link[rel~='stylesheet'], link[as='style']");
37859
+ for (let o = 0, b = s.length; o < b; ++o) {
37860
+ const r = s[o];
37861
+ if (r.tagName.toLowerCase() === "style") {
37862
+ const u = d.createElement(r.tagName), w = r.sheet;
37863
+ if (w) {
37864
+ let S = "";
37865
+ try {
37866
+ const v = w.cssRules.length;
37867
+ for (let N = 0; N < v; ++N)
37868
+ typeof w.cssRules[N].cssText == "string" && (S += `${w.cssRules[N].cssText}\r
37869
+ `);
37870
+ } catch (v) {
37871
+ f({
37872
+ messages: [
37873
+ "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.",
37874
+ // eslint-disable-line max-len
37875
+ r,
37876
+ `Original error: ${P(v).message}`
37877
+ ],
37878
+ level: "warning"
37879
+ });
37880
+ }
37881
+ u.setAttribute("id", `react-to-print-${o}`), T && u.setAttribute("nonce", T), u.appendChild(d.createTextNode(S)), d.head.appendChild(u);
37882
+ }
37883
+ } else if (r.getAttribute("href"))
37884
+ if (r.hasAttribute("disabled"))
37885
+ f({
37886
+ 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],
37887
+ level: "warning"
37888
+ }), i(r);
37889
+ else {
37890
+ const u = d.createElement(r.tagName);
37891
+ for (let w = 0, S = r.attributes.length; w < S; ++w) {
37892
+ const v = r.attributes[w];
37893
+ v && u.setAttribute(v.nodeName, v.nodeValue ?? "");
37894
+ }
37895
+ u.onload = () => {
37896
+ i(u);
37897
+ }, u.onerror = (w, S, v, N, I) => {
37898
+ i(u, ["Failed to load", u, "Error:", I]);
37899
+ }, T && u.setAttribute("nonce", T), d.head.appendChild(u);
37900
+ }
37901
+ else
37902
+ f({
37903
+ 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],
37904
+ level: "warning"
37905
+ }), i(r);
37906
+ }
37907
+ }
37908
+ }
37909
+ g === 0 && H(e, n);
37910
+ }
37911
+ function J(e, t, n) {
37912
+ e.onload = () => {
37913
+ W(
37914
+ e,
37915
+ t,
37916
+ n
37917
+ );
37918
+ }, document.body.appendChild(e);
37919
+ }
37920
+ function K({ contentRef: e, optionalContent: t, suppressErrors: n }) {
37921
+ if (t && typeof t == "function")
37922
+ return e && f({
37923
+ level: "warning",
37924
+ messages: ['"react-to-print" received a `contentRef` option and an optional-content param passed to its callback. The `contentRef` option will be ignored.']
37925
+ }), t();
37926
+ if (e)
37927
+ return e.current;
37928
+ f({
37929
+ messages: ['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],
37930
+ suppressErrors: n
37931
+ });
37932
+ }
37933
+ function Q(e, t) {
37934
+ const {
37935
+ contentRef: n,
37936
+ fonts: l,
37937
+ ignoreGlobalStyles: p,
37938
+ suppressErrors: m
37939
+ } = t, h = K({
37940
+ contentRef: n,
37941
+ optionalContent: e,
37942
+ suppressErrors: m
37943
+ });
37944
+ if (!h)
37945
+ return;
37946
+ 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;
37947
+ return {
37948
+ contentNode: h,
37949
+ clonedContentNode: g,
37950
+ clonedImgNodes: c,
37951
+ clonedVideoNodes: E,
37952
+ numResourcesToLoad: C,
37953
+ originalCanvasNodes: h.querySelectorAll("canvas")
37954
+ };
37955
+ }
37956
+ function Z({
37957
+ bodyClass: e,
37958
+ contentRef: t,
37959
+ copyShadowRoots: n,
37960
+ documentTitle: l,
37961
+ fonts: p,
37962
+ ignoreGlobalStyles: m,
37963
+ nonce: h,
37964
+ onAfterPrint: g,
37965
+ onBeforePrint: a,
37966
+ onPrintError: c,
37967
+ pageStyle: E,
37968
+ preserveAfterPrint: y,
37969
+ print: C,
37970
+ printIframeProps: T,
37971
+ suppressErrors: A
37972
+ }) {
37973
+ return useCallback((L) => {
37974
+ $(y, true);
37975
+ function _() {
37976
+ const i = {
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
+ onPrintError: c,
37986
+ pageStyle: E,
37987
+ preserveAfterPrint: y,
37988
+ print: C,
37989
+ suppressErrors: A
37990
+ }, d = V(T), k = Q(L, i);
37991
+ if (!k) {
37992
+ f({
37993
+ messages: ["There is nothing to print"],
37994
+ suppressErrors: A
37995
+ });
37996
+ return;
37997
+ }
37998
+ J(d, k, i);
37999
+ }
38000
+ a ? a().then(() => {
38001
+ _();
38002
+ }).catch((i) => {
38003
+ c?.("onBeforePrint", P(i));
38004
+ }) : _();
38005
+ }, [
38006
+ e,
38007
+ t,
38008
+ n,
38009
+ l,
38010
+ p,
38011
+ m,
38012
+ h,
38013
+ g,
38014
+ a,
38015
+ c,
38016
+ E,
38017
+ y,
38018
+ T,
38019
+ C,
38020
+ A
38021
+ ]);
38022
+ }
37564
38023
 
37565
38024
  var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
37566
38025
  var __hasOwnProp$l = Object.prototype.hasOwnProperty;
@@ -37595,7 +38054,7 @@ const BasePrinter = (_a) => {
37595
38054
  "onAfterPrint"
37596
38055
  ]);
37597
38056
  const contentRef = useRef(null);
37598
- const reactToPrintFn = libExports.useReactToPrint({ contentRef, onAfterPrint });
38057
+ const reactToPrintFn = Z({ contentRef, onAfterPrint });
37599
38058
  return /* @__PURE__ */ jsxs(ScopeHost, { className: "", children: [
37600
38059
  /* @__PURE__ */ jsx$1("div", { id, className: `cur-pointer ${className}`, onClick: reactToPrintFn, children }),
37601
38060
  /* @__PURE__ */ jsx$1(
@@ -45668,7 +46127,7 @@ const TicketModalWrapper = (props) => {
45668
46127
  const reportRef = useRef(null);
45669
46128
  const actionButtonsRef = useRef(null);
45670
46129
  const contentRef = useRef(null);
45671
- const reactToPrintFn = libExports.useReactToPrint({ contentRef, onAfterPrint });
46130
+ const reactToPrintFn = Z({ contentRef, onAfterPrint });
45672
46131
  const handleCopyImage = async () => {
45673
46132
  await copyImageToClipboard(contentRef, actionButtonsRef, lotteryLabel[lotteryType], object == null ? void 0 : object.ticketNumber);
45674
46133
  await onAfterPrint();
@@ -53441,7 +53900,7 @@ var StateManagedSelect = /*#__PURE__*/forwardRef(function (props, ref) {
53441
53900
  });
53442
53901
  var StateManagedSelect$1 = StateManagedSelect;
53443
53902
 
53444
- /*! Axios v1.15.2 Copyright (c) 2026 Matt Zabriskie and contributors */
53903
+ /*! Axios v1.16.1 Copyright (c) 2026 Matt Zabriskie and contributors */
53445
53904
 
53446
53905
  /**
53447
53906
  * Create a bound version of a function with a specified `this` context
@@ -53646,9 +54105,9 @@ const isFile = kindOfTest('File');
53646
54105
  * also have a `name` and `type` attribute to specify filename and content type
53647
54106
  *
53648
54107
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
53649
- *
54108
+ *
53650
54109
  * @param {*} value The value to test
53651
- *
54110
+ *
53652
54111
  * @returns {boolean} True if value is a React Native Blob, otherwise false
53653
54112
  */
53654
54113
  const isReactNativeBlob = (value) => {
@@ -53658,9 +54117,9 @@ const isReactNativeBlob = (value) => {
53658
54117
  /**
53659
54118
  * Determine if environment is React Native
53660
54119
  * ReactNative `FormData` has a non-standard `getParts()` method
53661
- *
54120
+ *
53662
54121
  * @param {*} formData The formData to test
53663
- *
54122
+ *
53664
54123
  * @returns {boolean} True if environment is React Native, otherwise false
53665
54124
  */
53666
54125
  const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
@@ -53679,7 +54138,7 @@ const isBlob = kindOfTest('Blob');
53679
54138
  *
53680
54139
  * @param {*} val The value to test
53681
54140
  *
53682
- * @returns {boolean} True if value is a File, otherwise false
54141
+ * @returns {boolean} True if value is a FileList, otherwise false
53683
54142
  */
53684
54143
  const isFileList = kindOfTest('FileList');
53685
54144
 
@@ -53713,14 +54172,16 @@ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
53713
54172
  const isFormData = (thing) => {
53714
54173
  if (!thing) return false;
53715
54174
  if (FormDataCtor && thing instanceof FormDataCtor) return true;
53716
- // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
54175
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
53717
54176
  const proto = getPrototypeOf(thing);
53718
54177
  if (!proto || proto === Object.prototype) return false;
53719
54178
  if (!isFunction$1(thing.append)) return false;
53720
54179
  const kind = kindOf(thing);
53721
- return kind === 'formdata' ||
54180
+ return (
54181
+ kind === 'formdata' ||
53722
54182
  // detect form-data instance
53723
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]');
54183
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
54184
+ );
53724
54185
  };
53725
54186
 
53726
54187
  /**
@@ -53855,7 +54316,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
53855
54316
  *
53856
54317
  * @returns {Object} Result of all merge properties
53857
54318
  */
53858
- function merge(/* obj1, obj2, obj3, ... */) {
54319
+ function merge(...objs) {
53859
54320
  const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
53860
54321
  const result = {};
53861
54322
  const assignValue = (val, key) => {
@@ -53865,8 +54326,12 @@ function merge(/* obj1, obj2, obj3, ... */) {
53865
54326
  }
53866
54327
 
53867
54328
  const targetKey = (caseless && findKey(result, key)) || key;
53868
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
53869
- result[targetKey] = merge(result[targetKey], val);
54329
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
54330
+ // chain, so a polluted Object.prototype value could surface here and get
54331
+ // copied into the merged result.
54332
+ const existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
54333
+ if (isPlainObject(existing) && isPlainObject(val)) {
54334
+ result[targetKey] = merge(existing, val);
53870
54335
  } else if (isPlainObject(val)) {
53871
54336
  result[targetKey] = merge({}, val);
53872
54337
  } else if (isArray(val)) {
@@ -53876,8 +54341,8 @@ function merge(/* obj1, obj2, obj3, ... */) {
53876
54341
  }
53877
54342
  };
53878
54343
 
53879
- for (let i = 0, l = arguments.length; i < l; i++) {
53880
- arguments[i] && forEach(arguments[i], assignValue);
54344
+ for (let i = 0, l = objs.length; i < l; i++) {
54345
+ objs[i] && forEach(objs[i], assignValue);
53881
54346
  }
53882
54347
  return result;
53883
54348
  }
@@ -53899,6 +54364,9 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
53899
54364
  (val, key) => {
53900
54365
  if (thisArg && isFunction$1(val)) {
53901
54366
  Object.defineProperty(a, key, {
54367
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
54368
+ // hijack defineProperty's accessor-vs-data resolution.
54369
+ __proto__: null,
53902
54370
  value: bind(val, thisArg),
53903
54371
  writable: true,
53904
54372
  enumerable: true,
@@ -53906,6 +54374,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
53906
54374
  });
53907
54375
  } else {
53908
54376
  Object.defineProperty(a, key, {
54377
+ __proto__: null,
53909
54378
  value: val,
53910
54379
  writable: true,
53911
54380
  enumerable: true,
@@ -53944,12 +54413,14 @@ const stripBOM = (content) => {
53944
54413
  const inherits = (constructor, superConstructor, props, descriptors) => {
53945
54414
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
53946
54415
  Object.defineProperty(constructor.prototype, 'constructor', {
54416
+ __proto__: null,
53947
54417
  value: constructor,
53948
54418
  writable: true,
53949
54419
  enumerable: false,
53950
54420
  configurable: true,
53951
54421
  });
53952
54422
  Object.defineProperty(constructor, 'super', {
54423
+ __proto__: null,
53953
54424
  value: superConstructor.prototype,
53954
54425
  });
53955
54426
  props && Object.assign(constructor.prototype, props);
@@ -54131,7 +54602,7 @@ const reduceDescriptors = (obj, reducer) => {
54131
54602
  const freezeMethods = (obj) => {
54132
54603
  reduceDescriptors(obj, (descriptor, name) => {
54133
54604
  // skip restricted props in strict mode
54134
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
54605
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
54135
54606
  return false;
54136
54607
  }
54137
54608
 
@@ -54205,11 +54676,11 @@ function isSpecCompliantForm(thing) {
54205
54676
  * @returns {Object} The JSON-compatible object.
54206
54677
  */
54207
54678
  const toJSONObject = (obj) => {
54208
- const stack = new Array(10);
54679
+ const visited = new WeakSet();
54209
54680
 
54210
- const visit = (source, i) => {
54681
+ const visit = (source) => {
54211
54682
  if (isObject(source)) {
54212
- if (stack.indexOf(source) >= 0) {
54683
+ if (visited.has(source)) {
54213
54684
  return;
54214
54685
  }
54215
54686
 
@@ -54219,15 +54690,16 @@ const toJSONObject = (obj) => {
54219
54690
  }
54220
54691
 
54221
54692
  if (!('toJSON' in source)) {
54222
- stack[i] = source;
54693
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
54694
+ visited.add(source);
54223
54695
  const target = isArray(source) ? [] : {};
54224
54696
 
54225
54697
  forEach(source, (value, key) => {
54226
- const reducedValue = visit(value, i + 1);
54698
+ const reducedValue = visit(value);
54227
54699
  !isUndefined(reducedValue) && (target[key] = reducedValue);
54228
54700
  });
54229
54701
 
54230
- stack[i] = undefined;
54702
+ visited.delete(source);
54231
54703
 
54232
54704
  return target;
54233
54705
  }
@@ -54236,7 +54708,7 @@ const toJSONObject = (obj) => {
54236
54708
  return source;
54237
54709
  };
54238
54710
 
54239
- return visit(obj, 0);
54711
+ return visit(obj);
54240
54712
  };
54241
54713
 
54242
54714
  /**
@@ -54372,1311 +54844,1422 @@ var utils$1 = {
54372
54844
  isIterable,
54373
54845
  };
54374
54846
 
54375
- class AxiosError extends Error {
54376
- static from(error, code, config, request, response, customProps) {
54377
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
54378
- axiosError.cause = error;
54379
- axiosError.name = error.name;
54380
-
54381
- // Preserve status from the original error if not already set from response
54382
- if (error.status != null && axiosError.status == null) {
54383
- axiosError.status = error.status;
54384
- }
54385
-
54386
- customProps && Object.assign(axiosError, customProps);
54387
- return axiosError;
54388
- }
54389
-
54390
- /**
54391
- * Create an Error with the specified message, config, error code, request and response.
54392
- *
54393
- * @param {string} message The error message.
54394
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
54395
- * @param {Object} [config] The config.
54396
- * @param {Object} [request] The request.
54397
- * @param {Object} [response] The response.
54398
- *
54399
- * @returns {Error} The created error.
54400
- */
54401
- constructor(message, code, config, request, response) {
54402
- super(message);
54403
-
54404
- // Make message enumerable to maintain backward compatibility
54405
- // The native Error constructor sets message as non-enumerable,
54406
- // but axios < v1.13.3 had it as enumerable
54407
- Object.defineProperty(this, 'message', {
54408
- value: message,
54409
- enumerable: true,
54410
- writable: true,
54411
- configurable: true,
54412
- });
54413
-
54414
- this.name = 'AxiosError';
54415
- this.isAxiosError = true;
54416
- code && (this.code = code);
54417
- config && (this.config = config);
54418
- request && (this.request = request);
54419
- if (response) {
54420
- this.response = response;
54421
- this.status = response.status;
54422
- }
54423
- }
54424
-
54425
- toJSON() {
54426
- return {
54427
- // Standard
54428
- message: this.message,
54429
- name: this.name,
54430
- // Microsoft
54431
- description: this.description,
54432
- number: this.number,
54433
- // Mozilla
54434
- fileName: this.fileName,
54435
- lineNumber: this.lineNumber,
54436
- columnNumber: this.columnNumber,
54437
- stack: this.stack,
54438
- // Axios
54439
- config: utils$1.toJSONObject(this.config),
54440
- code: this.code,
54441
- status: this.status,
54442
- };
54443
- }
54444
- }
54445
-
54446
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
54447
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
54448
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
54449
- AxiosError.ECONNABORTED = 'ECONNABORTED';
54450
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
54451
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
54452
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
54453
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
54454
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
54455
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
54456
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
54457
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
54458
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
54459
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
54460
-
54461
- // eslint-disable-next-line strict
54462
- var httpAdapter = null;
54847
+ // RawAxiosHeaders whose duplicates are ignored by node
54848
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
54849
+ const ignoreDuplicateOf = utils$1.toObjectSet([
54850
+ 'age',
54851
+ 'authorization',
54852
+ 'content-length',
54853
+ 'content-type',
54854
+ 'etag',
54855
+ 'expires',
54856
+ 'from',
54857
+ 'host',
54858
+ 'if-modified-since',
54859
+ 'if-unmodified-since',
54860
+ 'last-modified',
54861
+ 'location',
54862
+ 'max-forwards',
54863
+ 'proxy-authorization',
54864
+ 'referer',
54865
+ 'retry-after',
54866
+ 'user-agent',
54867
+ ]);
54463
54868
 
54464
54869
  /**
54465
- * Determines if the given thing is a array or js object.
54466
- *
54467
- * @param {string} thing - The object or array to be visited.
54870
+ * Parse headers into an object
54468
54871
  *
54469
- * @returns {boolean}
54470
- */
54471
- function isVisitable(thing) {
54472
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
54473
- }
54474
-
54475
- /**
54476
- * It removes the brackets from the end of a string
54872
+ * ```
54873
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
54874
+ * Content-Type: application/json
54875
+ * Connection: keep-alive
54876
+ * Transfer-Encoding: chunked
54877
+ * ```
54477
54878
  *
54478
- * @param {string} key - The key of the parameter.
54879
+ * @param {String} rawHeaders Headers needing to be parsed
54479
54880
  *
54480
- * @returns {string} the key without the brackets.
54881
+ * @returns {Object} Headers parsed into an object
54481
54882
  */
54482
- function removeBrackets(key) {
54483
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
54484
- }
54883
+ var parseHeaders = (rawHeaders) => {
54884
+ const parsed = {};
54885
+ let key;
54886
+ let val;
54887
+ let i;
54485
54888
 
54486
- /**
54487
- * It takes a path, a key, and a boolean, and returns a string
54488
- *
54489
- * @param {string} path - The path to the current key.
54490
- * @param {string} key - The key of the current object being iterated over.
54491
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
54492
- *
54493
- * @returns {string} The path to the current key.
54494
- */
54495
- function renderKey(path, key, dots) {
54496
- if (!path) return key;
54497
- return path
54498
- .concat(key)
54499
- .map(function each(token, i) {
54500
- // eslint-disable-next-line no-param-reassign
54501
- token = removeBrackets(token);
54502
- return !dots && i ? '[' + token + ']' : token;
54503
- })
54504
- .join(dots ? '.' : '');
54505
- }
54889
+ rawHeaders &&
54890
+ rawHeaders.split('\n').forEach(function parser(line) {
54891
+ i = line.indexOf(':');
54892
+ key = line.substring(0, i).trim().toLowerCase();
54893
+ val = line.substring(i + 1).trim();
54506
54894
 
54507
- /**
54508
- * If the array is an array and none of its elements are visitable, then it's a flat array.
54509
- *
54510
- * @param {Array<any>} arr - The array to check
54511
- *
54512
- * @returns {boolean}
54513
- */
54514
- function isFlatArray(arr) {
54515
- return utils$1.isArray(arr) && !arr.some(isVisitable);
54516
- }
54895
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
54896
+ return;
54897
+ }
54517
54898
 
54518
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
54519
- return /^is[A-Z]/.test(prop);
54520
- });
54899
+ if (key === 'set-cookie') {
54900
+ if (parsed[key]) {
54901
+ parsed[key].push(val);
54902
+ } else {
54903
+ parsed[key] = [val];
54904
+ }
54905
+ } else {
54906
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
54907
+ }
54908
+ });
54521
54909
 
54522
- /**
54523
- * Convert a data object to FormData
54524
- *
54525
- * @param {Object} obj
54526
- * @param {?Object} [formData]
54527
- * @param {?Object} [options]
54528
- * @param {Function} [options.visitor]
54529
- * @param {Boolean} [options.metaTokens = true]
54530
- * @param {Boolean} [options.dots = false]
54531
- * @param {?Boolean} [options.indexes = false]
54532
- *
54533
- * @returns {Object}
54534
- **/
54910
+ return parsed;
54911
+ };
54535
54912
 
54536
- /**
54537
- * It converts an object into a FormData object
54538
- *
54539
- * @param {Object<any, any>} obj - The object to convert to form data.
54540
- * @param {string} formData - The FormData object to append to.
54541
- * @param {Object<string, any>} options
54542
- *
54543
- * @returns
54544
- */
54545
- function toFormData(obj, formData, options) {
54546
- if (!utils$1.isObject(obj)) {
54547
- throw new TypeError('target must be an object');
54548
- }
54913
+ function trimSPorHTAB(str) {
54914
+ let start = 0;
54915
+ let end = str.length;
54549
54916
 
54550
- // eslint-disable-next-line no-param-reassign
54551
- formData = formData || new (FormData)();
54917
+ while (start < end) {
54918
+ const code = str.charCodeAt(start);
54552
54919
 
54553
- // eslint-disable-next-line no-param-reassign
54554
- options = utils$1.toFlatObject(
54555
- options,
54556
- {
54557
- metaTokens: true,
54558
- dots: false,
54559
- indexes: false,
54560
- },
54561
- false,
54562
- function defined(option, source) {
54563
- // eslint-disable-next-line no-eq-null,eqeqeq
54564
- return !utils$1.isUndefined(source[option]);
54920
+ if (code !== 0x09 && code !== 0x20) {
54921
+ break;
54565
54922
  }
54566
- );
54567
-
54568
- const metaTokens = options.metaTokens;
54569
- // eslint-disable-next-line no-use-before-define
54570
- const visitor = options.visitor || defaultVisitor;
54571
- const dots = options.dots;
54572
- const indexes = options.indexes;
54573
- const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
54574
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
54575
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
54576
54923
 
54577
- if (!utils$1.isFunction(visitor)) {
54578
- throw new TypeError('visitor must be a function');
54924
+ start += 1;
54579
54925
  }
54580
54926
 
54581
- function convertValue(value) {
54582
- if (value === null) return '';
54927
+ while (end > start) {
54928
+ const code = str.charCodeAt(end - 1);
54583
54929
 
54584
- if (utils$1.isDate(value)) {
54585
- return value.toISOString();
54930
+ if (code !== 0x09 && code !== 0x20) {
54931
+ break;
54586
54932
  }
54587
54933
 
54588
- if (utils$1.isBoolean(value)) {
54589
- return value.toString();
54590
- }
54934
+ end -= 1;
54935
+ }
54591
54936
 
54592
- if (!useBlob && utils$1.isBlob(value)) {
54593
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
54594
- }
54937
+ return start === 0 && end === str.length ? str : str.slice(start, end);
54938
+ }
54595
54939
 
54596
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
54597
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
54598
- }
54940
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
54941
+ // eslint-disable-next-line no-control-regex
54942
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
54943
+ // eslint-disable-next-line no-control-regex
54944
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
54599
54945
 
54600
- return value;
54946
+ function sanitizeValue(value, invalidChars) {
54947
+ if (utils$1.isArray(value)) {
54948
+ return value.map((item) => sanitizeValue(item, invalidChars));
54601
54949
  }
54602
54950
 
54603
- /**
54604
- * Default visitor.
54605
- *
54606
- * @param {*} value
54607
- * @param {String|Number} key
54608
- * @param {Array<String|Number>} path
54609
- * @this {FormData}
54610
- *
54611
- * @returns {boolean} return true to visit the each prop of the value recursively
54612
- */
54613
- function defaultVisitor(value, key, path) {
54614
- let arr = value;
54615
-
54616
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
54617
- formData.append(renderKey(path, key, dots), convertValue(value));
54618
- return false;
54619
- }
54951
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
54952
+ }
54620
54953
 
54621
- if (value && !path && typeof value === 'object') {
54622
- if (utils$1.endsWith(key, '{}')) {
54623
- // eslint-disable-next-line no-param-reassign
54624
- key = metaTokens ? key : key.slice(0, -2);
54625
- // eslint-disable-next-line no-param-reassign
54626
- value = JSON.stringify(value);
54627
- } else if (
54628
- (utils$1.isArray(value) && isFlatArray(value)) ||
54629
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
54630
- ) {
54631
- // eslint-disable-next-line no-param-reassign
54632
- key = removeBrackets(key);
54954
+ const sanitizeHeaderValue = (value) =>
54955
+ sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
54633
54956
 
54634
- arr.forEach(function each(el, index) {
54635
- !(utils$1.isUndefined(el) || el === null) &&
54636
- formData.append(
54637
- // eslint-disable-next-line no-nested-ternary
54638
- indexes === true
54639
- ? renderKey([key], index, dots)
54640
- : indexes === null
54641
- ? key
54642
- : key + '[]',
54643
- convertValue(el)
54644
- );
54645
- });
54646
- return false;
54647
- }
54648
- }
54957
+ const sanitizeByteStringHeaderValue = (value) =>
54958
+ sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
54649
54959
 
54650
- if (isVisitable(value)) {
54651
- return true;
54652
- }
54960
+ function toByteStringHeaderObject(headers) {
54961
+ const byteStringHeaders = Object.create(null);
54653
54962
 
54654
- formData.append(renderKey(path, key, dots), convertValue(value));
54963
+ utils$1.forEach(headers.toJSON(), (value, header) => {
54964
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
54965
+ });
54655
54966
 
54656
- return false;
54657
- }
54967
+ return byteStringHeaders;
54968
+ }
54658
54969
 
54659
- const stack = [];
54970
+ const $internals = Symbol('internals');
54660
54971
 
54661
- const exposedHelpers = Object.assign(predicates, {
54662
- defaultVisitor,
54663
- convertValue,
54664
- isVisitable,
54665
- });
54972
+ function normalizeHeader(header) {
54973
+ return header && String(header).trim().toLowerCase();
54974
+ }
54666
54975
 
54667
- function build(value, path, depth = 0) {
54668
- if (utils$1.isUndefined(value)) return;
54976
+ function normalizeValue(value) {
54977
+ if (value === false || value == null) {
54978
+ return value;
54979
+ }
54669
54980
 
54670
- if (depth > maxDepth) {
54671
- throw new AxiosError(
54672
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
54673
- AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
54674
- );
54675
- }
54981
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
54982
+ }
54676
54983
 
54677
- if (stack.indexOf(value) !== -1) {
54678
- throw Error('Circular reference detected in ' + path.join('.'));
54679
- }
54984
+ function parseTokens(str) {
54985
+ const tokens = Object.create(null);
54986
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
54987
+ let match;
54680
54988
 
54681
- stack.push(value);
54989
+ while ((match = tokensRE.exec(str))) {
54990
+ tokens[match[1]] = match[2];
54991
+ }
54682
54992
 
54683
- utils$1.forEach(value, function each(el, key) {
54684
- const result =
54685
- !(utils$1.isUndefined(el) || el === null) &&
54686
- visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
54993
+ return tokens;
54994
+ }
54687
54995
 
54688
- if (result === true) {
54689
- build(el, path ? path.concat(key) : [key], depth + 1);
54690
- }
54691
- });
54996
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
54692
54997
 
54693
- stack.pop();
54998
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
54999
+ if (utils$1.isFunction(filter)) {
55000
+ return filter.call(this, value, header);
54694
55001
  }
54695
55002
 
54696
- if (!utils$1.isObject(obj)) {
54697
- throw new TypeError('data must be an object');
55003
+ if (isHeaderNameFilter) {
55004
+ value = header;
54698
55005
  }
54699
55006
 
54700
- build(obj);
55007
+ if (!utils$1.isString(value)) return;
54701
55008
 
54702
- return formData;
55009
+ if (utils$1.isString(filter)) {
55010
+ return value.indexOf(filter) !== -1;
55011
+ }
55012
+
55013
+ if (utils$1.isRegExp(filter)) {
55014
+ return filter.test(value);
55015
+ }
54703
55016
  }
54704
55017
 
54705
- /**
54706
- * It encodes a string by replacing all characters that are not in the unreserved set with
54707
- * their percent-encoded equivalents
54708
- *
54709
- * @param {string} str - The string to encode.
54710
- *
54711
- * @returns {string} The encoded string.
54712
- */
54713
- function encode$1(str) {
54714
- const charMap = {
54715
- '!': '%21',
54716
- "'": '%27',
54717
- '(': '%28',
54718
- ')': '%29',
54719
- '~': '%7E',
54720
- '%20': '+',
54721
- };
54722
- return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
54723
- return charMap[match];
54724
- });
55018
+ function formatHeader(header) {
55019
+ return header
55020
+ .trim()
55021
+ .toLowerCase()
55022
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
55023
+ return char.toUpperCase() + str;
55024
+ });
54725
55025
  }
54726
55026
 
54727
- /**
54728
- * It takes a params object and converts it to a FormData object
54729
- *
54730
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
54731
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
54732
- *
54733
- * @returns {void}
54734
- */
54735
- function AxiosURLSearchParams(params, options) {
54736
- this._pairs = [];
55027
+ function buildAccessors(obj, header) {
55028
+ const accessorName = utils$1.toCamelCase(' ' + header);
54737
55029
 
54738
- params && toFormData(params, this, options);
55030
+ ['get', 'set', 'has'].forEach((methodName) => {
55031
+ Object.defineProperty(obj, methodName + accessorName, {
55032
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
55033
+ // this data descriptor into an accessor descriptor on the way in.
55034
+ __proto__: null,
55035
+ value: function (arg1, arg2, arg3) {
55036
+ return this[methodName].call(this, header, arg1, arg2, arg3);
55037
+ },
55038
+ configurable: true,
55039
+ });
55040
+ });
54739
55041
  }
54740
55042
 
54741
- const prototype = AxiosURLSearchParams.prototype;
55043
+ class AxiosHeaders {
55044
+ constructor(headers) {
55045
+ headers && this.set(headers);
55046
+ }
54742
55047
 
54743
- prototype.append = function append(name, value) {
54744
- this._pairs.push([name, value]);
54745
- };
55048
+ set(header, valueOrRewrite, rewrite) {
55049
+ const self = this;
54746
55050
 
54747
- prototype.toString = function toString(encoder) {
54748
- const _encode = encoder
54749
- ? function (value) {
54750
- return encoder.call(this, value, encode$1);
55051
+ function setHeader(_value, _header, _rewrite) {
55052
+ const lHeader = normalizeHeader(_header);
55053
+
55054
+ if (!lHeader) {
55055
+ throw new Error('header name must be a non-empty string');
54751
55056
  }
54752
- : encode$1;
54753
55057
 
54754
- return this._pairs
54755
- .map(function each(pair) {
54756
- return _encode(pair[0]) + '=' + _encode(pair[1]);
54757
- }, '')
54758
- .join('&');
54759
- };
55058
+ const key = utils$1.findKey(self, lHeader);
54760
55059
 
54761
- /**
54762
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
54763
- * their plain counterparts (`:`, `$`, `,`, `+`).
54764
- *
54765
- * @param {string} val The value to be encoded.
54766
- *
54767
- * @returns {string} The encoded value.
54768
- */
54769
- function encode(val) {
54770
- return encodeURIComponent(val)
54771
- .replace(/%3A/gi, ':')
54772
- .replace(/%24/g, '$')
54773
- .replace(/%2C/gi, ',')
54774
- .replace(/%20/g, '+');
54775
- }
55060
+ if (
55061
+ !key ||
55062
+ self[key] === undefined ||
55063
+ _rewrite === true ||
55064
+ (_rewrite === undefined && self[key] !== false)
55065
+ ) {
55066
+ self[key || _header] = normalizeValue(_value);
55067
+ }
55068
+ }
54776
55069
 
54777
- /**
54778
- * Build a URL by appending params to the end
54779
- *
54780
- * @param {string} url The base of the url (e.g., http://www.google.com)
54781
- * @param {object} [params] The params to be appended
54782
- * @param {?(object|Function)} options
54783
- *
54784
- * @returns {string} The formatted url
54785
- */
54786
- function buildURL(url, params, options) {
54787
- if (!params) {
54788
- return url;
54789
- }
55070
+ const setHeaders = (headers, _rewrite) =>
55071
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
54790
55072
 
54791
- const _encode = (options && options.encode) || encode;
55073
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
55074
+ setHeaders(header, valueOrRewrite);
55075
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
55076
+ setHeaders(parseHeaders(header), valueOrRewrite);
55077
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
55078
+ let obj = {},
55079
+ dest,
55080
+ key;
55081
+ for (const entry of header) {
55082
+ if (!utils$1.isArray(entry)) {
55083
+ throw TypeError('Object iterator must return a key-value pair');
55084
+ }
54792
55085
 
54793
- const _options = utils$1.isFunction(options)
54794
- ? {
54795
- serialize: options,
55086
+ obj[(key = entry[0])] = (dest = obj[key])
55087
+ ? utils$1.isArray(dest)
55088
+ ? [...dest, entry[1]]
55089
+ : [dest, entry[1]]
55090
+ : entry[1];
54796
55091
  }
54797
- : options;
54798
-
54799
- const serializeFn = _options && _options.serialize;
54800
55092
 
54801
- let serializedParams;
55093
+ setHeaders(obj, valueOrRewrite);
55094
+ } else {
55095
+ header != null && setHeader(valueOrRewrite, header, rewrite);
55096
+ }
54802
55097
 
54803
- if (serializeFn) {
54804
- serializedParams = serializeFn(params, _options);
54805
- } else {
54806
- serializedParams = utils$1.isURLSearchParams(params)
54807
- ? params.toString()
54808
- : new AxiosURLSearchParams(params, _options).toString(_encode);
55098
+ return this;
54809
55099
  }
54810
55100
 
54811
- if (serializedParams) {
54812
- const hashmarkIndex = url.indexOf('#');
55101
+ get(header, parser) {
55102
+ header = normalizeHeader(header);
54813
55103
 
54814
- if (hashmarkIndex !== -1) {
54815
- url = url.slice(0, hashmarkIndex);
54816
- }
54817
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
54818
- }
55104
+ if (header) {
55105
+ const key = utils$1.findKey(this, header);
54819
55106
 
54820
- return url;
54821
- }
55107
+ if (key) {
55108
+ const value = this[key];
54822
55109
 
54823
- class InterceptorManager {
54824
- constructor() {
54825
- this.handlers = [];
54826
- }
55110
+ if (!parser) {
55111
+ return value;
55112
+ }
54827
55113
 
54828
- /**
54829
- * Add a new interceptor to the stack
54830
- *
54831
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
54832
- * @param {Function} rejected The function to handle `reject` for a `Promise`
54833
- * @param {Object} options The options for the interceptor, synchronous and runWhen
54834
- *
54835
- * @return {Number} An ID used to remove interceptor later
54836
- */
54837
- use(fulfilled, rejected, options) {
54838
- this.handlers.push({
54839
- fulfilled,
54840
- rejected,
54841
- synchronous: options ? options.synchronous : false,
54842
- runWhen: options ? options.runWhen : null,
54843
- });
54844
- return this.handlers.length - 1;
54845
- }
55114
+ if (parser === true) {
55115
+ return parseTokens(value);
55116
+ }
54846
55117
 
54847
- /**
54848
- * Remove an interceptor from the stack
54849
- *
54850
- * @param {Number} id The ID that was returned by `use`
54851
- *
54852
- * @returns {void}
54853
- */
54854
- eject(id) {
54855
- if (this.handlers[id]) {
54856
- this.handlers[id] = null;
54857
- }
54858
- }
55118
+ if (utils$1.isFunction(parser)) {
55119
+ return parser.call(this, value, key);
55120
+ }
54859
55121
 
54860
- /**
54861
- * Clear all interceptors from the stack
54862
- *
54863
- * @returns {void}
54864
- */
54865
- clear() {
54866
- if (this.handlers) {
54867
- this.handlers = [];
54868
- }
54869
- }
55122
+ if (utils$1.isRegExp(parser)) {
55123
+ return parser.exec(value);
55124
+ }
54870
55125
 
54871
- /**
54872
- * Iterate over all the registered interceptors
54873
- *
54874
- * This method is particularly useful for skipping over any
54875
- * interceptors that may have become `null` calling `eject`.
54876
- *
54877
- * @param {Function} fn The function to call for each interceptor
54878
- *
54879
- * @returns {void}
54880
- */
54881
- forEach(fn) {
54882
- utils$1.forEach(this.handlers, function forEachHandler(h) {
54883
- if (h !== null) {
54884
- fn(h);
55126
+ throw new TypeError('parser must be boolean|regexp|function');
54885
55127
  }
54886
- });
55128
+ }
54887
55129
  }
54888
- }
54889
55130
 
54890
- var transitionalDefaults = {
54891
- silentJSONParsing: true,
54892
- forcedJSONParsing: true,
54893
- clarifyTimeoutError: false,
54894
- legacyInterceptorReqResOrdering: true,
54895
- };
55131
+ has(header, matcher) {
55132
+ header = normalizeHeader(header);
54896
55133
 
54897
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
55134
+ if (header) {
55135
+ const key = utils$1.findKey(this, header);
54898
55136
 
54899
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
55137
+ return !!(
55138
+ key &&
55139
+ this[key] !== undefined &&
55140
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
55141
+ );
55142
+ }
54900
55143
 
54901
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
55144
+ return false;
55145
+ }
54902
55146
 
54903
- var platform$1 = {
54904
- isBrowser: true,
54905
- classes: {
54906
- URLSearchParams: URLSearchParams$1,
54907
- FormData: FormData$1,
54908
- Blob: Blob$1,
54909
- },
54910
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
54911
- };
55147
+ delete(header, matcher) {
55148
+ const self = this;
55149
+ let deleted = false;
54912
55150
 
54913
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
55151
+ function deleteHeader(_header) {
55152
+ _header = normalizeHeader(_header);
54914
55153
 
54915
- const _navigator = (typeof navigator === 'object' && navigator) || undefined;
55154
+ if (_header) {
55155
+ const key = utils$1.findKey(self, _header);
54916
55156
 
54917
- /**
54918
- * Determine if we're running in a standard browser environment
54919
- *
54920
- * This allows axios to run in a web worker, and react-native.
54921
- * Both environments support XMLHttpRequest, but not fully standard globals.
54922
- *
54923
- * web workers:
54924
- * typeof window -> undefined
54925
- * typeof document -> undefined
54926
- *
54927
- * react-native:
54928
- * navigator.product -> 'ReactNative'
54929
- * nativescript
54930
- * navigator.product -> 'NativeScript' or 'NS'
54931
- *
54932
- * @returns {boolean}
54933
- */
54934
- const hasStandardBrowserEnv =
54935
- hasBrowserEnv &&
54936
- (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
55157
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
55158
+ delete self[key];
54937
55159
 
54938
- /**
54939
- * Determine if we're running in a standard browser webWorker environment
54940
- *
54941
- * Although the `isStandardBrowserEnv` method indicates that
54942
- * `allows axios to run in a web worker`, the WebWorker will still be
54943
- * filtered out due to its judgment standard
54944
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
54945
- * This leads to a problem when axios post `FormData` in webWorker
54946
- */
54947
- const hasStandardBrowserWebWorkerEnv = (() => {
54948
- return (
54949
- typeof WorkerGlobalScope !== 'undefined' &&
54950
- // eslint-disable-next-line no-undef
54951
- self instanceof WorkerGlobalScope &&
54952
- typeof self.importScripts === 'function'
54953
- );
54954
- })();
55160
+ deleted = true;
55161
+ }
55162
+ }
55163
+ }
54955
55164
 
54956
- const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
55165
+ if (utils$1.isArray(header)) {
55166
+ header.forEach(deleteHeader);
55167
+ } else {
55168
+ deleteHeader(header);
55169
+ }
54957
55170
 
54958
- var utils = /*#__PURE__*/Object.freeze({
54959
- __proto__: null,
54960
- hasBrowserEnv: hasBrowserEnv,
54961
- hasStandardBrowserEnv: hasStandardBrowserEnv,
54962
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
54963
- navigator: _navigator,
54964
- origin: origin
54965
- });
55171
+ return deleted;
55172
+ }
54966
55173
 
54967
- var platform = {
54968
- ...utils,
54969
- ...platform$1,
54970
- };
55174
+ clear(matcher) {
55175
+ const keys = Object.keys(this);
55176
+ let i = keys.length;
55177
+ let deleted = false;
54971
55178
 
54972
- function toURLEncodedForm(data, options) {
54973
- return toFormData(data, new platform.classes.URLSearchParams(), {
54974
- visitor: function (value, key, path, helpers) {
54975
- if (platform.isNode && utils$1.isBuffer(value)) {
54976
- this.append(key, value.toString('base64'));
54977
- return false;
55179
+ while (i--) {
55180
+ const key = keys[i];
55181
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
55182
+ delete this[key];
55183
+ deleted = true;
54978
55184
  }
55185
+ }
54979
55186
 
54980
- return helpers.defaultVisitor.apply(this, arguments);
54981
- },
54982
- ...options,
54983
- });
54984
- }
54985
-
54986
- /**
54987
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
54988
- *
54989
- * @param {string} name - The name of the property to get.
54990
- *
54991
- * @returns An array of strings.
54992
- */
54993
- function parsePropPath(name) {
54994
- // foo[x][y][z]
54995
- // foo.x.y.z
54996
- // foo-x-y-z
54997
- // foo x y z
54998
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
54999
- return match[0] === '[]' ? '' : match[1] || match[0];
55000
- });
55001
- }
55002
-
55003
- /**
55004
- * Convert an array to an object.
55005
- *
55006
- * @param {Array<any>} arr - The array to convert to an object.
55007
- *
55008
- * @returns An object with the same keys and values as the array.
55009
- */
55010
- function arrayToObject(arr) {
55011
- const obj = {};
55012
- const keys = Object.keys(arr);
55013
- let i;
55014
- const len = keys.length;
55015
- let key;
55016
- for (i = 0; i < len; i++) {
55017
- key = keys[i];
55018
- obj[key] = arr[key];
55187
+ return deleted;
55019
55188
  }
55020
- return obj;
55021
- }
55022
-
55023
- /**
55024
- * It takes a FormData object and returns a JavaScript object
55025
- *
55026
- * @param {string} formData The FormData object to convert to JSON.
55027
- *
55028
- * @returns {Object<string, any> | null} The converted object.
55029
- */
55030
- function formDataToJSON(formData) {
55031
- function buildPath(path, value, target, index) {
55032
- let name = path[index++];
55033
55189
 
55034
- if (name === '__proto__') return true;
55190
+ normalize(format) {
55191
+ const self = this;
55192
+ const headers = {};
55035
55193
 
55036
- const isNumericKey = Number.isFinite(+name);
55037
- const isLast = index >= path.length;
55038
- name = !name && utils$1.isArray(target) ? target.length : name;
55194
+ utils$1.forEach(this, (value, header) => {
55195
+ const key = utils$1.findKey(headers, header);
55039
55196
 
55040
- if (isLast) {
55041
- if (utils$1.hasOwnProp(target, name)) {
55042
- target[name] = utils$1.isArray(target[name])
55043
- ? target[name].concat(value)
55044
- : [target[name], value];
55045
- } else {
55046
- target[name] = value;
55197
+ if (key) {
55198
+ self[key] = normalizeValue(value);
55199
+ delete self[header];
55200
+ return;
55047
55201
  }
55048
55202
 
55049
- return !isNumericKey;
55050
- }
55203
+ const normalized = format ? formatHeader(header) : String(header).trim();
55051
55204
 
55052
- if (!target[name] || !utils$1.isObject(target[name])) {
55053
- target[name] = [];
55054
- }
55205
+ if (normalized !== header) {
55206
+ delete self[header];
55207
+ }
55055
55208
 
55056
- const result = buildPath(path, value, target[name], index);
55209
+ self[normalized] = normalizeValue(value);
55057
55210
 
55058
- if (result && utils$1.isArray(target[name])) {
55059
- target[name] = arrayToObject(target[name]);
55060
- }
55211
+ headers[normalized] = true;
55212
+ });
55061
55213
 
55062
- return !isNumericKey;
55214
+ return this;
55063
55215
  }
55064
55216
 
55065
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
55066
- const obj = {};
55217
+ concat(...targets) {
55218
+ return this.constructor.concat(this, ...targets);
55219
+ }
55067
55220
 
55068
- utils$1.forEachEntry(formData, (name, value) => {
55069
- buildPath(parsePropPath(name), value, obj, 0);
55221
+ toJSON(asStrings) {
55222
+ const obj = Object.create(null);
55223
+
55224
+ utils$1.forEach(this, (value, header) => {
55225
+ value != null &&
55226
+ value !== false &&
55227
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
55070
55228
  });
55071
55229
 
55072
55230
  return obj;
55073
55231
  }
55074
55232
 
55075
- return null;
55076
- }
55077
-
55078
- const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
55233
+ [Symbol.iterator]() {
55234
+ return Object.entries(this.toJSON())[Symbol.iterator]();
55235
+ }
55079
55236
 
55080
- /**
55081
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
55082
- * of the input
55083
- *
55084
- * @param {any} rawValue - The value to be stringified.
55085
- * @param {Function} parser - A function that parses a string into a JavaScript object.
55086
- * @param {Function} encoder - A function that takes a value and returns a string.
55087
- *
55088
- * @returns {string} A stringified version of the rawValue.
55089
- */
55090
- function stringifySafely(rawValue, parser, encoder) {
55091
- if (utils$1.isString(rawValue)) {
55092
- try {
55093
- (parser || JSON.parse)(rawValue);
55094
- return utils$1.trim(rawValue);
55095
- } catch (e) {
55096
- if (e.name !== 'SyntaxError') {
55097
- throw e;
55098
- }
55099
- }
55237
+ toString() {
55238
+ return Object.entries(this.toJSON())
55239
+ .map(([header, value]) => header + ': ' + value)
55240
+ .join('\n');
55100
55241
  }
55101
55242
 
55102
- return (encoder || JSON.stringify)(rawValue);
55103
- }
55243
+ getSetCookie() {
55244
+ return this.get('set-cookie') || [];
55245
+ }
55104
55246
 
55105
- const defaults = {
55106
- transitional: transitionalDefaults,
55247
+ get [Symbol.toStringTag]() {
55248
+ return 'AxiosHeaders';
55249
+ }
55107
55250
 
55108
- adapter: ['xhr', 'http', 'fetch'],
55251
+ static from(thing) {
55252
+ return thing instanceof this ? thing : new this(thing);
55253
+ }
55109
55254
 
55110
- transformRequest: [
55111
- function transformRequest(data, headers) {
55112
- const contentType = headers.getContentType() || '';
55113
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
55114
- const isObjectPayload = utils$1.isObject(data);
55255
+ static concat(first, ...targets) {
55256
+ const computed = new this(first);
55115
55257
 
55116
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
55117
- data = new FormData(data);
55118
- }
55258
+ targets.forEach((target) => computed.set(target));
55119
55259
 
55120
- const isFormData = utils$1.isFormData(data);
55260
+ return computed;
55261
+ }
55121
55262
 
55122
- if (isFormData) {
55123
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
55124
- }
55263
+ static accessor(header) {
55264
+ const internals =
55265
+ (this[$internals] =
55266
+ this[$internals] =
55267
+ {
55268
+ accessors: {},
55269
+ });
55125
55270
 
55126
- if (
55127
- utils$1.isArrayBuffer(data) ||
55128
- utils$1.isBuffer(data) ||
55129
- utils$1.isStream(data) ||
55130
- utils$1.isFile(data) ||
55131
- utils$1.isBlob(data) ||
55132
- utils$1.isReadableStream(data)
55133
- ) {
55134
- return data;
55135
- }
55136
- if (utils$1.isArrayBufferView(data)) {
55137
- return data.buffer;
55138
- }
55139
- if (utils$1.isURLSearchParams(data)) {
55140
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
55141
- return data.toString();
55142
- }
55271
+ const accessors = internals.accessors;
55272
+ const prototype = this.prototype;
55143
55273
 
55144
- let isFileList;
55274
+ function defineAccessor(_header) {
55275
+ const lHeader = normalizeHeader(_header);
55145
55276
 
55146
- if (isObjectPayload) {
55147
- const formSerializer = own(this, 'formSerializer');
55148
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
55149
- return toURLEncodedForm(data, formSerializer).toString();
55150
- }
55277
+ if (!accessors[lHeader]) {
55278
+ buildAccessors(prototype, _header);
55279
+ accessors[lHeader] = true;
55280
+ }
55281
+ }
55151
55282
 
55152
- if (
55153
- (isFileList = utils$1.isFileList(data)) ||
55154
- contentType.indexOf('multipart/form-data') > -1
55155
- ) {
55156
- const env = own(this, 'env');
55157
- const _FormData = env && env.FormData;
55283
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
55158
55284
 
55159
- return toFormData(
55160
- isFileList ? { 'files[]': data } : data,
55161
- _FormData && new _FormData(),
55162
- formSerializer
55163
- );
55164
- }
55165
- }
55285
+ return this;
55286
+ }
55287
+ }
55166
55288
 
55167
- if (isObjectPayload || hasJSONContentType) {
55168
- headers.setContentType('application/json', false);
55169
- return stringifySafely(data);
55170
- }
55289
+ AxiosHeaders.accessor([
55290
+ 'Content-Type',
55291
+ 'Content-Length',
55292
+ 'Accept',
55293
+ 'Accept-Encoding',
55294
+ 'User-Agent',
55295
+ 'Authorization',
55296
+ ]);
55171
55297
 
55172
- return data;
55298
+ // reserved names hotfix
55299
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
55300
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
55301
+ return {
55302
+ get: () => value,
55303
+ set(headerValue) {
55304
+ this[mapped] = headerValue;
55173
55305
  },
55174
- ],
55306
+ };
55307
+ });
55175
55308
 
55176
- transformResponse: [
55177
- function transformResponse(data) {
55178
- const transitional = own(this, 'transitional') || defaults.transitional;
55179
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
55180
- const responseType = own(this, 'responseType');
55181
- const JSONRequested = responseType === 'json';
55309
+ utils$1.freezeMethods(AxiosHeaders);
55182
55310
 
55183
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
55184
- return data;
55185
- }
55311
+ const REDACTED = '[REDACTED ****]';
55186
55312
 
55187
- if (
55188
- data &&
55189
- utils$1.isString(data) &&
55190
- ((forcedJSONParsing && !responseType) || JSONRequested)
55191
- ) {
55192
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
55193
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
55313
+ function hasOwnOrPrototypeToJSON(source) {
55314
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
55315
+ return true;
55316
+ }
55194
55317
 
55195
- try {
55196
- return JSON.parse(data, own(this, 'parseReviver'));
55197
- } catch (e) {
55198
- if (strictJSONParsing) {
55199
- if (e.name === 'SyntaxError') {
55200
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
55201
- }
55202
- throw e;
55203
- }
55318
+ let prototype = Object.getPrototypeOf(source);
55319
+
55320
+ while (prototype && prototype !== Object.prototype) {
55321
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
55322
+ return true;
55323
+ }
55324
+
55325
+ prototype = Object.getPrototypeOf(prototype);
55326
+ }
55327
+
55328
+ return false;
55329
+ }
55330
+
55331
+ // Build a plain-object snapshot of `config` and replace the value of any key
55332
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
55333
+ // and AxiosHeaders, and short-circuits on circular references.
55334
+ function redactConfig(config, redactKeys) {
55335
+ const lowerKeys = new Set(redactKeys.map((k) => String(k).toLowerCase()));
55336
+ const seen = [];
55337
+
55338
+ const visit = (source) => {
55339
+ if (source === null || typeof source !== 'object') return source;
55340
+ if (utils$1.isBuffer(source)) return source;
55341
+ if (seen.indexOf(source) !== -1) return undefined;
55342
+
55343
+ if (source instanceof AxiosHeaders) {
55344
+ source = source.toJSON();
55345
+ }
55346
+
55347
+ seen.push(source);
55348
+
55349
+ let result;
55350
+ if (utils$1.isArray(source)) {
55351
+ result = [];
55352
+ source.forEach((v, i) => {
55353
+ const reducedValue = visit(v);
55354
+ if (!utils$1.isUndefined(reducedValue)) {
55355
+ result[i] = reducedValue;
55204
55356
  }
55357
+ });
55358
+ } else {
55359
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
55360
+ seen.pop();
55361
+ return source;
55205
55362
  }
55206
55363
 
55207
- return data;
55208
- },
55209
- ],
55364
+ result = Object.create(null);
55365
+ for (const [key, value] of Object.entries(source)) {
55366
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : visit(value);
55367
+ if (!utils$1.isUndefined(reducedValue)) {
55368
+ result[key] = reducedValue;
55369
+ }
55370
+ }
55371
+ }
55372
+
55373
+ seen.pop();
55374
+ return result;
55375
+ };
55376
+
55377
+ return visit(config);
55378
+ }
55379
+
55380
+ class AxiosError extends Error {
55381
+ static from(error, code, config, request, response, customProps) {
55382
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
55383
+ axiosError.cause = error;
55384
+ axiosError.name = error.name;
55385
+
55386
+ // Preserve status from the original error if not already set from response
55387
+ if (error.status != null && axiosError.status == null) {
55388
+ axiosError.status = error.status;
55389
+ }
55390
+
55391
+ customProps && Object.assign(axiosError, customProps);
55392
+ return axiosError;
55393
+ }
55210
55394
 
55211
55395
  /**
55212
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
55213
- * timeout is not created.
55396
+ * Create an Error with the specified message, config, error code, request and response.
55397
+ *
55398
+ * @param {string} message The error message.
55399
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
55400
+ * @param {Object} [config] The config.
55401
+ * @param {Object} [request] The request.
55402
+ * @param {Object} [response] The response.
55403
+ *
55404
+ * @returns {Error} The created error.
55214
55405
  */
55215
- timeout: 0,
55406
+ constructor(message, code, config, request, response) {
55407
+ super(message);
55216
55408
 
55217
- xsrfCookieName: 'XSRF-TOKEN',
55218
- xsrfHeaderName: 'X-XSRF-TOKEN',
55409
+ // Make message enumerable to maintain backward compatibility
55410
+ // The native Error constructor sets message as non-enumerable,
55411
+ // but axios < v1.13.3 had it as enumerable
55412
+ Object.defineProperty(this, 'message', {
55413
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
55414
+ // this data descriptor into an accessor descriptor on the way in.
55415
+ __proto__: null,
55416
+ value: message,
55417
+ enumerable: true,
55418
+ writable: true,
55419
+ configurable: true,
55420
+ });
55219
55421
 
55220
- maxContentLength: -1,
55221
- maxBodyLength: -1,
55422
+ this.name = 'AxiosError';
55423
+ this.isAxiosError = true;
55424
+ code && (this.code = code);
55425
+ config && (this.config = config);
55426
+ request && (this.request = request);
55427
+ if (response) {
55428
+ this.response = response;
55429
+ this.status = response.status;
55430
+ }
55431
+ }
55222
55432
 
55223
- env: {
55224
- FormData: platform.classes.FormData,
55225
- Blob: platform.classes.Blob,
55226
- },
55433
+ toJSON() {
55434
+ // Opt-in redaction: when the request config carries a `redact` array, the
55435
+ // value of any matching key (case-insensitive, at any depth) is replaced
55436
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
55437
+ // existing serialization behavior unchanged.
55438
+ const config = this.config;
55439
+ const redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
55440
+ const serializedConfig =
55441
+ utils$1.isArray(redactKeys) && redactKeys.length > 0
55442
+ ? redactConfig(config, redactKeys)
55443
+ : utils$1.toJSONObject(config);
55227
55444
 
55228
- validateStatus: function validateStatus(status) {
55229
- return status >= 200 && status < 300;
55230
- },
55445
+ return {
55446
+ // Standard
55447
+ message: this.message,
55448
+ name: this.name,
55449
+ // Microsoft
55450
+ description: this.description,
55451
+ number: this.number,
55452
+ // Mozilla
55453
+ fileName: this.fileName,
55454
+ lineNumber: this.lineNumber,
55455
+ columnNumber: this.columnNumber,
55456
+ stack: this.stack,
55457
+ // Axios
55458
+ config: serializedConfig,
55459
+ code: this.code,
55460
+ status: this.status,
55461
+ };
55462
+ }
55463
+ }
55231
55464
 
55232
- headers: {
55233
- common: {
55234
- Accept: 'application/json, text/plain, */*',
55235
- 'Content-Type': undefined,
55236
- },
55237
- },
55238
- };
55465
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
55466
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
55467
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
55468
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
55469
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
55470
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
55471
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
55472
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
55473
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
55474
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
55475
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
55476
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
55477
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
55478
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
55479
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
55239
55480
 
55240
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
55241
- defaults.headers[method] = {};
55242
- });
55481
+ // eslint-disable-next-line strict
55482
+ var httpAdapter = null;
55243
55483
 
55244
- // RawAxiosHeaders whose duplicates are ignored by node
55245
- // c.f. https://nodejs.org/api/http.html#http_message_headers
55246
- const ignoreDuplicateOf = utils$1.toObjectSet([
55247
- 'age',
55248
- 'authorization',
55249
- 'content-length',
55250
- 'content-type',
55251
- 'etag',
55252
- 'expires',
55253
- 'from',
55254
- 'host',
55255
- 'if-modified-since',
55256
- 'if-unmodified-since',
55257
- 'last-modified',
55258
- 'location',
55259
- 'max-forwards',
55260
- 'proxy-authorization',
55261
- 'referer',
55262
- 'retry-after',
55263
- 'user-agent',
55264
- ]);
55484
+ /**
55485
+ * Determines if the given thing is a array or js object.
55486
+ *
55487
+ * @param {string} thing - The object or array to be visited.
55488
+ *
55489
+ * @returns {boolean}
55490
+ */
55491
+ function isVisitable(thing) {
55492
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
55493
+ }
55265
55494
 
55266
55495
  /**
55267
- * Parse headers into an object
55496
+ * It removes the brackets from the end of a string
55268
55497
  *
55269
- * ```
55270
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
55271
- * Content-Type: application/json
55272
- * Connection: keep-alive
55273
- * Transfer-Encoding: chunked
55274
- * ```
55498
+ * @param {string} key - The key of the parameter.
55275
55499
  *
55276
- * @param {String} rawHeaders Headers needing to be parsed
55500
+ * @returns {string} the key without the brackets.
55501
+ */
55502
+ function removeBrackets(key) {
55503
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
55504
+ }
55505
+
55506
+ /**
55507
+ * It takes a path, a key, and a boolean, and returns a string
55277
55508
  *
55278
- * @returns {Object} Headers parsed into an object
55509
+ * @param {string} path - The path to the current key.
55510
+ * @param {string} key - The key of the current object being iterated over.
55511
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
55512
+ *
55513
+ * @returns {string} The path to the current key.
55279
55514
  */
55280
- var parseHeaders = (rawHeaders) => {
55281
- const parsed = {};
55282
- let key;
55283
- let val;
55284
- let i;
55515
+ function renderKey(path, key, dots) {
55516
+ if (!path) return key;
55517
+ return path
55518
+ .concat(key)
55519
+ .map(function each(token, i) {
55520
+ // eslint-disable-next-line no-param-reassign
55521
+ token = removeBrackets(token);
55522
+ return !dots && i ? '[' + token + ']' : token;
55523
+ })
55524
+ .join(dots ? '.' : '');
55525
+ }
55285
55526
 
55286
- rawHeaders &&
55287
- rawHeaders.split('\n').forEach(function parser(line) {
55288
- i = line.indexOf(':');
55289
- key = line.substring(0, i).trim().toLowerCase();
55290
- val = line.substring(i + 1).trim();
55527
+ /**
55528
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
55529
+ *
55530
+ * @param {Array<any>} arr - The array to check
55531
+ *
55532
+ * @returns {boolean}
55533
+ */
55534
+ function isFlatArray(arr) {
55535
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
55536
+ }
55291
55537
 
55292
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
55293
- return;
55294
- }
55538
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
55539
+ return /^is[A-Z]/.test(prop);
55540
+ });
55295
55541
 
55296
- if (key === 'set-cookie') {
55297
- if (parsed[key]) {
55298
- parsed[key].push(val);
55299
- } else {
55300
- parsed[key] = [val];
55301
- }
55302
- } else {
55303
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
55304
- }
55305
- });
55542
+ /**
55543
+ * Convert a data object to FormData
55544
+ *
55545
+ * @param {Object} obj
55546
+ * @param {?Object} [formData]
55547
+ * @param {?Object} [options]
55548
+ * @param {Function} [options.visitor]
55549
+ * @param {Boolean} [options.metaTokens = true]
55550
+ * @param {Boolean} [options.dots = false]
55551
+ * @param {?Boolean} [options.indexes = false]
55552
+ *
55553
+ * @returns {Object}
55554
+ **/
55306
55555
 
55307
- return parsed;
55308
- };
55556
+ /**
55557
+ * It converts an object into a FormData object
55558
+ *
55559
+ * @param {Object<any, any>} obj - The object to convert to form data.
55560
+ * @param {string} formData - The FormData object to append to.
55561
+ * @param {Object<string, any>} options
55562
+ *
55563
+ * @returns
55564
+ */
55565
+ function toFormData(obj, formData, options) {
55566
+ if (!utils$1.isObject(obj)) {
55567
+ throw new TypeError('target must be an object');
55568
+ }
55309
55569
 
55310
- const $internals = Symbol('internals');
55570
+ // eslint-disable-next-line no-param-reassign
55571
+ formData = formData || new (FormData)();
55311
55572
 
55312
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
55573
+ // eslint-disable-next-line no-param-reassign
55574
+ options = utils$1.toFlatObject(
55575
+ options,
55576
+ {
55577
+ metaTokens: true,
55578
+ dots: false,
55579
+ indexes: false,
55580
+ },
55581
+ false,
55582
+ function defined(option, source) {
55583
+ // eslint-disable-next-line no-eq-null,eqeqeq
55584
+ return !utils$1.isUndefined(source[option]);
55585
+ }
55586
+ );
55313
55587
 
55314
- function trimSPorHTAB(str) {
55315
- let start = 0;
55316
- let end = str.length;
55588
+ const metaTokens = options.metaTokens;
55589
+ // eslint-disable-next-line no-use-before-define
55590
+ const visitor = options.visitor || defaultVisitor;
55591
+ const dots = options.dots;
55592
+ const indexes = options.indexes;
55593
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
55594
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
55595
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
55317
55596
 
55318
- while (start < end) {
55319
- const code = str.charCodeAt(start);
55597
+ if (!utils$1.isFunction(visitor)) {
55598
+ throw new TypeError('visitor must be a function');
55599
+ }
55320
55600
 
55321
- if (code !== 0x09 && code !== 0x20) {
55322
- break;
55601
+ function convertValue(value) {
55602
+ if (value === null) return '';
55603
+
55604
+ if (utils$1.isDate(value)) {
55605
+ return value.toISOString();
55323
55606
  }
55324
55607
 
55325
- start += 1;
55326
- }
55608
+ if (utils$1.isBoolean(value)) {
55609
+ return value.toString();
55610
+ }
55327
55611
 
55328
- while (end > start) {
55329
- const code = str.charCodeAt(end - 1);
55612
+ if (!useBlob && utils$1.isBlob(value)) {
55613
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
55614
+ }
55330
55615
 
55331
- if (code !== 0x09 && code !== 0x20) {
55332
- break;
55616
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
55617
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
55333
55618
  }
55334
55619
 
55335
- end -= 1;
55620
+ return value;
55336
55621
  }
55337
55622
 
55338
- return start === 0 && end === str.length ? str : str.slice(start, end);
55339
- }
55623
+ /**
55624
+ * Default visitor.
55625
+ *
55626
+ * @param {*} value
55627
+ * @param {String|Number} key
55628
+ * @param {Array<String|Number>} path
55629
+ * @this {FormData}
55630
+ *
55631
+ * @returns {boolean} return true to visit the each prop of the value recursively
55632
+ */
55633
+ function defaultVisitor(value, key, path) {
55634
+ let arr = value;
55340
55635
 
55341
- function normalizeHeader(header) {
55342
- return header && String(header).trim().toLowerCase();
55343
- }
55636
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
55637
+ formData.append(renderKey(path, key, dots), convertValue(value));
55638
+ return false;
55639
+ }
55344
55640
 
55345
- function sanitizeHeaderValue(str) {
55346
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
55347
- }
55641
+ if (value && !path && typeof value === 'object') {
55642
+ if (utils$1.endsWith(key, '{}')) {
55643
+ // eslint-disable-next-line no-param-reassign
55644
+ key = metaTokens ? key : key.slice(0, -2);
55645
+ // eslint-disable-next-line no-param-reassign
55646
+ value = JSON.stringify(value);
55647
+ } else if (
55648
+ (utils$1.isArray(value) && isFlatArray(value)) ||
55649
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
55650
+ ) {
55651
+ // eslint-disable-next-line no-param-reassign
55652
+ key = removeBrackets(key);
55348
55653
 
55349
- function normalizeValue(value) {
55350
- if (value === false || value == null) {
55351
- return value;
55352
- }
55654
+ arr.forEach(function each(el, index) {
55655
+ !(utils$1.isUndefined(el) || el === null) &&
55656
+ formData.append(
55657
+ // eslint-disable-next-line no-nested-ternary
55658
+ indexes === true
55659
+ ? renderKey([key], index, dots)
55660
+ : indexes === null
55661
+ ? key
55662
+ : key + '[]',
55663
+ convertValue(el)
55664
+ );
55665
+ });
55666
+ return false;
55667
+ }
55668
+ }
55353
55669
 
55354
- return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
55355
- }
55670
+ if (isVisitable(value)) {
55671
+ return true;
55672
+ }
55356
55673
 
55357
- function parseTokens(str) {
55358
- const tokens = Object.create(null);
55359
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
55360
- let match;
55674
+ formData.append(renderKey(path, key, dots), convertValue(value));
55361
55675
 
55362
- while ((match = tokensRE.exec(str))) {
55363
- tokens[match[1]] = match[2];
55676
+ return false;
55364
55677
  }
55365
55678
 
55366
- return tokens;
55367
- }
55679
+ const stack = [];
55368
55680
 
55369
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
55681
+ const exposedHelpers = Object.assign(predicates, {
55682
+ defaultVisitor,
55683
+ convertValue,
55684
+ isVisitable,
55685
+ });
55370
55686
 
55371
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
55372
- if (utils$1.isFunction(filter)) {
55373
- return filter.call(this, value, header);
55374
- }
55687
+ function build(value, path, depth = 0) {
55688
+ if (utils$1.isUndefined(value)) return;
55375
55689
 
55376
- if (isHeaderNameFilter) {
55377
- value = header;
55378
- }
55690
+ if (depth > maxDepth) {
55691
+ throw new AxiosError(
55692
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
55693
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
55694
+ );
55695
+ }
55379
55696
 
55380
- if (!utils$1.isString(value)) return;
55697
+ if (stack.indexOf(value) !== -1) {
55698
+ throw Error('Circular reference detected in ' + path.join('.'));
55699
+ }
55381
55700
 
55382
- if (utils$1.isString(filter)) {
55383
- return value.indexOf(filter) !== -1;
55701
+ stack.push(value);
55702
+
55703
+ utils$1.forEach(value, function each(el, key) {
55704
+ const result =
55705
+ !(utils$1.isUndefined(el) || el === null) &&
55706
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
55707
+
55708
+ if (result === true) {
55709
+ build(el, path ? path.concat(key) : [key], depth + 1);
55710
+ }
55711
+ });
55712
+
55713
+ stack.pop();
55384
55714
  }
55385
55715
 
55386
- if (utils$1.isRegExp(filter)) {
55387
- return filter.test(value);
55716
+ if (!utils$1.isObject(obj)) {
55717
+ throw new TypeError('data must be an object');
55388
55718
  }
55389
- }
55390
55719
 
55391
- function formatHeader(header) {
55392
- return header
55393
- .trim()
55394
- .toLowerCase()
55395
- .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
55396
- return char.toUpperCase() + str;
55397
- });
55398
- }
55720
+ build(obj);
55399
55721
 
55400
- function buildAccessors(obj, header) {
55401
- const accessorName = utils$1.toCamelCase(' ' + header);
55722
+ return formData;
55723
+ }
55402
55724
 
55403
- ['get', 'set', 'has'].forEach((methodName) => {
55404
- Object.defineProperty(obj, methodName + accessorName, {
55405
- value: function (arg1, arg2, arg3) {
55406
- return this[methodName].call(this, header, arg1, arg2, arg3);
55407
- },
55408
- configurable: true,
55409
- });
55725
+ /**
55726
+ * It encodes a string by replacing all characters that are not in the unreserved set with
55727
+ * their percent-encoded equivalents
55728
+ *
55729
+ * @param {string} str - The string to encode.
55730
+ *
55731
+ * @returns {string} The encoded string.
55732
+ */
55733
+ function encode$1(str) {
55734
+ const charMap = {
55735
+ '!': '%21',
55736
+ "'": '%27',
55737
+ '(': '%28',
55738
+ ')': '%29',
55739
+ '~': '%7E',
55740
+ '%20': '+',
55741
+ };
55742
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
55743
+ return charMap[match];
55410
55744
  });
55411
55745
  }
55412
55746
 
55413
- class AxiosHeaders {
55414
- constructor(headers) {
55415
- headers && this.set(headers);
55416
- }
55747
+ /**
55748
+ * It takes a params object and converts it to a FormData object
55749
+ *
55750
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
55751
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
55752
+ *
55753
+ * @returns {void}
55754
+ */
55755
+ function AxiosURLSearchParams(params, options) {
55756
+ this._pairs = [];
55417
55757
 
55418
- set(header, valueOrRewrite, rewrite) {
55419
- const self = this;
55758
+ params && toFormData(params, this, options);
55759
+ }
55420
55760
 
55421
- function setHeader(_value, _header, _rewrite) {
55422
- const lHeader = normalizeHeader(_header);
55761
+ const prototype = AxiosURLSearchParams.prototype;
55423
55762
 
55424
- if (!lHeader) {
55425
- throw new Error('header name must be a non-empty string');
55763
+ prototype.append = function append(name, value) {
55764
+ this._pairs.push([name, value]);
55765
+ };
55766
+
55767
+ prototype.toString = function toString(encoder) {
55768
+ const _encode = encoder
55769
+ ? function (value) {
55770
+ return encoder.call(this, value, encode$1);
55426
55771
  }
55772
+ : encode$1;
55427
55773
 
55428
- const key = utils$1.findKey(self, lHeader);
55774
+ return this._pairs
55775
+ .map(function each(pair) {
55776
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
55777
+ }, '')
55778
+ .join('&');
55779
+ };
55429
55780
 
55430
- if (
55431
- !key ||
55432
- self[key] === undefined ||
55433
- _rewrite === true ||
55434
- (_rewrite === undefined && self[key] !== false)
55435
- ) {
55436
- self[key || _header] = normalizeValue(_value);
55781
+ /**
55782
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
55783
+ * their plain counterparts (`:`, `$`, `,`, `+`).
55784
+ *
55785
+ * @param {string} val The value to be encoded.
55786
+ *
55787
+ * @returns {string} The encoded value.
55788
+ */
55789
+ function encode(val) {
55790
+ return encodeURIComponent(val)
55791
+ .replace(/%3A/gi, ':')
55792
+ .replace(/%24/g, '$')
55793
+ .replace(/%2C/gi, ',')
55794
+ .replace(/%20/g, '+');
55795
+ }
55796
+
55797
+ /**
55798
+ * Build a URL by appending params to the end
55799
+ *
55800
+ * @param {string} url The base of the url (e.g., http://www.google.com)
55801
+ * @param {object} [params] The params to be appended
55802
+ * @param {?(object|Function)} options
55803
+ *
55804
+ * @returns {string} The formatted url
55805
+ */
55806
+ function buildURL(url, params, options) {
55807
+ if (!params) {
55808
+ return url;
55809
+ }
55810
+
55811
+ const _encode = (options && options.encode) || encode;
55812
+
55813
+ const _options = utils$1.isFunction(options)
55814
+ ? {
55815
+ serialize: options,
55437
55816
  }
55817
+ : options;
55818
+
55819
+ const serializeFn = _options && _options.serialize;
55820
+
55821
+ let serializedParams;
55822
+
55823
+ if (serializeFn) {
55824
+ serializedParams = serializeFn(params, _options);
55825
+ } else {
55826
+ serializedParams = utils$1.isURLSearchParams(params)
55827
+ ? params.toString()
55828
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
55829
+ }
55830
+
55831
+ if (serializedParams) {
55832
+ const hashmarkIndex = url.indexOf('#');
55833
+
55834
+ if (hashmarkIndex !== -1) {
55835
+ url = url.slice(0, hashmarkIndex);
55438
55836
  }
55837
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
55838
+ }
55439
55839
 
55440
- const setHeaders = (headers, _rewrite) =>
55441
- utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
55840
+ return url;
55841
+ }
55442
55842
 
55443
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
55444
- setHeaders(header, valueOrRewrite);
55445
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
55446
- setHeaders(parseHeaders(header), valueOrRewrite);
55447
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
55448
- let obj = {},
55449
- dest,
55450
- key;
55451
- for (const entry of header) {
55452
- if (!utils$1.isArray(entry)) {
55453
- throw TypeError('Object iterator must return a key-value pair');
55454
- }
55843
+ class InterceptorManager {
55844
+ constructor() {
55845
+ this.handlers = [];
55846
+ }
55455
55847
 
55456
- obj[(key = entry[0])] = (dest = obj[key])
55457
- ? utils$1.isArray(dest)
55458
- ? [...dest, entry[1]]
55459
- : [dest, entry[1]]
55460
- : entry[1];
55461
- }
55848
+ /**
55849
+ * Add a new interceptor to the stack
55850
+ *
55851
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
55852
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
55853
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
55854
+ *
55855
+ * @return {Number} An ID used to remove interceptor later
55856
+ */
55857
+ use(fulfilled, rejected, options) {
55858
+ this.handlers.push({
55859
+ fulfilled,
55860
+ rejected,
55861
+ synchronous: options ? options.synchronous : false,
55862
+ runWhen: options ? options.runWhen : null,
55863
+ });
55864
+ return this.handlers.length - 1;
55865
+ }
55462
55866
 
55463
- setHeaders(obj, valueOrRewrite);
55464
- } else {
55465
- header != null && setHeader(valueOrRewrite, header, rewrite);
55867
+ /**
55868
+ * Remove an interceptor from the stack
55869
+ *
55870
+ * @param {Number} id The ID that was returned by `use`
55871
+ *
55872
+ * @returns {void}
55873
+ */
55874
+ eject(id) {
55875
+ if (this.handlers[id]) {
55876
+ this.handlers[id] = null;
55466
55877
  }
55878
+ }
55467
55879
 
55468
- return this;
55880
+ /**
55881
+ * Clear all interceptors from the stack
55882
+ *
55883
+ * @returns {void}
55884
+ */
55885
+ clear() {
55886
+ if (this.handlers) {
55887
+ this.handlers = [];
55888
+ }
55469
55889
  }
55470
55890
 
55471
- get(header, parser) {
55472
- header = normalizeHeader(header);
55891
+ /**
55892
+ * Iterate over all the registered interceptors
55893
+ *
55894
+ * This method is particularly useful for skipping over any
55895
+ * interceptors that may have become `null` calling `eject`.
55896
+ *
55897
+ * @param {Function} fn The function to call for each interceptor
55898
+ *
55899
+ * @returns {void}
55900
+ */
55901
+ forEach(fn) {
55902
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
55903
+ if (h !== null) {
55904
+ fn(h);
55905
+ }
55906
+ });
55907
+ }
55908
+ }
55473
55909
 
55474
- if (header) {
55475
- const key = utils$1.findKey(this, header);
55910
+ var transitionalDefaults = {
55911
+ silentJSONParsing: true,
55912
+ forcedJSONParsing: true,
55913
+ clarifyTimeoutError: false,
55914
+ legacyInterceptorReqResOrdering: true,
55915
+ };
55476
55916
 
55477
- if (key) {
55478
- const value = this[key];
55917
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
55479
55918
 
55480
- if (!parser) {
55481
- return value;
55482
- }
55919
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
55920
+
55921
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
55922
+
55923
+ var platform$1 = {
55924
+ isBrowser: true,
55925
+ classes: {
55926
+ URLSearchParams: URLSearchParams$1,
55927
+ FormData: FormData$1,
55928
+ Blob: Blob$1,
55929
+ },
55930
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
55931
+ };
55932
+
55933
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
55934
+
55935
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
55936
+
55937
+ /**
55938
+ * Determine if we're running in a standard browser environment
55939
+ *
55940
+ * This allows axios to run in a web worker, and react-native.
55941
+ * Both environments support XMLHttpRequest, but not fully standard globals.
55942
+ *
55943
+ * web workers:
55944
+ * typeof window -> undefined
55945
+ * typeof document -> undefined
55946
+ *
55947
+ * react-native:
55948
+ * navigator.product -> 'ReactNative'
55949
+ * nativescript
55950
+ * navigator.product -> 'NativeScript' or 'NS'
55951
+ *
55952
+ * @returns {boolean}
55953
+ */
55954
+ const hasStandardBrowserEnv =
55955
+ hasBrowserEnv &&
55956
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
55957
+
55958
+ /**
55959
+ * Determine if we're running in a standard browser webWorker environment
55960
+ *
55961
+ * Although the `isStandardBrowserEnv` method indicates that
55962
+ * `allows axios to run in a web worker`, the WebWorker will still be
55963
+ * filtered out due to its judgment standard
55964
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
55965
+ * This leads to a problem when axios post `FormData` in webWorker
55966
+ */
55967
+ const hasStandardBrowserWebWorkerEnv = (() => {
55968
+ return (
55969
+ typeof WorkerGlobalScope !== 'undefined' &&
55970
+ // eslint-disable-next-line no-undef
55971
+ self instanceof WorkerGlobalScope &&
55972
+ typeof self.importScripts === 'function'
55973
+ );
55974
+ })();
55483
55975
 
55484
- if (parser === true) {
55485
- return parseTokens(value);
55486
- }
55976
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
55487
55977
 
55488
- if (utils$1.isFunction(parser)) {
55489
- return parser.call(this, value, key);
55490
- }
55978
+ var utils = /*#__PURE__*/Object.freeze({
55979
+ __proto__: null,
55980
+ hasBrowserEnv: hasBrowserEnv,
55981
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
55982
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
55983
+ navigator: _navigator,
55984
+ origin: origin
55985
+ });
55491
55986
 
55492
- if (utils$1.isRegExp(parser)) {
55493
- return parser.exec(value);
55494
- }
55987
+ var platform = {
55988
+ ...utils,
55989
+ ...platform$1,
55990
+ };
55495
55991
 
55496
- throw new TypeError('parser must be boolean|regexp|function');
55992
+ function toURLEncodedForm(data, options) {
55993
+ return toFormData(data, new platform.classes.URLSearchParams(), {
55994
+ visitor: function (value, key, path, helpers) {
55995
+ if (platform.isNode && utils$1.isBuffer(value)) {
55996
+ this.append(key, value.toString('base64'));
55997
+ return false;
55497
55998
  }
55498
- }
55499
- }
55500
-
55501
- has(header, matcher) {
55502
- header = normalizeHeader(header);
55503
55999
 
55504
- if (header) {
55505
- const key = utils$1.findKey(this, header);
56000
+ return helpers.defaultVisitor.apply(this, arguments);
56001
+ },
56002
+ ...options,
56003
+ });
56004
+ }
55506
56005
 
55507
- return !!(
55508
- key &&
55509
- this[key] !== undefined &&
55510
- (!matcher || matchHeaderValue(this, this[key], key, matcher))
55511
- );
55512
- }
56006
+ /**
56007
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
56008
+ *
56009
+ * @param {string} name - The name of the property to get.
56010
+ *
56011
+ * @returns An array of strings.
56012
+ */
56013
+ function parsePropPath(name) {
56014
+ // foo[x][y][z]
56015
+ // foo.x.y.z
56016
+ // foo-x-y-z
56017
+ // foo x y z
56018
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
56019
+ return match[0] === '[]' ? '' : match[1] || match[0];
56020
+ });
56021
+ }
55513
56022
 
55514
- return false;
56023
+ /**
56024
+ * Convert an array to an object.
56025
+ *
56026
+ * @param {Array<any>} arr - The array to convert to an object.
56027
+ *
56028
+ * @returns An object with the same keys and values as the array.
56029
+ */
56030
+ function arrayToObject(arr) {
56031
+ const obj = {};
56032
+ const keys = Object.keys(arr);
56033
+ let i;
56034
+ const len = keys.length;
56035
+ let key;
56036
+ for (i = 0; i < len; i++) {
56037
+ key = keys[i];
56038
+ obj[key] = arr[key];
55515
56039
  }
56040
+ return obj;
56041
+ }
55516
56042
 
55517
- delete(header, matcher) {
55518
- const self = this;
55519
- let deleted = false;
55520
-
55521
- function deleteHeader(_header) {
55522
- _header = normalizeHeader(_header);
56043
+ /**
56044
+ * It takes a FormData object and returns a JavaScript object
56045
+ *
56046
+ * @param {string} formData The FormData object to convert to JSON.
56047
+ *
56048
+ * @returns {Object<string, any> | null} The converted object.
56049
+ */
56050
+ function formDataToJSON(formData) {
56051
+ function buildPath(path, value, target, index) {
56052
+ let name = path[index++];
55523
56053
 
55524
- if (_header) {
55525
- const key = utils$1.findKey(self, _header);
56054
+ if (name === '__proto__') return true;
55526
56055
 
55527
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
55528
- delete self[key];
56056
+ const isNumericKey = Number.isFinite(+name);
56057
+ const isLast = index >= path.length;
56058
+ name = !name && utils$1.isArray(target) ? target.length : name;
55529
56059
 
55530
- deleted = true;
55531
- }
56060
+ if (isLast) {
56061
+ if (utils$1.hasOwnProp(target, name)) {
56062
+ target[name] = utils$1.isArray(target[name])
56063
+ ? target[name].concat(value)
56064
+ : [target[name], value];
56065
+ } else {
56066
+ target[name] = value;
55532
56067
  }
56068
+
56069
+ return !isNumericKey;
55533
56070
  }
55534
56071
 
55535
- if (utils$1.isArray(header)) {
55536
- header.forEach(deleteHeader);
55537
- } else {
55538
- deleteHeader(header);
56072
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
56073
+ target[name] = [];
55539
56074
  }
55540
56075
 
55541
- return deleted;
56076
+ const result = buildPath(path, value, target[name], index);
56077
+
56078
+ if (result && utils$1.isArray(target[name])) {
56079
+ target[name] = arrayToObject(target[name]);
56080
+ }
56081
+
56082
+ return !isNumericKey;
55542
56083
  }
55543
56084
 
55544
- clear(matcher) {
55545
- const keys = Object.keys(this);
55546
- let i = keys.length;
55547
- let deleted = false;
56085
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
56086
+ const obj = {};
55548
56087
 
55549
- while (i--) {
55550
- const key = keys[i];
55551
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
55552
- delete this[key];
55553
- deleted = true;
55554
- }
55555
- }
56088
+ utils$1.forEachEntry(formData, (name, value) => {
56089
+ buildPath(parsePropPath(name), value, obj, 0);
56090
+ });
55556
56091
 
55557
- return deleted;
56092
+ return obj;
55558
56093
  }
55559
56094
 
55560
- normalize(format) {
55561
- const self = this;
55562
- const headers = {};
56095
+ return null;
56096
+ }
55563
56097
 
55564
- utils$1.forEach(this, (value, header) => {
55565
- const key = utils$1.findKey(headers, header);
56098
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
55566
56099
 
55567
- if (key) {
55568
- self[key] = normalizeValue(value);
55569
- delete self[header];
55570
- return;
56100
+ /**
56101
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
56102
+ * of the input
56103
+ *
56104
+ * @param {any} rawValue - The value to be stringified.
56105
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
56106
+ * @param {Function} encoder - A function that takes a value and returns a string.
56107
+ *
56108
+ * @returns {string} A stringified version of the rawValue.
56109
+ */
56110
+ function stringifySafely(rawValue, parser, encoder) {
56111
+ if (utils$1.isString(rawValue)) {
56112
+ try {
56113
+ (parser || JSON.parse)(rawValue);
56114
+ return utils$1.trim(rawValue);
56115
+ } catch (e) {
56116
+ if (e.name !== 'SyntaxError') {
56117
+ throw e;
55571
56118
  }
56119
+ }
56120
+ }
55572
56121
 
55573
- const normalized = format ? formatHeader(header) : String(header).trim();
56122
+ return (encoder || JSON.stringify)(rawValue);
56123
+ }
55574
56124
 
55575
- if (normalized !== header) {
55576
- delete self[header];
55577
- }
56125
+ const defaults = {
56126
+ transitional: transitionalDefaults,
55578
56127
 
55579
- self[normalized] = normalizeValue(value);
56128
+ adapter: ['xhr', 'http', 'fetch'],
55580
56129
 
55581
- headers[normalized] = true;
55582
- });
56130
+ transformRequest: [
56131
+ function transformRequest(data, headers) {
56132
+ const contentType = headers.getContentType() || '';
56133
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
56134
+ const isObjectPayload = utils$1.isObject(data);
55583
56135
 
55584
- return this;
55585
- }
56136
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
56137
+ data = new FormData(data);
56138
+ }
55586
56139
 
55587
- concat(...targets) {
55588
- return this.constructor.concat(this, ...targets);
55589
- }
56140
+ const isFormData = utils$1.isFormData(data);
55590
56141
 
55591
- toJSON(asStrings) {
55592
- const obj = Object.create(null);
56142
+ if (isFormData) {
56143
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
56144
+ }
55593
56145
 
55594
- utils$1.forEach(this, (value, header) => {
55595
- value != null &&
55596
- value !== false &&
55597
- (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
55598
- });
56146
+ if (
56147
+ utils$1.isArrayBuffer(data) ||
56148
+ utils$1.isBuffer(data) ||
56149
+ utils$1.isStream(data) ||
56150
+ utils$1.isFile(data) ||
56151
+ utils$1.isBlob(data) ||
56152
+ utils$1.isReadableStream(data)
56153
+ ) {
56154
+ return data;
56155
+ }
56156
+ if (utils$1.isArrayBufferView(data)) {
56157
+ return data.buffer;
56158
+ }
56159
+ if (utils$1.isURLSearchParams(data)) {
56160
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
56161
+ return data.toString();
56162
+ }
55599
56163
 
55600
- return obj;
55601
- }
56164
+ let isFileList;
55602
56165
 
55603
- [Symbol.iterator]() {
55604
- return Object.entries(this.toJSON())[Symbol.iterator]();
55605
- }
56166
+ if (isObjectPayload) {
56167
+ const formSerializer = own(this, 'formSerializer');
56168
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
56169
+ return toURLEncodedForm(data, formSerializer).toString();
56170
+ }
55606
56171
 
55607
- toString() {
55608
- return Object.entries(this.toJSON())
55609
- .map(([header, value]) => header + ': ' + value)
55610
- .join('\n');
55611
- }
56172
+ if (
56173
+ (isFileList = utils$1.isFileList(data)) ||
56174
+ contentType.indexOf('multipart/form-data') > -1
56175
+ ) {
56176
+ const env = own(this, 'env');
56177
+ const _FormData = env && env.FormData;
55612
56178
 
55613
- getSetCookie() {
55614
- return this.get('set-cookie') || [];
55615
- }
56179
+ return toFormData(
56180
+ isFileList ? { 'files[]': data } : data,
56181
+ _FormData && new _FormData(),
56182
+ formSerializer
56183
+ );
56184
+ }
56185
+ }
55616
56186
 
55617
- get [Symbol.toStringTag]() {
55618
- return 'AxiosHeaders';
55619
- }
56187
+ if (isObjectPayload || hasJSONContentType) {
56188
+ headers.setContentType('application/json', false);
56189
+ return stringifySafely(data);
56190
+ }
55620
56191
 
55621
- static from(thing) {
55622
- return thing instanceof this ? thing : new this(thing);
55623
- }
56192
+ return data;
56193
+ },
56194
+ ],
55624
56195
 
55625
- static concat(first, ...targets) {
55626
- const computed = new this(first);
56196
+ transformResponse: [
56197
+ function transformResponse(data) {
56198
+ const transitional = own(this, 'transitional') || defaults.transitional;
56199
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
56200
+ const responseType = own(this, 'responseType');
56201
+ const JSONRequested = responseType === 'json';
55627
56202
 
55628
- targets.forEach((target) => computed.set(target));
56203
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
56204
+ return data;
56205
+ }
55629
56206
 
55630
- return computed;
55631
- }
56207
+ if (
56208
+ data &&
56209
+ utils$1.isString(data) &&
56210
+ ((forcedJSONParsing && !responseType) || JSONRequested)
56211
+ ) {
56212
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
56213
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
55632
56214
 
55633
- static accessor(header) {
55634
- const internals =
55635
- (this[$internals] =
55636
- this[$internals] =
55637
- {
55638
- accessors: {},
55639
- });
56215
+ try {
56216
+ return JSON.parse(data, own(this, 'parseReviver'));
56217
+ } catch (e) {
56218
+ if (strictJSONParsing) {
56219
+ if (e.name === 'SyntaxError') {
56220
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
56221
+ }
56222
+ throw e;
56223
+ }
56224
+ }
56225
+ }
55640
56226
 
55641
- const accessors = internals.accessors;
55642
- const prototype = this.prototype;
56227
+ return data;
56228
+ },
56229
+ ],
55643
56230
 
55644
- function defineAccessor(_header) {
55645
- const lHeader = normalizeHeader(_header);
56231
+ /**
56232
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
56233
+ * timeout is not created.
56234
+ */
56235
+ timeout: 0,
55646
56236
 
55647
- if (!accessors[lHeader]) {
55648
- buildAccessors(prototype, _header);
55649
- accessors[lHeader] = true;
55650
- }
55651
- }
56237
+ xsrfCookieName: 'XSRF-TOKEN',
56238
+ xsrfHeaderName: 'X-XSRF-TOKEN',
55652
56239
 
55653
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
56240
+ maxContentLength: -1,
56241
+ maxBodyLength: -1,
55654
56242
 
55655
- return this;
55656
- }
55657
- }
56243
+ env: {
56244
+ FormData: platform.classes.FormData,
56245
+ Blob: platform.classes.Blob,
56246
+ },
55658
56247
 
55659
- AxiosHeaders.accessor([
55660
- 'Content-Type',
55661
- 'Content-Length',
55662
- 'Accept',
55663
- 'Accept-Encoding',
55664
- 'User-Agent',
55665
- 'Authorization',
55666
- ]);
56248
+ validateStatus: function validateStatus(status) {
56249
+ return status >= 200 && status < 300;
56250
+ },
55667
56251
 
55668
- // reserved names hotfix
55669
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
55670
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
55671
- return {
55672
- get: () => value,
55673
- set(headerValue) {
55674
- this[mapped] = headerValue;
56252
+ headers: {
56253
+ common: {
56254
+ Accept: 'application/json, text/plain, */*',
56255
+ 'Content-Type': undefined,
55675
56256
  },
55676
- };
55677
- });
56257
+ },
56258
+ };
55678
56259
 
55679
- utils$1.freezeMethods(AxiosHeaders);
56260
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], (method) => {
56261
+ defaults.headers[method] = {};
56262
+ });
55680
56263
 
55681
56264
  /**
55682
56265
  * Transform the data for a request or a response
@@ -55736,22 +56319,18 @@ function settle(resolve, reject, response) {
55736
56319
  if (!response.status || !validateStatus || validateStatus(response.status)) {
55737
56320
  resolve(response);
55738
56321
  } else {
55739
- reject(
55740
- new AxiosError(
55741
- 'Request failed with status code ' + response.status,
55742
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][
55743
- Math.floor(response.status / 100) - 4
55744
- ],
55745
- response.config,
55746
- response.request,
55747
- response
55748
- )
55749
- );
56322
+ reject(new AxiosError(
56323
+ 'Request failed with status code ' + response.status,
56324
+ response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE,
56325
+ response.config,
56326
+ response.request,
56327
+ response
56328
+ ));
55750
56329
  }
55751
56330
  }
55752
56331
 
55753
56332
  function parseProtocol(url) {
55754
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
56333
+ const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
55755
56334
  return (match && match[1]) || '';
55756
56335
  }
55757
56336
 
@@ -55855,6 +56434,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
55855
56434
  const _speedometer = speedometer(50, 250);
55856
56435
 
55857
56436
  return throttle((e) => {
56437
+ if (!e || typeof e.loaded !== 'number') {
56438
+ return;
56439
+ }
55858
56440
  const rawLoaded = e.loaded;
55859
56441
  const total = e.lengthComputable ? e.total : undefined;
55860
56442
  const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -55942,8 +56524,20 @@ var cookies = platform.hasStandardBrowserEnv
55942
56524
 
55943
56525
  read(name) {
55944
56526
  if (typeof document === 'undefined') return null;
55945
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
55946
- return match ? decodeURIComponent(match[1]) : null;
56527
+ // Match name=value by splitting on the semicolon separator instead of building a
56528
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
56529
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
56530
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
56531
+ // "; ", so ignore optional whitespace before each cookie name.
56532
+ const cookies = document.cookie.split(';');
56533
+ for (let i = 0; i < cookies.length; i++) {
56534
+ const cookie = cookies[i].replace(/^\s+/, '');
56535
+ const eq = cookie.indexOf('=');
56536
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
56537
+ return decodeURIComponent(cookie.slice(eq + 1));
56538
+ }
56539
+ }
56540
+ return null;
55947
56541
  },
55948
56542
 
55949
56543
  remove(name) {
@@ -56025,11 +56619,14 @@ function mergeConfig(config1, config2) {
56025
56619
  config2 = config2 || {};
56026
56620
 
56027
56621
  // Use a null-prototype object so that downstream reads such as `config.auth`
56028
- // or `config.baseURL` cannot inherit polluted values from Object.prototype
56029
- // (see GHSA-q8qp-cvcw-x6jj). `hasOwnProperty` is restored as a non-enumerable
56030
- // own slot to preserve ergonomics for user code that relies on it.
56622
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
56623
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
56624
+ // ergonomics for user code that relies on it.
56031
56625
  const config = Object.create(null);
56032
56626
  Object.defineProperty(config, 'hasOwnProperty', {
56627
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
56628
+ // this data descriptor into an accessor descriptor on the way in.
56629
+ __proto__: null,
56033
56630
  value: Object.prototype.hasOwnProperty,
56034
56631
  enumerable: false,
56035
56632
  writable: true,
@@ -56126,11 +56723,39 @@ function mergeConfig(config1, config2) {
56126
56723
  return config;
56127
56724
  }
56128
56725
 
56726
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
56727
+
56728
+ function setFormDataHeaders(headers, formHeaders, policy) {
56729
+ if (policy !== 'content-only') {
56730
+ headers.set(formHeaders);
56731
+ return;
56732
+ }
56733
+
56734
+ Object.entries(formHeaders).forEach(([key, val]) => {
56735
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
56736
+ headers.set(key, val);
56737
+ }
56738
+ });
56739
+ }
56740
+
56741
+ /**
56742
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
56743
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
56744
+ *
56745
+ * @param {string} str The string to encode
56746
+ *
56747
+ * @returns {string} UTF-8 bytes as a Latin-1 string
56748
+ */
56749
+ const encodeUTF8 = (str) =>
56750
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
56751
+ String.fromCharCode(parseInt(hex, 16))
56752
+ );
56753
+
56129
56754
  var resolveConfig = (config) => {
56130
56755
  const newConfig = mergeConfig({}, config);
56131
56756
 
56132
56757
  // Read only own properties to prevent prototype pollution gadgets
56133
- // (e.g. Object.prototype.baseURL = 'https://evil.com'). See GHSA-q8qp-cvcw-x6jj.
56758
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
56134
56759
  const own = (key) => (utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined);
56135
56760
 
56136
56761
  const data = own('data');
@@ -56156,11 +56781,7 @@ var resolveConfig = (config) => {
56156
56781
  headers.set(
56157
56782
  'Authorization',
56158
56783
  'Basic ' +
56159
- btoa(
56160
- (auth.username || '') +
56161
- ':' +
56162
- (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
56163
- )
56784
+ btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
56164
56785
  );
56165
56786
  }
56166
56787
 
@@ -56169,14 +56790,7 @@ var resolveConfig = (config) => {
56169
56790
  headers.setContentType(undefined); // browser handles it
56170
56791
  } else if (utils$1.isFunction(data.getHeaders)) {
56171
56792
  // Node.js FormData (like form-data package)
56172
- const formHeaders = data.getHeaders();
56173
- // Only set safe headers to avoid overwriting security headers
56174
- const allowedHeaders = ['content-type', 'content-length'];
56175
- Object.entries(formHeaders).forEach(([key, val]) => {
56176
- if (allowedHeaders.includes(key.toLowerCase())) {
56177
- headers.set(key, val);
56178
- }
56179
- });
56793
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
56180
56794
  }
56181
56795
  }
56182
56796
 
@@ -56191,10 +56805,9 @@ var resolveConfig = (config) => {
56191
56805
 
56192
56806
  // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
56193
56807
  // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
56194
- // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
56808
+ // the XSRF token cross-origin.
56195
56809
  const shouldSendXSRF =
56196
- withXSRFToken === true ||
56197
- (withXSRFToken == null && isURLSameOrigin(newConfig.url));
56810
+ withXSRFToken === true || (withXSRFToken == null && isURLSameOrigin(newConfig.url));
56198
56811
 
56199
56812
  if (shouldSendXSRF) {
56200
56813
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
@@ -56290,7 +56903,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56290
56903
  // will return status as 0 even though it's a successful request
56291
56904
  if (
56292
56905
  request.status === 0 &&
56293
- !(request.responseURL && request.responseURL.indexOf('file:') === 0)
56906
+ !(request.responseURL && request.responseURL.startsWith('file:'))
56294
56907
  ) {
56295
56908
  return;
56296
56909
  }
@@ -56307,6 +56920,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56307
56920
  }
56308
56921
 
56309
56922
  reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
56923
+ done();
56310
56924
 
56311
56925
  // Clean up request
56312
56926
  request = null;
@@ -56322,6 +56936,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56322
56936
  // attach the underlying event for consumers who want details
56323
56937
  err.event = event || null;
56324
56938
  reject(err);
56939
+ done();
56325
56940
  request = null;
56326
56941
  };
56327
56942
 
@@ -56342,6 +56957,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56342
56957
  request
56343
56958
  )
56344
56959
  );
56960
+ done();
56345
56961
 
56346
56962
  // Clean up request
56347
56963
  request = null;
@@ -56352,7 +56968,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56352
56968
 
56353
56969
  // Add headers to the request
56354
56970
  if ('setRequestHeader' in request) {
56355
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
56971
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
56356
56972
  request.setRequestHeader(key, val);
56357
56973
  });
56358
56974
  }
@@ -56391,6 +57007,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56391
57007
  }
56392
57008
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
56393
57009
  request.abort();
57010
+ done();
56394
57011
  request = null;
56395
57012
  };
56396
57013
 
@@ -56404,7 +57021,7 @@ var xhrAdapter = isXHRAdapterSupported &&
56404
57021
 
56405
57022
  const protocol = parseProtocol(_config.url);
56406
57023
 
56407
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
57024
+ if (protocol && !platform.protocols.includes(protocol)) {
56408
57025
  reject(
56409
57026
  new AxiosError(
56410
57027
  'Unsupported protocol ' + protocol + ':',
@@ -56421,54 +57038,55 @@ var xhrAdapter = isXHRAdapterSupported &&
56421
57038
  };
56422
57039
 
56423
57040
  const composeSignals = (signals, timeout) => {
56424
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
56425
-
56426
- if (timeout || length) {
56427
- let controller = new AbortController();
56428
-
56429
- let aborted;
56430
-
56431
- const onabort = function (reason) {
56432
- if (!aborted) {
56433
- aborted = true;
56434
- unsubscribe();
56435
- const err = reason instanceof Error ? reason : this.reason;
56436
- controller.abort(
56437
- err instanceof AxiosError
56438
- ? err
56439
- : new CanceledError(err instanceof Error ? err.message : err)
56440
- );
56441
- }
56442
- };
57041
+ signals = signals ? signals.filter(Boolean) : [];
56443
57042
 
56444
- let timer =
56445
- timeout &&
56446
- setTimeout(() => {
56447
- timer = null;
56448
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
56449
- }, timeout);
56450
-
56451
- const unsubscribe = () => {
56452
- if (signals) {
56453
- timer && clearTimeout(timer);
56454
- timer = null;
56455
- signals.forEach((signal) => {
56456
- signal.unsubscribe
56457
- ? signal.unsubscribe(onabort)
56458
- : signal.removeEventListener('abort', onabort);
56459
- });
56460
- signals = null;
56461
- }
56462
- };
57043
+ if (!timeout && !signals.length) {
57044
+ return;
57045
+ }
57046
+
57047
+ const controller = new AbortController();
57048
+
57049
+ let aborted = false;
56463
57050
 
56464
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
57051
+ const onabort = function (reason) {
57052
+ if (!aborted) {
57053
+ aborted = true;
57054
+ unsubscribe();
57055
+ const err = reason instanceof Error ? reason : this.reason;
57056
+ controller.abort(
57057
+ err instanceof AxiosError
57058
+ ? err
57059
+ : new CanceledError(err instanceof Error ? err.message : err)
57060
+ );
57061
+ }
57062
+ };
57063
+
57064
+ let timer =
57065
+ timeout &&
57066
+ setTimeout(() => {
57067
+ timer = null;
57068
+ onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
57069
+ }, timeout);
57070
+
57071
+ const unsubscribe = () => {
57072
+ if (!signals) { return; }
57073
+ timer && clearTimeout(timer);
57074
+ timer = null;
57075
+ signals.forEach((signal) => {
57076
+ signal.unsubscribe
57077
+ ? signal.unsubscribe(onabort)
57078
+ : signal.removeEventListener('abort', onabort);
57079
+ });
57080
+ signals = null;
57081
+ };
56465
57082
 
56466
- const { signal } = controller;
57083
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
56467
57084
 
56468
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
57085
+ const { signal } = controller;
56469
57086
 
56470
- return signal;
56471
- }
57087
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
57088
+
57089
+ return signal;
56472
57090
  };
56473
57091
 
56474
57092
  const streamChunk = function* (chunk, chunkSize) {
@@ -56561,16 +57179,112 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
56561
57179
  );
56562
57180
  };
56563
57181
 
56564
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
57182
+ /**
57183
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
57184
+ * - For base64: compute exact decoded size using length and padding;
57185
+ * handle %XX at the character-count level (no string allocation).
57186
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
57187
+ *
57188
+ * @param {string} url
57189
+ * @returns {number}
57190
+ */
57191
+ function estimateDataURLDecodedBytes(url) {
57192
+ if (!url || typeof url !== 'string') return 0;
57193
+ if (!url.startsWith('data:')) return 0;
57194
+
57195
+ const comma = url.indexOf(',');
57196
+ if (comma < 0) return 0;
57197
+
57198
+ const meta = url.slice(5, comma);
57199
+ const body = url.slice(comma + 1);
57200
+ const isBase64 = /;base64/i.test(meta);
57201
+
57202
+ if (isBase64) {
57203
+ let effectiveLen = body.length;
57204
+ const len = body.length; // cache length
57205
+
57206
+ for (let i = 0; i < len; i++) {
57207
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
57208
+ const a = body.charCodeAt(i + 1);
57209
+ const b = body.charCodeAt(i + 2);
57210
+ const isHex =
57211
+ ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
57212
+ ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
57213
+
57214
+ if (isHex) {
57215
+ effectiveLen -= 2;
57216
+ i += 2;
57217
+ }
57218
+ }
57219
+ }
56565
57220
 
56566
- const { isFunction } = utils$1;
57221
+ let pad = 0;
57222
+ let idx = len - 1;
57223
+
57224
+ const tailIsPct3D = (j) =>
57225
+ j >= 2 &&
57226
+ body.charCodeAt(j - 2) === 37 && // '%'
57227
+ body.charCodeAt(j - 1) === 51 && // '3'
57228
+ (body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
57229
+
57230
+ if (idx >= 0) {
57231
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
57232
+ pad++;
57233
+ idx--;
57234
+ } else if (tailIsPct3D(idx)) {
57235
+ pad++;
57236
+ idx -= 3;
57237
+ }
57238
+ }
57239
+
57240
+ if (pad === 1 && idx >= 0) {
57241
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
57242
+ pad++;
57243
+ } else if (tailIsPct3D(idx)) {
57244
+ pad++;
57245
+ }
57246
+ }
57247
+
57248
+ const groups = Math.floor(effectiveLen / 4);
57249
+ const bytes = groups * 3 - (pad || 0);
57250
+ return bytes > 0 ? bytes : 0;
57251
+ }
57252
+
57253
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
57254
+ return Buffer.byteLength(body, 'utf8');
57255
+ }
57256
+
57257
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
57258
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
57259
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
57260
+ // but 3 UTF-8 bytes).
57261
+ let bytes = 0;
57262
+ for (let i = 0, len = body.length; i < len; i++) {
57263
+ const c = body.charCodeAt(i);
57264
+ if (c < 0x80) {
57265
+ bytes += 1;
57266
+ } else if (c < 0x800) {
57267
+ bytes += 2;
57268
+ } else if (c >= 0xd800 && c <= 0xdbff && i + 1 < len) {
57269
+ const next = body.charCodeAt(i + 1);
57270
+ if (next >= 0xdc00 && next <= 0xdfff) {
57271
+ bytes += 4;
57272
+ i++;
57273
+ } else {
57274
+ bytes += 3;
57275
+ }
57276
+ } else {
57277
+ bytes += 3;
57278
+ }
57279
+ }
57280
+ return bytes;
57281
+ }
56567
57282
 
56568
- const globalFetchAPI = (({ Request, Response }) => ({
56569
- Request,
56570
- Response,
56571
- }))(utils$1.global);
57283
+ const VERSION = "1.16.1";
56572
57284
 
56573
- const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
57285
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
57286
+
57287
+ const { isFunction } = utils$1;
56574
57288
 
56575
57289
  const test = (fn, ...args) => {
56576
57290
  try {
@@ -56581,11 +57295,20 @@ const test = (fn, ...args) => {
56581
57295
  };
56582
57296
 
56583
57297
  const factory = (env) => {
57298
+ const globalObject =
57299
+ utils$1.global !== undefined && utils$1.global !== null
57300
+ ? utils$1.global
57301
+ : globalThis;
57302
+ const { ReadableStream, TextEncoder } = globalObject;
57303
+
56584
57304
  env = utils$1.merge.call(
56585
57305
  {
56586
57306
  skipUndefined: true,
56587
57307
  },
56588
- globalFetchAPI,
57308
+ {
57309
+ Request: globalObject.Request,
57310
+ Response: globalObject.Response,
57311
+ },
56589
57312
  env
56590
57313
  );
56591
57314
 
@@ -56598,7 +57321,7 @@ const factory = (env) => {
56598
57321
  return false;
56599
57322
  }
56600
57323
 
56601
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
57324
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
56602
57325
 
56603
57326
  const encodeText =
56604
57327
  isFetchSupported &&
@@ -56616,7 +57339,7 @@ const factory = (env) => {
56616
57339
  let duplexAccessed = false;
56617
57340
 
56618
57341
  const request = new Request(platform.origin, {
56619
- body: new ReadableStream$1(),
57342
+ body: new ReadableStream(),
56620
57343
  method: 'POST',
56621
57344
  get duplex() {
56622
57345
  duplexAccessed = true;
@@ -56712,8 +57435,13 @@ const factory = (env) => {
56712
57435
  headers,
56713
57436
  withCredentials = 'same-origin',
56714
57437
  fetchOptions,
57438
+ maxContentLength,
57439
+ maxBodyLength,
56715
57440
  } = resolveConfig(config);
56716
57441
 
57442
+ const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
57443
+ const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
57444
+
56717
57445
  let _fetch = envFetch || fetch;
56718
57446
 
56719
57447
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
@@ -56735,6 +57463,41 @@ const factory = (env) => {
56735
57463
  let requestContentLength;
56736
57464
 
56737
57465
  try {
57466
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
57467
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
57468
+ // "if (protocol === 'data:')" branch).
57469
+ if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
57470
+ const estimated = estimateDataURLDecodedBytes(url);
57471
+ if (estimated > maxContentLength) {
57472
+ throw new AxiosError(
57473
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57474
+ AxiosError.ERR_BAD_RESPONSE,
57475
+ config,
57476
+ request
57477
+ );
57478
+ }
57479
+ }
57480
+
57481
+ // Enforce maxBodyLength against the outbound request body before dispatch.
57482
+ // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
57483
+ // maxBodyLength limit'). Skip when the body length cannot be determined
57484
+ // (e.g. a live ReadableStream supplied by the caller).
57485
+ if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
57486
+ const outboundLength = await resolveBodyLength(headers, data);
57487
+ if (
57488
+ typeof outboundLength === 'number' &&
57489
+ isFinite(outboundLength) &&
57490
+ outboundLength > maxBodyLength
57491
+ ) {
57492
+ throw new AxiosError(
57493
+ 'Request body larger than maxBodyLength limit',
57494
+ AxiosError.ERR_BAD_REQUEST,
57495
+ config,
57496
+ request
57497
+ );
57498
+ }
57499
+ }
57500
+
56738
57501
  if (
56739
57502
  onUploadProgress &&
56740
57503
  supportsRequestStream &&
@@ -56785,11 +57548,14 @@ const factory = (env) => {
56785
57548
  }
56786
57549
  }
56787
57550
 
57551
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
57552
+ headers.set('User-Agent', 'axios/' + VERSION, false);
57553
+
56788
57554
  const resolvedOptions = {
56789
57555
  ...fetchOptions,
56790
57556
  signal: composedSignal,
56791
57557
  method: method.toUpperCase(),
56792
- headers: headers.normalize().toJSON(),
57558
+ headers: toByteStringHeaderObject(headers.normalize()),
56793
57559
  body: data,
56794
57560
  duplex: 'half',
56795
57561
  credentials: isCredentialsSupported ? withCredentials : undefined,
@@ -56801,10 +57567,28 @@ const factory = (env) => {
56801
57567
  ? _fetch(request, fetchOptions)
56802
57568
  : _fetch(url, resolvedOptions));
56803
57569
 
57570
+ // Cheap pre-check: if the server honestly declares a content-length that
57571
+ // already exceeds the cap, reject before we start streaming.
57572
+ if (hasMaxContentLength) {
57573
+ const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
57574
+ if (declaredLength != null && declaredLength > maxContentLength) {
57575
+ throw new AxiosError(
57576
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57577
+ AxiosError.ERR_BAD_RESPONSE,
57578
+ config,
57579
+ request
57580
+ );
57581
+ }
57582
+ }
57583
+
56804
57584
  const isStreamResponse =
56805
57585
  supportsResponseStream && (responseType === 'stream' || responseType === 'response');
56806
57586
 
56807
- if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
57587
+ if (
57588
+ supportsResponseStream &&
57589
+ response.body &&
57590
+ (onDownloadProgress || hasMaxContentLength || (isStreamResponse && unsubscribe))
57591
+ ) {
56808
57592
  const options = {};
56809
57593
 
56810
57594
  ['status', 'statusText', 'headers'].forEach((prop) => {
@@ -56821,8 +57605,24 @@ const factory = (env) => {
56821
57605
  )) ||
56822
57606
  [];
56823
57607
 
57608
+ let bytesRead = 0;
57609
+ const onChunkProgress = (loadedBytes) => {
57610
+ if (hasMaxContentLength) {
57611
+ bytesRead = loadedBytes;
57612
+ if (bytesRead > maxContentLength) {
57613
+ throw new AxiosError(
57614
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57615
+ AxiosError.ERR_BAD_RESPONSE,
57616
+ config,
57617
+ request
57618
+ );
57619
+ }
57620
+ }
57621
+ onProgress && onProgress(loadedBytes);
57622
+ };
57623
+
56824
57624
  response = new Response(
56825
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
57625
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, () => {
56826
57626
  flush && flush();
56827
57627
  unsubscribe && unsubscribe();
56828
57628
  }),
@@ -56837,6 +57637,33 @@ const factory = (env) => {
56837
57637
  config
56838
57638
  );
56839
57639
 
57640
+ // Fallback enforcement for environments without ReadableStream support
57641
+ // (legacy runtimes). Detect materialized size from typed output; skip
57642
+ // streams/Response passthrough since the user will read those themselves.
57643
+ if (hasMaxContentLength && !supportsResponseStream && !isStreamResponse) {
57644
+ let materializedSize;
57645
+ if (responseData != null) {
57646
+ if (typeof responseData.byteLength === 'number') {
57647
+ materializedSize = responseData.byteLength;
57648
+ } else if (typeof responseData.size === 'number') {
57649
+ materializedSize = responseData.size;
57650
+ } else if (typeof responseData === 'string') {
57651
+ materializedSize =
57652
+ typeof TextEncoder === 'function'
57653
+ ? new TextEncoder().encode(responseData).byteLength
57654
+ : responseData.length;
57655
+ }
57656
+ }
57657
+ if (typeof materializedSize === 'number' && materializedSize > maxContentLength) {
57658
+ throw new AxiosError(
57659
+ 'maxContentLength size of ' + maxContentLength + ' exceeded',
57660
+ AxiosError.ERR_BAD_RESPONSE,
57661
+ config,
57662
+ request
57663
+ );
57664
+ }
57665
+ }
57666
+
56840
57667
  !isStreamResponse && unsubscribe && unsubscribe();
56841
57668
 
56842
57669
  return await new Promise((resolve, reject) => {
@@ -56852,6 +57679,17 @@ const factory = (env) => {
56852
57679
  } catch (err) {
56853
57680
  unsubscribe && unsubscribe();
56854
57681
 
57682
+ // Safari can surface fetch aborts as a DOMException-like object whose
57683
+ // branded getters throw. Prefer our composed signal reason before reading
57684
+ // the caught error, preserving timeout vs cancellation semantics.
57685
+ if (composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError) {
57686
+ const canceledError = composedSignal.reason;
57687
+ canceledError.config = config;
57688
+ request && (canceledError.request = request);
57689
+ err !== canceledError && (canceledError.cause = err);
57690
+ throw canceledError;
57691
+ }
57692
+
56855
57693
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
56856
57694
  throw Object.assign(
56857
57695
  new AxiosError(
@@ -56920,11 +57758,13 @@ const knownAdapters = {
56920
57758
  utils$1.forEach(knownAdapters, (fn, value) => {
56921
57759
  if (fn) {
56922
57760
  try {
56923
- Object.defineProperty(fn, 'name', { value });
57761
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
57762
+ // these data descriptors into accessor descriptors on the way in.
57763
+ Object.defineProperty(fn, 'name', { __proto__: null, value });
56924
57764
  } catch (e) {
56925
57765
  // eslint-disable-next-line no-empty
56926
57766
  }
56927
- Object.defineProperty(fn, 'adapterName', { value });
57767
+ Object.defineProperty(fn, 'adapterName', { __proto__: null, value });
56928
57768
  }
56929
57769
  });
56930
57770
 
@@ -57066,8 +57906,15 @@ function dispatchRequest(config) {
57066
57906
  function onAdapterResolution(response) {
57067
57907
  throwIfCancellationRequested(config);
57068
57908
 
57069
- // Transform response data
57070
- response.data = transformData.call(config, config.transformResponse, response);
57909
+ // Expose the current response on config so that transformResponse can
57910
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
57911
+ // We clean it up afterwards to avoid polluting the config object.
57912
+ config.response = response;
57913
+ try {
57914
+ response.data = transformData.call(config, config.transformResponse, response);
57915
+ } finally {
57916
+ delete config.response;
57917
+ }
57071
57918
 
57072
57919
  response.headers = AxiosHeaders.from(response.headers);
57073
57920
 
@@ -57079,11 +57926,16 @@ function dispatchRequest(config) {
57079
57926
 
57080
57927
  // Transform response data
57081
57928
  if (reason && reason.response) {
57082
- reason.response.data = transformData.call(
57083
- config,
57084
- config.transformResponse,
57085
- reason.response
57086
- );
57929
+ config.response = reason.response;
57930
+ try {
57931
+ reason.response.data = transformData.call(
57932
+ config,
57933
+ config.transformResponse,
57934
+ reason.response
57935
+ );
57936
+ } finally {
57937
+ delete config.response;
57938
+ }
57087
57939
  reason.response.headers = AxiosHeaders.from(reason.response.headers);
57088
57940
  }
57089
57941
  }
@@ -57093,8 +57945,6 @@ function dispatchRequest(config) {
57093
57945
  );
57094
57946
  }
57095
57947
 
57096
- const VERSION = "1.15.2";
57097
-
57098
57948
  const validators$1 = {};
57099
57949
 
57100
57950
  // eslint-disable-next-line func-names
@@ -57179,7 +58029,7 @@ function assertOptions(options, schema, allowUnknown) {
57179
58029
  while (i-- > 0) {
57180
58030
  const opt = keys[i];
57181
58031
  // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
57182
- // a non-function validator and cause a TypeError. See GHSA-q8qp-cvcw-x6jj.
58032
+ // a non-function validator and cause a TypeError.
57183
58033
  const validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
57184
58034
  if (validator) {
57185
58035
  const value = options[opt];
@@ -57339,7 +58189,7 @@ class Axios {
57339
58189
  let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
57340
58190
 
57341
58191
  headers &&
57342
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
58192
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], (method) => {
57343
58193
  delete headers[method];
57344
58194
  });
57345
58195
 
@@ -57442,7 +58292,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
57442
58292
  };
57443
58293
  });
57444
58294
 
57445
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
58295
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
57446
58296
  function generateHTTPMethod(isForm) {
57447
58297
  return function httpMethod(url, data, config) {
57448
58298
  return this.request(
@@ -57462,7 +58312,11 @@ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method)
57462
58312
 
57463
58313
  Axios.prototype[method] = generateHTTPMethod();
57464
58314
 
57465
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
58315
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
58316
+ // its semantics, so no queryForm shorthand is generated.
58317
+ if (method !== 'query') {
58318
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
58319
+ }
57466
58320
  });
57467
58321
 
57468
58322
  /**
@@ -60015,7 +60869,9 @@ const MainVn = (props) => {
60015
60869
  win4DKhr = 0,
60016
60870
  win4DUsd = 0,
60017
60871
  winLoseKhr = 0,
60018
- winLoseUsd = 0
60872
+ winLoseUsd = 0,
60873
+ shareAmountKhr = 0,
60874
+ shareAmountUsd = 0
60019
60875
  },
60020
60876
  hasLottery: {
60021
60877
  rebateRate1D = 0,
@@ -60100,6 +60956,7 @@ const MainVn = (props) => {
60100
60956
  });
60101
60957
  const isShow = (value) => !isMix && value;
60102
60958
  const titleColSpan = isShowUsd ? 2 + mergeAll + mergeKhr + mergeUsd : 2 + mergeKhr * 2;
60959
+ let isShare = shareAmountKhr !== winLoseKhr || shareAmountUsd !== winLoseUsd;
60103
60960
  return /* @__PURE__ */ jsx$1("div", { id: "wrap-tb", className: "mb-3 mr-3", children: /* @__PURE__ */ jsx$1("table", { id, className: `table table-hover table-striped ${className}`, children: /* @__PURE__ */ jsxs("tbody", { className: "pb-5", children: [
60104
60961
  renderReportTitleRows({
60105
60962
  preTitle,
@@ -60187,6 +61044,17 @@ const MainVn = (props) => {
60187
61044
  isShowUsd,
60188
61045
  winLoseKhr,
60189
61046
  winLoseUsd,
61047
+ borderClassName: isShare ? "" : "b-vio-b",
61048
+ khrAfterValue: [{ colSpan: isShowUsd ? getAllLength + 4 : mergeKhr + 8 }],
61049
+ usdAfterValue: [{ colSpan: 7 }]
61050
+ }),
61051
+ isShare && renderWinLoseRow({
61052
+ id,
61053
+ isShowUsd,
61054
+ khrLabel: "\u1780\u17B6\u178F\u17CB Share \u179A\u17BD\u1785",
61055
+ usdLabel: "\u1780\u17B6\u178F\u17CB Share \u179A\u17BD\u1785",
61056
+ winLoseKhr: shareAmountKhr,
61057
+ winLoseUsd: shareAmountUsd,
60190
61058
  khrAfterValue: [{ colSpan: isShowUsd ? getAllLength + 4 : mergeKhr + 8 }],
60191
61059
  usdAfterValue: [{ colSpan: 7 }]
60192
61060
  })
@@ -61286,8 +62154,16 @@ const SummaryImageActions = ({ children, fileName }) => {
61286
62154
  ] }) });
61287
62155
  };
61288
62156
 
61289
- const SummaryRow = ({ id, label, khr, usd, showUsd, className = "", labelClassName = "text-center" }) => /* @__PURE__ */ jsxs("tr", { className: "animate-slide-up", children: [
61290
- /* @__PURE__ */ jsx$1(THB, { colSpan: 4, className: labelClassName, children: label }),
62157
+ const SummaryRow = ({ id, label, khr, usd, showUsd, className = "", labelClassName = "text-center", share = 100 }) => /* @__PURE__ */ jsxs("tr", { className: "animate-slide-up", children: [
62158
+ /* @__PURE__ */ jsxs(THB, { colSpan: 4, className: labelClassName, children: [
62159
+ label,
62160
+ " ",
62161
+ share !== 100 ? /* @__PURE__ */ jsxs("span", { className: "text-info", children: [
62162
+ " (",
62163
+ share,
62164
+ "%)"
62165
+ ] }) : ""
62166
+ ] }),
61291
62167
  /* @__PURE__ */ jsx$1(RenderThWidthB, { colSpan: showUsd ? 3 : 6, className: `${className} t-right`, id, value: khr, currency: "KHR" }),
61292
62168
  showUsd && /* @__PURE__ */ jsx$1(RenderThWidthB, { colSpan: 3, className: `${className} t-right`, id, value: usd, currency: "USD" })
61293
62169
  ] });
@@ -61322,8 +62198,6 @@ const WinLoseSummary = ({ data, id, filter, showUsd }) => {
61322
62198
  } = data || {};
61323
62199
  const user = getSummaryUser({ data, filter });
61324
62200
  const totalStyle = { borderBottom: "2px solid black", borderTop: "2px solid black" };
61325
- const summaryValueKhr = (filter == null ? void 0 : filter.isSend) ? winLoseKhr : shareAmountKhr;
61326
- const summaryValueUsd = (filter == null ? void 0 : filter.isSend) ? winLoseUsd : shareAmountUsd;
61327
62201
  return /* @__PURE__ */ jsx$1(SummaryImageActions, { fileName: getSummaryImageFileName("win-lose-summary", filter), children: (actions) => /* @__PURE__ */ jsx$1(
61328
62202
  "table",
61329
62203
  {
@@ -61345,17 +62219,18 @@ const WinLoseSummary = ({ data, id, filter, showUsd }) => {
61345
62219
  /* @__PURE__ */ jsx$1(THB, { className: "blue-l-h", colSpan: showUsd ? 3 : 6, children: "(\u179A\u17C0\u179B)" }),
61346
62220
  showUsd && /* @__PURE__ */ jsx$1(THB, { colSpan: 3, className: "green-l-h text-left", children: "(\u178A\u17BB\u179B\u17D2\u179B\u17B6\u179A)" })
61347
62221
  ] }),
61348
- winLoses.map(({ winLoseKhr: winLoseKhr2, winLoseUsd: winLoseUsd2, lotteryType }, index) => {
62222
+ winLoses.map(({ winLoseKhr: winLoseKhr2, winLoseUsd: winLoseUsd2, lotteryType, share }, index) => {
61349
62223
  const lotteryName = lotteryLabelKH[lotteryType] || lotteryType;
61350
- const lotteryCode = lotteryLabel[lotteryType] || lotteryType;
62224
+ const lotteryCode2 = lotteryCodes[lotteryType] || lotteryType;
61351
62225
  return /* @__PURE__ */ jsx$1(
61352
62226
  SummaryRow,
61353
62227
  {
61354
62228
  id,
61355
- label: `\u1786\u17D2\u1793\u17C4\u178F${lotteryName} (${lotteryCode})`,
62229
+ label: `\u1786\u17D2\u1793\u17C4\u178F${lotteryName} (${lotteryCode2})`,
61356
62230
  khr: winLoseKhr2,
61357
62231
  usd: winLoseUsd2,
61358
62232
  showUsd,
62233
+ share,
61359
62234
  labelClassName: "t-left"
61360
62235
  },
61361
62236
  `${lotteryType}-${index}`
@@ -61363,8 +62238,8 @@ const WinLoseSummary = ({ data, id, filter, showUsd }) => {
61363
62238
  }),
61364
62239
  /* @__PURE__ */ jsxs("tr", { className: "animate-slide-up b-vio-b2", children: [
61365
62240
  /* @__PURE__ */ jsx$1(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" }),
61366
- /* @__PURE__ */ jsx$1(RenderThWidthB, { className: "t-right f-bold blue-l-h", colSpan: showUsd ? 3 : 6, id, value: summaryValueKhr, currency: "KHR" }),
61367
- showUsd && /* @__PURE__ */ jsx$1(RenderThWidthB, { colSpan: 3, className: "t-right f-bold green-l-h", id, value: summaryValueUsd, currency: "USD" })
62241
+ /* @__PURE__ */ jsx$1(RenderThWidthB, { className: "t-right f-bold blue-l-h", colSpan: showUsd ? 3 : 6, id, value: shareAmountKhr, currency: "KHR" }),
62242
+ showUsd && /* @__PURE__ */ jsx$1(RenderThWidthB, { colSpan: 3, className: "t-right f-bold green-l-h", id, value: shareAmountUsd, currency: "USD" })
61368
62243
  ] }),
61369
62244
  /* @__PURE__ */ jsx$1(SummaryRow, { id, label: "\u1794\u1789\u17D2\u1787\u17B8\u1785\u17B6\u179F\u17CB", khr: oldKhr, usd: oldUsd, showUsd }),
61370
62245
  /* @__PURE__ */ jsx$1(SummaryRow, { id, label: "\u179B\u17BB\u1799\u179F\u1784", khr: giveKhr, usd: giveUsd, showUsd }),
@@ -61492,5 +62367,5 @@ class MainTableWrapExcel extends Component {
61492
62367
  }
61493
62368
  }
61494
62369
 
61495
- export { DeleteModal, DeleteTicketButton, MoreMenu as DropdownMenu, KPLO, KPPostCode, MainTableWrap as MixDailyReport, MainTableWrapExcel as MixDailyReportExcel, Printer, ProtestButton, ProtestModal, ProtestTicket, RemarkConfigToggle, RemarkModal, RemarkModalShowOnly, SCPostCode, SaryLottery, SaryPrintAll, THLabel, Ticket, TicketModal, TransferModal, TransferTicket, clickRemarkBtn, formatUsd, getMemberName, getS3ImgPrint, getStoredIsRemark, isVNType, lType, lotteryLabel, lotteryLabelKH, lotteryLabelOnline, lotteryLabelVN, lotteryReportLabel, mapBetTitle, mapLabels, mapStrPost, widthLength };
62370
+ export { DeleteModal, DeleteTicketButton, MoreMenu as DropdownMenu, KPLO, KPPostCode, MainTableWrap as MixDailyReport, MainTableWrapExcel as MixDailyReportExcel, Printer, ProtestButton, ProtestModal, ProtestTicket, RemarkConfigToggle, RemarkModal, RemarkModalShowOnly, SCPostCode, SaryLottery, SaryPrintAll, THLabel, Ticket, TicketModal, TransferModal, TransferTicket, clickRemarkBtn, formatUsd, getMemberName, getS3ImgPrint, getStoredIsRemark, isVNType, lType, lotteryCodes, lotteryLabel, lotteryLabelKH, lotteryLabelOnline, lotteryLabelVN, lotteryReportLabel, mapBetTitle, mapLabels, mapStrPost, widthLength };
61496
62371
  //# sourceMappingURL=index.esm.js.map