techprotrade commited on
Commit
9363588
·
verified ·
1 Parent(s): adb87a5

Add scripts directory (part 5)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. scripts/node_modules/@types/react-dom/LICENSE +21 -0
  2. scripts/node_modules/@types/react-dom/README.md +16 -0
  3. scripts/node_modules/@types/react-dom/canary.d.ts +185 -0
  4. scripts/node_modules/@types/react-dom/client.d.ts +72 -0
  5. scripts/node_modules/@types/react-dom/experimental.d.ts +36 -0
  6. scripts/node_modules/@types/react-dom/index.d.ts +150 -0
  7. scripts/node_modules/@types/react-dom/package.json +88 -0
  8. scripts/node_modules/@types/react-dom/server.d.ts +131 -0
  9. scripts/node_modules/@types/react-dom/test-utils/index.d.ts +402 -0
  10. scripts/node_modules/@vitejs/plugin-react/LICENSE +21 -0
  11. scripts/node_modules/@vitejs/plugin-react/README.md +142 -0
  12. scripts/node_modules/@vitejs/plugin-react/dist/index.cjs +343 -0
  13. scripts/node_modules/@vitejs/plugin-react/dist/index.d.cts +67 -0
  14. scripts/node_modules/@vitejs/plugin-react/dist/index.d.ts +67 -0
  15. scripts/node_modules/@vitejs/plugin-react/dist/index.js +320 -0
  16. scripts/node_modules/@vitejs/plugin-react/dist/refresh-runtime.js +670 -0
  17. scripts/node_modules/@vitejs/plugin-react/package.json +70 -0
  18. scripts/node_modules/asynckit/LICENSE +21 -0
  19. scripts/node_modules/asynckit/README.md +233 -0
  20. scripts/node_modules/asynckit/bench.js +76 -0
  21. scripts/node_modules/asynckit/index.js +6 -0
  22. scripts/node_modules/asynckit/lib/abort.js +29 -0
  23. scripts/node_modules/asynckit/lib/async.js +34 -0
  24. scripts/node_modules/asynckit/lib/defer.js +26 -0
  25. scripts/node_modules/asynckit/lib/iterate.js +75 -0
  26. scripts/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  27. scripts/node_modules/asynckit/lib/readable_parallel.js +25 -0
  28. scripts/node_modules/asynckit/lib/readable_serial.js +25 -0
  29. scripts/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  30. scripts/node_modules/asynckit/lib/state.js +37 -0
  31. scripts/node_modules/asynckit/lib/streamify.js +141 -0
  32. scripts/node_modules/asynckit/lib/terminator.js +29 -0
  33. scripts/node_modules/asynckit/package.json +63 -0
  34. scripts/node_modules/asynckit/parallel.js +43 -0
  35. scripts/node_modules/asynckit/serial.js +17 -0
  36. scripts/node_modules/asynckit/serialOrdered.js +75 -0
  37. scripts/node_modules/asynckit/stream.js +21 -0
  38. scripts/node_modules/axios/CHANGELOG.md +0 -0
  39. scripts/node_modules/axios/LICENSE +7 -0
  40. scripts/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  41. scripts/node_modules/axios/README.md +2019 -0
  42. scripts/node_modules/axios/dist/axios.js +0 -0
  43. scripts/node_modules/axios/dist/axios.js.map +0 -0
  44. scripts/node_modules/axios/dist/axios.min.js +5 -0
  45. scripts/node_modules/axios/dist/axios.min.js.map +0 -0
  46. scripts/node_modules/axios/dist/browser/axios.cjs +0 -0
  47. scripts/node_modules/axios/dist/browser/axios.cjs.map +0 -0
  48. scripts/node_modules/axios/dist/esm/axios.js +0 -0
  49. scripts/node_modules/axios/dist/esm/axios.js.map +0 -0
  50. scripts/node_modules/axios/dist/esm/axios.min.js +3 -0
scripts/node_modules/@types/react-dom/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
scripts/node_modules/@types/react-dom/README.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installation
2
+ > `npm install --save @types/react-dom`
3
+
4
+ # Summary
5
+ This package contains type definitions for react-dom (https://reactjs.org).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom/v18.
9
+
10
+ ### Additional Details
11
+ * Last updated: Wed, 30 Apr 2025 10:37:29 GMT
12
+ * Dependencies: none
13
+ * Peer dependencies: [@types/react](https://npmjs.com/package/@types/react)
14
+
15
+ # Credits
16
+ These definitions were written by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com), [Microsoft](https://microsoft.com), [MartynasZilinskas](https://github.com/MartynasZilinskas), [Josh Rutherford](https://github.com/theruther4d), [Jessica Franco](https://github.com/Jessidhia), and [Sebastian Silbermann](https://github.com/eps1lon).
scripts/node_modules/@types/react-dom/canary.d.ts ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * These are types for things that are present in the upcoming React 18 release.
3
+ *
4
+ * Once React 18 is released they can just be moved to the main index file.
5
+ *
6
+ * To load the types declared here in an actual project, there are three ways. The easiest one,
7
+ * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
8
+ * is to add `"react-dom/canary"` to the `"types"` array.
9
+ *
10
+ * Alternatively, a specific import syntax can to be used from a typescript file.
11
+ * This module does not exist in reality, which is why the {} is important:
12
+ *
13
+ * ```ts
14
+ * import {} from 'react-dom/canary'
15
+ * ```
16
+ *
17
+ * It is also possible to include it through a triple-slash reference:
18
+ *
19
+ * ```ts
20
+ * /// <reference types="react-dom/canary" />
21
+ * ```
22
+ *
23
+ * Either the import or the reference only needs to appear once, anywhere in the project.
24
+ */
25
+
26
+ // See https://github.com/facebook/react/blob/main/packages/react-dom/index.js to see how the exports are declared,
27
+ // but confirm with published source code (e.g. https://unpkg.com/react-dom@canary) that these exports end up in the published code
28
+
29
+ import React = require("react");
30
+ import ReactDOM = require(".");
31
+
32
+ export {};
33
+
34
+ declare const REACT_FORM_STATE_SIGIL: unique symbol;
35
+
36
+ declare module "." {
37
+ function prefetchDNS(href: string): void;
38
+
39
+ interface PreconnectOptions {
40
+ // Don't create a helper type.
41
+ // It would have to be in module scope to be inlined in TS tooltips.
42
+ // But then it becomes part of the public API.
43
+ // TODO: Upstream to microsoft/TypeScript-DOM-lib-generator -> w3c/webref
44
+ // since the spec has a notion of a dedicated type: https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attribute
45
+ crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
46
+ }
47
+ function preconnect(href: string, options?: PreconnectOptions): void;
48
+
49
+ type PreloadAs =
50
+ | "audio"
51
+ | "document"
52
+ | "embed"
53
+ | "fetch"
54
+ | "font"
55
+ | "image"
56
+ | "object"
57
+ | "track"
58
+ | "script"
59
+ | "style"
60
+ | "video"
61
+ | "worker";
62
+ interface PreloadOptions {
63
+ as: PreloadAs;
64
+ crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
65
+ fetchPriority?: "high" | "low" | "auto" | undefined;
66
+ // TODO: These should only be allowed with `as: 'image'` but it's not trivial to write tests against the full TS support matrix.
67
+ imageSizes?: string | undefined;
68
+ imageSrcSet?: string | undefined;
69
+ integrity?: string | undefined;
70
+ type?: string | undefined;
71
+ nonce?: string | undefined;
72
+ referrerPolicy?: ReferrerPolicy | undefined;
73
+ media?: string | undefined;
74
+ }
75
+ function preload(href: string, options?: PreloadOptions): void;
76
+
77
+ // https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload
78
+ type PreloadModuleAs = RequestDestination;
79
+ interface PreloadModuleOptions {
80
+ /**
81
+ * @default "script"
82
+ */
83
+ as: PreloadModuleAs;
84
+ crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
85
+ integrity?: string | undefined;
86
+ nonce?: string | undefined;
87
+ }
88
+ function preloadModule(href: string, options?: PreloadModuleOptions): void;
89
+
90
+ type PreinitAs = "script" | "style";
91
+ interface PreinitOptions {
92
+ as: PreinitAs;
93
+ crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
94
+ fetchPriority?: "high" | "low" | "auto" | undefined;
95
+ precedence?: string | undefined;
96
+ integrity?: string | undefined;
97
+ nonce?: string | undefined;
98
+ }
99
+ function preinit(href: string, options?: PreinitOptions): void;
100
+
101
+ // Will be expanded to include all of https://github.com/tc39/proposal-import-attributes
102
+ type PreinitModuleAs = "script";
103
+ interface PreinitModuleOptions {
104
+ /**
105
+ * @default "script"
106
+ */
107
+ as?: PreinitModuleAs;
108
+ crossOrigin?: "anonymous" | "use-credentials" | "" | undefined;
109
+ integrity?: string | undefined;
110
+ nonce?: string | undefined;
111
+ }
112
+ function preinitModule(href: string, options?: PreinitModuleOptions): void;
113
+
114
+ interface FormStatusNotPending {
115
+ pending: false;
116
+ data: null;
117
+ method: null;
118
+ action: null;
119
+ }
120
+
121
+ interface FormStatusPending {
122
+ pending: true;
123
+ data: FormData;
124
+ method: string;
125
+ action: string | ((formData: FormData) => void | Promise<void>);
126
+ }
127
+
128
+ type FormStatus = FormStatusPending | FormStatusNotPending;
129
+
130
+ function useFormStatus(): FormStatus;
131
+
132
+ function useFormState<State>(
133
+ action: (state: Awaited<State>) => State | Promise<State>,
134
+ initialState: Awaited<State>,
135
+ permalink?: string,
136
+ ): [state: Awaited<State>, dispatch: () => void, isPending: boolean];
137
+ function useFormState<State, Payload>(
138
+ action: (state: Awaited<State>, payload: Payload) => State | Promise<State>,
139
+ initialState: Awaited<State>,
140
+ permalink?: string,
141
+ ): [state: Awaited<State>, dispatch: (payload: Payload) => void, isPending: boolean];
142
+
143
+ function requestFormReset(form: HTMLFormElement): void;
144
+ }
145
+
146
+ declare module "./client" {
147
+ interface ReactFormState {
148
+ [REACT_FORM_STATE_SIGIL]: never;
149
+ }
150
+
151
+ interface RootOptions {
152
+ onUncaughtError?:
153
+ | ((error: unknown, errorInfo: { componentStack?: string | undefined }) => void)
154
+ | undefined;
155
+ onCaughtError?:
156
+ | ((
157
+ error: unknown,
158
+ errorInfo: {
159
+ componentStack?: string | undefined;
160
+ errorBoundary?: React.Component<unknown> | undefined;
161
+ },
162
+ ) => void)
163
+ | undefined;
164
+ }
165
+
166
+ interface HydrationOptions {
167
+ formState?: ReactFormState | null;
168
+ onUncaughtError?:
169
+ | ((error: unknown, errorInfo: { componentStack?: string | undefined }) => void)
170
+ | undefined;
171
+ onCaughtError?:
172
+ | ((
173
+ error: unknown,
174
+ errorInfo: {
175
+ componentStack?: string | undefined;
176
+ errorBoundary?: React.Component<unknown> | undefined;
177
+ },
178
+ ) => void)
179
+ | undefined;
180
+ }
181
+
182
+ interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS {
183
+ document: Document;
184
+ }
185
+ }
scripts/node_modules/@types/react-dom/client.d.ts ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WARNING: This entrypoint is only available starting with `react-dom@18.0.0-rc.1`
3
+ */
4
+
5
+ // See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared,
6
+
7
+ import React = require("react");
8
+ export interface HydrationOptions {
9
+ /**
10
+ * Prefix for `useId`.
11
+ */
12
+ identifierPrefix?: string;
13
+ onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void;
14
+ }
15
+
16
+ export interface RootOptions {
17
+ /**
18
+ * Prefix for `useId`.
19
+ */
20
+ identifierPrefix?: string;
21
+ onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void;
22
+ }
23
+
24
+ export interface ErrorInfo {
25
+ digest?: string;
26
+ componentStack?: string;
27
+ }
28
+
29
+ export interface Root {
30
+ render(children: React.ReactNode): void;
31
+ unmount(): void;
32
+ }
33
+
34
+ /**
35
+ * Different release channels declare additional types of ReactNode this particular release channel accepts.
36
+ * App or library types should never augment this interface.
37
+ */
38
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
39
+ export interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS {}
40
+
41
+ export type Container =
42
+ | Element
43
+ | DocumentFragment
44
+ | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS[
45
+ keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS
46
+ ];
47
+
48
+ /**
49
+ * createRoot lets you create a root to display React components inside a browser DOM node.
50
+ *
51
+ * @see {@link https://react.dev/reference/react-dom/client/createRoot API Reference for `createRoot`}
52
+ */
53
+ export function createRoot(container: Container, options?: RootOptions): Root;
54
+
55
+ /**
56
+ * Same as `createRoot()`, but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer.
57
+ *
58
+ * React will attempt to attach event listeners to the existing markup.
59
+ *
60
+ * **Example Usage**
61
+ *
62
+ * ```jsx
63
+ * hydrateRoot(document.querySelector('#root'), <App />)
64
+ * ```
65
+ *
66
+ * @see https://reactjs.org/docs/react-dom-client.html#hydrateroot
67
+ */
68
+ export function hydrateRoot(
69
+ container: Element | Document,
70
+ initialChildren: React.ReactNode,
71
+ options?: HydrationOptions,
72
+ ): Root;
scripts/node_modules/@types/react-dom/experimental.d.ts ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * These are types for things that are present in the `experimental` builds of React but not yet
3
+ * on a stable build.
4
+ *
5
+ * Once they are promoted to stable they can just be moved to the main index file.
6
+ *
7
+ * To load the types declared here in an actual project, there are three ways. The easiest one,
8
+ * if your `tsconfig.json` already has a `"types"` array in the `"compilerOptions"` section,
9
+ * is to add `"react-dom/experimental"` to the `"types"` array.
10
+ *
11
+ * Alternatively, a specific import syntax can to be used from a typescript file.
12
+ * This module does not exist in reality, which is why the {} is important:
13
+ *
14
+ * ```ts
15
+ * import {} from 'react-dom/experimental'
16
+ * ```
17
+ *
18
+ * It is also possible to include it through a triple-slash reference:
19
+ *
20
+ * ```ts
21
+ * /// <reference types="react-dom/experimental" />
22
+ * ```
23
+ *
24
+ * Either the import or the reference only needs to appear once, anywhere in the project.
25
+ */
26
+
27
+ // See https://github.com/facebook/react/blob/main/packages/react-dom/index.experimental.js to see how the exports are declared,
28
+ // but confirm with published source code (e.g. https://unpkg.com/react-dom@experimental) that these exports end up in the published code
29
+
30
+ import React = require("react");
31
+ import ReactDOM = require("./canary");
32
+
33
+ export {};
34
+
35
+ declare module "." {
36
+ }
scripts/node_modules/@types/react-dom/index.d.ts ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // NOTE: Users of the `experimental` builds of React should add a reference
2
+ // to 'react-dom/experimental' in their project. See experimental.d.ts's top comment
3
+ // for reference and documentation on how exactly to do it.
4
+
5
+ export as namespace ReactDOM;
6
+
7
+ import {
8
+ CElement,
9
+ Component,
10
+ ComponentState,
11
+ DOMAttributes,
12
+ DOMElement,
13
+ FunctionComponentElement,
14
+ Key,
15
+ ReactElement,
16
+ ReactInstance,
17
+ ReactNode,
18
+ ReactPortal,
19
+ } from "react";
20
+
21
+ /**
22
+ * @deprecated See https://react.dev/reference/react-dom/findDOMNode#alternatives
23
+ */
24
+ export function findDOMNode(instance: ReactInstance | null | undefined): Element | null | Text;
25
+ /**
26
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
27
+ */
28
+ export function unmountComponentAtNode(container: Element | DocumentFragment): boolean;
29
+
30
+ export function createPortal(
31
+ children: ReactNode,
32
+ container: Element | DocumentFragment,
33
+ key?: Key | null,
34
+ ): ReactPortal;
35
+
36
+ export const version: string;
37
+ /**
38
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
39
+ */
40
+ export const render: Renderer;
41
+ /**
42
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
43
+ */
44
+ export const hydrate: Renderer;
45
+
46
+ export function flushSync<R>(fn: () => R): R;
47
+
48
+ export function unstable_batchedUpdates<A, R>(callback: (a: A) => R, a: A): R;
49
+ export function unstable_batchedUpdates<R>(callback: () => R): R;
50
+
51
+ /**
52
+ * @deprecated
53
+ */
54
+ export function unstable_renderSubtreeIntoContainer<T extends Element>(
55
+ parentComponent: Component<any>,
56
+ element: DOMElement<DOMAttributes<T>, T>,
57
+ container: Element,
58
+ callback?: (element: T) => any,
59
+ ): T;
60
+ /**
61
+ * @deprecated
62
+ */
63
+ export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
64
+ parentComponent: Component<any>,
65
+ element: CElement<P, T>,
66
+ container: Element,
67
+ callback?: (component: T) => any,
68
+ ): T;
69
+ /**
70
+ * @deprecated
71
+ */
72
+ export function unstable_renderSubtreeIntoContainer<P>(
73
+ parentComponent: Component<any>,
74
+ element: ReactElement<P>,
75
+ container: Element,
76
+ callback?: (component?: Component<P, ComponentState> | Element) => any,
77
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
78
+ ): Component<P, ComponentState> | Element | void;
79
+
80
+ export type Container = Element | Document | DocumentFragment;
81
+
82
+ export interface Renderer {
83
+ // Deprecated(render): The return value is deprecated.
84
+ // In future releases the render function's return type will be void.
85
+
86
+ /**
87
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
88
+ */
89
+ <T extends Element>(
90
+ element: DOMElement<DOMAttributes<T>, T>,
91
+ container: Container | null,
92
+ callback?: () => void,
93
+ ): T;
94
+
95
+ /**
96
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
97
+ */
98
+ (
99
+ element: Array<DOMElement<DOMAttributes<any>, any>>,
100
+ container: Container | null,
101
+ callback?: () => void,
102
+ ): Element;
103
+
104
+ /**
105
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
106
+ */
107
+ (
108
+ element: FunctionComponentElement<any> | Array<FunctionComponentElement<any>>,
109
+ container: Container | null,
110
+ callback?: () => void,
111
+ ): void;
112
+
113
+ /**
114
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
115
+ */
116
+ <P, T extends Component<P, ComponentState>>(
117
+ element: CElement<P, T>,
118
+ container: Container | null,
119
+ callback?: () => void,
120
+ ): T;
121
+
122
+ /**
123
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
124
+ */
125
+ (
126
+ element: Array<CElement<any, Component<any, ComponentState>>>,
127
+ container: Container | null,
128
+ callback?: () => void,
129
+ ): Component<any, ComponentState>;
130
+
131
+ /**
132
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
133
+ */
134
+ <P>(
135
+ element: ReactElement<P>,
136
+ container: Container | null,
137
+ callback?: () => void,
138
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
139
+ ): Component<P, ComponentState> | Element | void;
140
+
141
+ /**
142
+ * @deprecated See https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis
143
+ */
144
+ (
145
+ element: ReactElement[],
146
+ container: Container | null,
147
+ callback?: () => void,
148
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
149
+ ): Component<any, ComponentState> | Element | void;
150
+ }
scripts/node_modules/@types/react-dom/package.json ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@types/react-dom",
3
+ "version": "18.3.7",
4
+ "description": "TypeScript definitions for react-dom",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom",
6
+ "license": "MIT",
7
+ "contributors": [
8
+ {
9
+ "name": "Asana",
10
+ "url": "https://asana.com"
11
+ },
12
+ {
13
+ "name": "AssureSign",
14
+ "url": "http://www.assuresign.com"
15
+ },
16
+ {
17
+ "name": "Microsoft",
18
+ "url": "https://microsoft.com"
19
+ },
20
+ {
21
+ "name": "MartynasZilinskas",
22
+ "githubUsername": "MartynasZilinskas",
23
+ "url": "https://github.com/MartynasZilinskas"
24
+ },
25
+ {
26
+ "name": "Josh Rutherford",
27
+ "githubUsername": "theruther4d",
28
+ "url": "https://github.com/theruther4d"
29
+ },
30
+ {
31
+ "name": "Jessica Franco",
32
+ "githubUsername": "Jessidhia",
33
+ "url": "https://github.com/Jessidhia"
34
+ },
35
+ {
36
+ "name": "Sebastian Silbermann",
37
+ "githubUsername": "eps1lon",
38
+ "url": "https://github.com/eps1lon"
39
+ }
40
+ ],
41
+ "main": "",
42
+ "types": "index.d.ts",
43
+ "exports": {
44
+ ".": {
45
+ "types": {
46
+ "default": "./index.d.ts"
47
+ }
48
+ },
49
+ "./canary": {
50
+ "types": {
51
+ "default": "./canary.d.ts"
52
+ }
53
+ },
54
+ "./client": {
55
+ "types": {
56
+ "default": "./client.d.ts"
57
+ }
58
+ },
59
+ "./server": {
60
+ "types": {
61
+ "default": "./server.d.ts"
62
+ }
63
+ },
64
+ "./experimental": {
65
+ "types": {
66
+ "default": "./experimental.d.ts"
67
+ }
68
+ },
69
+ "./test-utils": {
70
+ "types": {
71
+ "default": "./test-utils/index.d.ts"
72
+ }
73
+ },
74
+ "./package.json": "./package.json"
75
+ },
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
79
+ "directory": "types/react-dom"
80
+ },
81
+ "scripts": {},
82
+ "dependencies": {},
83
+ "peerDependencies": {
84
+ "@types/react": "^18.0.0"
85
+ },
86
+ "typesPublisherContentHash": "091d1528d83863778f5cb9fbf6c81d6e64ed2394f4c3c73a57ed81d9871b4465",
87
+ "typeScriptVersion": "5.1"
88
+ }
scripts/node_modules/@types/react-dom/server.d.ts ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // forward declarations
2
+ declare global {
3
+ namespace NodeJS {
4
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
5
+ interface ReadableStream {}
6
+
7
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
8
+ interface WritableStream {}
9
+ }
10
+
11
+ /**
12
+ * Stub for https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
13
+ */
14
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
15
+ interface AbortSignal {}
16
+
17
+ /**
18
+ * Stub for https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
19
+ */
20
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
21
+ interface ReadableStream {}
22
+ }
23
+
24
+ import { ReactNode } from "react";
25
+ import { ErrorInfo } from "./client";
26
+
27
+ export type BootstrapScriptDescriptor = {
28
+ src: string;
29
+ integrity?: string | undefined;
30
+ crossOrigin?: string | undefined;
31
+ };
32
+ export interface RenderToPipeableStreamOptions {
33
+ identifierPrefix?: string;
34
+ namespaceURI?: string;
35
+ nonce?: string;
36
+ bootstrapScriptContent?: string;
37
+ bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
38
+ bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
39
+ progressiveChunkSize?: number;
40
+ onShellReady?: () => void;
41
+ onShellError?: (error: unknown) => void;
42
+ onAllReady?: () => void;
43
+ onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;
44
+ }
45
+
46
+ export interface PipeableStream {
47
+ abort: (reason?: unknown) => void;
48
+ pipe: <Writable extends NodeJS.WritableStream>(destination: Writable) => Writable;
49
+ }
50
+
51
+ export interface ServerOptions {
52
+ identifierPrefix?: string;
53
+ }
54
+
55
+ /**
56
+ * Only available in the environments with [Node.js Streams](https://nodejs.dev/learn/nodejs-streams).
57
+ *
58
+ * @see [API](https://reactjs.org/docs/react-dom-server.html#rendertopipeablestream)
59
+ *
60
+ * @param children
61
+ * @param options
62
+ */
63
+ export function renderToPipeableStream(children: ReactNode, options?: RenderToPipeableStreamOptions): PipeableStream;
64
+
65
+ /**
66
+ * Render a React element to its initial HTML. This should only be used on the server.
67
+ * React will return an HTML string. You can use this method to generate HTML on the server
68
+ * and send the markup down on the initial request for faster page loads and to allow search
69
+ * engines to crawl your pages for SEO purposes.
70
+ *
71
+ * If you call `ReactDOMClient.hydrateRoot()` on a node that already has this server-rendered markup,
72
+ * React will preserve it and only attach event handlers, allowing you
73
+ * to have a very performant first-load experience.
74
+ */
75
+ export function renderToString(element: ReactNode, options?: ServerOptions): string;
76
+
77
+ /**
78
+ * Render a React element to its initial HTML. Returns a Readable stream that outputs
79
+ * an HTML string. The HTML output by this stream is exactly equal to what
80
+ * `ReactDOMServer.renderToString()` would return.
81
+ *
82
+ * @deprecated
83
+ */
84
+ export function renderToNodeStream(element: ReactNode, options?: ServerOptions): NodeJS.ReadableStream;
85
+
86
+ /**
87
+ * Similar to `renderToString`, except this doesn't create extra DOM attributes
88
+ * such as `data-reactid`, that React uses internally. This is useful if you want
89
+ * to use React as a simple static page generator, as stripping away the extra
90
+ * attributes can save lots of bytes.
91
+ */
92
+ export function renderToStaticMarkup(element: ReactNode, options?: ServerOptions): string;
93
+
94
+ /**
95
+ * Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
96
+ * such as `data-reactid`, that React uses internally. The HTML output by this stream
97
+ * is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
98
+ *
99
+ * @deprecated
100
+ */
101
+ export function renderToStaticNodeStream(element: ReactNode, options?: ServerOptions): NodeJS.ReadableStream;
102
+
103
+ export interface RenderToReadableStreamOptions {
104
+ identifierPrefix?: string;
105
+ namespaceURI?: string;
106
+ nonce?: string;
107
+ bootstrapScriptContent?: string;
108
+ bootstrapScripts?: Array<string | BootstrapScriptDescriptor>;
109
+ bootstrapModules?: Array<string | BootstrapScriptDescriptor>;
110
+ progressiveChunkSize?: number;
111
+ signal?: AbortSignal;
112
+ onError?: (error: unknown, errorInfo: ErrorInfo) => string | void;
113
+ }
114
+
115
+ export interface ReactDOMServerReadableStream extends ReadableStream {
116
+ allReady: Promise<void>;
117
+ }
118
+
119
+ /**
120
+ * Only available in the environments with [Web Streams](https://developer.mozilla.org/en-US/docs/Web/API/Streams_API) (this includes browsers, Deno, and some modern edge runtimes).
121
+ *
122
+ * @see [API](https://reactjs.org/docs/react-dom-server.html#rendertoreadablestream)
123
+ */
124
+ export function renderToReadableStream(
125
+ children: ReactNode,
126
+ options?: RenderToReadableStreamOptions,
127
+ ): Promise<ReactDOMServerReadableStream>;
128
+
129
+ export const version: string;
130
+
131
+ export as namespace ReactDOMServer;
scripts/node_modules/@types/react-dom/test-utils/index.d.ts ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ AbstractView,
3
+ CElement,
4
+ ClassType,
5
+ Component,
6
+ ComponentClass,
7
+ DOMAttributes,
8
+ DOMElement,
9
+ FC,
10
+ FunctionComponentElement,
11
+ ReactElement,
12
+ ReactHTMLElement,
13
+ ReactInstance,
14
+ } from "react";
15
+
16
+ import * as ReactTestUtils from ".";
17
+
18
+ export {};
19
+
20
+ export interface OptionalEventProperties {
21
+ bubbles?: boolean | undefined;
22
+ cancelable?: boolean | undefined;
23
+ currentTarget?: EventTarget | undefined;
24
+ defaultPrevented?: boolean | undefined;
25
+ eventPhase?: number | undefined;
26
+ isTrusted?: boolean | undefined;
27
+ nativeEvent?: Event | undefined;
28
+ preventDefault?(): void;
29
+ stopPropagation?(): void;
30
+ target?: EventTarget | undefined;
31
+ timeStamp?: Date | undefined;
32
+ type?: string | undefined;
33
+ }
34
+
35
+ export type ModifierKey =
36
+ | "Alt"
37
+ | "AltGraph"
38
+ | "CapsLock"
39
+ | "Control"
40
+ | "Fn"
41
+ | "FnLock"
42
+ | "Hyper"
43
+ | "Meta"
44
+ | "NumLock"
45
+ | "ScrollLock"
46
+ | "Shift"
47
+ | "Super"
48
+ | "Symbol"
49
+ | "SymbolLock";
50
+
51
+ export interface SyntheticEventData extends OptionalEventProperties {
52
+ altKey?: boolean | undefined;
53
+ button?: number | undefined;
54
+ buttons?: number | undefined;
55
+ clientX?: number | undefined;
56
+ clientY?: number | undefined;
57
+ changedTouches?: TouchList | undefined;
58
+ charCode?: number | undefined;
59
+ clipboardData?: DataTransfer | undefined;
60
+ ctrlKey?: boolean | undefined;
61
+ deltaMode?: number | undefined;
62
+ deltaX?: number | undefined;
63
+ deltaY?: number | undefined;
64
+ deltaZ?: number | undefined;
65
+ detail?: number | undefined;
66
+ getModifierState?(key: ModifierKey): boolean;
67
+ key?: string | undefined;
68
+ keyCode?: number | undefined;
69
+ locale?: string | undefined;
70
+ location?: number | undefined;
71
+ metaKey?: boolean | undefined;
72
+ pageX?: number | undefined;
73
+ pageY?: number | undefined;
74
+ relatedTarget?: EventTarget | undefined;
75
+ repeat?: boolean | undefined;
76
+ screenX?: number | undefined;
77
+ screenY?: number | undefined;
78
+ shiftKey?: boolean | undefined;
79
+ targetTouches?: TouchList | undefined;
80
+ touches?: TouchList | undefined;
81
+ view?: AbstractView | undefined;
82
+ which?: number | undefined;
83
+ }
84
+
85
+ export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
86
+
87
+ export interface MockedComponentClass {
88
+ new(props: any): any;
89
+ }
90
+
91
+ export interface ShallowRenderer {
92
+ /**
93
+ * After `shallowRenderer.render()` has been called, returns shallowly rendered output.
94
+ */
95
+ getRenderOutput<E extends ReactElement>(): E;
96
+ /**
97
+ * Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep.
98
+ */
99
+ render(element: ReactElement, context?: any): void;
100
+ unmount(): void;
101
+ }
102
+
103
+ /**
104
+ * Simulate an event dispatch on a DOM node with optional `eventData` event data.
105
+ * `Simulate` has a method for every event that React understands.
106
+ */
107
+ export namespace Simulate {
108
+ const abort: EventSimulator;
109
+ const animationEnd: EventSimulator;
110
+ const animationIteration: EventSimulator;
111
+ const animationStart: EventSimulator;
112
+ const blur: EventSimulator;
113
+ const cancel: EventSimulator;
114
+ const canPlay: EventSimulator;
115
+ const canPlayThrough: EventSimulator;
116
+ const change: EventSimulator;
117
+ const click: EventSimulator;
118
+ const close: EventSimulator;
119
+ const compositionEnd: EventSimulator;
120
+ const compositionStart: EventSimulator;
121
+ const compositionUpdate: EventSimulator;
122
+ const contextMenu: EventSimulator;
123
+ const copy: EventSimulator;
124
+ const cut: EventSimulator;
125
+ const auxClick: EventSimulator;
126
+ const doubleClick: EventSimulator;
127
+ const drag: EventSimulator;
128
+ const dragEnd: EventSimulator;
129
+ const dragEnter: EventSimulator;
130
+ const dragExit: EventSimulator;
131
+ const dragLeave: EventSimulator;
132
+ const dragOver: EventSimulator;
133
+ const dragStart: EventSimulator;
134
+ const drop: EventSimulator;
135
+ const durationChange: EventSimulator;
136
+ const emptied: EventSimulator;
137
+ const encrypted: EventSimulator;
138
+ const ended: EventSimulator;
139
+ const error: EventSimulator;
140
+ const focus: EventSimulator;
141
+ const input: EventSimulator;
142
+ const invalid: EventSimulator;
143
+ const keyDown: EventSimulator;
144
+ const keyPress: EventSimulator;
145
+ const keyUp: EventSimulator;
146
+ const load: EventSimulator;
147
+ const loadStart: EventSimulator;
148
+ const loadedData: EventSimulator;
149
+ const loadedMetadata: EventSimulator;
150
+ const mouseDown: EventSimulator;
151
+ const mouseEnter: EventSimulator;
152
+ const mouseLeave: EventSimulator;
153
+ const mouseMove: EventSimulator;
154
+ const mouseOut: EventSimulator;
155
+ const mouseOver: EventSimulator;
156
+ const mouseUp: EventSimulator;
157
+ const paste: EventSimulator;
158
+ const pause: EventSimulator;
159
+ const play: EventSimulator;
160
+ const playing: EventSimulator;
161
+ const progress: EventSimulator;
162
+ const pointerCancel: EventSimulator;
163
+ const pointerDown: EventSimulator;
164
+ const pointerUp: EventSimulator;
165
+ const pointerMove: EventSimulator;
166
+ const pointerOut: EventSimulator;
167
+ const pointerOver: EventSimulator;
168
+ const pointerEnter: EventSimulator;
169
+ const pointerLeave: EventSimulator;
170
+ const gotPointerCapture: EventSimulator;
171
+ const lostPointerCapture: EventSimulator;
172
+ const rateChange: EventSimulator;
173
+ const reset: EventSimulator;
174
+ const resize: EventSimulator;
175
+ const scroll: EventSimulator;
176
+ const toggle: EventSimulator;
177
+ const seeked: EventSimulator;
178
+ const seeking: EventSimulator;
179
+ const select: EventSimulator;
180
+ const beforeInput: EventSimulator;
181
+ const stalled: EventSimulator;
182
+ const submit: EventSimulator;
183
+ const suspend: EventSimulator;
184
+ const timeUpdate: EventSimulator;
185
+ const touchCancel: EventSimulator;
186
+ const touchEnd: EventSimulator;
187
+ const touchMove: EventSimulator;
188
+ const touchStart: EventSimulator;
189
+ const transitionEnd: EventSimulator;
190
+ const volumeChange: EventSimulator;
191
+ const waiting: EventSimulator;
192
+ const wheel: EventSimulator;
193
+ }
194
+
195
+ /**
196
+ * Render a React element into a detached DOM node in the document. __This function requires a DOM__.
197
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
198
+ */
199
+ export function renderIntoDocument<T extends Element>(
200
+ element: DOMElement<any, T>,
201
+ ): T;
202
+ /** @deprecated https://react.dev/warnings/react-dom-test-utils */
203
+ export function renderIntoDocument(
204
+ element: FunctionComponentElement<any>,
205
+ ): void;
206
+ // If we replace `P` with `any` in this overload, then some tests fail because
207
+ // calls to `renderIntoDocument` choose the last overload on the
208
+ // subtype-relation pass and get an undesirably broad return type. Using `P`
209
+ // allows this overload to match on the subtype-relation pass.
210
+ /**
211
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
212
+ */
213
+ export function renderIntoDocument<P, T extends Component<P>>(
214
+ element: CElement<P, T>,
215
+ ): T;
216
+ /**
217
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
218
+ */
219
+ export function renderIntoDocument<P>(
220
+ element: ReactElement<P>,
221
+ ): Component<P> | Element | void;
222
+
223
+ /**
224
+ * Pass a mocked component module to this method to augment it with useful methods that allow it to
225
+ * be used as a dummy React component. Instead of rendering as usual, the component will become
226
+ * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
227
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
228
+ */
229
+ export function mockComponent(
230
+ mocked: MockedComponentClass,
231
+ mockTagName?: string,
232
+ ): typeof ReactTestUtils;
233
+
234
+ /**
235
+ * Returns `true` if `element` is any React element.
236
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
237
+ */
238
+ export function isElement(element: any): boolean;
239
+
240
+ /**
241
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
242
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
243
+ */
244
+ export function isElementOfType<T extends HTMLElement>(
245
+ element: ReactElement,
246
+ type: string,
247
+ ): element is ReactHTMLElement<T>;
248
+ /**
249
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
250
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
251
+ */
252
+ export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
253
+ element: ReactElement,
254
+ type: string,
255
+ ): element is DOMElement<P, T>;
256
+ /**
257
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
258
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
259
+ */
260
+ export function isElementOfType<P>(
261
+ element: ReactElement,
262
+ type: FC<P>,
263
+ ): element is FunctionComponentElement<P>;
264
+ /**
265
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
266
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
267
+ */
268
+ export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
269
+ element: ReactElement,
270
+ type: ClassType<P, T, C>,
271
+ ): element is CElement<P, T>;
272
+
273
+ /**
274
+ * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
275
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
276
+ */
277
+ export function isDOMComponent(instance: ReactInstance): instance is Element;
278
+ /**
279
+ * Returns `true` if `instance` is a user-defined component, such as a class or a function.
280
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
281
+ */
282
+ export function isCompositeComponent(instance: ReactInstance): instance is Component<any>;
283
+ /**
284
+ * Returns `true` if `instance` is a component whose type is of a React `componentClass`.
285
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
286
+ */
287
+ export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
288
+ instance: ReactInstance,
289
+ type: ClassType<any, T, C>,
290
+ ): boolean;
291
+
292
+ /**
293
+ * Traverse all components in `tree` and accumulate all components where
294
+ * `test(component)` is `true`. This is not that useful on its own, but it's used
295
+ * as a primitive for other test utils.
296
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
297
+ */
298
+ export function findAllInRenderedTree(
299
+ root: Component<any>,
300
+ fn: (i: ReactInstance) => boolean,
301
+ ): ReactInstance[];
302
+
303
+ /**
304
+ * Finds all DOM elements of components in the rendered tree that are
305
+ * DOM components with the class name matching `className`.
306
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
307
+ */
308
+ export function scryRenderedDOMComponentsWithClass(
309
+ root: Component<any>,
310
+ className: string,
311
+ ): Element[];
312
+ /**
313
+ * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
314
+ * and returns that one result, or throws exception if there is any other
315
+ * number of matches besides one.
316
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
317
+ */
318
+ export function findRenderedDOMComponentWithClass(
319
+ root: Component<any>,
320
+ className: string,
321
+ ): Element;
322
+
323
+ /**
324
+ * Finds all DOM elements of components in the rendered tree that are
325
+ * DOM components with the tag name matching `tagName`.
326
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
327
+ */
328
+ export function scryRenderedDOMComponentsWithTag(
329
+ root: Component<any>,
330
+ tagName: string,
331
+ ): Element[];
332
+ /**
333
+ * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
334
+ * and returns that one result, or throws exception if there is any other
335
+ * number of matches besides one.
336
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
337
+ */
338
+ export function findRenderedDOMComponentWithTag(
339
+ root: Component<any>,
340
+ tagName: string,
341
+ ): Element;
342
+
343
+ /**
344
+ * Finds all instances of components with type equal to `componentClass`.
345
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
346
+ */
347
+ export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
348
+ root: Component<any>,
349
+ type: ClassType<any, T, C>,
350
+ ): T[];
351
+
352
+ /**
353
+ * Same as `scryRenderedComponentsWithType()` but expects there to be one result
354
+ * and returns that one result, or throws exception if there is any other
355
+ * number of matches besides one.
356
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
357
+ */
358
+ export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
359
+ root: Component<any>,
360
+ type: ClassType<any, T, C>,
361
+ ): T;
362
+
363
+ /**
364
+ * Call this in your tests to create a shallow renderer.
365
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
366
+ */
367
+ export function createRenderer(): ShallowRenderer;
368
+
369
+ // NOTES
370
+ // - the order of these signatures matters - typescript will check the signatures in source order.
371
+ // If the `() => VoidOrUndefinedOnly` signature is first, it'll erroneously match a Promise returning function for users with
372
+ // `strictNullChecks: false`.
373
+ // - VoidOrUndefinedOnly is there to forbid any non-void return values for users with `strictNullChecks: true`
374
+ declare const UNDEFINED_VOID_ONLY: unique symbol;
375
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
376
+ type VoidOrUndefinedOnly = void | { [UNDEFINED_VOID_ONLY]: never };
377
+ /**
378
+ * Wrap any code rendering and triggering updates to your components into `act()` calls.
379
+ *
380
+ * Ensures that the behavior in your tests matches what happens in the browser
381
+ * more closely by executing pending `useEffect`s before returning. This also
382
+ * reduces the amount of re-renders done.
383
+ *
384
+ * @param callback A synchronous, void callback that will execute as a single, complete React commit.
385
+ *
386
+ * @see https://reactjs.org/blog/2019/02/06/react-v16.8.0.html#testing-hooks
387
+ *
388
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
389
+ */
390
+ // While act does always return Thenable, if a void function is passed, we pretend the return value is also void to not trigger dangling Promise lint rules.
391
+ export function act(callback: () => VoidOrUndefinedOnly): void;
392
+ /**
393
+ * @deprecated https://react.dev/warnings/react-dom-test-utils
394
+ */
395
+ export function act<T>(callback: () => T | Promise<T>): Promise<T>;
396
+
397
+ // Intentionally doesn't extend PromiseLike<never>.
398
+ // Ideally this should be as hard to accidentally use as possible.
399
+ export interface DebugPromiseLike {
400
+ // the actual then() in here is 0-ary, but that doesn't count as a PromiseLike.
401
+ then(onfulfilled: (value: never) => never, onrejected: (reason: never) => never): never;
402
+ }
scripts/node_modules/@vitejs/plugin-react/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2019-present, Yuxi (Evan) You and Vite contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
scripts/node_modules/@vitejs/plugin-react/README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # @vitejs/plugin-react [![npm](https://img.shields.io/npm/v/@vitejs/plugin-react.svg)](https://npmjs.com/package/@vitejs/plugin-react)
2
+
3
+ The default Vite plugin for React projects.
4
+
5
+ - enable [Fast Refresh](https://www.npmjs.com/package/react-refresh) in development (requires react >= 16.9)
6
+ - use the [automatic JSX runtime](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)
7
+ - use custom Babel plugins/presets
8
+ - small installation size
9
+
10
+ ```js
11
+ // vite.config.js
12
+ import { defineConfig } from 'vite'
13
+ import react from '@vitejs/plugin-react'
14
+
15
+ export default defineConfig({
16
+ plugins: [react()],
17
+ })
18
+ ```
19
+
20
+ ## Options
21
+
22
+ ### include/exclude
23
+
24
+ Includes `.js`, `.jsx`, `.ts` & `.tsx` by default. This option can be used to add fast refresh to `.mdx` files:
25
+
26
+ ```js
27
+ import { defineConfig } from 'vite'
28
+ import react from '@vitejs/plugin-react'
29
+ import mdx from '@mdx-js/rollup'
30
+
31
+ export default defineConfig({
32
+ plugins: [
33
+ { enforce: 'pre', ...mdx() },
34
+ react({ include: /\.(mdx|js|jsx|ts|tsx)$/ }),
35
+ ],
36
+ })
37
+ ```
38
+
39
+ > `node_modules` are never processed by this plugin (but esbuild will)
40
+
41
+ ### jsxImportSource
42
+
43
+ Control where the JSX factory is imported from. Default to `'react'`
44
+
45
+ ```js
46
+ react({ jsxImportSource: '@emotion/react' })
47
+ ```
48
+
49
+ ### jsxRuntime
50
+
51
+ By default, the plugin uses the [automatic JSX runtime](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html). However, if you encounter any issues, you may opt out using the `jsxRuntime` option.
52
+
53
+ ```js
54
+ react({ jsxRuntime: 'classic' })
55
+ ```
56
+
57
+ ### babel
58
+
59
+ The `babel` option lets you add plugins, presets, and [other configuration](https://babeljs.io/docs/en/options) to the Babel transformation performed on each included file.
60
+
61
+ ```js
62
+ react({
63
+ babel: {
64
+ presets: [...],
65
+ // Your plugins run before any built-in transform (eg: Fast Refresh)
66
+ plugins: [...],
67
+ // Use .babelrc files
68
+ babelrc: true,
69
+ // Use babel.config.js files
70
+ configFile: true,
71
+ }
72
+ })
73
+ ```
74
+
75
+ Note: When not using plugins, only esbuild is used for production builds, resulting in faster builds.
76
+
77
+ #### Proposed syntax
78
+
79
+ If you are using ES syntax that are still in proposal status (e.g. class properties), you can selectively enable them with the `babel.parserOpts.plugins` option:
80
+
81
+ ```js
82
+ react({
83
+ babel: {
84
+ parserOpts: {
85
+ plugins: ['decorators-legacy'],
86
+ },
87
+ },
88
+ })
89
+ ```
90
+
91
+ This option does not enable _code transformation_. That is handled by esbuild.
92
+
93
+ **Note:** TypeScript syntax is handled automatically.
94
+
95
+ Here's the [complete list of Babel parser plugins](https://babeljs.io/docs/en/babel-parser#ecmascript-proposalshttpsgithubcombabelproposals).
96
+
97
+ ### reactRefreshHost
98
+
99
+ The `reactRefreshHost` option is only necessary in a module federation context. It enables HMR to work between a remote & host application. In your remote Vite config, you would add your host origin:
100
+
101
+ ```js
102
+ react({ reactRefreshHost: 'http://localhost:3000' })
103
+ ```
104
+
105
+ Under the hood, this simply updates the React Fash Refresh runtime URL from `/@react-refresh` to `http://localhost:3000/@react-refresh` to ensure there is only one Refresh runtime across the whole application. Note that if you define `base` option in the host application, you need to include it in the option, like: `http://localhost:3000/{base}`.
106
+
107
+ ## Middleware mode
108
+
109
+ In [middleware mode](https://vite.dev/config/server-options.html#server-middlewaremode), you should make sure your entry `index.html` file is transformed by Vite. Here's an example for an Express server:
110
+
111
+ ```js
112
+ app.get('/', async (req, res, next) => {
113
+ try {
114
+ let html = fs.readFileSync(path.resolve(root, 'index.html'), 'utf-8')
115
+
116
+ // Transform HTML using Vite plugins.
117
+ html = await viteServer.transformIndexHtml(req.url, html)
118
+
119
+ res.send(html)
120
+ } catch (e) {
121
+ return next(e)
122
+ }
123
+ })
124
+ ```
125
+
126
+ Otherwise, you'll probably get this error:
127
+
128
+ ```
129
+ Uncaught Error: @vitejs/plugin-react can't detect preamble. Something is wrong.
130
+ ```
131
+
132
+ ### disableOxcRecommendation
133
+
134
+ If set, disables the recommendation to use `@vitejs/plugin-react-oxc` (which is shown when `rolldown-vite` is detected and `babel` is not configured).
135
+
136
+ ## Consistent components exports
137
+
138
+ For React refresh to work correctly, your file should only export React components. You can find a good explanation in the [Gatsby docs](https://www.gatsbyjs.com/docs/reference/local-development/fast-refresh/#how-it-works).
139
+
140
+ If an incompatible change in exports is found, the module will be invalidated and HMR will propagate. To make it easier to export simple constants alongside your component, the module is only invalidated when their value changes.
141
+
142
+ You can catch mistakes and get more detailed warning with this [eslint rule](https://github.com/ArnaudBarre/eslint-plugin-react-refresh).
scripts/node_modules/@vitejs/plugin-react/dist/index.cjs ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const node_path = __toESM(require("node:path"));
25
+ const node_url = __toESM(require("node:url"));
26
+ const node_fs = __toESM(require("node:fs"));
27
+ const vite = __toESM(require("vite"));
28
+ const __rolldown_pluginutils = __toESM(require("@rolldown/pluginutils"));
29
+
30
+ //#region ../common/refresh-utils.ts
31
+ const runtimePublicPath = "/@react-refresh";
32
+ const reactCompRE = /extends\s+(?:React\.)?(?:Pure)?Component/;
33
+ const refreshContentRE = /\$RefreshReg\$\(/;
34
+ const preambleCode = `import { injectIntoGlobalHook } from "__BASE__${runtimePublicPath.slice(1)}";
35
+ injectIntoGlobalHook(window);
36
+ window.$RefreshReg$ = () => {};
37
+ window.$RefreshSig$ = () => (type) => type;`;
38
+ const getPreambleCode = (base) => preambleCode.replace("__BASE__", base);
39
+ const avoidSourceMapOption = Symbol();
40
+ function addRefreshWrapper(code, map, pluginName, id, reactRefreshHost = "") {
41
+ const hasRefresh = refreshContentRE.test(code);
42
+ const onlyReactComp = !hasRefresh && reactCompRE.test(code);
43
+ const normalizedMap = map === avoidSourceMapOption ? null : map;
44
+ if (!hasRefresh && !onlyReactComp) return {
45
+ code,
46
+ map: normalizedMap
47
+ };
48
+ const avoidSourceMap = map === avoidSourceMapOption;
49
+ const newMap = typeof normalizedMap === "string" ? JSON.parse(normalizedMap) : normalizedMap;
50
+ let newCode = code;
51
+ if (hasRefresh) {
52
+ const refreshHead = removeLineBreaksIfNeeded(`let prevRefreshReg;
53
+ let prevRefreshSig;
54
+
55
+ if (import.meta.hot && !inWebWorker) {
56
+ if (!window.$RefreshReg$) {
57
+ throw new Error(
58
+ "${pluginName} can't detect preamble. Something is wrong."
59
+ );
60
+ }
61
+
62
+ prevRefreshReg = window.$RefreshReg$;
63
+ prevRefreshSig = window.$RefreshSig$;
64
+ window.$RefreshReg$ = RefreshRuntime.getRefreshReg(${JSON.stringify(id)});
65
+ window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
66
+ }
67
+
68
+ `, avoidSourceMap);
69
+ newCode = `${refreshHead}${newCode}
70
+
71
+ if (import.meta.hot && !inWebWorker) {
72
+ window.$RefreshReg$ = prevRefreshReg;
73
+ window.$RefreshSig$ = prevRefreshSig;
74
+ }
75
+ `;
76
+ if (newMap) newMap.mappings = ";".repeat(16) + newMap.mappings;
77
+ }
78
+ const sharedHead = removeLineBreaksIfNeeded(`import * as RefreshRuntime from "${reactRefreshHost}${runtimePublicPath}";
79
+ const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope;
80
+
81
+ `, avoidSourceMap);
82
+ newCode = `${sharedHead}${newCode}
83
+
84
+ if (import.meta.hot && !inWebWorker) {
85
+ RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
86
+ RefreshRuntime.registerExportsForReactRefresh(${JSON.stringify(id)}, currentExports);
87
+ import.meta.hot.accept((nextExports) => {
88
+ if (!nextExports) return;
89
+ const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(${JSON.stringify(id)}, currentExports, nextExports);
90
+ if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
91
+ });
92
+ });
93
+ }
94
+ `;
95
+ if (newMap) newMap.mappings = ";;;" + newMap.mappings;
96
+ return {
97
+ code: newCode,
98
+ map: newMap
99
+ };
100
+ }
101
+ function removeLineBreaksIfNeeded(code, enabled) {
102
+ return enabled ? code.replace(/\n/g, "") : code;
103
+ }
104
+
105
+ //#endregion
106
+ //#region ../common/warning.ts
107
+ const silenceUseClientWarning = (userConfig) => ({ rollupOptions: { onwarn(warning, defaultHandler) {
108
+ var _userConfig$build;
109
+ if (warning.code === "MODULE_LEVEL_DIRECTIVE" && (warning.message.includes("use client") || warning.message.includes("use server"))) return;
110
+ if (warning.code === "SOURCEMAP_ERROR" && warning.message.includes("resolve original location") && warning.pos === 0) return;
111
+ if ((_userConfig$build = userConfig.build) === null || _userConfig$build === void 0 || (_userConfig$build = _userConfig$build.rollupOptions) === null || _userConfig$build === void 0 ? void 0 : _userConfig$build.onwarn) userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
112
+ else defaultHandler(warning);
113
+ } } });
114
+
115
+ //#endregion
116
+ //#region src/index.ts
117
+ const _dirname = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
118
+ const refreshRuntimePath = (0, node_path.join)(_dirname, "refresh-runtime.js");
119
+ let babel;
120
+ async function loadBabel() {
121
+ if (!babel) babel = await import("@babel/core");
122
+ return babel;
123
+ }
124
+ const defaultIncludeRE = /\.[tj]sx?$/;
125
+ const tsRE = /\.tsx?$/;
126
+ function viteReact(opts = {}) {
127
+ var _opts$babel;
128
+ const include = opts.include ?? defaultIncludeRE;
129
+ const exclude = opts.exclude;
130
+ const filter = (0, vite.createFilter)(include, exclude);
131
+ const jsxImportSource = opts.jsxImportSource ?? "react";
132
+ const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
133
+ const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
134
+ let runningInVite = false;
135
+ let isProduction = true;
136
+ let projectRoot = process.cwd();
137
+ let skipFastRefresh = true;
138
+ let runPluginOverrides;
139
+ let staticBabelOptions;
140
+ const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/;
141
+ const viteBabel = {
142
+ name: "vite:react-babel",
143
+ enforce: "pre",
144
+ config() {
145
+ if (opts.jsxRuntime === "classic") if ("rolldownVersion" in vite) return { oxc: { jsx: {
146
+ runtime: "classic",
147
+ development: false
148
+ } } };
149
+ else return { esbuild: { jsx: "transform" } };
150
+ else return {
151
+ esbuild: {
152
+ jsx: "automatic",
153
+ jsxImportSource: opts.jsxImportSource
154
+ },
155
+ optimizeDeps: "rolldownVersion" in vite ? { rollupOptions: { jsx: { mode: "automatic" } } } : { esbuildOptions: { jsx: "automatic" } }
156
+ };
157
+ },
158
+ configResolved(config) {
159
+ runningInVite = true;
160
+ projectRoot = config.root;
161
+ isProduction = config.isProduction;
162
+ skipFastRefresh = isProduction || config.command === "build" || config.server.hmr === false;
163
+ if ("jsxPure" in opts) config.logger.warnOnce("[@vitejs/plugin-react] jsxPure was removed. You can configure esbuild.jsxSideEffects directly.");
164
+ const hooks = config.plugins.map((plugin) => {
165
+ var _plugin$api;
166
+ return (_plugin$api = plugin.api) === null || _plugin$api === void 0 ? void 0 : _plugin$api.reactBabel;
167
+ }).filter(defined);
168
+ if ("rolldownVersion" in vite && !opts.babel && !hooks.length && !opts.disableOxcRecommendation) config.logger.warn("[vite:react-babel] We recommend switching to `@vitejs/plugin-react-oxc` for improved performance. More information at https://vite.dev/rolldown");
169
+ if (hooks.length > 0) runPluginOverrides = (babelOptions, context) => {
170
+ hooks.forEach((hook) => hook(babelOptions, context, config));
171
+ };
172
+ else if (typeof opts.babel !== "function") {
173
+ staticBabelOptions = createBabelOptions(opts.babel);
174
+ if (canSkipBabel(staticBabelOptions.plugins, staticBabelOptions) && skipFastRefresh && (opts.jsxRuntime === "classic" ? isProduction : true)) delete viteBabel.transform;
175
+ }
176
+ },
177
+ options(options) {
178
+ if (!runningInVite) {
179
+ options.jsx = {
180
+ mode: opts.jsxRuntime,
181
+ importSource: opts.jsxImportSource
182
+ };
183
+ return options;
184
+ }
185
+ },
186
+ transform: {
187
+ filter: { id: {
188
+ include: (0, __rolldown_pluginutils.makeIdFiltersToMatchWithQuery)(include),
189
+ exclude: [...exclude ? (0, __rolldown_pluginutils.makeIdFiltersToMatchWithQuery)(ensureArray(exclude)) : [], /\/node_modules\//]
190
+ } },
191
+ async handler(code, id, options) {
192
+ if (id.includes("/node_modules/")) return;
193
+ const [filepath] = id.split("?");
194
+ if (!filter(filepath)) return;
195
+ const ssr = (options === null || options === void 0 ? void 0 : options.ssr) === true;
196
+ const babelOptions = (() => {
197
+ if (staticBabelOptions) return staticBabelOptions;
198
+ const newBabelOptions = createBabelOptions(typeof opts.babel === "function" ? opts.babel(id, { ssr }) : opts.babel);
199
+ runPluginOverrides === null || runPluginOverrides === void 0 || runPluginOverrides(newBabelOptions, {
200
+ id,
201
+ ssr
202
+ });
203
+ return newBabelOptions;
204
+ })();
205
+ const plugins = [...babelOptions.plugins];
206
+ const isJSX = filepath.endsWith("x");
207
+ const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(jsxImportDevRuntime) || code.includes(jsxImportRuntime)));
208
+ if (useFastRefresh) plugins.push([await loadPlugin("react-refresh/babel"), { skipEnvCheck: true }]);
209
+ if (opts.jsxRuntime === "classic" && isJSX) {
210
+ if (!isProduction) plugins.push(await loadPlugin("@babel/plugin-transform-react-jsx-self"), await loadPlugin("@babel/plugin-transform-react-jsx-source"));
211
+ }
212
+ if (canSkipBabel(plugins, babelOptions)) return;
213
+ const parserPlugins = [...babelOptions.parserOpts.plugins];
214
+ if (!filepath.endsWith(".ts")) parserPlugins.push("jsx");
215
+ if (tsRE.test(filepath)) parserPlugins.push("typescript");
216
+ const babel$1 = await loadBabel();
217
+ const result = await babel$1.transformAsync(code, {
218
+ ...babelOptions,
219
+ root: projectRoot,
220
+ filename: id,
221
+ sourceFileName: filepath,
222
+ retainLines: getReactCompilerPlugin(plugins) != null ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
223
+ parserOpts: {
224
+ ...babelOptions.parserOpts,
225
+ sourceType: "module",
226
+ allowAwaitOutsideFunction: true,
227
+ plugins: parserPlugins
228
+ },
229
+ generatorOpts: {
230
+ ...babelOptions.generatorOpts,
231
+ importAttributesKeyword: "with",
232
+ decoratorsBeforeExport: true
233
+ },
234
+ plugins,
235
+ sourceMaps: true
236
+ });
237
+ if (result) {
238
+ if (!useFastRefresh) return {
239
+ code: result.code,
240
+ map: result.map
241
+ };
242
+ return addRefreshWrapper(result.code, result.map, "@vitejs/plugin-react", id, opts.reactRefreshHost);
243
+ }
244
+ }
245
+ }
246
+ };
247
+ const dependencies = [
248
+ "react",
249
+ "react-dom",
250
+ jsxImportDevRuntime,
251
+ jsxImportRuntime
252
+ ];
253
+ const staticBabelPlugins = typeof opts.babel === "object" ? ((_opts$babel = opts.babel) === null || _opts$babel === void 0 ? void 0 : _opts$babel.plugins) ?? [] : [];
254
+ const reactCompilerPlugin = getReactCompilerPlugin(staticBabelPlugins);
255
+ if (reactCompilerPlugin != null) {
256
+ const reactCompilerRuntimeModule = getReactCompilerRuntimeModule(reactCompilerPlugin);
257
+ dependencies.push(reactCompilerRuntimeModule);
258
+ }
259
+ const viteReactRefresh = {
260
+ name: "vite:react-refresh",
261
+ enforce: "pre",
262
+ config: (userConfig) => ({
263
+ build: silenceUseClientWarning(userConfig),
264
+ optimizeDeps: { include: dependencies },
265
+ resolve: { dedupe: ["react", "react-dom"] }
266
+ }),
267
+ resolveId: {
268
+ filter: { id: (0, __rolldown_pluginutils.exactRegex)(runtimePublicPath) },
269
+ handler(id) {
270
+ if (id === runtimePublicPath) return id;
271
+ }
272
+ },
273
+ load: {
274
+ filter: { id: (0, __rolldown_pluginutils.exactRegex)(runtimePublicPath) },
275
+ handler(id) {
276
+ if (id === runtimePublicPath) return (0, node_fs.readFileSync)(refreshRuntimePath, "utf-8").replace(/__README_URL__/g, "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react");
277
+ }
278
+ },
279
+ transformIndexHtml(_, config) {
280
+ if (!skipFastRefresh) return [{
281
+ tag: "script",
282
+ attrs: { type: "module" },
283
+ children: getPreambleCode(config.server.config.base)
284
+ }];
285
+ }
286
+ };
287
+ return [viteBabel, viteReactRefresh];
288
+ }
289
+ viteReact.preambleCode = preambleCode;
290
+ function canSkipBabel(plugins, babelOptions) {
291
+ return !(plugins.length || babelOptions.presets.length || babelOptions.configFile || babelOptions.babelrc);
292
+ }
293
+ const loadedPlugin = /* @__PURE__ */ new Map();
294
+ function loadPlugin(path) {
295
+ const cached = loadedPlugin.get(path);
296
+ if (cached) return cached;
297
+ const promise = import(path).then((module$1) => {
298
+ const value = module$1.default || module$1;
299
+ loadedPlugin.set(path, value);
300
+ return value;
301
+ });
302
+ loadedPlugin.set(path, promise);
303
+ return promise;
304
+ }
305
+ function createBabelOptions(rawOptions) {
306
+ var _babelOptions$parserO;
307
+ const babelOptions = {
308
+ babelrc: false,
309
+ configFile: false,
310
+ ...rawOptions
311
+ };
312
+ babelOptions.plugins || (babelOptions.plugins = []);
313
+ babelOptions.presets || (babelOptions.presets = []);
314
+ babelOptions.overrides || (babelOptions.overrides = []);
315
+ babelOptions.parserOpts || (babelOptions.parserOpts = {});
316
+ (_babelOptions$parserO = babelOptions.parserOpts).plugins || (_babelOptions$parserO.plugins = []);
317
+ return babelOptions;
318
+ }
319
+ function defined(value) {
320
+ return value !== void 0;
321
+ }
322
+ function getReactCompilerPlugin(plugins) {
323
+ return plugins.find((p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler");
324
+ }
325
+ function getReactCompilerRuntimeModule(plugin) {
326
+ let moduleName = "react/compiler-runtime";
327
+ if (Array.isArray(plugin)) {
328
+ var _plugin$, _plugin$2, _plugin$3;
329
+ if (((_plugin$ = plugin[1]) === null || _plugin$ === void 0 ? void 0 : _plugin$.target) === "17" || ((_plugin$2 = plugin[1]) === null || _plugin$2 === void 0 ? void 0 : _plugin$2.target) === "18") moduleName = "react-compiler-runtime";
330
+ else if (typeof ((_plugin$3 = plugin[1]) === null || _plugin$3 === void 0 ? void 0 : _plugin$3.runtimeModule) === "string") {
331
+ var _plugin$4;
332
+ moduleName = (_plugin$4 = plugin[1]) === null || _plugin$4 === void 0 ? void 0 : _plugin$4.runtimeModule;
333
+ }
334
+ }
335
+ return moduleName;
336
+ }
337
+ function ensureArray(value) {
338
+ return Array.isArray(value) ? value : [value];
339
+ }
340
+
341
+ //#endregion
342
+ module.exports = viteReact;
343
+ module.exports.default = module.exports
scripts/node_modules/@vitejs/plugin-react/dist/index.d.cts ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { ParserOptions, TransformOptions } from "@babel/core";
2
+ import { Plugin, ResolvedConfig } from "vite";
3
+
4
+ //#region src/index.d.ts
5
+ interface Options {
6
+ include?: string | RegExp | Array<string | RegExp>;
7
+ exclude?: string | RegExp | Array<string | RegExp>;
8
+ /**
9
+ * Control where the JSX factory is imported from.
10
+ * https://esbuild.github.io/api/#jsx-import-source
11
+ * @default 'react'
12
+ */
13
+ jsxImportSource?: string;
14
+ /**
15
+ * Note: Skipping React import with classic runtime is not supported from v4
16
+ * @default "automatic"
17
+ */
18
+ jsxRuntime?: 'classic' | 'automatic';
19
+ /**
20
+ * Babel configuration applied in both dev and prod.
21
+ */
22
+ babel?: BabelOptions | ((id: string, options: {
23
+ ssr?: boolean;
24
+ }) => BabelOptions);
25
+ /**
26
+ * React Fast Refresh runtime URL prefix.
27
+ * Useful in a module federation context to enable HMR by specifying
28
+ * the host application URL in the Vite config of a remote application.
29
+ * @example
30
+ * reactRefreshHost: 'http://localhost:3000'
31
+ */
32
+ reactRefreshHost?: string;
33
+ /**
34
+ * If set, disables the recommendation to use `@vitejs/plugin-react-oxc`
35
+ */
36
+ disableOxcRecommendation?: boolean;
37
+ }
38
+ type BabelOptions = Omit<TransformOptions, 'ast' | 'filename' | 'root' | 'sourceFileName' | 'sourceMaps' | 'inputSourceMap'>;
39
+ /**
40
+ * The object type used by the `options` passed to plugins with
41
+ * an `api.reactBabel` method.
42
+ */
43
+ interface ReactBabelOptions extends BabelOptions {
44
+ plugins: Extract<BabelOptions['plugins'], any[]>;
45
+ presets: Extract<BabelOptions['presets'], any[]>;
46
+ overrides: Extract<BabelOptions['overrides'], any[]>;
47
+ parserOpts: ParserOptions & {
48
+ plugins: Extract<ParserOptions['plugins'], any[]>;
49
+ };
50
+ }
51
+ type ReactBabelHook = (babelConfig: ReactBabelOptions, context: ReactBabelHookContext, config: ResolvedConfig) => void;
52
+ type ReactBabelHookContext = {
53
+ ssr: boolean;
54
+ id: string;
55
+ };
56
+ type ViteReactPluginApi = {
57
+ /**
58
+ * Manipulate the Babel options of `@vitejs/plugin-react`
59
+ */
60
+ reactBabel?: ReactBabelHook;
61
+ };
62
+ declare function viteReact(opts?: Options): Plugin[];
63
+ declare namespace viteReact {
64
+ var preambleCode: string;
65
+ }
66
+ //#endregion
67
+ export { BabelOptions, Options, ReactBabelOptions, ViteReactPluginApi, viteReact as default };
scripts/node_modules/@vitejs/plugin-react/dist/index.d.ts ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Plugin, ResolvedConfig } from "vite";
2
+ import { ParserOptions, TransformOptions } from "@babel/core";
3
+
4
+ //#region src/index.d.ts
5
+ interface Options {
6
+ include?: string | RegExp | Array<string | RegExp>;
7
+ exclude?: string | RegExp | Array<string | RegExp>;
8
+ /**
9
+ * Control where the JSX factory is imported from.
10
+ * https://esbuild.github.io/api/#jsx-import-source
11
+ * @default 'react'
12
+ */
13
+ jsxImportSource?: string;
14
+ /**
15
+ * Note: Skipping React import with classic runtime is not supported from v4
16
+ * @default "automatic"
17
+ */
18
+ jsxRuntime?: 'classic' | 'automatic';
19
+ /**
20
+ * Babel configuration applied in both dev and prod.
21
+ */
22
+ babel?: BabelOptions | ((id: string, options: {
23
+ ssr?: boolean;
24
+ }) => BabelOptions);
25
+ /**
26
+ * React Fast Refresh runtime URL prefix.
27
+ * Useful in a module federation context to enable HMR by specifying
28
+ * the host application URL in the Vite config of a remote application.
29
+ * @example
30
+ * reactRefreshHost: 'http://localhost:3000'
31
+ */
32
+ reactRefreshHost?: string;
33
+ /**
34
+ * If set, disables the recommendation to use `@vitejs/plugin-react-oxc`
35
+ */
36
+ disableOxcRecommendation?: boolean;
37
+ }
38
+ type BabelOptions = Omit<TransformOptions, 'ast' | 'filename' | 'root' | 'sourceFileName' | 'sourceMaps' | 'inputSourceMap'>;
39
+ /**
40
+ * The object type used by the `options` passed to plugins with
41
+ * an `api.reactBabel` method.
42
+ */
43
+ interface ReactBabelOptions extends BabelOptions {
44
+ plugins: Extract<BabelOptions['plugins'], any[]>;
45
+ presets: Extract<BabelOptions['presets'], any[]>;
46
+ overrides: Extract<BabelOptions['overrides'], any[]>;
47
+ parserOpts: ParserOptions & {
48
+ plugins: Extract<ParserOptions['plugins'], any[]>;
49
+ };
50
+ }
51
+ type ReactBabelHook = (babelConfig: ReactBabelOptions, context: ReactBabelHookContext, config: ResolvedConfig) => void;
52
+ type ReactBabelHookContext = {
53
+ ssr: boolean;
54
+ id: string;
55
+ };
56
+ type ViteReactPluginApi = {
57
+ /**
58
+ * Manipulate the Babel options of `@vitejs/plugin-react`
59
+ */
60
+ reactBabel?: ReactBabelHook;
61
+ };
62
+ declare function viteReact(opts?: Options): Plugin[];
63
+ declare namespace viteReact {
64
+ var preambleCode: string;
65
+ }
66
+ //#endregion
67
+ export { BabelOptions, Options, ReactBabelOptions, ViteReactPluginApi, viteReact as default };
scripts/node_modules/@vitejs/plugin-react/dist/index.js ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { dirname, join } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { readFileSync } from "node:fs";
4
+ import * as vite from "vite";
5
+ import { createFilter } from "vite";
6
+ import { exactRegex, makeIdFiltersToMatchWithQuery } from "@rolldown/pluginutils";
7
+
8
+ //#region ../common/refresh-utils.ts
9
+ const runtimePublicPath = "/@react-refresh";
10
+ const reactCompRE = /extends\s+(?:React\.)?(?:Pure)?Component/;
11
+ const refreshContentRE = /\$RefreshReg\$\(/;
12
+ const preambleCode = `import { injectIntoGlobalHook } from "__BASE__${runtimePublicPath.slice(1)}";
13
+ injectIntoGlobalHook(window);
14
+ window.$RefreshReg$ = () => {};
15
+ window.$RefreshSig$ = () => (type) => type;`;
16
+ const getPreambleCode = (base) => preambleCode.replace("__BASE__", base);
17
+ const avoidSourceMapOption = Symbol();
18
+ function addRefreshWrapper(code, map, pluginName, id, reactRefreshHost = "") {
19
+ const hasRefresh = refreshContentRE.test(code);
20
+ const onlyReactComp = !hasRefresh && reactCompRE.test(code);
21
+ const normalizedMap = map === avoidSourceMapOption ? null : map;
22
+ if (!hasRefresh && !onlyReactComp) return {
23
+ code,
24
+ map: normalizedMap
25
+ };
26
+ const avoidSourceMap = map === avoidSourceMapOption;
27
+ const newMap = typeof normalizedMap === "string" ? JSON.parse(normalizedMap) : normalizedMap;
28
+ let newCode = code;
29
+ if (hasRefresh) {
30
+ const refreshHead = removeLineBreaksIfNeeded(`let prevRefreshReg;
31
+ let prevRefreshSig;
32
+
33
+ if (import.meta.hot && !inWebWorker) {
34
+ if (!window.$RefreshReg$) {
35
+ throw new Error(
36
+ "${pluginName} can't detect preamble. Something is wrong."
37
+ );
38
+ }
39
+
40
+ prevRefreshReg = window.$RefreshReg$;
41
+ prevRefreshSig = window.$RefreshSig$;
42
+ window.$RefreshReg$ = RefreshRuntime.getRefreshReg(${JSON.stringify(id)});
43
+ window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
44
+ }
45
+
46
+ `, avoidSourceMap);
47
+ newCode = `${refreshHead}${newCode}
48
+
49
+ if (import.meta.hot && !inWebWorker) {
50
+ window.$RefreshReg$ = prevRefreshReg;
51
+ window.$RefreshSig$ = prevRefreshSig;
52
+ }
53
+ `;
54
+ if (newMap) newMap.mappings = ";".repeat(16) + newMap.mappings;
55
+ }
56
+ const sharedHead = removeLineBreaksIfNeeded(`import * as RefreshRuntime from "${reactRefreshHost}${runtimePublicPath}";
57
+ const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope;
58
+
59
+ `, avoidSourceMap);
60
+ newCode = `${sharedHead}${newCode}
61
+
62
+ if (import.meta.hot && !inWebWorker) {
63
+ RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
64
+ RefreshRuntime.registerExportsForReactRefresh(${JSON.stringify(id)}, currentExports);
65
+ import.meta.hot.accept((nextExports) => {
66
+ if (!nextExports) return;
67
+ const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate(${JSON.stringify(id)}, currentExports, nextExports);
68
+ if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
69
+ });
70
+ });
71
+ }
72
+ `;
73
+ if (newMap) newMap.mappings = ";;;" + newMap.mappings;
74
+ return {
75
+ code: newCode,
76
+ map: newMap
77
+ };
78
+ }
79
+ function removeLineBreaksIfNeeded(code, enabled) {
80
+ return enabled ? code.replace(/\n/g, "") : code;
81
+ }
82
+
83
+ //#endregion
84
+ //#region ../common/warning.ts
85
+ const silenceUseClientWarning = (userConfig) => ({ rollupOptions: { onwarn(warning, defaultHandler) {
86
+ var _userConfig$build;
87
+ if (warning.code === "MODULE_LEVEL_DIRECTIVE" && (warning.message.includes("use client") || warning.message.includes("use server"))) return;
88
+ if (warning.code === "SOURCEMAP_ERROR" && warning.message.includes("resolve original location") && warning.pos === 0) return;
89
+ if ((_userConfig$build = userConfig.build) === null || _userConfig$build === void 0 || (_userConfig$build = _userConfig$build.rollupOptions) === null || _userConfig$build === void 0 ? void 0 : _userConfig$build.onwarn) userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
90
+ else defaultHandler(warning);
91
+ } } });
92
+
93
+ //#endregion
94
+ //#region src/index.ts
95
+ const _dirname = dirname(fileURLToPath(import.meta.url));
96
+ const refreshRuntimePath = join(_dirname, "refresh-runtime.js");
97
+ let babel;
98
+ async function loadBabel() {
99
+ if (!babel) babel = await import("@babel/core");
100
+ return babel;
101
+ }
102
+ const defaultIncludeRE = /\.[tj]sx?$/;
103
+ const tsRE = /\.tsx?$/;
104
+ function viteReact(opts = {}) {
105
+ var _opts$babel;
106
+ const include = opts.include ?? defaultIncludeRE;
107
+ const exclude = opts.exclude;
108
+ const filter = createFilter(include, exclude);
109
+ const jsxImportSource = opts.jsxImportSource ?? "react";
110
+ const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
111
+ const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
112
+ let runningInVite = false;
113
+ let isProduction = true;
114
+ let projectRoot = process.cwd();
115
+ let skipFastRefresh = true;
116
+ let runPluginOverrides;
117
+ let staticBabelOptions;
118
+ const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/;
119
+ const viteBabel = {
120
+ name: "vite:react-babel",
121
+ enforce: "pre",
122
+ config() {
123
+ if (opts.jsxRuntime === "classic") if ("rolldownVersion" in vite) return { oxc: { jsx: {
124
+ runtime: "classic",
125
+ development: false
126
+ } } };
127
+ else return { esbuild: { jsx: "transform" } };
128
+ else return {
129
+ esbuild: {
130
+ jsx: "automatic",
131
+ jsxImportSource: opts.jsxImportSource
132
+ },
133
+ optimizeDeps: "rolldownVersion" in vite ? { rollupOptions: { jsx: { mode: "automatic" } } } : { esbuildOptions: { jsx: "automatic" } }
134
+ };
135
+ },
136
+ configResolved(config) {
137
+ runningInVite = true;
138
+ projectRoot = config.root;
139
+ isProduction = config.isProduction;
140
+ skipFastRefresh = isProduction || config.command === "build" || config.server.hmr === false;
141
+ if ("jsxPure" in opts) config.logger.warnOnce("[@vitejs/plugin-react] jsxPure was removed. You can configure esbuild.jsxSideEffects directly.");
142
+ const hooks = config.plugins.map((plugin) => {
143
+ var _plugin$api;
144
+ return (_plugin$api = plugin.api) === null || _plugin$api === void 0 ? void 0 : _plugin$api.reactBabel;
145
+ }).filter(defined);
146
+ if ("rolldownVersion" in vite && !opts.babel && !hooks.length && !opts.disableOxcRecommendation) config.logger.warn("[vite:react-babel] We recommend switching to `@vitejs/plugin-react-oxc` for improved performance. More information at https://vite.dev/rolldown");
147
+ if (hooks.length > 0) runPluginOverrides = (babelOptions, context) => {
148
+ hooks.forEach((hook) => hook(babelOptions, context, config));
149
+ };
150
+ else if (typeof opts.babel !== "function") {
151
+ staticBabelOptions = createBabelOptions(opts.babel);
152
+ if (canSkipBabel(staticBabelOptions.plugins, staticBabelOptions) && skipFastRefresh && (opts.jsxRuntime === "classic" ? isProduction : true)) delete viteBabel.transform;
153
+ }
154
+ },
155
+ options(options) {
156
+ if (!runningInVite) {
157
+ options.jsx = {
158
+ mode: opts.jsxRuntime,
159
+ importSource: opts.jsxImportSource
160
+ };
161
+ return options;
162
+ }
163
+ },
164
+ transform: {
165
+ filter: { id: {
166
+ include: makeIdFiltersToMatchWithQuery(include),
167
+ exclude: [...exclude ? makeIdFiltersToMatchWithQuery(ensureArray(exclude)) : [], /\/node_modules\//]
168
+ } },
169
+ async handler(code, id, options) {
170
+ if (id.includes("/node_modules/")) return;
171
+ const [filepath] = id.split("?");
172
+ if (!filter(filepath)) return;
173
+ const ssr = (options === null || options === void 0 ? void 0 : options.ssr) === true;
174
+ const babelOptions = (() => {
175
+ if (staticBabelOptions) return staticBabelOptions;
176
+ const newBabelOptions = createBabelOptions(typeof opts.babel === "function" ? opts.babel(id, { ssr }) : opts.babel);
177
+ runPluginOverrides === null || runPluginOverrides === void 0 || runPluginOverrides(newBabelOptions, {
178
+ id,
179
+ ssr
180
+ });
181
+ return newBabelOptions;
182
+ })();
183
+ const plugins = [...babelOptions.plugins];
184
+ const isJSX = filepath.endsWith("x");
185
+ const useFastRefresh = !skipFastRefresh && !ssr && (isJSX || (opts.jsxRuntime === "classic" ? importReactRE.test(code) : code.includes(jsxImportDevRuntime) || code.includes(jsxImportRuntime)));
186
+ if (useFastRefresh) plugins.push([await loadPlugin("react-refresh/babel"), { skipEnvCheck: true }]);
187
+ if (opts.jsxRuntime === "classic" && isJSX) {
188
+ if (!isProduction) plugins.push(await loadPlugin("@babel/plugin-transform-react-jsx-self"), await loadPlugin("@babel/plugin-transform-react-jsx-source"));
189
+ }
190
+ if (canSkipBabel(plugins, babelOptions)) return;
191
+ const parserPlugins = [...babelOptions.parserOpts.plugins];
192
+ if (!filepath.endsWith(".ts")) parserPlugins.push("jsx");
193
+ if (tsRE.test(filepath)) parserPlugins.push("typescript");
194
+ const babel$1 = await loadBabel();
195
+ const result = await babel$1.transformAsync(code, {
196
+ ...babelOptions,
197
+ root: projectRoot,
198
+ filename: id,
199
+ sourceFileName: filepath,
200
+ retainLines: getReactCompilerPlugin(plugins) != null ? false : !isProduction && isJSX && opts.jsxRuntime !== "classic",
201
+ parserOpts: {
202
+ ...babelOptions.parserOpts,
203
+ sourceType: "module",
204
+ allowAwaitOutsideFunction: true,
205
+ plugins: parserPlugins
206
+ },
207
+ generatorOpts: {
208
+ ...babelOptions.generatorOpts,
209
+ importAttributesKeyword: "with",
210
+ decoratorsBeforeExport: true
211
+ },
212
+ plugins,
213
+ sourceMaps: true
214
+ });
215
+ if (result) {
216
+ if (!useFastRefresh) return {
217
+ code: result.code,
218
+ map: result.map
219
+ };
220
+ return addRefreshWrapper(result.code, result.map, "@vitejs/plugin-react", id, opts.reactRefreshHost);
221
+ }
222
+ }
223
+ }
224
+ };
225
+ const dependencies = [
226
+ "react",
227
+ "react-dom",
228
+ jsxImportDevRuntime,
229
+ jsxImportRuntime
230
+ ];
231
+ const staticBabelPlugins = typeof opts.babel === "object" ? ((_opts$babel = opts.babel) === null || _opts$babel === void 0 ? void 0 : _opts$babel.plugins) ?? [] : [];
232
+ const reactCompilerPlugin = getReactCompilerPlugin(staticBabelPlugins);
233
+ if (reactCompilerPlugin != null) {
234
+ const reactCompilerRuntimeModule = getReactCompilerRuntimeModule(reactCompilerPlugin);
235
+ dependencies.push(reactCompilerRuntimeModule);
236
+ }
237
+ const viteReactRefresh = {
238
+ name: "vite:react-refresh",
239
+ enforce: "pre",
240
+ config: (userConfig) => ({
241
+ build: silenceUseClientWarning(userConfig),
242
+ optimizeDeps: { include: dependencies },
243
+ resolve: { dedupe: ["react", "react-dom"] }
244
+ }),
245
+ resolveId: {
246
+ filter: { id: exactRegex(runtimePublicPath) },
247
+ handler(id) {
248
+ if (id === runtimePublicPath) return id;
249
+ }
250
+ },
251
+ load: {
252
+ filter: { id: exactRegex(runtimePublicPath) },
253
+ handler(id) {
254
+ if (id === runtimePublicPath) return readFileSync(refreshRuntimePath, "utf-8").replace(/__README_URL__/g, "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react");
255
+ }
256
+ },
257
+ transformIndexHtml(_, config) {
258
+ if (!skipFastRefresh) return [{
259
+ tag: "script",
260
+ attrs: { type: "module" },
261
+ children: getPreambleCode(config.server.config.base)
262
+ }];
263
+ }
264
+ };
265
+ return [viteBabel, viteReactRefresh];
266
+ }
267
+ viteReact.preambleCode = preambleCode;
268
+ function canSkipBabel(plugins, babelOptions) {
269
+ return !(plugins.length || babelOptions.presets.length || babelOptions.configFile || babelOptions.babelrc);
270
+ }
271
+ const loadedPlugin = /* @__PURE__ */ new Map();
272
+ function loadPlugin(path) {
273
+ const cached = loadedPlugin.get(path);
274
+ if (cached) return cached;
275
+ const promise = import(path).then((module) => {
276
+ const value = module.default || module;
277
+ loadedPlugin.set(path, value);
278
+ return value;
279
+ });
280
+ loadedPlugin.set(path, promise);
281
+ return promise;
282
+ }
283
+ function createBabelOptions(rawOptions) {
284
+ var _babelOptions$parserO;
285
+ const babelOptions = {
286
+ babelrc: false,
287
+ configFile: false,
288
+ ...rawOptions
289
+ };
290
+ babelOptions.plugins || (babelOptions.plugins = []);
291
+ babelOptions.presets || (babelOptions.presets = []);
292
+ babelOptions.overrides || (babelOptions.overrides = []);
293
+ babelOptions.parserOpts || (babelOptions.parserOpts = {});
294
+ (_babelOptions$parserO = babelOptions.parserOpts).plugins || (_babelOptions$parserO.plugins = []);
295
+ return babelOptions;
296
+ }
297
+ function defined(value) {
298
+ return value !== void 0;
299
+ }
300
+ function getReactCompilerPlugin(plugins) {
301
+ return plugins.find((p) => p === "babel-plugin-react-compiler" || Array.isArray(p) && p[0] === "babel-plugin-react-compiler");
302
+ }
303
+ function getReactCompilerRuntimeModule(plugin) {
304
+ let moduleName = "react/compiler-runtime";
305
+ if (Array.isArray(plugin)) {
306
+ var _plugin$, _plugin$2, _plugin$3;
307
+ if (((_plugin$ = plugin[1]) === null || _plugin$ === void 0 ? void 0 : _plugin$.target) === "17" || ((_plugin$2 = plugin[1]) === null || _plugin$2 === void 0 ? void 0 : _plugin$2.target) === "18") moduleName = "react-compiler-runtime";
308
+ else if (typeof ((_plugin$3 = plugin[1]) === null || _plugin$3 === void 0 ? void 0 : _plugin$3.runtimeModule) === "string") {
309
+ var _plugin$4;
310
+ moduleName = (_plugin$4 = plugin[1]) === null || _plugin$4 === void 0 ? void 0 : _plugin$4.runtimeModule;
311
+ }
312
+ }
313
+ return moduleName;
314
+ }
315
+ function ensureArray(value) {
316
+ return Array.isArray(value) ? value : [value];
317
+ }
318
+
319
+ //#endregion
320
+ export { viteReact as default };
scripts/node_modules/@vitejs/plugin-react/dist/refresh-runtime.js ADDED
@@ -0,0 +1,670 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* global window */
2
+ /* eslint-disable eqeqeq, prefer-const, @typescript-eslint/no-empty-function */
3
+
4
+ /*! Copyright (c) Meta Platforms, Inc. and affiliates. **/
5
+ /**
6
+ * This is simplified pure-js version of https://github.com/facebook/react/blob/main/packages/react-refresh/src/ReactFreshRuntime.js
7
+ * without IE11 compatibility and verbose isDev checks.
8
+ * Some utils are appended at the bottom for HMR integration.
9
+ */
10
+
11
+ const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')
12
+ const REACT_MEMO_TYPE = Symbol.for('react.memo')
13
+
14
+ // We never remove these associations.
15
+ // It's OK to reference families, but use WeakMap/Set for types.
16
+ let allFamiliesByID = new Map()
17
+ let allFamiliesByType = new WeakMap()
18
+ let allSignaturesByType = new WeakMap()
19
+
20
+ // This WeakMap is read by React, so we only put families
21
+ // that have actually been edited here. This keeps checks fast.
22
+ const updatedFamiliesByType = new WeakMap()
23
+
24
+ // This is cleared on every performReactRefresh() call.
25
+ // It is an array of [Family, NextType] tuples.
26
+ let pendingUpdates = []
27
+
28
+ // This is injected by the renderer via DevTools global hook.
29
+ const helpersByRendererID = new Map()
30
+
31
+ const helpersByRoot = new Map()
32
+
33
+ // We keep track of mounted roots so we can schedule updates.
34
+ const mountedRoots = new Set()
35
+ // If a root captures an error, we remember it so we can retry on edit.
36
+ const failedRoots = new Set()
37
+
38
+ // We also remember the last element for every root.
39
+ // It needs to be weak because we do this even for roots that failed to mount.
40
+ // If there is no WeakMap, we won't attempt to do retrying.
41
+ let rootElements = new WeakMap()
42
+ let isPerformingRefresh = false
43
+
44
+ function computeFullKey(signature) {
45
+ if (signature.fullKey !== null) {
46
+ return signature.fullKey
47
+ }
48
+
49
+ let fullKey = signature.ownKey
50
+ let hooks
51
+ try {
52
+ hooks = signature.getCustomHooks()
53
+ } catch (err) {
54
+ // This can happen in an edge case, e.g. if expression like Foo.useSomething
55
+ // depends on Foo which is lazily initialized during rendering.
56
+ // In that case just assume we'll have to remount.
57
+ signature.forceReset = true
58
+ signature.fullKey = fullKey
59
+ return fullKey
60
+ }
61
+
62
+ for (let i = 0; i < hooks.length; i++) {
63
+ const hook = hooks[i]
64
+ if (typeof hook !== 'function') {
65
+ // Something's wrong. Assume we need to remount.
66
+ signature.forceReset = true
67
+ signature.fullKey = fullKey
68
+ return fullKey
69
+ }
70
+ const nestedHookSignature = allSignaturesByType.get(hook)
71
+ if (nestedHookSignature === undefined) {
72
+ // No signature means Hook wasn't in the source code, e.g. in a library.
73
+ // We'll skip it because we can assume it won't change during this session.
74
+ continue
75
+ }
76
+ const nestedHookKey = computeFullKey(nestedHookSignature)
77
+ if (nestedHookSignature.forceReset) {
78
+ signature.forceReset = true
79
+ }
80
+ fullKey += '\n---\n' + nestedHookKey
81
+ }
82
+
83
+ signature.fullKey = fullKey
84
+ return fullKey
85
+ }
86
+
87
+ function haveEqualSignatures(prevType, nextType) {
88
+ const prevSignature = allSignaturesByType.get(prevType)
89
+ const nextSignature = allSignaturesByType.get(nextType)
90
+
91
+ if (prevSignature === undefined && nextSignature === undefined) {
92
+ return true
93
+ }
94
+ if (prevSignature === undefined || nextSignature === undefined) {
95
+ return false
96
+ }
97
+ if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
98
+ return false
99
+ }
100
+ if (nextSignature.forceReset) {
101
+ return false
102
+ }
103
+
104
+ return true
105
+ }
106
+
107
+ function isReactClass(type) {
108
+ return type.prototype && type.prototype.isReactComponent
109
+ }
110
+
111
+ function canPreserveStateBetween(prevType, nextType) {
112
+ if (isReactClass(prevType) || isReactClass(nextType)) {
113
+ return false
114
+ }
115
+ if (haveEqualSignatures(prevType, nextType)) {
116
+ return true
117
+ }
118
+ return false
119
+ }
120
+
121
+ function resolveFamily(type) {
122
+ // Only check updated types to keep lookups fast.
123
+ return updatedFamiliesByType.get(type)
124
+ }
125
+
126
+ // This is a safety mechanism to protect against rogue getters and Proxies.
127
+ function getProperty(object, property) {
128
+ try {
129
+ return object[property]
130
+ } catch (err) {
131
+ // Intentionally ignore.
132
+ return undefined
133
+ }
134
+ }
135
+
136
+ function performReactRefresh() {
137
+ if (pendingUpdates.length === 0) {
138
+ return null
139
+ }
140
+ if (isPerformingRefresh) {
141
+ return null
142
+ }
143
+
144
+ isPerformingRefresh = true
145
+ try {
146
+ const staleFamilies = new Set()
147
+ const updatedFamilies = new Set()
148
+
149
+ const updates = pendingUpdates
150
+ pendingUpdates = []
151
+ updates.forEach(([family, nextType]) => {
152
+ // Now that we got a real edit, we can create associations
153
+ // that will be read by the React reconciler.
154
+ const prevType = family.current
155
+ updatedFamiliesByType.set(prevType, family)
156
+ updatedFamiliesByType.set(nextType, family)
157
+ family.current = nextType
158
+
159
+ // Determine whether this should be a re-render or a re-mount.
160
+ if (canPreserveStateBetween(prevType, nextType)) {
161
+ updatedFamilies.add(family)
162
+ } else {
163
+ staleFamilies.add(family)
164
+ }
165
+ })
166
+
167
+ // TODO: rename these fields to something more meaningful.
168
+ const update = {
169
+ updatedFamilies, // Families that will re-render preserving state
170
+ staleFamilies, // Families that will be remounted
171
+ }
172
+
173
+ helpersByRendererID.forEach((helpers) => {
174
+ // Even if there are no roots, set the handler on first update.
175
+ // This ensures that if *new* roots are mounted, they'll use the resolve handler.
176
+ helpers.setRefreshHandler(resolveFamily)
177
+ })
178
+
179
+ let didError = false
180
+ let firstError = null
181
+
182
+ // We snapshot maps and sets that are mutated during commits.
183
+ // If we don't do this, there is a risk they will be mutated while
184
+ // we iterate over them. For example, trying to recover a failed root
185
+ // may cause another root to be added to the failed list -- an infinite loop.
186
+ const failedRootsSnapshot = new Set(failedRoots)
187
+ const mountedRootsSnapshot = new Set(mountedRoots)
188
+ const helpersByRootSnapshot = new Map(helpersByRoot)
189
+
190
+ failedRootsSnapshot.forEach((root) => {
191
+ const helpers = helpersByRootSnapshot.get(root)
192
+ if (helpers === undefined) {
193
+ throw new Error(
194
+ 'Could not find helpers for a root. This is a bug in React Refresh.',
195
+ )
196
+ }
197
+ if (!failedRoots.has(root)) {
198
+ // No longer failed.
199
+ }
200
+ if (rootElements === null) {
201
+ return
202
+ }
203
+ if (!rootElements.has(root)) {
204
+ return
205
+ }
206
+ const element = rootElements.get(root)
207
+ try {
208
+ helpers.scheduleRoot(root, element)
209
+ } catch (err) {
210
+ if (!didError) {
211
+ didError = true
212
+ firstError = err
213
+ }
214
+ // Keep trying other roots.
215
+ }
216
+ })
217
+ mountedRootsSnapshot.forEach((root) => {
218
+ const helpers = helpersByRootSnapshot.get(root)
219
+ if (helpers === undefined) {
220
+ throw new Error(
221
+ 'Could not find helpers for a root. This is a bug in React Refresh.',
222
+ )
223
+ }
224
+ if (!mountedRoots.has(root)) {
225
+ // No longer mounted.
226
+ }
227
+ try {
228
+ helpers.scheduleRefresh(root, update)
229
+ } catch (err) {
230
+ if (!didError) {
231
+ didError = true
232
+ firstError = err
233
+ }
234
+ // Keep trying other roots.
235
+ }
236
+ })
237
+ if (didError) {
238
+ throw firstError
239
+ }
240
+ return update
241
+ } finally {
242
+ isPerformingRefresh = false
243
+ }
244
+ }
245
+
246
+ function register(type, id) {
247
+ if (type === null) {
248
+ return
249
+ }
250
+ if (typeof type !== 'function' && typeof type !== 'object') {
251
+ return
252
+ }
253
+
254
+ // This can happen in an edge case, e.g. if we register
255
+ // return value of a HOC but it returns a cached component.
256
+ // Ignore anything but the first registration for each type.
257
+ if (allFamiliesByType.has(type)) {
258
+ return
259
+ }
260
+ // Create family or remember to update it.
261
+ // None of this bookkeeping affects reconciliation
262
+ // until the first performReactRefresh() call above.
263
+ let family = allFamiliesByID.get(id)
264
+ if (family === undefined) {
265
+ family = { current: type }
266
+ allFamiliesByID.set(id, family)
267
+ } else {
268
+ pendingUpdates.push([family, type])
269
+ }
270
+ allFamiliesByType.set(type, family)
271
+
272
+ // Visit inner types because we might not have registered them.
273
+ if (typeof type === 'object' && type !== null) {
274
+ switch (getProperty(type, '$$typeof')) {
275
+ case REACT_FORWARD_REF_TYPE:
276
+ register(type.render, id + '$render')
277
+ break
278
+ case REACT_MEMO_TYPE:
279
+ register(type.type, id + '$type')
280
+ break
281
+ }
282
+ }
283
+ }
284
+
285
+ function setSignature(type, key, forceReset, getCustomHooks) {
286
+ if (!allSignaturesByType.has(type)) {
287
+ allSignaturesByType.set(type, {
288
+ forceReset,
289
+ ownKey: key,
290
+ fullKey: null,
291
+ getCustomHooks: getCustomHooks || (() => []),
292
+ })
293
+ }
294
+ // Visit inner types because we might not have signed them.
295
+ if (typeof type === 'object' && type !== null) {
296
+ switch (getProperty(type, '$$typeof')) {
297
+ case REACT_FORWARD_REF_TYPE:
298
+ setSignature(type.render, key, forceReset, getCustomHooks)
299
+ break
300
+ case REACT_MEMO_TYPE:
301
+ setSignature(type.type, key, forceReset, getCustomHooks)
302
+ break
303
+ }
304
+ }
305
+ }
306
+
307
+ // This is lazily called during first render for a type.
308
+ // It captures Hook list at that time so inline requires don't break comparisons.
309
+ function collectCustomHooksForSignature(type) {
310
+ const signature = allSignaturesByType.get(type)
311
+ if (signature !== undefined) {
312
+ computeFullKey(signature)
313
+ }
314
+ }
315
+
316
+ export function injectIntoGlobalHook(globalObject) {
317
+ // For React Native, the global hook will be set up by require('react-devtools-core').
318
+ // That code will run before us. So we need to monkeypatch functions on existing hook.
319
+
320
+ // For React Web, the global hook will be set up by the extension.
321
+ // This will also run before us.
322
+ let hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__
323
+ if (hook === undefined) {
324
+ // However, if there is no DevTools extension, we'll need to set up the global hook ourselves.
325
+ // Note that in this case it's important that renderer code runs *after* this method call.
326
+ // Otherwise, the renderer will think that there is no global hook, and won't do the injection.
327
+ let nextID = 0
328
+ globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
329
+ renderers: new Map(),
330
+ supportsFiber: true,
331
+ inject: (injected) => nextID++,
332
+ onScheduleFiberRoot: (id, root, children) => {},
333
+ onCommitFiberRoot: (id, root, maybePriorityLevel, didError) => {},
334
+ onCommitFiberUnmount() {},
335
+ }
336
+ }
337
+
338
+ if (hook.isDisabled) {
339
+ // This isn't a real property on the hook, but it can be set to opt out
340
+ // of DevTools integration and associated warnings and logs.
341
+ // Using console['warn'] to evade Babel and ESLint
342
+ console['warn'](
343
+ 'Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). ' +
344
+ 'Fast Refresh is not compatible with this shim and will be disabled.',
345
+ )
346
+ return
347
+ }
348
+
349
+ // Here, we just want to get a reference to scheduleRefresh.
350
+ const oldInject = hook.inject
351
+ hook.inject = function (injected) {
352
+ const id = oldInject.apply(this, arguments)
353
+ if (
354
+ typeof injected.scheduleRefresh === 'function' &&
355
+ typeof injected.setRefreshHandler === 'function'
356
+ ) {
357
+ // This version supports React Refresh.
358
+ helpersByRendererID.set(id, injected)
359
+ }
360
+ return id
361
+ }
362
+
363
+ // Do the same for any already injected roots.
364
+ // This is useful if ReactDOM has already been initialized.
365
+ // https://github.com/facebook/react/issues/17626
366
+ hook.renderers.forEach((injected, id) => {
367
+ if (
368
+ typeof injected.scheduleRefresh === 'function' &&
369
+ typeof injected.setRefreshHandler === 'function'
370
+ ) {
371
+ // This version supports React Refresh.
372
+ helpersByRendererID.set(id, injected)
373
+ }
374
+ })
375
+
376
+ // We also want to track currently mounted roots.
377
+ const oldOnCommitFiberRoot = hook.onCommitFiberRoot
378
+ const oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || (() => {})
379
+ hook.onScheduleFiberRoot = function (id, root, children) {
380
+ if (!isPerformingRefresh) {
381
+ // If it was intentionally scheduled, don't attempt to restore.
382
+ // This includes intentionally scheduled unmounts.
383
+ failedRoots.delete(root)
384
+ if (rootElements !== null) {
385
+ rootElements.set(root, children)
386
+ }
387
+ }
388
+ return oldOnScheduleFiberRoot.apply(this, arguments)
389
+ }
390
+ hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
391
+ const helpers = helpersByRendererID.get(id)
392
+ if (helpers !== undefined) {
393
+ helpersByRoot.set(root, helpers)
394
+
395
+ const current = root.current
396
+ const alternate = current.alternate
397
+
398
+ // We need to determine whether this root has just (un)mounted.
399
+ // This logic is copy-pasted from similar logic in the DevTools backend.
400
+ // If this breaks with some refactoring, you'll want to update DevTools too.
401
+
402
+ if (alternate !== null) {
403
+ const wasMounted =
404
+ alternate.memoizedState != null &&
405
+ alternate.memoizedState.element != null &&
406
+ mountedRoots.has(root)
407
+
408
+ const isMounted =
409
+ current.memoizedState != null && current.memoizedState.element != null
410
+
411
+ if (!wasMounted && isMounted) {
412
+ // Mount a new root.
413
+ mountedRoots.add(root)
414
+ failedRoots.delete(root)
415
+ } else if (wasMounted && isMounted) {
416
+ // Update an existing root.
417
+ // This doesn't affect our mounted root Set.
418
+ } else if (wasMounted && !isMounted) {
419
+ // Unmount an existing root.
420
+ mountedRoots.delete(root)
421
+ if (didError) {
422
+ // We'll remount it on future edits.
423
+ failedRoots.add(root)
424
+ } else {
425
+ helpersByRoot.delete(root)
426
+ }
427
+ } else if (!wasMounted && !isMounted) {
428
+ if (didError) {
429
+ // We'll remount it on future edits.
430
+ failedRoots.add(root)
431
+ }
432
+ }
433
+ } else {
434
+ // Mount a new root.
435
+ mountedRoots.add(root)
436
+ }
437
+ }
438
+
439
+ // Always call the decorated DevTools hook.
440
+ return oldOnCommitFiberRoot.apply(this, arguments)
441
+ }
442
+ }
443
+
444
+ // This is a wrapper over more primitive functions for setting signature.
445
+ // Signatures let us decide whether the Hook order has changed on refresh.
446
+ //
447
+ // This function is intended to be used as a transform target, e.g.:
448
+ // var _s = createSignatureFunctionForTransform()
449
+ //
450
+ // function Hello() {
451
+ // const [foo, setFoo] = useState(0);
452
+ // const value = useCustomHook();
453
+ // _s(); /* Call without arguments triggers collecting the custom Hook list.
454
+ // * This doesn't happen during the module evaluation because we
455
+ // * don't want to change the module order with inline requires.
456
+ // * Next calls are noops. */
457
+ // return <h1>Hi</h1>;
458
+ // }
459
+ //
460
+ // /* Call with arguments attaches the signature to the type: */
461
+ // _s(
462
+ // Hello,
463
+ // 'useState{[foo, setFoo]}(0)',
464
+ // () => [useCustomHook], /* Lazy to avoid triggering inline requires */
465
+ // );
466
+ export function createSignatureFunctionForTransform() {
467
+ let savedType
468
+ let hasCustomHooks
469
+ let didCollectHooks = false
470
+ return function (type, key, forceReset, getCustomHooks) {
471
+ if (typeof key === 'string') {
472
+ // We're in the initial phase that associates signatures
473
+ // with the functions. Note this may be called multiple times
474
+ // in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))).
475
+ if (!savedType) {
476
+ // We're in the innermost call, so this is the actual type.
477
+ // $FlowFixMe[escaped-generic] discovered when updating Flow
478
+ savedType = type
479
+ hasCustomHooks = typeof getCustomHooks === 'function'
480
+ }
481
+ // Set the signature for all types (even wrappers!) in case
482
+ // they have no signatures of their own. This is to prevent
483
+ // problems like https://github.com/facebook/react/issues/20417.
484
+ if (
485
+ type != null &&
486
+ (typeof type === 'function' || typeof type === 'object')
487
+ ) {
488
+ setSignature(type, key, forceReset, getCustomHooks)
489
+ }
490
+ return type
491
+ } else {
492
+ // We're in the _s() call without arguments, which means
493
+ // this is the time to collect custom Hook signatures.
494
+ // Only do this once. This path is hot and runs *inside* every render!
495
+ if (!didCollectHooks && hasCustomHooks) {
496
+ didCollectHooks = true
497
+ collectCustomHooksForSignature(savedType)
498
+ }
499
+ }
500
+ }
501
+ }
502
+
503
+ function isLikelyComponentType(type) {
504
+ switch (typeof type) {
505
+ case 'function': {
506
+ // First, deal with classes.
507
+ if (type.prototype != null) {
508
+ if (type.prototype.isReactComponent) {
509
+ // React class.
510
+ return true
511
+ }
512
+ const ownNames = Object.getOwnPropertyNames(type.prototype)
513
+ if (ownNames.length > 1 || ownNames[0] !== 'constructor') {
514
+ // This looks like a class.
515
+ return false
516
+ }
517
+
518
+ if (type.prototype.__proto__ !== Object.prototype) {
519
+ // It has a superclass.
520
+ return false
521
+ }
522
+ // Pass through.
523
+ // This looks like a regular function with empty prototype.
524
+ }
525
+ // For plain functions and arrows, use name as a heuristic.
526
+ const name = type.name || type.displayName
527
+ return typeof name === 'string' && /^[A-Z]/.test(name)
528
+ }
529
+ case 'object': {
530
+ if (type != null) {
531
+ switch (getProperty(type, '$$typeof')) {
532
+ case REACT_FORWARD_REF_TYPE:
533
+ case REACT_MEMO_TYPE:
534
+ // Definitely React components.
535
+ return true
536
+ default:
537
+ return false
538
+ }
539
+ }
540
+ return false
541
+ }
542
+ default: {
543
+ return false
544
+ }
545
+ }
546
+ }
547
+
548
+ function isCompoundComponent(type) {
549
+ if (!isPlainObject(type)) return false
550
+ for (const key in type) {
551
+ if (!isLikelyComponentType(type[key])) return false
552
+ }
553
+ return true
554
+ }
555
+
556
+ function isPlainObject(obj) {
557
+ return (
558
+ Object.prototype.toString.call(obj) === '[object Object]' &&
559
+ (obj.constructor === Object || obj.constructor === undefined)
560
+ )
561
+ }
562
+
563
+ /**
564
+ * Plugin utils
565
+ */
566
+
567
+ export function getRefreshReg(filename) {
568
+ return (type, id) => register(type, filename + ' ' + id)
569
+ }
570
+
571
+ // Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141
572
+ // This allows to resister components not detected by SWC like styled component
573
+ export function registerExportsForReactRefresh(filename, moduleExports) {
574
+ for (const key in moduleExports) {
575
+ if (key === '__esModule') continue
576
+ const exportValue = moduleExports[key]
577
+ if (isLikelyComponentType(exportValue)) {
578
+ // 'export' is required to avoid key collision when renamed exports that
579
+ // shadow a local component name: https://github.com/vitejs/vite-plugin-react/issues/116
580
+ // The register function has an identity check to not register twice the same component,
581
+ // so this is safe to not used the same key here.
582
+ register(exportValue, filename + ' export ' + key)
583
+ } else if (isCompoundComponent(exportValue)) {
584
+ for (const subKey in exportValue) {
585
+ register(
586
+ exportValue[subKey],
587
+ filename + ' export ' + key + '-' + subKey,
588
+ )
589
+ }
590
+ }
591
+ }
592
+ }
593
+
594
+ function debounce(fn, delay) {
595
+ let handle
596
+ return () => {
597
+ clearTimeout(handle)
598
+ handle = setTimeout(fn, delay)
599
+ }
600
+ }
601
+
602
+ const hooks = []
603
+ window.__registerBeforePerformReactRefresh = (cb) => {
604
+ hooks.push(cb)
605
+ }
606
+ const enqueueUpdate = debounce(async () => {
607
+ if (hooks.length) await Promise.all(hooks.map((cb) => cb()))
608
+ performReactRefresh()
609
+ }, 16)
610
+
611
+ export function validateRefreshBoundaryAndEnqueueUpdate(
612
+ id,
613
+ prevExports,
614
+ nextExports,
615
+ ) {
616
+ const ignoredExports = window.__getReactRefreshIgnoredExports?.({ id }) ?? []
617
+ if (
618
+ predicateOnExport(
619
+ ignoredExports,
620
+ prevExports,
621
+ (key) => key in nextExports,
622
+ ) !== true
623
+ ) {
624
+ return 'Could not Fast Refresh (export removed)'
625
+ }
626
+ if (
627
+ predicateOnExport(
628
+ ignoredExports,
629
+ nextExports,
630
+ (key) => key in prevExports,
631
+ ) !== true
632
+ ) {
633
+ return 'Could not Fast Refresh (new export)'
634
+ }
635
+
636
+ let hasExports = false
637
+ const allExportsAreComponentsOrUnchanged = predicateOnExport(
638
+ ignoredExports,
639
+ nextExports,
640
+ (key, value) => {
641
+ hasExports = true
642
+ if (isLikelyComponentType(value)) return true
643
+ if (isCompoundComponent(value)) return true
644
+ return prevExports[key] === nextExports[key]
645
+ },
646
+ )
647
+ if (hasExports && allExportsAreComponentsOrUnchanged === true) {
648
+ enqueueUpdate()
649
+ } else {
650
+ return `Could not Fast Refresh ("${allExportsAreComponentsOrUnchanged}" export is incompatible). Learn more at __README_URL__#consistent-components-exports`
651
+ }
652
+ }
653
+
654
+ function predicateOnExport(ignoredExports, moduleExports, predicate) {
655
+ for (const key in moduleExports) {
656
+ if (key === '__esModule') continue
657
+ if (ignoredExports.includes(key)) continue
658
+ const desc = Object.getOwnPropertyDescriptor(moduleExports, key)
659
+ if (desc && desc.get) return key
660
+ if (!predicate(key, moduleExports[key])) return key
661
+ }
662
+ return true
663
+ }
664
+
665
+ // Hides vite-ignored dynamic import so that Vite can skip analysis if no other
666
+ // dynamic import is present (https://github.com/vitejs/vite/pull/12732)
667
+ export const __hmr_import = (module) => import(/* @vite-ignore */ module)
668
+
669
+ // For backwards compatibility with @vitejs/plugin-react.
670
+ export default { injectIntoGlobalHook }
scripts/node_modules/@vitejs/plugin-react/package.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@vitejs/plugin-react",
3
+ "version": "4.7.0",
4
+ "license": "MIT",
5
+ "author": "Evan You",
6
+ "description": "The default Vite plugin for React projects",
7
+ "keywords": [
8
+ "vite",
9
+ "vite-plugin",
10
+ "react",
11
+ "babel",
12
+ "react-refresh",
13
+ "fast refresh"
14
+ ],
15
+ "contributors": [
16
+ "Alec Larson",
17
+ "Arnaud Barré"
18
+ ],
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "type": "module",
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/index.js",
29
+ "require": "./dist/index.cjs"
30
+ }
31
+ },
32
+ "scripts": {
33
+ "dev": "tsdown --watch",
34
+ "build": "tsdown",
35
+ "prepublishOnly": "npm run build",
36
+ "test-unit": "vitest run"
37
+ },
38
+ "engines": {
39
+ "node": "^14.18.0 || >=16.0.0"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/vitejs/vite-plugin-react.git",
44
+ "directory": "packages/plugin-react"
45
+ },
46
+ "bugs": {
47
+ "url": "https://github.com/vitejs/vite-plugin-react/issues"
48
+ },
49
+ "homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
50
+ "dependencies": {
51
+ "@babel/core": "^7.28.0",
52
+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",
53
+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",
54
+ "@rolldown/pluginutils": "1.0.0-beta.27",
55
+ "@types/babel__core": "^7.20.5",
56
+ "react-refresh": "^0.17.0"
57
+ },
58
+ "peerDependencies": {
59
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
60
+ },
61
+ "devDependencies": {
62
+ "@vitejs/react-common": "workspace:*",
63
+ "babel-plugin-react-compiler": "19.1.0-rc.2",
64
+ "react": "^19.1.0",
65
+ "react-dom": "^19.1.0",
66
+ "rolldown": "1.0.0-beta.27",
67
+ "tsdown": "^0.12.9",
68
+ "vitest": "^3.2.4"
69
+ }
70
+ }
scripts/node_modules/asynckit/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Alex Indigo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
scripts/node_modules/asynckit/README.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # asynckit [![NPM Module](https://img.shields.io/npm/v/asynckit.svg?style=flat)](https://www.npmjs.com/package/asynckit)
2
+
3
+ Minimal async jobs utility library, with streams support.
4
+
5
+ [![PhantomJS Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=browser&style=flat)](https://travis-ci.org/alexindigo/asynckit)
6
+ [![Linux Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/asynckit)
7
+ [![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit)
8
+
9
+ [![Coverage Status](https://img.shields.io/coveralls/alexindigo/asynckit/v0.4.0.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/asynckit?branch=master)
10
+ [![Dependency Status](https://img.shields.io/david/alexindigo/asynckit/v0.4.0.svg?style=flat)](https://david-dm.org/alexindigo/asynckit)
11
+ [![bitHound Overall Score](https://www.bithound.io/github/alexindigo/asynckit/badges/score.svg)](https://www.bithound.io/github/alexindigo/asynckit)
12
+
13
+ <!-- [![Readme](https://img.shields.io/badge/readme-tested-brightgreen.svg?style=flat)](https://www.npmjs.com/package/reamde) -->
14
+
15
+ AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects.
16
+ Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method.
17
+
18
+ It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators.
19
+
20
+ | compression | size |
21
+ | :----------------- | -------: |
22
+ | asynckit.js | 12.34 kB |
23
+ | asynckit.min.js | 4.11 kB |
24
+ | asynckit.min.js.gz | 1.47 kB |
25
+
26
+
27
+ ## Install
28
+
29
+ ```sh
30
+ $ npm install --save asynckit
31
+ ```
32
+
33
+ ## Examples
34
+
35
+ ### Parallel Jobs
36
+
37
+ Runs iterator over provided array in parallel. Stores output in the `result` array,
38
+ on the matching positions. In unlikely event of an error from one of the jobs,
39
+ will terminate rest of the active jobs (if abort function is provided)
40
+ and return error along with salvaged data to the main callback function.
41
+
42
+ #### Input Array
43
+
44
+ ```javascript
45
+ var parallel = require('asynckit').parallel
46
+ , assert = require('assert')
47
+ ;
48
+
49
+ var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
50
+ , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
51
+ , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
52
+ , target = []
53
+ ;
54
+
55
+ parallel(source, asyncJob, function(err, result)
56
+ {
57
+ assert.deepEqual(result, expectedResult);
58
+ assert.deepEqual(target, expectedTarget);
59
+ });
60
+
61
+ // async job accepts one element from the array
62
+ // and a callback function
63
+ function asyncJob(item, cb)
64
+ {
65
+ // different delays (in ms) per item
66
+ var delay = item * 25;
67
+
68
+ // pretend different jobs take different time to finish
69
+ // and not in consequential order
70
+ var timeoutId = setTimeout(function() {
71
+ target.push(item);
72
+ cb(null, item * 2);
73
+ }, delay);
74
+
75
+ // allow to cancel "leftover" jobs upon error
76
+ // return function, invoking of which will abort this job
77
+ return clearTimeout.bind(null, timeoutId);
78
+ }
79
+ ```
80
+
81
+ More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js).
82
+
83
+ #### Input Object
84
+
85
+ Also it supports named jobs, listed via object.
86
+
87
+ ```javascript
88
+ var parallel = require('asynckit/parallel')
89
+ , assert = require('assert')
90
+ ;
91
+
92
+ var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
93
+ , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
94
+ , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
95
+ , expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ]
96
+ , target = []
97
+ , keys = []
98
+ ;
99
+
100
+ parallel(source, asyncJob, function(err, result)
101
+ {
102
+ assert.deepEqual(result, expectedResult);
103
+ assert.deepEqual(target, expectedTarget);
104
+ assert.deepEqual(keys, expectedKeys);
105
+ });
106
+
107
+ // supports full value, key, callback (shortcut) interface
108
+ function asyncJob(item, key, cb)
109
+ {
110
+ // different delays (in ms) per item
111
+ var delay = item * 25;
112
+
113
+ // pretend different jobs take different time to finish
114
+ // and not in consequential order
115
+ var timeoutId = setTimeout(function() {
116
+ keys.push(key);
117
+ target.push(item);
118
+ cb(null, item * 2);
119
+ }, delay);
120
+
121
+ // allow to cancel "leftover" jobs upon error
122
+ // return function, invoking of which will abort this job
123
+ return clearTimeout.bind(null, timeoutId);
124
+ }
125
+ ```
126
+
127
+ More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js).
128
+
129
+ ### Serial Jobs
130
+
131
+ Runs iterator over provided array sequentially. Stores output in the `result` array,
132
+ on the matching positions. In unlikely event of an error from one of the jobs,
133
+ will not proceed to the rest of the items in the list
134
+ and return error along with salvaged data to the main callback function.
135
+
136
+ #### Input Array
137
+
138
+ ```javascript
139
+ var serial = require('asynckit/serial')
140
+ , assert = require('assert')
141
+ ;
142
+
143
+ var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
144
+ , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
145
+ , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
146
+ , target = []
147
+ ;
148
+
149
+ serial(source, asyncJob, function(err, result)
150
+ {
151
+ assert.deepEqual(result, expectedResult);
152
+ assert.deepEqual(target, expectedTarget);
153
+ });
154
+
155
+ // extended interface (item, key, callback)
156
+ // also supported for arrays
157
+ function asyncJob(item, key, cb)
158
+ {
159
+ target.push(key);
160
+
161
+ // it will be automatically made async
162
+ // even it iterator "returns" in the same event loop
163
+ cb(null, item * 2);
164
+ }
165
+ ```
166
+
167
+ More examples could be found in [test/test-serial-array.js](test/test-serial-array.js).
168
+
169
+ #### Input Object
170
+
171
+ Also it supports named jobs, listed via object.
172
+
173
+ ```javascript
174
+ var serial = require('asynckit').serial
175
+ , assert = require('assert')
176
+ ;
177
+
178
+ var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
179
+ , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
180
+ , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
181
+ , target = []
182
+ ;
183
+
184
+ var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
185
+ , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
186
+ , expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
187
+ , target = []
188
+ ;
189
+
190
+
191
+ serial(source, asyncJob, function(err, result)
192
+ {
193
+ assert.deepEqual(result, expectedResult);
194
+ assert.deepEqual(target, expectedTarget);
195
+ });
196
+
197
+ // shortcut interface (item, callback)
198
+ // works for object as well as for the arrays
199
+ function asyncJob(item, cb)
200
+ {
201
+ target.push(item);
202
+
203
+ // it will be automatically made async
204
+ // even it iterator "returns" in the same event loop
205
+ cb(null, item * 2);
206
+ }
207
+ ```
208
+
209
+ More examples could be found in [test/test-serial-object.js](test/test-serial-object.js).
210
+
211
+ _Note: Since _object_ is an _unordered_ collection of properties,
212
+ it may produce unexpected results with sequential iterations.
213
+ Whenever order of the jobs' execution is important please use `serialOrdered` method._
214
+
215
+ ### Ordered Serial Iterations
216
+
217
+ TBD
218
+
219
+ For example [compare-property](compare-property) package.
220
+
221
+ ### Streaming interface
222
+
223
+ TBD
224
+
225
+ ## Want to Know More?
226
+
227
+ More examples can be found in [test folder](test/).
228
+
229
+ Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions.
230
+
231
+ ## License
232
+
233
+ AsyncKit is licensed under the MIT license.
scripts/node_modules/asynckit/bench.js ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* eslint no-console: "off" */
2
+
3
+ var asynckit = require('./')
4
+ , async = require('async')
5
+ , assert = require('assert')
6
+ , expected = 0
7
+ ;
8
+
9
+ var Benchmark = require('benchmark');
10
+ var suite = new Benchmark.Suite;
11
+
12
+ var source = [];
13
+ for (var z = 1; z < 100; z++)
14
+ {
15
+ source.push(z);
16
+ expected += z;
17
+ }
18
+
19
+ suite
20
+ // add tests
21
+
22
+ .add('async.map', function(deferred)
23
+ {
24
+ var total = 0;
25
+
26
+ async.map(source,
27
+ function(i, cb)
28
+ {
29
+ setImmediate(function()
30
+ {
31
+ total += i;
32
+ cb(null, total);
33
+ });
34
+ },
35
+ function(err, result)
36
+ {
37
+ assert.ifError(err);
38
+ assert.equal(result[result.length - 1], expected);
39
+ deferred.resolve();
40
+ });
41
+ }, {'defer': true})
42
+
43
+
44
+ .add('asynckit.parallel', function(deferred)
45
+ {
46
+ var total = 0;
47
+
48
+ asynckit.parallel(source,
49
+ function(i, cb)
50
+ {
51
+ setImmediate(function()
52
+ {
53
+ total += i;
54
+ cb(null, total);
55
+ });
56
+ },
57
+ function(err, result)
58
+ {
59
+ assert.ifError(err);
60
+ assert.equal(result[result.length - 1], expected);
61
+ deferred.resolve();
62
+ });
63
+ }, {'defer': true})
64
+
65
+
66
+ // add listeners
67
+ .on('cycle', function(ev)
68
+ {
69
+ console.log(String(ev.target));
70
+ })
71
+ .on('complete', function()
72
+ {
73
+ console.log('Fastest is ' + this.filter('fastest').map('name'));
74
+ })
75
+ // run async
76
+ .run({ 'async': true });
scripts/node_modules/asynckit/index.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ module.exports =
2
+ {
3
+ parallel : require('./parallel.js'),
4
+ serial : require('./serial.js'),
5
+ serialOrdered : require('./serialOrdered.js')
6
+ };
scripts/node_modules/asynckit/lib/abort.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // API
2
+ module.exports = abort;
3
+
4
+ /**
5
+ * Aborts leftover active jobs
6
+ *
7
+ * @param {object} state - current state object
8
+ */
9
+ function abort(state)
10
+ {
11
+ Object.keys(state.jobs).forEach(clean.bind(state));
12
+
13
+ // reset leftover jobs
14
+ state.jobs = {};
15
+ }
16
+
17
+ /**
18
+ * Cleans up leftover job by invoking abort function for the provided job id
19
+ *
20
+ * @this state
21
+ * @param {string|number} key - job id to abort
22
+ */
23
+ function clean(key)
24
+ {
25
+ if (typeof this.jobs[key] == 'function')
26
+ {
27
+ this.jobs[key]();
28
+ }
29
+ }
scripts/node_modules/asynckit/lib/async.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var defer = require('./defer.js');
2
+
3
+ // API
4
+ module.exports = async;
5
+
6
+ /**
7
+ * Runs provided callback asynchronously
8
+ * even if callback itself is not
9
+ *
10
+ * @param {function} callback - callback to invoke
11
+ * @returns {function} - augmented callback
12
+ */
13
+ function async(callback)
14
+ {
15
+ var isAsync = false;
16
+
17
+ // check if async happened
18
+ defer(function() { isAsync = true; });
19
+
20
+ return function async_callback(err, result)
21
+ {
22
+ if (isAsync)
23
+ {
24
+ callback(err, result);
25
+ }
26
+ else
27
+ {
28
+ defer(function nextTick_callback()
29
+ {
30
+ callback(err, result);
31
+ });
32
+ }
33
+ };
34
+ }
scripts/node_modules/asynckit/lib/defer.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = defer;
2
+
3
+ /**
4
+ * Runs provided function on next iteration of the event loop
5
+ *
6
+ * @param {function} fn - function to run
7
+ */
8
+ function defer(fn)
9
+ {
10
+ var nextTick = typeof setImmediate == 'function'
11
+ ? setImmediate
12
+ : (
13
+ typeof process == 'object' && typeof process.nextTick == 'function'
14
+ ? process.nextTick
15
+ : null
16
+ );
17
+
18
+ if (nextTick)
19
+ {
20
+ nextTick(fn);
21
+ }
22
+ else
23
+ {
24
+ setTimeout(fn, 0);
25
+ }
26
+ }
scripts/node_modules/asynckit/lib/iterate.js ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var async = require('./async.js')
2
+ , abort = require('./abort.js')
3
+ ;
4
+
5
+ // API
6
+ module.exports = iterate;
7
+
8
+ /**
9
+ * Iterates over each job object
10
+ *
11
+ * @param {array|object} list - array or object (named list) to iterate over
12
+ * @param {function} iterator - iterator to run
13
+ * @param {object} state - current job status
14
+ * @param {function} callback - invoked when all elements processed
15
+ */
16
+ function iterate(list, iterator, state, callback)
17
+ {
18
+ // store current index
19
+ var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
20
+
21
+ state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
22
+ {
23
+ // don't repeat yourself
24
+ // skip secondary callbacks
25
+ if (!(key in state.jobs))
26
+ {
27
+ return;
28
+ }
29
+
30
+ // clean up jobs
31
+ delete state.jobs[key];
32
+
33
+ if (error)
34
+ {
35
+ // don't process rest of the results
36
+ // stop still active jobs
37
+ // and reset the list
38
+ abort(state);
39
+ }
40
+ else
41
+ {
42
+ state.results[key] = output;
43
+ }
44
+
45
+ // return salvaged results
46
+ callback(error, state.results);
47
+ });
48
+ }
49
+
50
+ /**
51
+ * Runs iterator over provided job element
52
+ *
53
+ * @param {function} iterator - iterator to invoke
54
+ * @param {string|number} key - key/index of the element in the list of jobs
55
+ * @param {mixed} item - job description
56
+ * @param {function} callback - invoked after iterator is done with the job
57
+ * @returns {function|mixed} - job abort function or something else
58
+ */
59
+ function runJob(iterator, key, item, callback)
60
+ {
61
+ var aborter;
62
+
63
+ // allow shortcut if iterator expects only two arguments
64
+ if (iterator.length == 2)
65
+ {
66
+ aborter = iterator(item, async(callback));
67
+ }
68
+ // otherwise go with full three arguments
69
+ else
70
+ {
71
+ aborter = iterator(item, key, async(callback));
72
+ }
73
+
74
+ return aborter;
75
+ }
scripts/node_modules/asynckit/lib/readable_asynckit.js ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var streamify = require('./streamify.js')
2
+ , defer = require('./defer.js')
3
+ ;
4
+
5
+ // API
6
+ module.exports = ReadableAsyncKit;
7
+
8
+ /**
9
+ * Base constructor for all streams
10
+ * used to hold properties/methods
11
+ */
12
+ function ReadableAsyncKit()
13
+ {
14
+ ReadableAsyncKit.super_.apply(this, arguments);
15
+
16
+ // list of active jobs
17
+ this.jobs = {};
18
+
19
+ // add stream methods
20
+ this.destroy = destroy;
21
+ this._start = _start;
22
+ this._read = _read;
23
+ }
24
+
25
+ /**
26
+ * Destroys readable stream,
27
+ * by aborting outstanding jobs
28
+ *
29
+ * @returns {void}
30
+ */
31
+ function destroy()
32
+ {
33
+ if (this.destroyed)
34
+ {
35
+ return;
36
+ }
37
+
38
+ this.destroyed = true;
39
+
40
+ if (typeof this.terminator == 'function')
41
+ {
42
+ this.terminator();
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Starts provided jobs in async manner
48
+ *
49
+ * @private
50
+ */
51
+ function _start()
52
+ {
53
+ // first argument – runner function
54
+ var runner = arguments[0]
55
+ // take away first argument
56
+ , args = Array.prototype.slice.call(arguments, 1)
57
+ // second argument - input data
58
+ , input = args[0]
59
+ // last argument - result callback
60
+ , endCb = streamify.callback.call(this, args[args.length - 1])
61
+ ;
62
+
63
+ args[args.length - 1] = endCb;
64
+ // third argument - iterator
65
+ args[1] = streamify.iterator.call(this, args[1]);
66
+
67
+ // allow time for proper setup
68
+ defer(function()
69
+ {
70
+ if (!this.destroyed)
71
+ {
72
+ this.terminator = runner.apply(null, args);
73
+ }
74
+ else
75
+ {
76
+ endCb(null, Array.isArray(input) ? [] : {});
77
+ }
78
+ }.bind(this));
79
+ }
80
+
81
+
82
+ /**
83
+ * Implement _read to comply with Readable streams
84
+ * Doesn't really make sense for flowing object mode
85
+ *
86
+ * @private
87
+ */
88
+ function _read()
89
+ {
90
+
91
+ }
scripts/node_modules/asynckit/lib/readable_parallel.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var parallel = require('../parallel.js');
2
+
3
+ // API
4
+ module.exports = ReadableParallel;
5
+
6
+ /**
7
+ * Streaming wrapper to `asynckit.parallel`
8
+ *
9
+ * @param {array|object} list - array or object (named list) to iterate over
10
+ * @param {function} iterator - iterator to run
11
+ * @param {function} callback - invoked when all elements processed
12
+ * @returns {stream.Readable#}
13
+ */
14
+ function ReadableParallel(list, iterator, callback)
15
+ {
16
+ if (!(this instanceof ReadableParallel))
17
+ {
18
+ return new ReadableParallel(list, iterator, callback);
19
+ }
20
+
21
+ // turn on object mode
22
+ ReadableParallel.super_.call(this, {objectMode: true});
23
+
24
+ this._start(parallel, list, iterator, callback);
25
+ }
scripts/node_modules/asynckit/lib/readable_serial.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var serial = require('../serial.js');
2
+
3
+ // API
4
+ module.exports = ReadableSerial;
5
+
6
+ /**
7
+ * Streaming wrapper to `asynckit.serial`
8
+ *
9
+ * @param {array|object} list - array or object (named list) to iterate over
10
+ * @param {function} iterator - iterator to run
11
+ * @param {function} callback - invoked when all elements processed
12
+ * @returns {stream.Readable#}
13
+ */
14
+ function ReadableSerial(list, iterator, callback)
15
+ {
16
+ if (!(this instanceof ReadableSerial))
17
+ {
18
+ return new ReadableSerial(list, iterator, callback);
19
+ }
20
+
21
+ // turn on object mode
22
+ ReadableSerial.super_.call(this, {objectMode: true});
23
+
24
+ this._start(serial, list, iterator, callback);
25
+ }
scripts/node_modules/asynckit/lib/readable_serial_ordered.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var serialOrdered = require('../serialOrdered.js');
2
+
3
+ // API
4
+ module.exports = ReadableSerialOrdered;
5
+ // expose sort helpers
6
+ module.exports.ascending = serialOrdered.ascending;
7
+ module.exports.descending = serialOrdered.descending;
8
+
9
+ /**
10
+ * Streaming wrapper to `asynckit.serialOrdered`
11
+ *
12
+ * @param {array|object} list - array or object (named list) to iterate over
13
+ * @param {function} iterator - iterator to run
14
+ * @param {function} sortMethod - custom sort function
15
+ * @param {function} callback - invoked when all elements processed
16
+ * @returns {stream.Readable#}
17
+ */
18
+ function ReadableSerialOrdered(list, iterator, sortMethod, callback)
19
+ {
20
+ if (!(this instanceof ReadableSerialOrdered))
21
+ {
22
+ return new ReadableSerialOrdered(list, iterator, sortMethod, callback);
23
+ }
24
+
25
+ // turn on object mode
26
+ ReadableSerialOrdered.super_.call(this, {objectMode: true});
27
+
28
+ this._start(serialOrdered, list, iterator, sortMethod, callback);
29
+ }
scripts/node_modules/asynckit/lib/state.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // API
2
+ module.exports = state;
3
+
4
+ /**
5
+ * Creates initial state object
6
+ * for iteration over list
7
+ *
8
+ * @param {array|object} list - list to iterate over
9
+ * @param {function|null} sortMethod - function to use for keys sort,
10
+ * or `null` to keep them as is
11
+ * @returns {object} - initial state object
12
+ */
13
+ function state(list, sortMethod)
14
+ {
15
+ var isNamedList = !Array.isArray(list)
16
+ , initState =
17
+ {
18
+ index : 0,
19
+ keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
20
+ jobs : {},
21
+ results : isNamedList ? {} : [],
22
+ size : isNamedList ? Object.keys(list).length : list.length
23
+ }
24
+ ;
25
+
26
+ if (sortMethod)
27
+ {
28
+ // sort array keys based on it's values
29
+ // sort object's keys just on own merit
30
+ initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
31
+ {
32
+ return sortMethod(list[a], list[b]);
33
+ });
34
+ }
35
+
36
+ return initState;
37
+ }
scripts/node_modules/asynckit/lib/streamify.js ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var async = require('./async.js');
2
+
3
+ // API
4
+ module.exports = {
5
+ iterator: wrapIterator,
6
+ callback: wrapCallback
7
+ };
8
+
9
+ /**
10
+ * Wraps iterators with long signature
11
+ *
12
+ * @this ReadableAsyncKit#
13
+ * @param {function} iterator - function to wrap
14
+ * @returns {function} - wrapped function
15
+ */
16
+ function wrapIterator(iterator)
17
+ {
18
+ var stream = this;
19
+
20
+ return function(item, key, cb)
21
+ {
22
+ var aborter
23
+ , wrappedCb = async(wrapIteratorCallback.call(stream, cb, key))
24
+ ;
25
+
26
+ stream.jobs[key] = wrappedCb;
27
+
28
+ // it's either shortcut (item, cb)
29
+ if (iterator.length == 2)
30
+ {
31
+ aborter = iterator(item, wrappedCb);
32
+ }
33
+ // or long format (item, key, cb)
34
+ else
35
+ {
36
+ aborter = iterator(item, key, wrappedCb);
37
+ }
38
+
39
+ return aborter;
40
+ };
41
+ }
42
+
43
+ /**
44
+ * Wraps provided callback function
45
+ * allowing to execute snitch function before
46
+ * real callback
47
+ *
48
+ * @this ReadableAsyncKit#
49
+ * @param {function} callback - function to wrap
50
+ * @returns {function} - wrapped function
51
+ */
52
+ function wrapCallback(callback)
53
+ {
54
+ var stream = this;
55
+
56
+ var wrapped = function(error, result)
57
+ {
58
+ return finisher.call(stream, error, result, callback);
59
+ };
60
+
61
+ return wrapped;
62
+ }
63
+
64
+ /**
65
+ * Wraps provided iterator callback function
66
+ * makes sure snitch only called once,
67
+ * but passes secondary calls to the original callback
68
+ *
69
+ * @this ReadableAsyncKit#
70
+ * @param {function} callback - callback to wrap
71
+ * @param {number|string} key - iteration key
72
+ * @returns {function} wrapped callback
73
+ */
74
+ function wrapIteratorCallback(callback, key)
75
+ {
76
+ var stream = this;
77
+
78
+ return function(error, output)
79
+ {
80
+ // don't repeat yourself
81
+ if (!(key in stream.jobs))
82
+ {
83
+ callback(error, output);
84
+ return;
85
+ }
86
+
87
+ // clean up jobs
88
+ delete stream.jobs[key];
89
+
90
+ return streamer.call(stream, error, {key: key, value: output}, callback);
91
+ };
92
+ }
93
+
94
+ /**
95
+ * Stream wrapper for iterator callback
96
+ *
97
+ * @this ReadableAsyncKit#
98
+ * @param {mixed} error - error response
99
+ * @param {mixed} output - iterator output
100
+ * @param {function} callback - callback that expects iterator results
101
+ */
102
+ function streamer(error, output, callback)
103
+ {
104
+ if (error && !this.error)
105
+ {
106
+ this.error = error;
107
+ this.pause();
108
+ this.emit('error', error);
109
+ // send back value only, as expected
110
+ callback(error, output && output.value);
111
+ return;
112
+ }
113
+
114
+ // stream stuff
115
+ this.push(output);
116
+
117
+ // back to original track
118
+ // send back value only, as expected
119
+ callback(error, output && output.value);
120
+ }
121
+
122
+ /**
123
+ * Stream wrapper for finishing callback
124
+ *
125
+ * @this ReadableAsyncKit#
126
+ * @param {mixed} error - error response
127
+ * @param {mixed} output - iterator output
128
+ * @param {function} callback - callback that expects final results
129
+ */
130
+ function finisher(error, output, callback)
131
+ {
132
+ // signal end of the stream
133
+ // only for successfully finished streams
134
+ if (!error)
135
+ {
136
+ this.push(null);
137
+ }
138
+
139
+ // back to original track
140
+ callback(error, output);
141
+ }
scripts/node_modules/asynckit/lib/terminator.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var abort = require('./abort.js')
2
+ , async = require('./async.js')
3
+ ;
4
+
5
+ // API
6
+ module.exports = terminator;
7
+
8
+ /**
9
+ * Terminates jobs in the attached state context
10
+ *
11
+ * @this AsyncKitState#
12
+ * @param {function} callback - final callback to invoke after termination
13
+ */
14
+ function terminator(callback)
15
+ {
16
+ if (!Object.keys(this.jobs).length)
17
+ {
18
+ return;
19
+ }
20
+
21
+ // fast forward iteration index
22
+ this.index = this.size;
23
+
24
+ // abort jobs
25
+ abort(this);
26
+
27
+ // send back results we have so far
28
+ async(callback)(null, this.results);
29
+ }
scripts/node_modules/asynckit/package.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "asynckit",
3
+ "version": "0.4.0",
4
+ "description": "Minimal async jobs utility library, with streams support",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "clean": "rimraf coverage",
8
+ "lint": "eslint *.js lib/*.js test/*.js",
9
+ "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec",
10
+ "win-test": "tape test/test-*.js",
11
+ "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec",
12
+ "report": "istanbul report",
13
+ "size": "browserify index.js | size-table asynckit",
14
+ "debug": "tape test/test-*.js"
15
+ },
16
+ "pre-commit": [
17
+ "clean",
18
+ "lint",
19
+ "test",
20
+ "browser",
21
+ "report",
22
+ "size"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/alexindigo/asynckit.git"
27
+ },
28
+ "keywords": [
29
+ "async",
30
+ "jobs",
31
+ "parallel",
32
+ "serial",
33
+ "iterator",
34
+ "array",
35
+ "object",
36
+ "stream",
37
+ "destroy",
38
+ "terminate",
39
+ "abort"
40
+ ],
41
+ "author": "Alex Indigo <iam@alexindigo.com>",
42
+ "license": "MIT",
43
+ "bugs": {
44
+ "url": "https://github.com/alexindigo/asynckit/issues"
45
+ },
46
+ "homepage": "https://github.com/alexindigo/asynckit#readme",
47
+ "devDependencies": {
48
+ "browserify": "^13.0.0",
49
+ "browserify-istanbul": "^2.0.0",
50
+ "coveralls": "^2.11.9",
51
+ "eslint": "^2.9.0",
52
+ "istanbul": "^0.4.3",
53
+ "obake": "^0.1.2",
54
+ "phantomjs-prebuilt": "^2.1.7",
55
+ "pre-commit": "^1.1.3",
56
+ "reamde": "^1.1.0",
57
+ "rimraf": "^2.5.2",
58
+ "size-table": "^0.2.0",
59
+ "tap-spec": "^4.1.1",
60
+ "tape": "^4.5.1"
61
+ },
62
+ "dependencies": {}
63
+ }
scripts/node_modules/asynckit/parallel.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var iterate = require('./lib/iterate.js')
2
+ , initState = require('./lib/state.js')
3
+ , terminator = require('./lib/terminator.js')
4
+ ;
5
+
6
+ // Public API
7
+ module.exports = parallel;
8
+
9
+ /**
10
+ * Runs iterator over provided array elements in parallel
11
+ *
12
+ * @param {array|object} list - array or object (named list) to iterate over
13
+ * @param {function} iterator - iterator to run
14
+ * @param {function} callback - invoked when all elements processed
15
+ * @returns {function} - jobs terminator
16
+ */
17
+ function parallel(list, iterator, callback)
18
+ {
19
+ var state = initState(list);
20
+
21
+ while (state.index < (state['keyedList'] || list).length)
22
+ {
23
+ iterate(list, iterator, state, function(error, result)
24
+ {
25
+ if (error)
26
+ {
27
+ callback(error, result);
28
+ return;
29
+ }
30
+
31
+ // looks like it's the last one
32
+ if (Object.keys(state.jobs).length === 0)
33
+ {
34
+ callback(null, state.results);
35
+ return;
36
+ }
37
+ });
38
+
39
+ state.index++;
40
+ }
41
+
42
+ return terminator.bind(state, callback);
43
+ }
scripts/node_modules/asynckit/serial.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var serialOrdered = require('./serialOrdered.js');
2
+
3
+ // Public API
4
+ module.exports = serial;
5
+
6
+ /**
7
+ * Runs iterator over provided array elements in series
8
+ *
9
+ * @param {array|object} list - array or object (named list) to iterate over
10
+ * @param {function} iterator - iterator to run
11
+ * @param {function} callback - invoked when all elements processed
12
+ * @returns {function} - jobs terminator
13
+ */
14
+ function serial(list, iterator, callback)
15
+ {
16
+ return serialOrdered(list, iterator, null, callback);
17
+ }
scripts/node_modules/asynckit/serialOrdered.js ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var iterate = require('./lib/iterate.js')
2
+ , initState = require('./lib/state.js')
3
+ , terminator = require('./lib/terminator.js')
4
+ ;
5
+
6
+ // Public API
7
+ module.exports = serialOrdered;
8
+ // sorting helpers
9
+ module.exports.ascending = ascending;
10
+ module.exports.descending = descending;
11
+
12
+ /**
13
+ * Runs iterator over provided sorted array elements in series
14
+ *
15
+ * @param {array|object} list - array or object (named list) to iterate over
16
+ * @param {function} iterator - iterator to run
17
+ * @param {function} sortMethod - custom sort function
18
+ * @param {function} callback - invoked when all elements processed
19
+ * @returns {function} - jobs terminator
20
+ */
21
+ function serialOrdered(list, iterator, sortMethod, callback)
22
+ {
23
+ var state = initState(list, sortMethod);
24
+
25
+ iterate(list, iterator, state, function iteratorHandler(error, result)
26
+ {
27
+ if (error)
28
+ {
29
+ callback(error, result);
30
+ return;
31
+ }
32
+
33
+ state.index++;
34
+
35
+ // are we there yet?
36
+ if (state.index < (state['keyedList'] || list).length)
37
+ {
38
+ iterate(list, iterator, state, iteratorHandler);
39
+ return;
40
+ }
41
+
42
+ // done here
43
+ callback(null, state.results);
44
+ });
45
+
46
+ return terminator.bind(state, callback);
47
+ }
48
+
49
+ /*
50
+ * -- Sort methods
51
+ */
52
+
53
+ /**
54
+ * sort helper to sort array elements in ascending order
55
+ *
56
+ * @param {mixed} a - an item to compare
57
+ * @param {mixed} b - an item to compare
58
+ * @returns {number} - comparison result
59
+ */
60
+ function ascending(a, b)
61
+ {
62
+ return a < b ? -1 : a > b ? 1 : 0;
63
+ }
64
+
65
+ /**
66
+ * sort helper to sort array elements in descending order
67
+ *
68
+ * @param {mixed} a - an item to compare
69
+ * @param {mixed} b - an item to compare
70
+ * @returns {number} - comparison result
71
+ */
72
+ function descending(a, b)
73
+ {
74
+ return -1 * ascending(a, b);
75
+ }
scripts/node_modules/asynckit/stream.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var inherits = require('util').inherits
2
+ , Readable = require('stream').Readable
3
+ , ReadableAsyncKit = require('./lib/readable_asynckit.js')
4
+ , ReadableParallel = require('./lib/readable_parallel.js')
5
+ , ReadableSerial = require('./lib/readable_serial.js')
6
+ , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js')
7
+ ;
8
+
9
+ // API
10
+ module.exports =
11
+ {
12
+ parallel : ReadableParallel,
13
+ serial : ReadableSerial,
14
+ serialOrdered : ReadableSerialOrdered,
15
+ };
16
+
17
+ inherits(ReadableAsyncKit, Readable);
18
+
19
+ inherits(ReadableParallel, ReadableAsyncKit);
20
+ inherits(ReadableSerial, ReadableAsyncKit);
21
+ inherits(ReadableSerialOrdered, ReadableAsyncKit);
scripts/node_modules/axios/CHANGELOG.md ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/LICENSE ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2014-present Matt Zabriskie & Collaborators
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
scripts/node_modules/axios/MIGRATION_GUIDE.md ADDED
@@ -0,0 +1,877 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Axios Migration Guide
2
+
3
+ > **Migrating from Axios 0.x to 1.x**
4
+ >
5
+ > This guide helps developers upgrade from Axios 0.x to 1.x by documenting breaking changes, providing migration strategies, and offering solutions to common upgrade challenges.
6
+
7
+ ## Table of Contents
8
+
9
+ - [Overview](#overview)
10
+ - [Breaking Changes](#breaking-changes)
11
+ - [Error Handling Migration](#error-handling-migration)
12
+ - [API Changes](#api-changes)
13
+ - [Configuration Changes](#configuration-changes)
14
+ - [Migration Strategies](#migration-strategies)
15
+ - [Common Patterns](#common-patterns)
16
+ - [Troubleshooting](#troubleshooting)
17
+ - [Resources](#resources)
18
+
19
+ ## Overview
20
+
21
+ Axios 1.x introduced several breaking changes to improve consistency, security, and developer experience. While these changes provide better error handling and more predictable behavior, they require code updates when migrating from 0.x versions.
22
+
23
+ ### Key Changes Summary
24
+
25
+ | Area | 0.x Behavior | 1.x Behavior | Impact |
26
+ |------|--------------|--------------|--------|
27
+ | Error Handling | Selective throwing | Consistent throwing | High |
28
+ | JSON Parsing | Lenient | Strict | Medium |
29
+ | Browser Support | IE11+ | Modern browsers | Low-Medium |
30
+ | TypeScript | Partial | Full support | Low |
31
+
32
+ ### Migration Complexity
33
+
34
+ - **Simple applications**: 1-2 hours
35
+ - **Medium applications**: 1-2 days
36
+ - **Large applications with complex error handling**: 3-5 days
37
+
38
+ ## Breaking Changes
39
+
40
+ ### 1. Error Handling Changes
41
+
42
+ **The most significant change in Axios 1.x is how errors are handled.**
43
+
44
+ #### 0.x Behavior
45
+ ```javascript
46
+ // Axios 0.x - Some HTTP error codes didn't throw
47
+ axios.get('/api/data')
48
+ .then(response => {
49
+ // Response interceptor could handle all errors
50
+ console.log('Success:', response.data);
51
+ });
52
+
53
+ // Response interceptor handled everything
54
+ axios.interceptors.response.use(
55
+ response => response,
56
+ error => {
57
+ handleError(error);
58
+ // Error was "handled" and didn't propagate
59
+ }
60
+ );
61
+ ```
62
+
63
+ #### 1.x Behavior
64
+ ```javascript
65
+ // Axios 1.x - All HTTP errors throw consistently
66
+ axios.get('/api/data')
67
+ .then(response => {
68
+ console.log('Success:', response.data);
69
+ })
70
+ .catch(error => {
71
+ // Must handle errors at call site or they propagate
72
+ console.error('Request failed:', error);
73
+ });
74
+
75
+ // Response interceptor must re-throw or return rejected promise
76
+ axios.interceptors.response.use(
77
+ response => response,
78
+ error => {
79
+ handleError(error);
80
+ // Must explicitly handle propagation
81
+ return Promise.reject(error); // or throw error;
82
+ }
83
+ );
84
+ ```
85
+
86
+ #### Impact
87
+ - **Response interceptors** can no longer "swallow" errors silently
88
+ - **Every API call** must handle errors explicitly or they become unhandled promise rejections
89
+ - **Centralized error handling** requires new patterns
90
+
91
+ ### 2. JSON Parsing Changes
92
+
93
+ #### 0.x Behavior
94
+ ```javascript
95
+ // Axios 0.x - Lenient JSON parsing
96
+ // Would attempt to parse even invalid JSON
97
+ response.data; // Might contain partial data or fallbacks
98
+ ```
99
+
100
+ #### 1.x Behavior
101
+ ```javascript
102
+ // Axios 1.x - Strict JSON parsing
103
+ // Throws clear errors for invalid JSON
104
+ try {
105
+ const data = response.data;
106
+ } catch (error) {
107
+ // Handle JSON parsing errors explicitly
108
+ }
109
+ ```
110
+
111
+ ### 3. Request/Response Transform Changes
112
+
113
+ #### 0.x Behavior
114
+ ```javascript
115
+ // Implicit transformations with some edge cases
116
+ transformRequest: [function (data) {
117
+ // Less predictable behavior
118
+ return data;
119
+ }]
120
+ ```
121
+
122
+ #### 1.x Behavior
123
+ ```javascript
124
+ // More consistent transformation pipeline
125
+ transformRequest: [function (data, headers) {
126
+ // Headers parameter always available
127
+ // More predictable behavior
128
+ return data;
129
+ }]
130
+ ```
131
+
132
+ ### 4. Browser Support Changes
133
+
134
+ - **0.x**: Supported IE11 and older browsers
135
+ - **1.x**: Requires modern browsers with Promise support
136
+ - **Polyfills**: May be needed for older browser support
137
+
138
+ ## Error Handling Migration
139
+
140
+ The error handling changes are the most complex part of migrating to Axios 1.x. Here are proven strategies:
141
+
142
+ ### Strategy 1: Centralized Error Handling with Error Boundary
143
+
144
+ ```javascript
145
+ // Create a centralized error handler
146
+ class ApiErrorHandler {
147
+ constructor() {
148
+ this.setupInterceptors();
149
+ }
150
+
151
+ setupInterceptors() {
152
+ axios.interceptors.response.use(
153
+ response => response,
154
+ error => {
155
+ // Centralized error processing
156
+ this.processError(error);
157
+
158
+ // Return a resolved promise with error info for handled errors
159
+ if (this.isHandledError(error)) {
160
+ return Promise.resolve({
161
+ data: null,
162
+ error: this.normalizeError(error),
163
+ handled: true
164
+ });
165
+ }
166
+
167
+ // Re-throw unhandled errors
168
+ return Promise.reject(error);
169
+ }
170
+ );
171
+ }
172
+
173
+ processError(error) {
174
+ // Log errors
175
+ console.error('API Error:', error);
176
+
177
+ // Show user notifications
178
+ if (error.response?.status === 401) {
179
+ this.handleAuthError();
180
+ } else if (error.response?.status >= 500) {
181
+ this.showErrorNotification('Server error occurred');
182
+ }
183
+ }
184
+
185
+ isHandledError(error) {
186
+ // Define which errors are "handled" centrally
187
+ const handledStatuses = [401, 403, 404, 422, 500, 502, 503];
188
+ return handledStatuses.includes(error.response?.status);
189
+ }
190
+
191
+ normalizeError(error) {
192
+ return {
193
+ status: error.response?.status,
194
+ message: error.response?.data?.message || error.message,
195
+ code: error.response?.data?.code || error.code
196
+ };
197
+ }
198
+
199
+ handleAuthError() {
200
+ // Redirect to login, clear tokens, etc.
201
+ localStorage.removeItem('token');
202
+ window.location.href = '/login';
203
+ }
204
+
205
+ showErrorNotification(message) {
206
+ // Show user-friendly error message
207
+ console.error(message); // Replace with your notification system
208
+ }
209
+ }
210
+
211
+ // Initialize globally
212
+ const errorHandler = new ApiErrorHandler();
213
+
214
+ // Usage in components/services
215
+ async function fetchUserData(userId) {
216
+ try {
217
+ const response = await axios.get(`/api/users/${userId}`);
218
+
219
+ // Check if error was handled centrally
220
+ if (response.handled) {
221
+ return { data: null, error: response.error };
222
+ }
223
+
224
+ return { data: response.data, error: null };
225
+ } catch (error) {
226
+ // Unhandled errors still need local handling
227
+ return { data: null, error: { message: 'Unexpected error occurred' } };
228
+ }
229
+ }
230
+ ```
231
+
232
+ ### Strategy 2: Wrapper Function Pattern
233
+
234
+ ```javascript
235
+ // Create a wrapper that provides 0.x-like behavior
236
+ function createApiWrapper() {
237
+ const api = axios.create();
238
+
239
+ // Add response interceptor for centralized handling
240
+ api.interceptors.response.use(
241
+ response => response,
242
+ error => {
243
+ // Handle common errors centrally
244
+ if (error.response?.status === 401) {
245
+ // Handle auth errors
246
+ handleAuthError();
247
+ }
248
+
249
+ if (error.response?.status >= 500) {
250
+ // Handle server errors
251
+ showServerErrorNotification();
252
+ }
253
+
254
+ // Always reject to maintain error propagation
255
+ return Promise.reject(error);
256
+ }
257
+ );
258
+
259
+ // Wrapper function that mimics 0.x behavior
260
+ function safeRequest(requestConfig, options = {}) {
261
+ return api(requestConfig)
262
+ .then(response => response)
263
+ .catch(error => {
264
+ if (options.suppressErrors) {
265
+ // Return error info instead of throwing
266
+ return {
267
+ data: null,
268
+ error: {
269
+ status: error.response?.status,
270
+ message: error.response?.data?.message || error.message
271
+ }
272
+ };
273
+ }
274
+ throw error;
275
+ });
276
+ }
277
+
278
+ return { safeRequest, axios: api };
279
+ }
280
+
281
+ // Usage
282
+ const { safeRequest } = createApiWrapper();
283
+
284
+ // For calls where you want centralized error handling
285
+ const result = await safeRequest(
286
+ { method: 'get', url: '/api/data' },
287
+ { suppressErrors: true }
288
+ );
289
+
290
+ if (result.error) {
291
+ // Handle error case
292
+ console.log('Request failed:', result.error.message);
293
+ } else {
294
+ // Handle success case
295
+ console.log('Data:', result.data);
296
+ }
297
+ ```
298
+
299
+ ### Strategy 3: Global Error Handler with Custom Events
300
+
301
+ ```javascript
302
+ // Set up global error handling with events
303
+ class GlobalErrorHandler extends EventTarget {
304
+ constructor() {
305
+ super();
306
+ this.setupInterceptors();
307
+ }
308
+
309
+ setupInterceptors() {
310
+ axios.interceptors.response.use(
311
+ response => response,
312
+ error => {
313
+ // Emit custom event for global handling
314
+ this.dispatchEvent(new CustomEvent('apiError', {
315
+ detail: { error, timestamp: new Date() }
316
+ }));
317
+
318
+ // Always reject to maintain proper error flow
319
+ return Promise.reject(error);
320
+ }
321
+ );
322
+ }
323
+ }
324
+
325
+ const globalErrorHandler = new GlobalErrorHandler();
326
+
327
+ // Set up global listeners
328
+ globalErrorHandler.addEventListener('apiError', (event) => {
329
+ const { error } = event.detail;
330
+
331
+ // Centralized error logic
332
+ if (error.response?.status === 401) {
333
+ handleAuthError();
334
+ }
335
+
336
+ if (error.response?.status >= 500) {
337
+ showErrorNotification('Server error occurred');
338
+ }
339
+ });
340
+
341
+ // Usage remains clean
342
+ async function apiCall() {
343
+ try {
344
+ const response = await axios.get('/api/data');
345
+ return response.data;
346
+ } catch (error) {
347
+ // Error was already handled globally
348
+ // Just handle component-specific logic
349
+ return null;
350
+ }
351
+ }
352
+ ```
353
+
354
+ ## API Changes
355
+
356
+ ### Request Configuration
357
+
358
+ #### 0.x to 1.x Changes
359
+ ```javascript
360
+ // 0.x - Some properties had different defaults
361
+ const config = {
362
+ timeout: 0, // No timeout by default
363
+ maxContentLength: -1, // No limit
364
+ };
365
+
366
+ // 1.x - More secure defaults
367
+ const config = {
368
+ timeout: 0, // Still no timeout, but easier to configure
369
+ maxContentLength: 2000, // Default limit for security
370
+ maxBodyLength: 2000, // New property
371
+ };
372
+ ```
373
+
374
+ ### Response Object
375
+
376
+ The response object structure remains largely the same, but error responses are more consistent:
377
+
378
+ ```javascript
379
+ // Both 0.x and 1.x
380
+ response = {
381
+ data: {}, // Response body
382
+ status: 200, // HTTP status
383
+ statusText: 'OK', // HTTP status message
384
+ headers: {}, // Response headers
385
+ config: {}, // Request config
386
+ request: {} // Request object
387
+ };
388
+
389
+ // Error responses are more consistent in 1.x
390
+ error.response = {
391
+ data: {}, // Error response body
392
+ status: 404, // HTTP error status
393
+ statusText: 'Not Found',
394
+ headers: {},
395
+ config: {},
396
+ request: {}
397
+ };
398
+ ```
399
+
400
+ ## Configuration Changes
401
+
402
+ ### Default Configuration Updates
403
+
404
+ ```javascript
405
+ // 0.x defaults
406
+ axios.defaults.timeout = 0; // No timeout
407
+ axios.defaults.maxContentLength = -1; // No limit
408
+
409
+ // 1.x defaults (more secure)
410
+ axios.defaults.timeout = 0; // Still no timeout
411
+ axios.defaults.maxContentLength = 2000; // 2MB limit
412
+ axios.defaults.maxBodyLength = 2000; // 2MB limit
413
+ ```
414
+
415
+ ### Instance Configuration
416
+
417
+ ```javascript
418
+ // 0.x - Instance creation
419
+ const api = axios.create({
420
+ baseURL: 'https://api.example.com',
421
+ timeout: 1000,
422
+ });
423
+
424
+ // 1.x - Same API, but more options available
425
+ const api = axios.create({
426
+ baseURL: 'https://api.example.com',
427
+ timeout: 1000,
428
+ maxBodyLength: Infinity, // Override default if needed
429
+ maxContentLength: Infinity,
430
+ });
431
+ ```
432
+
433
+ ## Migration Strategies
434
+
435
+ ### Step-by-Step Migration Process
436
+
437
+ #### Phase 1: Preparation
438
+ 1. **Audit Current Error Handling**
439
+ ```bash
440
+ # Find all axios usage
441
+ grep -r "axios\." src/
442
+ grep -r "\.catch" src/
443
+ grep -r "interceptors" src/
444
+ ```
445
+
446
+ 2. **Identify Patterns**
447
+ - Response interceptors that handle errors
448
+ - Components that rely on centralized error handling
449
+ - Authentication and retry logic
450
+
451
+ 3. **Create Test Cases**
452
+ ```javascript
453
+ // Test current error handling behavior
454
+ describe('Error Handling Migration', () => {
455
+ it('should handle 401 errors consistently', async () => {
456
+ // Test authentication error flows
457
+ });
458
+
459
+ it('should handle 500 errors with user feedback', async () => {
460
+ // Test server error handling
461
+ });
462
+ });
463
+ ```
464
+
465
+ #### Phase 2: Implementation
466
+ 1. **Update Dependencies**
467
+ ```bash
468
+ npm update axios
469
+ ```
470
+
471
+ 2. **Implement New Error Handling**
472
+ - Choose one of the strategies above
473
+ - Update response interceptors
474
+ - Add error handling to API calls
475
+
476
+ 3. **Update Authentication Logic**
477
+ ```javascript
478
+ // 0.x pattern
479
+ axios.interceptors.response.use(null, error => {
480
+ if (error.response?.status === 401) {
481
+ logout();
482
+ // Error was "handled"
483
+ }
484
+ });
485
+
486
+ // 1.x pattern
487
+ axios.interceptors.response.use(
488
+ response => response,
489
+ error => {
490
+ if (error.response?.status === 401) {
491
+ logout();
492
+ }
493
+ return Promise.reject(error); // Always propagate
494
+ }
495
+ );
496
+ ```
497
+
498
+ #### Phase 3: Testing and Validation
499
+ 1. **Test Error Scenarios**
500
+ - Network failures
501
+ - HTTP error codes (401, 403, 404, 500, etc.)
502
+ - Timeout errors
503
+ - JSON parsing errors
504
+
505
+ 2. **Validate User Experience**
506
+ - Error messages are shown appropriately
507
+ - Authentication redirects work
508
+ - Loading states are handled correctly
509
+
510
+ ### Gradual Migration Approach
511
+
512
+ For large applications, consider gradual migration:
513
+
514
+ ```javascript
515
+ // Create a compatibility layer
516
+ const axiosCompat = {
517
+ // Use new axios instance for new code
518
+ v1: axios.create({
519
+ // 1.x configuration
520
+ }),
521
+
522
+ // Wrapper for legacy code
523
+ legacy: createLegacyWrapper(axios.create({
524
+ // Configuration that mimics 0.x behavior
525
+ }))
526
+ };
527
+
528
+ function createLegacyWrapper(axiosInstance) {
529
+ // Add interceptors that provide 0.x-like behavior
530
+ axiosInstance.interceptors.response.use(
531
+ response => response,
532
+ error => {
533
+ // Handle errors in 0.x style for legacy code
534
+ handleLegacyError(error);
535
+ // Don't propagate certain errors
536
+ if (shouldSuppressError(error)) {
537
+ return Promise.resolve({ data: null, error: true });
538
+ }
539
+ return Promise.reject(error);
540
+ }
541
+ );
542
+
543
+ return axiosInstance;
544
+ }
545
+ ```
546
+
547
+ ## Common Patterns
548
+
549
+ ### Authentication Interceptors
550
+
551
+ #### Updated Authentication Pattern
552
+ ```javascript
553
+ // Token refresh interceptor for 1.x
554
+ let isRefreshing = false;
555
+ let refreshSubscribers = [];
556
+
557
+ function subscribeTokenRefresh(cb) {
558
+ refreshSubscribers.push(cb);
559
+ }
560
+
561
+ function onTokenRefreshed(token) {
562
+ refreshSubscribers.forEach(cb => cb(token));
563
+ refreshSubscribers = [];
564
+ }
565
+
566
+ axios.interceptors.response.use(
567
+ response => response,
568
+ async error => {
569
+ const originalRequest = error.config;
570
+
571
+ if (error.response?.status === 401 && !originalRequest._retry) {
572
+ if (isRefreshing) {
573
+ // Wait for token refresh
574
+ return new Promise(resolve => {
575
+ subscribeTokenRefresh(token => {
576
+ originalRequest.headers.Authorization = `Bearer ${token}`;
577
+ resolve(axios(originalRequest));
578
+ });
579
+ });
580
+ }
581
+
582
+ originalRequest._retry = true;
583
+ isRefreshing = true;
584
+
585
+ try {
586
+ const newToken = await refreshToken();
587
+ onTokenRefreshed(newToken);
588
+ isRefreshing = false;
589
+
590
+ originalRequest.headers.Authorization = `Bearer ${newToken}`;
591
+ return axios(originalRequest);
592
+ } catch (refreshError) {
593
+ isRefreshing = false;
594
+ logout();
595
+ return Promise.reject(refreshError);
596
+ }
597
+ }
598
+
599
+ return Promise.reject(error);
600
+ }
601
+ );
602
+ ```
603
+
604
+ ### Retry Logic
605
+
606
+ ```javascript
607
+ // Retry interceptor for 1.x
608
+ function createRetryInterceptor(maxRetries = 3, retryDelay = 1000) {
609
+ return axios.interceptors.response.use(
610
+ response => response,
611
+ async error => {
612
+ const config = error.config;
613
+
614
+ if (!config || !config.retry) {
615
+ return Promise.reject(error);
616
+ }
617
+
618
+ config.__retryCount = config.__retryCount || 0;
619
+
620
+ if (config.__retryCount >= maxRetries) {
621
+ return Promise.reject(error);
622
+ }
623
+
624
+ config.__retryCount += 1;
625
+
626
+ // Exponential backoff
627
+ const delay = retryDelay * Math.pow(2, config.__retryCount - 1);
628
+ await new Promise(resolve => setTimeout(resolve, delay));
629
+
630
+ return axios(config);
631
+ }
632
+ );
633
+ }
634
+
635
+ // Usage
636
+ const api = axios.create();
637
+ createRetryInterceptor(3, 1000);
638
+
639
+ // Make request with retry
640
+ api.get('/api/data', { retry: true });
641
+ ```
642
+
643
+ ### Loading State Management
644
+
645
+ ```javascript
646
+ // Loading interceptor for 1.x
647
+ class LoadingManager {
648
+ constructor() {
649
+ this.requests = new Set();
650
+ this.setupInterceptors();
651
+ }
652
+
653
+ setupInterceptors() {
654
+ axios.interceptors.request.use(config => {
655
+ this.requests.add(config);
656
+ this.updateLoadingState();
657
+ return config;
658
+ });
659
+
660
+ axios.interceptors.response.use(
661
+ response => {
662
+ this.requests.delete(response.config);
663
+ this.updateLoadingState();
664
+ return response;
665
+ },
666
+ error => {
667
+ this.requests.delete(error.config);
668
+ this.updateLoadingState();
669
+ return Promise.reject(error);
670
+ }
671
+ );
672
+ }
673
+
674
+ updateLoadingState() {
675
+ const isLoading = this.requests.size > 0;
676
+ // Update your loading UI
677
+ document.body.classList.toggle('loading', isLoading);
678
+ }
679
+ }
680
+
681
+ const loadingManager = new LoadingManager();
682
+ ```
683
+
684
+ ## Troubleshooting
685
+
686
+ ### Common Migration Issues
687
+
688
+ #### Issue 1: Unhandled Promise Rejections
689
+
690
+ **Problem:**
691
+ ```javascript
692
+ // This pattern worked in 0.x but causes unhandled rejections in 1.x
693
+ axios.get('/api/data'); // No .catch() handler
694
+ ```
695
+
696
+ **Solution:**
697
+ ```javascript
698
+ // Always handle promises
699
+ axios.get('/api/data')
700
+ .catch(error => {
701
+ // Handle error appropriately
702
+ console.error('Request failed:', error.message);
703
+ });
704
+
705
+ // Or use async/await with try/catch
706
+ async function fetchData() {
707
+ try {
708
+ const response = await axios.get('/api/data');
709
+ return response.data;
710
+ } catch (error) {
711
+ console.error('Request failed:', error.message);
712
+ return null;
713
+ }
714
+ }
715
+ ```
716
+
717
+ #### Issue 2: Response Interceptors Not "Handling" Errors
718
+
719
+ **Problem:**
720
+ ```javascript
721
+ // 0.x style - interceptor "handled" errors
722
+ axios.interceptors.response.use(null, error => {
723
+ showErrorMessage(error.message);
724
+ // Error was considered "handled"
725
+ });
726
+ ```
727
+
728
+ **Solution:**
729
+ ```javascript
730
+ // 1.x style - explicitly control error propagation
731
+ axios.interceptors.response.use(
732
+ response => response,
733
+ error => {
734
+ showErrorMessage(error.message);
735
+
736
+ // Choose whether to propagate the error
737
+ if (shouldPropagateError(error)) {
738
+ return Promise.reject(error);
739
+ }
740
+
741
+ // Return success-like response for "handled" errors
742
+ return Promise.resolve({
743
+ data: null,
744
+ handled: true,
745
+ error: normalizeError(error)
746
+ });
747
+ }
748
+ );
749
+ ```
750
+
751
+ #### Issue 3: JSON Parsing Errors
752
+
753
+ **Problem:**
754
+ ```javascript
755
+ // 1.x is stricter about JSON parsing
756
+ // This might throw where 0.x was lenient
757
+ const data = response.data;
758
+ ```
759
+
760
+ **Solution:**
761
+ ```javascript
762
+ // Add response transformer for better error handling
763
+ axios.defaults.transformResponse = [
764
+ function (data) {
765
+ if (typeof data === 'string') {
766
+ try {
767
+ return JSON.parse(data);
768
+ } catch (e) {
769
+ // Handle JSON parsing errors gracefully
770
+ console.warn('Invalid JSON response:', data);
771
+ return { error: 'Invalid JSON', rawData: data };
772
+ }
773
+ }
774
+ return data;
775
+ }
776
+ ];
777
+ ```
778
+
779
+ #### Issue 4: TypeScript Errors After Upgrade
780
+
781
+ **Problem:**
782
+ ```typescript
783
+ // TypeScript errors after upgrade
784
+ const response = await axios.get('/api/data');
785
+ // Property 'someProperty' does not exist on type 'any'
786
+ ```
787
+
788
+ **Solution:**
789
+ ```typescript
790
+ // Define proper interfaces
791
+ interface ApiResponse {
792
+ data: any;
793
+ message: string;
794
+ success: boolean;
795
+ }
796
+
797
+ const response = await axios.get<ApiResponse>('/api/data');
798
+ // Now properly typed
799
+ console.log(response.data.data);
800
+ ```
801
+
802
+ ### Debug Migration Issues
803
+
804
+ #### Enable Debug Logging
805
+ ```javascript
806
+ // Add request/response logging
807
+ axios.interceptors.request.use(config => {
808
+ console.log('Request:', config);
809
+ return config;
810
+ });
811
+
812
+ axios.interceptors.response.use(
813
+ response => {
814
+ console.log('Response:', response);
815
+ return response;
816
+ },
817
+ error => {
818
+ console.log('Error:', error);
819
+ return Promise.reject(error);
820
+ }
821
+ );
822
+ ```
823
+
824
+ #### Compare Behavior
825
+ ```javascript
826
+ // Create side-by-side comparison during migration
827
+ const axios0x = require('axios-0x'); // Keep old version for testing
828
+ const axios1x = require('axios');
829
+
830
+ async function compareRequests(config) {
831
+ try {
832
+ const [result0x, result1x] = await Promise.allSettled([
833
+ axios0x(config),
834
+ axios1x(config)
835
+ ]);
836
+
837
+ console.log('0.x result:', result0x);
838
+ console.log('1.x result:', result1x);
839
+ } catch (error) {
840
+ console.log('Comparison error:', error);
841
+ }
842
+ }
843
+ ```
844
+
845
+ ## Resources
846
+
847
+ ### Official Documentation
848
+ - [Axios 1.x Documentation](https://axios-http.com/)
849
+ - [Axios GitHub Repository](https://github.com/axios/axios)
850
+ - [Axios Changelog](https://github.com/axios/axios/blob/main/CHANGELOG.md)
851
+
852
+ ### Migration Tools
853
+ - [Axios Migration Codemod](https://github.com/axios/axios-migration-codemod) *(if available)*
854
+ - [ESLint Rules for Axios 1.x](https://github.com/axios/eslint-plugin-axios) *(if available)*
855
+
856
+ ### Community Resources
857
+ - [Stack Overflow - Axios Migration Questions](https://stackoverflow.com/questions/tagged/axios+migration)
858
+ - [GitHub Discussions](https://github.com/axios/axios/discussions)
859
+ - [Axios Discord Community](https://discord.gg/axios) *(if available)*
860
+
861
+ ### Related Issues
862
+ - [Error Handling Changes Discussion](https://github.com/axios/axios/issues/7208)
863
+ - [Migration Guide Request](https://github.com/axios/axios/issues/xxxx) *(link to related issues)*
864
+
865
+ ---
866
+
867
+ ## Need Help?
868
+
869
+ If you encounter issues during migration that aren't covered in this guide:
870
+
871
+ 1. **Search existing issues** in the [Axios GitHub repository](https://github.com/axios/axios/issues)
872
+ 2. **Ask questions** in [GitHub Discussions](https://github.com/axios/axios/discussions)
873
+ 3. **Contribute improvements** to this migration guide
874
+
875
+ ---
876
+
877
+ *This migration guide is maintained by the community. If you find errors or have suggestions, please [open an issue](https://github.com/axios/axios/issues) or submit a pull request.*
scripts/node_modules/axios/README.md ADDED
@@ -0,0 +1,2019 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3 align="center"> 💎 Platinum sponsors <br> </h3> <table align="center"><tr><td align="center" width="50%"> <a href="https://thanks.dev/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="90px" height="90px" src="https://axios-http.com/assets/sponsors/opencollective/ed51c2ee8f1b70aa3484d6dd678652134079a036.png" alt="THANKS.DEV"/> </a> <p align="center" title="We&#x27;re passionate about making open source sustainable. Scan your dependancy tree to better understand which open source projects need funding the most. Maintainers can also register their projects to become eligible for funding.">We&#x27;re passionate about making open source sustainable. Scan your dependancy tree to better understand which open source projects need funding the...</p> <p align="center"> <a href="https://thanks.dev/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>thanks.dev</b></a> </p>
2
+ </td><td align="center" width="50%"> <a href="https://opencollective.com/hopper-security?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="90px" height="90px" src="https://axios-http.com/assets/sponsors/opencollective/180d02a83ee99448f850e39eed6dbb95f56000ba.png" alt="Hopper Security"/> </a> <p align="center"> </p>
3
+ </td></tr></table><table align="center"><tr><td align="center" width="50%"> <a href="https://opencollective.com/axios/contribute" target="_blank" >💜 Become a sponsor</a>
4
+ </td><td align="center" width="50%"> <a href="https://opencollective.com/axios/contribute" target="_blank" >💜 Become a sponsor</a>
5
+ </td></tr></table>
6
+ <h3 align="center"> 🥇 Gold sponsors <br> </h3> <table align="center" width="100%"><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="133px" height="43px" src="https://axios-http.com/assets/sponsors/principal.svg" alt="Principal Financial Group"/> </a> <p align="center" title="We’re bound by one common purpose: to give you the financial tools, resources and information you need to live your best life.">We’re bound by one common purpose: to give you the financial tools, resources and information you ne...</p> <p align="center"> <a href="https://www.principal.com/about-us?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>www.principal.com</b></a> </p>
7
+ </td><td align="center" width="33.333333333333336%"> <a href="https://twicsy.com/buy-instagram-followers?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="85px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/dfa9670ad5e66eea17315332453c7f4e3a3b5905.png" alt="Buy Instagram Followers Twicsy"/> </a> <p align="center" title="Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine.">Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site...</p> <p align="center"> <a href="https://twicsy.com/buy-instagram-followers?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>twicsy.com</b></a> </p>
8
+ </td><td align="center" width="33.333333333333336%"> <a href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="52px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/descope_white.png"> <img width="200px" height="52px" src="https://axios-http.com/assets/sponsors/descope.png" alt="Descope"/> </picture> </a> <p align="center" title="Hi, we&#x27;re Descope! We are building something in the authentication space for app developers and can’t wait to place it in your hands.">Hi, we&#x27;re Descope! We are building something in the authentication space for app developers and...</p> <p align="center"> <a href="https://www.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship" target="_blank"><b>Website</b></a> | <a href="https://docs.descope.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship" target="_blank"><b>Docs</b></a> | <a href="https://www.descope.com/community?utm_source&#x3D;axios&amp;utm_medium&#x3D;referral&amp;utm_campaign&#x3D;axios-oss-sponsorship" target="_blank"><b>Community</b></a> </p>
9
+ </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://route4me.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <picture> <source width="200px" height="51px" media="(prefers-color-scheme: dark)" srcset="https://axios-http.com/assets/sponsors/route4me_white.png"> <img width="200px" height="51px" src="https://axios-http.com/assets/sponsors/route4me.png" alt="Route4Me"/> </picture> </a> <p align="center" title="Best Route Planning And Route Optimization Software">Best Route Planning And Route Optimization Software</p> <p align="center"> <a href="https://route4me.com/platform/route-optimization-software?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>Explore</b></a> | <a href="https://route4me.com/platform/marketplace/pricing?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>Free Trial</b></a> | <a href="https://route4me.com/contact?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>Contact</b></a> </p>
10
+ </td><td align="center" width="33.333333333333336%"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="62px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/e1625cb54e10ee40180c99d1495a462e9d6664a4.png" alt="Buzzoid - Buy Instagram Followers"/> </a> <p align="center" title="At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rated world&#x27;s #1 IG service since 2012.">At Buzzoid, you can buy Instagram followers quickly, safely, and easily with just a few clicks. Rate...</p> <p align="center"> <a href="https://buzzoid.com/buy-instagram-followers/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>buzzoid.com</b></a> </p>
11
+ </td><td align="center" width="33.333333333333336%"> <a href="https://poprey.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="70px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/e699ec99f7df3a203ddbc49d3c7712a907e628ea.png" alt="Poprey - Buy Instagram Likes"/> </a> <p align="center" title="Buy Instagram Likes">Buy Instagram Likes</p> <p align="center"> <a href="https://poprey.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>poprey.com</b></a> </p>
12
+ </td></tr><tr width="33.333333333333336%"><td align="center" width="33.333333333333336%"> <a href="https://requestly.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;sponsorlist&amp;utm_campaign&#x3D;sponsorship" style="padding: 10px; display: inline-block" target="_blank"> <img width="71px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/16450b4dc0deb9dab5a511bf2bc8b8b4ac33412f.png" alt="Requestly"/> </a> <p align="center" title="A lightweight open-source API Development, Testing &amp; Mocking platform">A lightweight open-source API Development, Testing &amp; Mocking platform</p> <p align="center"> <a href="https://requestly.com/?utm_source&#x3D;axios&amp;utm_medium&#x3D;readme_sponsorlist&amp;utm_campaign&#x3D;sponsorship" target="_blank"><b>requestly.com</b></a> </p>
13
+ </td><td align="center" width="33.333333333333336%"> <a href="https://rxdb.info/?utm_source&#x3D;opencollective&amp;utm_medium&#x3D;banner&amp;utm_campaign&#x3D;opencollective_sponsor&amp;utm_content&#x3D;logo" style="padding: 10px; display: inline-block" target="_blank"> <img width="158px" height="70px" src="https://axios-http.com/assets/sponsors/opencollective/b28cc6ed919b414cb5f3d4a6d666cb8e06c5ff07.png" alt="RxDB"/> </a> <p align="center" title="RxDB is a fast, local-first NoSQL-database for JavaScript Applications like Websites, hybrid Apps, Electron-Apps, Progressive Web Apps and Node.js">RxDB is a fast, local-first NoSQL-database for JavaScript Applications like Websites, hybrid Apps, E...</p> <p align="center"> <a href="https://rxdb.info/?utm_source&#x3D;opencollective&amp;utm_medium&#x3D;banner&amp;utm_campaign&#x3D;opencollective_sponsor&amp;utm_content&#x3D;logo" target="_blank"><b>rxdb.info</b></a> </p>
14
+ </td><td align="center" width="33.333333333333336%"> <a href="https://opencollective.com/axios/contribute" target="_blank" >💜 Become a sponsor</a>
15
+ </td></tr></table>
16
+
17
+ <!--<div>marker</div>-->
18
+
19
+ <br><br>
20
+
21
+ <div align="center">
22
+ <a href="https://axios-http.com"><img src="https://axios-http.com/assets/logo.svg" alt="Axios" /></a><br>
23
+ </div>
24
+
25
+ <p align="center">Promise based HTTP client for the browser and node.js</p>
26
+
27
+ <p align="center">
28
+ <a href="https://axios-http.com/"><b>Website</b></a> •
29
+ <a href="https://axios-http.com/docs/intro"><b>Documentation</b></a>
30
+ </p>
31
+
32
+ <div align="center">
33
+
34
+ [![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios)
35
+ [![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios)
36
+ [![Build status](https://img.shields.io/github/actions/workflow/status/axios/axios/ci.yml?branch=v1.x&label=CI&logo=github&style=flat-square)](https://github.com/axios/axios/actions/workflows/ci.yml)
37
+ [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/axios/axios)
38
+ [![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios)
39
+ [![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=axios&query=$.install.pretty&label=install%20size&style=flat-square)](https://packagephobia.now.sh/result?p=axios)
40
+ [![npm bundle size](https://img.shields.io/bundlephobia/minzip/axios?style=flat-square)](https://bundlephobia.com/package/axios@latest)
41
+ [![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://npm-stat.com/charts.html?package=axios)
42
+ [![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios)
43
+ [![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios)
44
+ [![Known Vulnerabilities](https://snyk.io/test/npm/axios/badge.svg)](https://snyk.io/test/npm/axios)
45
+ [![Contributors](https://img.shields.io/github/contributors/axios/axios.svg?style=flat-square)](CONTRIBUTORS.md)
46
+
47
+ </div>
48
+
49
+ ## Table of Contents
50
+
51
+ - [Features](#features)
52
+ - [Browser Support](#browser-support)
53
+ - [Installing](#installing)
54
+ - [Package manager](#package-manager)
55
+ - [CDN](#cdn)
56
+ - [Example](#example)
57
+ - [Axios API](#axios-api)
58
+ - [Request method aliases](#request-method-aliases)
59
+ - [Concurrency 👎](#concurrency-deprecated)
60
+ - [Creating an instance](#creating-an-instance)
61
+ - [Instance methods](#instance-methods)
62
+ - [Request Config](#request-config)
63
+ - [Response Schema](#response-schema)
64
+ - [Config Defaults](#config-defaults)
65
+ - [Global axios defaults](#global-axios-defaults)
66
+ - [Custom instance defaults](#custom-instance-defaults)
67
+ - [Config order of precedence](#config-order-of-precedence)
68
+ - [Interceptors](#interceptors)
69
+ - [Multiple Interceptors](#multiple-interceptors)
70
+ - [Handling Errors](#handling-errors)
71
+ - [Handling Timeouts](#handling-timeouts)
72
+ - [Cancellation](#cancellation)
73
+ - [AbortController](#abortcontroller)
74
+ - [CancelToken 👎](#canceltoken-deprecated)
75
+ - [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format)
76
+ - [URLSearchParams](#urlsearchparams)
77
+ - [Query string](#query-string-older-browsers)
78
+ - [🆕 Automatic serialization](#-automatic-serialization-to-urlsearchparams)
79
+ - [Using multipart/form-data format](#using-multipartform-data-format)
80
+ - [FormData](#formdata)
81
+ - [🆕 Automatic serialization](#-automatic-serialization-to-formdata)
82
+ - [Files Posting](#files-posting)
83
+ - [HTML Form Posting](#-html-form-posting-browser)
84
+ - [🆕 Progress capturing](#-progress-capturing)
85
+ - [🆕 Rate limiting](#-rate-limiting)
86
+ - [🆕 AxiosHeaders](#-axiosheaders)
87
+ - [🔥 Fetch adapter](#-fetch-adapter)
88
+ - [🔥 Custom fetch](#-custom-fetch)
89
+ - [🔥 Using with Tauri](#-using-with-tauri)
90
+ - [🔥 Using with SvelteKit](#-using-with-sveltekit-)
91
+ - [🔥 HTTP2](#-http2)
92
+ - [Semver](#semver)
93
+ - [Promises](#promises)
94
+ - [TypeScript](#typescript)
95
+ - [Resources](#resources)
96
+ - [Credits](#credits)
97
+ - [License](#license)
98
+
99
+ ## Features
100
+
101
+ - **Browser Requests:** Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) directly from the browser.
102
+ - **Node.js Requests:** Make [http](https://nodejs.org/api/http.html) requests from Node.js environments.
103
+ - **Promise-based:** Fully supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API for easier asynchronous code.
104
+ - **Interceptors:** Intercept requests and responses to add custom logic or transform data.
105
+ - **Data Transformation:** Transform request and response data automatically.
106
+ - **Request Cancellation:** Cancel requests using built-in mechanisms.
107
+ - **Automatic JSON Handling:** Automatically serializes and parses [JSON](https://www.json.org/json-en.html) data.
108
+ - **Form Serialization:** 🆕 Automatically serializes data objects to `multipart/form-data` or `x-www-form-urlencoded` formats.
109
+ - **XSRF Protection:** Client-side support to protect against [Cross-Site Request Forgery](https://en.wikipedia.org/wiki/Cross-site_request_forgery).
110
+
111
+ ## Browser Support
112
+
113
+ | Chrome | Firefox | Safari | Opera | Edge |
114
+ | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------: |
115
+ | ![Chrome browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge browser logo](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) |
116
+ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
117
+
118
+ [![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios)
119
+
120
+ ## Installing
121
+
122
+ ### Package manager
123
+
124
+ Using npm:
125
+
126
+ ```bash
127
+ $ npm install axios
128
+ ```
129
+
130
+ Using bower:
131
+
132
+ ```bash
133
+ $ bower install axios
134
+ ```
135
+
136
+ Using yarn:
137
+
138
+ ```bash
139
+ $ yarn add axios
140
+ ```
141
+
142
+ Using pnpm:
143
+
144
+ ```bash
145
+ $ pnpm add axios
146
+ ```
147
+
148
+ Using bun:
149
+
150
+ ```bash
151
+ $ bun add axios
152
+ ```
153
+
154
+ Once the package is installed, you can import the library using `import` or `require` approach:
155
+
156
+ ```js
157
+ import axios, { isCancel, AxiosError } from "axios";
158
+ ```
159
+
160
+ You can also use the default export, since the named export is just a re-export from the Axios factory:
161
+
162
+ ```js
163
+ import axios from "axios";
164
+
165
+ console.log(axios.isCancel("something"));
166
+ ```
167
+
168
+ If you use `require` for importing, **only the default export is available**:
169
+
170
+ ```js
171
+ const axios = require("axios");
172
+
173
+ console.log(axios.isCancel("something"));
174
+ ```
175
+
176
+ For some bundlers and some ES6 linters you may need to do the following:
177
+
178
+ ```js
179
+ import { default as axios } from "axios";
180
+ ```
181
+
182
+ For cases where something went wrong when trying to import a module into a custom or legacy environment,
183
+ you can try importing the module package directly:
184
+
185
+ ```js
186
+ const axios = require("axios/dist/browser/axios.cjs"); // browser commonJS bundle (ES2017)
187
+ // const axios = require('axios/dist/node/axios.cjs'); // node commonJS bundle (ES2017)
188
+ ```
189
+
190
+ ### CDN
191
+
192
+ Using jsDelivr CDN (ES5 UMD browser module):
193
+
194
+ ```html
195
+ <script src="https://cdn.jsdelivr.net/npm/axios@1.13.2/dist/axios.min.js"></script>
196
+ ```
197
+
198
+ Using unpkg CDN:
199
+
200
+ ```html
201
+ <script src="https://unpkg.com/axios@1.13.2/dist/axios.min.js"></script>
202
+ ```
203
+
204
+ ## Example
205
+
206
+ ```js
207
+ import axios from "axios";
208
+ //const axios = require('axios'); // legacy way
209
+
210
+ try {
211
+ const response = await axios.get("/user?ID=12345");
212
+ console.log(response);
213
+ } catch (error) {
214
+ console.error(error);
215
+ }
216
+
217
+ // Optionally the request above could also be done as
218
+ axios
219
+ .get("/user", {
220
+ params: {
221
+ ID: 12345,
222
+ },
223
+ })
224
+ .then(function (response) {
225
+ console.log(response);
226
+ })
227
+ .catch(function (error) {
228
+ console.log(error);
229
+ })
230
+ .finally(function () {
231
+ // always executed
232
+ });
233
+
234
+ // Want to use async/await? Add the `async` keyword to your outer function/method.
235
+ async function getUser() {
236
+ try {
237
+ const response = await axios.get("/user?ID=12345");
238
+ console.log(response);
239
+ } catch (error) {
240
+ console.error(error);
241
+ }
242
+ }
243
+ ```
244
+
245
+ > **Note**: `async/await` is part of ECMAScript 2017 and is not supported in Internet
246
+ > Explorer and older browsers, so use with caution.
247
+
248
+ Performing a `POST` request
249
+
250
+ ```js
251
+ const response = await axios.post("/user", {
252
+ firstName: "Fred",
253
+ lastName: "Flintstone",
254
+ });
255
+ console.log(response);
256
+ ```
257
+
258
+ Performing multiple concurrent requests
259
+
260
+ ```js
261
+ function getUserAccount() {
262
+ return axios.get("/user/12345");
263
+ }
264
+
265
+ function getUserPermissions() {
266
+ return axios.get("/user/12345/permissions");
267
+ }
268
+
269
+ Promise.all([getUserAccount(), getUserPermissions()]).then(function (results) {
270
+ const acct = results[0];
271
+ const perm = results[1];
272
+ });
273
+ ```
274
+
275
+ ## axios API
276
+
277
+ Requests can be made by passing the relevant config to `axios`.
278
+
279
+ ##### axios(config)
280
+
281
+ ```js
282
+ // Send a POST request
283
+ axios({
284
+ method: "post",
285
+ url: "/user/12345",
286
+ data: {
287
+ firstName: "Fred",
288
+ lastName: "Flintstone",
289
+ },
290
+ });
291
+ ```
292
+
293
+ ```js
294
+ // GET request for remote image in node.js
295
+ const response = await axios({
296
+ method: "get",
297
+ url: "https://bit.ly/2mTM3nY",
298
+ responseType: "stream",
299
+ });
300
+ response.data.pipe(fs.createWriteStream("ada_lovelace.jpg"));
301
+ ```
302
+
303
+ ##### axios(url[, config])
304
+
305
+ ```js
306
+ // Send a GET request (default method)
307
+ axios("/user/12345");
308
+ ```
309
+
310
+ ### Request method aliases
311
+
312
+ For convenience, aliases have been provided for all common request methods.
313
+
314
+ ##### axios.request(config)
315
+
316
+ ##### axios.get(url[, config])
317
+
318
+ ##### axios.delete(url[, config])
319
+
320
+ ##### axios.head(url[, config])
321
+
322
+ ##### axios.options(url[, config])
323
+
324
+ ##### axios.post(url[, data[, config]])
325
+
326
+ ##### axios.put(url[, data[, config]])
327
+
328
+ ##### axios.patch(url[, data[, config]])
329
+
330
+ ###### NOTE
331
+
332
+ When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
333
+
334
+ ### Concurrency (Deprecated)
335
+
336
+ Please use `Promise.all` to replace the below functions.
337
+
338
+ Helper functions for dealing with concurrent requests.
339
+
340
+ axios.all(iterable)
341
+ axios.spread(callback)
342
+
343
+ ### Creating an instance
344
+
345
+ You can create a new instance of axios with a custom config.
346
+
347
+ ##### axios.create([config])
348
+
349
+ ```js
350
+ const instance = axios.create({
351
+ baseURL: "https://some-domain.com/api/",
352
+ timeout: 1000,
353
+ headers: { "X-Custom-Header": "foobar" },
354
+ });
355
+ ```
356
+
357
+ ### Instance methods
358
+
359
+ The available instance methods are listed below. The specified config will be merged with the instance config.
360
+
361
+ ##### axios#request(config)
362
+
363
+ ##### axios#get(url[, config])
364
+
365
+ ##### axios#delete(url[, config])
366
+
367
+ ##### axios#head(url[, config])
368
+
369
+ ##### axios#options(url[, config])
370
+
371
+ ##### axios#post(url[, data[, config]])
372
+
373
+ ##### axios#put(url[, data[, config]])
374
+
375
+ ##### axios#patch(url[, data[, config]])
376
+
377
+ ##### axios#getUri([config])
378
+
379
+ ## Request Config
380
+
381
+ These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified.
382
+
383
+ ```js
384
+ {
385
+ // `url` is the server URL that will be used for the request
386
+ url: '/user',
387
+
388
+ // `method` is the request method to be used when making the request
389
+ method: 'get', // default
390
+
391
+ // `baseURL` will be prepended to `url` unless `url` is absolute and the option `allowAbsoluteUrls` is set to true.
392
+ // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs
393
+ // to the methods of that instance.
394
+ baseURL: 'https://some-domain.com/api/',
395
+
396
+ // `allowAbsoluteUrls` determines whether or not absolute URLs will override a configured `baseUrl`.
397
+ // When set to true (default), absolute values for `url` will override `baseUrl`.
398
+ // When set to false, absolute values for `url` will always be prepended by `baseUrl`.
399
+ allowAbsoluteUrls: true,
400
+
401
+ // `transformRequest` allows changes to the request data before it is sent to the server
402
+ // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE'
403
+ // The last function in the array must return a string or an instance of Buffer, ArrayBuffer,
404
+ // FormData or Stream
405
+ // You may modify the headers object.
406
+ transformRequest: [function (data, headers) {
407
+ // Do whatever you want to transform the data
408
+
409
+ return data;
410
+ }],
411
+
412
+ // `transformResponse` allows changes to the response data to be made before
413
+ // it is passed to then/catch
414
+ transformResponse: [function (data) {
415
+ // Do whatever you want to transform the data
416
+
417
+ return data;
418
+ }],
419
+
420
+ // `headers` are custom headers to be sent
421
+ headers: {'X-Requested-With': 'XMLHttpRequest'},
422
+
423
+ // `params` are the URL parameters to be sent with the request
424
+ // Must be a plain object or a URLSearchParams object
425
+ params: {
426
+ ID: 12345
427
+ },
428
+
429
+ // `paramsSerializer` is an optional config that allows you to customize serializing `params`.
430
+ paramsSerializer: {
431
+
432
+ // Custom encoder function which sends key/value pairs in an iterative fashion.
433
+ encode?: (param: string): string => { /* Do custom operations here and return transformed string */ },
434
+
435
+ // Custom serializer function for the entire parameter. Allows the user to mimic pre 1.x behaviour.
436
+ serialize?: (params: Record<string, any>, options?: ParamsSerializerOptions ),
437
+
438
+ // Configuration for formatting array indexes in the params.
439
+ indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes).
440
+ },
441
+
442
+ // `data` is the data to be sent as the request body
443
+ // Only applicable for request methods 'PUT', 'POST', 'DELETE', and 'PATCH'
444
+ // When no `transformRequest` is set, it must be of one of the following types:
445
+ // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
446
+ // - Browser only: FormData, File, Blob
447
+ // - Node only: Stream, Buffer, FormData (form-data package)
448
+ data: {
449
+ firstName: 'Fred'
450
+ },
451
+
452
+ // syntax alternative to send data into the body
453
+ // method post
454
+ // only the value is sent, not the key
455
+ data: 'Country=Brasil&City=Belo Horizonte',
456
+
457
+ // `timeout` specifies the number of milliseconds before the request times out.
458
+ // If the request takes longer than `timeout`, the request will be aborted.
459
+ timeout: 1000, // default is `0` (no timeout)
460
+
461
+ // `withCredentials` indicates whether or not cross-site Access-Control requests
462
+ // should be made using credentials
463
+ // This only controls whether the browser sends credentials.
464
+ // It does not control whether the XSRF header is added.
465
+ withCredentials: false, // default
466
+
467
+ // `adapter` allows custom handling of requests which makes testing easier.
468
+ // Return a promise and supply a valid response (see lib/adapters/README.md)
469
+ adapter: function (config) {
470
+ /* ... */
471
+ },
472
+ // Also, you can set the name of the built-in adapter, or provide an array with their names
473
+ // to choose the first available in the environment
474
+ adapter: 'xhr', // 'fetch' | 'http' | ['xhr', 'http', 'fetch']
475
+
476
+ // `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
477
+ // This will set an `Authorization` header, overwriting any existing
478
+ // `Authorization` custom headers you have set using `headers`.
479
+ // Please note that only HTTP Basic auth is configurable through this parameter.
480
+ // For Bearer tokens and such, use `Authorization` custom headers instead.
481
+ auth: {
482
+ username: 'janedoe',
483
+ password: 's00pers3cret'
484
+ },
485
+
486
+ // `responseType` indicates the type of data that the server will respond with
487
+ // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
488
+ // browser only: 'blob'
489
+ responseType: 'json', // default
490
+
491
+ // `responseEncoding` indicates encoding to use for decoding responses (Node.js only)
492
+ // Note: Ignored for `responseType` of 'stream' or client-side requests
493
+ // options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url',
494
+ // 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8',
495
+ // 'utf8', 'UTF8', 'utf16le', 'UTF16LE'
496
+ responseEncoding: 'utf8', // default
497
+
498
+ // `xsrfCookieName` is the name of the cookie to use as a value for the xsrf token
499
+ xsrfCookieName: 'XSRF-TOKEN', // default
500
+
501
+ // `xsrfHeaderName` is the name of the http header that carries the xsrf token value
502
+ xsrfHeaderName: 'X-XSRF-TOKEN', // default
503
+
504
+ // `withXSRFToken` defines whether to send the XSRF header in browser requests.
505
+ // `undefined` (default) - set XSRF header only for the same origin requests
506
+ // `true` - always set XSRF header, including for cross-origin requests
507
+ // `false` - never set XSRF header
508
+ // function - resolve with custom logic; receives the internal config object
509
+ withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined),
510
+
511
+ // `withXSRFToken` controls whether Axios reads the XSRF cookie and sets the XSRF header.
512
+ // - `undefined` (default): the XSRF header is set only for same-origin requests.
513
+ // - `true`: attempt to set the XSRF header for all requests (including cross-origin).
514
+ // - `false`: never set the XSRF header.
515
+ // - function: a callback that receives the request `config` and returns `true`,
516
+ // `false`, or `undefined` to decide per-request behavior.
517
+ //
518
+ // Note about `withCredentials`: `withCredentials` controls whether cross-site
519
+ // requests include credentials (cookies and HTTP auth). In older Axios versions,
520
+ // setting `withCredentials: true` implicitly caused Axios to set the XSRF header
521
+ // for cross-origin requests. Newer Axios separates these concerns: to allow the
522
+ // XSRF header to be sent for cross-origin requests you should set both
523
+ // `withCredentials: true` and `withXSRFToken: true`.
524
+ //
525
+ // Example:
526
+ // axios.get('/user', { withCredentials: true, withXSRFToken: true });
527
+
528
+ // `onUploadProgress` allows handling of progress events for uploads
529
+ // browser & node.js
530
+ onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) {
531
+ // Do whatever you want with the Axios progress event
532
+ },
533
+
534
+ // `onDownloadProgress` allows handling of progress events for downloads
535
+ // browser & node.js
536
+ onDownloadProgress: function ({loaded, total, progress, bytes, estimated, rate, download = true}) {
537
+ // Do whatever you want with the Axios progress event
538
+ },
539
+
540
+ // `maxContentLength` defines the max size of the http response content in bytes allowed in node.js
541
+ maxContentLength: 2000,
542
+
543
+ // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed
544
+ maxBodyLength: 2000,
545
+
546
+ // `validateStatus` defines whether to resolve or reject the promise for a given
547
+ // HTTP response status code. If `validateStatus` returns `true` (or is set to `null`
548
+ // or `undefined`), the promise will be resolved; otherwise, the promise will be
549
+ // rejected.
550
+ validateStatus: function (status) {
551
+ return status >= 200 && status < 300; // default
552
+ },
553
+
554
+ // `maxRedirects` defines the maximum number of redirects to follow in node.js.
555
+ // If set to 0, no redirects will be followed.
556
+ maxRedirects: 21, // default
557
+
558
+ // `beforeRedirect` defines a function that will be called before redirect.
559
+ // Use this to adjust the request options upon redirecting,
560
+ // to inspect the latest response headers,
561
+ // or to cancel the request by throwing an error
562
+ // If maxRedirects is set to 0, `beforeRedirect` is not used.
563
+
564
+ beforeRedirect: (options, { headers }) => {
565
+ if (
566
+ options.hostname === "example.com" &&
567
+ options.protocol === "https:"
568
+ ) {
569
+ options.auth = "user:password";
570
+ }
571
+ },
572
+ // Security note:
573
+ // The `beforeRedirect` hook runs after sensitive headers are stripped during redirects.
574
+ //The `follow-redirects` library removes credentials on protocol downgrade (HTTPS → HTTP) for security.
575
+ //Since `beforeRedirect` runs after this, re-injecting credentials without checking the protocol can expose sensitive data.
576
+ //Always ensure credentials are only added for trusted HTTPS destinations.
577
+
578
+ // Security note:
579
+ // The beforeRedirect hook runs after sensitive headers are stripped during redirects.
580
+ // Re-injecting credentials without checking the destination can expose sensitive data.
581
+ // Only add credentials for trusted HTTPS destinations.
582
+ // Avoid re-adding credentials on downgraded redirects.
583
+
584
+
585
+ // `socketPath` defines a UNIX Socket to be used in node.js.
586
+ // e.g. '/var/run/docker.sock' to send requests to the docker daemon.
587
+ // Only either `socketPath` or `proxy` can be specified.
588
+ // If both are specified, `socketPath` is used.
589
+ socketPath: null, // default
590
+
591
+ // `transport` determines the transport method that will be used to make the request.
592
+ // If defined, it will be used. Otherwise, if `maxRedirects` is 0,
593
+ // the default `http` or `https` library will be used, depending on the protocol specified in `protocol`.
594
+ // Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol,
595
+ // which can handle redirects.
596
+ transport: undefined, // default
597
+
598
+ // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http
599
+ // and https requests, respectively, in node.js. This allows options to be added like
600
+ // `keepAlive` that are not enabled by default before Node.js v19.0.0. After Node.js
601
+ // v19.0.0, you no longer need to customize the agent to enable `keepAlive` because
602
+ // `http.globalAgent` has `keepAlive` enabled by default.
603
+ httpAgent: new http.Agent({ keepAlive: true }),
604
+ httpsAgent: new https.Agent({ keepAlive: true }),
605
+
606
+ // `proxy` defines the hostname, port, and protocol of the proxy server.
607
+ // You can also define your proxy using the conventional `http_proxy` and
608
+ // `https_proxy` environment variables. If you are using environment variables
609
+ // for your proxy configuration, you can also define a `no_proxy` environment
610
+ // variable as a comma-separated list of domains that should not be proxied.
611
+ // Use `false` to disable proxies, ignoring environment variables.
612
+ // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
613
+ // supplies credentials.
614
+ // This will set a `Proxy-Authorization` header, overwriting any existing
615
+ // `Proxy-Authorization` custom headers you have set using `headers`.
616
+ // If the proxy server uses HTTPS, then you must set the protocol to `https`.
617
+ proxy: {
618
+ protocol: 'https',
619
+ host: '127.0.0.1',
620
+ // hostname: '127.0.0.1' // Takes precedence over 'host' if both are defined
621
+ port: 9000,
622
+ auth: {
623
+ username: 'mikeymike',
624
+ password: 'rapunz3l'
625
+ }
626
+ },
627
+
628
+ // `cancelToken` specifies a cancel token that can be used to cancel the request
629
+ // (see Cancellation section below for details)
630
+ cancelToken: new CancelToken(function (cancel) {
631
+ }),
632
+
633
+ // an alternative way to cancel Axios requests using AbortController
634
+ signal: new AbortController().signal,
635
+
636
+ // `decompress` indicates whether or not the response body should be decompressed
637
+ // automatically. If set to `true` will also remove the 'content-encoding' header
638
+ // from the responses objects of all decompressed responses
639
+ // - Node only (XHR cannot turn off decompression)
640
+ decompress: true, // default
641
+
642
+ // `insecureHTTPParser` boolean.
643
+ // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers.
644
+ // This may allow interoperability with non-conformant HTTP implementations.
645
+ // Using the insecure parser should be avoided.
646
+ // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback
647
+ // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none
648
+ insecureHTTPParser: undefined, // default
649
+
650
+ // transitional options for backward compatibility that may be removed in the newer versions
651
+ transitional: {
652
+ // silent JSON parsing mode
653
+ // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour)
654
+ // `false` - throw SyntaxError if JSON parsing failed
655
+ // Important: this option only takes effect when `responseType` is explicitly set to 'json'.
656
+ // When `responseType` is omitted (defaults to no value), axios uses `forcedJSONParsing`
657
+ // to attempt JSON parsing, but will silently return the raw string on failure regardless
658
+ // of this setting. To have invalid JSON throw errors, use:
659
+ // { responseType: 'json', transitional: { silentJSONParsing: false } }
660
+ silentJSONParsing: true, // default value for the current Axios version
661
+
662
+ // try to parse the response string as JSON even if `responseType` is not 'json'
663
+ forcedJSONParsing: true,
664
+
665
+ // throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts
666
+ clarifyTimeoutError: false,
667
+
668
+ // use the legacy interceptor request/response ordering
669
+ legacyInterceptorReqResOrdering: true, // default
670
+ },
671
+
672
+ env: {
673
+ // The FormData class to be used to automatically serialize the payload into a FormData object
674
+ FormData: window?.FormData || global?.FormData
675
+ },
676
+
677
+ formSerializer: {
678
+ visitor: (value, key, path, helpers) => {}; // custom visitor function to serialize form values
679
+ dots: boolean; // use dots instead of brackets format
680
+ metaTokens: boolean; // keep special endings like {} in parameter key
681
+ indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes
682
+ },
683
+
684
+ // http adapter only (node.js)
685
+ maxRate: [
686
+ 100 * 1024, // 100KB/s upload limit,
687
+ 100 * 1024 // 100KB/s download limit
688
+ ]
689
+ }
690
+ ```
691
+ ## 🔥 HTTP/2 Support
692
+
693
+ Axios has experimental HTTP/2 support available via the Node.js HTTP adapter.
694
+
695
+ Support depends on the runtime environment and Node.js version. Features like redirects and some behaviors may not be fully supported with HTTP/2.
696
+
697
+ Options like `httpVersion` and `http2Options` are adapter-specific and may not work consistently across all environments.
698
+
699
+ If HTTP/2 functionality is required, ensure your runtime environment supports it or consider using alternative libraries or custom adapters.
700
+
701
+ ## Response Schema
702
+
703
+ The response to a request contains the following information.
704
+
705
+ ```js
706
+ {
707
+ // `data` is the response that was provided by the server
708
+ data: {},
709
+
710
+ // `status` is the HTTP status code from the server response
711
+ status: 200,
712
+
713
+ // `statusText` is the HTTP status message from the server response
714
+ statusText: 'OK',
715
+
716
+ // `headers` the HTTP headers that the server responded with
717
+ // All header names are lowercase and can be accessed using the bracket notation.
718
+ // Example: `response.headers['content-type']`
719
+ headers: {},
720
+
721
+ // `config` is the config that was provided to `axios` for the request
722
+ config: {},
723
+
724
+ // `request` is the request that generated this response
725
+ // It is the last ClientRequest instance in node.js (in redirects)
726
+ // and an XMLHttpRequest instance in the browser
727
+ request: {}
728
+ }
729
+ ```
730
+
731
+ When using `then`, you will receive the response as follows:
732
+
733
+ ```js
734
+ const response = await axios.get("/user/12345");
735
+ console.log(response.data);
736
+ console.log(response.status);
737
+ console.log(response.statusText);
738
+ console.log(response.headers);
739
+ console.log(response.config);
740
+ ```
741
+
742
+ When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section.
743
+
744
+ ## Config Defaults
745
+
746
+ You can specify config defaults that will be applied to every request.
747
+
748
+ ### Global axios defaults
749
+
750
+ ```js
751
+ axios.defaults.baseURL = "https://api.example.com";
752
+
753
+ // Important: If axios is used with multiple domains, the AUTH_TOKEN will be sent to all of them.
754
+ // See below for an example using Custom instance defaults instead.
755
+ axios.defaults.headers.common["Authorization"] = AUTH_TOKEN;
756
+
757
+ axios.defaults.headers.post["Content-Type"] =
758
+ "application/x-www-form-urlencoded";
759
+ ```
760
+
761
+ ### Custom instance defaults
762
+
763
+ ```js
764
+ // Set config defaults when creating the instance
765
+ const instance = axios.create({
766
+ baseURL: "https://api.example.com",
767
+ });
768
+
769
+ // Alter defaults after instance has been created
770
+ instance.defaults.headers.common["Authorization"] = AUTH_TOKEN;
771
+ ```
772
+
773
+ ### Config order of precedence
774
+
775
+ Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults/index.js](https://github.com/axios/axios/blob/main/lib/defaults/index.js#L49), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
776
+
777
+ ```js
778
+ // Create an instance using the config defaults provided by the library
779
+ // At this point the timeout config value is `0` as is the default for the library
780
+ const instance = axios.create();
781
+
782
+ // Override timeout default for the library
783
+ // Now all requests using this instance will wait 2.5 seconds before timing out
784
+ instance.defaults.timeout = 2500;
785
+
786
+ // Override timeout for this request as it's known to take a long time
787
+ instance.get("/longRequest", {
788
+ timeout: 5000,
789
+ });
790
+ ```
791
+
792
+ ## Interceptors
793
+
794
+ You can intercept requests or responses before methods like `.get()` or `.post()`
795
+ resolve their promises (before code inside `then` or `catch`, or after `await`)
796
+
797
+ ```js
798
+ const instance = axios.create();
799
+
800
+ // Add a request interceptor
801
+ instance.interceptors.request.use(
802
+ function (config) {
803
+ // Do something before the request is sent
804
+ return config;
805
+ },
806
+ function (error) {
807
+ // Do something with the request error
808
+ return Promise.reject(error);
809
+ },
810
+ );
811
+
812
+ // Add a response interceptor
813
+ instance.interceptors.response.use(
814
+ function (response) {
815
+ // Any status code that lies within the range of 2xx causes this function to trigger
816
+ // Do something with response data
817
+ return response;
818
+ },
819
+ function (error) {
820
+ // Any status codes that fall outside the range of 2xx cause this function to trigger
821
+ // Do something with response error
822
+ return Promise.reject(error);
823
+ },
824
+ );
825
+ ```
826
+
827
+ If you need to remove an interceptor later you can.
828
+
829
+ ```js
830
+ const instance = axios.create();
831
+ const myInterceptor = instance.interceptors.request.use(function () {
832
+ /*...*/
833
+ });
834
+ axios.interceptors.request.eject(myInterceptor);
835
+ ```
836
+
837
+ You can also clear all interceptors for requests or responses.
838
+
839
+ ```js
840
+ const instance = axios.create();
841
+ instance.interceptors.request.use(function () {
842
+ /*...*/
843
+ });
844
+ instance.interceptors.request.clear(); // Removes interceptors from requests
845
+ instance.interceptors.response.use(function () {
846
+ /*...*/
847
+ });
848
+ instance.interceptors.response.clear(); // Removes interceptors from responses
849
+ ```
850
+
851
+ You can add interceptors to a custom instance of axios.
852
+
853
+ ```js
854
+ const instance = axios.create();
855
+ instance.interceptors.request.use(function () {
856
+ /*...*/
857
+ });
858
+ ```
859
+
860
+ When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay
861
+ in the execution of your axios request when the main thread is blocked (a promise is created under the hood for
862
+ the interceptor and your request gets put at the bottom of the call stack). If your request interceptors are synchronous you can add a flag
863
+ to the options object that will tell axios to run the code synchronously and avoid any delays in request execution.
864
+
865
+ ```js
866
+ axios.interceptors.request.use(
867
+ function (config) {
868
+ config.headers.test = "I am only a header!";
869
+ return config;
870
+ },
871
+ null,
872
+ { synchronous: true },
873
+ );
874
+ ```
875
+
876
+ If you want to execute a particular interceptor based on a runtime check,
877
+ you can add a `runWhen` function to the options object. The request interceptor will not be executed **if and only if** the return
878
+ of `runWhen` is `false`. The function will be called with the config
879
+ object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an
880
+ asynchronous request interceptor that only needs to run at certain times.
881
+
882
+ ```js
883
+ function onGetCall(config) {
884
+ return config.method === "get";
885
+ }
886
+ axios.interceptors.request.use(
887
+ function (config) {
888
+ config.headers.test = "special get headers";
889
+ return config;
890
+ },
891
+ null,
892
+ { runWhen: onGetCall },
893
+ );
894
+ ```
895
+
896
+ > **Note:** The options parameter(having `synchronous` and `runWhen` properties) is only supported for request interceptors at the moment.
897
+
898
+ ### Interceptor Execution Order
899
+
900
+ **Important:** Interceptors have different execution orders depending on their type!
901
+
902
+ Request interceptors are executed in **reverse order** (LIFO - Last In, First Out). This means the _last_ interceptor added is executed **first**.
903
+
904
+ Response interceptors are executed in the **order they were added** (FIFO - First In, First Out). This means the _first_ interceptor added is executed **first**.
905
+
906
+ Example:
907
+
908
+ ```js
909
+ const instance = axios.create();
910
+
911
+ const interceptor = (id) => (base) => {
912
+ console.log(id);
913
+ return base;
914
+ };
915
+
916
+ instance.interceptors.request.use(interceptor("Request Interceptor 1"));
917
+ instance.interceptors.request.use(interceptor("Request Interceptor 2"));
918
+ instance.interceptors.request.use(interceptor("Request Interceptor 3"));
919
+ instance.interceptors.response.use(interceptor("Response Interceptor 1"));
920
+ instance.interceptors.response.use(interceptor("Response Interceptor 2"));
921
+ instance.interceptors.response.use(interceptor("Response Interceptor 3"));
922
+
923
+ // Console output:
924
+ // Request Interceptor 3
925
+ // Request Interceptor 2
926
+ // Request Interceptor 1
927
+ // [HTTP request is made]
928
+ // Response Interceptor 1
929
+ // Response Interceptor 2
930
+ // Response Interceptor 3
931
+ ```
932
+
933
+ ### Multiple Interceptors
934
+
935
+ Given that you add multiple response interceptors
936
+ and when the response was fulfilled
937
+
938
+ - then each interceptor is executed
939
+ - then they are executed in the order they were added
940
+ - then only the last interceptor's result is returned
941
+ - then every interceptor receives the result of its predecessor
942
+ - and when the fulfillment-interceptor throws
943
+ - then the following fulfillment-interceptor is not called
944
+ - then the following rejection-interceptor is called
945
+ - once caught, another following fulfill-interceptor is called again (just like in a promise chain).
946
+
947
+ Read [the interceptor tests](./test/specs/interceptors.spec.js) to see all this in code.
948
+
949
+ ## Error Types
950
+
951
+ There are many different axios error messages that can appear which can provide basic information about the specifics of the error and where opportunities may lie in debugging.
952
+
953
+ The general structure of axios errors is as follows:
954
+ | Property | Definition |
955
+ | -------- | ---------- |
956
+ | message | A quick summary of the error message and the status it failed with. |
957
+ | name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. |
958
+ | stack | Provides the stack trace of the error. |
959
+ | config | An axios config object with specific instance configurations defined by the user from when the request was made |
960
+ | code | Represents an axios identified error. The table below lists specific definitions for internal axios error. |
961
+ | status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings.
962
+
963
+ Below is a list of potential axios identified error:
964
+
965
+ | Code | Definition |
966
+ | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
967
+ | ERR_BAD_OPTION_VALUE | Invalid value provided in axios configuration. |
968
+ | ERR_BAD_OPTION | Invalid option provided in axios configuration. |
969
+ | ERR_NOT_SUPPORT | Feature or method not supported in the current axios environment. |
970
+ | ERR_DEPRECATED | Deprecated feature or method used in axios. |
971
+ | ERR_INVALID_URL | Invalid URL provided for axios request. |
972
+ | ECONNABORTED | Typically indicates that the request has been timed out (unless `transitional.clarifyTimeoutError` is set) or aborted by the browser or its plugin. |
973
+ | ERR_CANCELED | Feature or method is canceled explicitly by the user using an AbortSignal (or a CancelToken). |
974
+ | ETIMEDOUT | Request timed out due to exceeding the default axios timelimit. `transitional.clarifyTimeoutError` must be set to `true`, otherwise a generic `ECONNABORTED` error will be thrown instead. |
975
+ | ERR_NETWORK | Network-related issue. In the browser, this error can also be caused by a [CORS](https://developer.mozilla.org/ru/docs/Web/HTTP/Guides/CORS) or [Mixed Content](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content) policy violation. The browser does not allow the JS code to clarify the real reason for the error caused by security issues, so please check the console. |
976
+ | ERR_FR_TOO_MANY_REDIRECTS | Request is redirected too many times; exceeds max redirects specified in axios configuration. |
977
+ | ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. Usually related to a response with `5xx` status code. |
978
+ | ERR_BAD_REQUEST | The request has an unexpected format or is missing required parameters. Usually related to a response with `4xx` status code. |
979
+
980
+ ## Handling Errors
981
+
982
+ The default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error.
983
+
984
+ ```js
985
+ axios.get("/user/12345").catch(function (error) {
986
+ if (error.response) {
987
+ // The request was made and the server responded with a status code
988
+ // that falls out of the range of 2xx
989
+ console.log(error.response.data);
990
+ console.log(error.response.status);
991
+ console.log(error.response.headers);
992
+ } else if (error.request) {
993
+ // The request was made but no response was received
994
+ // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
995
+ // http.ClientRequest in node.js
996
+ console.log(error.request);
997
+ } else {
998
+ // Something happened in setting up the request that triggered an Error
999
+ console.log("Error", error.message);
1000
+ }
1001
+ console.log(error.config);
1002
+ });
1003
+ ```
1004
+
1005
+ Using the `validateStatus` config option, you can override the default condition (status >= 200 && status < 300) and define HTTP code(s) that should throw an error.
1006
+
1007
+ ```js
1008
+ axios.get("/user/12345", {
1009
+ validateStatus: function (status) {
1010
+ return status < 500; // Resolve only if the status code is less than 500
1011
+ },
1012
+ });
1013
+ ```
1014
+
1015
+ Using `toJSON` you get an object with more information about the HTTP error.
1016
+
1017
+ ```js
1018
+ axios.get("/user/12345").catch(function (error) {
1019
+ console.log(error.toJSON());
1020
+ });
1021
+ ```
1022
+
1023
+ ## Handling Timeouts
1024
+
1025
+ ```js
1026
+ async function fetchWithTimeout() {
1027
+ try {
1028
+ const response = await axios.get("https://example.com/data", {
1029
+ timeout: 5000, // 5 seconds
1030
+ transitional: {
1031
+ // set to true if you prefer ETIMEDOUT over ECONNABORTED
1032
+ clarifyTimeoutError: false,
1033
+ },
1034
+ });
1035
+
1036
+ console.log("Response:", response.data);
1037
+ } catch (error) {
1038
+ if (axios.isAxiosError(error)) {
1039
+ if (error.code === "ECONNABORTED" || error.code === "ETIMEDOUT") {
1040
+ console.error("Request timed out. Please try again.");
1041
+ return;
1042
+ }
1043
+
1044
+ console.error("Axios error:", error.message);
1045
+ return;
1046
+ }
1047
+
1048
+ console.error("Unexpected error:", error);
1049
+ }
1050
+ }
1051
+ ```
1052
+
1053
+ ## Cancellation
1054
+
1055
+ ### AbortController
1056
+
1057
+ Starting from `v0.22.0` Axios supports AbortController to cancel requests in a fetch API way:
1058
+
1059
+ ```js
1060
+ const controller = new AbortController();
1061
+
1062
+ axios
1063
+ .get("/foo/bar", {
1064
+ signal: controller.signal,
1065
+ })
1066
+ .then(function (response) {
1067
+ //...
1068
+ });
1069
+ // cancel the request
1070
+ controller.abort();
1071
+ ```
1072
+
1073
+ ### CancelToken `👎deprecated`
1074
+
1075
+ You can also cancel a request using a _CancelToken_.
1076
+
1077
+ > The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
1078
+
1079
+ > This API is deprecated since v0.22.0 and shouldn't be used in new projects
1080
+
1081
+ You can create a cancel token using the `CancelToken.source` factory as shown below:
1082
+
1083
+ ```js
1084
+ const CancelToken = axios.CancelToken;
1085
+ const source = CancelToken.source();
1086
+
1087
+ axios
1088
+ .get("/user/12345", {
1089
+ cancelToken: source.token,
1090
+ })
1091
+ .catch(function (thrown) {
1092
+ if (axios.isCancel(thrown)) {
1093
+ console.log("Request canceled", thrown.message);
1094
+ } else {
1095
+ // handle error
1096
+ }
1097
+ });
1098
+
1099
+ axios.post(
1100
+ "/user/12345",
1101
+ {
1102
+ name: "new name",
1103
+ },
1104
+ {
1105
+ cancelToken: source.token,
1106
+ },
1107
+ );
1108
+
1109
+ // cancel the request (the message parameter is optional)
1110
+ source.cancel("Operation canceled by the user.");
1111
+ ```
1112
+
1113
+ You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
1114
+
1115
+ ```js
1116
+ const CancelToken = axios.CancelToken;
1117
+ let cancel;
1118
+
1119
+ axios.get("/user/12345", {
1120
+ cancelToken: new CancelToken(function executor(c) {
1121
+ // An executor function receives a cancel function as a parameter
1122
+ cancel = c;
1123
+ }),
1124
+ });
1125
+
1126
+ // cancel the request
1127
+ cancel();
1128
+ ```
1129
+
1130
+ > **Note:** you can cancel several requests with the same cancel token/abort controller.
1131
+ > If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make a real request.
1132
+
1133
+ > During the transition period, you can use both cancellation APIs, even for the same request:
1134
+
1135
+ ## Using `application/x-www-form-urlencoded` format
1136
+
1137
+ ### URLSearchParams
1138
+
1139
+ By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) format instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers, and [Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018).
1140
+
1141
+ ```js
1142
+ const params = new URLSearchParams({ foo: "bar" });
1143
+ params.append("extraparam", "value");
1144
+ axios.post("/foo", params);
1145
+ ```
1146
+
1147
+ ### Query string (Older browsers)
1148
+
1149
+ For compatibility with very old browsers, there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment).
1150
+
1151
+ Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library:
1152
+
1153
+ ```js
1154
+ const qs = require("qs");
1155
+ axios.post("/foo", qs.stringify({ bar: 123 }));
1156
+ ```
1157
+
1158
+ Or in another way (ES6),
1159
+
1160
+ ```js
1161
+ import qs from "qs";
1162
+ const data = { bar: 123 };
1163
+ const options = {
1164
+ method: "POST",
1165
+ headers: { "content-type": "application/x-www-form-urlencoded" },
1166
+ data: qs.stringify(data),
1167
+ url,
1168
+ };
1169
+ axios(options);
1170
+ ```
1171
+
1172
+ ### Older Node.js versions
1173
+
1174
+ For older Node.js engines, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows:
1175
+
1176
+ ```js
1177
+ const querystring = require("querystring");
1178
+ axios.post("https://something.com/", querystring.stringify({ foo: "bar" }));
1179
+ ```
1180
+
1181
+ You can also use the [`qs`](https://github.com/ljharb/qs) library.
1182
+
1183
+ > **Note**: The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case.
1184
+
1185
+ ### 🆕 Automatic serialization to URLSearchParams
1186
+
1187
+ Axios will automatically serialize the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded".
1188
+
1189
+ ```js
1190
+ const data = {
1191
+ x: 1,
1192
+ arr: [1, 2, 3],
1193
+ arr2: [1, [2], 3],
1194
+ users: [
1195
+ { name: "Peter", surname: "Griffin" },
1196
+ { name: "Thomas", surname: "Anderson" },
1197
+ ],
1198
+ };
1199
+
1200
+ await axios.postForm("https://postman-echo.com/post", data, {
1201
+ headers: { "content-type": "application/x-www-form-urlencoded" },
1202
+ });
1203
+ ```
1204
+
1205
+ The server will handle it as:
1206
+
1207
+ ```js
1208
+ {
1209
+ x: '1',
1210
+ 'arr[]': [ '1', '2', '3' ],
1211
+ 'arr2[0]': '1',
1212
+ 'arr2[1][0]': '2',
1213
+ 'arr2[2]': '3',
1214
+ 'arr3[]': [ '1', '2', '3' ],
1215
+ 'users[0][name]': 'Peter',
1216
+ 'users[0][surname]': 'griffin',
1217
+ 'users[1][name]': 'Thomas',
1218
+ 'users[1][surname]': 'Anderson'
1219
+ }
1220
+ ```
1221
+
1222
+ If your backend body-parser (like `body-parser` of `express.js`) supports nested objects decoding, you will get the same object on the server-side automatically
1223
+
1224
+ ```js
1225
+ const app = express();
1226
+
1227
+ app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
1228
+
1229
+ app.post("/", function (req, res, next) {
1230
+ // echo body as JSON
1231
+ res.send(JSON.stringify(req.body));
1232
+ });
1233
+
1234
+ server = app.listen(3000);
1235
+ ```
1236
+
1237
+ ## Using `multipart/form-data` format
1238
+
1239
+ ### FormData
1240
+
1241
+ To send the data as a `multipart/form-data` you need to pass a formData instance as a payload.
1242
+ Setting the `Content-Type` header is not required as Axios guesses it based on the payload type.
1243
+
1244
+ ```js
1245
+ const formData = new FormData();
1246
+ formData.append("foo", "bar");
1247
+
1248
+ axios.post("https://httpbin.org/post", formData);
1249
+ ```
1250
+
1251
+ In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows:
1252
+
1253
+ ```js
1254
+ const FormData = require("form-data");
1255
+
1256
+ const form = new FormData();
1257
+ form.append("my_field", "my value");
1258
+ form.append("my_buffer", Buffer.alloc(10));
1259
+ form.append("my_file", fs.createReadStream("/foo/bar.jpg"));
1260
+
1261
+ axios.post("https://example.com", form);
1262
+ ```
1263
+
1264
+ ### 🆕 Automatic serialization to FormData
1265
+
1266
+ Starting from `v0.27.0`, Axios supports automatic object serialization to a FormData object if the request `Content-Type`
1267
+ header is set to `multipart/form-data`.
1268
+
1269
+ The following request will submit the data in a FormData format (Browser & Node.js):
1270
+
1271
+ ```js
1272
+ import axios from "axios";
1273
+
1274
+ axios
1275
+ .post(
1276
+ "https://httpbin.org/post",
1277
+ { x: 1 },
1278
+ {
1279
+ headers: {
1280
+ "Content-Type": "multipart/form-data",
1281
+ },
1282
+ },
1283
+ )
1284
+ .then(({ data }) => console.log(data));
1285
+ ```
1286
+
1287
+ In the `node.js` build, the ([`form-data`](https://github.com/form-data/form-data)) polyfill is used by default.
1288
+
1289
+ You can overload the FormData class by setting the `env.FormData` config variable,
1290
+ but you probably won't need it in most cases:
1291
+
1292
+ ```js
1293
+ const axios = require("axios");
1294
+ var FormData = require("form-data");
1295
+
1296
+ axios
1297
+ .post(
1298
+ "https://httpbin.org/post",
1299
+ { x: 1, buf: Buffer.alloc(10) },
1300
+ {
1301
+ headers: {
1302
+ "Content-Type": "multipart/form-data",
1303
+ },
1304
+ },
1305
+ )
1306
+ .then(({ data }) => console.log(data));
1307
+ ```
1308
+
1309
+ Axios FormData serializer supports some special endings to perform the following operations:
1310
+
1311
+ - `{}` - serialize the value with JSON.stringify
1312
+ - `[]` - unwrap the array-like object as separate fields with the same key
1313
+
1314
+ > **Note**: unwrap/expand operation will be used by default on arrays and FileList objects
1315
+
1316
+ FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases:
1317
+
1318
+ - `visitor: Function` - user-defined visitor function that will be called recursively to serialize the data object
1319
+ to a `FormData` object by following custom rules.
1320
+
1321
+ - `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects;
1322
+
1323
+ - `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key.
1324
+ The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON.
1325
+
1326
+ - `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects.
1327
+ - `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`)
1328
+ - `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`)
1329
+ - `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`)
1330
+
1331
+ Let's say we have an object like this one:
1332
+
1333
+ ```js
1334
+ const obj = {
1335
+ x: 1,
1336
+ arr: [1, 2, 3],
1337
+ arr2: [1, [2], 3],
1338
+ users: [
1339
+ { name: "Peter", surname: "Griffin" },
1340
+ { name: "Thomas", surname: "Anderson" },
1341
+ ],
1342
+ "obj2{}": [{ x: 1 }],
1343
+ };
1344
+ ```
1345
+
1346
+ The following steps will be executed by the Axios serializer internally:
1347
+
1348
+ ```js
1349
+ const formData = new FormData();
1350
+ formData.append("x", "1");
1351
+ formData.append("arr[]", "1");
1352
+ formData.append("arr[]", "2");
1353
+ formData.append("arr[]", "3");
1354
+ formData.append("arr2[0]", "1");
1355
+ formData.append("arr2[1][0]", "2");
1356
+ formData.append("arr2[2]", "3");
1357
+ formData.append("users[0][name]", "Peter");
1358
+ formData.append("users[0][surname]", "Griffin");
1359
+ formData.append("users[1][name]", "Thomas");
1360
+ formData.append("users[1][surname]", "Anderson");
1361
+ formData.append("obj2{}", '[{"x":1}]');
1362
+ ```
1363
+
1364
+ Axios supports the following shortcut methods: `postForm`, `putForm`, `patchForm`
1365
+ which are just the corresponding http methods with the `Content-Type` header preset to `multipart/form-data`.
1366
+
1367
+ ## Files Posting
1368
+
1369
+ You can easily submit a single file:
1370
+
1371
+ ```js
1372
+ await axios.postForm("https://httpbin.org/post", {
1373
+ myVar: "foo",
1374
+ file: document.querySelector("#fileInput").files[0],
1375
+ });
1376
+ ```
1377
+
1378
+ or multiple files as `multipart/form-data`:
1379
+
1380
+ ```js
1381
+ await axios.postForm("https://httpbin.org/post", {
1382
+ "files[]": document.querySelector("#fileInput").files,
1383
+ });
1384
+ ```
1385
+
1386
+ `FileList` object can be passed directly:
1387
+
1388
+ ```js
1389
+ await axios.postForm(
1390
+ "https://httpbin.org/post",
1391
+ document.querySelector("#fileInput").files,
1392
+ );
1393
+ ```
1394
+
1395
+ All files will be sent with the same field names: `files[]`.
1396
+
1397
+ ## 🆕 HTML Form Posting (browser)
1398
+
1399
+ Pass an HTML Form element as a payload to submit it as `multipart/form-data` content.
1400
+
1401
+ ```js
1402
+ await axios.postForm(
1403
+ "https://httpbin.org/post",
1404
+ document.querySelector("#htmlForm"),
1405
+ );
1406
+ ```
1407
+
1408
+ `FormData` and `HTMLForm` objects can also be posted as `JSON` by explicitly setting the `Content-Type` header to `application/json`:
1409
+
1410
+ ```js
1411
+ await axios.post(
1412
+ "https://httpbin.org/post",
1413
+ document.querySelector("#htmlForm"),
1414
+ {
1415
+ headers: {
1416
+ "Content-Type": "application/json",
1417
+ },
1418
+ },
1419
+ );
1420
+ ```
1421
+
1422
+ For example, the Form
1423
+
1424
+ ```html
1425
+ <form id="form">
1426
+ <input type="text" name="foo" value="1" />
1427
+ <input type="text" name="deep.prop" value="2" />
1428
+ <input type="text" name="deep prop spaced" value="3" />
1429
+ <input type="text" name="baz" value="4" />
1430
+ <input type="text" name="baz" value="5" />
1431
+
1432
+ <select name="user.age">
1433
+ <option value="value1">Value 1</option>
1434
+ <option value="value2" selected>Value 2</option>
1435
+ <option value="value3">Value 3</option>
1436
+ </select>
1437
+
1438
+ <input type="submit" value="Save" />
1439
+ </form>
1440
+ ```
1441
+
1442
+ will be submitted as the following JSON object:
1443
+
1444
+ ```js
1445
+ {
1446
+ "foo": "1",
1447
+ "deep": {
1448
+ "prop": {
1449
+ "spaced": "3"
1450
+ }
1451
+ },
1452
+ "baz": [
1453
+ "4",
1454
+ "5"
1455
+ ],
1456
+ "user": {
1457
+ "age": "value2"
1458
+ }
1459
+ }
1460
+ ```
1461
+
1462
+ Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported.
1463
+
1464
+ ## 🆕 Progress capturing
1465
+
1466
+ Axios supports both browser and node environments to capture request upload/download progress.
1467
+ The frequency of progress events is forced to be limited to `3` times per second.
1468
+
1469
+ ```js
1470
+ await axios.post(url, data, {
1471
+ onUploadProgress: function (axiosProgressEvent) {
1472
+ /*{
1473
+ loaded: number;
1474
+ total?: number;
1475
+ progress?: number; // in range [0..1]
1476
+ bytes: number; // how many bytes have been transferred since the last trigger (delta)
1477
+ estimated?: number; // estimated time in seconds
1478
+ rate?: number; // upload speed in bytes
1479
+ upload: true; // upload sign
1480
+ }*/
1481
+ },
1482
+
1483
+ onDownloadProgress: function (axiosProgressEvent) {
1484
+ /*{
1485
+ loaded: number;
1486
+ total?: number;
1487
+ progress?: number;
1488
+ bytes: number;
1489
+ estimated?: number;
1490
+ rate?: number; // download speed in bytes
1491
+ download: true; // download sign
1492
+ }*/
1493
+ },
1494
+ });
1495
+ ```
1496
+
1497
+ You can also track stream upload/download progress in node.js:
1498
+
1499
+ ```js
1500
+ const { data } = await axios.post(SERVER_URL, readableStream, {
1501
+ onUploadProgress: ({ progress }) => {
1502
+ console.log((progress * 100).toFixed(2));
1503
+ },
1504
+
1505
+ headers: {
1506
+ "Content-Length": contentLength,
1507
+ },
1508
+
1509
+ maxRedirects: 0, // avoid buffering the entire stream
1510
+ });
1511
+ ```
1512
+
1513
+ > **Note:**
1514
+ > Capturing FormData upload progress is not currently supported in node.js environments.
1515
+
1516
+ > **⚠️ Warning**
1517
+ > It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment,
1518
+ > as the follow-redirects package will buffer the entire stream in RAM without following the "backpressure" algorithm.
1519
+
1520
+ ## 🆕 Rate limiting
1521
+
1522
+ Download and upload rate limits can only be set for the http adapter (node.js):
1523
+
1524
+ ```js
1525
+ const { data } = await axios.post(LOCAL_SERVER_URL, myBuffer, {
1526
+ onUploadProgress: ({ progress, rate }) => {
1527
+ console.log(
1528
+ `Upload [${(progress * 100).toFixed(2)}%]: ${(rate / 1024).toFixed(2)}KB/s`,
1529
+ );
1530
+ },
1531
+
1532
+ maxRate: [100 * 1024], // 100KB/s limit
1533
+ });
1534
+ ```
1535
+
1536
+ ## 🆕 AxiosHeaders
1537
+
1538
+ Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work.
1539
+ Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons
1540
+ and as a workaround when servers mistakenly consider the header's case.
1541
+ The old approach of directly manipulating the headers object is still available, but deprecated and not recommended for future usage.
1542
+
1543
+ ### Working with headers
1544
+
1545
+ An AxiosHeaders object instance can contain different types of internal values. that control setting and merging logic.
1546
+ The final headers object with string values is obtained by Axios by calling the `toJSON` method.
1547
+
1548
+ > Note: By JSON here we mean an object consisting only of string values intended to be sent over the network.
1549
+
1550
+ The header value can be one of the following types:
1551
+
1552
+ - `string` - normal string value that will be sent to the server
1553
+ - `null` - skip header when rendering to JSON
1554
+ - `false` - skip header when rendering to JSON, additionally indicates that `set` method must be called with `rewrite` option set to `true`
1555
+ to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`)
1556
+ - `undefined` - value is not set
1557
+
1558
+ > Note: The header value is considered set if it is not equal to undefined.
1559
+
1560
+ The headers object is always initialized inside interceptors and transformers:
1561
+
1562
+ ```ts
1563
+ axios.interceptors.request.use((request: InternalAxiosRequestConfig) => {
1564
+ request.headers.set("My-header", "value");
1565
+
1566
+ request.headers.set({
1567
+ "My-set-header1": "my-set-value1",
1568
+ "My-set-header2": "my-set-value2",
1569
+ });
1570
+
1571
+ request.headers.set("User-Agent", false); // disable subsequent setting the header by Axios
1572
+
1573
+ request.headers.setContentType("text/plain");
1574
+
1575
+ request.headers["My-set-header2"] = "newValue"; // direct access is deprecated
1576
+
1577
+ return request;
1578
+ });
1579
+ ```
1580
+
1581
+ You can iterate over an `AxiosHeaders` instance using a `for...of` statement:
1582
+
1583
+ ```js
1584
+ const headers = new AxiosHeaders({
1585
+ foo: "1",
1586
+ bar: "2",
1587
+ baz: "3",
1588
+ });
1589
+
1590
+ for (const [header, value] of headers) {
1591
+ console.log(header, value);
1592
+ }
1593
+
1594
+ // foo 1
1595
+ // bar 2
1596
+ // baz 3
1597
+ ```
1598
+
1599
+ ### Preserving a specific header case
1600
+
1601
+ Header names are case-insensitive, but `AxiosHeaders` keeps the case of the first matching key it sees.
1602
+ If you need a specific case for non-standard case-sensitive servers, define a case preset with `undefined` and then set the value later:
1603
+
1604
+ ```js
1605
+ const api = axios.create();
1606
+
1607
+ api.defaults.headers.common = {
1608
+ 'content-type': undefined,
1609
+ accept: undefined,
1610
+ };
1611
+
1612
+ await api.put(url, data, {
1613
+ headers: {
1614
+ 'Content-Type': 'application/octet-stream',
1615
+ Accept: 'application/json',
1616
+ },
1617
+ });
1618
+ ```
1619
+
1620
+ You can also compose the same behavior with `AxiosHeaders.concat`:
1621
+
1622
+ ```js
1623
+ const headers = axios.AxiosHeaders.concat(
1624
+ { 'content-type': undefined },
1625
+ { 'Content-Type': 'application/octet-stream' }
1626
+ );
1627
+
1628
+ await axios.put(url, data, { headers });
1629
+ ```
1630
+
1631
+ ### new AxiosHeaders(headers?)
1632
+
1633
+ Constructs a new `AxiosHeaders` instance.
1634
+
1635
+ ```
1636
+ constructor(headers?: RawAxiosHeaders | AxiosHeaders | string);
1637
+ ```
1638
+
1639
+ If the headers object is a string, it will be parsed as RAW HTTP headers.
1640
+
1641
+ ```js
1642
+ const headers = new AxiosHeaders(`
1643
+ Host: www.bing.com
1644
+ User-Agent: curl/7.54.0
1645
+ Accept: */*`);
1646
+
1647
+ console.log(headers);
1648
+
1649
+ // Object [AxiosHeaders] {
1650
+ // host: 'www.bing.com',
1651
+ // 'user-agent': 'curl/7.54.0',
1652
+ // accept: '*/*'
1653
+ // }
1654
+ ```
1655
+
1656
+ ### AxiosHeaders#set
1657
+
1658
+ ```ts
1659
+ set(headerName, value: Axios, rewrite?: boolean);
1660
+ set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean);
1661
+ set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean);
1662
+ ```
1663
+
1664
+ The `rewrite` argument controls the overwriting behavior:
1665
+
1666
+ - `false` - do not overwrite if the header's value is set (is not `undefined`)
1667
+ - `undefined` (default) - overwrite the header unless its value is set to `false`
1668
+ - `true` - rewrite anyway
1669
+
1670
+ The option can also accept a user-defined function that determines whether the value should be overwritten or not.
1671
+
1672
+ Returns `this`.
1673
+
1674
+ ### AxiosHeaders#get(header)
1675
+
1676
+ ```
1677
+ get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue;
1678
+ get(headerName: string, parser: RegExp): RegExpExecArray | null;
1679
+ ```
1680
+
1681
+ Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`,
1682
+ matcher function or internal key-value parser.
1683
+
1684
+ ```ts
1685
+ const headers = new AxiosHeaders({
1686
+ "Content-Type": "multipart/form-data; boundary=Asrf456BGe4h",
1687
+ });
1688
+
1689
+ console.log(headers.get("Content-Type"));
1690
+ // multipart/form-data; boundary=Asrf456BGe4h
1691
+
1692
+ console.log(headers.get("Content-Type", true)); // parse key-value pairs from a string separated with \s,;= delimiters:
1693
+ // [Object: null prototype] {
1694
+ // 'multipart/form-data': undefined,
1695
+ // boundary: 'Asrf456BGe4h'
1696
+ // }
1697
+
1698
+ console.log(
1699
+ headers.get("Content-Type", (value, name, headers) => {
1700
+ return String(value).replace(/a/g, "ZZZ");
1701
+ }),
1702
+ );
1703
+ // multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h
1704
+
1705
+ console.log(headers.get("Content-Type", /boundary=(\w+)/)?.[0]);
1706
+ // boundary=Asrf456BGe4h
1707
+ ```
1708
+
1709
+ Returns the value of the header.
1710
+
1711
+ ### AxiosHeaders#has(header, matcher?)
1712
+
1713
+ ```
1714
+ has(header: string, matcher?: AxiosHeaderMatcher): boolean;
1715
+ ```
1716
+
1717
+ Returns `true` if the header is set (has no `undefined` value).
1718
+
1719
+ ### AxiosHeaders#delete(header, matcher?)
1720
+
1721
+ ```
1722
+ delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;
1723
+ ```
1724
+
1725
+ Returns `true` if at least one header has been removed.
1726
+
1727
+ ### AxiosHeaders#clear(matcher?)
1728
+
1729
+ ```
1730
+ clear(matcher?: AxiosHeaderMatcher): boolean;
1731
+ ```
1732
+
1733
+ Removes all headers.
1734
+ Unlike the `delete` method matcher, this optional matcher will be used to match against the header name rather than the value.
1735
+
1736
+ ```ts
1737
+ const headers = new AxiosHeaders({
1738
+ foo: "1",
1739
+ "x-foo": "2",
1740
+ "x-bar": "3",
1741
+ });
1742
+
1743
+ console.log(headers.clear(/^x-/)); // true
1744
+
1745
+ console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' }
1746
+ ```
1747
+
1748
+ Returns `true` if at least one header has been cleared.
1749
+
1750
+ ### AxiosHeaders#normalize(format);
1751
+
1752
+ If the headers object was changed directly, it can have duplicates with the same name but in different cases.
1753
+ This method normalizes the headers object by combining duplicate keys into one.
1754
+ Axios uses this method internally after calling each interceptor.
1755
+ Set `format` to true for converting header names to lowercase and capitalizing the initial letters (`cOntEnt-type` => `Content-Type`)
1756
+
1757
+ ```js
1758
+ const headers = new AxiosHeaders({
1759
+ foo: "1",
1760
+ });
1761
+
1762
+ headers.Foo = "2";
1763
+ headers.FOO = "3";
1764
+
1765
+ console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' }
1766
+ console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' }
1767
+ console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' }
1768
+ ```
1769
+
1770
+ Returns `this`.
1771
+
1772
+ ### AxiosHeaders#concat(...targets)
1773
+
1774
+ ```
1775
+ concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
1776
+ ```
1777
+
1778
+ Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, it will be parsed as RAW HTTP headers.
1779
+
1780
+ Returns a new `AxiosHeaders` instance.
1781
+
1782
+ ### AxiosHeaders#toJSON(asStrings?)
1783
+
1784
+ ```
1785
+ toJSON(asStrings?: boolean): RawAxiosHeaders;
1786
+ ```
1787
+
1788
+ Resolve all internal header values into a new null prototype object.
1789
+ Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas.
1790
+
1791
+ ### AxiosHeaders.from(thing?)
1792
+
1793
+ ```
1794
+ from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;
1795
+ ```
1796
+
1797
+ Returns a new `AxiosHeaders` instance created from the raw headers passed in,
1798
+ or simply returns the given headers object if it's an `AxiosHeaders` instance.
1799
+
1800
+ ### AxiosHeaders.concat(...targets)
1801
+
1802
+ ```
1803
+ concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;
1804
+ ```
1805
+
1806
+ Returns a new `AxiosHeaders` instance created by merging the target objects.
1807
+
1808
+ ### Shortcuts
1809
+
1810
+ The following shortcuts are available:
1811
+
1812
+ - `setContentType`, `getContentType`, `hasContentType`
1813
+
1814
+ - `setContentLength`, `getContentLength`, `hasContentLength`
1815
+
1816
+ - `setAccept`, `getAccept`, `hasAccept`
1817
+
1818
+ - `setUserAgent`, `getUserAgent`, `hasUserAgent`
1819
+
1820
+ - `setContentEncoding`, `getContentEncoding`, `hasContentEncoding`
1821
+
1822
+ ## 🔥 Fetch adapter
1823
+
1824
+ Fetch adapter was introduced in `v1.7.0`. By default, it will be used if `xhr` and `http` adapters are not available in the build,
1825
+ or not supported by the environment.
1826
+ To use it by default, it must be selected explicitly:
1827
+
1828
+ ```js
1829
+ const { data } = axios.get(url, {
1830
+ adapter: "fetch", // by default ['xhr', 'http', 'fetch']
1831
+ });
1832
+ ```
1833
+
1834
+ You can create a separate instance for this:
1835
+
1836
+ ```js
1837
+ const fetchAxios = axios.create({
1838
+ adapter: "fetch",
1839
+ });
1840
+
1841
+ const { data } = fetchAxios.get(url);
1842
+ ```
1843
+
1844
+ The adapter supports the same functionality as the `xhr` adapter, **including upload and download progress capturing**.
1845
+ Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment).
1846
+
1847
+ ### 🔥 Custom fetch
1848
+
1849
+ Starting from `v1.12.0`, you can customize the fetch adapter to use a custom fetch API instead of environment globals.
1850
+ You can pass a custom `fetch` function, `Request`, and `Response` constructors via env config.
1851
+ This can be helpful in case of custom environments & app frameworks.
1852
+
1853
+ Also, when using a custom fetch, you may need to set custom Request and Response too. If you don't set them, global objects will be used.
1854
+ If your custom fetch api does not have these objects, and the globals are incompatible with a custom fetch,
1855
+ you must disable their use inside the fetch adapter by passing null.
1856
+
1857
+ > Note: Setting `Request` & `Response` to `null` will make it impossible for the fetch adapter to capture the upload & download progress.
1858
+
1859
+ Basic example:
1860
+
1861
+ ```js
1862
+ import customFetchFunction from "customFetchModule";
1863
+
1864
+ const instance = axios.create({
1865
+ adapter: "fetch",
1866
+ onDownloadProgress(e) {
1867
+ console.log("downloadProgress", e);
1868
+ },
1869
+ env: {
1870
+ fetch: customFetchFunction,
1871
+ Request: null, // undefined -> use the global constructor
1872
+ Response: null,
1873
+ },
1874
+ });
1875
+ ```
1876
+
1877
+ #### 🔥 Using with Tauri
1878
+
1879
+ A minimal example of setting up Axios for use in a [Tauri](https://tauri.app/plugin/http-client/) app with a platform fetch function that ignores CORS policy for requests.
1880
+
1881
+ ```js
1882
+ import { fetch } from "@tauri-apps/plugin-http";
1883
+ import axios from "axios";
1884
+
1885
+ const instance = axios.create({
1886
+ adapter: "fetch",
1887
+ onDownloadProgress(e) {
1888
+ console.log("downloadProgress", e);
1889
+ },
1890
+ env: {
1891
+ fetch,
1892
+ },
1893
+ });
1894
+
1895
+ const { data } = await instance.get("https://google.com");
1896
+ ```
1897
+
1898
+ #### 🔥 Using with SvelteKit
1899
+
1900
+ [SvelteKit](https://svelte.dev/docs/kit/web-standards#Fetch-APIs) framework has a custom implementation of the fetch function for server rendering (so called `load` functions), and also uses relative paths,
1901
+ which makes it incompatible with the standard URL API. So, Axios must be configured to use the custom fetch API:
1902
+
1903
+ ```js
1904
+ export async function load({ fetch }) {
1905
+ const { data: post } = await axios.get(
1906
+ "https://jsonplaceholder.typicode.com/posts/1",
1907
+ {
1908
+ adapter: "fetch",
1909
+ env: {
1910
+ fetch,
1911
+ Request: null,
1912
+ Response: null,
1913
+ },
1914
+ },
1915
+ );
1916
+
1917
+ return { post };
1918
+ }
1919
+ ```
1920
+
1921
+ #### HTTP/2 Support
1922
+
1923
+ Axios supports HTTP/2 via the Node.js `http` adapter (introduced in v1.13.0).
1924
+
1925
+ This support depends on the runtime environment. Since Axios relies on Node.js APIs, HTTP/2 functionality is available in supported Node.js versions, but may not work in other environments (such as Bun or Deno).
1926
+
1927
+ Options like `httpVersion` and `http2Options` are adapter-specific and may not behave consistently across all environments.
1928
+
1929
+ Note: HTTP/2 redirects are currently not supported by the HTTP/2 adapter.
1930
+
1931
+ ```js
1932
+ const form = new FormData();
1933
+
1934
+ form.append("foo", "123");
1935
+
1936
+ const { data, headers, status } = await axios.post(
1937
+ "https://httpbin.org/post",
1938
+ form,
1939
+ {
1940
+ onUploadProgress(e) {
1941
+ console.log("upload progress", e);
1942
+ },
1943
+ onDownloadProgress(e) {
1944
+ console.log("download progress", e);
1945
+ },
1946
+ responseType: "arraybuffer",
1947
+ }
1948
+ );
1949
+ ```
1950
+
1951
+ ## Semver
1952
+
1953
+ Since Axios has reached a `v.1.0.0` we will fully embrace semver as per the spec [here](https://semver.org/)
1954
+
1955
+ ## Promises
1956
+
1957
+ axios depends on a native ES6 Promise implementation to be [supported](https://caniuse.com/promises).
1958
+ If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise).
1959
+
1960
+ ## TypeScript
1961
+
1962
+ axios includes [TypeScript](https://typescriptlang.org) definitions and a type guard for axios errors.
1963
+
1964
+ ```typescript
1965
+ let user: User = null;
1966
+ try {
1967
+ const { data } = await axios.get("/user?ID=12345");
1968
+ user = data.userDetails;
1969
+ } catch (error) {
1970
+ if (axios.isAxiosError(error)) {
1971
+ handleAxiosError(error);
1972
+ } else {
1973
+ handleUnexpectedError(error);
1974
+ }
1975
+ }
1976
+ ```
1977
+
1978
+ Because axios dual publishes with an ESM default export and a CJS `module.exports`, there are some caveats.
1979
+ The recommended setting is to use `"moduleResolution": "node16"` (this is implied by `"module": "node16"`). Note that this requires TypeScript 4.7 or greater.
1980
+ If use ESM, your settings should be fine.
1981
+ If you compile TypeScript to CJS and you can’t use `"moduleResolution": "node 16"`, you have to enable `esModuleInterop`.
1982
+ If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`.
1983
+
1984
+ You can also create a custom instance with typed interceptors:
1985
+
1986
+ ```typescript
1987
+ import axios, { AxiosInstance, InternalAxiosRequestConfig } from "axios";
1988
+
1989
+ const apiClient: AxiosInstance = axios.create({
1990
+ baseURL: "https://api.example.com",
1991
+ timeout: 10000,
1992
+ });
1993
+
1994
+ apiClient.interceptors.request.use((config: InternalAxiosRequestConfig) => {
1995
+ // Add auth token
1996
+ return config;
1997
+ });
1998
+ ```
1999
+
2000
+ ## Online one-click setup
2001
+
2002
+ You can use Gitpod, an online IDE(which is free for Open Source) for contributing or running the examples online.
2003
+
2004
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/main/examples/server.js)
2005
+
2006
+ ## Resources
2007
+
2008
+ - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
2009
+ - [Ecosystem](https://github.com/axios/axios/blob/v1.x/ECOSYSTEM.md)
2010
+ - [Contributing Guide](https://github.com/axios/axios/blob/v1.x/CONTRIBUTING.md)
2011
+ - [Code of Conduct](https://github.com/axios/axios/blob/v1.x/CODE_OF_CONDUCT.md)
2012
+
2013
+ ## Credits
2014
+
2015
+ axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS.
2016
+
2017
+ ## License
2018
+
2019
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
scripts/node_modules/axios/dist/axios.js ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/axios.js.map ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/axios.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,function(){"use strict";function e(e,t){this.v=e,this.k=t}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(t){var n={},r=!1;function o(n,o){return r=!0,o=new Promise(function(e){e(t[n](o))}),{done:!1,value:new e(o,1)}}return n["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},n.next=function(e){return r?(r=!1,e):o("next",e)},"function"==typeof t.throw&&(n.throw=function(e){if(r)throw r=!1,e;return o("throw",e)}),"function"==typeof t.return&&(n.return=function(e){return r?(r=!1,e):o("return",e)}),n}function r(e){var t,n,r,i=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&null!=(t=e[n]))return t.call(e);if(r&&null!=(t=e[r]))return new o(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function o(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then(function(e){return{value:e,done:t}})}return o=function(e){this.s=e,this.n=e.next},o.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var n=this.s.return;return void 0===n?Promise.resolve({value:e,done:!0}):t(n.apply(this.s,arguments))},throw:function(e){var n=this.s.return;return void 0===n?Promise.reject(e):t(n.apply(this.s,arguments))}},new o(e)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,o)}function a(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,s,"next",e)}function s(e){i(a,r,o,u,s,"throw",e)}u(void 0)})}}function u(t){return new e(t,0)}function s(e,t,n){return t=p(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,v()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,S(r.key),r)}}function l(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m(){
3
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
4
+ var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var s=r&&r.prototype instanceof u?r:u,c=Object.create(s.prototype);return g(c,"_invoke",function(n,r,o){var i,u,s,c=0,f=o||[],l=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,u=0,s=e,d.n=n,a}};function p(n,r){for(u=n,s=r,t=0;!l&&c&&!o&&t<f.length;t++){var o,i=f[t],p=d.p,h=i[2];n>3?(o=h===r)&&(s=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,d.v=r,d.n=i[1]):p<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,d.n=h,u=0))}if(o||n>1)return a;throw l=!0,r}return function(o,f,h){if(c>1)throw TypeError("Generator is already running");for(l&&1===f&&p(f,h),u=f,s=h;(t=u<2?e:s)||!l;){i||(u?u<3?(u>1&&(d.n=-1),p(u,s)):d.n=s:d.v=s);try{if(c=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(l=d.n<0)?s:n.call(r,d))!==a)break}catch(t){i=e,u=1,s=t}finally{c=1}}return{value:t,done:l}}}(n,o,i),!0),c}var a={};function u(){}function s(){}function c(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(g(t={},r,function(){return this}),t),l=c.prototype=u.prototype=Object.create(f);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,g(e,o,"GeneratorFunction")),e.prototype=Object.create(l),e}return s.prototype=c,g(l,"constructor",c),g(c,"constructor",s),s.displayName="GeneratorFunction",g(c,o,"GeneratorFunction"),g(l),g(l,o,"Generator"),g(l,r,function(){return this}),g(l,"toString",function(){return"[object Generator]"}),(m=function(){return{w:i,m:d}})()}function g(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}g=function(e,t,n,r){function i(t,n){g(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},g(e,t,n,r)}function w(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function A(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function j(e){return function(){return new k(e.apply(this,arguments))}}function k(t){var n,r;function o(n,r){try{var a=t[n](r),u=a.value,s=u instanceof e;Promise.resolve(s?u.v:u).then(function(e){if(s){var r="return"===n?"return":"next";if(!u.k||e.done)return o(r,e);e=t[r](e).value}i(a.done?"return":"normal",e)},function(e){o("throw",e)})}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":n.resolve({value:t,done:!0});break;case"throw":n.reject(t);break;default:n.resolve({value:t,done:!1})}(n=n.next)?o(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(i,a){var u={key:e,arg:t,resolve:i,reject:a,next:null};r?r=r.next=u:(n=r=u,o(e,t))})},"function"!=typeof t.return&&(this.return=void 0)}function P(e){var t="function"==typeof Map?new Map:void 0;return P=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(v())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&O(o,n.prototype),o}(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),O(n,e)},P(e)}function _(e,t){return function(){return e.apply(t,arguments)}}k.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},k.prototype.next=function(e){return this._invoke("next",e)},k.prototype.throw=function(e){return this._invoke("throw",e)},k.prototype.return=function(e){return this._invoke("return",e)};var x,N=Object.prototype.toString,C=Object.getPrototypeOf,U=Symbol.iterator,F=Symbol.toStringTag,D=(x=Object.create(null),function(e){var t=N.call(e);return x[t]||(x[t]=t.slice(8,-1).toLowerCase())}),B=function(e){return e=e.toLowerCase(),function(t){return D(t)===e}},L=function(e){return function(t){return T(t)===e}},I=Array.isArray,q=L("undefined");function M(e){return null!==e&&!q(e)&&null!==e.constructor&&!q(e.constructor)&&J(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var z=B("ArrayBuffer");var H=L("string"),J=L("function"),W=L("number"),K=function(e){return null!==e&&"object"===T(e)},V=function(e){if("object"!==D(e))return!1;var t=C(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||F in e||U in e)},G=B("Date"),X=B("File"),$=B("Blob"),Q=B("FileList");var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Z=void 0!==Y.FormData?Y.FormData:void 0,ee=B("URLSearchParams"),te=E(["ReadableStream","Request","Response","Headers"].map(B),4),ne=te[0],re=te[1],oe=te[2],ie=te[3];function ae(e,t){var n,r,o=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,i=void 0!==o&&o;if(null!=e)if("object"!==T(e)&&(e=[e]),I(e))for(n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else{if(M(e))return;var a,u=i?Object.getOwnPropertyNames(e):Object.keys(e),s=u.length;for(n=0;n<s;n++)a=u[n],t.call(null,e[a],a,e)}}function ue(e,t){if(M(e))return null;t=t.toLowerCase();for(var n,r=Object.keys(e),o=r.length;o-- >0;)if(t===(n=r[o]).toLowerCase())return n;return null}var se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ce=function(e){return!q(e)&&e!==se};var fe,le=(fe="undefined"!=typeof Uint8Array&&C(Uint8Array),function(e){return fe&&e instanceof fe}),de=B("HTMLFormElement"),pe=function(){var e=Object.prototype.hasOwnProperty;return function(t,n){return e.call(t,n)}}(),he=B("RegExp"),ve=function(e,t){var n=Object.getOwnPropertyDescriptors(e),r={};ae(n,function(n,o){var i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};var ye,be,me,ge,we=B("AsyncFunction"),Oe=(ye="function"==typeof setImmediate,be=J(se.postMessage),ye?setImmediate:be?(me="axios@".concat(Math.random()),ge=[],se.addEventListener("message",function(e){var t=e.source,n=e.data;t===se&&n===me&&ge.length&&ge.shift()()},!1),function(e){ge.push(e),se.postMessage(me,"*")}):function(e){return setTimeout(e)}),Ee="undefined"!=typeof queueMicrotask?queueMicrotask.bind(se):"undefined"!=typeof process&&process.nextTick||Oe,Re={isArray:I,isArrayBuffer:z,isBuffer:M,isFormData:function(e){var t;return e&&(Z&&e instanceof Z||J(e.append)&&("formdata"===(t=D(e))||"object"===t&&J(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&z(e.buffer)},isString:H,isNumber:W,isBoolean:function(e){return!0===e||!1===e},isObject:K,isPlainObject:V,isEmptyObject:function(e){if(!K(e)||M(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ne,isRequest:re,isResponse:oe,isHeaders:ie,isUndefined:q,isDate:G,isFile:X,isReactNativeBlob:function(e){return!(!e||void 0===e.uri)},isReactNative:function(e){return e&&void 0!==e.getParts},isBlob:$,isRegExp:he,isFunction:J,isStream:function(e){return K(e)&&J(e.pipe)},isURLSearchParams:ee,isTypedArray:le,isFileList:Q,forEach:ae,merge:function e(){for(var t=ce(this)&&this||{},n=t.caseless,r=t.skipUndefined,o={},i=function(t,i){if("__proto__"!==i&&"constructor"!==i&&"prototype"!==i){var a=n&&ue(o,i)||i;V(o[a])&&V(t)?o[a]=e(o[a],t):V(t)?o[a]=e({},t):I(t)?o[a]=t.slice():r&&q(t)||(o[a]=t)}},a=0,u=arguments.length;a<u;a++)arguments[a]&&ae(arguments[a],i);return o},extend:function(e,t,n){return ae(t,function(t,r){n&&J(t)?Object.defineProperty(e,r,{value:_(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).allOwnKeys}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,n,r){e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:function(e,t,n,r){var o,i,a,u={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],r&&!r(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==n&&C(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:D,kindOfTest:B,endsWith:function(e,t,n){e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;var r=e.indexOf(t,n);return-1!==r&&r===n},toArray:function(e){if(!e)return null;if(I(e))return e;var t=e.length;if(!W(t))return null;for(var n=new Array(t);t-- >0;)n[t]=e[t];return n},forEachEntry:function(e,t){for(var n,r=(e&&e[U]).call(e);(n=r.next())&&!n.done;){var o=n.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var n,r=[];null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:de,hasOwnProperty:pe,hasOwnProp:pe,reduceDescriptors:ve,freezeMethods:function(e){ve(e,function(t,n){if(J(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;var r=e[n];J(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:function(e,t){var n={},r=function(e){e.forEach(function(e){n[e]=!0})};return I(e)?r(e):r(String(e).split(t)),n},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:ue,global:se,isContextDefined:ce,isSpecCompliantForm:function(e){return!!(e&&J(e.append)&&"FormData"===e[F]&&e[U])},toJSONObject:function(e){var t=new Array(10),n=function(e,r){if(K(e)){if(t.indexOf(e)>=0)return;if(M(e))return e;if(!("toJSON"in e)){t[r]=e;var o=I(e)?[]:{};return ae(e,function(e,t){var i=n(e,r+1);!q(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:we,isThenable:function(e){return e&&(K(e)||J(e))&&J(e.then)&&J(e.catch)},setImmediate:Oe,asap:Ee,isIterable:function(e){return null!=e&&J(e[U])}},Se=function(e){function t(e,n,r,o,i){var a;return c(this,t),a=s(this,t,[e]),Object.defineProperty(a,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),a.name="AxiosError",a.isAxiosError=!0,n&&(a.code=n),r&&(a.config=r),o&&(a.request=o),i&&(a.response=i,a.status=i.status),a}return h(t,e),l(t,[{key:"toJSON",value:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Re.toJSONObject(this.config),code:this.code,status:this.status}}}],[{key:"from",value:function(e,n,r,o,i,a){var u=new t(e.message,n||e.code,r,o,i);return u.cause=e,u.name=e.name,null!=e.status&&null==u.status&&(u.status=e.status),a&&Object.assign(u,a),u}}])}(P(Error));Se.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Se.ERR_BAD_OPTION="ERR_BAD_OPTION",Se.ECONNABORTED="ECONNABORTED",Se.ETIMEDOUT="ETIMEDOUT",Se.ERR_NETWORK="ERR_NETWORK",Se.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Se.ERR_DEPRECATED="ERR_DEPRECATED",Se.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Se.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Se.ERR_CANCELED="ERR_CANCELED",Se.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Se.ERR_INVALID_URL="ERR_INVALID_URL";function Te(e){return Re.isPlainObject(e)||Re.isArray(e)}function Ae(e){return Re.endsWith(e,"[]")?e.slice(0,-2):e}function je(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ae(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}var ke=Re.toFlatObject(Re,{},null,function(e){return/^is[A-Z]/.test(e)});function Pe(e,t,n){if(!Re.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var r=(n=Re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Re.isUndefined(t[e])})).metaTokens,o=n.visitor||c,i=n.dots,a=n.indexes,u=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Re.isSpecCompliantForm(t);if(!Re.isFunction(o))throw new TypeError("visitor must be a function");function s(e){if(null===e)return"";if(Re.isDate(e))return e.toISOString();if(Re.isBoolean(e))return e.toString();if(!u&&Re.isBlob(e))throw new Se("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(e)||Re.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,n,o){var u=e;if(Re.isReactNative(t)&&Re.isReactNativeBlob(e))return t.append(je(o,n,i),s(e)),!1;if(e&&!o&&"object"===T(e))if(Re.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Re.isArray(e)&&function(e){return Re.isArray(e)&&!e.some(Te)}(e)||(Re.isFileList(e)||Re.endsWith(n,"[]"))&&(u=Re.toArray(e)))return n=Ae(n),u.forEach(function(e,r){!Re.isUndefined(e)&&null!==e&&t.append(!0===a?je([n],r,i):null===a?n:n+"[]",s(e))}),!1;return!!Te(e)||(t.append(je(o,n,i),s(e)),!1)}var f=[],l=Object.assign(ke,{defaultVisitor:c,convertValue:s,isVisitable:Te});if(!Re.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Re.isUndefined(n)){if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),Re.forEach(n,function(n,i){!0===(!(Re.isUndefined(n)||null===n)&&o.call(t,n,Re.isString(i)?i.trim():i,r,l))&&e(n,r?r.concat(i):[i])}),f.pop()}}(e),t}function _e(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function xe(e,t){this._pairs=[],e&&Pe(e,this,t)}var Ne=xe.prototype;function Ce(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ue(e,t,n){if(!t)return e;var r,o=n&&n.encode||Ce,i=Re.isFunction(n)?{serialize:n}:n,a=i&&i.serialize;if(r=a?a(t,i):Re.isURLSearchParams(t)?t.toString():new xe(t,i).toString(o)){var u=e.indexOf("#");-1!==u&&(e=e.slice(0,u)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e}Ne.append=function(e,t){this._pairs.push([e,t])},Ne.toString=function(e){var t=e?function(t){return e.call(this,t,_e)}:_e;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};var Fe=function(){return l(function e(){c(this,e),this.handlers=[]},[{key:"use",value:function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){Re.forEach(this.handlers,function(t){null!==t&&e(t)})}}])}(),De={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Be={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:xe,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Le="undefined"!=typeof window&&"undefined"!=typeof document,Ie="object"===("undefined"==typeof navigator?"undefined":T(navigator))&&navigator||void 0,qe=Le&&(!Ie||["ReactNative","NativeScript","NS"].indexOf(Ie.product)<0),Me="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ze=Le&&window.location.href||"http://localhost",He=b(b({},Object.freeze({__proto__:null,hasBrowserEnv:Le,hasStandardBrowserEnv:qe,hasStandardBrowserWebWorkerEnv:Me,navigator:Ie,origin:ze})),Be);function Je(e){function t(e,n,r,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),u=o>=e.length;return i=!i&&Re.isArray(r)?r.length:i,u?(Re.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a):(r[i]&&Re.isObject(r[i])||(r[i]=[]),t(e,n,r[i],o)&&Re.isArray(r[i])&&(r[i]=function(e){var t,n,r={},o=Object.keys(e),i=o.length;for(t=0;t<i;t++)r[n=o[t]]=e[n];return r}(r[i])),!a)}if(Re.isFormData(e)&&Re.isFunction(e.entries)){var n={};return Re.forEachEntry(e,function(e,r){t(function(e){return Re.matchAll(/\w+|\[(\w*)]/g,e).map(function(e){return"[]"===e[0]?"":e[1]||e[0]})}(e),r,n,0)}),n}return null}var We={transitional:De,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){var n,r=t.getContentType()||"",o=r.indexOf("application/json")>-1,i=Re.isObject(e);if(i&&Re.isHTMLForm(e)&&(e=new FormData(e)),Re.isFormData(e))return o?JSON.stringify(Je(e)):e;if(Re.isArrayBuffer(e)||Re.isBuffer(e)||Re.isStream(e)||Re.isFile(e)||Re.isBlob(e)||Re.isReadableStream(e))return e;if(Re.isArrayBufferView(e))return e.buffer;if(Re.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Pe(e,new He.classes.URLSearchParams,b({visitor:function(e,t,n,r){return He.isNode&&Re.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((n=Re.isFileList(e))||r.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return Pe(n?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,n){if(Re.isString(e))try{return(t||JSON.parse)(e),Re.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||We.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Re.isResponse(e)||Re.isReadableStream(e))return e;if(e&&Re.isString(e)&&(n&&!this.responseType||r)){var o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(o){if("SyntaxError"===e.name)throw Se.from(e,Se.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:He.classes.FormData,Blob:He.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],function(e){We.headers[e]={}});var Ke=Re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ve=Symbol("internals");function Ge(e,t){if(!1!==e&&null!=e)if(Re.isArray(e))e.forEach(function(e){return Ge(e,t)});else if(!function(e){return!/[\r\n]/.test(e)}(String(e)))throw new Error('Invalid character in header content ["'.concat(t,'"]'))}function Xe(e){return e&&String(e).trim().toLowerCase()}function $e(e){return!1===e||null==e?e:Re.isArray(e)?e.map($e):function(e){for(var t=e.length;t>0;){var n=e.charCodeAt(t-1);if(10!==n&&13!==n)break;t-=1}return t===e.length?e:e.slice(0,t)}(String(e))}function Qe(e,t,n,r,o){return Re.isFunction(r)?r.call(this,t,n):(o&&(t=n),Re.isString(t)?Re.isString(r)?-1!==t.indexOf(r):Re.isRegExp(r)?r.test(t):void 0:void 0)}var Ye=function(){return l(function e(t){c(this,e),t&&this.set(t)},[{key:"set",value:function(e,t,n){var r=this;function o(e,t,n){var o=Xe(t);if(!o)throw new Error("header name must be a non-empty string");var i=Re.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(Ge(e,t),r[i||t]=$e(e))}var i=function(e,t){return Re.forEach(e,function(e,n){return o(e,n,t)})};if(Re.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Re.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(function(e){var t,n,r,o={};return e&&e.split("\n").forEach(function(e){r=e.indexOf(":"),t=e.substring(0,r).trim().toLowerCase(),n=e.substring(r+1).trim(),!t||o[t]&&Ke[t]||("set-cookie"===t?o[t]?o[t].push(n):o[t]=[n]:o[t]=o[t]?o[t]+", "+n:n)}),o}(e),t);else if(Re.isObject(e)&&Re.isIterable(e)){var a,u,s,c={},f=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=A(e))||t){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(e);try{for(f.s();!(s=f.n()).done;){var l=s.value;if(!Re.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(a=c[u])?Re.isArray(a)?[].concat(R(a),[l[1]]):[a,l[1]]:l[1]}}catch(e){f.e(e)}finally{f.f()}i(c,t)}else null!=e&&o(t,e,n);return this}},{key:"get",value:function(e,t){if(e=Xe(e)){var n=Re.findKey(this,e);if(n){var r=this[n];if(!t)return r;if(!0===t)return function(e){for(var t,n=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=r.exec(e);)n[t[1]]=t[2];return n}(r);if(Re.isFunction(t))return t.call(this,r,n);if(Re.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=Xe(e)){var n=Re.findKey(this,e);return!(!n||void 0===this[n]||t&&!Qe(0,this[n],n,t))}return!1}},{key:"delete",value:function(e,t){var n=this,r=!1;function o(e){if(e=Xe(e)){var o=Re.findKey(n,e);!o||t&&!Qe(0,n[o],o,t)||(delete n[o],r=!0)}}return Re.isArray(e)?e.forEach(o):o(e),r}},{key:"clear",value:function(e){for(var t=Object.keys(this),n=t.length,r=!1;n--;){var o=t[n];e&&!Qe(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}},{key:"normalize",value:function(e){var t=this,n={};return Re.forEach(this,function(r,o){var i=Re.findKey(n,o);if(i)return t[i]=$e(r),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n})}(o):String(o).trim();a!==o&&delete t[o],t[a]=$e(r),n[a]=!0}),this}},{key:"concat",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=this.constructor).concat.apply(e,[this].concat(n))}},{key:"toJSON",value:function(e){var t=Object.create(null);return Re.forEach(this,function(n,r){null!=n&&!1!==n&&(t[r]=e&&Re.isArray(n)?n.join(", "):n)}),t}},{key:Symbol.iterator,value:function(){return Object.entries(this.toJSON())[Symbol.iterator]()}},{key:"toString",value:function(){return Object.entries(this.toJSON()).map(function(e){var t=E(e,2);return t[0]+": "+t[1]}).join("\n")}},{key:"getSetCookie",value:function(){return this.get("set-cookie")||[]}},{key:Symbol.toStringTag,get:function(){return"AxiosHeaders"}}],[{key:"from",value:function(e){return e instanceof this?e:new this(e)}},{key:"concat",value:function(e){for(var t=new this(e),n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.forEach(function(e){return t.set(e)}),t}},{key:"accessor",value:function(e){var t=(this[Ve]=this[Ve]={accessors:{}}).accessors,n=this.prototype;function r(e){var r=Xe(e);t[r]||(!function(e,t){var n=Re.toCamelCase(" "+t);["get","set","has"].forEach(function(r){Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Re.isArray(e)?e.forEach(r):r(e),this}}])}();function Ze(e,t){var n=this||We,r=t||n,o=Ye.from(r.headers),i=r.data;return Re.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function et(e){return!(!e||!e.__CANCEL__)}Ye.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Re.reduceDescriptors(Ye.prototype,function(e,t){var n=e.value,r=t[0].toUpperCase()+t.slice(1);return{get:function(){return n},set:function(e){this[r]=e}}}),Re.freezeMethods(Ye);var tt=function(e){function t(e,n,r){var o;return c(this,t),(o=s(this,t,[null==e?"canceled":e,Se.ERR_CANCELED,n,r])).name="CanceledError",o.__CANCEL__=!0,o}return h(t,e),l(t)}(Se);function nt(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Se("Request failed with status code "+n.status,[Se.ERR_BAD_REQUEST,Se.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}var rt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,r=0,o=function(e,t){e=e||10;var n,r=new Array(e),o=new Array(e),i=0,a=0;return t=void 0!==t?t:1e3,function(u){var s=Date.now(),c=o[a];n||(n=s),r[i]=u,o[i]=s;for(var f=a,l=0;f!==i;)l+=r[f++],f%=e;if((i=(i+1)%e)===a&&(a=(a+1)%e),!(s-n<t)){var d=c&&s-c;return d?Math.round(1e3*l/d):void 0}}}(50,250);return function(e,t){var n,r,o=0,i=1e3/t,a=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();o=i,n=null,r&&(clearTimeout(r),r=null),e.apply(void 0,R(t))};return[function(){for(var e=Date.now(),t=e-o,u=arguments.length,s=new Array(u),c=0;c<u;c++)s[c]=arguments[c];t>=i?a(s,e):(n=s,r||(r=setTimeout(function(){r=null,a(n)},i-t)))},function(){return n&&a(n)}]}(function(n){var i=n.loaded,a=n.lengthComputable?n.total:void 0,u=i-r,s=o(u);r=i;var c=d({loaded:i,total:a,progress:a?i/a:void 0,bytes:u,rate:s||void 0,estimated:s&&a&&i<=a?(a-i)/s:void 0,event:n,lengthComputable:null!=a},t?"download":"upload",!0);e(c)},n)},ot=function(e,t){var n=null!=e;return[function(r){return t[0]({lengthComputable:n,total:e,loaded:r})},t[1]]},it=function(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Re.asap(function(){return e.apply(void 0,n)})}},at=He.hasStandardBrowserEnv?function(e,t){return function(n){return n=new URL(n,He.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)}}(new URL(He.origin),He.navigator&&/(msie|trident)/i.test(He.navigator.userAgent)):function(){return!0},ut=He.hasStandardBrowserEnv?{write:function(e,t,n,r,o,i,a){if("undefined"!=typeof document){var u=["".concat(e,"=").concat(encodeURIComponent(t))];Re.isNumber(n)&&u.push("expires=".concat(new Date(n).toUTCString())),Re.isString(r)&&u.push("path=".concat(r)),Re.isString(o)&&u.push("domain=".concat(o)),!0===i&&u.push("secure"),Re.isString(a)&&u.push("SameSite=".concat(a)),document.cookie=u.join("; ")}},read:function(e){if("undefined"==typeof document)return null;var t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove:function(e){this.write(e,"",Date.now()-864e5,"/")}}:{write:function(){},read:function(){return null},remove:function(){}};function st(e,t,n){var r,o=!("string"==typeof(r=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r));return e&&(o||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var ct=function(e){return e instanceof Ye?b({},e):e};function ft(e,t){t=t||{};var n={};function r(e,t,n,r){return Re.isPlainObject(e)&&Re.isPlainObject(t)?Re.merge.call({caseless:r},e,t):Re.isPlainObject(t)?Re.merge({},t):Re.isArray(t)?t.slice():t}function o(e,t,n,o){return Re.isUndefined(t)?Re.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Re.isUndefined(t))return r(void 0,t)}function a(e,t){return Re.isUndefined(t)?Re.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function u(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 0}var s={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:u,headers:function(e,t,n){return o(ct(e),ct(t),0,!0)}};return Re.forEach(Object.keys(b(b({},e),t)),function(r){if("__proto__"!==r&&"constructor"!==r&&"prototype"!==r){var i=Re.hasOwnProp(s,r)?s[r]:o,a=i(e[r],t[r],r);Re.isUndefined(a)&&i!==u||(n[r]=a)}}),n}var lt,dt=function(e){var t=ft({},e),n=t.data,r=t.withXSRFToken,o=t.xsrfHeaderName,i=t.xsrfCookieName,a=t.headers,u=t.auth;if(t.headers=a=Ye.from(a),t.url=Ue(st(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&a.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),Re.isFormData(n))if(He.hasStandardBrowserEnv||He.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Re.isFunction(n.getHeaders)){var s=n.getHeaders(),c=["content-type","content-length"];Object.entries(s).forEach(function(e){var t=E(e,2),n=t[0],r=t[1];c.includes(n.toLowerCase())&&a.set(n,r)})}if(He.hasStandardBrowserEnv&&(r&&Re.isFunction(r)&&(r=r(t)),r||!1!==r&&at(t.url))){var f=o&&i&&ut.read(i);f&&a.set(o,f)}return t},pt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){var r,o,i,a,u,s=dt(e),c=s.data,f=Ye.from(s.headers).normalize(),l=s.responseType,d=s.onUploadProgress,p=s.onDownloadProgress;function h(){a&&a(),u&&u(),s.cancelToken&&s.cancelToken.unsubscribe(r),s.signal&&s.signal.removeEventListener("abort",r)}var v=new XMLHttpRequest;function y(){if(v){var r=Ye.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders());nt(function(e){t(e),h()},function(e){n(e),h()},{data:l&&"text"!==l&&"json"!==l?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v}),v=null}}if(v.open(s.method.toUpperCase(),s.url,!0),v.timeout=s.timeout,"onloadend"in v?v.onloadend=y:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(y)},v.onabort=function(){v&&(n(new Se("Request aborted",Se.ECONNABORTED,e,v)),v=null)},v.onerror=function(t){var r=t&&t.message?t.message:"Network Error",o=new Se(r,Se.ERR_NETWORK,e,v);o.event=t||null,n(o),v=null},v.ontimeout=function(){var t=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",r=s.transitional||De;s.timeoutErrorMessage&&(t=s.timeoutErrorMessage),n(new Se(t,r.clarifyTimeoutError?Se.ETIMEDOUT:Se.ECONNABORTED,e,v)),v=null},void 0===c&&f.setContentType(null),"setRequestHeader"in v&&Re.forEach(f.toJSON(),function(e,t){v.setRequestHeader(t,e)}),Re.isUndefined(s.withCredentials)||(v.withCredentials=!!s.withCredentials),l&&"json"!==l&&(v.responseType=s.responseType),p){var b=E(rt(p,!0),2);i=b[0],u=b[1],v.addEventListener("progress",i)}if(d&&v.upload){var m=E(rt(d),2);o=m[0],a=m[1],v.upload.addEventListener("progress",o),v.upload.addEventListener("loadend",a)}(s.cancelToken||s.signal)&&(r=function(t){v&&(n(!t||t.type?new tt(null,e,v):t),v.abort(),v=null)},s.cancelToken&&s.cancelToken.subscribe(r),s.signal&&(s.signal.aborted?r():s.signal.addEventListener("abort",r)));var g,w,O=(g=s.url,(w=/^([-+\w]{1,25})(:?\/\/|:)/.exec(g))&&w[1]||"");O&&-1===He.protocols.indexOf(O)?n(new Se("Unsupported protocol "+O+":",Se.ERR_BAD_REQUEST,e)):v.send(c||null)})},ht=function(e,t){var n=(e=e?e.filter(Boolean):[]).length;if(t||n){var r,o=new AbortController,i=function(e){if(!r){r=!0,u();var t=e instanceof Error?e:this.reason;o.abort(t instanceof Se?t:new tt(t instanceof Error?t.message:t))}},a=t&&setTimeout(function(){a=null,i(new Se("timeout of ".concat(t,"ms exceeded"),Se.ETIMEDOUT))},t),u=function(){e&&(a&&clearTimeout(a),a=null,e.forEach(function(e){e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)}),e=null)};e.forEach(function(e){return e.addEventListener("abort",i)});var s=o.signal;return s.unsubscribe=function(){return Re.asap(u)},s}},vt=m().m(function e(t,n){var r,o,i;return m().w(function(e){for(;;)switch(e.n){case 0:if(r=t.byteLength,n&&!(r<n)){e.n=2;break}return e.n=1,t;case 1:return e.a(2);case 2:o=0;case 3:if(!(o<r)){e.n=5;break}return i=o+n,e.n=4,t.slice(o,i);case 4:o=i,e.n=3;break;case 5:return e.a(2)}},e)}),yt=function(){var e=j(m().m(function e(t,o){var i,a,s,c,f,l,d;return m().w(function(e){for(;;)switch(e.p=e.n){case 0:i=!1,a=!1,e.p=1,c=r(bt(t));case 2:return e.n=3,u(c.next());case 3:if(!(i=!(f=e.v).done)){e.n=5;break}return l=f.value,e.d(w(n(r(vt(l,o)))),4);case 4:i=!1,e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,d=e.v,a=!0,s=d;case 7:if(e.p=7,e.p=8,!i||null==c.return){e.n=9;break}return e.n=9,u(c.return());case 9:if(e.p=9,!a){e.n=10;break}throw s;case 10:return e.f(9);case 11:return e.f(7);case 12:return e.a(2)}},e,null,[[8,,9,11],[1,6,7,12]])}));return function(t,n){return e.apply(this,arguments)}}(),bt=function(){var e=j(m().m(function e(t){var o,i,a,s;return m().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t[Symbol.asyncIterator]){e.n=2;break}return e.d(w(n(r(t))),1);case 1:return e.a(2);case 2:o=t.getReader(),e.p=3;case 4:return e.n=5,u(o.read());case 5:if(i=e.v,a=i.done,s=i.value,!a){e.n=6;break}return e.a(3,8);case 6:return e.n=7,s;case 7:e.n=4;break;case 8:return e.p=8,e.n=9,u(o.cancel());case 9:return e.f(8);case 10:return e.a(2)}},e,null,[[3,,8,10]])}));return function(t){return e.apply(this,arguments)}}(),mt=function(e,t,n,r){var o,i=yt(e,t),u=0,s=function(e){o||(o=!0,r&&r(e))};return new ReadableStream({pull:function(e){return a(m().m(function t(){var r,o,a,c,f,l;return m().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,i.next();case 1:if(r=t.v,o=r.done,a=r.value,!o){t.n=2;break}return s(),e.close(),t.a(2);case 2:c=a.byteLength,n&&(f=u+=c,n(f)),e.enqueue(new Uint8Array(a)),t.n=4;break;case 3:throw t.p=3,l=t.v,s(l),l;case 4:return t.a(2)}},t,null,[[0,3]])}))()},cancel:function(e){return s(e),i.return()}},{highWaterMark:2})},gt=Re.isFunction,wt={Request:(lt=Re.global).Request,Response:lt.Response},Ot=Re.global,Et=Ot.ReadableStream,Rt=Ot.TextEncoder,St=function(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return!!e.apply(void 0,n)}catch(e){return!1}},Tt=function(e){var t=e=Re.merge.call({skipUndefined:!0},wt,e),n=t.fetch,r=t.Request,o=t.Response,i=n?gt(n):"function"==typeof fetch,u=gt(r),s=gt(o);if(!i)return!1;var c,f=i&&gt(Et),l=i&&("function"==typeof Rt?(c=new Rt,function(e){return c.encode(e)}):function(){var e=a(m().m(function e(t){var n,o;return m().w(function(e){for(;;)switch(e.n){case 0:return n=Uint8Array,e.n=1,new r(t).arrayBuffer();case 1:return o=e.v,e.a(2,new n(o))}},e)}));return function(t){return e.apply(this,arguments)}}()),d=u&&f&&St(function(){var e=!1,t=new Et,n=new r(He.origin,{body:t,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return t.cancel(),e&&!n}),p=s&&f&&St(function(){return Re.isReadableStream(new o("").body)}),h={stream:p&&function(e){return e.body}};i&&["text","arrayBuffer","blob","formData","stream"].forEach(function(e){!h[e]&&(h[e]=function(t,n){var r=t&&t[e];if(r)return r.call(t);throw new Se("Response type '".concat(e,"' is not supported"),Se.ERR_NOT_SUPPORT,n)})});var v=function(){var e=a(m().m(function e(t){var n;return m().w(function(e){for(;;)switch(e.n){case 0:if(null!=t){e.n=1;break}return e.a(2,0);case 1:if(!Re.isBlob(t)){e.n=2;break}return e.a(2,t.size);case 2:if(!Re.isSpecCompliantForm(t)){e.n=4;break}return n=new r(He.origin,{method:"POST",body:t}),e.n=3,n.arrayBuffer();case 3:case 6:return e.a(2,e.v.byteLength);case 4:if(!Re.isArrayBufferView(t)&&!Re.isArrayBuffer(t)){e.n=5;break}return e.a(2,t.byteLength);case 5:if(Re.isURLSearchParams(t)&&(t+=""),!Re.isString(t)){e.n=7;break}return e.n=6,l(t);case 7:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=a(m().m(function e(t,n){var r;return m().w(function(e){for(;;)if(0===e.n)return r=Re.toFiniteNumber(t.getContentLength()),e.a(2,null==r?v(n):r)},e)}));return function(t,n){return e.apply(this,arguments)}}();return function(){var e=a(m().m(function e(t){var i,a,s,c,f,l,v,g,w,O,R,S,T,A,j,k,P,_,x,N,C,U,F,D,B,L,I,q,M,z,H,J,W,K,V,G,X,$,Q;return m().w(function(e){for(;;)switch(e.p=e.n){case 0:if(i=dt(t),a=i.url,s=i.method,c=i.data,f=i.signal,l=i.cancelToken,v=i.timeout,g=i.onDownloadProgress,w=i.onUploadProgress,O=i.responseType,R=i.headers,S=i.withCredentials,T=void 0===S?"same-origin":S,A=i.fetchOptions,j=n||fetch,O=O?(O+"").toLowerCase():"text",k=ht([f,l&&l.toAbortSignal()],v),P=null,_=k&&k.unsubscribe&&function(){k.unsubscribe()},e.p=1,!(X=w&&d&&"get"!==s&&"head"!==s)){e.n=3;break}return e.n=2,y(R,c);case 2:$=x=e.v,X=0!==$;case 3:if(!X){e.n=4;break}N=new r(a,{method:"POST",body:c,duplex:"half"}),Re.isFormData(c)&&(C=N.headers.get("content-type"))&&R.setContentType(C),N.body&&(U=ot(x,rt(it(w))),F=E(U,2),D=F[0],B=F[1],c=mt(N.body,65536,D,B));case 4:return Re.isString(T)||(T=T?"include":"omit"),L=u&&"credentials"in r.prototype,I=b(b({},A),{},{signal:k,method:s.toUpperCase(),headers:R.normalize().toJSON(),body:c,duplex:"half",credentials:L?T:void 0}),P=u&&new r(a,I),e.n=5,u?j(P,A):j(a,I);case 5:return q=e.v,M=p&&("stream"===O||"response"===O),p&&(g||M&&_)&&(z={},["status","statusText","headers"].forEach(function(e){z[e]=q[e]}),H=Re.toFiniteNumber(q.headers.get("content-length")),J=g&&ot(H,rt(it(g),!0))||[],W=E(J,2),K=W[0],V=W[1],q=new o(mt(q.body,65536,K,function(){V&&V(),_&&_()}),z)),O=O||"text",e.n=6,h[Re.findKey(h,O)||"text"](q,t);case 6:return G=e.v,!M&&_&&_(),e.n=7,new Promise(function(e,n){nt(e,n,{data:G,headers:Ye.from(q.headers),status:q.status,statusText:q.statusText,config:t,request:P})});case 7:return e.a(2,e.v);case 8:if(e.p=8,Q=e.v,_&&_(),!Q||"TypeError"!==Q.name||!/Load failed|fetch/i.test(Q.message)){e.n=9;break}throw Object.assign(new Se("Network Error",Se.ERR_NETWORK,t,P,Q&&Q.response),{cause:Q.cause||Q});case 9:throw Se.from(Q,Q&&Q.code,t,P,Q&&Q.response);case 10:return e.a(2)}},e,null,[[1,8]])}));return function(t){return e.apply(this,arguments)}}()},At=new Map,jt=function(e){for(var t,n,r=e&&e.env||{},o=r.fetch,i=[r.Request,r.Response,o],a=i.length,u=At;a--;)t=i[a],void 0===(n=u.get(t))&&u.set(t,n=a?new Map:Tt(r)),u=n;return n};jt();var kt={http:null,xhr:pt,fetch:{get:jt}};Re.forEach(kt,function(e,t){if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});var Pt=function(e){return"- ".concat(e)},_t=function(e){return Re.isFunction(e)||null===e||!1===e};var xt={getAdapter:function(e,t){for(var n,r,o=(e=Re.isArray(e)?e:[e]).length,i={},a=0;a<o;a++){var u=void 0;if(r=n=e[a],!_t(n)&&void 0===(r=kt[(u=String(n)).toLowerCase()]))throw new Se("Unknown adapter '".concat(u,"'"));if(r&&(Re.isFunction(r)||(r=r.get(t))))break;i[u||"#"+a]=r}if(!r){var s=Object.entries(i).map(function(e){var t=E(e,2),n=t[0],r=t[1];return"adapter ".concat(n," ")+(!1===r?"is not supported by the environment":"is not available in the build")}),c=o?s.length>1?"since :\n"+s.map(Pt).join("\n"):" "+Pt(s[0]):"as no adapter specified";throw new Se("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return r},adapters:kt};function Nt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new tt(null,e)}function Ct(e){return Nt(e),e.headers=Ye.from(e.headers),e.data=Ze.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),xt.getAdapter(e.adapter||We.adapter,e)(e).then(function(t){return Nt(e),t.data=Ze.call(e,e.transformResponse,t),t.headers=Ye.from(t.headers),t},function(t){return et(t)||(Nt(e),t&&t.response&&(t.response.data=Ze.call(e,e.transformResponse,t.response),t.response.headers=Ye.from(t.response.headers))),Promise.reject(t)})}var Ut="1.15.0",Ft={};["object","boolean","number","function","string","symbol"].forEach(function(e,t){Ft[e]=function(n){return T(n)===e||"a"+(t<1?"n ":" ")+e}});var Dt={};Ft.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ut+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,o,i){if(!1===e)throw new Se(r(o," has been removed"+(t?" in "+t:"")),Se.ERR_DEPRECATED);return t&&!Dt[o]&&(Dt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Ft.spelling=function(e){return function(t,n){return console.warn("".concat(n," is likely a misspelling of ").concat(e)),!0}};var Bt={assertOptions:function(e,t,n){if("object"!==T(e))throw new Se("options must be an object",Se.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],a=t[i];if(a){var u=e[i],s=void 0===u||a(u,i,e);if(!0!==s)throw new Se("option "+i+" must be "+s,Se.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new Se("Unknown option "+i,Se.ERR_BAD_OPTION)}},validators:Ft},Lt=Bt.validators,It=function(){return l(function e(t){c(this,e),this.defaults=t||{},this.interceptors={request:new Fe,response:new Fe}},[{key:"request",value:(e=a(m().m(function e(t,n){var r,o,i,a,u,s;return m().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this._request(t,n);case 1:return e.a(2,e.v);case 2:if(e.p=2,(s=e.v)instanceof Error){r={},Error.captureStackTrace?Error.captureStackTrace(r):r=new Error,o=function(){if(!r.stack)return"";var e=r.stack.indexOf("\n");return-1===e?"":r.stack.slice(e+1)}();try{s.stack?o&&(i=o.indexOf("\n"),a=-1===i?-1:o.indexOf("\n",i+1),u=-1===a?"":o.slice(a+1),String(s.stack).endsWith(u)||(s.stack+="\n"+o)):s.stack=o}catch(e){}}throw s;case 3:return e.a(2)}},e,this,[[0,2]])})),function(t,n){return e.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var n=t=ft(this.defaults,t),r=n.transitional,o=n.paramsSerializer,i=n.headers;void 0!==r&&Bt.assertOptions(r,{silentJSONParsing:Lt.transitional(Lt.boolean),forcedJSONParsing:Lt.transitional(Lt.boolean),clarifyTimeoutError:Lt.transitional(Lt.boolean),legacyInterceptorReqResOrdering:Lt.transitional(Lt.boolean)},!1),null!=o&&(Re.isFunction(o)?t.paramsSerializer={serialize:o}:Bt.assertOptions(o,{encode:Lt.function,serialize:Lt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Bt.assertOptions(t,{baseUrl:Lt.spelling("baseURL"),withXsrfToken:Lt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&Re.merge(i.common,i[t.method]);i&&Re.forEach(["delete","get","head","post","put","patch","common"],function(e){delete i[e]}),t.headers=Ye.concat(a,i);var u=[],s=!0;this.interceptors.request.forEach(function(e){if("function"!=typeof e.runWhen||!1!==e.runWhen(t)){s=s&&e.synchronous;var n=t.transitional||De;n&&n.legacyInterceptorReqResOrdering?u.unshift(e.fulfilled,e.rejected):u.push(e.fulfilled,e.rejected)}});var c,f=[];this.interceptors.response.forEach(function(e){f.push(e.fulfilled,e.rejected)});var l,d=0;if(!s){var p=[Ct.bind(this),void 0];for(p.unshift.apply(p,u),p.push.apply(p,f),l=p.length,c=Promise.resolve(t);d<l;)c=c.then(p[d++],p[d++]);return c}l=u.length;for(var h=t;d<l;){var v=u[d++],y=u[d++];try{h=v(h)}catch(e){y.call(this,e);break}}try{c=Ct.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,l=f.length;d<l;)c=c.then(f[d++],f[d++]);return c}},{key:"getUri",value:function(e){return Ue(st((e=ft(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}}]);var e}();Re.forEach(["delete","get","head","options"],function(e){It.prototype[e]=function(t,n){return this.request(ft(n||{},{method:e,url:t,data:(n||{}).data}))}}),Re.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(ft(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}It.prototype[e]=t(),It.prototype[e+"Form"]=t(!0)});var qt=function(){function e(t){if(c(this,e),"function"!=typeof t)throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(e){n=e});var r=this;this.promise.then(function(e){if(r._listeners){for(var t=r._listeners.length;t-- >0;)r._listeners[t](e);r._listeners=null}}),this.promise.then=function(e){var t,n=new Promise(function(e){r.subscribe(e),t=e}).then(e);return n.cancel=function(){r.unsubscribe(t)},n},t(function(e,t,o){r.reason||(r.reason=new tt(e,t,o),n(r.reason))})}return l(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}},{key:"toAbortSignal",value:function(){var e=this,t=new AbortController,n=function(e){t.abort(e)};return this.subscribe(n),t.signal.unsubscribe=function(){return e.unsubscribe(n)},t.signal}}],[{key:"source",value:function(){var t;return{token:new e(function(e){t=e}),cancel:t}}}])}();var Mt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Mt).forEach(function(e){var t=E(e,2),n=t[0],r=t[1];Mt[r]=n});var zt=function e(t){var n=new It(t),r=_(It.prototype.request,n);return Re.extend(r,It.prototype,n,{allOwnKeys:!0}),Re.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ft(t,n))},r}(We);return zt.Axios=It,zt.CanceledError=tt,zt.CancelToken=qt,zt.isCancel=et,zt.VERSION=Ut,zt.toFormData=Pe,zt.AxiosError=Se,zt.Cancel=zt.CanceledError,zt.all=function(e){return Promise.all(e)},zt.spread=function(e){return function(t){return e.apply(null,t)}},zt.isAxiosError=function(e){return Re.isObject(e)&&!0===e.isAxiosError},zt.mergeConfig=ft,zt.AxiosHeaders=Ye,zt.formToJSON=function(e){return Je(Re.isHTMLForm(e)?new FormData(e):e)},zt.getAdapter=xt.getAdapter,zt.HttpStatusCode=Mt,zt.default=zt,zt});
5
+ //# sourceMappingURL=axios.min.js.map
scripts/node_modules/axios/dist/axios.min.js.map ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/browser/axios.cjs ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/browser/axios.cjs.map ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/esm/axios.js ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/esm/axios.js.map ADDED
The diff for this file is too large to render. See raw diff
 
scripts/node_modules/axios/dist/esm/axios.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
+ function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,{iterator:r,toStringTag:o}=Symbol,s=(i=Object.create(null),e=>{const n=t.call(e);return i[n]||(i[n]=n.slice(8,-1).toLowerCase())});var i;const a=e=>(e=e.toLowerCase(),t=>s(t)===e),c=e=>t=>typeof t===e,{isArray:l}=Array,u=c("undefined");function f(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&h(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const d=a("ArrayBuffer");const p=c("string"),h=c("function"),m=c("number"),b=e=>null!==e&&"object"==typeof e,g=e=>{if("object"!==s(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||o in e||r in e)},y=a("Date"),w=a("File"),E=a("Blob"),R=a("FileList");const O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},S=void 0!==O.FormData?O.FormData:void 0,T=a("URLSearchParams"),[A,v,C,N]=["ReadableStream","Request","Response","Headers"].map(a);function _(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),l(e))for(r=0,o=e.length;r<o;r++)t.call(null,e[r],r,e);else{if(f(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(r=0;r<s;r++)i=o[r],t.call(null,e[i],i,e)}}function x(e,t){if(f(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r,o=n.length;for(;o-- >0;)if(r=n[o],t===r.toLowerCase())return r;return null}const j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,P=e=>!u(e)&&e!==j;const U=(F="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>F&&e instanceof F);var F;const L=a("HTMLFormElement"),B=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),D=a("RegExp"),k=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};_(n,(n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)}),Object.defineProperties(e,r)};const q=a("AsyncFunction"),I=(M="function"==typeof setImmediate,z=h(j.postMessage),M?setImmediate:z?(H=`axios@${Math.random()}`,J=[],j.addEventListener("message",({source:e,data:t})=>{e===j&&t===H&&J.length&&J.shift()()},!1),e=>{J.push(e),j.postMessage(H,"*")}):e=>setTimeout(e));var M,z,H,J;const W="undefined"!=typeof queueMicrotask?queueMicrotask.bind(j):"undefined"!=typeof process&&process.nextTick||I;var $={isArray:l,isArrayBuffer:d,isBuffer:f,isFormData:e=>{let t;return e&&(S&&e instanceof S||h(e.append)&&("formdata"===(t=s(e))||"object"===t&&h(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&d(e.buffer),t},isString:p,isNumber:m,isBoolean:e=>!0===e||!1===e,isObject:b,isPlainObject:g,isEmptyObject:e=>{if(!b(e)||f(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:A,isRequest:v,isResponse:C,isHeaders:N,isUndefined:u,isDate:y,isFile:w,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:E,isRegExp:D,isFunction:h,isStream:e=>b(e)&&h(e.pipe),isURLSearchParams:T,isTypedArray:U,isFileList:R,forEach:_,merge:function e(){const{caseless:t,skipUndefined:n}=P(this)&&this||{},r={},o=(o,s)=>{if("__proto__"===s||"constructor"===s||"prototype"===s)return;const i=t&&x(r,s)||s;g(r[i])&&g(o)?r[i]=e(r[i],o):g(o)?r[i]=e({},o):l(o)?r[i]=o.slice():n&&u(o)||(r[i]=o)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&_(arguments[e],o);return r},extend:(t,n,r,{allOwnKeys:o}={})=>(_(n,(n,o)=>{r&&h(n)?Object.defineProperty(t,o,{value:e(n,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,o,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:o}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,o)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:a,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(l(e))return e;let t=e.length;if(!m(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[r]).call(e);let o;for(;(o=n.next())&&!o.done;){const n=o.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:L,hasOwnProperty:B,hasOwnProp:B,reduceDescriptors:k,freezeMethods:e=>{k(e,(t,n)=>{if(h(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];h(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return l(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:x,global:j,isContextDefined:P,isSpecCompliantForm:function(e){return!!(e&&h(e.append)&&"FormData"===e[o]&&e[r])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(b(e)){if(t.indexOf(e)>=0)return;if(f(e))return e;if(!("toJSON"in e)){t[r]=e;const o=l(e)?[]:{};return _(e,(e,t)=>{const s=n(e,r+1);!u(s)&&(o[t]=s)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:q,isThenable:e=>e&&(b(e)||h(e))&&h(e.then)&&h(e.catch),setImmediate:I,asap:W,isIterable:e=>null!=e&&h(e[r])};let V=class e extends Error{static from(t,n,r,o,s,i){const a=new e(t.message,n||t.code,r,o,s);return a.cause=t,a.name=t.name,null!=t.status&&null==a.status&&(a.status=t.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$.toJSONObject(this.config),code:this.code,status:this.status}}};V.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",V.ERR_BAD_OPTION="ERR_BAD_OPTION",V.ECONNABORTED="ECONNABORTED",V.ETIMEDOUT="ETIMEDOUT",V.ERR_NETWORK="ERR_NETWORK",V.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",V.ERR_DEPRECATED="ERR_DEPRECATED",V.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",V.ERR_BAD_REQUEST="ERR_BAD_REQUEST",V.ERR_CANCELED="ERR_CANCELED",V.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",V.ERR_INVALID_URL="ERR_INVALID_URL";function K(e){return $.isPlainObject(e)||$.isArray(e)}function X(e){return $.endsWith(e,"[]")?e.slice(0,-2):e}function G(e,t,n){return e?e.concat(t).map(function(e,t){return e=X(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Q=$.toFlatObject($,{},null,function(e){return/^is[A-Z]/.test(e)});function Y(e,t,n){if(!$.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=$.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!$.isUndefined(t[e])})).metaTokens,o=n.visitor||l,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&$.isSpecCompliantForm(t);if(!$.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($.isDate(e))return e.toISOString();if($.isBoolean(e))return e.toString();if(!a&&$.isBlob(e))throw new V("Blob is not supported. Use a Buffer instead.");return $.isArrayBuffer(e)||$.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,n,o){let a=e;if($.isReactNative(t)&&$.isReactNativeBlob(e))return t.append(G(o,n,s),c(e)),!1;if(e&&!o&&"object"==typeof e)if($.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if($.isArray(e)&&function(e){return $.isArray(e)&&!e.some(K)}(e)||($.isFileList(e)||$.endsWith(n,"[]"))&&(a=$.toArray(e)))return n=X(n),a.forEach(function(e,r){!$.isUndefined(e)&&null!==e&&t.append(!0===i?G([n],r,s):null===i?n:n+"[]",c(e))}),!1;return!!K(e)||(t.append(G(o,n,s),c(e)),!1)}const u=[],f=Object.assign(Q,{defaultVisitor:l,convertValue:c,isVisitable:K});if(!$.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!$.isUndefined(n)){if(-1!==u.indexOf(n))throw Error("Circular reference detected in "+r.join("."));u.push(n),$.forEach(n,function(n,s){!0===(!($.isUndefined(n)||null===n)&&o.call(t,n,$.isString(s)?s.trim():s,r,f))&&e(n,r?r.concat(s):[s])}),u.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ee(e,t){this._pairs=[],e&&Y(e,this,t)}const te=ee.prototype;function ne(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function re(e,t,n){if(!t)return e;const r=n&&n.encode||ne,o=$.isFunction(n)?{serialize:n}:n,s=o&&o.serialize;let i;if(i=s?s(t,o):$.isURLSearchParams(t)?t.toString():new ee(t,o).toString(r),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Z)}:Z;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};class oe{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){$.forEach(this.handlers,function(t){null!==t&&e(t)})}}var se={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},ie={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ee,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ae="undefined"!=typeof window&&"undefined"!=typeof document,ce="object"==typeof navigator&&navigator||void 0,le=ae&&(!ce||["ReactNative","NativeScript","NS"].indexOf(ce.product)<0),ue="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,fe=ae&&window.location.href||"http://localhost";var de={...Object.freeze({__proto__:null,hasBrowserEnv:ae,hasStandardBrowserEnv:le,hasStandardBrowserWebWorkerEnv:ue,navigator:ce,origin:fe}),...ie};function pe(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&$.isArray(r)?r.length:s,a)return $.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&$.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&$.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],t[s]=e[s];return t}(r[s])),!i}if($.isFormData(e)&&$.isFunction(e.entries)){const n={};return $.forEachEntry(e,(e,r)=>{t(function(e){return $.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null}const he={transitional:se,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=$.isObject(e);o&&$.isHTMLForm(e)&&(e=new FormData(e));if($.isFormData(e))return r?JSON.stringify(pe(e)):e;if($.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e)||$.isReadableStream(e))return e;if($.isArrayBufferView(e))return e.buffer;if($.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Y(e,new de.classes.URLSearchParams,{visitor:function(e,t,n,r){return de.isNode&&$.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((s=$.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Y(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if($.isString(e))try{return(t||JSON.parse)(e),$.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||he.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if($.isResponse(e)||$.isReadableStream(e))return e;if(e&&$.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw V.from(e,V.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$.forEach(["delete","get","head","post","put","patch"],e=>{he.headers[e]={}});const me=$.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const be=Symbol("internals");function ge(e,t){if(!1!==e&&null!=e)if($.isArray(e))e.forEach(e=>ge(e,t));else if(!(e=>!/[\r\n]/.test(e))(String(e)))throw new Error(`Invalid character in header content ["${t}"]`)}function ye(e){return e&&String(e).trim().toLowerCase()}function we(e){return!1===e||null==e?e:$.isArray(e)?e.map(we):function(e){let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(10!==n&&13!==n)break;t-=1}return t===e.length?e:e.slice(0,t)}(String(e))}function Ee(e,t,n,r,o){return $.isFunction(r)?r.call(this,t,n):(o&&(t=n),$.isString(t)?$.isString(r)?-1!==t.indexOf(r):$.isRegExp(r)?r.test(t):void 0:void 0)}let Re=class{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ye(t);if(!o)throw new Error("header name must be a non-empty string");const s=$.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(ge(e,t),r[s||t]=we(e))}const s=(e,t)=>$.forEach(e,(e,n)=>o(e,n,t));if($.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if($.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&me[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if($.isObject(e)&&$.isIterable(e)){let n,r,o={};for(const t of e){if(!$.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?$.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}s(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ye(e)){const n=$.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if($.isFunction(t))return t.call(this,e,n);if($.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ye(e)){const n=$.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ee(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ye(e)){const o=$.findKey(n,e);!o||t&&!Ee(0,n[o],o,t)||(delete n[o],r=!0)}}return $.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Ee(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return $.forEach(this,(r,o)=>{const s=$.findKey(n,o);if(s)return t[s]=we(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();i!==o&&delete t[o],t[i]=we(r),n[i]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return $.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&$.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[be]=this[be]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ye(e);t[r]||(!function(e,t){const n=$.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return $.isArray(e)?e.forEach(r):r(e),this}};function Oe(e,t){const n=this||he,r=t||n,o=Re.from(r.headers);let s=r.data;return $.forEach(e,function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}function Se(e){return!(!e||!e.__CANCEL__)}Re.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$.reduceDescriptors(Re.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),$.freezeMethods(Re);let Te=class extends V{constructor(e,t,n){super(null==e?"canceled":e,V.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ae(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new V("Request failed with status code "+n.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const ve=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),l=r[i];o||(o=c),n[s]=a,r[s]=c;let u=i,f=0;for(;u!==s;)f+=n[u++],u%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const d=l&&c-l;return d?Math.round(1e3*f/d):void 0}}(50,250);return function(e,t){let n,r,o=0,s=1e3/t;const i=(t,s=Date.now())=>{o=s,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-o;a>=s?i(e,t):(n=e,r||(r=setTimeout(()=>{r=null,i(n)},s-a)))},()=>n&&i(n)]}(n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;e({loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i,[t?"download":"upload"]:!0})},n)},Ce=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ne=e=>(...t)=>$.asap(()=>e(...t));var _e=de.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,de.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(de.origin),de.navigator&&/(msie|trident)/i.test(de.navigator.userAgent)):()=>!0,xe=de.hasStandardBrowserEnv?{write(e,t,n,r,o,s,i){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];$.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),$.isString(r)&&a.push(`path=${r}`),$.isString(o)&&a.push(`domain=${o}`),!0===s&&a.push("secure"),$.isString(i)&&a.push(`SameSite=${i}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function je(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Pe=e=>e instanceof Re?{...e}:e;function Ue(e,t){t=t||{};const n={};function r(e,t,n,r){return $.isPlainObject(e)&&$.isPlainObject(t)?$.merge.call({caseless:r},e,t):$.isPlainObject(t)?$.merge({},t):$.isArray(t)?t.slice():t}function o(e,t,n,o){return $.isUndefined(t)?$.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function s(e,t){if(!$.isUndefined(t))return r(void 0,t)}function i(e,t){return $.isUndefined(t)?$.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t,n)=>o(Pe(e),Pe(t),0,!0)};return $.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const s=$.hasOwnProp(c,r)?c[r]:o,i=s(e[r],t[r],r);$.isUndefined(i)&&s!==a||(n[r]=i)}),n}var Fe=e=>{const t=Ue({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:i,auth:a}=t;if(t.headers=i=Re.from(i),t.url=re(je(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&i.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),$.isFormData(n))if(de.hasStandardBrowserEnv||de.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if($.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&i.set(e,n)})}if(de.hasStandardBrowserEnv&&(r&&$.isFunction(r)&&(r=r(t)),r||!1!==r&&_e(t.url))){const e=o&&s&&xe.read(s);e&&i.set(o,e)}return t};var Le="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Fe(e);let o=r.data;const s=Re.from(r.headers).normalize();let i,a,c,l,u,{responseType:f,onUploadProgress:d,onDownloadProgress:p}=r;function h(){l&&l(),u&&u(),r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let m=new XMLHttpRequest;function b(){if(!m)return;const r=Re.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ae(function(e){t(e),h()},function(e){n(e),h()},{data:f&&"text"!==f&&"json"!==f?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=b:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(b)},m.onabort=function(){m&&(n(new V("Request aborted",V.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new V(r,V.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||se;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new V(t,o.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,e,m)),m=null},void 0===o&&s.setContentType(null),"setRequestHeader"in m&&$.forEach(s.toJSON(),function(e,t){m.setRequestHeader(t,e)}),$.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),f&&"json"!==f&&(m.responseType=r.responseType),p&&([c,u]=ve(p,!0),m.addEventListener("progress",c)),d&&m.upload&&([a,l]=ve(d),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",l)),(r.cancelToken||r.signal)&&(i=t=>{m&&(n(!t||t.type?new Te(null,e,m):t),m.abort(),m=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const g=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);g&&-1===de.protocols.indexOf(g)?n(new V("Unsupported protocol "+g+":",V.ERR_BAD_REQUEST,e)):m.send(o||null)})};const Be=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof V?t:new Te(t instanceof Error?t.message:t))}};let s=t&&setTimeout(()=>{s=null,o(new V(`timeout of ${t}ms exceeded`,V.ETIMEDOUT))},t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:a}=r;return a.unsubscribe=()=>$.asap(i),a}},De=function*(e,t){let n=e.byteLength;if(n<t)return void(yield e);let r,o=0;for(;o<n;)r=o+t,yield e.slice(o,r),o=r},ke=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},qe=(e,t,n,r)=>{const o=async function*(e,t){for await(const n of ke(e))yield*De(n,t)}(e,t);let s,i=0,a=e=>{s||(s=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return a(),void e.close();let s=r.byteLength;if(n){let e=i+=s;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw a(e),e}},cancel:e=>(a(e),o.return())},{highWaterMark:2})},{isFunction:Ie}=$,Me=(({Request:e,Response:t})=>({Request:e,Response:t}))($.global),{ReadableStream:ze,TextEncoder:He}=$.global,Je=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},We=e=>{e=$.merge.call({skipUndefined:!0},Me,e);const{fetch:t,Request:n,Response:r}=e,o=t?Ie(t):"function"==typeof fetch,s=Ie(n),i=Ie(r);if(!o)return!1;const a=o&&Ie(ze),c=o&&("function"==typeof He?(l=new He,e=>l.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var l;const u=s&&a&&Je(()=>{let e=!1;const t=new ze,r=new n(de.origin,{body:t,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return t.cancel(),e&&!r}),f=i&&a&&Je(()=>$.isReadableStream(new r("").body)),d={stream:f&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!d[e]&&(d[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new V(`Response type '${e}' is not supported`,V.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=$.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if($.isBlob(e))return e.size;if($.isSpecCompliantForm(e)){const t=new n(de.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $.isArrayBufferView(e)||$.isArrayBuffer(e)?e.byteLength:($.isURLSearchParams(e)&&(e+=""),$.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:i,data:a,signal:c,cancelToken:l,timeout:h,onDownloadProgress:m,onUploadProgress:b,responseType:g,headers:y,withCredentials:w="same-origin",fetchOptions:E}=Fe(e),R=t||fetch;g=g?(g+"").toLowerCase():"text";let O=Be([c,l&&l.toAbortSignal()],h),S=null;const T=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let A;try{if(b&&u&&"get"!==i&&"head"!==i&&0!==(A=await p(y,a))){let e,t=new n(o,{method:"POST",body:a,duplex:"half"});if($.isFormData(a)&&(e=t.headers.get("content-type"))&&y.setContentType(e),t.body){const[e,n]=Ce(A,ve(Ne(b)));a=qe(t.body,65536,e,n)}}$.isString(w)||(w=w?"include":"omit");const t=s&&"credentials"in n.prototype,c={...E,signal:O,method:i.toUpperCase(),headers:y.normalize().toJSON(),body:a,duplex:"half",credentials:t?w:void 0};S=s&&new n(o,c);let l=await(s?R(S,E):R(o,c));const h=f&&("stream"===g||"response"===g);if(f&&(m||h&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=l[t]});const t=$.toFiniteNumber(l.headers.get("content-length")),[n,o]=m&&Ce(t,ve(Ne(m),!0))||[];l=new r(qe(l.body,65536,n,()=>{o&&o(),T&&T()}),e)}g=g||"text";let v=await d[$.findKey(d,g)||"text"](l,e);return!h&&T&&T(),await new Promise((t,n)=>{Ae(t,n,{data:v,headers:Re.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:S})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new V("Network Error",V.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t});throw V.from(t,t&&t.code,e,S,t&&t.response)}}},$e=new Map,Ve=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,s=[r,o,n];let i,a,c=s.length,l=$e;for(;c--;)i=s[c],a=l.get(i),void 0===a&&l.set(i,a=c?new Map:We(t)),l=a;return a};Ve();const Ke={http:null,xhr:Le,fetch:{get:Ve}};$.forEach(Ke,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Xe=e=>`- ${e}`,Ge=e=>$.isFunction(e)||null===e||!1===e;var Qe={getAdapter:function(e,t){e=$.isArray(e)?e:[e];const{length:n}=e;let r,o;const s={};for(let i=0;i<n;i++){let n;if(r=e[i],o=r,!Ge(r)&&(o=Ke[(n=String(r)).toLowerCase()],void 0===o))throw new V(`Unknown adapter '${n}'`);if(o&&($.isFunction(o)||(o=o.get(t))))break;s[n||"#"+i]=o}if(!o){const e=Object.entries(s).map(([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Xe).join("\n"):" "+Xe(e[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Ke};function Ye(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Te(null,e)}function Ze(e){Ye(e),e.headers=Re.from(e.headers),e.data=Oe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Qe.getAdapter(e.adapter||he.adapter,e)(e).then(function(t){return Ye(e),t.data=Oe.call(e,e.transformResponse,t),t.headers=Re.from(t.headers),t},function(t){return Se(t)||(Ye(e),t&&t.response&&(t.response.data=Oe.call(e,e.transformResponse,t.response),t.response.headers=Re.from(t.response.headers))),Promise.reject(t)})}const et="1.15.0",tt={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{tt[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const nt={};tt.transitional=function(e,t,n){function r(e,t){return"[Axios v"+et+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new V(r(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!nt[o]&&(nt[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}},tt.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};var rt={assertOptions:function(e,t,n){if("object"!=typeof e)throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new V("option "+s+" must be "+n,V.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new V("Unknown option "+s,V.ERR_BAD_OPTION)}},validators:tt};const ot=rt.validators;let st=class{constructor(e){this.defaults=e||{},this.interceptors={request:new oe,response:new oe}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ue(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&rt.assertOptions(n,{silentJSONParsing:ot.transitional(ot.boolean),forcedJSONParsing:ot.transitional(ot.boolean),clarifyTimeoutError:ot.transitional(ot.boolean),legacyInterceptorReqResOrdering:ot.transitional(ot.boolean)},!1),null!=r&&($.isFunction(r)?t.paramsSerializer={serialize:r}:rt.assertOptions(r,{encode:ot.function,serialize:ot.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),rt.assertOptions(t,{baseUrl:ot.spelling("baseURL"),withXsrfToken:ot.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&$.merge(o.common,o[t.method]);o&&$.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=Re.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const n=t.transitional||se;n&&n.legacyInterceptorReqResOrdering?i.unshift(e.fulfilled,e.rejected):i.push(e.fulfilled,e.rejected)});const c=[];let l;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let u,f=0;if(!a){const e=[Ze.bind(this),void 0];for(e.unshift(...i),e.push(...c),u=e.length,l=Promise.resolve(t);f<u;)l=l.then(e[f++],e[f++]);return l}u=i.length;let d=t;for(;f<u;){const e=i[f++],t=i[f++];try{d=e(d)}catch(e){t.call(this,e);break}}try{l=Ze.call(this,d)}catch(e){return Promise.reject(e)}for(f=0,u=c.length;f<u;)l=l.then(c[f++],c[f++]);return l}getUri(e){return re(je((e=Ue(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};$.forEach(["delete","get","head","options"],function(e){st.prototype[e]=function(t,n){return this.request(Ue(n||{},{method:e,url:t,data:(n||{}).data}))}}),$.forEach(["post","put","patch"],function(e){function t(t){return function(n,r,o){return this.request(Ue(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}st.prototype[e]=t(),st.prototype[e+"Form"]=t(!0)});const it={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(it).forEach(([e,t])=>{it[t]=e});const at=function t(n){const r=new st(n),o=e(st.prototype.request,r);return $.extend(o,st.prototype,r,{allOwnKeys:!0}),$.extend(o,r,null,{allOwnKeys:!0}),o.create=function(e){return t(Ue(n,e))},o}(he);at.Axios=st,at.CanceledError=Te,at.CancelToken=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(e){t=e});const n=this;this.promise.then(e=>{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Te(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e(function(e){t=e}),cancel:t}}},at.isCancel=Se,at.VERSION=et,at.toFormData=Y,at.AxiosError=V,at.Cancel=at.CanceledError,at.all=function(e){return Promise.all(e)},at.spread=function(e){return function(t){return e.apply(null,t)}},at.isAxiosError=function(e){return $.isObject(e)&&!0===e.isAxiosError},at.mergeConfig=Ue,at.AxiosHeaders=Re,at.formToJSON=e=>pe($.isHTMLForm(e)?new FormData(e):e),at.getAdapter=Qe.getAdapter,at.HttpStatusCode=it,at.default=at;const{Axios:ct,AxiosError:lt,CanceledError:ut,isCancel:ft,CancelToken:dt,VERSION:pt,all:ht,Cancel:mt,isAxiosError:bt,spread:gt,toFormData:yt,AxiosHeaders:wt,HttpStatusCode:Et,formToJSON:Rt,getAdapter:Ot,mergeConfig:St}=at;export{ct as Axios,lt as AxiosError,wt as AxiosHeaders,mt as Cancel,dt as CancelToken,ut as CanceledError,Et as HttpStatusCode,pt as VERSION,ht as all,at as default,Rt as formToJSON,Ot as getAdapter,bt as isAxiosError,ft as isCancel,St as mergeConfig,gt as spread,yt as toFormData};
3
+ //# sourceMappingURL=axios.min.js.map