@queuedash/ui
Version:
A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue
9 lines • 600 kB
JavaScript
"use strict";var Au=e=>{throw TypeError(e)};var Wa=(e,t,n)=>t.has(e)||Au("Cannot "+n);var C=(e,t,n)=>(Wa(e,t,"read from private field"),n?n.call(e):t.get(e)),G=(e,t,n)=>t.has(e)?Au("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),V=(e,t,n,r)=>(Wa(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),X=(e,t,n)=>(Wa(e,t,"access private method"),n);var ui=(e,t,n,r)=>({set _(o){V(e,t,o,n)},get _(){return C(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),Br=require("react-dom");function Ng(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const E=Ng(d);function cf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var df={exports:{}},ya={};/**
* @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 Ag=Symbol.for("react.transitional.element"),Kg=Symbol.for("react.fragment");function ff(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var o in t)o!=="key"&&(n[o]=t[o])}else n=t;return t=n.ref,{$$typeof:Ag,type:e,key:r,ref:t!==void 0?t:null,props:n}}ya.Fragment=Kg;ya.jsx=ff;ya.jsxs=ff;df.exports=ya;var y=df.exports,Wn=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(){}},Bg={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Jt,Kl,Xd,Hg=(Xd=class{constructor(){G(this,Jt,Bg);G(this,Kl,!1)}setTimeoutProvider(e){V(this,Jt,e)}setTimeout(e,t){return C(this,Jt).setTimeout(e,t)}clearTimeout(e){C(this,Jt).clearTimeout(e)}setInterval(e,t){return C(this,Jt).setInterval(e,t)}clearInterval(e){C(this,Jt).clearInterval(e)}},Jt=new WeakMap,Kl=new WeakMap,Xd),Tn=new Hg;function Vg(e){setTimeout(e,0)}var Hn=typeof window>"u"||"Deno"in globalThis;function Ie(){}function zg(e,t){return typeof e=="function"?e(t):e}function Ls(e){return typeof e=="number"&&e>=0&&e!==1/0}function hf(e,t){return Math.max(e+(t||0)-Date.now(),0)}function hn(e,t){return typeof e=="function"?e(t):e}function ut(e,t){return typeof e=="function"?e(t):e}function Ku(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:a,stale:s}=e;if(a){if(r){if(t.queryHash!==Bl(a,t.options))return!1}else if(!So(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||o&&o!==t.state.fetchStatus||i&&!i(t))}function Bu(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(vn(t.options.mutationKey)!==vn(i))return!1}else if(!So(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Bl(e,t){return((t==null?void 0:t.queryKeyHashFn)||vn)(e)}function vn(e){return JSON.stringify(e,(t,n)=>Fs(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function So(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>So(e[n],t[n])):!1}var Ug=Object.prototype.hasOwnProperty;function Hl(e,t){if(e===t)return e;const n=Hu(e)&&Hu(t);if(!n&&!(Fs(e)&&Fs(t)))return t;const o=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),a=i.length,s=n?new Array(a):{};let l=0;for(let u=0;u<a;u++){const h=n?u:i[u],c=e[h],p=t[h];if(c===p){s[h]=c,(n?u<o:Ug.call(e,h))&&l++;continue}if(c===null||p===null||typeof c!="object"||typeof p!="object"){s[h]=p;continue}const f=Hl(c,p);s[h]=f,f===c&&l++}return o===a&&l===o?e:s}function Eo(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Hu(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Fs(e){if(!Vu(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Vu(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Vu(e){return Object.prototype.toString.call(e)==="[object Object]"}function qg(e){return new Promise(t=>{Tn.setTimeout(t,e)})}function Is(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Hl(e,t):t}function Wg(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Gg(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var et=Symbol();function pf(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===et?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gf(e,t){return typeof e=="function"?e(...t):!!e}var _n,en,br,Zd,Qg=(Zd=class extends Wn{constructor(){super();G(this,_n);G(this,en);G(this,br);V(this,br,t=>{if(!Hn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,en)||this.setEventListener(C(this,br))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,en))==null||t.call(this),V(this,en,void 0))}setEventListener(t){var n;V(this,br,t),(n=C(this,en))==null||n.call(this),V(this,en,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){C(this,_n)!==t&&(V(this,_n,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof C(this,_n)=="boolean"?C(this,_n):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},_n=new WeakMap,en=new WeakMap,br=new WeakMap,Zd),Vl=new Qg;function js(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var Yg=Vg;function Xg(){let e=[],t=0,n=s=>{s()},r=s=>{s()},o=Yg;const i=s=>{t?e.push(s):o(()=>{n(s)})},a=()=>{const s=e;e=[],s.length&&o(()=>{r(()=>{s.forEach(l=>{n(l)})})})};return{batch:s=>{let l;t++;try{l=s()}finally{t--,t||a()}return l},batchCalls:s=>(...l)=>{i(()=>{s(...l)})},schedule:i,setNotifyFunction:s=>{n=s},setBatchNotifyFunction:s=>{r=s},setScheduler:s=>{o=s}}}var be=Xg(),yr,tn,xr,Jd,Zg=(Jd=class extends Wn{constructor(){super();G(this,yr,!0);G(this,tn);G(this,xr);V(this,xr,t=>{if(!Hn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){C(this,tn)||this.setEventListener(C(this,xr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,tn))==null||t.call(this),V(this,tn,void 0))}setEventListener(t){var n;V(this,xr,t),(n=C(this,tn))==null||n.call(this),V(this,tn,t(this.setOnline.bind(this)))}setOnline(t){C(this,yr)!==t&&(V(this,yr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return C(this,yr)}},yr=new WeakMap,tn=new WeakMap,xr=new WeakMap,Jd),Vi=new Zg;function Jg(e){return Math.min(1e3*2**e,3e4)}function mf(e){return(e??"online")==="online"?Vi.isOnline():!0}var Ns=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function vf(e){let t=!1,n=0,r;const o=js(),i=()=>o.status!=="pending",a=m=>{var v;if(!i()){const b=new Ns(m);p(b),(v=e.onCancel)==null||v.call(e,b)}},s=()=>{t=!0},l=()=>{t=!1},u=()=>Vl.isFocused()&&(e.networkMode==="always"||Vi.isOnline())&&e.canRun(),h=()=>mf(e.networkMode)&&e.canRun(),c=m=>{i()||(r==null||r(),o.resolve(m))},p=m=>{i()||(r==null||r(),o.reject(m))},f=()=>new Promise(m=>{var v;r=b=>{(i()||u())&&m(b)},(v=e.onPause)==null||v.call(e)}).then(()=>{var m;r=void 0,i()||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(i())return;let m;const v=n===0?e.initialPromise:void 0;try{m=v??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(c).catch(b=>{var P;if(i())return;const x=e.retry??(Hn?0:3),w=e.retryDelay??Jg,S=typeof w=="function"?w(n,b):w,k=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,b);if(t||!k){p(b);return}n++,(P=e.onFail)==null||P.call(e,n,b),qg(S).then(()=>u()?void 0:f()).then(()=>{t?p(b):g()})})};return{promise:o,status:()=>o.status,cancel:a,continue:()=>(r==null||r(),o),cancelRetry:s,continueRetry:l,canStart:h,start:()=>(h()?g():f().then(g),o)}}var Ln,ef,bf=(ef=class{constructor(){G(this,Ln)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ls(this.gcTime)&&V(this,Ln,Tn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hn?1/0:5*60*1e3))}clearGcTimeout(){C(this,Ln)&&(Tn.clearTimeout(C(this,Ln)),V(this,Ln,void 0))}},Ln=new WeakMap,ef),Fn,wr,st,In,Re,Ao,jn,yt,It,tf,em=(tf=class extends bf{constructor(t){super();G(this,yt);G(this,Fn);G(this,wr);G(this,st);G(this,In);G(this,Re);G(this,Ao);G(this,jn);V(this,jn,!1),V(this,Ao,t.defaultOptions),this.setOptions(t.options),this.observers=[],V(this,In,t.client),V(this,st,C(this,In).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,V(this,Fn,Uu(this.options)),this.state=t.state??C(this,Fn),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=C(this,Re))==null?void 0:t.promise}setOptions(t){if(this.options={...C(this,Ao),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Uu(this.options);n.data!==void 0&&(this.setState(zu(n.data,n.dataUpdatedAt)),V(this,Fn,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,st).remove(this)}setData(t,n){const r=Is(this.state.data,t,this.options);return X(this,yt,It).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){X(this,yt,It).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=C(this,Re))==null?void 0:r.promise;return(o=C(this,Re))==null||o.cancel(t),n?n.then(Ie).catch(Ie):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(C(this,Fn))}isActive(){return this.observers.some(t=>ut(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===et||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>hn(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:!hf(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,Re))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,Re))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(this,st).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(C(this,Re)&&(C(this,jn)?C(this,Re).cancel({revert:!0}):C(this,Re).cancelRetry()),this.scheduleGc()),C(this,st).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||X(this,yt,It).call(this,{type:"invalidate"})}async fetch(t,n){var l,u,h,c,p,f,g,m,v,b,x,w;if(this.state.fetchStatus!=="idle"&&((l=C(this,Re))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,Re))return C(this,Re).continueRetry(),C(this,Re).promise}if(t&&this.setOptions(t),!this.options.queryFn){const S=this.observers.find(k=>k.options.queryFn);S&&this.setOptions(S.options)}const r=new AbortController,o=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(V(this,jn,!0),r.signal)})},i=()=>{const S=pf(this.options,n),P=(()=>{const R={client:C(this,In),queryKey:this.queryKey,meta:this.meta};return o(R),R})();return V(this,jn,!1),this.options.persister?this.options.persister(S,P,this):S(P)},s=(()=>{const S={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,In),state:this.state,fetchFn:i};return o(S),S})();(u=this.options.behavior)==null||u.onFetch(s,this),V(this,wr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=s.fetchOptions)==null?void 0:h.meta))&&X(this,yt,It).call(this,{type:"fetch",meta:(c=s.fetchOptions)==null?void 0:c.meta}),V(this,Re,vf({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,onCancel:S=>{S instanceof Ns&&S.revert&&this.setState({...C(this,wr),fetchStatus:"idle"}),r.abort()},onFail:(S,k)=>{X(this,yt,It).call(this,{type:"failed",failureCount:S,error:k})},onPause:()=>{X(this,yt,It).call(this,{type:"pause"})},onContinue:()=>{X(this,yt,It).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}));try{const S=await C(this,Re).start();if(S===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(S),(f=(p=C(this,st).config).onSuccess)==null||f.call(p,S,this),(m=(g=C(this,st).config).onSettled)==null||m.call(g,S,this.state.error,this),S}catch(S){if(S instanceof Ns){if(S.silent)return C(this,Re).promise;if(S.revert){if(this.state.data===void 0)throw S;return this.state.data}}throw X(this,yt,It).call(this,{type:"error",error:S}),(b=(v=C(this,st).config).onError)==null||b.call(v,S,this),(w=(x=C(this,st).config).onSettled)==null||w.call(x,this.state.data,S,this),S}finally{this.scheduleGc()}}},Fn=new WeakMap,wr=new WeakMap,st=new WeakMap,In=new WeakMap,Re=new WeakMap,Ao=new WeakMap,jn=new WeakMap,yt=new WeakSet,It=function(t){const n=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,...yf(r.data,this.options),fetchMeta:t.meta??null};case"success":const o={...r,...zu(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return V(this,wr,t.manual?o:void 0),o;case"error":const i=t.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),be.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),C(this,st).notify({query:this,type:"updated",action:t})})},tf);function yf(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:mf(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function zu(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Uu(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ve,re,Ko,Ne,Nn,Cr,Nt,nn,Bo,$r,Sr,An,Kn,rn,Er,ce,uo,As,Ks,Bs,Hs,Vs,zs,Us,xf,nf,Wo=(nf=class extends Wn{constructor(t,n){super();G(this,ce);G(this,Ve);G(this,re);G(this,Ko);G(this,Ne);G(this,Nn);G(this,Cr);G(this,Nt);G(this,nn);G(this,Bo);G(this,$r);G(this,Sr);G(this,An);G(this,Kn);G(this,rn);G(this,Er,new Set);this.options=n,V(this,Ve,t),V(this,nn,null),V(this,Nt,js()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,re).addObserver(this),qu(C(this,re),this.options)?X(this,ce,uo).call(this):this.updateResult(),X(this,ce,Hs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qs(C(this,re),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qs(C(this,re),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,X(this,ce,Vs).call(this),X(this,ce,zs).call(this),C(this,re).removeObserver(this)}setOptions(t){const n=this.options,r=C(this,re);if(this.options=C(this,Ve).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ut(this.options.enabled,C(this,re))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");X(this,ce,Us).call(this),C(this,re).setOptions(this.options),n._defaulted&&!Eo(this.options,n)&&C(this,Ve).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,re),observer:this});const o=this.hasListeners();o&&Wu(C(this,re),r,this.options,n)&&X(this,ce,uo).call(this),this.updateResult(),o&&(C(this,re)!==r||ut(this.options.enabled,C(this,re))!==ut(n.enabled,C(this,re))||hn(this.options.staleTime,C(this,re))!==hn(n.staleTime,C(this,re)))&&X(this,ce,As).call(this);const i=X(this,ce,Ks).call(this);o&&(C(this,re)!==r||ut(this.options.enabled,C(this,re))!==ut(n.enabled,C(this,re))||i!==C(this,rn))&&X(this,ce,Bs).call(this,i)}getOptimisticResult(t){const n=C(this,Ve).getQueryCache().build(C(this,Ve),t),r=this.createResult(n,t);return nm(this,r)&&(V(this,Ne,r),V(this,Cr,this.options),V(this,Nn,C(this,re).state)),r}getCurrentResult(){return C(this,Ne)}trackResult(t,n){return new Proxy(t,{get:(r,o)=>(this.trackProp(o),n==null||n(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,Nt).status==="pending"&&C(this,Nt).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(t){C(this,Er).add(t)}getCurrentQuery(){return C(this,re)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=C(this,Ve).defaultQueryOptions(t),r=C(this,Ve).getQueryCache().build(C(this,Ve),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return X(this,ce,uo).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,Ne)))}createResult(t,n){var _;const r=C(this,re),o=this.options,i=C(this,Ne),a=C(this,Nn),s=C(this,Cr),u=t!==r?t.state:C(this,Ko),{state:h}=t;let c={...h},p=!1,f;if(n._optimisticResults){const D=this.hasListeners(),j=!D&&qu(t,n),K=D&&Wu(t,r,n,o);(j||K)&&(c={...c,...yf(h.data,t.options)}),n._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:v}=c;f=c.data;let b=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let D;i!=null&&i.isPlaceholderData&&n.placeholderData===(s==null?void 0:s.placeholderData)?(D=i.data,b=!0):D=typeof n.placeholderData=="function"?n.placeholderData((_=C(this,Sr))==null?void 0:_.state.data,C(this,Sr)):n.placeholderData,D!==void 0&&(v="success",f=Is(i==null?void 0:i.data,D,n),p=!0)}if(n.select&&f!==void 0&&!b)if(i&&f===(a==null?void 0:a.data)&&n.select===C(this,Bo))f=C(this,$r);else try{V(this,Bo,n.select),f=n.select(f),f=Is(i==null?void 0:i.data,f,n),V(this,$r,f),V(this,nn,null)}catch(D){V(this,nn,D)}C(this,nn)&&(g=C(this,nn),f=C(this,$r),m=Date.now(),v="error");const x=c.fetchStatus==="fetching",w=v==="pending",S=v==="error",k=w&&x,P=f!==void 0,M={status:v,fetchStatus:c.fetchStatus,isPending:w,isSuccess:v==="success",isError:S,isInitialLoading:k,isLoading:k,data:f,dataUpdatedAt:c.dataUpdatedAt,error:g,errorUpdatedAt:m,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:S&&!P,isPaused:c.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:S&&P,isStale:zl(t,n),refetch:this.refetch,promise:C(this,Nt),isEnabled:ut(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const D=I=>{M.status==="error"?I.reject(M.error):M.data!==void 0&&I.resolve(M.data)},j=()=>{const I=V(this,Nt,M.promise=js());D(I)},K=C(this,Nt);switch(K.status){case"pending":t.queryHash===r.queryHash&&D(K);break;case"fulfilled":(M.status==="error"||M.data!==K.value)&&j();break;case"rejected":(M.status!=="error"||M.error!==K.reason)&&j();break}}return M}updateResult(){const t=C(this,Ne),n=this.createResult(C(this,re),this.options);if(V(this,Nn,C(this,re).state),V(this,Cr,this.options),C(this,Nn).data!==void 0&&V(this,Sr,C(this,re)),Eo(n,t))return;V(this,Ne,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,i=typeof o=="function"?o():o;if(i==="all"||!i&&!C(this,Er).size)return!0;const a=new Set(i??C(this,Er));return this.options.throwOnError&&a.add("error"),Object.keys(C(this,Ne)).some(s=>{const l=s;return C(this,Ne)[l]!==t[l]&&a.has(l)})};X(this,ce,xf).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&X(this,ce,Hs).call(this)}},Ve=new WeakMap,re=new WeakMap,Ko=new WeakMap,Ne=new WeakMap,Nn=new WeakMap,Cr=new WeakMap,Nt=new WeakMap,nn=new WeakMap,Bo=new WeakMap,$r=new WeakMap,Sr=new WeakMap,An=new WeakMap,Kn=new WeakMap,rn=new WeakMap,Er=new WeakMap,ce=new WeakSet,uo=function(t){X(this,ce,Us).call(this);let n=C(this,re).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ie)),n},As=function(){X(this,ce,Vs).call(this);const t=hn(this.options.staleTime,C(this,re));if(Hn||C(this,Ne).isStale||!Ls(t))return;const r=hf(C(this,Ne).dataUpdatedAt,t)+1;V(this,An,Tn.setTimeout(()=>{C(this,Ne).isStale||this.updateResult()},r))},Ks=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,re)):this.options.refetchInterval)??!1},Bs=function(t){X(this,ce,zs).call(this),V(this,rn,t),!(Hn||ut(this.options.enabled,C(this,re))===!1||!Ls(C(this,rn))||C(this,rn)===0)&&V(this,Kn,Tn.setInterval(()=>{(this.options.refetchIntervalInBackground||Vl.isFocused())&&X(this,ce,uo).call(this)},C(this,rn)))},Hs=function(){X(this,ce,As).call(this),X(this,ce,Bs).call(this,X(this,ce,Ks).call(this))},Vs=function(){C(this,An)&&(Tn.clearTimeout(C(this,An)),V(this,An,void 0))},zs=function(){C(this,Kn)&&(Tn.clearInterval(C(this,Kn)),V(this,Kn,void 0))},Us=function(){const t=C(this,Ve).getQueryCache().build(C(this,Ve),this.options);if(t===C(this,re))return;const n=C(this,re);V(this,re,t),V(this,Ko,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},xf=function(t){be.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(C(this,Ne))}),C(this,Ve).getQueryCache().notify({query:C(this,re),type:"observerResultsUpdated"})})},nf);function tm(e,t){return ut(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function qu(e,t){return tm(e,t)||e.state.data!==void 0&&qs(e,t,t.refetchOnMount)}function qs(e,t,n){if(ut(t.enabled,e)!==!1&&hn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&zl(e,t)}return!1}function Wu(e,t,n,r){return(e!==t||ut(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&zl(e,n)}function zl(e,t){return ut(t.enabled,e)!==!1&&e.isStaleByTime(hn(t.staleTime,e))}function nm(e,t){return!Eo(e.getCurrentResult(),t)}function zi(e){return{onFetch:(t,n)=>{var h,c,p,f,g;const r=t.options,o=(p=(c=(h=t.fetchOptions)==null?void 0:h.meta)==null?void 0:c.fetchMore)==null?void 0:p.direction,i=((f=t.state.data)==null?void 0:f.pages)||[],a=((g=t.state.data)==null?void 0:g.pageParams)||[];let s={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},b=pf(t.options,t.fetchOptions),x=async(w,S,k)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const R=(()=>{const j={client:t.client,queryKey:t.queryKey,pageParam:S,direction:k?"backward":"forward",meta:t.options.meta};return v(j),j})(),M=await b(R),{maxPages:_}=t.options,D=k?Gg:Wg;return{pages:D(w.pages,M,_),pageParams:D(w.pageParams,S,_)}};if(o&&i.length){const w=o==="backward",S=w?wf:Ws,k={pages:i,pageParams:a},P=S(r,k);s=await x(k,P,w)}else{const w=e??i.length;do{const S=l===0?a[0]??r.initialPageParam:Ws(r,s);if(l>0&&S==null)break;s=await x(s,S),l++}while(l<w)}return s};t.options.persister?t.fetchFn=()=>{var m,v;return(v=(m=t.options).persister)==null?void 0:v.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function Ws(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function wf(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}function rm(e,t){return t?Ws(e,t)!=null:!1}function om(e,t){return!t||!e.getPreviousPageParam?!1:wf(e,t)!=null}var Cf=class extends Wo{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:zi()})}getOptimisticResult(e){return e.behavior=zi(),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 g,m;const{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:i,isError:a,isRefetchError:s}=r,l=(m=(g=n.fetchMeta)==null?void 0:g.fetchMore)==null?void 0:m.direction,u=a&&l==="forward",h=o&&l==="forward",c=a&&l==="backward",p=o&&l==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:rm(t,n.data),hasPreviousPage:om(t,n.data),isFetchNextPageError:u,isFetchingNextPage:h,isFetchPreviousPageError:c,isFetchingPreviousPage:p,isRefetchError:s&&!u&&!c,isRefetching:i&&!h&&!p}}},Ho,Mt,Ae,Bn,Ot,Xt,rf,im=(rf=class extends bf{constructor(t){super();G(this,Ot);G(this,Ho);G(this,Mt);G(this,Ae);G(this,Bn);V(this,Ho,t.client),this.mutationId=t.mutationId,V(this,Ae,t.mutationCache),V(this,Mt,[]),this.state=t.state||$f(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){C(this,Mt).includes(t)||(C(this,Mt).push(t),this.clearGcTimeout(),C(this,Ae).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){V(this,Mt,C(this,Mt).filter(n=>n!==t)),this.scheduleGc(),C(this,Ae).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,Mt).length||(this.state.status==="pending"?this.scheduleGc():C(this,Ae).remove(this))}continue(){var t;return((t=C(this,Bn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var a,s,l,u,h,c,p,f,g,m,v,b,x,w,S,k,P,R,M,_;const n=()=>{X(this,Ot,Xt).call(this,{type:"continue"})},r={client:C(this,Ho),meta:this.options.meta,mutationKey:this.options.mutationKey};V(this,Bn,vf({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(D,j)=>{X(this,Ot,Xt).call(this,{type:"failed",failureCount:D,error:j})},onPause:()=>{X(this,Ot,Xt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,Ae).canRun(this)}));const o=this.state.status==="pending",i=!C(this,Bn).canStart();try{if(o)n();else{X(this,Ot,Xt).call(this,{type:"pending",variables:t,isPaused:i}),await((s=(a=C(this,Ae).config).onMutate)==null?void 0:s.call(a,t,this,r));const j=await((u=(l=this.options).onMutate)==null?void 0:u.call(l,t,r));j!==this.state.context&&X(this,Ot,Xt).call(this,{type:"pending",context:j,variables:t,isPaused:i})}const D=await C(this,Bn).start();return await((c=(h=C(this,Ae).config).onSuccess)==null?void 0:c.call(h,D,t,this.state.context,this,r)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,D,t,this.state.context,r)),await((m=(g=C(this,Ae).config).onSettled)==null?void 0:m.call(g,D,null,this.state.variables,this.state.context,this,r)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,D,null,t,this.state.context,r)),X(this,Ot,Xt).call(this,{type:"success",data:D}),D}catch(D){try{throw await((w=(x=C(this,Ae).config).onError)==null?void 0:w.call(x,D,t,this.state.context,this,r)),await((k=(S=this.options).onError)==null?void 0:k.call(S,D,t,this.state.context,r)),await((R=(P=C(this,Ae).config).onSettled)==null?void 0:R.call(P,void 0,D,this.state.variables,this.state.context,this,r)),await((_=(M=this.options).onSettled)==null?void 0:_.call(M,void 0,D,t,this.state.context,r)),D}finally{X(this,Ot,Xt).call(this,{type:"error",error:D})}}finally{C(this,Ae).runNext(this)}}},Ho=new WeakMap,Mt=new WeakMap,Ae=new WeakMap,Bn=new WeakMap,Ot=new WeakSet,Xt=function(t){const n=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=n(this.state),be.batch(()=>{C(this,Mt).forEach(r=>{r.onMutationUpdate(t)}),C(this,Ae).notify({mutation:this,type:"updated",action:t})})},rf);function $f(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var At,xt,Vo,of,am=(of=class extends Wn{constructor(t={}){super();G(this,At);G(this,xt);G(this,Vo);this.config=t,V(this,At,new Set),V(this,xt,new Map),V(this,Vo,0)}build(t,n,r){const o=new im({client:t,mutationCache:this,mutationId:++ui(this,Vo)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){C(this,At).add(t);const n=ci(t);if(typeof n=="string"){const r=C(this,xt).get(n);r?r.push(t):C(this,xt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,At).delete(t)){const n=ci(t);if(typeof n=="string"){const r=C(this,xt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&C(this,xt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ci(t);if(typeof n=="string"){const r=C(this,xt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=ci(t);if(typeof n=="string"){const o=(r=C(this,xt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){be.batch(()=>{C(this,At).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,At).clear(),C(this,xt).clear()})}getAll(){return Array.from(C(this,At))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Bu(n,r))}findAll(t={}){return this.getAll().filter(n=>Bu(t,n))}notify(t){be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return be.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ie))))}},At=new WeakMap,xt=new WeakMap,Vo=new WeakMap,of);function ci(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Kt,on,ze,Bt,Vt,Fi,Gs,af,sm=(af=class extends Wn{constructor(n,r){super();G(this,Vt);G(this,Kt);G(this,on);G(this,ze);G(this,Bt);V(this,Kt,n),this.setOptions(r),this.bindMethods(),X(this,Vt,Fi).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=C(this,Kt).defaultMutationOptions(n),Eo(this.options,r)||C(this,Kt).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,ze),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&vn(r.mutationKey)!==vn(this.options.mutationKey)?this.reset():((o=C(this,ze))==null?void 0:o.state.status)==="pending"&&C(this,ze).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=C(this,ze))==null||n.removeObserver(this)}onMutationUpdate(n){X(this,Vt,Fi).call(this),X(this,Vt,Gs).call(this,n)}getCurrentResult(){return C(this,on)}reset(){var n;(n=C(this,ze))==null||n.removeObserver(this),V(this,ze,void 0),X(this,Vt,Fi).call(this),X(this,Vt,Gs).call(this)}mutate(n,r){var o;return V(this,Bt,r),(o=C(this,ze))==null||o.removeObserver(this),V(this,ze,C(this,Kt).getMutationCache().build(C(this,Kt),this.options)),C(this,ze).addObserver(this),C(this,ze).execute(n)}},Kt=new WeakMap,on=new WeakMap,ze=new WeakMap,Bt=new WeakMap,Vt=new WeakSet,Fi=function(){var r;const n=((r=C(this,ze))==null?void 0:r.state)??$f();V(this,on,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Gs=function(n){be.batch(()=>{var r,o,i,a,s,l,u,h;if(C(this,Bt)&&this.hasListeners()){const c=C(this,on).variables,p=C(this,on).context,f={client:C(this,Kt),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((o=(r=C(this,Bt)).onSuccess)==null||o.call(r,n.data,c,p,f),(a=(i=C(this,Bt)).onSettled)==null||a.call(i,n.data,null,c,p,f)):(n==null?void 0:n.type)==="error"&&((l=(s=C(this,Bt)).onError)==null||l.call(s,n.error,c,p,f),(h=(u=C(this,Bt)).onSettled)==null||h.call(u,void 0,n.error,c,p,f))}this.listeners.forEach(c=>{c(C(this,on))})})},af);function Gu(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}function lm(e,t,n){const r=e.slice(0);return r[t]=n,r}var Pr,Ze,Rr,kr,lt,an,zo,Uo,qo,De,Qs,Ys,Xs,Zs,Js,sf,um=(sf=class extends Wn{constructor(t,n,r){super();G(this,De);G(this,Pr);G(this,Ze);G(this,Rr);G(this,kr);G(this,lt);G(this,an);G(this,zo);G(this,Uo);G(this,qo,[]);V(this,Pr,t),V(this,kr,r),V(this,Rr,[]),V(this,lt,[]),V(this,Ze,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&C(this,lt).forEach(t=>{t.subscribe(n=>{X(this,De,Zs).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,C(this,lt).forEach(t=>{t.destroy()})}setQueries(t,n){V(this,Rr,t),V(this,kr,n),be.batch(()=>{const r=C(this,lt),o=X(this,De,Xs).call(this,C(this,Rr));V(this,qo,o),o.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions));const i=o.map(c=>c.observer),a=i.map(c=>c.getCurrentResult()),s=r.length!==i.length,l=i.some((c,p)=>c!==r[p]),u=s||l,h=u?!0:a.some((c,p)=>{const f=C(this,Ze)[p];return!f||!Eo(c,f)});!u&&!h||(u&&V(this,lt,i),V(this,Ze,a),this.hasListeners()&&(u&&(Gu(r,i).forEach(c=>{c.destroy()}),Gu(i,r).forEach(c=>{c.subscribe(p=>{X(this,De,Zs).call(this,c,p)})})),X(this,De,Js).call(this)))})}getCurrentResult(){return C(this,Ze)}getQueries(){return C(this,lt).map(t=>t.getCurrentQuery())}getObservers(){return C(this,lt)}getOptimisticResult(t,n){const r=X(this,De,Xs).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>X(this,De,Ys).call(this,i??o,n),()=>X(this,De,Qs).call(this,o,r)]}},Pr=new WeakMap,Ze=new WeakMap,Rr=new WeakMap,kr=new WeakMap,lt=new WeakMap,an=new WeakMap,zo=new WeakMap,Uo=new WeakMap,qo=new WeakMap,De=new WeakSet,Qs=function(t,n){return n.map((r,o)=>{const i=t[o];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,a=>{n.forEach(s=>{s.observer.trackProp(a)})})})},Ys=function(t,n){return n?((!C(this,an)||C(this,Ze)!==C(this,Uo)||n!==C(this,zo))&&(V(this,zo,n),V(this,Uo,C(this,Ze)),V(this,an,Hl(C(this,an),n(t)))),C(this,an)):t},Xs=function(t){const n=new Map;C(this,lt).forEach(o=>{const i=o.options.queryHash;if(!i)return;const a=n.get(i);a?a.push(o):n.set(i,[o])});const r=[];return t.forEach(o=>{var l;const i=C(this,Pr).defaultQueryOptions(o),s=((l=n.get(i.queryHash))==null?void 0:l.shift())??new Wo(C(this,Pr),i);r.push({defaultedQueryOptions:i,observer:s})}),r},Zs=function(t,n){const r=C(this,lt).indexOf(t);r!==-1&&(V(this,Ze,lm(C(this,Ze),r,n)),X(this,De,Js).call(this))},Js=function(){var t;if(this.hasListeners()){const n=C(this,an),r=X(this,De,Qs).call(this,C(this,Ze),C(this,qo)),o=X(this,De,Ys).call(this,r,(t=C(this,kr))==null?void 0:t.combine);n!==o&&be.batch(()=>{this.listeners.forEach(i=>{i(C(this,Ze))})})}},sf),Tt,lf,cm=(lf=class extends Wn{constructor(t={}){super();G(this,Tt);this.config=t,V(this,Tt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Bl(o,n);let a=this.get(i);return a||(a=new em({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(a)),a}add(t){C(this,Tt).has(t.queryHash)||(C(this,Tt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=C(this,Tt).get(t.queryHash);n&&(t.destroy(),n===t&&C(this,Tt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){be.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,Tt).get(t)}getAll(){return[...C(this,Tt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ku(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Ku(t,r)):n}notify(t){be.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){be.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){be.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Tt=new WeakMap,lf),ve,sn,ln,Mr,Or,un,Tr,Dr,uf,dm=(uf=class{constructor(e={}){G(this,ve);G(this,sn);G(this,ln);G(this,Mr);G(this,Or);G(this,un);G(this,Tr);G(this,Dr);V(this,ve,e.queryCache||new cm),V(this,sn,e.mutationCache||new am),V(this,ln,e.defaultOptions||{}),V(this,Mr,new Map),V(this,Or,new Map),V(this,un,0)}mount(){ui(this,un)._++,C(this,un)===1&&(V(this,Tr,Vl.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,ve).onFocus())})),V(this,Dr,Vi.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,ve).onOnline())})))}unmount(){var e,t;ui(this,un)._--,C(this,un)===0&&((e=C(this,Tr))==null||e.call(this),V(this,Tr,void 0),(t=C(this,Dr))==null||t.call(this),V(this,Dr,void 0))}isFetching(e){return C(this,ve).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,sn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,ve).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=C(this,ve).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(hn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return C(this,ve).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=C(this,ve).get(r.queryHash),i=o==null?void 0:o.state.data,a=zg(t,i);if(a!==void 0)return C(this,ve).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return be.batch(()=>C(this,ve).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,ve).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=C(this,ve);be.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=C(this,ve);return be.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=be.batch(()=>C(this,ve).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Ie).catch(Ie)}invalidateQueries(e,t={}){return be.batch(()=>(C(this,ve).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=be.batch(()=>C(this,ve).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Ie)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Ie)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=C(this,ve).build(this,t);return n.isStaleByTime(hn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ie).catch(Ie)}fetchInfiniteQuery(e){return e.behavior=zi(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ie).catch(Ie)}ensureInfiniteQueryData(e){return e.behavior=zi(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Vi.isOnline()?C(this,sn).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,ve)}getMutationCache(){return C(this,sn)}getDefaultOptions(){return C(this,ln)}setDefaultOptions(e){V(this,ln,e)}setQueryDefaults(e,t){C(this,Mr).set(vn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,Mr).values()],n={};return t.forEach(r=>{So(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){C(this,Or).set(vn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(this,Or).values()],n={};return t.forEach(r=>{So(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...C(this,ln).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Bl(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===et&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,ln).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,ve).clear(),C(this,sn).clear()}},ve=new WeakMap,sn=new WeakMap,ln=new WeakMap,Mr=new WeakMap,Or=new WeakMap,un=new WeakMap,Tr=new WeakMap,Dr=new WeakMap,uf),Sf=E.createContext(void 0),Go=e=>{const t=E.useContext(Sf);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},fm=({client:e,children:t})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(Sf.Provider,{value:e,children:t})),Ef=E.createContext(!1),Pf=()=>E.useContext(Ef);Ef.Provider;function hm(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pm=E.createContext(hm()),Rf=()=>E.useContext(pm),kf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Mf=e=>{E.useEffect(()=>{e.clearReset()},[e])},Of=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||gf(n,[e.error,r])),Ul=(e,t)=>t.state.data===void 0,Tf=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Df=(e,t)=>e.isLoading&&e.isFetching&&!t,el=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Ui=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function _f({queries:e,...t},n){const r=Go(n),o=Pf(),i=Rf(),a=E.useMemo(()=>e.map(m=>{const v=r.defaultQueryOptions(m);return v._optimisticResults=o?"isRestoring":"optimistic",v}),[e,r,o]);a.forEach(m=>{Tf(m),kf(m,i)}),Mf(i);const[s]=E.useState(()=>new um(r,a,t)),[l,u,h]=s.getOptimisticResult(a,t.combine),c=!o&&t.subscribed!==!1;E.useSyncExternalStore(E.useCallback(m=>c?s.subscribe(be.batchCalls(m)):Ie,[s,c]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),E.useEffect(()=>{s.setQueries(a,t)},[a,t,s]);const f=l.some((m,v)=>el(a[v],m))?l.flatMap((m,v)=>{const b=a[v];if(b){const x=new Wo(r,b);if(el(b,m))return Ui(b,x,i);Df(m,o)&&Ui(b,x,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const g=l.find((m,v)=>{const b=a[v];return b&&Of({result:m,errorResetBoundary:i,throwOnError:b.throwOnError,query:r.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(g!=null&&g.error)throw g.error;return u(h())}function xa(e,t,n){var c,p,f,g,m;const r=Pf(),o=Rf(),i=Go(n),a=i.defaultQueryOptions(e);(p=(c=i.getDefaultOptions().queries)==null?void 0:c._experimental_beforeQuery)==null||p.call(c,a),a._optimisticResults=r?"isRestoring":"optimistic",Tf(a),kf(a,o),Mf(o);const s=!i.getQueryCache().get(a.queryHash),[l]=E.useState(()=>new t(i,a)),u=l.getOptimisticResult(a),h=!r&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(v=>{const b=h?l.subscribe(be.batchCalls(v)):Ie;return l.updateResult(),b},[l,h]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),E.useEffect(()=>{l.setOptions(a)},[a,l]),el(a,u))throw Ui(a,l,o);if(Of({result:u,errorResetBoundary:o,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw u.error;if((g=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||g.call(f,a,u),a.experimental_prefetchInRender&&!Hn&&Df(u,r)){const v=s?Ui(a,l,o):(m=i.getQueryCache().get(a.queryHash))==null?void 0:m.promise;v==null||v.catch(Ie).finally(()=>{l.updateResult()})}return a.notifyOnChangeProps?u:l.trackResult(u)}function gm(e,t){return xa(e,Wo,t)}function mm(e,t){return xa({...e,enabled:!0,suspense:!0,throwOnError:Ul,placeholderData:void 0},Wo,t)}function vm(e,t){return xa({...e,enabled:!0,suspense:!0,throwOnError:Ul},Cf,t)}function bm(e,t){return _f({...e,queries:e.queries.map(n=>({...n,suspense:!0,throwOnError:Ul,enabled:!0,placeholderData:void 0}))},t)}function ym(e,t){const n=Go(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function xm(e,t){const n=Go(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function wm(e,t){const n=Go(t),[r]=E.useState(()=>new sm(n,e));E.useEffect(()=>{r.setOptions(e)},[r,e]);const o=E.useSyncExternalStore(E.useCallback(a=>r.subscribe(be.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=E.useCallback((a,s)=>{r.mutate(a,s).catch(Ie)},[r]);if(o.error&&gf(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}function Cm(e,t){return xa(e,Cf,t)}var $m=Object.create,Lf=Object.defineProperty,Sm=Object.getOwnPropertyDescriptor,Ff=Object.getOwnPropertyNames,Em=Object.getPrototypeOf,Pm=Object.prototype.hasOwnProperty,Dt=(e,t)=>function(){return t||(0,e[Ff(e)[0]])((t={exports:{}}).exports,t),t.exports},Rm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=Ff(t),i=0,a=o.length,s;i<a;i++)s=o[i],!Pm.call(e,s)&&s!==n&&Lf(e,s,{get:(l=>t[l]).bind(null,s),enumerable:!(r=Sm(t,s))||r.enumerable});return e},Ce=(e,t,n)=>(n=e!=null?$m(Em(e)):{},Rm(Lf(n,"default",{value:e,enumerable:!0}),e)),If=Dt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function n(r){"@babel/helpers - typeof";return t.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t.exports.__esModule=!0,t.exports.default=t.exports,n(r)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),km=Dt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var n=If().default;function r(o,i){if(n(o)!="object"||!o)return o;var a=o[Symbol.toPrimitive];if(a!==void 0){var s=a.call(o,i||"default");if(n(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(o)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Mm=Dt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var n=If().default,r=km();function o(i){var a=r(i,"string");return n(a)=="symbol"?a:a+""}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),Gn=Dt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var n=Mm();function r(o,i,a){return(i=n(i))in o?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,o}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),St=Dt({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var n=Gn();function r(i,a){var s=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);a&&(l=l.filter(function(u){return Object.getOwnPropertyDescriptor(i,u).enumerable})),s.push.apply(s,l)}return s}function o(i){for(var a=1;a<arguments.length;a++){var s=arguments[a]!=null?arguments[a]:{};a%2?r(Object(s),!0).forEach(function(l){n(i,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(s)):r(Object(s)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(s,l))})}retu