redwax-cli 0.0.0-stage → 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/README.md +90 -3
- package/dashboard/apple-touch-icon.png +0 -0
- package/dashboard/assets/data-DnUM1Mpn.js +17 -0
- package/dashboard/assets/index-Cb3ZdSPZ.js +191 -0
- package/dashboard/assets/index-GSeTo6vS.css +1 -0
- package/dashboard/assets/radix-Cu8wEyce.js +41 -0
- package/dashboard/assets/react-Cnjii2my.js +59 -0
- package/dashboard/favicon.svg +12 -0
- package/dashboard/index.html +37 -0
- package/package.json +68 -6
- package/scripts/bundle.cjs +56 -0
- package/server/package.json +5 -0
- package/server/src/app.js +141 -0
- package/server/src/config/env.js +102 -0
- package/server/src/config/keys.js +81 -0
- package/server/src/config/metrics.js +161 -0
- package/server/src/config/openapi.js +507 -0
- package/server/src/controllers/auth.controller.js +115 -0
- package/server/src/controllers/project.controller.js +154 -0
- package/server/src/controllers/secret.controller.js +138 -0
- package/server/src/domain.js +49 -0
- package/server/src/middleware/auth.middleware.js +26 -0
- package/server/src/middleware/rateLimit.middleware.js +49 -0
- package/server/src/middleware/rbac.middleware.js +47 -0
- package/server/src/middleware/validate.middleware.js +35 -0
- package/server/src/models/AuditLog.model.js +32 -0
- package/server/src/models/Project.model.js +33 -0
- package/server/src/models/Secret.model.js +30 -0
- package/server/src/models/SecretVersion.model.js +25 -0
- package/server/src/models/User.model.js +31 -0
- package/server/src/routes/auth.routes.js +15 -0
- package/server/src/routes/project.routes.js +45 -0
- package/server/src/routes/secret.routes.js +44 -0
- package/server/src/services/audit.service.js +65 -0
- package/server/src/services/auth.service.js +130 -0
- package/server/src/services/crypto.service.js +73 -0
- package/server/src/services/project.service.js +178 -0
- package/server/src/services/secret.service.js +198 -0
- package/server/src/start.js +49 -0
- package/server/src/store/index.js +60 -0
- package/server/src/store/mongo.js +336 -0
- package/server/src/store/sqlite.js +538 -0
- package/server/src/store/sqliteRuntime.js +64 -0
- package/server/src/utils/apiError.js +10 -0
- package/server/src/utils/asyncHandler.js +8 -0
- package/server/src/utils/logger.js +20 -0
- package/server/src/utils/requestContext.js +19 -0
- package/src/commands/diff.js +64 -0
- package/src/commands/history.js +56 -0
- package/src/commands/init.js +59 -0
- package/src/commands/login.js +53 -0
- package/src/commands/logout.js +30 -0
- package/src/commands/pull.js +82 -0
- package/src/commands/push.js +76 -0
- package/src/commands/server.js +313 -0
- package/src/commands/whoami.js +26 -0
- package/src/index.js +52 -0
- package/src/lib/api.js +137 -0
- package/src/lib/config.js +36 -0
- package/src/lib/credentials.js +43 -0
- package/src/lib/dotenv.js +88 -0
- package/src/lib/prompt.js +50 -0
- package/src/lib/runtime.js +88 -0
- package/src/lib/ui.js +68 -0
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# redwax
|
|
2
|
+
|
|
3
|
+
Self-hostable secret management for development teams — the CLI **and** the server in one
|
|
4
|
+
package. Stop sharing `.env` files over Slack.
|
|
5
|
+
|
|
6
|
+
## Run your own server — no Docker needed
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx redwax-cli server
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Needs Node.js 22.5 or newer, nothing else. One process serves the API, the dashboard and a
|
|
13
|
+
built-in database on http://localhost:4000. The first run creates your data folder and
|
|
14
|
+
master key and opens the dashboard.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx redwax-cli server backup # snapshot the database + master key
|
|
18
|
+
npx redwax-cli server --share # let teammates on your network connect
|
|
19
|
+
npx redwax-cli server info # where your data lives
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Back up the master key — it is the one thing that cannot be recreated.
|
|
23
|
+
|
|
24
|
+
## Install the CLI
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g redwax-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Use
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
redwax login # authenticate against your server
|
|
34
|
+
redwax init payments-api # link this directory to a project
|
|
35
|
+
redwax pull # write remote secrets into .env
|
|
36
|
+
redwax push # upload your local .env
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
| Command | What it does |
|
|
40
|
+
| ------------------------ | --------------------------------------------------------------- |
|
|
41
|
+
| `login` | Authenticate; stores a token in `~/.redwax/credentials` (0600) |
|
|
42
|
+
| `logout` | Invalidate the session and delete local credentials |
|
|
43
|
+
| `whoami` | Show the signed-in user and the linked project |
|
|
44
|
+
| `init <slug>` | Link the current directory, writing `.redwax` |
|
|
45
|
+
| `pull` | Fetch secrets and write them to `.env` |
|
|
46
|
+
| `push` | Encrypt and upload `.env`; unchanged keys are skipped |
|
|
47
|
+
| `diff` | Compare local `.env` against the remote environment |
|
|
48
|
+
| `history <KEY>` | Version history for one key |
|
|
49
|
+
|
|
50
|
+
### Common flags
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
redwax pull --env production # target a specific environment
|
|
54
|
+
redwax pull --stdout # print instead of writing a file
|
|
55
|
+
redwax pull --force # overwrite without asking (a .backup is kept)
|
|
56
|
+
redwax push --dry-run # preview the changes
|
|
57
|
+
redwax push --prune # delete remote keys missing locally
|
|
58
|
+
redwax diff --show-values # values are masked by default
|
|
59
|
+
redwax history API_KEY --full
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Drift detection in CI
|
|
63
|
+
|
|
64
|
+
`redwax diff` exits `1` when local and remote differ:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
- run: redwax diff --env production
|
|
68
|
+
env:
|
|
69
|
+
REDWAX_SERVER: https://redwax.example.com/api/v1
|
|
70
|
+
REDWAX_EMAIL: ${{ secrets.REDWAX_EMAIL }}
|
|
71
|
+
REDWAX_PASSWORD: ${{ secrets.REDWAX_PASSWORD }}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Environment variables
|
|
75
|
+
|
|
76
|
+
| Variable | Purpose |
|
|
77
|
+
| ------------------ | ----------------------------------------------------- |
|
|
78
|
+
| `REDWAX_SERVER` | API base URL (default `http://localhost:4000/api/v1`) |
|
|
79
|
+
| `REDWAX_EMAIL` | Email for non-interactive login |
|
|
80
|
+
| `REDWAX_PASSWORD` | Password for non-interactive login |
|
|
81
|
+
| `REDWAX_HOME` | Credentials directory (default `~/.redwax`) |
|
|
82
|
+
|
|
83
|
+
## Notes
|
|
84
|
+
|
|
85
|
+
Commit `.redwax` — it holds only the project id, slug and default environment. Never commit
|
|
86
|
+
`.env`; `redwax init` warns when it is not in your `.gitignore`.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var Ds=t=>{throw TypeError(t)};var Jt=(t,e,s)=>e.has(t)||Ds("Cannot "+s);var a=(t,e,s)=>(Jt(t,e,"read from private field"),s?s.call(t):e.get(t)),O=(t,e,s)=>e.has(t)?Ds("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),w=(t,e,s,n)=>(Jt(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),P=(t,e,s)=>(Jt(t,e,"access private method"),s);var _t=(t,e,s,n)=>({set _(r){w(t,e,r,s)},get _(){return a(t,e,n)}});import{r as Yn,a as k}from"./react-Cnjii2my.js";var Vt={exports:{}},dt={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Ns;function er(){if(Ns)return dt;Ns=1;var t=Yn(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(u,h,f){var l,p={},R=null,m=null;f!==void 0&&(R=""+f),h.key!==void 0&&(R=""+h.key),h.ref!==void 0&&(m=h.ref);for(l in h)n.call(h,l)&&!i.hasOwnProperty(l)&&(p[l]=h[l]);if(u&&u.defaultProps)for(l in h=u.defaultProps,h)p[l]===void 0&&(p[l]=h[l]);return{$$typeof:e,type:u,key:R,ref:m,props:p,_owner:r.current}}return dt.Fragment=s,dt.jsx=o,dt.jsxs=o,dt}var Us;function tr(){return Us||(Us=1,Vt.exports=er()),Vt.exports}var sr=tr(),ut=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ue,Ee,Ve,on,nr=(on=class extends ut{constructor(){super();O(this,Ue);O(this,Ee);O(this,Ve);w(this,Ve,e=>{if(typeof window<"u"&&window.addEventListener){const s=()=>e();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){a(this,Ee)||this.setEventListener(a(this,Ve))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,Ee))==null||e.call(this),w(this,Ee,void 0))}setEventListener(e){var s;w(this,Ve,e),(s=a(this,Ee))==null||s.call(this),w(this,Ee,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){a(this,Ue)!==e&&(w(this,Ue,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(s=>{s(e)})}isFocused(){var e;return typeof a(this,Ue)=="boolean"?a(this,Ue):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ue=new WeakMap,Ee=new WeakMap,Ve=new WeakMap,on),ws=new nr,rr={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Se,gs,an,ir=(an=class{constructor(){O(this,Se,rr);O(this,gs,!1)}setTimeoutProvider(t){w(this,Se,t)}setTimeout(t,e){return a(this,Se).setTimeout(t,e)}clearTimeout(t){a(this,Se).clearTimeout(t)}setInterval(t,e){return a(this,Se).setInterval(t,e)}clearInterval(t){a(this,Se).clearInterval(t)}},Se=new WeakMap,gs=new WeakMap,an),De=new ir;function or(t){setTimeout(t,0)}var ar=typeof window>"u"||"Deno"in globalThis;function $(){}function ur(t,e){return typeof t=="function"?t(e):t}function Yt(t){return typeof t=="number"&&t>=0&&t!==1/0}function bn(t,e){return Math.max(t+(e||0)-Date.now(),0)}function _e(t,e){return typeof t=="function"?t(e):t}function Y(t,e){return typeof t=="function"?t(e):t}function Ls(t,e){const{type:s="all",exact:n,fetchStatus:r,predicate:i,queryKey:o,stale:u}=t;if(o){if(n){if(e.queryHash!==Rs(o,e.options))return!1}else if(!mt(e.queryKey,o))return!1}if(s!=="all"){const h=e.isActive();if(s==="active"&&!h||s==="inactive"&&h)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||r&&r!==e.state.fetchStatus||i&&!i(e))}function Ms(t,e){const{exact:s,status:n,predicate:r,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(s){if(Ke(e.options.mutationKey)!==Ke(i))return!1}else if(!mt(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function Rs(t,e){return((e==null?void 0:e.queryKeyHashFn)||Ke)(t)}function Ke(t){return JSON.stringify(t,(e,s)=>es(s)?Object.keys(s).sort().reduce((n,r)=>(n[r]=s[r],n),{}):s)}function mt(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(s=>mt(t[s],e[s])):!1}var cr=Object.prototype.hasOwnProperty;function gn(t,e,s=0){if(t===e)return t;if(s>500)return e;const n=Is(t)&&Is(e);if(!n&&!(es(t)&&es(e)))return e;const i=(n?t:Object.keys(t)).length,o=n?e:Object.keys(e),u=o.length,h=n?new Array(u):{};let f=0;for(let l=0;l<u;l++){const p=n?l:o[l],R=t[p],m=e[p];if(R===m){h[p]=R,(n?l<i:cr.call(t,p))&&f++;continue}if(R===null||m===null||typeof R!="object"||typeof m!="object"){h[p]=m;continue}const S=gn(R,m,s+1);h[p]=S,S===R&&f++}return i===u&&f===i?t:h}function It(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(t[s]!==e[s])return!1;return!0}function Is(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function es(t){if(!js(t))return!1;const e=t.constructor;if(e===void 0)return!0;const s=e.prototype;return!(!js(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function js(t){return Object.prototype.toString.call(t)==="[object Object]"}function lr(t){return new Promise(e=>{De.setTimeout(e,t)})}function ts(t,e,s){return typeof s.structuralSharing=="function"?s.structuralSharing(t,e):s.structuralSharing!==!1?gn(t,e):e}function hr(t,e,s=0){const n=[...t,e];return s&&n.length>s?n.slice(1):n}function fr(t,e,s=0){const n=[e,...t];return s&&n.length>s?n.slice(0,-1):n}var Es=Symbol();function wn(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Es?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Ss(t,e){return typeof t=="function"?t(...e):!!t}function dr(t,e,s){let n=!1,r;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??(r=e()),n||(n=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var bt=(()=>{let t=()=>ar;return{isServer(){return t()},setIsServer(e){t=e}}})();function ss(){let t,e;const s=new Promise((r,i)=>{t=r,e=i});s.status="pending",s.catch(()=>{});function n(r){Object.assign(s,r),delete s.resolve,delete s.reject}return s.resolve=r=>{n({status:"fulfilled",value:r}),t(r)},s.reject=r=>{n({status:"rejected",reason:r}),e(r)},s}var pr=or;function yr(){let t=[],e=0,s=u=>{u()},n=u=>{u()},r=pr;const i=u=>{e?t.push(u):r(()=>{s(u)})},o=()=>{const u=t;t=[],u.length&&r(()=>{n(()=>{u.forEach(h=>{s(h)})})})};return{batch:u=>{let h;e++;try{h=u()}finally{e--,e||o()}return h},batchCalls:u=>(...h)=>{i(()=>{u(...h)})},schedule:i,setNotifyFunction:u=>{s=u},setBatchNotifyFunction:u=>{n=u},setScheduler:u=>{r=u}}}var I=yr(),We,Oe,Ge,un,mr=(un=class extends ut{constructor(){super();O(this,We,!0);O(this,Oe);O(this,Ge);w(this,Ge,e=>{if(typeof window<"u"&&window.addEventListener){const s=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",n)}}})}onSubscribe(){a(this,Oe)||this.setEventListener(a(this,Ge))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,Oe))==null||e.call(this),w(this,Oe,void 0))}setEventListener(e){var s;w(this,Ge,e),(s=a(this,Oe))==null||s.call(this),w(this,Oe,e(this.setOnline.bind(this)))}setOnline(e){a(this,We)!==e&&(w(this,We,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return a(this,We)}},We=new WeakMap,Oe=new WeakMap,Ge=new WeakMap,un),jt=new mr;function br(t){return Math.min(1e3*2**t,3e4)}function Rn(t){return(t??"online")==="online"?jt.isOnline():!0}var ns=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function En(t){let e=!1,s=0,n;const r=ss(),i=()=>r.status!=="pending",o=y=>{var d;if(!i()){const b=new ns(y);R(b),(d=t.onCancel)==null||d.call(t,b)}},u=()=>{e=!0},h=()=>{e=!1},f=()=>ws.isFocused()&&(t.networkMode==="always"||jt.isOnline())&&t.canRun(),l=()=>Rn(t.networkMode)&&t.canRun(),p=y=>{i()||(n==null||n(),r.resolve(y))},R=y=>{i()||(n==null||n(),r.reject(y))},m=()=>new Promise(y=>{var d;n=b=>{(i()||f())&&y(b)},(d=t.onPause)==null||d.call(t)}).then(()=>{var y;n=void 0,i()||(y=t.onContinue)==null||y.call(t)}),S=()=>{if(i())return;let y;const d=s===0?t.initialPromise:void 0;try{y=d??t.fn()}catch(b){y=Promise.reject(b)}Promise.resolve(y).then(p).catch(b=>{var N;if(i())return;const C=t.retry??(bt.isServer()?0:3),v=t.retryDelay??br,g=typeof v=="function"?v(s,b):v,A=C===!0||typeof C=="number"&&s<C||typeof C=="function"&&C(s,b);if(e||!A){R(b);return}s++,(N=t.onFail)==null||N.call(t,s,b),lr(g).then(()=>f()?void 0:m()).then(()=>{e?R(b):S()})})};return{promise:r,status:()=>r.status,cancel:o,continue:()=>(n==null||n(),r),cancelRetry:u,continueRetry:h,canStart:l,start:()=>(l()?S():m().then(S),r)}}var Le,cn,Sn=(cn=class{constructor(){O(this,Le)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yt(this.gcTime)&&w(this,Le,De.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(bt.isServer()?1/0:300*1e3))}clearGcTimeout(){a(this,Le)!==void 0&&(De.clearTimeout(a(this,Le)),w(this,Le,void 0))}},Le=new WeakMap,cn);function gr(t){return{onFetch:(e,s)=>{var l,p,R,m,S;const n=e.options,r=(R=(p=(l=e.fetchOptions)==null?void 0:l.meta)==null?void 0:p.fetchMore)==null?void 0:R.direction,i=((m=e.state.data)==null?void 0:m.pages)||[],o=((S=e.state.data)==null?void 0:S.pageParams)||[];let u={pages:[],pageParams:[]},h=0;const f=async()=>{let y=!1;const d=v=>{dr(v,()=>e.signal,()=>y=!0)},b=wn(e.options,e.fetchOptions),C=async(v,g,A)=>{if(y)return Promise.reject(e.signal.reason);if(g==null&&v.pages.length)return Promise.resolve(v);const V=(()=>{const q={client:e.client,queryKey:e.queryKey,pageParam:g,direction:A?"backward":"forward",meta:e.options.meta};return d(q),q})(),x=await b(V),{maxPages:L}=e.options,D=A?fr:hr;return{pages:D(v.pages,x,L),pageParams:D(v.pageParams,g,L)}};if(r&&i.length){const v=r==="backward",g=v?wr:ks,A={pages:i,pageParams:o},N=g(n,A);u=await C(A,N,v)}else{const v=t??i.length;do{const g=h===0?o[0]??n.initialPageParam:ks(n,u);if(h>0&&g==null)break;u=await C(u,g),h++}while(h<v)}return u};e.options.persister?e.fetchFn=()=>{var y,d;return(d=(y=e.options).persister)==null?void 0:d.call(y,f,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s)}:e.fetchFn=f}}}function ks(t,{pages:e,pageParams:s}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,s[n],s):void 0}function wr(t,{pages:e,pageParams:s}){var n;return e.length>0?(n=t.getPreviousPageParam)==null?void 0:n.call(t,e[0],e,s[0],s):void 0}var Xe,Me,Ze,se,Ie,j,gt,je,Z,On,he,ln,Rr=(ln=class extends Sn{constructor(e){super();O(this,Z);O(this,Xe);O(this,Me);O(this,Ze);O(this,se);O(this,Ie);O(this,j);O(this,gt);O(this,je);w(this,je,!1),w(this,gt,e.defaultOptions),this.setOptions(e.options),this.observers=[],w(this,Ie,e.client),w(this,se,a(this,Ie).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,w(this,Me,Bs(this.options)),this.state=e.state??a(this,Me),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return a(this,Xe)}get promise(){var e;return(e=a(this,j))==null?void 0:e.promise}setOptions(e){if(this.options={...a(this,gt),...e},e!=null&&e._type&&w(this,Xe,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=Bs(this.options);s.data!==void 0&&(this.setState(qs(s.data,s.dataUpdatedAt)),w(this,Me,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&a(this,se).remove(this)}setData(e,s){const n=ts(this.state.data,e,this.options);return P(this,Z,he).call(this,{data:n,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),n}setState(e){P(this,Z,he).call(this,{type:"setState",state:e})}cancel(e){var n,r;const s=(n=a(this,j))==null?void 0:n.promise;return(r=a(this,j))==null||r.cancel(e),s?s.then($).catch($):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return a(this,Me)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Es||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>_e(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!bn(this.state.dataUpdatedAt,e)}onFocus(){var s;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(s=a(this,j))==null||s.continue()}onOnline(){var s;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(s=a(this,j))==null||s.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),a(this,se).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(s=>s!==e),this.observers.length||(a(this,j)&&(a(this,je)||P(this,Z,On).call(this)?a(this,j).cancel({revert:!0}):a(this,j).cancelRetry()),this.scheduleGc()),a(this,se).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||P(this,Z,he).call(this,{type:"invalidate"})}async fetch(e,s){var f,l,p,R,m,S,y,d,b,C,v;if(this.state.fetchStatus!=="idle"&&((f=a(this,j))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(a(this,j))return a(this,j).continueRetry(),a(this,j).promise}if(e&&this.setOptions(e),!this.options.queryFn){const g=this.observers.find(A=>A.options.queryFn);g&&this.setOptions(g.options)}const n=new AbortController,r=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(w(this,je,!0),n.signal)})},i=()=>{const g=wn(this.options,s),N=(()=>{const V={client:a(this,Ie),queryKey:this.queryKey,meta:this.meta};return r(V),V})();return w(this,je,!1),this.options.persister?this.options.persister(g,N,this):g(N)},u=(()=>{const g={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:a(this,Ie),state:this.state,fetchFn:i};return r(g),g})(),h=a(this,Xe)==="infinite"?gr(this.options.pages):this.options.behavior;h==null||h.onFetch(u,this),w(this,Ze,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((l=u.fetchOptions)==null?void 0:l.meta))&&P(this,Z,he).call(this,{type:"fetch",meta:(p=u.fetchOptions)==null?void 0:p.meta}),w(this,j,En({initialPromise:s==null?void 0:s.initialPromise,fn:u.fetchFn,onCancel:g=>{g instanceof ns&&g.revert&&this.setState({...a(this,Ze),fetchStatus:"idle"}),n.abort()},onFail:(g,A)=>{P(this,Z,he).call(this,{type:"failed",failureCount:g,error:A})},onPause:()=>{P(this,Z,he).call(this,{type:"pause"})},onContinue:()=>{P(this,Z,he).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const g=await a(this,j).start();if(g===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(g),(m=(R=a(this,se).config).onSuccess)==null||m.call(R,g,this),(y=(S=a(this,se).config).onSettled)==null||y.call(S,g,this.state.error,this),g}catch(g){if(g instanceof ns){if(g.silent)return a(this,j).promise;if(g.revert){if(this.state.data===void 0)throw g;return this.state.data}}throw P(this,Z,he).call(this,{type:"error",error:g}),(b=(d=a(this,se).config).onError)==null||b.call(d,g,this),(v=(C=a(this,se).config).onSettled)==null||v.call(C,this.state.data,g,this),g}finally{this.scheduleGc()}}},Xe=new WeakMap,Me=new WeakMap,Ze=new WeakMap,se=new WeakMap,Ie=new WeakMap,j=new WeakMap,gt=new WeakMap,je=new WeakMap,Z=new WeakSet,On=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},he=function(e){const s=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...vn(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...qs(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return w(this,Ze,e.manual?r:void 0),r;case"error":const i=e.error;return{...n,error:i,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=s(this.state),I.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),a(this,se).notify({query:this,type:"updated",action:e})})},ln);function vn(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Rn(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function qs(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Bs(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,s=e!==void 0,n=s?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var W,T,wt,z,ke,Ye,fe,ve,Rt,et,tt,qe,Be,Ce,st,_,yt,rs,is,os,as,us,cs,ls,Cn,hn,Er=(hn=class extends ut{constructor(e,s){super();O(this,_);O(this,W);O(this,T);O(this,wt);O(this,z);O(this,ke);O(this,Ye);O(this,fe);O(this,ve);O(this,Rt);O(this,et);O(this,tt);O(this,qe);O(this,Be);O(this,Ce);O(this,st,new Set);this.options=s,w(this,W,e),w(this,ve,null),w(this,fe,ss()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(a(this,T).addObserver(this),Qs(a(this,T),this.options)?P(this,_,yt).call(this):this.updateResult(),P(this,_,as).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return hs(a(this,T),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return hs(a(this,T),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,P(this,_,us).call(this),P(this,_,cs).call(this),a(this,T).removeObserver(this)}setOptions(e){const s=this.options,n=a(this,T);if(this.options=a(this,W).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Y(this.options.enabled,a(this,T))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");P(this,_,ls).call(this),a(this,T).setOptions(this.options),s._defaulted&&!It(this.options,s)&&a(this,W).getQueryCache().notify({type:"observerOptionsUpdated",query:a(this,T),observer:this});const r=this.hasListeners();r&&Hs(a(this,T),n,this.options,s)&&P(this,_,yt).call(this),this.updateResult(),r&&(a(this,T)!==n||Y(this.options.enabled,a(this,T))!==Y(s.enabled,a(this,T))||_e(this.options.staleTime,a(this,T))!==_e(s.staleTime,a(this,T)))&&P(this,_,rs).call(this);const i=P(this,_,is).call(this);r&&(a(this,T)!==n||Y(this.options.enabled,a(this,T))!==Y(s.enabled,a(this,T))||i!==a(this,Ce))&&P(this,_,os).call(this,i)}getOptimisticResult(e){const s=a(this,W).getQueryCache().build(a(this,W),e),n=this.createResult(s,e);return Or(this,n)&&(w(this,z,n),w(this,Ye,this.options),w(this,ke,a(this,T).state)),n}getCurrentResult(){return a(this,z)}trackResult(e,s){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),s==null||s(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&a(this,fe).status==="pending"&&a(this,fe).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){a(this,st).add(e)}getCurrentQuery(){return a(this,T)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const s=a(this,W).defaultQueryOptions(e),n=a(this,W).getQueryCache().build(a(this,W),s);return n.fetch().then(()=>this.createResult(n,s))}fetch(e){return P(this,_,yt).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),a(this,z)))}createResult(e,s){var L;const n=a(this,T),r=this.options,i=a(this,z),o=a(this,ke),u=a(this,Ye),f=e!==n?e.state:a(this,wt),{state:l}=e;let p={...l},R=!1,m;if(s._optimisticResults){const D=this.hasListeners(),q=!D&&Qs(e,s),ce=D&&Hs(e,n,s,r);(q||ce)&&(p={...p,...vn(l.data,e.options)}),s._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:S,errorUpdatedAt:y,status:d}=p;m=p.data;let b=!1;if(s.placeholderData!==void 0&&m===void 0&&d==="pending"){let D;i!=null&&i.isPlaceholderData&&s.placeholderData===(u==null?void 0:u.placeholderData)?(D=i.data,b=!0):D=typeof s.placeholderData=="function"?s.placeholderData((L=a(this,tt))==null?void 0:L.state.data,a(this,tt)):s.placeholderData,D!==void 0&&(d="success",m=ts(i==null?void 0:i.data,D,s),R=!0)}if(s.select&&m!==void 0&&!b)if(i&&m===(o==null?void 0:o.data)&&s.select===a(this,Rt))m=a(this,et);else try{w(this,Rt,s.select),m=s.select(m),m=ts(i==null?void 0:i.data,m,s),w(this,et,m),w(this,ve,null)}catch(D){w(this,ve,D)}a(this,ve)&&(S=a(this,ve),m=a(this,et),y=Date.now(),d="error");const C=p.fetchStatus==="fetching",v=d==="pending",g=d==="error",A=v&&C,N=m!==void 0,x={status:d,fetchStatus:p.fetchStatus,isPending:v,isSuccess:d==="success",isError:g,isInitialLoading:A,isLoading:A,data:m,dataUpdatedAt:p.dataUpdatedAt,error:S,errorUpdatedAt:y,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>f.dataUpdateCount||p.errorUpdateCount>f.errorUpdateCount,isFetching:C,isRefetching:C&&!v,isLoadingError:g&&!N,isPaused:p.fetchStatus==="paused",isPlaceholderData:R,isRefetchError:g&&N,isStale:Os(e,s),refetch:this.refetch,promise:a(this,fe),isEnabled:Y(s.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const D=x.data!==void 0,q=x.status==="error"&&!D,ce=be=>{q?be.reject(x.error):D&&be.resolve(x.data)},lt=()=>{const be=w(this,fe,x.promise=ss());ce(be)},K=a(this,fe);switch(K.status){case"pending":e.queryHash===n.queryHash&&ce(K);break;case"fulfilled":(q||x.data!==K.value)&<();break;case"rejected":(!q||x.error!==K.reason)&<();break}}return x}updateResult(){const e=a(this,z),s=this.createResult(a(this,T),this.options);if(w(this,ke,a(this,T).state),w(this,Ye,this.options),a(this,ke).data!==void 0&&w(this,tt,a(this,T)),It(s,e))return;w(this,z,s);const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!a(this,st).size)return!0;const o=new Set(i??a(this,st));return this.options.throwOnError&&o.add("error"),Object.keys(a(this,z)).some(u=>{const h=u;return a(this,z)[h]!==e[h]&&o.has(h)})};P(this,_,Cn).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&P(this,_,as).call(this)}},W=new WeakMap,T=new WeakMap,wt=new WeakMap,z=new WeakMap,ke=new WeakMap,Ye=new WeakMap,fe=new WeakMap,ve=new WeakMap,Rt=new WeakMap,et=new WeakMap,tt=new WeakMap,qe=new WeakMap,Be=new WeakMap,Ce=new WeakMap,st=new WeakMap,_=new WeakSet,yt=function(e){P(this,_,ls).call(this);let s=a(this,T).fetch(this.options,e);return e!=null&&e.throwOnError||(s=s.catch($)),s},rs=function(){P(this,_,us).call(this);const e=_e(this.options.staleTime,a(this,T));if(bt.isServer()||a(this,z).isStale||!Yt(e))return;const n=bn(a(this,z).dataUpdatedAt,e)+1;w(this,qe,De.setTimeout(()=>{a(this,z).isStale||this.updateResult()},n))},is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(a(this,T)):this.options.refetchInterval)??!1},os=function(e){P(this,_,cs).call(this),w(this,Ce,e),!(bt.isServer()||Y(this.options.enabled,a(this,T))===!1||!Yt(a(this,Ce))||a(this,Ce)===0)&&w(this,Be,De.setInterval(()=>{(this.options.refetchIntervalInBackground||ws.isFocused())&&P(this,_,yt).call(this)},a(this,Ce)))},as=function(){P(this,_,rs).call(this),P(this,_,os).call(this,P(this,_,is).call(this))},us=function(){a(this,qe)!==void 0&&(De.clearTimeout(a(this,qe)),w(this,qe,void 0))},cs=function(){a(this,Be)!==void 0&&(De.clearInterval(a(this,Be)),w(this,Be,void 0))},ls=function(){const e=a(this,W).getQueryCache().build(a(this,W),this.options);if(e===a(this,T))return;const s=a(this,T);w(this,T,e),w(this,wt,e.state),this.hasListeners()&&(s==null||s.removeObserver(this),e.addObserver(this))},Cn=function(e){I.batch(()=>{e.listeners&&this.listeners.forEach(s=>{s(a(this,z))}),a(this,W).getQueryCache().notify({query:a(this,T),type:"observerResultsUpdated"})})},hn);function Sr(t,e){return Y(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&Y(e.retryOnMount,t)===!1)}function Qs(t,e){return Sr(t,e)||t.state.data!==void 0&&hs(t,e,e.refetchOnMount)}function hs(t,e,s){if(Y(e.enabled,t)!==!1&&_e(e.staleTime,t)!=="static"){const n=typeof s=="function"?s(t):s;return n==="always"||n!==!1&&Os(t,e)}return!1}function Hs(t,e,s,n){return(t!==e||Y(n.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&Os(t,s)}function Os(t,e){return Y(e.enabled,t)!==!1&&t.isStaleByTime(_e(e.staleTime,t))}function Or(t,e){return!It(t.getCurrentResult(),e)}var Et,oe,Q,Qe,ae,Re,fn,vr=(fn=class extends Sn{constructor(e){super();O(this,ae);O(this,Et);O(this,oe);O(this,Q);O(this,Qe);w(this,Et,e.client),this.mutationId=e.mutationId,w(this,Q,e.mutationCache),w(this,oe,[]),this.state=e.state||Pn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){a(this,oe).includes(e)||(a(this,oe).push(e),this.clearGcTimeout(),a(this,Q).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){w(this,oe,a(this,oe).filter(s=>s!==e)),this.scheduleGc(),a(this,Q).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){a(this,oe).length||(this.state.status==="pending"?this.scheduleGc():a(this,Q).remove(this))}continue(){var e;return((e=a(this,Qe))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,u,h,f,l,p,R,m,S,y,d,b,C,v,g,A,N,V;const s=()=>{P(this,ae,Re).call(this,{type:"continue"})},n={client:a(this,Et),meta:this.options.meta,mutationKey:this.options.mutationKey};w(this,Qe,En({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,L)=>{P(this,ae,Re).call(this,{type:"failed",failureCount:x,error:L})},onPause:()=>{P(this,ae,Re).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>a(this,Q).canRun(this)}));const r=this.state.status==="pending",i=!a(this,Qe).canStart();try{if(r)s();else{P(this,ae,Re).call(this,{type:"pending",variables:e,isPaused:i}),a(this,Q).config.onMutate&&await a(this,Q).config.onMutate(e,this,n);const L=await((u=(o=this.options).onMutate)==null?void 0:u.call(o,e,n));L!==this.state.context&&P(this,ae,Re).call(this,{type:"pending",context:L,variables:e,isPaused:i})}const x=await a(this,Qe).start();return await((f=(h=a(this,Q).config).onSuccess)==null?void 0:f.call(h,x,e,this.state.context,this,n)),await((p=(l=this.options).onSuccess)==null?void 0:p.call(l,x,e,this.state.context,n)),await((m=(R=a(this,Q).config).onSettled)==null?void 0:m.call(R,x,null,this.state.variables,this.state.context,this,n)),await((y=(S=this.options).onSettled)==null?void 0:y.call(S,x,null,e,this.state.context,n)),P(this,ae,Re).call(this,{type:"success",data:x}),x}catch(x){try{await((b=(d=a(this,Q).config).onError)==null?void 0:b.call(d,x,e,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((v=(C=this.options).onError)==null?void 0:v.call(C,x,e,this.state.context,n))}catch(L){Promise.reject(L)}try{await((A=(g=a(this,Q).config).onSettled)==null?void 0:A.call(g,void 0,x,this.state.variables,this.state.context,this,n))}catch(L){Promise.reject(L)}try{await((V=(N=this.options).onSettled)==null?void 0:V.call(N,void 0,x,e,this.state.context,n))}catch(L){Promise.reject(L)}throw P(this,ae,Re).call(this,{type:"error",error:x}),x}finally{a(this,Q).runNext(this)}}},Et=new WeakMap,oe=new WeakMap,Q=new WeakMap,Qe=new WeakMap,ae=new WeakSet,Re=function(e){const s=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=s(this.state),I.batch(()=>{a(this,oe).forEach(n=>{n.onMutationUpdate(e)}),a(this,Q).notify({mutation:this,type:"updated",action:e})})},fn);function Pn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var de,ne,St,dn,Cr=(dn=class extends ut{constructor(e={}){super();O(this,de);O(this,ne);O(this,St);this.config=e,w(this,de,new Set),w(this,ne,new Map),w(this,St,0)}build(e,s,n){const r=new vr({client:e,mutationCache:this,mutationId:++_t(this,St)._,options:e.defaultMutationOptions(s),state:n});return this.add(r),r}add(e){a(this,de).add(e);const s=Ft(e);if(typeof s=="string"){const n=a(this,ne).get(s);n?n.push(e):a(this,ne).set(s,[e])}this.notify({type:"added",mutation:e})}remove(e){if(a(this,de).delete(e)){const s=Ft(e);if(typeof s=="string"){const n=a(this,ne).get(s);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&a(this,ne).delete(s)}}this.notify({type:"removed",mutation:e})}canRun(e){const s=Ft(e);if(typeof s=="string"){const n=a(this,ne).get(s),r=n==null?void 0:n.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){var n;const s=Ft(e);if(typeof s=="string"){const r=(n=a(this,ne).get(s))==null?void 0:n.find(i=>i!==e&&i.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){I.batch(()=>{a(this,de).forEach(e=>{this.notify({type:"removed",mutation:e})}),a(this,de).clear(),a(this,ne).clear()})}getAll(){return Array.from(a(this,de))}find(e){const s={exact:!0,...e};return this.getAll().find(n=>Ms(s,n))}findAll(e={}){return this.getAll().filter(s=>Ms(e,s))}notify(e){I.batch(()=>{this.listeners.forEach(s=>{s(e)})})}resumePausedMutations(){const e=this.getAll().filter(s=>s.state.isPaused);return I.batch(()=>Promise.all(e.map(s=>s.continue().catch($))))}},de=new WeakMap,ne=new WeakMap,St=new WeakMap,dn);function Ft(t){var e;return(e=t.options.scope)==null?void 0:e.id}var pe,Pe,G,ye,me,Nt,fs,pn,Pr=(pn=class extends ut{constructor(e,s){super();O(this,me);O(this,pe);O(this,Pe);O(this,G);O(this,ye);w(this,pe,e),this.setOptions(s),this.bindMethods(),P(this,me,Nt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var n;const s=this.options;this.options=a(this,pe).defaultMutationOptions(e),It(this.options,s)||a(this,pe).getMutationCache().notify({type:"observerOptionsUpdated",mutation:a(this,G),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Ke(s.mutationKey)!==Ke(this.options.mutationKey)?this.reset():((n=a(this,G))==null?void 0:n.state.status)==="pending"&&a(this,G).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=a(this,G))==null||e.removeObserver(this)}onMutationUpdate(e){P(this,me,Nt).call(this),P(this,me,fs).call(this,e)}getCurrentResult(){return a(this,Pe)}reset(){var e;(e=a(this,G))==null||e.removeObserver(this),w(this,G,void 0),P(this,me,Nt).call(this),P(this,me,fs).call(this)}mutate(e,s){var n;return w(this,ye,s),(n=a(this,G))==null||n.removeObserver(this),w(this,G,a(this,pe).getMutationCache().build(a(this,pe),this.options)),a(this,G).addObserver(this),a(this,G).execute(e)}},pe=new WeakMap,Pe=new WeakMap,G=new WeakMap,ye=new WeakMap,me=new WeakSet,Nt=function(){var s;const e=((s=a(this,G))==null?void 0:s.state)??Pn();w(this,Pe,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},fs=function(e){I.batch(()=>{var s,n,r,i,o,u,h,f;if(a(this,ye)&&this.hasListeners()){const l=a(this,Pe).variables,p=a(this,Pe).context,R={client:a(this,pe),meta:this.options.meta,mutationKey:this.options.mutationKey};if((e==null?void 0:e.type)==="success"){try{(n=(s=a(this,ye)).onSuccess)==null||n.call(s,e.data,l,p,R)}catch(m){Promise.reject(m)}try{(i=(r=a(this,ye)).onSettled)==null||i.call(r,e.data,null,l,p,R)}catch(m){Promise.reject(m)}}else if((e==null?void 0:e.type)==="error"){try{(u=(o=a(this,ye)).onError)==null||u.call(o,e.error,l,p,R)}catch(m){Promise.reject(m)}try{(f=(h=a(this,ye)).onSettled)==null||f.call(h,void 0,e.error,l,p,R)}catch(m){Promise.reject(m)}}}this.listeners.forEach(l=>{l(a(this,Pe))})})},pn),ue,yn,Tr=(yn=class extends ut{constructor(e={}){super();O(this,ue);this.config=e,w(this,ue,new Map)}build(e,s,n){const r=s.queryKey,i=s.queryHash??Rs(r,s);let o=this.get(i);return o||(o=new Rr({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(s),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){a(this,ue).has(e.queryHash)||(a(this,ue).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const s=a(this,ue).get(e.queryHash);s&&(e.destroy(),s===e&&a(this,ue).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){I.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return a(this,ue).get(e)}getAll(){return[...a(this,ue).values()]}find(e){const s={exact:!0,...e};return this.getAll().find(n=>Ls(s,n))}findAll(e={}){const s=this.getAll();return Object.keys(e).length>0?s.filter(n=>Ls(e,n)):s}notify(e){I.batch(()=>{this.listeners.forEach(s=>{s(e)})})}onFocus(){I.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){I.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ue=new WeakMap,yn),U,Te,Ae,nt,rt,xe,it,ot,mn,xo=(mn=class{constructor(t={}){O(this,U);O(this,Te);O(this,Ae);O(this,nt);O(this,rt);O(this,xe);O(this,it);O(this,ot);w(this,U,t.queryCache||new Tr),w(this,Te,t.mutationCache||new Cr),w(this,Ae,t.defaultOptions||{}),w(this,nt,new Map),w(this,rt,new Map),w(this,xe,0)}mount(){_t(this,xe)._++,a(this,xe)===1&&(w(this,it,ws.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,U).onFocus())})),w(this,ot,jt.subscribe(async t=>{t&&(await this.resumePausedMutations(),a(this,U).onOnline())})))}unmount(){var t,e;_t(this,xe)._--,a(this,xe)===0&&((t=a(this,it))==null||t.call(this),w(this,it,void 0),(e=a(this,ot))==null||e.call(this),w(this,ot,void 0))}isFetching(t){return a(this,U).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return a(this,Te).findAll({...t,status:"pending"}).length}getQueryData(t){var s;const e=this.defaultQueryOptions({queryKey:t});return(s=a(this,U).get(e.queryHash))==null?void 0:s.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=a(this,U).build(this,e),n=s.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(_e(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return a(this,U).findAll(t).map(({queryKey:e,state:s})=>{const n=s.data;return[e,n]})}setQueryData(t,e,s){const n=this.defaultQueryOptions({queryKey:t}),r=a(this,U).get(n.queryHash),i=r==null?void 0:r.state.data,o=ur(e,i);if(o!==void 0)return a(this,U).build(this,n).setData(o,{...s,manual:!0})}setQueriesData(t,e,s){return I.batch(()=>a(this,U).findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,s)]))}getQueryState(t){var s;const e=this.defaultQueryOptions({queryKey:t});return(s=a(this,U).get(e.queryHash))==null?void 0:s.state}removeQueries(t){const e=a(this,U);I.batch(()=>{e.findAll(t).forEach(s=>{e.remove(s)})})}resetQueries(t,e){const s=a(this,U);return I.batch(()=>(s.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},n=I.batch(()=>a(this,U).findAll(t).map(r=>r.cancel(s)));return Promise.all(n).then($).catch($)}invalidateQueries(t,e={}){return I.batch(()=>(a(this,U).findAll(t).forEach(s=>{s.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},n=I.batch(()=>a(this,U).findAll(t).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let i=r.fetch(void 0,s);return s.throwOnError||(i=i.catch($)),r.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then($)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const s=a(this,U).build(this,e);return s.isStaleByTime(_e(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then($).catch($)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then($).catch($)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return jt.isOnline()?a(this,Te).resumePausedMutations():Promise.resolve()}getQueryCache(){return a(this,U)}getMutationCache(){return a(this,Te)}getDefaultOptions(){return a(this,Ae)}setDefaultOptions(t){w(this,Ae,t)}setQueryDefaults(t,e){a(this,nt).set(Ke(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...a(this,nt).values()],s={};return e.forEach(n=>{mt(t,n.queryKey)&&Object.assign(s,n.defaultOptions)}),s}setMutationDefaults(t,e){a(this,rt).set(Ke(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...a(this,rt).values()],s={};return e.forEach(n=>{mt(t,n.mutationKey)&&Object.assign(s,n.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...a(this,Ae).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Rs(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Es&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...a(this,Ae).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){a(this,U).clear(),a(this,Te).clear()}},U=new WeakMap,Te=new WeakMap,Ae=new WeakMap,nt=new WeakMap,rt=new WeakMap,xe=new WeakMap,it=new WeakMap,ot=new WeakMap,mn),Tn=k.createContext(void 0),An=t=>{const e=k.useContext(Tn);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},_o=({client:t,children:e})=>(k.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),sr.jsx(Tn.Provider,{value:t,children:e})),xn=k.createContext(!1),Ar=()=>k.useContext(xn);xn.Provider;function xr(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var _r=k.createContext(xr()),Fr=()=>k.useContext(_r),Dr=(t,e,s)=>{const n=s!=null&&s.state.error&&typeof t.throwOnError=="function"?Ss(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||n)&&(e.isReset()||(t.retryOnMount=!1))},Nr=t=>{k.useEffect(()=>{t.clearReset()},[t])},Ur=({result:t,errorResetBoundary:e,throwOnError:s,query:n,suspense:r})=>t.isError&&!e.isReset()&&!t.isFetching&&n&&(r&&t.data===void 0||Ss(s,[t.error,n])),Lr=t=>{if(t.suspense){const s=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>s(n(...r)):s(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Mr=(t,e)=>t.isLoading&&t.isFetching&&!e,Ir=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Ks=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function jr(t,e,s){var R,m,S,y;const n=Ar(),r=Fr(),i=An(),o=i.defaultQueryOptions(t);(m=(R=i.getDefaultOptions().queries)==null?void 0:R._experimental_beforeQuery)==null||m.call(R,o);const u=i.getQueryCache().get(o.queryHash);o._optimisticResults=n?"isRestoring":"optimistic",Lr(o),Dr(o,r,u),Nr(r);const h=!i.getQueryCache().get(o.queryHash),[f]=k.useState(()=>new e(i,o)),l=f.getOptimisticResult(o),p=!n&&t.subscribed!==!1;if(k.useSyncExternalStore(k.useCallback(d=>{const b=p?f.subscribe(I.batchCalls(d)):$;return f.updateResult(),b},[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),k.useEffect(()=>{f.setOptions(o)},[o,f]),Ir(o,l))throw Ks(o,f,r);if(Ur({result:l,errorResetBoundary:r,throwOnError:o.throwOnError,query:u,suspense:o.suspense}))throw l.error;if((y=(S=i.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||y.call(S,o,l),o.experimental_prefetchInRender&&!bt.isServer()&&Mr(l,n)){const d=h?Ks(o,f,r):u==null?void 0:u.promise;d==null||d.catch($).finally(()=>{f.updateResult()})}return o.notifyOnChangeProps?l:f.trackResult(l)}function Fo(t,e){return jr(t,Er)}function Do(t,e){const s=An(),[n]=k.useState(()=>new Pr(s,t));k.useEffect(()=>{n.setOptions(t)},[n,t]);const r=k.useSyncExternalStore(k.useCallback(o=>n.subscribe(I.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=k.useCallback((o,u)=>{n.mutate(o,u).catch($)},[n]);if(r.error&&Ss(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}function _n(t,e){return function(){return t.apply(e,arguments)}}const{toString:kr}=Object.prototype,{getPrototypeOf:qt}=Object,{iterator:Bt,toStringTag:Fn}=Symbol,Qt=(t=>e=>{const s=kr.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),re=t=>(t=t.toLowerCase(),e=>Qt(e)===t),Ht=t=>e=>typeof e===t,{isArray:ct}=Array,at=Ht("undefined");function Ot(t){return t!==null&&!at(t)&&t.constructor!==null&&!at(t.constructor)&&X(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Dn=re("ArrayBuffer");function qr(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Dn(t.buffer),e}const Br=Ht("string"),X=Ht("function"),Nn=Ht("number"),vt=t=>t!==null&&typeof t=="object",Qr=t=>t===!0||t===!1,Ut=t=>{if(Qt(t)!=="object")return!1;const e=qt(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Fn in t)&&!(Bt in t)},Hr=t=>{if(!vt(t)||Ot(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Kr=re("Date"),zr=re("File"),$r=t=>!!(t&&typeof t.uri<"u"),Jr=t=>t&&typeof t.getParts<"u",Vr=re("Blob"),Wr=re("FileList"),Gr=t=>vt(t)&&X(t.pipe);function Xr(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const zs=Xr(),$s=typeof zs.FormData<"u"?zs.FormData:void 0,Zr=t=>{if(!t)return!1;if($s&&t instanceof $s)return!0;const e=qt(t);if(!e||e===Object.prototype||!X(t.append))return!1;const s=Qt(t);return s==="formdata"||s==="object"&&X(t.toString)&&t.toString()==="[object FormData]"},Yr=re("URLSearchParams"),[ei,ti,si,ni]=["ReadableStream","Request","Response","Headers"].map(re),ri=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ct(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t>"u")return;let n,r;if(typeof t!="object"&&(t=[t]),ct(t))for(n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else{if(Ot(t))return;const i=s?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let u;for(n=0;n<o;n++)u=i[n],e.call(null,t[u],u,t)}}function Un(t,e){if(Ot(t))return null;e=e.toLowerCase();const s=Object.keys(t);let n=s.length,r;for(;n-- >0;)if(r=s[n],e===r.toLowerCase())return r;return null}const Ne=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ln=t=>!at(t)&&t!==Ne;function ds(...t){const{caseless:e,skipUndefined:s}=Ln(this)&&this||{},n={},r=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const u=e&&Un(n,o)||o,h=ps(n,u)?n[u]:void 0;Ut(h)&&Ut(i)?n[u]=ds(h,i):Ut(i)?n[u]=ds({},i):ct(i)?n[u]=i.slice():(!s||!at(i))&&(n[u]=i)};for(let i=0,o=t.length;i<o;i++)t[i]&&Ct(t[i],r);return n}const ii=(t,e,s,{allOwnKeys:n}={})=>(Ct(e,(r,i)=>{s&&X(r)?Object.defineProperty(t,i,{__proto__:null,value:_n(r,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,i,{__proto__:null,value:r,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),t),oi=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),ai=(t,e,s,n)=>{t.prototype=Object.create(e.prototype,n),Object.defineProperty(t.prototype,"constructor",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{__proto__:null,value:e.prototype}),s&&Object.assign(t.prototype,s)},ui=(t,e,s,n)=>{let r,i,o;const u={};if(e=e||{},t==null)return e;do{for(r=Object.getOwnPropertyNames(t),i=r.length;i-- >0;)o=r[i],(!n||n(o,t,e))&&!u[o]&&(e[o]=t[o],u[o]=!0);t=s!==!1&&qt(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},ci=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;const n=t.indexOf(e,s);return n!==-1&&n===s},li=t=>{if(!t)return null;if(ct(t))return t;let e=t.length;if(!Nn(e))return null;const s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},hi=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&qt(Uint8Array)),fi=(t,e)=>{const n=(t&&t[Bt]).call(t);let r;for(;(r=n.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},di=(t,e)=>{let s;const n=[];for(;(s=t.exec(e))!==null;)n.push(s);return n},pi=re("HTMLFormElement"),yi=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,n,r){return n.toUpperCase()+r}),ps=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),mi=re("RegExp"),Mn=(t,e)=>{const s=Object.getOwnPropertyDescriptors(t),n={};Ct(s,(r,i)=>{let o;(o=e(r,i,t))!==!1&&(n[i]=o||r)}),Object.defineProperties(t,n)},bi=t=>{Mn(t,(e,s)=>{if(X(t)&&["arguments","caller","callee"].includes(s))return!1;const n=t[s];if(X(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},gi=(t,e)=>{const s={},n=r=>{r.forEach(i=>{s[i]=!0})};return ct(t)?n(t):n(String(t).split(e)),s},wi=()=>{},Ri=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Ei(t){return!!(t&&X(t.append)&&t[Fn]==="FormData"&&t[Bt])}const Si=t=>{const e=new Array(10),s=(n,r)=>{if(vt(n)){if(e.indexOf(n)>=0)return;if(Ot(n))return n;if(!("toJSON"in n)){e[r]=n;const i=ct(n)?[]:{};return Ct(n,(o,u)=>{const h=s(o,r+1);!at(h)&&(i[u]=h)}),e[r]=void 0,i}}return n};return s(t,0)},Oi=re("AsyncFunction"),vi=t=>t&&(vt(t)||X(t))&&X(t.then)&&X(t.catch),In=((t,e)=>t?setImmediate:e?((s,n)=>(Ne.addEventListener("message",({source:r,data:i})=>{r===Ne&&i===s&&n.length&&n.shift()()},!1),r=>{n.push(r),Ne.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",X(Ne.postMessage)),Ci=typeof queueMicrotask<"u"?queueMicrotask.bind(Ne):typeof process<"u"&&process.nextTick||In,Pi=t=>t!=null&&X(t[Bt]),c={isArray:ct,isArrayBuffer:Dn,isBuffer:Ot,isFormData:Zr,isArrayBufferView:qr,isString:Br,isNumber:Nn,isBoolean:Qr,isObject:vt,isPlainObject:Ut,isEmptyObject:Hr,isReadableStream:ei,isRequest:ti,isResponse:si,isHeaders:ni,isUndefined:at,isDate:Kr,isFile:zr,isReactNativeBlob:$r,isReactNative:Jr,isBlob:Vr,isRegExp:mi,isFunction:X,isStream:Gr,isURLSearchParams:Yr,isTypedArray:hi,isFileList:Wr,forEach:Ct,merge:ds,extend:ii,trim:ri,stripBOM:oi,inherits:ai,toFlatObject:ui,kindOf:Qt,kindOfTest:re,endsWith:ci,toArray:li,forEachEntry:fi,matchAll:di,isHTMLForm:pi,hasOwnProperty:ps,hasOwnProp:ps,reduceDescriptors:Mn,freezeMethods:bi,toObjectSet:gi,toCamelCase:yi,noop:wi,toFiniteNumber:Ri,findKey:Un,global:Ne,isContextDefined:Ln,isSpecCompliantForm:Ei,toJSONObject:Si,isAsyncFn:Oi,isThenable:vi,setImmediate:In,asap:Ci,isIterable:Pi},Ti=c.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"]),Ai=t=>{const e={};let s,n,r;return t&&t.split(`
|
|
10
|
+
`).forEach(function(o){r=o.indexOf(":"),s=o.substring(0,r).trim().toLowerCase(),n=o.substring(r+1).trim(),!(!s||e[s]&&Ti[s])&&(s==="set-cookie"?e[s]?e[s].push(n):e[s]=[n]:e[s]=e[s]?e[s]+", "+n:n)}),e},Js=Symbol("internals"),xi=/[^\x09\x20-\x7E\x80-\xFF]/g;function _i(t){let e=0,s=t.length;for(;e<s;){const n=t.charCodeAt(e);if(n!==9&&n!==32)break;e+=1}for(;s>e;){const n=t.charCodeAt(s-1);if(n!==9&&n!==32)break;s-=1}return e===0&&s===t.length?t:t.slice(e,s)}function pt(t){return t&&String(t).trim().toLowerCase()}function Fi(t){return _i(t.replace(xi,""))}function Lt(t){return t===!1||t==null?t:c.isArray(t)?t.map(Lt):Fi(String(t))}function Di(t){const e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=s.exec(t);)e[n[1]]=n[2];return e}const Ni=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Wt(t,e,s,n,r){if(c.isFunction(n))return n.call(this,e,s);if(r&&(e=s),!!c.isString(e)){if(c.isString(n))return e.indexOf(n)!==-1;if(c.isRegExp(n))return n.test(e)}}function Ui(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,n)=>s.toUpperCase()+n)}function Li(t,e){const s=c.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+s,{__proto__:null,value:function(r,i,o){return this[n].call(this,e,r,i,o)},configurable:!0})})}let J=class{constructor(e){e&&this.set(e)}set(e,s,n){const r=this;function i(u,h,f){const l=pt(h);if(!l)throw new Error("header name must be a non-empty string");const p=c.findKey(r,l);(!p||r[p]===void 0||f===!0||f===void 0&&r[p]!==!1)&&(r[p||h]=Lt(u))}const o=(u,h)=>c.forEach(u,(f,l)=>i(f,l,h));if(c.isPlainObject(e)||e instanceof this.constructor)o(e,s);else if(c.isString(e)&&(e=e.trim())&&!Ni(e))o(Ai(e),s);else if(c.isObject(e)&&c.isIterable(e)){let u={},h,f;for(const l of e){if(!c.isArray(l))throw TypeError("Object iterator must return a key-value pair");u[f=l[0]]=(h=u[f])?c.isArray(h)?[...h,l[1]]:[h,l[1]]:l[1]}o(u,s)}else e!=null&&i(s,e,n);return this}get(e,s){if(e=pt(e),e){const n=c.findKey(this,e);if(n){const r=this[n];if(!s)return r;if(s===!0)return Di(r);if(c.isFunction(s))return s.call(this,r,n);if(c.isRegExp(s))return s.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=pt(e),e){const n=c.findKey(this,e);return!!(n&&this[n]!==void 0&&(!s||Wt(this,this[n],n,s)))}return!1}delete(e,s){const n=this;let r=!1;function i(o){if(o=pt(o),o){const u=c.findKey(n,o);u&&(!s||Wt(n,n[u],u,s))&&(delete n[u],r=!0)}}return c.isArray(e)?e.forEach(i):i(e),r}clear(e){const s=Object.keys(this);let n=s.length,r=!1;for(;n--;){const i=s[n];(!e||Wt(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const s=this,n={};return c.forEach(this,(r,i)=>{const o=c.findKey(n,i);if(o){s[o]=Lt(r),delete s[i];return}const u=e?Ui(i):String(i).trim();u!==i&&delete s[i],s[u]=Lt(r),n[u]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const s=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(s[r]=e&&c.isArray(n)?n.join(", "):n)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
|
|
11
|
+
`)}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,...s){const n=new this(e);return s.forEach(r=>n.set(r)),n}static accessor(e){const n=(this[Js]=this[Js]={accessors:{}}).accessors,r=this.prototype;function i(o){const u=pt(o);n[u]||(Li(r,o),n[u]=!0)}return c.isArray(e)?e.forEach(i):i(e),this}};J.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);c.reduceDescriptors(J.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(n){this[s]=n}}});c.freezeMethods(J);const Mi="[REDACTED ****]";function Ii(t){if(c.hasOwnProp(t,"toJSON"))return!0;let e=Object.getPrototypeOf(t);for(;e&&e!==Object.prototype;){if(c.hasOwnProp(e,"toJSON"))return!0;e=Object.getPrototypeOf(e)}return!1}function ji(t,e){const s=new Set(e.map(i=>String(i).toLowerCase())),n=[],r=i=>{if(i===null||typeof i!="object"||c.isBuffer(i))return i;if(n.indexOf(i)!==-1)return;i instanceof J&&(i=i.toJSON()),n.push(i);let o;if(c.isArray(i))o=[],i.forEach((u,h)=>{const f=r(u);c.isUndefined(f)||(o[h]=f)});else{if(!c.isPlainObject(i)&&Ii(i))return n.pop(),i;o=Object.create(null);for(const[u,h]of Object.entries(i)){const f=s.has(u.toLowerCase())?Mi:r(h);c.isUndefined(f)||(o[u]=f)}}return n.pop(),o};return r(t)}let E=class jn extends Error{static from(e,s,n,r,i,o){const u=new jn(e.message,s||e.code,n,r,i);return u.cause=e,u.name=e.name,e.status!=null&&u.status==null&&(u.status=e.status),o&&Object.assign(u,o),u}constructor(e,s,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,s&&(this.code=s),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,s=e&&c.hasOwnProp(e,"redact")?e.redact:void 0,n=c.isArray(s)&&s.length>0?ji(e,s):c.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}}};E.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";E.ERR_BAD_OPTION="ERR_BAD_OPTION";E.ECONNABORTED="ECONNABORTED";E.ETIMEDOUT="ETIMEDOUT";E.ECONNREFUSED="ECONNREFUSED";E.ERR_NETWORK="ERR_NETWORK";E.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";E.ERR_DEPRECATED="ERR_DEPRECATED";E.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";E.ERR_BAD_REQUEST="ERR_BAD_REQUEST";E.ERR_CANCELED="ERR_CANCELED";E.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";E.ERR_INVALID_URL="ERR_INVALID_URL";E.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ki=null;function ys(t){return c.isPlainObject(t)||c.isArray(t)}function kn(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function Gt(t,e,s){return t?t.concat(e).map(function(r,i){return r=kn(r),!s&&i?"["+r+"]":r}).join(s?".":""):e}function qi(t){return c.isArray(t)&&!t.some(ys)}const Bi=c.toFlatObject(c,{},null,function(e){return/^is[A-Z]/.test(e)});function Kt(t,e,s){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,s=c.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,b){return!c.isUndefined(b[d])});const n=s.metaTokens,r=s.visitor||p,i=s.dots,o=s.indexes,u=s.Blob||typeof Blob<"u"&&Blob,h=s.maxDepth===void 0?100:s.maxDepth,f=u&&c.isSpecCompliantForm(e);if(!c.isFunction(r))throw new TypeError("visitor must be a function");function l(y){if(y===null)return"";if(c.isDate(y))return y.toISOString();if(c.isBoolean(y))return y.toString();if(!f&&c.isBlob(y))throw new E("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(y)||c.isTypedArray(y)?f&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function p(y,d,b){let C=y;if(c.isReactNative(e)&&c.isReactNativeBlob(y))return e.append(Gt(b,d,i),l(y)),!1;if(y&&!b&&typeof y=="object"){if(c.endsWith(d,"{}"))d=n?d:d.slice(0,-2),y=JSON.stringify(y);else if(c.isArray(y)&&qi(y)||(c.isFileList(y)||c.endsWith(d,"[]"))&&(C=c.toArray(y)))return d=kn(d),C.forEach(function(g,A){!(c.isUndefined(g)||g===null)&&e.append(o===!0?Gt([d],A,i):o===null?d:d+"[]",l(g))}),!1}return ys(y)?!0:(e.append(Gt(b,d,i),l(y)),!1)}const R=[],m=Object.assign(Bi,{defaultVisitor:p,convertValue:l,isVisitable:ys});function S(y,d,b=0){if(!c.isUndefined(y)){if(b>h)throw new E("Object is too deeply nested ("+b+" levels). Max depth: "+h,E.ERR_FORM_DATA_DEPTH_EXCEEDED);if(R.indexOf(y)!==-1)throw Error("Circular reference detected in "+d.join("."));R.push(y),c.forEach(y,function(v,g){(!(c.isUndefined(v)||v===null)&&r.call(e,v,c.isString(g)?g.trim():g,d,m))===!0&&S(v,d?d.concat(g):[g],b+1)}),R.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return S(t),e}function Vs(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(t).replace(/[!'()~]|%20/g,function(n){return e[n]})}function vs(t,e){this._pairs=[],t&&Kt(t,this,e)}const qn=vs.prototype;qn.append=function(e,s){this._pairs.push([e,s])};qn.toString=function(e){const s=e?function(n){return e.call(this,n,Vs)}:Vs;return this._pairs.map(function(r){return s(r[0])+"="+s(r[1])},"").join("&")};function Qi(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Bn(t,e,s){if(!e)return t;const n=s&&s.encode||Qi,r=c.isFunction(s)?{serialize:s}:s,i=r&&r.serialize;let o;if(i?o=i(e,r):o=c.isURLSearchParams(e)?e.toString():new vs(e,r).toString(n),o){const u=t.indexOf("#");u!==-1&&(t=t.slice(0,u)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class Ws{constructor(){this.handlers=[]}use(e,s,n){return this.handlers.push({fulfilled:e,rejected:s,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&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Cs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Hi=typeof URLSearchParams<"u"?URLSearchParams:vs,Ki=typeof FormData<"u"?FormData:null,zi=typeof Blob<"u"?Blob:null,$i={isBrowser:!0,classes:{URLSearchParams:Hi,FormData:Ki,Blob:zi},protocols:["http","https","file","blob","url","data"]},Ps=typeof window<"u"&&typeof document<"u",ms=typeof navigator=="object"&&navigator||void 0,Ji=Ps&&(!ms||["ReactNative","NativeScript","NS"].indexOf(ms.product)<0),Vi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Wi=Ps&&window.location.href||"http://localhost",Gi=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ps,hasStandardBrowserEnv:Ji,hasStandardBrowserWebWorkerEnv:Vi,navigator:ms,origin:Wi},Symbol.toStringTag,{value:"Module"})),H={...Gi,...$i};function Xi(t,e){return Kt(t,new H.classes.URLSearchParams,{visitor:function(s,n,r,i){return H.isNode&&c.isBuffer(s)?(this.append(n,s.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function Zi(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Yi(t){const e={},s=Object.keys(t);let n;const r=s.length;let i;for(n=0;n<r;n++)i=s[n],e[i]=t[i];return e}function Qn(t){function e(s,n,r,i){let o=s[i++];if(o==="__proto__")return!0;const u=Number.isFinite(+o),h=i>=s.length;return o=!o&&c.isArray(r)?r.length:o,h?(c.hasOwnProp(r,o)?r[o]=c.isArray(r[o])?r[o].concat(n):[r[o],n]:r[o]=n,!u):((!r[o]||!c.isObject(r[o]))&&(r[o]=[]),e(s,n,r[o],i)&&c.isArray(r[o])&&(r[o]=Yi(r[o])),!u)}if(c.isFormData(t)&&c.isFunction(t.entries)){const s={};return c.forEachEntry(t,(n,r)=>{e(Zi(n),r,s,0)}),s}return null}const Je=(t,e)=>t!=null&&c.hasOwnProp(t,e)?t[e]:void 0;function eo(t,e,s){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(s||JSON.stringify)(t)}const Pt={transitional:Cs,adapter:["xhr","http","fetch"],transformRequest:[function(e,s){const n=s.getContentType()||"",r=n.indexOf("application/json")>-1,i=c.isObject(e);if(i&&c.isHTMLForm(e)&&(e=new FormData(e)),c.isFormData(e))return r?JSON.stringify(Qn(e)):e;if(c.isArrayBuffer(e)||c.isBuffer(e)||c.isStream(e)||c.isFile(e)||c.isBlob(e)||c.isReadableStream(e))return e;if(c.isArrayBufferView(e))return e.buffer;if(c.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let u;if(i){const h=Je(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return Xi(e,h).toString();if((u=c.isFileList(e))||n.indexOf("multipart/form-data")>-1){const f=Je(this,"env"),l=f&&f.FormData;return Kt(u?{"files[]":e}:e,l&&new l,h)}}return i||r?(s.setContentType("application/json",!1),eo(e)):e}],transformResponse:[function(e){const s=Je(this,"transitional")||Pt.transitional,n=s&&s.forcedJSONParsing,r=Je(this,"responseType"),i=r==="json";if(c.isResponse(e)||c.isReadableStream(e))return e;if(e&&c.isString(e)&&(n&&!r||i)){const u=!(s&&s.silentJSONParsing)&&i;try{return JSON.parse(e,Je(this,"parseReviver"))}catch(h){if(u)throw h.name==="SyntaxError"?E.from(h,E.ERR_BAD_RESPONSE,this,null,Je(this,"response")):h}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:H.classes.FormData,Blob:H.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch","query"],t=>{Pt.headers[t]={}});function Xt(t,e){const s=this||Pt,n=e||s,r=J.from(n.headers);let i=n.data;return c.forEach(t,function(u){i=u.call(s,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Hn(t){return!!(t&&t.__CANCEL__)}let Tt=class extends E{constructor(e,s,n){super(e??"canceled",E.ERR_CANCELED,s,n),this.name="CanceledError",this.__CANCEL__=!0}};function Kn(t,e,s){const n=s.config.validateStatus;!s.status||!n||n(s.status)?t(s):e(new E("Request failed with status code "+s.status,s.status>=400&&s.status<500?E.ERR_BAD_REQUEST:E.ERR_BAD_RESPONSE,s.config,s.request,s))}function to(t){const e=/^([-+\w]{1,25}):(?:\/\/)?/.exec(t);return e&&e[1]||""}function so(t,e){t=t||10;const s=new Array(t),n=new Array(t);let r=0,i=0,o;return e=e!==void 0?e:1e3,function(h){const f=Date.now(),l=n[i];o||(o=f),s[r]=h,n[r]=f;let p=i,R=0;for(;p!==r;)R+=s[p++],p=p%t;if(r=(r+1)%t,r===i&&(i=(i+1)%t),f-o<e)return;const m=l&&f-l;return m?Math.round(R*1e3/m):void 0}}function no(t,e){let s=0,n=1e3/e,r,i;const o=(f,l=Date.now())=>{s=l,r=null,i&&(clearTimeout(i),i=null),t(...f)};return[(...f)=>{const l=Date.now(),p=l-s;p>=n?o(f,l):(r=f,i||(i=setTimeout(()=>{i=null,o(r)},n-p)))},()=>r&&o(r)]}const kt=(t,e,s=3)=>{let n=0;const r=so(50,250);return no(i=>{const o=i.loaded,u=i.lengthComputable?i.total:void 0,h=u!=null?Math.min(o,u):o,f=Math.max(0,h-n),l=r(f);n=Math.max(n,h);const p={loaded:h,total:u,progress:u?h/u:void 0,bytes:f,rate:l||void 0,estimated:l&&u?(u-h)/l:void 0,event:i,lengthComputable:u!=null,[e?"download":"upload"]:!0};t(p)},s)},Gs=(t,e)=>{const s=t!=null;return[n=>e[0]({lengthComputable:s,total:t,loaded:n}),e[1]]},Xs=t=>(...e)=>c.asap(()=>t(...e)),ro=H.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,H.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(H.origin),H.navigator&&/(msie|trident)/i.test(H.navigator.userAgent)):()=>!0,io=H.hasStandardBrowserEnv?{write(t,e,s,n,r,i,o){if(typeof document>"u")return;const u=[`${t}=${encodeURIComponent(e)}`];c.isNumber(s)&&u.push(`expires=${new Date(s).toUTCString()}`),c.isString(n)&&u.push(`path=${n}`),c.isString(r)&&u.push(`domain=${r}`),i===!0&&u.push("secure"),c.isString(o)&&u.push(`SameSite=${o}`),document.cookie=u.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.split(";");for(let s=0;s<e.length;s++){const n=e[s].replace(/^\s+/,""),r=n.indexOf("=");if(r!==-1&&n.slice(0,r)===t)return decodeURIComponent(n.slice(r+1))}return null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function oo(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function ao(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function zn(t,e,s){let n=!oo(e);return t&&(n||s===!1)?ao(t,e):e}const Zs=t=>t instanceof J?{...t}:t;function ze(t,e){e=e||{};const s=Object.create(null);Object.defineProperty(s,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function n(f,l,p,R){return c.isPlainObject(f)&&c.isPlainObject(l)?c.merge.call({caseless:R},f,l):c.isPlainObject(l)?c.merge({},l):c.isArray(l)?l.slice():l}function r(f,l,p,R){if(c.isUndefined(l)){if(!c.isUndefined(f))return n(void 0,f,p,R)}else return n(f,l,p,R)}function i(f,l){if(!c.isUndefined(l))return n(void 0,l)}function o(f,l){if(c.isUndefined(l)){if(!c.isUndefined(f))return n(void 0,f)}else return n(void 0,l)}function u(f,l,p){if(c.hasOwnProp(e,p))return n(f,l);if(c.hasOwnProp(t,p))return n(void 0,f)}const h={url:i,method:i,data:i,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:u,headers:(f,l,p)=>r(Zs(f),Zs(l),p,!0)};return c.forEach(Object.keys({...t,...e}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const p=c.hasOwnProp(h,l)?h[l]:r,R=c.hasOwnProp(t,l)?t[l]:void 0,m=c.hasOwnProp(e,l)?e[l]:void 0,S=p(R,m,l);c.isUndefined(S)&&p!==u||(s[l]=S)}),s}const uo=["content-type","content-length"];function co(t,e,s){if(s!=="content-only"){t.set(e);return}Object.entries(e).forEach(([n,r])=>{uo.includes(n.toLowerCase())&&t.set(n,r)})}const lo=t=>encodeURIComponent(t).replace(/%([0-9A-F]{2})/gi,(e,s)=>String.fromCharCode(parseInt(s,16))),$n=t=>{const e=ze({},t),s=R=>c.hasOwnProp(e,R)?e[R]:void 0,n=s("data");let r=s("withXSRFToken");const i=s("xsrfHeaderName"),o=s("xsrfCookieName");let u=s("headers");const h=s("auth"),f=s("baseURL"),l=s("allowAbsoluteUrls"),p=s("url");if(e.headers=u=J.from(u),e.url=Bn(zn(f,p,l),t.params,t.paramsSerializer),h&&u.set("Authorization","Basic "+btoa((h.username||"")+":"+(h.password?lo(h.password):""))),c.isFormData(n)&&(H.hasStandardBrowserEnv||H.hasStandardBrowserWebWorkerEnv?u.setContentType(void 0):c.isFunction(n.getHeaders)&&co(u,n.getHeaders(),s("formDataHeaderPolicy"))),H.hasStandardBrowserEnv&&(c.isFunction(r)&&(r=r(e)),r===!0||r==null&&ro(e.url))){const m=i&&o&&io.read(o);m&&u.set(i,m)}return e},ho=typeof XMLHttpRequest<"u",fo=ho&&function(t){return new Promise(function(s,n){const r=$n(t);let i=r.data;const o=J.from(r.headers).normalize();let{responseType:u,onUploadProgress:h,onDownloadProgress:f}=r,l,p,R,m,S;function y(){m&&m(),S&&S(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let d=new XMLHttpRequest;d.open(r.method.toUpperCase(),r.url,!0),d.timeout=r.timeout;function b(){if(!d)return;const v=J.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),A={data:!u||u==="text"||u==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:v,config:t,request:d};Kn(function(V){s(V),y()},function(V){n(V),y()},A),d=null}"onloadend"in d?d.onloadend=b:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.startsWith("file:"))||setTimeout(b)},d.onabort=function(){d&&(n(new E("Request aborted",E.ECONNABORTED,t,d)),y(),d=null)},d.onerror=function(g){const A=g&&g.message?g.message:"Network Error",N=new E(A,E.ERR_NETWORK,t,d);N.event=g||null,n(N),y(),d=null},d.ontimeout=function(){let g=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const A=r.transitional||Cs;r.timeoutErrorMessage&&(g=r.timeoutErrorMessage),n(new E(g,A.clarifyTimeoutError?E.ETIMEDOUT:E.ECONNABORTED,t,d)),y(),d=null},i===void 0&&o.setContentType(null),"setRequestHeader"in d&&c.forEach(o.toJSON(),function(g,A){d.setRequestHeader(A,g)}),c.isUndefined(r.withCredentials)||(d.withCredentials=!!r.withCredentials),u&&u!=="json"&&(d.responseType=r.responseType),f&&([R,S]=kt(f,!0),d.addEventListener("progress",R)),h&&d.upload&&([p,m]=kt(h),d.upload.addEventListener("progress",p),d.upload.addEventListener("loadend",m)),(r.cancelToken||r.signal)&&(l=v=>{d&&(n(!v||v.type?new Tt(null,t,d):v),d.abort(),y(),d=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const C=to(r.url);if(C&&!H.protocols.includes(C)){n(new E("Unsupported protocol "+C+":",E.ERR_BAD_REQUEST,t));return}d.send(i||null)})},po=(t,e)=>{const{length:s}=t=t?t.filter(Boolean):[];if(e||s){let n=new AbortController,r;const i=function(f){if(!r){r=!0,u();const l=f instanceof Error?f:this.reason;n.abort(l instanceof E?l:new Tt(l instanceof Error?l.message:l))}};let o=e&&setTimeout(()=>{o=null,i(new E(`timeout of ${e}ms exceeded`,E.ETIMEDOUT))},e);const u=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(f=>{f.unsubscribe?f.unsubscribe(i):f.removeEventListener("abort",i)}),t=null)};t.forEach(f=>f.addEventListener("abort",i));const{signal:h}=n;return h.unsubscribe=()=>c.asap(u),h}},yo=function*(t,e){let s=t.byteLength;if(s<e){yield t;return}let n=0,r;for(;n<s;)r=n+e,yield t.slice(n,r),n=r},mo=async function*(t,e){for await(const s of bo(t))yield*yo(s,e)},bo=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:s,value:n}=await e.read();if(s)break;yield n}}finally{await e.cancel()}},Ys=(t,e,s,n)=>{const r=mo(t,e);let i=0,o,u=h=>{o||(o=!0,n&&n(h))};return new ReadableStream({async pull(h){try{const{done:f,value:l}=await r.next();if(f){u(),h.close();return}let p=l.byteLength;if(s){let R=i+=p;s(R)}h.enqueue(new Uint8Array(l))}catch(f){throw u(f),f}},cancel(h){return u(h),r.return()}},{highWaterMark:2})};function go(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;const e=t.indexOf(",");if(e<0)return 0;const s=t.slice(5,e),n=t.slice(e+1);if(/;base64/i.test(s)){let o=n.length;const u=n.length;for(let m=0;m<u;m++)if(n.charCodeAt(m)===37&&m+2<u){const S=n.charCodeAt(m+1),y=n.charCodeAt(m+2);(S>=48&&S<=57||S>=65&&S<=70||S>=97&&S<=102)&&(y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102)&&(o-=2,m+=2)}let h=0,f=u-1;const l=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);f>=0&&(n.charCodeAt(f)===61?(h++,f--):l(f)&&(h++,f-=3)),h===1&&f>=0&&(n.charCodeAt(f)===61||l(f))&&h++;const R=Math.floor(o/4)*3-(h||0);return R>0?R:0}if(typeof Buffer<"u"&&typeof Buffer.byteLength=="function")return Buffer.byteLength(n,"utf8");let i=0;for(let o=0,u=n.length;o<u;o++){const h=n.charCodeAt(o);if(h<128)i+=1;else if(h<2048)i+=2;else if(h>=55296&&h<=56319&&o+1<u){const f=n.charCodeAt(o+1);f>=56320&&f<=57343?(i+=4,o++):i+=3}else i+=3}return i}const Ts="1.16.0",en=64*1024,{isFunction:Dt}=c,tn=(t,...e)=>{try{return!!t(...e)}catch{return!1}},wo=t=>{const e=c.global??globalThis,{ReadableStream:s,TextEncoder:n}=e;t=c.merge.call({skipUndefined:!0},{Request:e.Request,Response:e.Response},t);const{fetch:r,Request:i,Response:o}=t,u=r?Dt(r):typeof fetch=="function",h=Dt(i),f=Dt(o);if(!u)return!1;const l=u&&Dt(s),p=u&&(typeof n=="function"?(b=>C=>b.encode(C))(new n):async b=>new Uint8Array(await new i(b).arrayBuffer())),R=h&&l&&tn(()=>{let b=!1;const C=new i(H.origin,{body:new s,method:"POST",get duplex(){return b=!0,"half"}}),v=C.headers.has("Content-Type");return C.body!=null&&C.body.cancel(),b&&!v}),m=f&&l&&tn(()=>c.isReadableStream(new o("").body)),S={stream:m&&(b=>b.body)};u&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!S[b]&&(S[b]=(C,v)=>{let g=C&&C[b];if(g)return g.call(C);throw new E(`Response type '${b}' is not supported`,E.ERR_NOT_SUPPORT,v)})});const y=async b=>{if(b==null)return 0;if(c.isBlob(b))return b.size;if(c.isSpecCompliantForm(b))return(await new i(H.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(c.isArrayBufferView(b)||c.isArrayBuffer(b))return b.byteLength;if(c.isURLSearchParams(b)&&(b=b+""),c.isString(b))return(await p(b)).byteLength},d=async(b,C)=>{const v=c.toFiniteNumber(b.getContentLength());return v??y(C)};return async b=>{let{url:C,method:v,data:g,signal:A,cancelToken:N,timeout:V,onDownloadProgress:x,onUploadProgress:L,responseType:D,headers:q,withCredentials:ce="same-origin",fetchOptions:lt,maxContentLength:K,maxBodyLength:be}=$n(b);const ht=c.isNumber(K)&&K>-1,Xn=c.isNumber(be)&&be>-1;let xs=r||fetch;D=D?(D+"").toLowerCase():"text";let ge=po([A,N&&N.toAbortSignal()],V),ee=null;const Fe=ge&&ge.unsubscribe&&(()=>{ge.unsubscribe()});let _s;try{if(ht&&typeof C=="string"&&C.startsWith("data:")&&go(C)>K)throw new E("maxContentLength size of "+K+" exceeded",E.ERR_BAD_RESPONSE,b,ee);if(Xn&&v!=="get"&&v!=="head"){const F=await d(q,g);if(typeof F=="number"&&isFinite(F)&&F>be)throw new E("Request body larger than maxBodyLength limit",E.ERR_BAD_REQUEST,b,ee)}if(L&&R&&v!=="get"&&v!=="head"&&(_s=await d(q,g))!==0){let F=new i(C,{method:"POST",body:g,duplex:"half"}),$e;if(c.isFormData(g)&&($e=F.headers.get("content-type"))&&q.setContentType($e),F.body){const[At,xt]=Gs(_s,kt(Xs(L)));g=Ys(F.body,en,At,xt)}}c.isString(ce)||(ce=ce?"include":"omit");const B=h&&"credentials"in i.prototype;if(c.isFormData(g)){const F=q.getContentType();F&&/^multipart\/form-data/i.test(F)&&!/boundary=/i.test(F)&&q.delete("content-type")}q.set("User-Agent","axios/"+Ts,!1);const we={...lt,signal:ge,method:v.toUpperCase(),headers:q.normalize().toJSON(),body:g,duplex:"half",credentials:B?ce:void 0};ee=h&&new i(C,we);let ie=await(h?xs(ee,lt):xs(C,we));if(ht){const F=c.toFiniteNumber(ie.headers.get("content-length"));if(F!=null&&F>K)throw new E("maxContentLength size of "+K+" exceeded",E.ERR_BAD_RESPONSE,b,ee)}const $t=m&&(D==="stream"||D==="response");if(m&&ie.body&&(x||ht||$t&&Fe)){const F={};["status","statusText","headers"].forEach(ft=>{F[ft]=ie[ft]});const $e=c.toFiniteNumber(ie.headers.get("content-length")),[At,xt]=x&&Gs($e,kt(Xs(x),!0))||[];let Fs=0;const Zn=ft=>{if(ht&&(Fs=ft,Fs>K))throw new E("maxContentLength size of "+K+" exceeded",E.ERR_BAD_RESPONSE,b,ee);At&&At(ft)};ie=new o(Ys(ie.body,en,Zn,()=>{xt&&xt(),Fe&&Fe()}),F)}D=D||"text";let le=await S[c.findKey(S,D)||"text"](ie,b);if(ht&&!m&&!$t){let F;if(le!=null&&(typeof le.byteLength=="number"?F=le.byteLength:typeof le.size=="number"?F=le.size:typeof le=="string"&&(F=typeof n=="function"?new n().encode(le).byteLength:le.length)),typeof F=="number"&&F>K)throw new E("maxContentLength size of "+K+" exceeded",E.ERR_BAD_RESPONSE,b,ee)}return!$t&&Fe&&Fe(),await new Promise((F,$e)=>{Kn(F,$e,{data:le,headers:J.from(ie.headers),status:ie.status,statusText:ie.statusText,config:b,request:ee})})}catch(B){if(Fe&&Fe(),ge&&ge.aborted&&ge.reason instanceof E){const we=ge.reason;throw we.config=b,ee&&(we.request=ee),B!==we&&(we.cause=B),we}throw B&&B.name==="TypeError"&&/Load failed|fetch/i.test(B.message)?Object.assign(new E("Network Error",E.ERR_NETWORK,b,ee,B&&B.response),{cause:B.cause||B}):E.from(B,B&&B.code,b,ee,B&&B.response)}}},Ro=new Map,Jn=t=>{let e=t&&t.env||{};const{fetch:s,Request:n,Response:r}=e,i=[n,r,s];let o=i.length,u=o,h,f,l=Ro;for(;u--;)h=i[u],f=l.get(h),f===void 0&&l.set(h,f=u?new Map:wo(e)),l=f;return f};Jn();const As={http:ki,xhr:fo,fetch:{get:Jn}};c.forEach(As,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{__proto__:null,value:e})}catch{}Object.defineProperty(t,"adapterName",{__proto__:null,value:e})}});const sn=t=>`- ${t}`,Eo=t=>c.isFunction(t)||t===null||t===!1;function So(t,e){t=c.isArray(t)?t:[t];const{length:s}=t;let n,r;const i={};for(let o=0;o<s;o++){n=t[o];let u;if(r=n,!Eo(n)&&(r=As[(u=String(n)).toLowerCase()],r===void 0))throw new E(`Unknown adapter '${u}'`);if(r&&(c.isFunction(r)||(r=r.get(e))))break;i[u||"#"+o]=r}if(!r){const o=Object.entries(i).map(([h,f])=>`adapter ${h} `+(f===!1?"is not supported by the environment":"is not available in the build"));let u=s?o.length>1?`since :
|
|
12
|
+
`+o.map(sn).join(`
|
|
13
|
+
`):" "+sn(o[0]):"as no adapter specified";throw new E("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return r}const Vn={getAdapter:So,adapters:As};function Zt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Tt(null,t)}function nn(t){return Zt(t),t.headers=J.from(t.headers),t.data=Xt.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Vn.getAdapter(t.adapter||Pt.adapter,t)(t).then(function(n){Zt(t),t.response=n;try{n.data=Xt.call(t,t.transformResponse,n)}finally{delete t.response}return n.headers=J.from(n.headers),n},function(n){if(!Hn(n)&&(Zt(t),n&&n.response)){t.response=n.response;try{n.response.data=Xt.call(t,t.transformResponse,n.response)}finally{delete t.response}n.response.headers=J.from(n.response.headers)}return Promise.reject(n)})}const zt={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{zt[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const rn={};zt.transitional=function(e,s,n){function r(i,o){return"[Axios v"+Ts+"] Transitional option '"+i+"'"+o+(n?". "+n:"")}return(i,o,u)=>{if(e===!1)throw new E(r(o," has been removed"+(s?" in "+s:"")),E.ERR_DEPRECATED);return s&&!rn[o]&&(rn[o]=!0,console.warn(r(o," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(i,o,u):!0}};zt.spelling=function(e){return(s,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};function Oo(t,e,s){if(typeof t!="object")throw new E("options must be an object",E.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let r=n.length;for(;r-- >0;){const i=n[r],o=Object.prototype.hasOwnProperty.call(e,i)?e[i]:void 0;if(o){const u=t[i],h=u===void 0||o(u,i,t);if(h!==!0)throw new E("option "+i+" must be "+h,E.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new E("Unknown option "+i,E.ERR_BAD_OPTION)}}const Mt={assertOptions:Oo,validators:zt},te=Mt.validators;let He=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ws,response:new Ws}}async request(e,s){try{return await this._request(e,s)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=(()=>{if(!r.stack)return"";const o=r.stack.indexOf(`
|
|
14
|
+
`);return o===-1?"":r.stack.slice(o+1)})();try{if(!n.stack)n.stack=i;else if(i){const o=i.indexOf(`
|
|
15
|
+
`),u=o===-1?-1:i.indexOf(`
|
|
16
|
+
`,o+1),h=u===-1?"":i.slice(u+1);String(n.stack).endsWith(h)||(n.stack+=`
|
|
17
|
+
`+i)}}catch{}}throw n}}_request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=ze(this.defaults,s);const{transitional:n,paramsSerializer:r,headers:i}=s;n!==void 0&&Mt.assertOptions(n,{silentJSONParsing:te.transitional(te.boolean),forcedJSONParsing:te.transitional(te.boolean),clarifyTimeoutError:te.transitional(te.boolean),legacyInterceptorReqResOrdering:te.transitional(te.boolean)},!1),r!=null&&(c.isFunction(r)?s.paramsSerializer={serialize:r}:Mt.assertOptions(r,{encode:te.function,serialize:te.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),Mt.assertOptions(s,{baseUrl:te.spelling("baseURL"),withXsrfToken:te.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let o=i&&c.merge(i.common,i[s.method]);i&&c.forEach(["delete","get","head","post","put","patch","query","common"],S=>{delete i[S]}),s.headers=J.concat(o,i);const u=[];let h=!0;this.interceptors.request.forEach(function(y){if(typeof y.runWhen=="function"&&y.runWhen(s)===!1)return;h=h&&y.synchronous;const d=s.transitional||Cs;d&&d.legacyInterceptorReqResOrdering?u.unshift(y.fulfilled,y.rejected):u.push(y.fulfilled,y.rejected)});const f=[];this.interceptors.response.forEach(function(y){f.push(y.fulfilled,y.rejected)});let l,p=0,R;if(!h){const S=[nn.bind(this),void 0];for(S.unshift(...u),S.push(...f),R=S.length,l=Promise.resolve(s);p<R;)l=l.then(S[p++],S[p++]);return l}R=u.length;let m=s;for(;p<R;){const S=u[p++],y=u[p++];try{m=S(m)}catch(d){y.call(this,d);break}}try{l=nn.call(this,m)}catch(S){return Promise.reject(S)}for(p=0,R=f.length;p<R;)l=l.then(f[p++],f[p++]);return l}getUri(e){e=ze(this.defaults,e);const s=zn(e.baseURL,e.url,e.allowAbsoluteUrls);return Bn(s,e.params,e.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(e){He.prototype[e]=function(s,n){return this.request(ze(n||{},{method:e,url:s,data:(n||{}).data}))}});c.forEach(["post","put","patch","query"],function(e){function s(n){return function(i,o,u){return this.request(ze(u||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}He.prototype[e]=s(),e!=="query"&&(He.prototype[e+"Form"]=s(!0))});let vo=class Wn{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(i){s=i});const n=this;this.promise.then(r=>{if(!n._listeners)return;let i=n._listeners.length;for(;i-- >0;)n._listeners[i](r);n._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(u=>{n.subscribe(u),i=u}).then(r);return o.cancel=function(){n.unsubscribe(i)},o},e(function(i,o,u){n.reason||(n.reason=new Tt(i,o,u),s(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;const s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const e=new AbortController,s=n=>{e.abort(n)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new Wn(function(r){e=r}),cancel:e}}};function Co(t){return function(s){return t.apply(null,s)}}function Po(t){return c.isObject(t)&&t.isAxiosError===!0}const bs={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(bs).forEach(([t,e])=>{bs[e]=t});function Gn(t){const e=new He(t),s=_n(He.prototype.request,e);return c.extend(s,He.prototype,e,{allOwnKeys:!0}),c.extend(s,e,null,{allOwnKeys:!0}),s.create=function(r){return Gn(ze(t,r))},s}const M=Gn(Pt);M.Axios=He;M.CanceledError=Tt;M.CancelToken=vo;M.isCancel=Hn;M.VERSION=Ts;M.toFormData=Kt;M.AxiosError=E;M.Cancel=M.CanceledError;M.all=function(e){return Promise.all(e)};M.spread=Co;M.isAxiosError=Po;M.mergeConfig=ze;M.AxiosHeaders=J;M.formToJSON=t=>Qn(c.isHTMLForm(t)?new FormData(t):t);M.getAdapter=Vn.getAdapter;M.HttpStatusCode=bs;M.default=M;const{Axios:Mo,AxiosError:Io,CanceledError:jo,isCancel:ko,CancelToken:qo,VERSION:Bo,all:Qo,Cancel:Ho,isAxiosError:Ko,spread:zo,toFormData:$o,AxiosHeaders:Jo,HttpStatusCode:Vo,formToJSON:Wo,getAdapter:Go,mergeConfig:Xo,create:Zo}=M;export{xo as Q,M as a,Fo as b,Do as c,_o as d,sr as j,An as u};
|