@sandeshnaroj/api-engine 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/api-engine.iife.js +10 -0
- package/dist/core/types.d.ts +15 -0
- package/dist/core/utils.d.ts +7 -0
- package/dist/index.cjs +10 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2400 -0
- package/dist/protocols/rest.d.ts +3 -0
- package/dist/protocols/socket.d.ts +29 -0
- package/dist/protocols/sse.d.ts +11 -0
- package/dist/schemas/manifest.d.ts +53 -0
- package/package.json +65 -0
- package/readme.md +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var APIEngine=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.defineProperty,n=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r};function r(e,t){return function(){return e.apply(t,arguments)}}var{toString:i}=Object.prototype,{getPrototypeOf:a}=Object,{iterator:o,toStringTag:s}=Symbol,c=(e=>t=>{let n=i.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),l=e=>(e=e.toLowerCase(),t=>c(t)===e),u=e=>t=>typeof t===e,{isArray:d}=Array,f=u(`undefined`);function p(e){return e!==null&&!f(e)&&e.constructor!==null&&!f(e.constructor)&&_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var m=l(`ArrayBuffer`);function h(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&m(e.buffer),t}var g=u(`string`),_=u(`function`),v=u(`number`),y=e=>typeof e==`object`&&!!e,b=e=>e===!0||e===!1,x=e=>{if(c(e)!==`object`)return!1;let t=a(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(s in e)&&!(o in e)},S=e=>{if(!y(e)||p(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},C=l(`Date`),w=l(`File`),ee=e=>!!(e&&e.uri!==void 0),te=e=>e&&e.getParts!==void 0,T=l(`Blob`),E=l(`FileList`),D=e=>y(e)&&_(e.pipe);function ne(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var O=ne(),re=O.FormData===void 0?void 0:O.FormData,ie=e=>{if(!e)return!1;if(re&&e instanceof re)return!0;let t=a(e);if(!t||t===Object.prototype||!_(e.append))return!1;let n=c(e);return n===`formdata`||n===`object`&&_(e.toString)&&e.toString()===`[object FormData]`},ae=l(`URLSearchParams`),[oe,se,ce,le]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(l),ue=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function k(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),d(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(p(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function de(e,t){if(p(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var A=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,fe=e=>!f(e)&&e!==A;function pe(...e){let{caseless:t,skipUndefined:n}=fe(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&de(r,i)||i,o=Te(r,a)?r[a]:void 0;x(o)&&x(e)?r[a]=pe(o,e):x(e)?r[a]=pe({},e):d(e)?r[a]=e.slice():(!n||!f(e))&&(r[a]=e)};for(let t=0,n=e.length;t<n;t++)e[t]&&k(e[t],i);return r}var me=(e,t,n,{allOwnKeys:i}={})=>(k(t,(t,i)=>{n&&_(t)?Object.defineProperty(e,i,{__proto__:null,value:r(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),e),he=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ge=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},_e=(e,t,n,r)=>{let i,o,s,c={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!r||r(s,e,t))&&!c[s]&&(t[s]=e[s],c[s]=!0);e=n!==!1&&a(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ve=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},ye=e=>{if(!e)return null;if(d(e))return e;let t=e.length;if(!v(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},be=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&a(Uint8Array)),xe=(e,t)=>{let n=(e&&e[o]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},Se=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ce=l(`HTMLFormElement`),we=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),Te=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ee=l(`RegExp`),De=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};k(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Oe=e=>{De(e,(t,n)=>{if(_(e)&&[`arguments`,`caller`,`callee`].includes(n))return!1;let r=e[n];if(_(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},ke=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return d(e)?r(e):r(String(e).split(t)),n},Ae=()=>{},je=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Me(e){return!!(e&&_(e.append)&&e[s]===`FormData`&&e[o])}var Ne=e=>{let t=Array(10),n=(e,r)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(p(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=d(e)?[]:{};return k(e,(e,t)=>{let a=n(e,r+1);!f(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},Pe=l(`AsyncFunction`),Fe=e=>e&&(y(e)||_(e))&&_(e.then)&&_(e.catch),Ie=((e,t)=>e?setImmediate:t?((e,t)=>(A.addEventListener(`message`,({source:n,data:r})=>{n===A&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),A.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,_(A.postMessage)),j={isArray:d,isArrayBuffer:m,isBuffer:p,isFormData:ie,isArrayBufferView:h,isString:g,isNumber:v,isBoolean:b,isObject:y,isPlainObject:x,isEmptyObject:S,isReadableStream:oe,isRequest:se,isResponse:ce,isHeaders:le,isUndefined:f,isDate:C,isFile:w,isReactNativeBlob:ee,isReactNative:te,isBlob:T,isRegExp:Ee,isFunction:_,isStream:D,isURLSearchParams:ae,isTypedArray:be,isFileList:E,forEach:k,merge:pe,extend:me,trim:ue,stripBOM:he,inherits:ge,toFlatObject:_e,kindOf:c,kindOfTest:l,endsWith:ve,toArray:ye,forEachEntry:xe,matchAll:Se,isHTMLForm:Ce,hasOwnProperty:Te,hasOwnProp:Te,reduceDescriptors:De,freezeMethods:Oe,toObjectSet:ke,toCamelCase:we,noop:Ae,toFiniteNumber:je,findKey:de,global:A,isContextDefined:fe,isSpecCompliantForm:Me,toJSONObject:Ne,isAsyncFn:Pe,isThenable:Fe,setImmediate:Ie,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(A):typeof process<`u`&&process.nextTick||Ie,isIterable:e=>e!=null&&_(e[o])},Le=j.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`]),Re=e=>{let t={},n,r,i;return e&&e.split(`
|
|
2
|
+
`).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&Le[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},ze=Symbol(`internals`),Be=/[^\x09\x20-\x7E\x80-\xFF]/g;function Ve(e){let t=0,n=e.length;for(;t<n;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}function M(e){return e&&String(e).trim().toLowerCase()}function He(e){return Ve(e.replace(Be,``))}function N(e){return e===!1||e==null?e:j.isArray(e)?e.map(N):He(String(e))}function Ue(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var We=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ge(e,t,n,r,i){if(j.isFunction(r))return r.call(this,t,n);if(i&&(t=n),j.isString(t)){if(j.isString(r))return t.indexOf(r)!==-1;if(j.isRegExp(r))return r.test(t)}}function Ke(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function qe(e,t){let n=j.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var P=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=M(t);if(!i)throw Error(`header name must be a non-empty string`);let a=j.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=N(e))}let a=(e,t)=>j.forEach(e,(e,n)=>i(e,n,t));if(j.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(j.isString(e)&&(e=e.trim())&&!We(e))a(Re(e),t);else if(j.isObject(e)&&j.isIterable(e)){let n={},r,i;for(let t of e){if(!j.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?j.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=M(e),e){let n=j.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return Ue(e);if(j.isFunction(t))return t.call(this,e,n);if(j.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=M(e),e){let n=j.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Ge(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=M(e),e){let i=j.findKey(n,e);i&&(!t||Ge(n,n[i],i,t))&&(delete n[i],r=!0)}}return j.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||Ge(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return j.forEach(this,(r,i)=>{let a=j.findKey(n,i);if(a){t[a]=N(r),delete t[i];return}let o=e?Ke(i):String(i).trim();o!==i&&delete t[i],t[o]=N(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return j.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&j.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(`
|
|
3
|
+
`)}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){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[ze]=this[ze]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=M(e);t[r]||(qe(n,e),t[r]=!0)}return j.isArray(e)?e.forEach(r):r(e),this}};P.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),j.reduceDescriptors(P.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),j.freezeMethods(P);var Je=`[REDACTED ****]`;function Ye(e){if(j.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(j.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function Xe(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||j.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof P&&(e=e.toJSON()),r.push(e);let t;if(j.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);j.isUndefined(r)||(t[n]=r)});else{if(!j.isPlainObject(e)&&Ye(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?Je:i(a);j.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var F=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{__proto__:null,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),i&&(this.response=i,this.status=i.status)}toJSON(){let e=this.config,t=e&&j.hasOwnProp(e,`redact`)?e.redact:void 0,n=j.isArray(t)&&t.length>0?Xe(e,t):j.toJSONObject(e);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:n,code:this.code,status:this.status}}};F.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,F.ERR_BAD_OPTION=`ERR_BAD_OPTION`,F.ECONNABORTED=`ECONNABORTED`,F.ETIMEDOUT=`ETIMEDOUT`,F.ECONNREFUSED=`ECONNREFUSED`,F.ERR_NETWORK=`ERR_NETWORK`,F.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,F.ERR_DEPRECATED=`ERR_DEPRECATED`,F.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,F.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,F.ERR_CANCELED=`ERR_CANCELED`,F.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,F.ERR_INVALID_URL=`ERR_INVALID_URL`,F.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function Ze(e){return j.isPlainObject(e)||j.isArray(e)}function Qe(e){return j.endsWith(e,`[]`)?e.slice(0,-2):e}function $e(e,t,n){return e?e.concat(t).map(function(e,t){return e=Qe(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function et(e){return j.isArray(e)&&!e.some(Ze)}var tt=j.toFlatObject(j,{},null,function(e){return/^is[A-Z]/.test(e)});function I(e,t,n){if(!j.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=j.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!j.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||d,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&j.isSpecCompliantForm(t);if(!j.isFunction(i))throw TypeError(`visitor must be a function`);function u(e){if(e===null)return``;if(j.isDate(e))return e.toISOString();if(j.isBoolean(e))return e.toString();if(!l&&j.isBlob(e))throw new F(`Blob is not supported. Use a Buffer instead.`);return j.isArrayBuffer(e)||j.isTypedArray(e)?l&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function d(e,n,i){let s=e;if(j.isReactNative(t)&&j.isReactNativeBlob(e))return t.append($e(i,n,a),u(e)),!1;if(e&&!i&&typeof e==`object`){if(j.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(j.isArray(e)&&et(e)||(j.isFileList(e)||j.endsWith(n,`[]`))&&(s=j.toArray(e)))return n=Qe(n),s.forEach(function(e,r){!(j.isUndefined(e)||e===null)&&t.append(o===!0?$e([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return Ze(e)?!0:(t.append($e(i,n,a),u(e)),!1)}let f=[],p=Object.assign(tt,{defaultVisitor:d,convertValue:u,isVisitable:Ze});function m(e,n,r=0){if(!j.isUndefined(e)){if(r>c)throw new F(`Object is too deeply nested (`+r+` levels). Max depth: `+c,F.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));f.push(e),j.forEach(e,function(e,a){(!(j.isUndefined(e)||e===null)&&i.call(t,e,j.isString(a)?a.trim():a,n,p))===!0&&m(e,n?n.concat(a):[a],r+1)}),f.pop()}}if(!j.isObject(e))throw TypeError(`data must be an object`);return m(e),t}function nt(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function rt(e,t){this._pairs=[],e&&I(e,this,t)}var it=rt.prototype;it.append=function(e,t){this._pairs.push([e,t])},it.toString=function(e){let t=e?function(t){return e.call(this,t,nt)}:nt;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function at(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function ot(e,t,n){if(!t)return e;let r=n&&n.encode||at,i=j.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):j.isURLSearchParams(t)?t.toString():new rt(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var st=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){j.forEach(this.handlers,function(t){t!==null&&e(t)})}},ct={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},lt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:rt,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},ut=n({hasBrowserEnv:()=>dt,hasStandardBrowserEnv:()=>pt,hasStandardBrowserWebWorkerEnv:()=>mt,navigator:()=>ft,origin:()=>ht}),dt=typeof window<`u`&&typeof document<`u`,ft=typeof navigator==`object`&&navigator||void 0,pt=dt&&(!ft||[`ReactNative`,`NativeScript`,`NS`].indexOf(ft.product)<0),mt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,ht=dt&&window.location.href||`http://localhost`,L={...ut,...lt};function gt(e,t){return I(e,new L.classes.URLSearchParams,{visitor:function(e,t,n,r){return L.isNode&&j.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function _t(e){return j.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function vt(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function yt(e){function t(e,n,r,i){let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&j.isArray(r)?r.length:a,s?(j.hasOwnProp(r,a)?r[a]=j.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!r[a]||!j.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&j.isArray(r[a])&&(r[a]=vt(r[a])),!o)}if(j.isFormData(e)&&j.isFunction(e.entries)){let n={};return j.forEachEntry(e,(e,r)=>{t(_t(e),r,n,0)}),n}return null}var R=(e,t)=>e!=null&&j.hasOwnProp(e,t)?e[t]:void 0;function bt(e,t,n){if(j.isString(e))try{return(t||JSON.parse)(e),j.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var z={transitional:ct,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=j.isObject(e);if(i&&j.isHTMLForm(e)&&(e=new FormData(e)),j.isFormData(e))return r?JSON.stringify(yt(e)):e;if(j.isArrayBuffer(e)||j.isBuffer(e)||j.isStream(e)||j.isFile(e)||j.isBlob(e)||j.isReadableStream(e))return e;if(j.isArrayBufferView(e))return e.buffer;if(j.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=R(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return gt(e,t).toString();if((a=j.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=R(this,`env`),r=n&&n.FormData;return I(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),bt(e)):e}],transformResponse:[function(e){let t=R(this,`transitional`)||z.transitional,n=t&&t.forcedJSONParsing,r=R(this,`responseType`),i=r===`json`;if(j.isResponse(e)||j.isReadableStream(e))return e;if(e&&j.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,R(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?F.from(e,F.ERR_BAD_RESPONSE,this,null,R(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:L.classes.FormData,Blob:L.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};j.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`],e=>{z.headers[e]={}});function xt(e,t){let n=this||z,r=t||n,i=P.from(r.headers),a=r.data;return j.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function St(e){return!!(e&&e.__CANCEL__)}var B=class extends F{constructor(e,t,n){super(e??`canceled`,F.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function Ct(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new F(`Request failed with status code `+n.status,n.status>=400&&n.status<500?F.ERR_BAD_REQUEST:F.ERR_BAD_RESPONSE,n.config,n.request,n))}function wt(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}function Tt(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;let f=l&&c-l;return f?Math.round(d*1e3/f):void 0}}function Et(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var V=(e,t,n=3)=>{let r=0,i=Tt(50,250);return Et(n=>{let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Dt=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ot=e=>(...t)=>j.asap(()=>e(...t)),kt=L.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,L.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(L.origin),L.navigator&&/(msie|trident)/i.test(L.navigator.userAgent)):()=>!0,At=L.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];j.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),j.isString(r)&&s.push(`path=${r}`),j.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),j.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.split(`;`);for(let n=0;n<t.length;n++){let r=t[n].replace(/^\s+/,``),i=r.indexOf(`=`);if(i!==-1&&r.slice(0,i)===e)return decodeURIComponent(r.slice(i+1))}return null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function jt(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Mt(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Nt(e,t,n){let r=!jt(t);return e&&(r||n===!1)?Mt(e,t):t}var Pt=e=>e instanceof P?{...e}:e;function H(e,t){t||={};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return j.isPlainObject(e)&&j.isPlainObject(t)?j.merge.call({caseless:r},e,t):j.isPlainObject(t)?j.merge({},t):j.isArray(t)?t.slice():t}function i(e,t,n,i){if(!j.isUndefined(t))return r(e,t,n,i);if(!j.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!j.isUndefined(t))return r(void 0,t)}function o(e,t){if(!j.isUndefined(t))return r(void 0,t);if(!j.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(j.hasOwnProp(t,a))return r(n,i);if(j.hasOwnProp(e,a))return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Pt(e),Pt(t),n,!0)};return j.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=j.hasOwnProp(c,r)?c[r]:i,o=a(j.hasOwnProp(e,r)?e[r]:void 0,j.hasOwnProp(t,r)?t[r]:void 0,r);j.isUndefined(o)&&a!==s||(n[r]=o)}),n}var Ft=[`content-type`,`content-length`];function It(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t).forEach(([t,n])=>{Ft.includes(t.toLowerCase())&&e.set(t,n)})}var Lt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),Rt=e=>{let t=H({},e),n=e=>j.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=P.from(s),t.url=ot(Nt(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?Lt(c.password):``))),j.isFormData(r)&&(L.hasStandardBrowserEnv||L.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):j.isFunction(r.getHeaders)&&It(s,r.getHeaders(),n(`formDataHeaderPolicy`))),L.hasStandardBrowserEnv&&(j.isFunction(i)&&(i=i(t)),i===!0||i==null&&kt(t.url))){let e=a&&o&&At.read(o);e&&s.set(a,e)}return t},zt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=Rt(e),i=r.data,a=P.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=P.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());Ct(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&=(n(new F(`Request aborted`,F.ECONNABORTED,e,h)),m(),null)},h.onerror=function(t){let r=new F(t&&t.message?t.message:`Network Error`,F.ERR_NETWORK,e,h);r.event=t||null,n(r),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||ct;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new F(t,i.clarifyTimeoutError?F.ETIMEDOUT:F.ECONNABORTED,e,h)),m(),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&j.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),j.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=V(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=V(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new B(null,e,h):t),h.abort(),m(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=wt(r.url);if(_&&!L.protocols.includes(_)){n(new F(`Unsupported protocol `+_+`:`,F.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Bt=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n=new AbortController,r,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof F?t:new B(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new F(`timeout of ${t}ms exceeded`,F.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>j.asap(o),s}},Vt=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},Ht=async function*(e,t){for await(let n of Ut(e))yield*Vt(n,t)},Ut=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Wt=(e,t,n,r)=>{let i=Ht(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})};function Gt(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;n<t;n++)if(r.charCodeAt(n)===37&&n+2<t){let t=r.charCodeAt(n+1),i=r.charCodeAt(n+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102)&&(e-=2,n+=2)}let n=0,i=t-1,a=e=>e>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}if(typeof Buffer<`u`&&typeof Buffer.byteLength==`function`)return Buffer.byteLength(r,`utf8`);let i=0;for(let e=0,t=r.length;e<t;e++){let n=r.charCodeAt(e);if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){let t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var Kt=`1.16.0`,qt=64*1024,{isFunction:U}=j,Jt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Yt=e=>{let t=j.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=j.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?U(i):typeof fetch==`function`,c=U(a),l=U(o);if(!s)return!1;let u=s&&U(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&Jt(()=>{let e=!1,t=new a(L.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&Jt(()=>j.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new F(`Response type '${e}' is not supported`,F.ERR_NOT_SUPPORT,n)})});let h=async e=>{if(e==null)return 0;if(j.isBlob(e))return e.size;if(j.isSpecCompliantForm(e))return(await new a(L.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(j.isArrayBufferView(e)||j.isArrayBuffer(e))return e.byteLength;if(j.isURLSearchParams(e)&&(e+=``),j.isString(e))return(await d(e)).byteLength},g=async(e,t)=>j.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:u,timeout:d,onDownloadProgress:h,onUploadProgress:_,responseType:v,headers:y,withCredentials:b=`same-origin`,fetchOptions:x,maxContentLength:S,maxBodyLength:C}=Rt(e),w=j.isNumber(S)&&S>-1,ee=j.isNumber(C)&&C>-1,te=i||fetch;v=v?(v+``).toLowerCase():`text`;let T=Bt([l,u&&u.toAbortSignal()],d),E=null,D=T&&T.unsubscribe&&(()=>{T.unsubscribe()}),ne;try{if(w&&typeof t==`string`&&t.startsWith(`data:`)&&Gt(t)>S)throw new F(`maxContentLength size of `+S+` exceeded`,F.ERR_BAD_RESPONSE,e,E);if(ee&&n!==`get`&&n!==`head`){let t=await g(y,s);if(typeof t==`number`&&isFinite(t)&&t>C)throw new F(`Request body larger than maxBodyLength limit`,F.ERR_BAD_REQUEST,e,E)}if(_&&f&&n!==`get`&&n!==`head`&&(ne=await g(y,s))!==0){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(j.isFormData(s)&&(n=e.headers.get(`content-type`))&&y.setContentType(n),e.body){let[t,n]=Dt(ne,V(Ot(_)));s=Wt(e.body,qt,t,n)}}j.isString(b)||(b=b?`include`:`omit`);let i=c&&`credentials`in a.prototype;if(j.isFormData(s)){let e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete(`content-type`)}y.set(`User-Agent`,`axios/`+Kt,!1);let l={...x,signal:T,method:n.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:`half`,credentials:i?b:void 0};E=c&&new a(t,l);let u=await(c?te(E,x):te(t,l));if(w){let t=j.toFiniteNumber(u.headers.get(`content-length`));if(t!=null&&t>S)throw new F(`maxContentLength size of `+S+` exceeded`,F.ERR_BAD_RESPONSE,e,E)}let d=p&&(v===`stream`||v===`response`);if(p&&u.body&&(h||w||d&&D)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=u[e]});let n=j.toFiniteNumber(u.headers.get(`content-length`)),[r,i]=h&&Dt(n,V(Ot(h),!0))||[],a=0;u=new o(Wt(u.body,qt,t=>{if(w&&(a=t,a>S))throw new F(`maxContentLength size of `+S+` exceeded`,F.ERR_BAD_RESPONSE,e,E);r&&r(t)},()=>{i&&i(),D&&D()}),t)}v||=`text`;let O=await m[j.findKey(m,v)||`text`](u,e);if(w&&!p&&!d){let t;if(O!=null&&(typeof O.byteLength==`number`?t=O.byteLength:typeof O.size==`number`?t=O.size:typeof O==`string`&&(t=typeof r==`function`?new r().encode(O).byteLength:O.length)),typeof t==`number`&&t>S)throw new F(`maxContentLength size of `+S+` exceeded`,F.ERR_BAD_RESPONSE,e,E)}return!d&&D&&D(),await new Promise((t,n)=>{Ct(t,n,{data:O,headers:P.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:E})})}catch(t){if(D&&D(),T&&T.aborted&&T.reason instanceof F){let n=T.reason;throw n.config=e,E&&(n.request=E),t!==n&&(n.cause=t),n}throw t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new F(`Network Error`,F.ERR_NETWORK,e,E,t&&t.response),{cause:t.cause||t}):F.from(t,t&&t.code,e,E,t&&t.response)}}},Xt=new Map,Zt=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=Xt;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:Yt(t)),l=c;return c};Zt();var Qt={http:null,xhr:zt,fetch:{get:Zt}};j.forEach(Qt,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{__proto__:null,value:t})}catch{}Object.defineProperty(e,`adapterName`,{__proto__:null,value:t})}});var $t=e=>`- ${e}`,en=e=>j.isFunction(e)||e===null||e===!1;function tn(e,t){e=j.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o<n;o++){r=e[o];let n;if(i=r,!en(r)&&(i=Qt[(n=String(r)).toLowerCase()],i===void 0))throw new F(`Unknown adapter '${n}'`);if(i&&(j.isFunction(i)||(i=i.get(t))))break;a[n||`#`+o]=i}if(!i){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new F(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
|
|
4
|
+
`+e.map($t).join(`
|
|
5
|
+
`):` `+$t(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var nn={getAdapter:tn,adapters:Qt};function rn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new B(null,e)}function an(e){return rn(e),e.headers=P.from(e.headers),e.data=xt.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),nn.getAdapter(e.adapter||z.adapter,e)(e).then(function(t){rn(e),e.response=t;try{t.data=xt.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=P.from(t.headers),t},function(t){if(!St(t)&&(rn(e),t&&t.response)){e.response=t.response;try{t.response.data=xt.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=P.from(t.response.headers)}return Promise.reject(t)})}var on={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{on[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var sn={};on.transitional=function(e,t,n){function r(e,t){return`[Axios v`+Kt+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new F(r(i,` has been removed`+(t?` in `+t:``)),F.ERR_DEPRECATED);return t&&!sn[i]&&(sn[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},on.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function cn(e,t,n){if(typeof e!=`object`)throw new F(`options must be an object`,F.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new F(`option `+a+` must be `+n,F.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new F(`Unknown option `+a,F.ERR_BAD_OPTION)}}var ln={assertOptions:cn,validators:on},W=ln.validators,G=class{constructor(e){this.defaults=e||{},this.interceptors={request:new st,response:new st}}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=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(`
|
|
6
|
+
`);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
|
|
7
|
+
`),r=t===-1?-1:n.indexOf(`
|
|
8
|
+
`,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
|
|
9
|
+
`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=H(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&ln.assertOptions(n,{silentJSONParsing:W.transitional(W.boolean),forcedJSONParsing:W.transitional(W.boolean),clarifyTimeoutError:W.transitional(W.boolean),legacyInterceptorReqResOrdering:W.transitional(W.boolean)},!1),r!=null&&(j.isFunction(r)?t.paramsSerializer={serialize:r}:ln.assertOptions(r,{encode:W.function,serialize:W.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),ln.assertOptions(t,{baseUrl:W.spelling(`baseURL`),withXsrfToken:W.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&j.merge(i.common,i[t.method]);i&&j.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=P.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||ct;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[an.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=an.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=H(this.defaults,e),ot(Nt(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};j.forEach([`delete`,`get`,`head`,`options`],function(e){G.prototype[e]=function(t,n){return this.request(H(n||{},{method:e,url:t,data:(n||{}).data}))}}),j.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(H(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}G.prototype[e]=t(),e!==`query`&&(G.prototype[e+`Form`]=t(!0))});var un=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let 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,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new B(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let 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}}};function dn(e){return function(t){return e.apply(null,t)}}function fn(e){return j.isObject(e)&&e.isAxiosError===!0}var pn={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(pn).forEach(([e,t])=>{pn[t]=e});function mn(e){let t=new G(e),n=r(G.prototype.request,t);return j.extend(n,G.prototype,t,{allOwnKeys:!0}),j.extend(n,t,null,{allOwnKeys:!0}),n.create=function(t){return mn(H(e,t))},n}var K=mn(z);K.Axios=G,K.CanceledError=B,K.CancelToken=un,K.isCancel=St,K.VERSION=Kt,K.toFormData=I,K.AxiosError=F,K.Cancel=K.CanceledError,K.all=function(e){return Promise.all(e)},K.spread=dn,K.isAxiosError=fn,K.mergeConfig=H,K.AxiosHeaders=P,K.formToJSON=e=>yt(j.isHTMLForm(e)?new FormData(e):e),K.getAdapter=nn.getAdapter,K.HttpStatusCode=pn,K.default=K;var hn=(e,t,n={})=>{let r=/^(https?|wss?):\/\//i.test(t)?t:`${e.replace(/\/$/,``)}/${t.replace(/^\//,``)}`,i=[],a=new Set;return r=r.replace(/:(\w+)/g,(e,t)=>n[t]===void 0?`:${t}`:(a.add(t),encodeURIComponent(String(n[t])))),Object.keys(n).forEach(e=>{if(!a.has(e)&&n[e]!==void 0){let t=n[e];Array.isArray(t)?t.forEach(t=>i.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`)):i.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`)}}),i.length>0?`${r}?${i.join(`&`)}`:r},gn=e=>async(t,n={})=>{if(t.protocol!==`REST`)throw Error(`REST adapter cannot handle ${t.protocol} protocol`);let r={url:hn(e,t.path,n.params),method:t.method,headers:{"Content-Type":`application/json`,...t.headers,...n.headers},data:[`GET`,`DELETE`].includes(t.method)?void 0:n.body,timeout:t.timeout||5e3,...t.options,...n.fetchOptions};try{return(await K.request(r)).data}catch(e){if(K.isAxiosError(e)){let t=e.response?.status||`Network Error`,n=e.response?.data?.message||e.message;throw Error(`[REST ${t}]: ${n}`)}throw e}},_n=class{constructor(e,t){this.endpoint=e,this.url=t,this.socket=null,this.subscribers=new Set,this.retryCount=0}connect(){if(typeof window>`u`){console.error(`APIEngine: WebSockets are only supported in the browser environment.`);return}this.socket?.readyState!==WebSocket.OPEN&&(this.socket=new WebSocket(this.url),this.socket.onopen=()=>{this.retryCount=0,this.startHeartbeat(),console.log(`[WS] Connected: ${this.url}`)},this.socket.onmessage=e=>{try{let t=typeof e.data==`string`?JSON.parse(e.data):e.data;this.subscribers.forEach(e=>e(t))}catch{this.subscribers.forEach(t=>t(e.data))}},this.socket.onclose=e=>{this.stopHeartbeat(),this.endpoint.autoReconnect&&e.code!==1e3&&this.reconnect()},this.socket.onerror=e=>{console.error(`[WS] Error:`,e)})}reconnect(){let e=this.endpoint.maxRetries||5;if(this.retryCount>=e){console.warn(`[WS] Max reconnection attempts reached for ${this.url}`);return}let t=Math.min(1e3*2**this.retryCount,3e4);this.retryCount++,console.log(`[WS] Reconnecting in ${t}ms... (Attempt ${this.retryCount}/${e})`),this.reconnectTimer=setTimeout(()=>this.connect(),t)}startHeartbeat(){this.endpoint.pingInterval&&(this.heartbeatTimer=setInterval(()=>{this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify({type:`ping`}))},this.endpoint.pingInterval))}stopHeartbeat(){clearInterval(this.heartbeatTimer),clearTimeout(this.reconnectTimer)}subscribe(e){return this.subscribers.add(e),(!this.socket||this.socket.readyState===WebSocket.CLOSED)&&this.connect(),()=>{this.subscribers.delete(e),this.subscribers.size===0&&this.close()}}send(e){if(this.socket?.readyState===WebSocket.OPEN){let t=typeof e==`string`?e:JSON.stringify(e);this.socket.send(t)}else console.warn(`[WS] Cannot send message: Connection is not open.`)}close(){this.stopHeartbeat(),this.socket&&=(this.socket.onclose=null,this.socket.close(1e3),null),console.log(`[WS] Connection closed: ${this.url}`)}},vn;function yn(e){return{lang:e?.lang??vn?.lang,message:e?.message,abortEarly:e?.abortEarly??vn?.abortEarly,abortPipeEarly:e?.abortPipeEarly??vn?.abortPipeEarly}}var bn;function xn(e){return bn?.get(e)}var Sn;function Cn(e){return Sn?.get(e)}var wn;function Tn(e,t){return wn?.get(e)?.get(t)}function En(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function q(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??En(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??Tn(e.reference,c.lang)??(l?Cn(c.lang):null)??r.message??xn(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function J(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},yn())}}}function Dn(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function On(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var kn=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function An(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function jn(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function Mn(e){return{kind:`schema`,type:`boolean`,reference:Mn,expects:`boolean`,async:!1,message:e,get"~standard"(){return J(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:q(this,`type`,e,t),e}}}function Nn(e,t){return{kind:`schema`,type:`literal`,reference:Nn,expects:En(e),async:!1,literal:e,message:t,get"~standard"(){return J(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:q(this,`type`,e,t),e}}}function Pn(e){return{kind:`schema`,type:`number`,reference:Pn,expects:`number`,async:!1,message:e,get"~standard"(){return J(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:q(this,`type`,e,t),e}}}function Y(e,t){return{kind:`schema`,type:`object`,reference:Y,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return J(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:jn(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=An(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(q(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else q(this,`type`,e,t);return e}}}function X(e,t){return{kind:`schema`,type:`optional`,reference:X,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return J(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=jn(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Z(e,t){return{kind:`schema`,type:`picklist`,reference:Z,expects:On(e.map(En),`|`),async:!1,options:e,message:t,get"~standard"(){return J(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:q(this,`type`,e,t),e}}}function Q(e,t,n){return{kind:`schema`,type:`record`,reference:Q,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return J(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(Dn(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else q(this,`type`,e,t);return e}}}function $(e){return{kind:`schema`,type:`string`,reference:$,expects:`string`,async:!1,message:e,get"~standard"(){return J(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:q(this,`type`,e,t),e}}}function Fn(e,t,n){return{kind:`schema`,type:`variant`,reference:Fn,expects:`Object`,async:!1,key:e,options:t,message:n,get"~standard"(){return J(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},{abortEarly:!0}).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;q(this,`type`,e,t,{input:n[a],expected:On(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else q(this,`type`,e,t);return e}}}function In(e,t,n){let r=e[`~run`]({value:t},yn(n));if(r.issues)throw new kn(r.issues);return r.value}var Ln=Y({version:$(),baseUrl:$(),endpoints:Q($(),Fn(`protocol`,[Y({protocol:Nn(`REST`),path:$(),method:Z([`GET`,`POST`,`PUT`,`DELETE`]),headers:X(Q($(),$()),{}),options:X(Y({cache:X(Z([`default`,`no-store`,`reload`,`force-cache`])),credentials:X(Z([`include`,`same-origin`,`omit`]))}),{}),timeout:X(Pn(),5e3)}),Y({protocol:Nn(`WS`),path:$(),autoReconnect:X(Mn(),!0),maxRetries:X(Pn(),5),pingInterval:X(Pn(),3e4)}),Y({protocol:Nn(`SSE`),path:$(),method:X(Z([`GET`,`POST`]),`GET`),headers:X(Q($(),$()),{}),eventType:X($(),`message`)})]))});async function Rn(e,t){let n=e.getReader(),r;for(;!(r=await n.read()).done;)t(r.value)}function zn(e){let t,n,r,i=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=Vn(t,a);let o=t.length,s=0;for(;n<o;){i&&=(t[n]===10&&(s=++n),!1);let a=-1;for(;n<o&&a===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-s);break;case 13:i=!0;case 10:a=n;break}if(a===-1)break;e(t.subarray(s,a),r),s=n,r=-1}s===o?t=void 0:s!==0&&(t=t.subarray(s),n-=s)}}function Bn(e,t,n){let r=Hn(),i=new TextDecoder;return function(a,o){if(a.length===0)n?.(r),r=Hn();else if(o>0){let n=i.decode(a.subarray(0,o)),s=o+(a[o+1]===32?2:1),c=i.decode(a.subarray(s));switch(n){case`data`:r.data=r.data?r.data+`
|
|
10
|
+
`+c:c;break;case`event`:r.event=c;break;case`id`:e(r.id=c);break;case`retry`:let n=parseInt(c,10);isNaN(n)||t(r.retry=n);break}}}}function Vn(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Hn(){return{data:``,event:``,id:``,retry:void 0}}var Un=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Wn=`text/event-stream`,Gn=1e3,Kn=`last-event-id`;function qn(e,t){var{signal:n,headers:r,onopen:i,onmessage:a,onclose:o,onerror:s,openWhenHidden:c,fetch:l}=t,u=Un(t,[`signal`,`headers`,`onopen`,`onmessage`,`onclose`,`onerror`,`openWhenHidden`,`fetch`]);return new Promise((t,d)=>{let f=Object.assign({},r);f.accept||=Wn;let p;function m(){p.abort(),document.hidden||b()}c||document.addEventListener(`visibilitychange`,m);let h=Gn,g=0;function _(){document.removeEventListener(`visibilitychange`,m),window.clearTimeout(g),p.abort()}n?.addEventListener(`abort`,()=>{_(),t()});let v=l??window.fetch,y=i??Jn;async function b(){p=new AbortController;try{let n=await v(e,Object.assign(Object.assign({},u),{headers:f,signal:p.signal}));await y(n),await Rn(n.body,zn(Bn(e=>{e?f[Kn]=e:delete f[Kn]},e=>{h=e},a))),o?.(),_(),t()}catch(e){if(!p.signal.aborted)try{let t=s?.(e)??h;window.clearTimeout(g),g=window.setTimeout(b,t)}catch(e){_(),d(e)}}}b()})}function Jn(e){let t=e.headers.get(`content-type`);if(!t?.startsWith(`text/event-stream`))throw Error(`Expected content-type to be ${Wn}, Actual: ${t}`)}var Yn=e=>(t,n={})=>{if(t.protocol!==`SSE`)throw Error(`Invalid Protocol`);let r=t.path.replace(/:(\w+)/g,(e,t)=>n.params?.[t]||`:${t}`),i=r.startsWith(`http`)?r:`${e}${r}`,a=new Set,o=new AbortController;return(async()=>{await qn(i,{method:t.method||`GET`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`,...t.headers,...n.headers},body:n.body?JSON.stringify(n.body):void 0,signal:o.signal,openWhenHidden:!0,onmessage(e){console.log(`Raw SSE Message arrived:`,e),a.forEach(t=>t({id:e.id,event:e.event,data:e.data}))},onopen:async e=>{if(!e.ok)throw Error(`SSE Open Error: ${e.status}`)},onerror:e=>{console.error(`SSE stream error, attempting retry...`,e)}})})(),{subscribe:e=>(a.add(e),()=>{a.delete(e),a.size===0&&o.abort()}),close:()=>{o.abort()}}};return e.APIEngine=class{constructor(e){this.socketManagers=new Map,this.manifest=In(Ln,e),this.baseUrl=this.manifest.baseUrl}async call(e,t){let n=this.manifest.endpoints[e];if(n.protocol!==`REST`)throw Error(`Use .watch() for streams`);return gn(this.baseUrl)(n,t)}watch(e,t={}){let n=this.manifest.endpoints[e];if(!n)throw Error(`Endpoint ${e} not found.`);switch(n.protocol){case`WS`:let r=hn(this.baseUrl.replace(`http`,`ws`),n.path,t.params);return console.log(`Connecting to WebSocket at ${r} with options:`,t),this.socketManagers.has(e)||this.socketManagers.set(e,new _n(n,r)),this.socketManagers.get(e);case`SSE`:return Yn(hn(this.baseUrl,n.path,t.params))(n,t);default:throw Error(`Protocol ${n.protocol} is not streamable.`)}}},e})({});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RequestOptions {
|
|
2
|
+
/** Dynamic headers (e.g., Auth tokens, Tenant IDs) */
|
|
3
|
+
headers?: Record<string, string>;
|
|
4
|
+
/** URL path parameters (e.g., replaces ":id" in "/sensors/:id") */
|
|
5
|
+
params?: Record<string, string | number>;
|
|
6
|
+
/** Query string parameters (e.g., ?limit=10) */
|
|
7
|
+
query?: Record<string, string | number | boolean>;
|
|
8
|
+
/** The request payload for POST/PUT/PATCH */
|
|
9
|
+
body?: any;
|
|
10
|
+
/** Request timeout in milliseconds */
|
|
11
|
+
timeout?: number;
|
|
12
|
+
/** AbortSignal to cancel the request/stream from the UI */
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
fetchOptions?: Record<string, any>;
|
|
15
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function n(e,t){return function(){return e.apply(t,arguments)}}var{toString:r}=Object.prototype,{getPrototypeOf:i}=Object,{iterator:a,toStringTag:o}=Symbol,s=(e=>t=>{let n=r.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),c=e=>(e=e.toLowerCase(),t=>s(t)===e),l=e=>t=>typeof t===e,{isArray:u}=Array,d=l(`undefined`);function f(e){return e!==null&&!d(e)&&e.constructor!==null&&!d(e.constructor)&&g(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var p=c(`ArrayBuffer`);function m(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&p(e.buffer),t}var h=l(`string`),g=l(`function`),_=l(`number`),v=e=>typeof e==`object`&&!!e,y=e=>e===!0||e===!1,b=e=>{if(s(e)!==`object`)return!1;let t=i(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(o in e)&&!(a in e)},ee=e=>{if(!v(e)||f(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},x=c(`Date`),te=c(`File`),S=e=>!!(e&&e.uri!==void 0),ne=e=>e&&e.getParts!==void 0,re=c(`Blob`),C=c(`FileList`),w=e=>v(e)&&g(e.pipe);function T(){return typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{}}var E=T(),D=E.FormData===void 0?void 0:E.FormData,ie=e=>{if(!e)return!1;if(D&&e instanceof D)return!0;let t=i(e);if(!t||t===Object.prototype||!g(e.append))return!1;let n=s(e);return n===`formdata`||n===`object`&&g(e.toString)&&e.toString()===`[object FormData]`},ae=c(`URLSearchParams`),[oe,se,ce,le]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(c),ue=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function O(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),u(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(f(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function de(e,t){if(f(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var k=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,fe=e=>!d(e)&&e!==k;function pe(...e){let{caseless:t,skipUndefined:n}=fe(this)&&this||{},r={},i=(e,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=t&&de(r,i)||i,o=Te(r,a)?r[a]:void 0;b(o)&&b(e)?r[a]=pe(o,e):b(e)?r[a]=pe({},e):u(e)?r[a]=e.slice():(!n||!d(e))&&(r[a]=e)};for(let t=0,n=e.length;t<n;t++)e[t]&&O(e[t],i);return r}var me=(e,t,r,{allOwnKeys:i}={})=>(O(t,(t,i)=>{r&&g(t)?Object.defineProperty(e,i,{__proto__:null,value:n(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),e),he=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),ge=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},_e=(e,t,n,r)=>{let a,o,s,c={};if(t||={},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),o=a.length;o-- >0;)s=a[o],(!r||r(s,e,t))&&!c[s]&&(t[s]=e[s],c[s]=!0);e=n!==!1&&i(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},ve=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},ye=e=>{if(!e)return null;if(u(e))return e;let t=e.length;if(!_(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},be=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&i(Uint8Array)),xe=(e,t)=>{let n=(e&&e[a]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},Se=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ce=c(`HTMLFormElement`),we=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),Te=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Ee=c(`RegExp`),De=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};O(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},Oe=e=>{De(e,(t,n)=>{if(g(e)&&[`arguments`,`caller`,`callee`].includes(n))return!1;let r=e[n];if(g(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},ke=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return u(e)?r(e):r(String(e).split(t)),n},Ae=()=>{},je=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Me(e){return!!(e&&g(e.append)&&e[o]===`FormData`&&e[a])}var Ne=e=>{let t=Array(10),n=(e,r)=>{if(v(e)){if(t.indexOf(e)>=0)return;if(f(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=u(e)?[]:{};return O(e,(e,t)=>{let a=n(e,r+1);!d(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},Pe=c(`AsyncFunction`),Fe=e=>e&&(v(e)||g(e))&&g(e.then)&&g(e.catch),Ie=((e,t)=>e?setImmediate:t?((e,t)=>(k.addEventListener(`message`,({source:n,data:r})=>{n===k&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),k.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,g(k.postMessage)),A={isArray:u,isArrayBuffer:p,isBuffer:f,isFormData:ie,isArrayBufferView:m,isString:h,isNumber:_,isBoolean:y,isObject:v,isPlainObject:b,isEmptyObject:ee,isReadableStream:oe,isRequest:se,isResponse:ce,isHeaders:le,isUndefined:d,isDate:x,isFile:te,isReactNativeBlob:S,isReactNative:ne,isBlob:re,isRegExp:Ee,isFunction:g,isStream:w,isURLSearchParams:ae,isTypedArray:be,isFileList:C,forEach:O,merge:pe,extend:me,trim:ue,stripBOM:he,inherits:ge,toFlatObject:_e,kindOf:s,kindOfTest:c,endsWith:ve,toArray:ye,forEachEntry:xe,matchAll:Se,isHTMLForm:Ce,hasOwnProperty:Te,hasOwnProp:Te,reduceDescriptors:De,freezeMethods:Oe,toObjectSet:ke,toCamelCase:we,noop:Ae,toFiniteNumber:je,findKey:de,global:k,isContextDefined:fe,isSpecCompliantForm:Me,toJSONObject:Ne,isAsyncFn:Pe,isThenable:Fe,setImmediate:Ie,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(k):typeof process<`u`&&process.nextTick||Ie,isIterable:e=>e!=null&&g(e[a])},Le=A.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`]),Re=e=>{let t={},n,r,i;return e&&e.split(`
|
|
2
|
+
`).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&Le[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},ze=Symbol(`internals`),Be=/[^\x09\x20-\x7E\x80-\xFF]/g;function Ve(e){let t=0,n=e.length;for(;t<n;){let n=e.charCodeAt(t);if(n!==9&&n!==32)break;t+=1}for(;n>t;){let t=e.charCodeAt(n-1);if(t!==9&&t!==32)break;--n}return t===0&&n===e.length?e:e.slice(t,n)}function j(e){return e&&String(e).trim().toLowerCase()}function He(e){return Ve(e.replace(Be,``))}function Ue(e){return e===!1||e==null?e:A.isArray(e)?e.map(Ue):He(String(e))}function We(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var Ge=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ke(e,t,n,r,i){if(A.isFunction(r))return r.call(this,t,n);if(i&&(t=n),A.isString(t)){if(A.isString(r))return t.indexOf(r)!==-1;if(A.isRegExp(r))return r.test(t)}}function qe(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function Je(e,t){let n=A.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var M=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=j(t);if(!i)throw Error(`header name must be a non-empty string`);let a=A.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=Ue(e))}let a=(e,t)=>A.forEach(e,(e,n)=>i(e,n,t));if(A.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if(A.isString(e)&&(e=e.trim())&&!Ge(e))a(Re(e),t);else if(A.isObject(e)&&A.isIterable(e)){let n={},r,i;for(let t of e){if(!A.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?A.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=j(e),e){let n=A.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return We(e);if(A.isFunction(t))return t.call(this,e,n);if(A.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=j(e),e){let n=A.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||Ke(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=j(e),e){let i=A.findKey(n,e);i&&(!t||Ke(n,n[i],i,t))&&(delete n[i],r=!0)}}return A.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||Ke(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return A.forEach(this,(r,i)=>{let a=A.findKey(n,i);if(a){t[a]=Ue(r),delete t[i];return}let o=e?qe(i):String(i).trim();o!==i&&delete t[i],t[o]=Ue(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return A.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&A.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(`
|
|
3
|
+
`)}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){let n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){let t=(this[ze]=this[ze]={accessors:{}}).accessors,n=this.prototype;function r(e){let r=j(e);t[r]||(Je(n,e),t[r]=!0)}return A.isArray(e)?e.forEach(r):r(e),this}};M.accessor([`Content-Type`,`Content-Length`,`Accept`,`Accept-Encoding`,`User-Agent`,`Authorization`]),A.reduceDescriptors(M.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),A.freezeMethods(M);var Ye=`[REDACTED ****]`;function Xe(e){if(A.hasOwnProp(e,`toJSON`))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(A.hasOwnProp(t,`toJSON`))return!0;t=Object.getPrototypeOf(t)}return!1}function Ze(e,t){let n=new Set(t.map(e=>String(e).toLowerCase())),r=[],i=e=>{if(typeof e!=`object`||!e||A.isBuffer(e))return e;if(r.indexOf(e)!==-1)return;e instanceof M&&(e=e.toJSON()),r.push(e);let t;if(A.isArray(e))t=[],e.forEach((e,n)=>{let r=i(e);A.isUndefined(r)||(t[n]=r)});else{if(!A.isPlainObject(e)&&Xe(e))return r.pop(),e;t=Object.create(null);for(let[r,a]of Object.entries(e)){let e=n.has(r.toLowerCase())?Ye:i(a);A.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return i(e)}var N=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,t.status!=null&&s.status==null&&(s.status=t.status),o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),Object.defineProperty(this,`message`,{__proto__:null,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),i&&(this.response=i,this.status=i.status)}toJSON(){let e=this.config,t=e&&A.hasOwnProp(e,`redact`)?e.redact:void 0,n=A.isArray(t)&&t.length>0?Ze(e,t):A.toJSONObject(e);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:n,code:this.code,status:this.status}}};N.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,N.ERR_BAD_OPTION=`ERR_BAD_OPTION`,N.ECONNABORTED=`ECONNABORTED`,N.ETIMEDOUT=`ETIMEDOUT`,N.ECONNREFUSED=`ECONNREFUSED`,N.ERR_NETWORK=`ERR_NETWORK`,N.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,N.ERR_DEPRECATED=`ERR_DEPRECATED`,N.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,N.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,N.ERR_CANCELED=`ERR_CANCELED`,N.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,N.ERR_INVALID_URL=`ERR_INVALID_URL`,N.ERR_FORM_DATA_DEPTH_EXCEEDED=`ERR_FORM_DATA_DEPTH_EXCEEDED`;function Qe(e){return A.isPlainObject(e)||A.isArray(e)}function $e(e){return A.endsWith(e,`[]`)?e.slice(0,-2):e}function et(e,t,n){return e?e.concat(t).map(function(e,t){return e=$e(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function tt(e){return A.isArray(e)&&!e.some(Qe)}var nt=A.toFlatObject(A,{},null,function(e){return/^is[A-Z]/.test(e)});function P(e,t,n){if(!A.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=A.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!A.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||d,a=n.dots,o=n.indexes,s=n.Blob||typeof Blob<`u`&&Blob,c=n.maxDepth===void 0?100:n.maxDepth,l=s&&A.isSpecCompliantForm(t);if(!A.isFunction(i))throw TypeError(`visitor must be a function`);function u(e){if(e===null)return``;if(A.isDate(e))return e.toISOString();if(A.isBoolean(e))return e.toString();if(!l&&A.isBlob(e))throw new N(`Blob is not supported. Use a Buffer instead.`);return A.isArrayBuffer(e)||A.isTypedArray(e)?l&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function d(e,n,i){let s=e;if(A.isReactNative(t)&&A.isReactNativeBlob(e))return t.append(et(i,n,a),u(e)),!1;if(e&&!i&&typeof e==`object`){if(A.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(A.isArray(e)&&tt(e)||(A.isFileList(e)||A.endsWith(n,`[]`))&&(s=A.toArray(e)))return n=$e(n),s.forEach(function(e,r){!(A.isUndefined(e)||e===null)&&t.append(o===!0?et([n],r,a):o===null?n:n+`[]`,u(e))}),!1}return Qe(e)?!0:(t.append(et(i,n,a),u(e)),!1)}let f=[],p=Object.assign(nt,{defaultVisitor:d,convertValue:u,isVisitable:Qe});function m(e,n,r=0){if(!A.isUndefined(e)){if(r>c)throw new N(`Object is too deeply nested (`+r+` levels). Max depth: `+c,N.ERR_FORM_DATA_DEPTH_EXCEEDED);if(f.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));f.push(e),A.forEach(e,function(e,a){(!(A.isUndefined(e)||e===null)&&i.call(t,e,A.isString(a)?a.trim():a,n,p))===!0&&m(e,n?n.concat(a):[a],r+1)}),f.pop()}}if(!A.isObject(e))throw TypeError(`data must be an object`);return m(e),t}function rt(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function it(e,t){this._pairs=[],e&&P(e,this,t)}var at=it.prototype;at.append=function(e,t){this._pairs.push([e,t])},at.toString=function(e){let t=e?function(t){return e.call(this,t,rt)}:rt;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function ot(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function st(e,t,n){if(!t)return e;let r=n&&n.encode||ot,i=A.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):A.isURLSearchParams(t)?t.toString():new it(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var ct=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){A.forEach(this.handlers,function(t){t!==null&&e(t)})}},lt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},ut={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:it,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},dt=t({hasBrowserEnv:()=>ft,hasStandardBrowserEnv:()=>mt,hasStandardBrowserWebWorkerEnv:()=>ht,navigator:()=>pt,origin:()=>gt}),ft=typeof window<`u`&&typeof document<`u`,pt=typeof navigator==`object`&&navigator||void 0,mt=ft&&(!pt||[`ReactNative`,`NativeScript`,`NS`].indexOf(pt.product)<0),ht=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,gt=ft&&window.location.href||`http://localhost`,F={...dt,...ut};function _t(e,t){return P(e,new F.classes.URLSearchParams,{visitor:function(e,t,n,r){return F.isNode&&A.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function vt(e){return A.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function yt(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function bt(e){function t(e,n,r,i){let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&A.isArray(r)?r.length:a,s?(A.hasOwnProp(r,a)?r[a]=A.isArray(r[a])?r[a].concat(n):[r[a],n]:r[a]=n,!o):((!r[a]||!A.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&A.isArray(r[a])&&(r[a]=yt(r[a])),!o)}if(A.isFormData(e)&&A.isFunction(e.entries)){let n={};return A.forEachEntry(e,(e,r)=>{t(vt(e),r,n,0)}),n}return null}var I=(e,t)=>e!=null&&A.hasOwnProp(e,t)?e[t]:void 0;function xt(e,t,n){if(A.isString(e))try{return(t||JSON.parse)(e),A.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var L={transitional:lt,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=A.isObject(e);if(i&&A.isHTMLForm(e)&&(e=new FormData(e)),A.isFormData(e))return r?JSON.stringify(bt(e)):e;if(A.isArrayBuffer(e)||A.isBuffer(e)||A.isStream(e)||A.isFile(e)||A.isBlob(e)||A.isReadableStream(e))return e;if(A.isArrayBufferView(e))return e.buffer;if(A.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){let t=I(this,`formSerializer`);if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return _t(e,t).toString();if((a=A.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let n=I(this,`env`),r=n&&n.FormData;return P(a?{"files[]":e}:e,r&&new r,t)}}return i||r?(t.setContentType(`application/json`,!1),xt(e)):e}],transformResponse:[function(e){let t=I(this,`transitional`)||L.transitional,n=t&&t.forcedJSONParsing,r=I(this,`responseType`),i=r===`json`;if(A.isResponse(e)||A.isReadableStream(e))return e;if(e&&A.isString(e)&&(n&&!r||i)){let n=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,I(this,`parseReviver`))}catch(e){if(n)throw e.name===`SyntaxError`?N.from(e,N.ERR_BAD_RESPONSE,this,null,I(this,`response`)):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:F.classes.FormData,Blob:F.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};A.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`],e=>{L.headers[e]={}});function St(e,t){let n=this||L,r=t||n,i=M.from(r.headers),a=r.data;return A.forEach(e,function(e){a=e.call(n,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function Ct(e){return!!(e&&e.__CANCEL__)}var R=class extends N{constructor(e,t,n){super(e??`canceled`,N.ERR_CANCELED,t,n),this.name=`CanceledError`,this.__CANCEL__=!0}};function wt(e,t,n){let r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new N(`Request failed with status code `+n.status,n.status>=400&&n.status<500?N.ERR_BAD_REQUEST:N.ERR_BAD_RESPONSE,n.config,n.request,n))}function Tt(e){let t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||``}function Et(e,t){e||=10;let n=Array(e),r=Array(e),i=0,a=0,o;return t=t===void 0?1e3:t,function(s){let c=Date.now(),l=r[a];o||=c,n[i]=s,r[i]=c;let u=a,d=0;for(;u!==i;)d+=n[u++],u%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o<t)return;let f=l&&c-l;return f?Math.round(d*1e3/f):void 0}}function Dt(e,t){let n=0,r=1e3/t,i,a,o=(t,r=Date.now())=>{n=r,i=null,a&&=(clearTimeout(a),null),e(...t)};return[(...e)=>{let t=Date.now(),s=t-n;s>=r?o(e,t):(i=e,a||=setTimeout(()=>{a=null,o(i)},r-s))},()=>i&&o(i)]}var z=(e,t,n=3)=>{let r=0,i=Et(50,250);return Dt(n=>{let a=n.loaded,o=n.lengthComputable?n.total:void 0,s=o==null?a:Math.min(a,o),c=Math.max(0,s-r),l=i(c);r=Math.max(r,s),e({loaded:s,total:o,progress:o?s/o:void 0,bytes:c,rate:l||void 0,estimated:l&&o?(o-s)/l:void 0,event:n,lengthComputable:o!=null,[t?`download`:`upload`]:!0})},n)},Ot=(e,t)=>{let n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},kt=e=>(...t)=>A.asap(()=>e(...t)),At=F.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,F.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(F.origin),F.navigator&&/(msie|trident)/i.test(F.navigator.userAgent)):()=>!0,jt=F.hasStandardBrowserEnv?{write(e,t,n,r,i,a,o){if(typeof document>`u`)return;let s=[`${e}=${encodeURIComponent(t)}`];A.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),A.isString(r)&&s.push(`path=${r}`),A.isString(i)&&s.push(`domain=${i}`),a===!0&&s.push(`secure`),A.isString(o)&&s.push(`SameSite=${o}`),document.cookie=s.join(`; `)},read(e){if(typeof document>`u`)return null;let t=document.cookie.split(`;`);for(let n=0;n<t.length;n++){let r=t[n].replace(/^\s+/,``),i=r.indexOf(`=`);if(i!==-1&&r.slice(0,i)===e)return decodeURIComponent(r.slice(i+1))}return null},remove(e){this.write(e,``,Date.now()-864e5,`/`)}}:{write(){},read(){return null},remove(){}};function Mt(e){return typeof e==`string`?/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e):!1}function Nt(e,t){return t?e.replace(/\/?\/$/,``)+`/`+t.replace(/^\/+/,``):e}function Pt(e,t,n){let r=!Mt(t);return e&&(r||n===!1)?Nt(e,t):t}var Ft=e=>e instanceof M?{...e}:e;function B(e,t){t||={};let n=Object.create(null);Object.defineProperty(n,`hasOwnProperty`,{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(e,t,n,r){return A.isPlainObject(e)&&A.isPlainObject(t)?A.merge.call({caseless:r},e,t):A.isPlainObject(t)?A.merge({},t):A.isArray(t)?t.slice():t}function i(e,t,n,i){if(!A.isUndefined(t))return r(e,t,n,i);if(!A.isUndefined(e))return r(void 0,e,n,i)}function a(e,t){if(!A.isUndefined(t))return r(void 0,t)}function o(e,t){if(!A.isUndefined(t))return r(void 0,t);if(!A.isUndefined(e))return r(void 0,e)}function s(n,i,a){if(A.hasOwnProp(t,a))return r(n,i);if(A.hasOwnProp(e,a))return r(void 0,n)}let c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,allowedSocketPaths:o,responseEncoding:o,validateStatus:s,headers:(e,t,n)=>i(Ft(e),Ft(t),n,!0)};return A.forEach(Object.keys({...e,...t}),function(r){if(r===`__proto__`||r===`constructor`||r===`prototype`)return;let a=A.hasOwnProp(c,r)?c[r]:i,o=a(A.hasOwnProp(e,r)?e[r]:void 0,A.hasOwnProp(t,r)?t[r]:void 0,r);A.isUndefined(o)&&a!==s||(n[r]=o)}),n}var It=[`content-type`,`content-length`];function Lt(e,t,n){if(n!==`content-only`){e.set(t);return}Object.entries(t).forEach(([t,n])=>{It.includes(t.toLowerCase())&&e.set(t,n)})}var Rt=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16))),zt=e=>{let t=B({},e),n=e=>A.hasOwnProp(t,e)?t[e]:void 0,r=n(`data`),i=n(`withXSRFToken`),a=n(`xsrfHeaderName`),o=n(`xsrfCookieName`),s=n(`headers`),c=n(`auth`),l=n(`baseURL`),u=n(`allowAbsoluteUrls`),d=n(`url`);if(t.headers=s=M.from(s),t.url=st(Pt(l,d,u),e.params,e.paramsSerializer),c&&s.set(`Authorization`,`Basic `+btoa((c.username||``)+`:`+(c.password?Rt(c.password):``))),A.isFormData(r)&&(F.hasStandardBrowserEnv||F.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):A.isFunction(r.getHeaders)&&Lt(s,r.getHeaders(),n(`formDataHeaderPolicy`))),F.hasStandardBrowserEnv&&(A.isFunction(i)&&(i=i(t)),i===!0||i==null&&At(t.url))){let e=a&&o&&jt.read(o);e&&s.set(a,e)}return t},Bt=typeof XMLHttpRequest<`u`&&function(e){return new Promise(function(t,n){let r=zt(e),i=r.data,a=M.from(r.headers).normalize(),{responseType:o,onUploadProgress:s,onDownloadProgress:c}=r,l,u,d,f,p;function m(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener(`abort`,l)}let h=new XMLHttpRequest;h.open(r.method.toUpperCase(),r.url,!0),h.timeout=r.timeout;function g(){if(!h)return;let r=M.from(`getAllResponseHeaders`in h&&h.getAllResponseHeaders());wt(function(e){t(e),m()},function(e){n(e),m()},{data:!o||o===`text`||o===`json`?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:r,config:e,request:h}),h=null}`onloadend`in h?h.onloadend=g:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.startsWith(`file:`))||setTimeout(g)},h.onabort=function(){h&&=(n(new N(`Request aborted`,N.ECONNABORTED,e,h)),m(),null)},h.onerror=function(t){let r=new N(t&&t.message?t.message:`Network Error`,N.ERR_NETWORK,e,h);r.event=t||null,n(r),m(),h=null},h.ontimeout=function(){let t=r.timeout?`timeout of `+r.timeout+`ms exceeded`:`timeout exceeded`,i=r.transitional||lt;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new N(t,i.clarifyTimeoutError?N.ETIMEDOUT:N.ECONNABORTED,e,h)),m(),h=null},i===void 0&&a.setContentType(null),`setRequestHeader`in h&&A.forEach(a.toJSON(),function(e,t){h.setRequestHeader(t,e)}),A.isUndefined(r.withCredentials)||(h.withCredentials=!!r.withCredentials),o&&o!==`json`&&(h.responseType=r.responseType),c&&([d,p]=z(c,!0),h.addEventListener(`progress`,d)),s&&h.upload&&([u,f]=z(s),h.upload.addEventListener(`progress`,u),h.upload.addEventListener(`loadend`,f)),(r.cancelToken||r.signal)&&(l=t=>{h&&=(n(!t||t.type?new R(null,e,h):t),h.abort(),m(),null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener(`abort`,l)));let _=Tt(r.url);if(_&&!F.protocols.includes(_)){n(new N(`Unsupported protocol `+_+`:`,N.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Vt=(e,t)=>{let{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n=new AbortController,r,i=function(e){if(!r){r=!0,o();let t=e instanceof Error?e:this.reason;n.abort(t instanceof N?t:new R(t instanceof Error?t.message:t))}},a=t&&setTimeout(()=>{a=null,i(new N(`timeout of ${t}ms exceeded`,N.ETIMEDOUT))},t),o=()=>{e&&=(a&&clearTimeout(a),a=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener(`abort`,i)}),null)};e.forEach(e=>e.addEventListener(`abort`,i));let{signal:s}=n;return s.unsubscribe=()=>A.asap(o),s}},Ht=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},Ut=async function*(e,t){for await(let n of Wt(e))yield*Ht(n,t)},Wt=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)break;yield n}}finally{await t.cancel()}},Gt=(e,t,n,r)=>{let i=Ut(e,t),a=0,o,s=e=>{o||(o=!0,r&&r(e))};return new ReadableStream({async pull(e){try{let{done:t,value:r}=await i.next();if(t){s(),e.close();return}let o=r.byteLength;n&&n(a+=o),e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel(e){return s(e),i.return()}},{highWaterMark:2})};function Kt(e){if(!e||typeof e!=`string`||!e.startsWith(`data:`))return 0;let t=e.indexOf(`,`);if(t<0)return 0;let n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length,t=r.length;for(let n=0;n<t;n++)if(r.charCodeAt(n)===37&&n+2<t){let t=r.charCodeAt(n+1),i=r.charCodeAt(n+2);(t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102)&&(e-=2,n+=2)}let n=0,i=t-1,a=e=>e>=2&&r.charCodeAt(e-2)===37&&r.charCodeAt(e-1)===51&&(r.charCodeAt(e)===68||r.charCodeAt(e)===100);i>=0&&(r.charCodeAt(i)===61?(n++,i--):a(i)&&(n++,i-=3)),n===1&&i>=0&&(r.charCodeAt(i)===61||a(i))&&n++;let o=Math.floor(e/4)*3-(n||0);return o>0?o:0}if(typeof Buffer<`u`&&typeof Buffer.byteLength==`function`)return Buffer.byteLength(r,`utf8`);let i=0;for(let e=0,t=r.length;e<t;e++){let n=r.charCodeAt(e);if(n<128)i+=1;else if(n<2048)i+=2;else if(n>=55296&&n<=56319&&e+1<t){let t=r.charCodeAt(e+1);t>=56320&&t<=57343?(i+=4,e++):i+=3}else i+=3}return i}var qt=`1.16.0`,Jt=64*1024,{isFunction:V}=A,Yt=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Xt=e=>{let t=A.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=A.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);let{fetch:i,Request:a,Response:o}=e,s=i?V(i):typeof fetch==`function`,c=V(a),l=V(o);if(!s)return!1;let u=s&&V(n),d=s&&(typeof r==`function`?(e=>t=>e.encode(t))(new r):async e=>new Uint8Array(await new a(e).arrayBuffer())),f=c&&u&&Yt(()=>{let e=!1,t=new a(F.origin,{body:new n,method:`POST`,get duplex(){return e=!0,`half`}}),r=t.headers.has(`Content-Type`);return t.body!=null&&t.body.cancel(),e&&!r}),p=l&&u&&Yt(()=>A.isReadableStream(new o(``).body)),m={stream:p&&(e=>e.body)};s&&[`text`,`arrayBuffer`,`blob`,`formData`,`stream`].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new N(`Response type '${e}' is not supported`,N.ERR_NOT_SUPPORT,n)})});let h=async e=>{if(e==null)return 0;if(A.isBlob(e))return e.size;if(A.isSpecCompliantForm(e))return(await new a(F.origin,{method:`POST`,body:e}).arrayBuffer()).byteLength;if(A.isArrayBufferView(e)||A.isArrayBuffer(e))return e.byteLength;if(A.isURLSearchParams(e)&&(e+=``),A.isString(e))return(await d(e)).byteLength},g=async(e,t)=>A.toFiniteNumber(e.getContentLength())??h(t);return async e=>{let{url:t,method:n,data:s,signal:l,cancelToken:u,timeout:d,onDownloadProgress:h,onUploadProgress:_,responseType:v,headers:y,withCredentials:b=`same-origin`,fetchOptions:ee,maxContentLength:x,maxBodyLength:te}=zt(e),S=A.isNumber(x)&&x>-1,ne=A.isNumber(te)&&te>-1,re=i||fetch;v=v?(v+``).toLowerCase():`text`;let C=Vt([l,u&&u.toAbortSignal()],d),w=null,T=C&&C.unsubscribe&&(()=>{C.unsubscribe()}),E;try{if(S&&typeof t==`string`&&t.startsWith(`data:`)&&Kt(t)>x)throw new N(`maxContentLength size of `+x+` exceeded`,N.ERR_BAD_RESPONSE,e,w);if(ne&&n!==`get`&&n!==`head`){let t=await g(y,s);if(typeof t==`number`&&isFinite(t)&&t>te)throw new N(`Request body larger than maxBodyLength limit`,N.ERR_BAD_REQUEST,e,w)}if(_&&f&&n!==`get`&&n!==`head`&&(E=await g(y,s))!==0){let e=new a(t,{method:`POST`,body:s,duplex:`half`}),n;if(A.isFormData(s)&&(n=e.headers.get(`content-type`))&&y.setContentType(n),e.body){let[t,n]=Ot(E,z(kt(_)));s=Gt(e.body,Jt,t,n)}}A.isString(b)||(b=b?`include`:`omit`);let i=c&&`credentials`in a.prototype;if(A.isFormData(s)){let e=y.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&y.delete(`content-type`)}y.set(`User-Agent`,`axios/`+qt,!1);let l={...ee,signal:C,method:n.toUpperCase(),headers:y.normalize().toJSON(),body:s,duplex:`half`,credentials:i?b:void 0};w=c&&new a(t,l);let u=await(c?re(w,ee):re(t,l));if(S){let t=A.toFiniteNumber(u.headers.get(`content-length`));if(t!=null&&t>x)throw new N(`maxContentLength size of `+x+` exceeded`,N.ERR_BAD_RESPONSE,e,w)}let d=p&&(v===`stream`||v===`response`);if(p&&u.body&&(h||S||d&&T)){let t={};[`status`,`statusText`,`headers`].forEach(e=>{t[e]=u[e]});let n=A.toFiniteNumber(u.headers.get(`content-length`)),[r,i]=h&&Ot(n,z(kt(h),!0))||[],a=0;u=new o(Gt(u.body,Jt,t=>{if(S&&(a=t,a>x))throw new N(`maxContentLength size of `+x+` exceeded`,N.ERR_BAD_RESPONSE,e,w);r&&r(t)},()=>{i&&i(),T&&T()}),t)}v||=`text`;let D=await m[A.findKey(m,v)||`text`](u,e);if(S&&!p&&!d){let t;if(D!=null&&(typeof D.byteLength==`number`?t=D.byteLength:typeof D.size==`number`?t=D.size:typeof D==`string`&&(t=typeof r==`function`?new r().encode(D).byteLength:D.length)),typeof t==`number`&&t>x)throw new N(`maxContentLength size of `+x+` exceeded`,N.ERR_BAD_RESPONSE,e,w)}return!d&&T&&T(),await new Promise((t,n)=>{wt(t,n,{data:D,headers:M.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:w})})}catch(t){if(T&&T(),C&&C.aborted&&C.reason instanceof N){let n=C.reason;throw n.config=e,w&&(n.request=w),t!==n&&(n.cause=t),n}throw t&&t.name===`TypeError`&&/Load failed|fetch/i.test(t.message)?Object.assign(new N(`Network Error`,N.ERR_NETWORK,e,w,t&&t.response),{cause:t.cause||t}):N.from(t,t&&t.code,e,w,t&&t.response)}}},Zt=new Map,Qt=e=>{let t=e&&e.env||{},{fetch:n,Request:r,Response:i}=t,a=[r,i,n],o=a.length,s,c,l=Zt;for(;o--;)s=a[o],c=l.get(s),c===void 0&&l.set(s,c=o?new Map:Xt(t)),l=c;return c};Qt();var $t={http:null,xhr:Bt,fetch:{get:Qt}};A.forEach($t,(e,t)=>{if(e){try{Object.defineProperty(e,`name`,{__proto__:null,value:t})}catch{}Object.defineProperty(e,`adapterName`,{__proto__:null,value:t})}});var en=e=>`- ${e}`,tn=e=>A.isFunction(e)||e===null||e===!1;function nn(e,t){e=A.isArray(e)?e:[e];let{length:n}=e,r,i,a={};for(let o=0;o<n;o++){r=e[o];let n;if(i=r,!tn(r)&&(i=$t[(n=String(r)).toLowerCase()],i===void 0))throw new N(`Unknown adapter '${n}'`);if(i&&(A.isFunction(i)||(i=i.get(t))))break;a[n||`#`+o]=i}if(!i){let e=Object.entries(a).map(([e,t])=>`adapter ${e} `+(t===!1?`is not supported by the environment`:`is not available in the build`));throw new N(`There is no suitable adapter to dispatch the request `+(n?e.length>1?`since :
|
|
4
|
+
`+e.map(en).join(`
|
|
5
|
+
`):` `+en(e[0]):`as no adapter specified`),`ERR_NOT_SUPPORT`)}return i}var rn={getAdapter:nn,adapters:$t};function an(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new R(null,e)}function on(e){return an(e),e.headers=M.from(e.headers),e.data=St.call(e,e.transformRequest),[`post`,`put`,`patch`].indexOf(e.method)!==-1&&e.headers.setContentType(`application/x-www-form-urlencoded`,!1),rn.getAdapter(e.adapter||L.adapter,e)(e).then(function(t){an(e),e.response=t;try{t.data=St.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=M.from(t.headers),t},function(t){if(!Ct(t)&&(an(e),t&&t.response)){e.response=t.response;try{t.response.data=St.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=M.from(t.response.headers)}return Promise.reject(t)})}var H={};[`object`,`boolean`,`number`,`function`,`string`,`symbol`].forEach((e,t)=>{H[e]=function(n){return typeof n===e||`a`+(t<1?`n `:` `)+e}});var sn={};H.transitional=function(e,t,n){function r(e,t){return`[Axios v`+qt+`] Transitional option '`+e+`'`+t+(n?`. `+n:``)}return(n,i,a)=>{if(e===!1)throw new N(r(i,` has been removed`+(t?` in `+t:``)),N.ERR_DEPRECATED);return t&&!sn[i]&&(sn[i]=!0,console.warn(r(i,` has been deprecated since v`+t+` and will be removed in the near future`))),e?e(n,i,a):!0}},H.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function cn(e,t,n){if(typeof e!=`object`)throw new N(`options must be an object`,N.ERR_BAD_OPTION_VALUE);let r=Object.keys(e),i=r.length;for(;i-- >0;){let a=r[i],o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;if(o){let t=e[a],n=t===void 0||o(t,a,e);if(n!==!0)throw new N(`option `+a+` must be `+n,N.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new N(`Unknown option `+a,N.ERR_BAD_OPTION)}}var U={assertOptions:cn,validators:H},W=U.validators,G=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ct,response:new ct}}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=Error();let n=(()=>{if(!t.stack)return``;let e=t.stack.indexOf(`
|
|
6
|
+
`);return e===-1?``:t.stack.slice(e+1)})();try{if(!e.stack)e.stack=n;else if(n){let t=n.indexOf(`
|
|
7
|
+
`),r=t===-1?-1:n.indexOf(`
|
|
8
|
+
`,t+1),i=r===-1?``:n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+=`
|
|
9
|
+
`+n)}}catch{}}throw e}}_request(e,t){typeof e==`string`?(t||={},t.url=e):t=e||{},t=B(this.defaults,t);let{transitional:n,paramsSerializer:r,headers:i}=t;n!==void 0&&U.assertOptions(n,{silentJSONParsing:W.transitional(W.boolean),forcedJSONParsing:W.transitional(W.boolean),clarifyTimeoutError:W.transitional(W.boolean),legacyInterceptorReqResOrdering:W.transitional(W.boolean)},!1),r!=null&&(A.isFunction(r)?t.paramsSerializer={serialize:r}:U.assertOptions(r,{encode:W.function,serialize:W.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls===void 0?t.allowAbsoluteUrls=!0:t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls),U.assertOptions(t,{baseUrl:W.spelling(`baseURL`),withXsrfToken:W.spelling(`withXSRFToken`)},!0),t.method=(t.method||this.defaults.method||`get`).toLowerCase();let a=i&&A.merge(i.common,i[t.method]);i&&A.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`,`query`,`common`],e=>{delete i[e]}),t.headers=M.concat(a,i);let o=[],s=!0;this.interceptors.request.forEach(function(e){if(typeof e.runWhen==`function`&&e.runWhen(t)===!1)return;s&&=e.synchronous;let n=t.transitional||lt;n&&n.legacyInterceptorReqResOrdering?o.unshift(e.fulfilled,e.rejected):o.push(e.fulfilled,e.rejected)});let c=[];this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,u=0,d;if(!s){let e=[on.bind(this),void 0];for(e.unshift(...o),e.push(...c),d=e.length,l=Promise.resolve(t);u<d;)l=l.then(e[u++],e[u++]);return l}d=o.length;let f=t;for(;u<d;){let e=o[u++],t=o[u++];try{f=e(f)}catch(e){t.call(this,e);break}}try{l=on.call(this,f)}catch(e){return Promise.reject(e)}for(u=0,d=c.length;u<d;)l=l.then(c[u++],c[u++]);return l}getUri(e){return e=B(this.defaults,e),st(Pt(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};A.forEach([`delete`,`get`,`head`,`options`],function(e){G.prototype[e]=function(t,n){return this.request(B(n||{},{method:e,url:t,data:(n||{}).data}))}}),A.forEach([`post`,`put`,`patch`,`query`],function(e){function t(t){return function(n,r,i){return this.request(B(i||{},{method:e,headers:t?{"Content-Type":`multipart/form-data`}:{},url:n,data:r}))}}G.prototype[e]=t(),e!==`query`&&(G.prototype[e+`Form`]=t(!0))});var ln=class e{constructor(e){if(typeof e!=`function`)throw TypeError(`executor must be a function.`);let t;this.promise=new Promise(function(e){t=e});let 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,r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,i){n.reason||(n.reason=new R(e,r,i),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let 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}}};function un(e){return function(t){return e.apply(null,t)}}function dn(e){return A.isObject(e)&&e.isAxiosError===!0}var fn={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(fn).forEach(([e,t])=>{fn[t]=e});function pn(e){let t=new G(e),r=n(G.prototype.request,t);return A.extend(r,G.prototype,t,{allOwnKeys:!0}),A.extend(r,t,null,{allOwnKeys:!0}),r.create=function(t){return pn(B(e,t))},r}var K=pn(L);K.Axios=G,K.CanceledError=R,K.CancelToken=ln,K.isCancel=Ct,K.VERSION=qt,K.toFormData=P,K.AxiosError=N,K.Cancel=K.CanceledError,K.all=function(e){return Promise.all(e)},K.spread=un,K.isAxiosError=dn,K.mergeConfig=B,K.AxiosHeaders=M,K.formToJSON=e=>bt(A.isHTMLForm(e)?new FormData(e):e),K.getAdapter=rn.getAdapter,K.HttpStatusCode=fn,K.default=K;var mn=(e,t,n={})=>{let r=/^(https?|wss?):\/\//i.test(t)?t:`${e.replace(/\/$/,``)}/${t.replace(/^\//,``)}`,i=[],a=new Set;return r=r.replace(/:(\w+)/g,(e,t)=>n[t]===void 0?`:${t}`:(a.add(t),encodeURIComponent(String(n[t])))),Object.keys(n).forEach(e=>{if(!a.has(e)&&n[e]!==void 0){let t=n[e];Array.isArray(t)?t.forEach(t=>i.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`)):i.push(`${encodeURIComponent(e)}=${encodeURIComponent(String(t))}`)}}),i.length>0?`${r}?${i.join(`&`)}`:r},hn=e=>async(t,n={})=>{if(t.protocol!==`REST`)throw Error(`REST adapter cannot handle ${t.protocol} protocol`);let r={url:mn(e,t.path,n.params),method:t.method,headers:{"Content-Type":`application/json`,...t.headers,...n.headers},data:[`GET`,`DELETE`].includes(t.method)?void 0:n.body,timeout:t.timeout||5e3,...t.options,...n.fetchOptions};try{return(await K.request(r)).data}catch(e){if(K.isAxiosError(e)){let t=e.response?.status||`Network Error`,n=e.response?.data?.message||e.message;throw Error(`[REST ${t}]: ${n}`)}throw e}},gn=class{constructor(e,t){this.endpoint=e,this.url=t,this.socket=null,this.subscribers=new Set,this.retryCount=0}connect(){if(typeof window>`u`){console.error(`APIEngine: WebSockets are only supported in the browser environment.`);return}this.socket?.readyState!==WebSocket.OPEN&&(this.socket=new WebSocket(this.url),this.socket.onopen=()=>{this.retryCount=0,this.startHeartbeat(),console.log(`[WS] Connected: ${this.url}`)},this.socket.onmessage=e=>{try{let t=typeof e.data==`string`?JSON.parse(e.data):e.data;this.subscribers.forEach(e=>e(t))}catch{this.subscribers.forEach(t=>t(e.data))}},this.socket.onclose=e=>{this.stopHeartbeat(),this.endpoint.autoReconnect&&e.code!==1e3&&this.reconnect()},this.socket.onerror=e=>{console.error(`[WS] Error:`,e)})}reconnect(){let e=this.endpoint.maxRetries||5;if(this.retryCount>=e){console.warn(`[WS] Max reconnection attempts reached for ${this.url}`);return}let t=Math.min(1e3*2**this.retryCount,3e4);this.retryCount++,console.log(`[WS] Reconnecting in ${t}ms... (Attempt ${this.retryCount}/${e})`),this.reconnectTimer=setTimeout(()=>this.connect(),t)}startHeartbeat(){this.endpoint.pingInterval&&(this.heartbeatTimer=setInterval(()=>{this.socket?.readyState===WebSocket.OPEN&&this.socket.send(JSON.stringify({type:`ping`}))},this.endpoint.pingInterval))}stopHeartbeat(){clearInterval(this.heartbeatTimer),clearTimeout(this.reconnectTimer)}subscribe(e){return this.subscribers.add(e),(!this.socket||this.socket.readyState===WebSocket.CLOSED)&&this.connect(),()=>{this.subscribers.delete(e),this.subscribers.size===0&&this.close()}}send(e){if(this.socket?.readyState===WebSocket.OPEN){let t=typeof e==`string`?e:JSON.stringify(e);this.socket.send(t)}else console.warn(`[WS] Cannot send message: Connection is not open.`)}close(){this.stopHeartbeat(),this.socket&&=(this.socket.onclose=null,this.socket.close(1e3),null),console.log(`[WS] Connection closed: ${this.url}`)}},_n;function vn(e){return{lang:e?.lang??_n?.lang,message:e?.message,abortEarly:e?.abortEarly??_n?.abortEarly,abortPipeEarly:e?.abortPipeEarly??_n?.abortPipeEarly}}var yn;function bn(e){return yn?.get(e)}var xn;function Sn(e){return xn?.get(e)}var Cn;function wn(e,t){return Cn?.get(e)?.get(t)}function Tn(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function q(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??Tn(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??wn(e.reference,c.lang)??(l?Sn(c.lang):null)??r.message??bn(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function J(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},vn())}}}function En(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function Dn(e,t){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${t} `)})`:n[0]??`never`}var On=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function kn(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function An(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function jn(e){return{kind:`schema`,type:`boolean`,reference:jn,expects:`boolean`,async:!1,message:e,get"~standard"(){return J(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:q(this,`type`,e,t),e}}}function Mn(e,t){return{kind:`schema`,type:`literal`,reference:Mn,expects:Tn(e),async:!1,literal:e,message:t,get"~standard"(){return J(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:q(this,`type`,e,t),e}}}function Y(e){return{kind:`schema`,type:`number`,reference:Y,expects:`number`,async:!1,message:e,get"~standard"(){return J(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:q(this,`type`,e,t),e}}}function X(e,t){return{kind:`schema`,type:`object`,reference:X,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return J(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:An(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=kn(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(q(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}}else q(this,`type`,e,t);return e}}}function Z(e,t){return{kind:`schema`,type:`optional`,reference:Z,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return J(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=An(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function Q(e,t){return{kind:`schema`,type:`picklist`,reference:Q,expects:Dn(e.map(Tn),`|`),async:!1,options:e,message:t,get"~standard"(){return J(this)},"~run"(e,t){return this.options.includes(e.value)?e.typed=!0:q(this,`type`,e,t),e}}}function Nn(e,t,n){return{kind:`schema`,type:`record`,reference:Nn,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return J(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){e.typed=!0,e.value={};for(let r in n)if(En(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else q(this,`type`,e,t);return e}}}function $(e){return{kind:`schema`,type:`string`,reference:$,expects:`string`,async:!1,message:e,get"~standard"(){return J(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:q(this,`type`,e,t),e}}}function Pn(e,t,n){return{kind:`schema`,type:`variant`,reference:Pn,expects:`Object`,async:!1,key:e,options:t,message:n,get"~standard"(){return J(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){let r,i=0,a=this.key,o=[],s=(e,c)=>{for(let l of e.options){if(l.type===`variant`)s(l,new Set(c).add(l.key));else{let e=!0,s=0;for(let t of c){let r=l.entries[t];if(t in n?r[`~run`]({typed:!1,value:n[t]},{abortEarly:!0}).issues:r.type!==`exact_optional`&&r.type!==`optional`&&r.type!==`nullish`){e=!1,a!==t&&(i<s||i===s&&t in n&&!(a in n))&&(i=s,a=t,o=[]),a===t&&o.push(l.entries[t].expects);break}s++}if(e){let e=l[`~run`]({value:n},t);(!r||!r.typed&&e.typed)&&(r=e)}}if(r&&!r.issues)break}};if(s(this,new Set([this.key])),r)return r;q(this,`type`,e,t,{input:n[a],expected:Dn(o,`|`),path:[{type:`object`,origin:`value`,input:n,key:a,value:n[a]}]})}else q(this,`type`,e,t);return e}}}function Fn(e,t,n){let r=e[`~run`]({value:t},vn(n));if(r.issues)throw new On(r.issues);return r.value}var In=X({version:$(),baseUrl:$(),endpoints:Nn($(),Pn(`protocol`,[X({protocol:Mn(`REST`),path:$(),method:Q([`GET`,`POST`,`PUT`,`DELETE`]),headers:Z(Nn($(),$()),{}),options:Z(X({cache:Z(Q([`default`,`no-store`,`reload`,`force-cache`])),credentials:Z(Q([`include`,`same-origin`,`omit`]))}),{}),timeout:Z(Y(),5e3)}),X({protocol:Mn(`WS`),path:$(),autoReconnect:Z(jn(),!0),maxRetries:Z(Y(),5),pingInterval:Z(Y(),3e4)}),X({protocol:Mn(`SSE`),path:$(),method:Z(Q([`GET`,`POST`]),`GET`),headers:Z(Nn($(),$()),{}),eventType:Z($(),`message`)})]))});async function Ln(e,t){let n=e.getReader(),r;for(;!(r=await n.read()).done;)t(r.value)}function Rn(e){let t,n,r,i=!1;return function(a){t===void 0?(t=a,n=0,r=-1):t=Bn(t,a);let o=t.length,s=0;for(;n<o;){i&&=(t[n]===10&&(s=++n),!1);let a=-1;for(;n<o&&a===-1;++n)switch(t[n]){case 58:r===-1&&(r=n-s);break;case 13:i=!0;case 10:a=n;break}if(a===-1)break;e(t.subarray(s,a),r),s=n,r=-1}s===o?t=void 0:s!==0&&(t=t.subarray(s),n-=s)}}function zn(e,t,n){let r=Vn(),i=new TextDecoder;return function(a,o){if(a.length===0)n?.(r),r=Vn();else if(o>0){let n=i.decode(a.subarray(0,o)),s=o+(a[o+1]===32?2:1),c=i.decode(a.subarray(s));switch(n){case`data`:r.data=r.data?r.data+`
|
|
10
|
+
`+c:c;break;case`event`:r.event=c;break;case`id`:e(r.id=c);break;case`retry`:let n=parseInt(c,10);isNaN(n)||t(r.retry=n);break}}}}function Bn(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}function Vn(){return{data:``,event:``,id:``,retry:void 0}}var Hn=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},Un=`text/event-stream`,Wn=1e3,Gn=`last-event-id`;function Kn(e,t){var{signal:n,headers:r,onopen:i,onmessage:a,onclose:o,onerror:s,openWhenHidden:c,fetch:l}=t,u=Hn(t,[`signal`,`headers`,`onopen`,`onmessage`,`onclose`,`onerror`,`openWhenHidden`,`fetch`]);return new Promise((t,d)=>{let f=Object.assign({},r);f.accept||=Un;let p;function m(){p.abort(),document.hidden||b()}c||document.addEventListener(`visibilitychange`,m);let h=Wn,g=0;function _(){document.removeEventListener(`visibilitychange`,m),window.clearTimeout(g),p.abort()}n?.addEventListener(`abort`,()=>{_(),t()});let v=l??window.fetch,y=i??qn;async function b(){p=new AbortController;try{let n=await v(e,Object.assign(Object.assign({},u),{headers:f,signal:p.signal}));await y(n),await Ln(n.body,Rn(zn(e=>{e?f[Gn]=e:delete f[Gn]},e=>{h=e},a))),o?.(),_(),t()}catch(e){if(!p.signal.aborted)try{let t=s?.(e)??h;window.clearTimeout(g),g=window.setTimeout(b,t)}catch(e){_(),d(e)}}}b()})}function qn(e){let t=e.headers.get(`content-type`);if(!t?.startsWith(`text/event-stream`))throw Error(`Expected content-type to be ${Un}, Actual: ${t}`)}var Jn=e=>(t,n={})=>{if(t.protocol!==`SSE`)throw Error(`Invalid Protocol`);let r=t.path.replace(/:(\w+)/g,(e,t)=>n.params?.[t]||`:${t}`),i=r.startsWith(`http`)?r:`${e}${r}`,a=new Set,o=new AbortController;return(async()=>{await Kn(i,{method:t.method||`GET`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`,...t.headers,...n.headers},body:n.body?JSON.stringify(n.body):void 0,signal:o.signal,openWhenHidden:!0,onmessage(e){console.log(`Raw SSE Message arrived:`,e),a.forEach(t=>t({id:e.id,event:e.event,data:e.data}))},onopen:async e=>{if(!e.ok)throw Error(`SSE Open Error: ${e.status}`)},onerror:e=>{console.error(`SSE stream error, attempting retry...`,e)}})})(),{subscribe:e=>(a.add(e),()=>{a.delete(e),a.size===0&&o.abort()}),close:()=>{o.abort()}}},Yn=class{constructor(e){this.socketManagers=new Map,this.manifest=Fn(In,e),this.baseUrl=this.manifest.baseUrl}async call(e,t){let n=this.manifest.endpoints[e];if(n.protocol!==`REST`)throw Error(`Use .watch() for streams`);return hn(this.baseUrl)(n,t)}watch(e,t={}){let n=this.manifest.endpoints[e];if(!n)throw Error(`Endpoint ${e} not found.`);switch(n.protocol){case`WS`:let r=mn(this.baseUrl.replace(`http`,`ws`),n.path,t.params);return console.log(`Connecting to WebSocket at ${r} with options:`,t),this.socketManagers.has(e)||this.socketManagers.set(e,new gn(n,r)),this.socketManagers.get(e);case`SSE`:return Jn(mn(this.baseUrl,n.path,t.params))(n,t);default:throw Error(`Protocol ${n.protocol} is not streamable.`)}}};exports.APIEngine=Yn;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RequestOptions } from './core/types';
|
|
2
|
+
export declare class APIEngine {
|
|
3
|
+
private manifest;
|
|
4
|
+
private socketManagers;
|
|
5
|
+
private baseUrl;
|
|
6
|
+
constructor(rawManifest: unknown);
|
|
7
|
+
/**
|
|
8
|
+
* For Standard Request-Response (REST)
|
|
9
|
+
*/
|
|
10
|
+
call<T>(key: string, options?: any): Promise<T>;
|
|
11
|
+
/**
|
|
12
|
+
* For Persistent Streams (WebSockets / SSE)
|
|
13
|
+
*/
|
|
14
|
+
watch(key: string, options?: RequestOptions): import("./protocols/sse").SSEConnection;
|
|
15
|
+
}
|