var qe=e=>{throw TypeError(e)};var pe=(e,t,s)=>t.has(e)||qe("Cannot "+s);var i=(e,t,s)=>(pe(e,t,"read from private field"),s?s.call(e):t.get(e)),f=(e,t,s)=>t.has(e)?qe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),c=(e,t,s,r)=>(pe(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),E=(e,t,s)=>(pe(e,t,"access private method"),s);var ce=(e,t,s,r)=>({set _(a){c(e,t,a,s)},get _(){return i(e,t,r)}});function Ms(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const u=Object.getOwnPropertyDescriptor(r,a);u&&Object.defineProperty(e,a,u.get?u:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Fs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ye={exports:{}},Xt={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ne;function xs(){if(Ne)return Xt;Ne=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,a,u){var l=null;if(u!==void 0&&(l=""+u),a.key!==void 0&&(l=""+a.key),"key"in a){u={};for(var h in a)h!=="key"&&(u[h]=a[h])}else u=a;return a=u.ref,{$$typeof:e,type:r,key:l,ref:a!==void 0?a:null,props:u}}return Xt.Fragment=t,Xt.jsx=s,Xt.jsxs=s,Xt}var He;function As(){return He||(He=1,ye.exports=xs()),ye.exports}var Is=As(),ve={exports:{}},g={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Le;function Qs(){if(Le)return g;Le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),l=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),F=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),C=Symbol.iterator;function y(n){return n===null||typeof n!="object"?null:(n=C&&n[C]||n["@@iterator"],typeof n=="function"?n:null)}var Q={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},P=Object.assign,_={};function S(n,o,R){this.props=n,this.context=o,this.refs=_,this.updater=R||Q}S.prototype.isReactComponent={},S.prototype.setState=function(n,o){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,o,"setState")},S.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function D(){}D.prototype=S.prototype;function x(n,o,R){this.props=n,this.context=o,this.refs=_,this.updater=R||Q}var d=x.prototype=new D;d.constructor=x,P(d,S.prototype),d.isPureReactComponent=!0;var q=Array.isArray;function L(){}var O={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function U(n,o,R){var b=R.ref;return{$$typeof:e,type:n,key:o,ref:b!==void 0?b:null,props:R}}function $(n,o){return U(n.type,o,n.props)}function X(n){return typeof n=="object"&&n!==null&&n.$$typeof===e}function jt(n){var o={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(R){return o[R]})}var Vt=/\/+/g;function ft(n,o){return typeof n=="object"&&n!==null&&n.key!=null?jt(""+n.key):o.toString(36)}function Dt(n){switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:switch(typeof n.status=="string"?n.then(L,L):(n.status="pending",n.then(function(o){n.status==="pending"&&(n.status="fulfilled",n.value=o)},function(o){n.status==="pending"&&(n.status="rejected",n.reason=o)})),n.status){case"fulfilled":return n.value;case"rejected":throw n.reason}}throw n}function Ut(n,o,R,b,T){var I=typeof n;(I==="undefined"||I==="boolean")&&(n=null);var j=!1;if(n===null)j=!0;else switch(I){case"bigint":case"string":case"number":j=!0;break;case"object":switch(n.$$typeof){case e:case t:j=!0;break;case m:return j=n._init,Ut(j(n._payload),o,R,b,T)}}if(j)return T=T(n),j=b===""?"."+ft(n,0):b,q(T)?(R="",j!=null&&(R=j.replace(Vt,"$&/")+"/"),Ut(T,o,R,"",function(Ts){return Ts})):T!=null&&(X(T)&&(T=$(T,R+(T.key==null||n&&n.key===T.key?"":(""+T.key).replace(Vt,"$&/")+"/")+j)),o.push(T)),1;j=0;var st=b===""?".":b+":";if(q(n))for(var z=0;z<n.length;z++)b=n[z],I=st+ft(b,z),j+=Ut(b,o,R,I,T);else if(z=y(n),typeof z=="function")for(n=z.call(n),z=0;!(b=n.next()).done;)b=b.value,I=st+ft(b,z++),j+=Ut(b,o,R,I,T);else if(I==="object"){if(typeof n.then=="function")return Ut(Dt(n),o,R,b,T);throw o=String(n),Error("Objects are not valid as a React child (found: "+(o==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":o)+"). If you meant to render a collection of children, use an array instead.")}return j}function oe(n,o,R){if(n==null)return n;var b=[],T=0;return Ut(n,b,"","",function(I){return o.call(R,I,T++)}),b}function Os(n){if(n._status===-1){var o=n._result;o=o(),o.then(function(R){(n._status===0||n._status===-1)&&(n._status=1,n._result=R)},function(R){(n._status===0||n._status===-1)&&(n._status=2,n._result=R)}),n._status===-1&&(n._status=0,n._result=o)}if(n._status===1)return n._result.default;throw n._result}var ke=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},_s={map:oe,forEach:function(n,o,R){oe(n,function(){o.apply(this,arguments)},R)},count:function(n){var o=0;return oe(n,function(){o++}),o},toArray:function(n){return oe(n,function(o){return o})||[]},only:function(n){if(!X(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};return g.Activity=p,g.Children=_s,g.Component=S,g.Fragment=s,g.Profiler=a,g.PureComponent=x,g.StrictMode=r,g.Suspense=v,g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,g.__COMPILER_RUNTIME={__proto__:null,c:function(n){return O.H.useMemoCache(n)}},g.cache=function(n){return function(){return n.apply(null,arguments)}},g.cacheSignal=function(){return null},g.cloneElement=function(n,o,R){if(n==null)throw Error("The argument must be a React element, but you passed "+n+".");var b=P({},n.props),T=n.key;if(o!=null)for(I in o.key!==void 0&&(T=""+o.key),o)!A.call(o,I)||I==="key"||I==="__self"||I==="__source"||I==="ref"&&o.ref===void 0||(b[I]=o[I]);var I=arguments.length-2;if(I===1)b.children=R;else if(1<I){for(var j=Array(I),st=0;st<I;st++)j[st]=arguments[st+2];b.children=j}return U(n.type,T,b)},g.createContext=function(n){return n={$$typeof:l,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null},n.Provider=n,n.Consumer={$$typeof:u,_context:n},n},g.createElement=function(n,o,R){var b,T={},I=null;if(o!=null)for(b in o.key!==void 0&&(I=""+o.key),o)A.call(o,b)&&b!=="key"&&b!=="__self"&&b!=="__source"&&(T[b]=o[b]);var j=arguments.length-2;if(j===1)T.children=R;else if(1<j){for(var st=Array(j),z=0;z<j;z++)st[z]=arguments[z+2];T.children=st}if(n&&n.defaultProps)for(b in j=n.defaultProps,j)T[b]===void 0&&(T[b]=j[b]);return U(n,I,T)},g.createRef=function(){return{current:null}},g.forwardRef=function(n){return{$$typeof:h,render:n}},g.isValidElement=X,g.lazy=function(n){return{$$typeof:m,_payload:{_status:-1,_result:n},_init:Os}},g.memo=function(n,o){return{$$typeof:F,type:n,compare:o===void 0?null:o}},g.startTransition=function(n){var o=O.T,R={};O.T=R;try{var b=n(),T=O.S;T!==null&&T(R,b),typeof b=="object"&&b!==null&&typeof b.then=="function"&&b.then(L,ke)}catch(I){ke(I)}finally{o!==null&&R.types!==null&&(o.types=R.types),O.T=o}},g.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},g.use=function(n){return O.H.use(n)},g.useActionState=function(n,o,R){return O.H.useActionState(n,o,R)},g.useCallback=function(n,o){return O.H.useCallback(n,o)},g.useContext=function(n){return O.H.useContext(n)},g.useDebugValue=function(){},g.useDeferredValue=function(n,o){return O.H.useDeferredValue(n,o)},g.useEffect=function(n,o){return O.H.useEffect(n,o)},g.useEffectEvent=function(n){return O.H.useEffectEvent(n)},g.useId=function(){return O.H.useId()},g.useImperativeHandle=function(n,o,R){return O.H.useImperativeHandle(n,o,R)},g.useInsertionEffect=function(n,o){return O.H.useInsertionEffect(n,o)},g.useLayoutEffect=function(n,o){return O.H.useLayoutEffect(n,o)},g.useMemo=function(n,o){return O.H.useMemo(n,o)},g.useOptimistic=function(n,o){return O.H.useOptimistic(n,o)},g.useReducer=function(n,o,R){return O.H.useReducer(n,o,R)},g.useRef=function(n){return O.H.useRef(n)},g.useState=function(n){return O.H.useState(n)},g.useSyncExternalStore=function(n,o,R){return O.H.useSyncExternalStore(n,o,R)},g.useTransition=function(){return O.H.useTransition()},g.version="19.2.7",g}var Ke;function js(){return Ke||(Ke=1,ve.exports=Qs()),ve.exports}var H=js();const Ds=Fs(H),Rr=Ms({__proto__:null,default:Ds},[H]);var Zt=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(){}},wt,pt,kt,Xe,Us=(Xe=class extends Zt{constructor(){super();f(this,wt);f(this,pt);f(this,kt);c(this,kt,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){i(this,pt)||this.setEventListener(i(this,kt))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,pt))==null||t.call(this),c(this,pt,void 0))}setEventListener(t){var s;c(this,kt,t),(s=i(this,pt))==null||s.call(this),c(this,pt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){i(this,wt)!==t&&(c(this,wt,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof i(this,wt)=="boolean"?i(this,wt):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},wt=new WeakMap,pt=new WeakMap,kt=new WeakMap,Xe),Ie=new Us,ks={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt,Ae,ts,qs=(ts=class{constructor(){f(this,yt,ks);f(this,Ae,!1)}setTimeoutProvider(e){c(this,yt,e)}setTimeout(e,t){return i(this,yt).setTimeout(e,t)}clearTimeout(e){i(this,yt).clearTimeout(e)}setInterval(e,t){return i(this,yt).setInterval(e,t)}clearInterval(e){i(this,yt).clearInterval(e)}},yt=new WeakMap,Ae=new WeakMap,ts),St=new qs;function Ns(e){setTimeout(e,0)}var Hs=typeof window>"u"||"Deno"in globalThis;function B(){}function Ls(e,t){return typeof e=="function"?e(t):e}function me(e){return typeof e=="number"&&e>=0&&e!==1/0}function hs(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ct(e,t){return typeof e=="function"?e(t):e}function V(e,t){return typeof e=="function"?e(t):e}function $e(e,t){const{type:s="all",exact:r,fetchStatus:a,predicate:u,queryKey:l,stale:h}=e;if(l){if(r){if(t.queryHash!==Qe(l,t.options))return!1}else if(!ee(t.queryKey,l))return!1}if(s!=="all"){const v=t.isActive();if(s==="active"&&!v||s==="inactive"&&v)return!1}return!(typeof h=="boolean"&&t.isStale()!==h||a&&a!==t.state.fetchStatus||u&&!u(t))}function Ge(e,t){const{exact:s,status:r,predicate:a,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(s){if(Qt(t.options.mutationKey)!==Qt(u))return!1}else if(!ee(t.options.mutationKey,u))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Qe(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qt)(e)}function Qt(e){return JSON.stringify(e,(t,s)=>ge(s)?Object.keys(s).sort().reduce((r,a)=>(r[a]=s[a],r),{}):s)}function ee(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>ee(e[s],t[s])):!1}var Ks=Object.prototype.hasOwnProperty;function ls(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=Ye(e)&&Ye(t);if(!r&&!(ge(e)&&ge(t)))return t;const u=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),h=l.length,v=r?new Array(h):{};let F=0;for(let m=0;m<h;m++){const p=r?m:l[m],C=e[p],y=t[p];if(C===y){v[p]=C,(r?m<u:Ks.call(e,p))&&F++;continue}if(C===null||y===null||typeof C!="object"||typeof y!="object"){v[p]=y;continue}const Q=ls(C,y,s+1);v[p]=Q,Q===C&&F++}return u===h&&F===u?e:v}function fe(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function Ye(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ge(e){if(!Be(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!Be(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Be(e){return Object.prototype.toString.call(e)==="[object Object]"}function $s(e){return new Promise(t=>{St.setTimeout(t,e)})}function be(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?ls(e,t):t}function Gs(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function Ys(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var je=Symbol();function fs(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===je?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function De(e,t){return typeof e=="function"?e(...t):!!e}function Bs(e,t,s){let r=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),r||(r=!0,a.aborted?s():a.addEventListener("abort",s,{once:!0})),a)}),e}var se=(()=>{let e=()=>Hs;return{isServer(){return e()},setIsServer(t){e=t}}})();function Re(){let e,t;const s=new Promise((a,u)=>{e=a,t=u});s.status="pending",s.catch(()=>{});function r(a){Object.assign(s,a),delete s.resolve,delete s.reject}return s.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},s.reject=a=>{r({status:"rejected",reason:a}),t(a)},s}var zs=Ns;function Js(){let e=[],t=0,s=h=>{h()},r=h=>{h()},a=zs;const u=h=>{t?e.push(h):a(()=>{s(h)})},l=()=>{const h=e;e=[],h.length&&a(()=>{r(()=>{h.forEach(v=>{s(v)})})})};return{batch:h=>{let v;t++;try{v=h()}finally{t--,t||l()}return v},batchCalls:h=>(...v)=>{u(()=>{h(...v)})},schedule:u,setNotifyFunction:h=>{s=h},setBatchNotifyFunction:h=>{r=h},setScheduler:h=>{a=h}}}var N=Js(),qt,vt,Nt,es,Ws=(es=class extends Zt{constructor(){super();f(this,qt,!0);f(this,vt);f(this,Nt);c(this,Nt,t=>{if(typeof window<"u"&&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,vt)||this.setEventListener(i(this,Nt))}onUnsubscribe(){var t;this.hasListeners()||((t=i(this,vt))==null||t.call(this),c(this,vt,void 0))}setEventListener(t){var s;c(this,Nt,t),(s=i(this,vt))==null||s.call(this),c(this,vt,t(this.setOnline.bind(this)))}setOnline(t){i(this,qt)!==t&&(c(this,qt,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return i(this,qt)}},qt=new WeakMap,vt=new WeakMap,Nt=new WeakMap,es),de=new Ws;function Zs(e){return Math.min(1e3*2**e,3e4)}function ds(e){return(e??"online")==="online"?de.isOnline():!0}var Ee=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ps(e){let t=!1,s=0,r;const a=Re(),u=()=>a.status!=="pending",l=P=>{var _;if(!u()){const S=new Ee(P);C(S),(_=e.onCancel)==null||_.call(e,S)}},h=()=>{t=!0},v=()=>{t=!1},F=()=>Ie.isFocused()&&(e.networkMode==="always"||de.isOnline())&&e.canRun(),m=()=>ds(e.networkMode)&&e.canRun(),p=P=>{u()||(r==null||r(),a.resolve(P))},C=P=>{u()||(r==null||r(),a.reject(P))},y=()=>new Promise(P=>{var _;r=S=>{(u()||F())&&P(S)},(_=e.onPause)==null||_.call(e)}).then(()=>{var P;r=void 0,u()||(P=e.onContinue)==null||P.call(e)}),Q=()=>{if(u())return;let P;const _=s===0?e.initialPromise:void 0;try{P=_??e.fn()}catch(S){P=Promise.reject(S)}Promise.resolve(P).then(p).catch(S=>{var L;if(u())return;const D=e.retry??(se.isServer()?0:3),x=e.retryDelay??Zs,d=typeof x=="function"?x(s,S):x,q=D===!0||typeof D=="number"&&s<D||typeof D=="function"&&D(s,S);if(t||!q){C(S);return}s++,(L=e.onFail)==null||L.call(e,s,S),$s(d).then(()=>F()?void 0:y()).then(()=>{t?C(S):Q()})})};return{promise:a,status:()=>a.status,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:h,continueRetry:v,canStart:m,start:()=>(m()?Q():y().then(Q),a)}}var Ot,ss,ys=(ss=class{constructor(){f(this,Ot)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),me(this.gcTime)&&c(this,Ot,St.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(se.isServer()?1/0:300*1e3))}clearGcTimeout(){i(this,Ot)!==void 0&&(St.clearTimeout(i(this,Ot)),c(this,Ot,void 0))}},Ot=new WeakMap,ss);function Vs(e){return{onFetch:(t,s)=>{var m,p,C,y,Q;const r=t.options,a=(C=(p=(m=t.fetchOptions)==null?void 0:m.meta)==null?void 0:p.fetchMore)==null?void 0:C.direction,u=((y=t.state.data)==null?void 0:y.pages)||[],l=((Q=t.state.data)==null?void 0:Q.pageParams)||[];let h={pages:[],pageParams:[]},v=0;const F=async()=>{let P=!1;const _=x=>{Bs(x,()=>t.signal,()=>P=!0)},S=fs(t.options,t.fetchOptions),D=async(x,d,q)=>{if(P)return Promise.reject(t.signal.reason);if(d==null&&x.pages.length)return Promise.resolve(x);const O=(()=>{const X={client:t.client,queryKey:t.queryKey,pageParam:d,direction:q?"backward":"forward",meta:t.options.meta};return _(X),X})(),A=await S(O),{maxPages:U}=t.options,$=q?Ys:Gs;return{pages:$(x.pages,A,U),pageParams:$(x.pageParams,d,U)}};if(a&&u.length){const x=a==="backward",d=x?vs:Pe,q={pages:u,pageParams:l},L=d(r,q);h=await D(q,L,x)}else{const x=e??u.length;do{const d=v===0?l[0]??r.initialPageParam:Pe(r,h);if(v>0&&d==null)break;h=await D(h,d),v++}while(v<x)}return h};t.options.persister?t.fetchFn=()=>{var P,_;return(_=(P=t.options).persister)==null?void 0:_.call(P,F,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=F}}}function Pe(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 vs(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}function Xs(e,t){return t?Pe(e,t)!=null:!1}function tr(e,t){return!t||!e.getPreviousPageParam?!1:vs(e,t)!=null}var Ht,_t,Lt,tt,Tt,K,re,Mt,Z,ms,at,rs,er=(rs=class extends ys{constructor(t){super();f(this,Z);f(this,Ht);f(this,_t);f(this,Lt);f(this,tt);f(this,Tt);f(this,K);f(this,re);f(this,Mt);c(this,Mt,!1),c(this,re,t.defaultOptions),this.setOptions(t.options),this.observers=[],c(this,Tt,t.client),c(this,tt,i(this,Tt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,c(this,_t,Je(this.options)),this.state=t.state??i(this,_t),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return i(this,Ht)}get promise(){var t;return(t=i(this,K))==null?void 0:t.promise}setOptions(t){if(this.options={...i(this,re),...t},t!=null&&t._type&&c(this,Ht,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=Je(this.options);s.data!==void 0&&(this.setState(ze(s.data,s.dataUpdatedAt)),c(this,_t,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&i(this,tt).remove(this)}setData(t,s){const r=be(this.state.data,t,this.options);return E(this,Z,at).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t){E(this,Z,at).call(this,{type:"setState",state:t})}cancel(t){var r,a;const s=(r=i(this,K))==null?void 0:r.promise;return(a=i(this,K))==null||a.cancel(t),s?s.then(B).catch(B):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return i(this,_t)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>V(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===je||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ct(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:!hs(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,K))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=i(this,K))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),i(this,tt).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,K)&&(i(this,Mt)||E(this,Z,ms).call(this)?i(this,K).cancel({revert:!0}):i(this,K).cancelRetry()),this.scheduleGc()),i(this,tt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||E(this,Z,at).call(this,{type:"invalidate"})}async fetch(t,s){var F,m,p,C,y,Q,P,_,S,D,x;if(this.state.fetchStatus!=="idle"&&((F=i(this,K))==null?void 0:F.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(i(this,K))return i(this,K).continueRetry(),i(this,K).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(q=>q.options.queryFn);d&&this.setOptions(d.options)}const r=new AbortController,a=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(c(this,Mt,!0),r.signal)})},u=()=>{const d=fs(this.options,s),L=(()=>{const O={client:i(this,Tt),queryKey:this.queryKey,meta:this.meta};return a(O),O})();return c(this,Mt,!1),this.options.persister?this.options.persister(d,L,this):d(L)},h=(()=>{const d={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:i(this,Tt),state:this.state,fetchFn:u};return a(d),d})(),v=i(this,Ht)==="infinite"?Vs(this.options.pages):this.options.behavior;v==null||v.onFetch(h,this),c(this,Lt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=h.fetchOptions)==null?void 0:m.meta))&&E(this,Z,at).call(this,{type:"fetch",meta:(p=h.fetchOptions)==null?void 0:p.meta}),c(this,K,ps({initialPromise:s==null?void 0:s.initialPromise,fn:h.fetchFn,onCancel:d=>{d instanceof Ee&&d.revert&&this.setState({...i(this,Lt),fetchStatus:"idle"}),r.abort()},onFail:(d,q)=>{E(this,Z,at).call(this,{type:"failed",failureCount:d,error:q})},onPause:()=>{E(this,Z,at).call(this,{type:"pause"})},onContinue:()=>{E(this,Z,at).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const d=await i(this,K).start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),(y=(C=i(this,tt).config).onSuccess)==null||y.call(C,d,this),(P=(Q=i(this,tt).config).onSettled)==null||P.call(Q,d,this.state.error,this),d}catch(d){if(d instanceof Ee){if(d.silent)return i(this,K).promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw E(this,Z,at).call(this,{type:"error",error:d}),(S=(_=i(this,tt).config).onError)==null||S.call(_,d,this),(x=(D=i(this,tt).config).onSettled)==null||x.call(D,this.state.data,d,this),d}finally{this.scheduleGc()}}},Ht=new WeakMap,_t=new WeakMap,Lt=new WeakMap,tt=new WeakMap,Tt=new WeakMap,K=new WeakMap,re=new WeakMap,Mt=new WeakMap,Z=new WeakSet,ms=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},at=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,...gs(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...ze(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return c(this,Lt,t.manual?a:void 0),a;case"error":const u=t.error;return{...r,error:u,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),N.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),i(this,tt).notify({query:this,type:"updated",action:t})})},rs);function gs(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ds(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ze(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Je(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"}}var J,w,ie,Y,Ft,Kt,ut,mt,ne,$t,Gt,xt,At,gt,Yt,M,te,Ce,Se,we,Oe,_e,Te,Me,Rs,is,bs=(is=class extends Zt{constructor(t,s){super();f(this,M);f(this,J);f(this,w);f(this,ie);f(this,Y);f(this,Ft);f(this,Kt);f(this,ut);f(this,mt);f(this,ne);f(this,$t);f(this,Gt);f(this,xt);f(this,At);f(this,gt);f(this,Yt,new Set);this.options=s,c(this,J,t),c(this,mt,null),c(this,ut,Re()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,w).addObserver(this),We(i(this,w),this.options)?E(this,M,te).call(this):this.updateResult(),E(this,M,Oe).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fe(i(this,w),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fe(i(this,w),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,E(this,M,_e).call(this),E(this,M,Te).call(this),i(this,w).removeObserver(this)}setOptions(t){const s=this.options,r=i(this,w);if(this.options=i(this,J).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof V(this.options.enabled,i(this,w))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");E(this,M,Me).call(this),i(this,w).setOptions(this.options),s._defaulted&&!fe(this.options,s)&&i(this,J).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,w),observer:this});const a=this.hasListeners();a&&Ze(i(this,w),r,this.options,s)&&E(this,M,te).call(this),this.updateResult(),a&&(i(this,w)!==r||V(this.options.enabled,i(this,w))!==V(s.enabled,i(this,w))||Ct(this.options.staleTime,i(this,w))!==Ct(s.staleTime,i(this,w)))&&E(this,M,Ce).call(this);const u=E(this,M,Se).call(this);a&&(i(this,w)!==r||V(this.options.enabled,i(this,w))!==V(s.enabled,i(this,w))||u!==i(this,gt))&&E(this,M,we).call(this,u)}getOptimisticResult(t){const s=i(this,J).getQueryCache().build(i(this,J),t),r=this.createResult(s,t);return rr(this,r)&&(c(this,Y,r),c(this,Kt,this.options),c(this,Ft,i(this,w).state)),r}getCurrentResult(){return i(this,Y)}trackResult(t,s){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),s==null||s(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&i(this,ut).status==="pending"&&i(this,ut).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){i(this,Yt).add(t)}getCurrentQuery(){return i(this,w)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=i(this,J).defaultQueryOptions(t),r=i(this,J).getQueryCache().build(i(this,J),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return E(this,M,te).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,Y)))}createResult(t,s){var U;const r=i(this,w),a=this.options,u=i(this,Y),l=i(this,Ft),h=i(this,Kt),F=t!==r?t.state:i(this,ie),{state:m}=t;let p={...m},C=!1,y;if(s._optimisticResults){const $=this.hasListeners(),X=!$&&We(t,s),jt=$&&Ze(t,r,s,a);(X||jt)&&(p={...p,...gs(m.data,t.options)}),s._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:Q,errorUpdatedAt:P,status:_}=p;y=p.data;let S=!1;if(s.placeholderData!==void 0&&y===void 0&&_==="pending"){let $;u!=null&&u.isPlaceholderData&&s.placeholderData===(h==null?void 0:h.placeholderData)?($=u.data,S=!0):$=typeof s.placeholderData=="function"?s.placeholderData((U=i(this,Gt))==null?void 0:U.state.data,i(this,Gt)):s.placeholderData,$!==void 0&&(_="success",y=be(u==null?void 0:u.data,$,s),C=!0)}if(s.select&&y!==void 0&&!S)if(u&&y===(l==null?void 0:l.data)&&s.select===i(this,ne))y=i(this,$t);else try{c(this,ne,s.select),y=s.select(y),y=be(u==null?void 0:u.data,y,s),c(this,$t,y),c(this,mt,null)}catch($){c(this,mt,$)}i(this,mt)&&(Q=i(this,mt),y=i(this,$t),P=Date.now(),_="error");const D=p.fetchStatus==="fetching",x=_==="pending",d=_==="error",q=x&&D,L=y!==void 0,A={status:_,fetchStatus:p.fetchStatus,isPending:x,isSuccess:_==="success",isError:d,isInitialLoading:q,isLoading:q,data:y,dataUpdatedAt:p.dataUpdatedAt,error:Q,errorUpdatedAt:P,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>F.dataUpdateCount||p.errorUpdateCount>F.errorUpdateCount,isFetching:D,isRefetching:D&&!x,isLoadingError:d&&!L,isPaused:p.fetchStatus==="paused",isPlaceholderData:C,isRefetchError:d&&L,isStale:Ue(t,s),refetch:this.refetch,promise:i(this,ut),isEnabled:V(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const $=A.data!==void 0,X=A.status==="error"&&!$,jt=Dt=>{X?Dt.reject(A.error):$&&Dt.resolve(A.data)},Vt=()=>{const Dt=c(this,ut,A.promise=Re());jt(Dt)},ft=i(this,ut);switch(ft.status){case"pending":t.queryHash===r.queryHash&&jt(ft);break;case"fulfilled":(X||A.data!==ft.value)&&Vt();break;case"rejected":(!X||A.error!==ft.reason)&&Vt();break}}return A}updateResult(){const t=i(this,Y),s=this.createResult(i(this,w),this.options);if(c(this,Ft,i(this,w).state),c(this,Kt,this.options),i(this,Ft).data!==void 0&&c(this,Gt,i(this,w)),fe(s,t))return;c(this,Y,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,u=typeof a=="function"?a():a;if(u==="all"||!u&&!i(this,Yt).size)return!0;const l=new Set(u??i(this,Yt));return this.options.throwOnError&&l.add("error"),Object.keys(i(this,Y)).some(h=>{const v=h;return i(this,Y)[v]!==t[v]&&l.has(v)})};E(this,M,Rs).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&E(this,M,Oe).call(this)}},J=new WeakMap,w=new WeakMap,ie=new WeakMap,Y=new WeakMap,Ft=new WeakMap,Kt=new WeakMap,ut=new WeakMap,mt=new WeakMap,ne=new WeakMap,$t=new WeakMap,Gt=new WeakMap,xt=new WeakMap,At=new WeakMap,gt=new WeakMap,Yt=new WeakMap,M=new WeakSet,te=function(t){E(this,M,Me).call(this);let s=i(this,w).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(B)),s},Ce=function(){E(this,M,_e).call(this);const t=Ct(this.options.staleTime,i(this,w));if(se.isServer()||i(this,Y).isStale||!me(t))return;const r=hs(i(this,Y).dataUpdatedAt,t)+1;c(this,xt,St.setTimeout(()=>{i(this,Y).isStale||this.updateResult()},r))},Se=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,w)):this.options.refetchInterval)??!1},we=function(t){E(this,M,Te).call(this),c(this,gt,t),!(se.isServer()||V(this.options.enabled,i(this,w))===!1||!me(i(this,gt))||i(this,gt)===0)&&c(this,At,St.setInterval(()=>{(this.options.refetchIntervalInBackground||Ie.isFocused())&&E(this,M,te).call(this)},i(this,gt)))},Oe=function(){E(this,M,Ce).call(this),E(this,M,we).call(this,E(this,M,Se).call(this))},_e=function(){i(this,xt)!==void 0&&(St.clearTimeout(i(this,xt)),c(this,xt,void 0))},Te=function(){i(this,At)!==void 0&&(St.clearInterval(i(this,At)),c(this,At,void 0))},Me=function(){const t=i(this,J).getQueryCache().build(i(this,J),this.options);if(t===i(this,w))return;const s=i(this,w);c(this,w,t),c(this,ie,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Rs=function(t){N.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(i(this,Y))}),i(this,J).getQueryCache().notify({query:i(this,w),type:"observerResultsUpdated"})})},is);function sr(e,t){return V(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&V(t.retryOnMount,e)===!1)}function We(e,t){return sr(e,t)||e.state.data!==void 0&&Fe(e,t,t.refetchOnMount)}function Fe(e,t,s){if(V(t.enabled,e)!==!1&&Ct(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&Ue(e,t)}return!1}function Ze(e,t,s,r){return(e!==t||V(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Ue(e,s)}function Ue(e,t){return V(t.enabled,e)!==!1&&e.isStaleByTime(Ct(t.staleTime,e))}function rr(e,t){return!fe(e.getCurrentResult(),t)}var ir=class extends bs{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var Q,P;const{state:s}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:u,isError:l,isRefetchError:h}=r,v=(P=(Q=s.fetchMeta)==null?void 0:Q.fetchMore)==null?void 0:P.direction,F=l&&v==="forward",m=a&&v==="forward",p=l&&v==="backward",C=a&&v==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Xs(t,s.data),hasPreviousPage:tr(t,s.data),isFetchNextPageError:F,isFetchingNextPage:m,isFetchPreviousPageError:p,isFetchingPreviousPage:C,isRefetchError:h&&!F&&!p,isRefetching:u&&!m&&!C}}},ae,rt,G,It,it,dt,ns,nr=(ns=class extends ys{constructor(t){super();f(this,it);f(this,ae);f(this,rt);f(this,G);f(this,It);c(this,ae,t.client),this.mutationId=t.mutationId,c(this,G,t.mutationCache),c(this,rt,[]),this.state=t.state||Es(),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,rt).includes(t)||(i(this,rt).push(t),this.clearGcTimeout(),i(this,G).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){c(this,rt,i(this,rt).filter(s=>s!==t)),this.scheduleGc(),i(this,G).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){i(this,rt).length||(this.state.status==="pending"?this.scheduleGc():i(this,G).remove(this))}continue(){var t;return((t=i(this,It))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,h,v,F,m,p,C,y,Q,P,_,S,D,x,d,q,L,O;const s=()=>{E(this,it,dt).call(this,{type:"continue"})},r={client:i(this,ae),meta:this.options.meta,mutationKey:this.options.mutationKey};c(this,It,ps({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,U)=>{E(this,it,dt).call(this,{type:"failed",failureCount:A,error:U})},onPause:()=>{E(this,it,dt).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>i(this,G).canRun(this)}));const a=this.state.status==="pending",u=!i(this,It).canStart();try{if(a)s();else{E(this,it,dt).call(this,{type:"pending",variables:t,isPaused:u}),i(this,G).config.onMutate&&await i(this,G).config.onMutate(t,this,r);const U=await((h=(l=this.options).onMutate)==null?void 0:h.call(l,t,r));U!==this.state.context&&E(this,it,dt).call(this,{type:"pending",context:U,variables:t,isPaused:u})}const A=await i(this,It).start();return await((F=(v=i(this,G).config).onSuccess)==null?void 0:F.call(v,A,t,this.state.context,this,r)),await((p=(m=this.options).onSuccess)==null?void 0:p.call(m,A,t,this.state.context,r)),await((y=(C=i(this,G).config).onSettled)==null?void 0:y.call(C,A,null,this.state.variables,this.state.context,this,r)),await((P=(Q=this.options).onSettled)==null?void 0:P.call(Q,A,null,t,this.state.context,r)),E(this,it,dt).call(this,{type:"success",data:A}),A}catch(A){try{await((S=(_=i(this,G).config).onError)==null?void 0:S.call(_,A,t,this.state.context,this,r))}catch(U){Promise.reject(U)}try{await((x=(D=this.options).onError)==null?void 0:x.call(D,A,t,this.state.context,r))}catch(U){Promise.reject(U)}try{await((q=(d=i(this,G).config).onSettled)==null?void 0:q.call(d,void 0,A,this.state.variables,this.state.context,this,r))}catch(U){Promise.reject(U)}try{await((O=(L=this.options).onSettled)==null?void 0:O.call(L,void 0,A,t,this.state.context,r))}catch(U){Promise.reject(U)}throw E(this,it,dt).call(this,{type:"error",error:A}),A}finally{i(this,G).runNext(this)}}},ae=new WeakMap,rt=new WeakMap,G=new WeakMap,It=new WeakMap,it=new WeakSet,dt=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),N.batch(()=>{i(this,rt).forEach(r=>{r.onMutationUpdate(t)}),i(this,G).notify({mutation:this,type:"updated",action:t})})},ns);function Es(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ot,et,ue,as,ar=(as=class extends Zt{constructor(t={}){super();f(this,ot);f(this,et);f(this,ue);this.config=t,c(this,ot,new Set),c(this,et,new Map),c(this,ue,0)}build(t,s,r){const a=new nr({client:t,mutationCache:this,mutationId:++ce(this,ue)._,options:t.defaultMutationOptions(s),state:r});return this.add(a),a}add(t){i(this,ot).add(t);const s=he(t);if(typeof s=="string"){const r=i(this,et).get(s);r?r.push(t):i(this,et).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(i(this,ot).delete(t)){const s=he(t);if(typeof s=="string"){const r=i(this,et).get(s);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&i(this,et).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=he(t);if(typeof s=="string"){const r=i(this,et).get(s),a=r==null?void 0:r.find(u=>u.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const s=he(t);if(typeof s=="string"){const a=(r=i(this,et).get(s))==null?void 0:r.find(u=>u!==t&&u.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){N.batch(()=>{i(this,ot).forEach(t=>{this.notify({type:"removed",mutation:t})}),i(this,ot).clear(),i(this,et).clear()})}getAll(){return Array.from(i(this,ot))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>Ge(s,r))}findAll(t={}){return this.getAll().filter(s=>Ge(t,s))}notify(t){N.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return N.batch(()=>Promise.all(t.map(s=>s.continue().catch(B))))}},ot=new WeakMap,et=new WeakMap,ue=new WeakMap,as);function he(e){var t;return(t=e.options.scope)==null?void 0:t.id}var ct,bt,W,ht,lt,le,xe,us,ur=(us=class extends Zt{constructor(t,s){super();f(this,lt);f(this,ct);f(this,bt);f(this,W);f(this,ht);c(this,ct,t),this.setOptions(s),this.bindMethods(),E(this,lt,le).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const s=this.options;this.options=i(this,ct).defaultMutationOptions(t),fe(this.options,s)||i(this,ct).getMutationCache().notify({type:"observerOptionsUpdated",mutation:i(this,W),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Qt(s.mutationKey)!==Qt(this.options.mutationKey)?this.reset():((r=i(this,W))==null?void 0:r.state.status)==="pending"&&i(this,W).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=i(this,W))==null||t.removeObserver(this)}onMutationUpdate(t){E(this,lt,le).call(this),E(this,lt,xe).call(this,t)}getCurrentResult(){return i(this,bt)}reset(){var t;(t=i(this,W))==null||t.removeObserver(this),c(this,W,void 0),E(this,lt,le).call(this),E(this,lt,xe).call(this)}mutate(t,s){var r;return c(this,ht,s),(r=i(this,W))==null||r.removeObserver(this),c(this,W,i(this,ct).getMutationCache().build(i(this,ct),this.options)),i(this,W).addObserver(this),i(this,W).execute(t)}},ct=new WeakMap,bt=new WeakMap,W=new WeakMap,ht=new WeakMap,lt=new WeakSet,le=function(){var s;const t=((s=i(this,W))==null?void 0:s.state)??Es();c(this,bt,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},xe=function(t){N.batch(()=>{var s,r,a,u,l,h,v,F;if(i(this,ht)&&this.hasListeners()){const m=i(this,bt).variables,p=i(this,bt).context,C={client:i(this,ct),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(s=i(this,ht)).onSuccess)==null||r.call(s,t.data,m,p,C)}catch(y){Promise.reject(y)}try{(u=(a=i(this,ht)).onSettled)==null||u.call(a,t.data,null,m,p,C)}catch(y){Promise.reject(y)}}else if((t==null?void 0:t.type)==="error"){try{(h=(l=i(this,ht)).onError)==null||h.call(l,t.error,m,p,C)}catch(y){Promise.reject(y)}try{(F=(v=i(this,ht)).onSettled)==null||F.call(v,void 0,t.error,m,p,C)}catch(y){Promise.reject(y)}}}this.listeners.forEach(m=>{m(i(this,bt))})})},us),nt,os,or=(os=class extends Zt{constructor(t={}){super();f(this,nt);this.config=t,c(this,nt,new Map)}build(t,s,r){const a=s.queryKey,u=s.queryHash??Qe(a,s);let l=this.get(u);return l||(l=new er({client:t,queryKey:a,queryHash:u,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){i(this,nt).has(t.queryHash)||(i(this,nt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=i(this,nt).get(t.queryHash);s&&(t.destroy(),s===t&&i(this,nt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){N.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return i(this,nt).get(t)}getAll(){return[...i(this,nt).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>$e(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>$e(t,r)):s}notify(t){N.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){N.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){N.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},nt=new WeakMap,os),k,Rt,Et,Bt,zt,Pt,Jt,Wt,cs,Er=(cs=class{constructor(e={}){f(this,k);f(this,Rt);f(this,Et);f(this,Bt);f(this,zt);f(this,Pt);f(this,Jt);f(this,Wt);c(this,k,e.queryCache||new or),c(this,Rt,e.mutationCache||new ar),c(this,Et,e.defaultOptions||{}),c(this,Bt,new Map),c(this,zt,new Map),c(this,Pt,0)}mount(){ce(this,Pt)._++,i(this,Pt)===1&&(c(this,Jt,Ie.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,k).onFocus())})),c(this,Wt,de.subscribe(async e=>{e&&(await this.resumePausedMutations(),i(this,k).onOnline())})))}unmount(){var e,t;ce(this,Pt)._--,i(this,Pt)===0&&((e=i(this,Jt))==null||e.call(this),c(this,Jt,void 0),(t=i(this,Wt))==null||t.call(this),c(this,Wt,void 0))}isFetching(e){return i(this,k).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return i(this,Rt).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=i(this,k).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=i(this,k).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Ct(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return i(this,k).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),a=i(this,k).get(r.queryHash),u=a==null?void 0:a.state.data,l=Ls(t,u);if(l!==void 0)return i(this,k).build(this,r).setData(l,{...s,manual:!0})}setQueriesData(e,t,s){return N.batch(()=>i(this,k).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,k).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=i(this,k);N.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=i(this,k);return N.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=N.batch(()=>i(this,k).findAll(e).map(a=>a.cancel(s)));return Promise.all(r).then(B).catch(B)}invalidateQueries(e,t={}){return N.batch(()=>(i(this,k).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=N.batch(()=>i(this,k).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let u=a.fetch(void 0,s);return s.throwOnError||(u=u.catch(B)),a.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(r).then(B)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=i(this,k).build(this,t);return s.isStaleByTime(Ct(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(B).catch(B)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(B).catch(B)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return de.isOnline()?i(this,Rt).resumePausedMutations():Promise.resolve()}getQueryCache(){return i(this,k)}getMutationCache(){return i(this,Rt)}getDefaultOptions(){return i(this,Et)}setDefaultOptions(e){c(this,Et,e)}setQueryDefaults(e,t){i(this,Bt).set(Qt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...i(this,Bt).values()],s={};return t.forEach(r=>{ee(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){i(this,zt).set(Qt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...i(this,zt).values()],s={};return t.forEach(r=>{ee(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...i(this,Et).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qe(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===je&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...i(this,Et).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){i(this,k).clear(),i(this,Rt).clear()}},k=new WeakMap,Rt=new WeakMap,Et=new WeakMap,Bt=new WeakMap,zt=new WeakMap,Pt=new WeakMap,Jt=new WeakMap,Wt=new WeakMap,cs),Ps=H.createContext(void 0),Cs=e=>{const t=H.useContext(Ps);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Pr=({client:e,children:t})=>(H.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),Is.jsx(Ps.Provider,{value:e,children:t})),Ss=H.createContext(!1),cr=()=>H.useContext(Ss);Ss.Provider;function hr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var lr=H.createContext(hr()),fr=()=>H.useContext(lr),dr=(e,t,s)=>{const r=s!=null&&s.state.error&&typeof e.throwOnError=="function"?De(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},pr=e=>{H.useEffect(()=>{e.clearReset()},[e])},yr=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||De(s,[e.error,r])),vr=e=>{if(e.suspense){const s=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>s(r(...a)):s(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},mr=(e,t)=>e.isLoading&&e.isFetching&&!t,gr=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ve=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function ws(e,t,s){var y,Q,P,_;const r=cr(),a=fr(),u=Cs(),l=u.defaultQueryOptions(e);(Q=(y=u.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||Q.call(y,l);const h=u.getQueryCache().get(l.queryHash),v=e.subscribed!==!1;l._optimisticResults=r?"isRestoring":v?"optimistic":void 0,vr(l),dr(l,a,h),pr(a);const F=!u.getQueryCache().get(l.queryHash),[m]=H.useState(()=>new t(u,l)),p=m.getOptimisticResult(l),C=!r&&v;if(H.useSyncExternalStore(H.useCallback(S=>{const D=C?m.subscribe(N.batchCalls(S)):B;return m.updateResult(),D},[m,C]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),H.useEffect(()=>{m.setOptions(l)},[l,m]),gr(l,p))throw Ve(l,m,a);if(yr({result:p,errorResetBoundary:a,throwOnError:l.throwOnError,query:h,suspense:l.suspense}))throw p.error;if((_=(P=u.getDefaultOptions().queries)==null?void 0:P._experimental_afterQuery)==null||_.call(P,l,p),l.experimental_prefetchInRender&&!se.isServer()&&mr(p,r)){const S=F?Ve(l,m,a):h==null?void 0:h.promise;S==null||S.catch(B).finally(()=>{m.updateResult()})}return l.notifyOnChangeProps?p:m.trackResult(p)}function Cr(e,t){return ws(e,bs)}function Sr(e,t){const s=Cs(),[r]=H.useState(()=>new ur(s,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);const a=H.useSyncExternalStore(H.useCallback(l=>r.subscribe(N.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),u=H.useCallback((l,h)=>{r.mutate(l,h).catch(B)},[r]);if(a.error&&De(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:u,mutateAsync:a.mutate}}function wr(e,t){return ws(e,ir)}export{Er as Q,Rr as R,H as a,Ds as b,Cs as c,Sr as d,Pr as e,wr as f,Fs as g,Is as j,js as r,Cr as u};
