var At=e=>{throw TypeError(e)};var Pt=(e,t,s)=>t.has(e)||At("Cannot "+s);var i=(e,t,s)=>(Pt(e,t,"read from private field"),s?s.call(e):t.get(e)),l=(e,t,s)=>t.has(e)?At("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),o=(e,t,s,r)=>(Pt(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),C=(e,t,s)=>(Pt(e,t,"access private method"),s);var mt=(e,t,s,r)=>({set _(n){o(e,t,n,s)},get _(){return i(e,t,r)}});import{r as ne,a as Zt}from"./icons-B6XnNDpJ.js";var Ot={exports:{}},ct={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var xt;function ae(){if(xt)return ct;xt=1;var e=ne(),t=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function d(u,c,P){var f,m={},p=null,b=null;P!==void 0&&(p=""+P),c.key!==void 0&&(p=""+c.key),c.ref!==void 0&&(b=c.ref);for(f in c)r.call(c,f)&&!a.hasOwnProperty(f)&&(m[f]=c[f]);if(u&&u.defaultProps)for(f in c=u.defaultProps,c)m[f]===void 0&&(m[f]=c[f]);return{$$typeof:t,type:u,key:p,ref:b,props:m,_owner:n.current}}return ct.Fragment=s,ct.jsx=d,ct.jsxs=d,ct}var Tt;function ue(){return Tt||(Tt=1,Ot.exports=ae()),Ot.exports}var oe=ue(),bt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},he={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},G,Mt,Gt,ce=(Gt=class{constructor(){l(this,G,he);l(this,Mt,!1)}setTimeoutProvider(e){o(this,G,e)}setTimeout(e,t){return i(this,G).setTimeout(e,t)}clearTimeout(e){i(this,G).clearTimeout(e)}setInterval(e,t){return i(this,G).setInterval(e,t)}clearInterval(e){i(this,G).clearInterval(e)}},G=new WeakMap,Mt=new WeakMap,Gt),St=new ce;function le(e){setTimeout(e,0)}var wt=typeof window>"u"||"Deno"in globalThis;function T(){}function de(e,t){return typeof e=="function"?e(t):e}function fe(e){return typeof e=="number"&&e>=0&&e!==1/0}function ye(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ft(e,t){return typeof e=="function"?e(t):e}function pe(e,t){return typeof e=="function"?e(t):e}function jt(e,t){const{type:s="all",exact:r,fetchStatus:n,predicate:a,queryKey:d,stale:u}=e;if(d){if(r){if(t.queryHash!==Qt(d,t.options))return!1}else if(!dt(t.queryKey,d))return!1}if(s!=="all"){const c=t.isActive();if(s==="active"&&!c||s==="inactive"&&c)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||n&&n!==t.state.fetchStatus||a&&!a(t))}function It(e,t){const{exact:s,status:r,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(s){if(lt(t.options.mutationKey)!==lt(a))return!1}else if(!dt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||n&&!n(t))}function Qt(e,t){return((t==null?void 0:t.queryKeyHashFn)||lt)(e)}function lt(e){return JSON.stringify(e,(t,s)=>Ct(s)?Object.keys(s).sort().reduce((r,n)=>(r[n]=s[n],r),{}):s)}function dt(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>dt(e[s],t[s])):!1}var me=Object.prototype.hasOwnProperty;function Xt(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=Ut(e)&&Ut(t);if(!r&&!(Ct(e)&&Ct(t)))return t;const a=(r?e:Object.keys(e)).length,d=r?t:Object.keys(t),u=d.length,c=r?new Array(u):{};let P=0;for(let f=0;f<u;f++){const m=r?f:d[f],p=e[m],b=t[m];if(p===b){c[m]=p,(r?f<a:me.call(e,m))&&P++;continue}if(p===null||b===null||typeof p!="object"||typeof b!="object"){c[m]=b;continue}const M=Xt(p,b,s+1);c[m]=M,M===p&&P++}return a===u&&P===a?e:c}function Ut(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ct(e){if(!Kt(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!Kt(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Kt(e){return Object.prototype.toString.call(e)==="[object Object]"}function ve(e){return new Promise(t=>{St.setTimeout(t,e)})}function ge(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?Xt(e,t):t}function be(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function we(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var qt=Symbol();function te(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===qt?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pe(e,t,s){let r=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??(n=t()),r||(r=!0,n.aborted?s():n.addEventListener("abort",s,{once:!0})),n)}),e}var W,N,st,Nt,Oe=(Nt=class extends bt{constructor(){super();l(this,W);l(this,N);l(this,st);o(this,st,t=>{if(!wt&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,N)||this.setEventListener(i(this,st))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,N))==null||t.call(this),o(this,N,void 0))}setEventListener(t){var s;o(this,st,t),(s=i(this,N))==null||s.call(this),o(this,N,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,W)!==t&&(o(this,W,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof i(this,W)=="boolean"?i(this,W):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},W=new WeakMap,N=new WeakMap,st=new WeakMap,Nt),ee=new Oe;function Se(){let e,t;const s=new Promise((n,a)=>{e=n,t=a});s.status="pending",s.catch(()=>{});function r(n){Object.assign(s,n),delete s.resolve,delete s.reject}return s.resolve=n=>{r({status:"fulfilled",value:n}),e(n)},s.reject=n=>{r({status:"rejected",reason:n}),t(n)},s}var Fe=le;function Ce(){let e=[],t=0,s=u=>{u()},r=u=>{u()},n=Fe;const a=u=>{t?e.push(u):n(()=>{s(u)})},d=()=>{const u=e;e=[],u.length&&n(()=>{r(()=>{u.forEach(c=>{s(c)})})})};return{batch:u=>{let c;t++;try{c=u()}finally{t--,t||d()}return c},batchCalls:u=>(...c)=>{a(()=>{u(...c)})},schedule:a,setNotifyFunction:u=>{s=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{n=u}}}var E=Ce(),rt,B,it,Bt,Re=(Bt=class extends bt{constructor(){super();l(this,rt,!0);l(this,B);l(this,it);o(this,it,t=>{if(!wt&&window.addEventListener){const s=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){i(this,B)||this.setEventListener(i(this,it))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,B))==null||t.call(this),o(this,B,void 0))}setEventListener(t){var s;o(this,it,t),(s=i(this,B))==null||s.call(this),o(this,B,t(this.setOnline.bind(this)))}setOnline(t){i(this,rt)!==t&&(o(this,rt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,rt)}},rt=new WeakMap,B=new WeakMap,it=new WeakMap,Bt),gt=new Re;function Me(e){return Math.min(1e3*2**e,3e4)}function se(e){return(e??"online")==="online"?gt.isOnline():!0}var Rt=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function re(e){let t=!1,s=0,r;const n=Se(),a=()=>n.status!=="pending",d=y=>{var O;if(!a()){const w=new Rt(y);p(w),(O=e.onCancel)==null||O.call(e,w)}},u=()=>{t=!0},c=()=>{t=!1},P=()=>ee.isFocused()&&(e.networkMode==="always"||gt.isOnline())&&e.canRun(),f=()=>se(e.networkMode)&&e.canRun(),m=y=>{a()||(r==null||r(),n.resolve(y))},p=y=>{a()||(r==null||r(),n.reject(y))},b=()=>new Promise(y=>{var O;r=w=>{(a()||P())&&y(w)},(O=e.onPause)==null||O.call(e)}).then(()=>{var y;r=void 0,a()||(y=e.onContinue)==null||y.call(e)}),M=()=>{if(a())return;let y;const O=s===0?e.initialPromise:void 0;try{y=O??e.fn()}catch(w){y=Promise.reject(w)}Promise.resolve(y).then(m).catch(w=>{var x;if(a())return;const D=e.retry??(wt?0:3),g=e.retryDelay??Me,h=typeof g=="function"?g(s,w):g,Q=D===!0||typeof D=="number"&&s<D||typeof D=="function"&&D(s,w);if(t||!Q){p(w);return}s++,(x=e.onFail)==null||x.call(e,s,w),ve(h).then(()=>P()?void 0:b()).then(()=>{t?p(w):M()})})};return{promise:n,status:()=>n.status,cancel:d,continue:()=>(r==null||r(),n),cancelRetry:u,continueRetry:c,canStart:f,start:()=>(f()?M():b().then(M),n)}}var Y,Jt,ie=(Jt=class{constructor(){l(this,Y)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fe(this.gcTime)&&o(this,Y,St.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wt?1/0:300*1e3))}clearGcTimeout(){i(this,Y)&&(St.clearTimeout(i(this,Y)),o(this,Y,void 0))}},Y=new WeakMap,Jt),Z,nt,A,X,S,ft,tt,j,k,$t,Qe=($t=class extends ie{constructor(t){super();l(this,j);l(this,Z);l(this,nt);l(this,A);l(this,X);l(this,S);l(this,ft);l(this,tt);o(this,tt,!1),o(this,ft,t.defaultOptions),this.setOptions(t.options),this.observers=[],o(this,X,t.client),o(this,A,i(this,X).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,o(this,Z,kt(this.options)),this.state=t.state??i(this,Z),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=i(this,S))==null?void 0:t.promise}setOptions(t){if(this.options={...i(this,ft),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=kt(this.options);s.data!==void 0&&(this.setState(_t(s.data,s.dataUpdatedAt)),o(this,Z,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,A).remove(this)}setData(t,s){const r=ge(this.state.data,t,this.options);return C(this,j,k).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t,s){C(this,j,k).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var r,n;const s=(r=i(this,S))==null?void 0:r.promise;return(n=i(this,S))==null||n.cancel(t),s?s.then(T).catch(T):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(i(this,Z))}isActive(){return this.observers.some(t=>pe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===qt||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ft(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!ye(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,S))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,S))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),i(this,A).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(i(this,S)&&(i(this,tt)?i(this,S).cancel({revert:!0}):i(this,S).cancelRetry()),this.scheduleGc()),i(this,A).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||C(this,j,k).call(this,{type:"invalidate"})}async fetch(t,s){var c,P,f,m,p,b,M,y,O,w,D,g;if(this.state.fetchStatus!=="idle"&&((c=i(this,S))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(i(this,S))return i(this,S).continueRetry(),i(this,S).promise}if(t&&this.setOptions(t),!this.options.queryFn){const h=this.observers.find(Q=>Q.options.queryFn);h&&this.setOptions(h.options)}const r=new AbortController,n=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(o(this,tt,!0),r.signal)})},a=()=>{const h=te(this.options,s),x=(()=>{const V={client:i(this,X),queryKey:this.queryKey,meta:this.meta};return n(V),V})();return o(this,tt,!1),this.options.persister?this.options.persister(h,x,this):h(x)},u=(()=>{const h={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:i(this,X),state:this.state,fetchFn:a};return n(h),h})();(P=this.options.behavior)==null||P.onFetch(u,this),o(this,nt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=u.fetchOptions)==null?void 0:f.meta))&&C(this,j,k).call(this,{type:"fetch",meta:(m=u.fetchOptions)==null?void 0:m.meta}),o(this,S,re({initialPromise:s==null?void 0:s.initialPromise,fn:u.fetchFn,onCancel:h=>{h instanceof Rt&&h.revert&&this.setState({...i(this,nt),fetchStatus:"idle"}),r.abort()},onFail:(h,Q)=>{C(this,j,k).call(this,{type:"failed",failureCount:h,error:Q})},onPause:()=>{C(this,j,k).call(this,{type:"pause"})},onContinue:()=>{C(this,j,k).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const h=await i(this,S).start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),(b=(p=i(this,A).config).onSuccess)==null||b.call(p,h,this),(y=(M=i(this,A).config).onSettled)==null||y.call(M,h,this.state.error,this),h}catch(h){if(h instanceof Rt){if(h.silent)return i(this,S).promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw C(this,j,k).call(this,{type:"error",error:h}),(w=(O=i(this,A).config).onError)==null||w.call(O,h,this),(g=(D=i(this,A).config).onSettled)==null||g.call(D,this.state.data,h,this),h}finally{this.scheduleGc()}}},Z=new WeakMap,nt=new WeakMap,A=new WeakMap,X=new WeakMap,S=new WeakMap,ft=new WeakMap,tt=new WeakMap,j=new WeakSet,k=function(t){const s=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...qe(r.data,this.options),fetchMeta:t.meta??null};case"success":const n={...r,..._t(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return o(this,nt,t.manual?n:void 0),n;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),E.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,A).notify({query:this,type:"updated",action:t})})},$t);function qe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:se(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function _t(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function kt(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,r=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}function Lt(e){return{onFetch:(t,s)=>{var f,m,p,b,M;const r=t.options,n=(p=(m=(f=t.fetchOptions)==null?void 0:f.meta)==null?void 0:m.fetchMore)==null?void 0:p.direction,a=((b=t.state.data)==null?void 0:b.pages)||[],d=((M=t.state.data)==null?void 0:M.pageParams)||[];let u={pages:[],pageParams:[]},c=0;const P=async()=>{let y=!1;const O=g=>{Pe(g,()=>t.signal,()=>y=!0)},w=te(t.options,t.fetchOptions),D=async(g,h,Q)=>{if(y)return Promise.reject();if(h==null&&g.pages.length)return Promise.resolve(g);const V=(()=>{const Dt={client:t.client,queryKey:t.queryKey,pageParam:h,direction:Q?"backward":"forward",meta:t.options.meta};return O(Dt),Dt})(),F=await w(V),{maxPages:q}=t.options,Et=Q?we:be;return{pages:Et(g.pages,F,q),pageParams:Et(g.pageParams,h,q)}};if(n&&a.length){const g=n==="backward",h=g?Ee:Ht,Q={pages:a,pageParams:d},x=h(r,Q);u=await D(Q,x,g)}else{const g=e??a.length;do{const h=c===0?d[0]??r.initialPageParam:Ht(r,u);if(c>0&&h==null)break;u=await D(u,h),c++}while(c<g)}return u};t.options.persister?t.fetchFn=()=>{var y,O;return(O=(y=t.options).persister)==null?void 0:O.call(y,P,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=P}}}function Ht(e,{pages:t,pageParams:s}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}function Ee(e,{pages:t,pageParams:s}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,s[0],s):void 0}var yt,U,R,et,K,H,zt,De=(zt=class extends ie{constructor(t){super();l(this,K);l(this,yt);l(this,U);l(this,R);l(this,et);o(this,yt,t.client),this.mutationId=t.mutationId,o(this,R,t.mutationCache),o(this,U,[]),this.state=t.state||Ae(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){i(this,U).includes(t)||(i(this,U).push(t),this.clearGcTimeout(),i(this,R).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){o(this,U,i(this,U).filter(s=>s!==t)),this.scheduleGc(),i(this,R).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){i(this,U).length||(this.state.status==="pending"?this.scheduleGc():i(this,R).remove(this))}continue(){var t;return((t=i(this,et))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var d,u,c,P,f,m,p,b,M,y,O,w,D,g,h,Q,x,V;const s=()=>{C(this,K,H).call(this,{type:"continue"})},r={client:i(this,yt),meta:this.options.meta,mutationKey:this.options.mutationKey};o(this,et,re({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,q)=>{C(this,K,H).call(this,{type:"failed",failureCount:F,error:q})},onPause:()=>{C(this,K,H).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,R).canRun(this)}));const n=this.state.status==="pending",a=!i(this,et).canStart();try{if(n)s();else{C(this,K,H).call(this,{type:"pending",variables:t,isPaused:a}),i(this,R).config.onMutate&&await i(this,R).config.onMutate(t,this,r);const q=await((u=(d=this.options).onMutate)==null?void 0:u.call(d,t,r));q!==this.state.context&&C(this,K,H).call(this,{type:"pending",context:q,variables:t,isPaused:a})}const F=await i(this,et).start();return await((P=(c=i(this,R).config).onSuccess)==null?void 0:P.call(c,F,t,this.state.context,this,r)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,F,t,this.state.context,r)),await((b=(p=i(this,R).config).onSettled)==null?void 0:b.call(p,F,null,this.state.variables,this.state.context,this,r)),await((y=(M=this.options).onSettled)==null?void 0:y.call(M,F,null,t,this.state.context,r)),C(this,K,H).call(this,{type:"success",data:F}),F}catch(F){try{await((w=(O=i(this,R).config).onError)==null?void 0:w.call(O,F,t,this.state.context,this,r))}catch(q){Promise.reject(q)}try{await((g=(D=this.options).onError)==null?void 0:g.call(D,F,t,this.state.context,r))}catch(q){Promise.reject(q)}try{await((Q=(h=i(this,R).config).onSettled)==null?void 0:Q.call(h,void 0,F,this.state.variables,this.state.context,this,r))}catch(q){Promise.reject(q)}try{await((V=(x=this.options).onSettled)==null?void 0:V.call(x,void 0,F,t,this.state.context,r))}catch(q){Promise.reject(q)}throw C(this,K,H).call(this,{type:"error",error:F}),F}finally{i(this,R).runNext(this)}}},yt=new WeakMap,U=new WeakMap,R=new WeakMap,et=new WeakMap,K=new WeakSet,H=function(t){const s=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),E.batch(()=>{i(this,U).forEach(r=>{r.onMutationUpdate(t)}),i(this,R).notify({mutation:this,type:"updated",action:t})})},zt);function Ae(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var L,I,pt,Vt,xe=(Vt=class extends bt{constructor(t={}){super();l(this,L);l(this,I);l(this,pt);this.config=t,o(this,L,new Set),o(this,I,new Map),o(this,pt,0)}build(t,s,r){const n=new De({client:t,mutationCache:this,mutationId:++mt(this,pt)._,options:t.defaultMutationOptions(s),state:r});return this.add(n),n}add(t){i(this,L).add(t);const s=vt(t);if(typeof s=="string"){const r=i(this,I).get(s);r?r.push(t):i(this,I).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(i(this,L).delete(t)){const s=vt(t);if(typeof s=="string"){const r=i(this,I).get(s);if(r)if(r.length>1){const n=r.indexOf(t);n!==-1&&r.splice(n,1)}else r[0]===t&&i(this,I).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=vt(t);if(typeof s=="string"){const r=i(this,I).get(s),n=r==null?void 0:r.find(a=>a.state.status==="pending");return!n||n===t}else return!0}runNext(t){var r;const s=vt(t);if(typeof s=="string"){const n=(r=i(this,I).get(s))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){E.batch(()=>{i(this,L).forEach(t=>{this.notify({type:"removed",mutation:t})}),i(this,L).clear(),i(this,I).clear()})}getAll(){return Array.from(i(this,L))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>It(s,r))}findAll(t={}){return this.getAll().filter(s=>It(t,s))}notify(t){E.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return E.batch(()=>Promise.all(t.map(s=>s.continue().catch(T))))}},L=new WeakMap,I=new WeakMap,pt=new WeakMap,Vt);function vt(e){var t;return(t=e.options.scope)==null?void 0:t.id}var _,Wt,Te=(Wt=class extends bt{constructor(t={}){super();l(this,_);this.config=t,o(this,_,new Map)}build(t,s,r){const n=s.queryKey,a=s.queryHash??Qt(n,s);let d=this.get(a);return d||(d=new Qe({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(d)),d}add(t){i(this,_).has(t.queryHash)||(i(this,_).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=i(this,_).get(t.queryHash);s&&(t.destroy(),s===t&&i(this,_).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){E.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return i(this,_).get(t)}getAll(){return[...i(this,_).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>jt(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>jt(t,r)):s}notify(t){E.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){E.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){E.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},_=new WeakMap,Wt),v,J,$,at,ut,z,ot,ht,Yt,Ke=(Yt=class{constructor(e={}){l(this,v);l(this,J);l(this,$);l(this,at);l(this,ut);l(this,z);l(this,ot);l(this,ht);o(this,v,e.queryCache||new Te),o(this,J,e.mutationCache||new xe),o(this,$,e.defaultOptions||{}),o(this,at,new Map),o(this,ut,new Map),o(this,z,0)}mount(){mt(this,z)._++,i(this,z)===1&&(o(this,ot,ee.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,v).onFocus())})),o(this,ht,gt.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,v).onOnline())})))}unmount(){var e,t;mt(this,z)._--,i(this,z)===0&&((e=i(this,ot))==null||e.call(this),o(this,ot,void 0),(t=i(this,ht))==null||t.call(this),o(this,ht,void 0))}isFetching(e){return i(this,v).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return i(this,J).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,v).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=i(this,v).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Ft(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return i(this,v).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),n=i(this,v).get(r.queryHash),a=n==null?void 0:n.state.data,d=de(t,a);if(d!==void 0)return i(this,v).build(this,r).setData(d,{...s,manual:!0})}setQueriesData(e,t,s){return E.batch(()=>i(this,v).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,v).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=i(this,v);E.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=i(this,v);return E.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=E.batch(()=>i(this,v).findAll(e).map(n=>n.cancel(s)));return Promise.all(r).then(T).catch(T)}invalidateQueries(e,t={}){return E.batch(()=>(i(this,v).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},r=E.batch(()=>i(this,v).findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,s);return s.throwOnError||(a=a.catch(T)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(T)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=i(this,v).build(this,t);return s.isStaleByTime(Ft(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(T).catch(T)}fetchInfiniteQuery(e){return e.behavior=Lt(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(T).catch(T)}ensureInfiniteQueryData(e){return e.behavior=Lt(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gt.isOnline()?i(this,J).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,v)}getMutationCache(){return i(this,J)}getDefaultOptions(){return i(this,$)}setDefaultOptions(e){o(this,$,e)}setQueryDefaults(e,t){i(this,at).set(lt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...i(this,at).values()],s={};return t.forEach(r=>{dt(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){i(this,ut).set(lt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...i(this,ut).values()],s={};return t.forEach(r=>{dt(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...i(this,$).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qt(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===qt&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...i(this,$).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){i(this,v).clear(),i(this,J).clear()}},v=new WeakMap,J=new WeakMap,$=new WeakMap,at=new WeakMap,ut=new WeakMap,z=new WeakMap,ot=new WeakMap,ht=new WeakMap,Yt),je=Zt.createContext(void 0),_e=({client:e,children:t})=>(Zt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),oe.jsx(je.Provider,{value:e,children:t}));export{Ke as Q,_e as a,oe as j};