UNPKG

@queuedash/ui

Version:

A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue

9 lines 560 kB
"use strict";var cu=e=>{throw TypeError(e)};var Sa=(e,t,n)=>t.has(e)||cu("Cannot "+n);var C=(e,t,n)=>(Sa(e,t,"read from private field"),n?n.call(e):t.get(e)),z=(e,t,n)=>t.has(e)?cu("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),B=(e,t,n,r)=>(Sa(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),G=(e,t,n)=>(Sa(e,t,"access private method"),n);var Ki=(e,t,n,r)=>({set _(i){B(e,t,i,n)},get _(){return C(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),Lr=require("react-dom");function Hg(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 $=Hg(d);function Id(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nd={exports:{}},Yo={};/** * @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 Vg=Symbol.for("react.transitional.element"),zg=Symbol.for("react.fragment");function Ad(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 i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:Vg,type:e,key:r,ref:t!==void 0?t:null,props:n}}Yo.Fragment=zg;Yo.jsx=Ad;Yo.jsxs=Ad;Nd.exports=Yo;var y=Nd.exports,jn=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(){}},Ln=typeof window>"u"||"Deno"in globalThis;function ke(){}function Ug(e,t){return typeof e=="function"?e(t):e}function os(e){return typeof e=="number"&&e>=0&&e!==1/0}function _d(e,t){return Math.max(e+(t||0)-Date.now(),0)}function or(e,t){return typeof e=="function"?e(t):e}function gt(e,t){return typeof e=="function"?e(t):e}function du(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:a,stale:s}=e;if(a){if(r){if(t.queryHash!==cl(a,t.options))return!1}else if(!li(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||i&&i!==t.state.fetchStatus||o&&!o(t))}function fu(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(cn(t.options.mutationKey)!==cn(o))return!1}else if(!li(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function cl(e,t){return((t==null?void 0:t.queryKeyHashFn)||cn)(e)}function cn(e){return JSON.stringify(e,(t,n)=>as(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function li(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>li(e[n],t[n])):!1}function dl(e,t){if(e===t)return e;const n=hu(e)&&hu(t);if(n||as(e)&&as(t)){const r=n?e:Object.keys(e),i=r.length,o=n?t:Object.keys(t),a=o.length,s=n?[]:{};let l=0;for(let u=0;u<a;u++){const g=n?u:o[u];(!n&&r.includes(g)||n)&&e[g]===void 0&&t[g]===void 0?(s[g]=void 0,l++):(s[g]=dl(e[g],t[g]),s[g]===e[g]&&e[g]!==void 0&&l++)}return i===a&&l===i?e:s}return t}function bo(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 as(e){if(!gu(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!gu(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function gu(e){return Object.prototype.toString.call(e)==="[object Object]"}function Wg(e){return new Promise(t=>{setTimeout(t,e)})}function ss(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?dl(e,t):t}function qg(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 Ue=Symbol();function jd(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Ue?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Kd(e,t){return typeof e=="function"?e(...t):!!e}var En,Wt,cr,bd,Qg=(bd=class extends jn{constructor(){super();z(this,En);z(this,Wt);z(this,cr);B(this,cr,t=>{if(!Ln&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){C(this,Wt)||this.setEventListener(C(this,cr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,Wt))==null||t.call(this),B(this,Wt,void 0))}setEventListener(t){var n;B(this,cr,t),(n=C(this,Wt))==null||n.call(this),B(this,Wt,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){C(this,En)!==t&&(B(this,En,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof C(this,En)=="boolean"?C(this,En):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},En=new WeakMap,Wt=new WeakMap,cr=new WeakMap,bd),fl=new Qg,dr,qt,fr,vd,Yg=(vd=class extends jn{constructor(){super();z(this,dr,!0);z(this,qt);z(this,fr);B(this,fr,t=>{if(!Ln&&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,qt)||this.setEventListener(C(this,fr))}onUnsubscribe(){var t;this.hasListeners()||((t=C(this,qt))==null||t.call(this),B(this,qt,void 0))}setEventListener(t){var n;B(this,fr,t),(n=C(this,qt))==null||n.call(this),B(this,qt,t(this.setOnline.bind(this)))}setOnline(t){C(this,dr)!==t&&(B(this,dr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return C(this,dr)}},dr=new WeakMap,qt=new WeakMap,fr=new WeakMap,vd),vo=new Yg;function ls(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function Xg(e){return Math.min(1e3*2**e,3e4)}function Bd(e){return(e??"online")==="online"?vo.isOnline():!0}var Hd=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function $a(e){return e instanceof Hd}function Vd(e){let t=!1,n=0,r=!1,i;const o=ls(),a=m=>{var b;r||(h(new Hd(m)),(b=e.abort)==null||b.call(e))},s=()=>{t=!0},l=()=>{t=!1},u=()=>fl.isFocused()&&(e.networkMode==="always"||vo.isOnline())&&e.canRun(),g=()=>Bd(e.networkMode)&&e.canRun(),c=m=>{var b;r||(r=!0,(b=e.onSuccess)==null||b.call(e,m),i==null||i(),o.resolve(m))},h=m=>{var b;r||(r=!0,(b=e.onError)==null||b.call(e,m),i==null||i(),o.reject(m))},f=()=>new Promise(m=>{var b;i=v=>{(r||u())&&m(v)},(b=e.onPause)==null||b.call(e)}).then(()=>{var m;i=void 0,r||(m=e.onContinue)==null||m.call(e)}),p=()=>{if(r)return;let m;const b=n===0?e.initialPromise:void 0;try{m=b??e.fn()}catch(v){m=Promise.reject(v)}Promise.resolve(m).then(c).catch(v=>{var R;if(r)return;const w=e.retry??(Ln?0:3),x=e.retryDelay??Xg,k=typeof x=="function"?x(n,v):x,S=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,v);if(t||!S){h(v);return}n++,(R=e.onFail)==null||R.call(e,n,v),Wg(k).then(()=>u()?void 0:f()).then(()=>{t?h(v):p()})})};return{promise:o,cancel:a,continue:()=>(i==null||i(),o),cancelRetry:s,continueRetry:l,canStart:g,start:()=>(g()?p():f().then(p),o)}}var Zg=e=>setTimeout(e,0);function Jg(){let e=[],t=0,n=s=>{s()},r=s=>{s()},i=Zg;const o=s=>{t?e.push(s):i(()=>{n(s)})},a=()=>{const s=e;e=[],s.length&&i(()=>{r(()=>{s.forEach(l=>{n(l)})})})};return{batch:s=>{let l;t++;try{l=s()}finally{t--,t||a()}return l},batchCalls:s=>(...l)=>{o(()=>{s(...l)})},schedule:o,setNotifyFunction:s=>{n=s},setBatchNotifyFunction:s=>{r=s},setScheduler:s=>{i=s}}}var ge=Jg(),Pn,yd,zd=(yd=class{constructor(){z(this,Pn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),os(this.gcTime)&&B(this,Pn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ln?1/0:5*60*1e3))}clearGcTimeout(){C(this,Pn)&&(clearTimeout(C(this,Pn)),B(this,Pn,void 0))}},Pn=new WeakMap,yd),hr,gr,tt,Rn,Me,xi,Mn,dt,Ft,wd,ep=(wd=class extends zd{constructor(t){super();z(this,dt);z(this,hr);z(this,gr);z(this,tt);z(this,Rn);z(this,Me);z(this,xi);z(this,Mn);B(this,Mn,!1),B(this,xi,t.defaultOptions),this.setOptions(t.options),this.observers=[],B(this,Rn,t.client),B(this,tt,C(this,Rn).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,B(this,hr,tp(this.options)),this.state=t.state??C(this,hr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=C(this,Me))==null?void 0:t.promise}setOptions(t){this.options={...C(this,xi),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,tt).remove(this)}setData(t,n){const r=ss(this.state.data,t,this.options);return G(this,dt,Ft).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){G(this,dt,Ft).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=C(this,Me))==null?void 0:r.promise;return(i=C(this,Me))==null||i.cancel(t),n?n.then(ke).catch(ke):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(C(this,hr))}isActive(){return this.observers.some(t=>gt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ue||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!_d(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,Me))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=C(this,Me))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),C(this,tt).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,Me)&&(C(this,Mn)?C(this,Me).cancel({revert:!0}):C(this,Me).cancelRetry()),this.scheduleGc()),C(this,tt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||G(this,dt,Ft).call(this,{type:"invalidate"})}fetch(t,n){var l,u,g;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(C(this,Me))return C(this,Me).continueRetry(),C(this,Me).promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(h=>h.options.queryFn);c&&this.setOptions(c.options)}const r=new AbortController,i=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(B(this,Mn,!0),r.signal)})},o=()=>{const c=jd(this.options,n),h={client:C(this,Rn),queryKey:this.queryKey,meta:this.meta};return i(h),B(this,Mn,!1),this.options.persister?this.options.persister(c,h,this):c(h)},a={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:C(this,Rn),state:this.state,fetchFn:o};i(a),(l=this.options.behavior)==null||l.onFetch(a,this),B(this,gr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&G(this,dt,Ft).call(this,{type:"fetch",meta:(g=a.fetchOptions)==null?void 0:g.meta});const s=c=>{var h,f,p,m;$a(c)&&c.silent||G(this,dt,Ft).call(this,{type:"error",error:c}),$a(c)||((f=(h=C(this,tt).config).onError)==null||f.call(h,c,this),(m=(p=C(this,tt).config).onSettled)==null||m.call(p,this.state.data,c,this)),this.scheduleGc()};return B(this,Me,Vd({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:c=>{var h,f,p,m;if(c===void 0){s(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(b){s(b);return}(f=(h=C(this,tt).config).onSuccess)==null||f.call(h,c,this),(m=(p=C(this,tt).config).onSettled)==null||m.call(p,c,this.state.error,this),this.scheduleGc()},onError:s,onFail:(c,h)=>{G(this,dt,Ft).call(this,{type:"failed",failureCount:c,error:h})},onPause:()=>{G(this,dt,Ft).call(this,{type:"pause"})},onContinue:()=>{G(this,dt,Ft).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0})),C(this,Me).start()}},hr=new WeakMap,gr=new WeakMap,tt=new WeakMap,Rn=new WeakMap,Me=new WeakMap,xi=new WeakMap,Mn=new WeakMap,dt=new WeakSet,Ft=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,...Ud(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return $a(i)&&i.revert&&C(this,gr)?{...C(this,gr),fetchStatus:"idle"}:{...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),ge.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),C(this,tt).notify({query:this,type:"updated",action:t})})},wd);function Ud(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bd(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function tp(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 $t,xd,np=(xd=class extends jn{constructor(t={}){super();z(this,$t);this.config=t,B(this,$t,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??cl(i,n);let a=this.get(o);return a||(a=new ep({client:t,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(a)),a}add(t){C(this,$t).has(t.queryHash)||(C(this,$t).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=C(this,$t).get(t.queryHash);n&&(t.destroy(),n===t&&C(this,$t).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){ge.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return C(this,$t).get(t)}getAll(){return[...C(this,$t).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>du(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>du(t,r)):n}notify(t){ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){ge.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){ge.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},$t=new WeakMap,xd),Et,Oe,kn,Pt,zt,Cd,rp=(Cd=class extends zd{constructor(t){super();z(this,Pt);z(this,Et);z(this,Oe);z(this,kn);this.mutationId=t.mutationId,B(this,Oe,t.mutationCache),B(this,Et,[]),this.state=t.state||Wd(),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,Et).includes(t)||(C(this,Et).push(t),this.clearGcTimeout(),C(this,Oe).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){B(this,Et,C(this,Et).filter(n=>n!==t)),this.scheduleGc(),C(this,Oe).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){C(this,Et).length||(this.state.status==="pending"?this.scheduleGc():C(this,Oe).remove(this))}continue(){var t;return((t=C(this,kn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,a,s,l,u,g,c,h,f,p,m,b,v,w,x,k,S,R,P,I;const n=()=>{G(this,Pt,zt).call(this,{type:"continue"})};B(this,kn,Vd({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(D,L)=>{G(this,Pt,zt).call(this,{type:"failed",failureCount:D,error:L})},onPause:()=>{G(this,Pt,zt).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,Oe).canRun(this)}));const r=this.state.status==="pending",i=!C(this,kn).canStart();try{if(r)n();else{G(this,Pt,zt).call(this,{type:"pending",variables:t,isPaused:i}),await((a=(o=C(this,Oe).config).onMutate)==null?void 0:a.call(o,t,this));const L=await((l=(s=this.options).onMutate)==null?void 0:l.call(s,t));L!==this.state.context&&G(this,Pt,zt).call(this,{type:"pending",context:L,variables:t,isPaused:i})}const D=await C(this,kn).start();return await((g=(u=C(this,Oe).config).onSuccess)==null?void 0:g.call(u,D,t,this.state.context,this)),await((h=(c=this.options).onSuccess)==null?void 0:h.call(c,D,t,this.state.context)),await((p=(f=C(this,Oe).config).onSettled)==null?void 0:p.call(f,D,null,this.state.variables,this.state.context,this)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,D,null,t,this.state.context)),G(this,Pt,zt).call(this,{type:"success",data:D}),D}catch(D){try{throw await((w=(v=C(this,Oe).config).onError)==null?void 0:w.call(v,D,t,this.state.context,this)),await((k=(x=this.options).onError)==null?void 0:k.call(x,D,t,this.state.context)),await((R=(S=C(this,Oe).config).onSettled)==null?void 0:R.call(S,void 0,D,this.state.variables,this.state.context,this)),await((I=(P=this.options).onSettled)==null?void 0:I.call(P,void 0,D,t,this.state.context)),D}finally{G(this,Pt,zt).call(this,{type:"error",error:D})}}finally{C(this,Oe).runNext(this)}}},Et=new WeakMap,Oe=new WeakMap,kn=new WeakMap,Pt=new WeakSet,zt=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),ge.batch(()=>{C(this,Et).forEach(r=>{r.onMutationUpdate(t)}),C(this,Oe).notify({mutation:this,type:"updated",action:t})})},Cd);function Wd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,ft,Ci,Sd,ip=(Sd=class extends jn{constructor(t={}){super();z(this,It);z(this,ft);z(this,Ci);this.config=t,B(this,It,new Set),B(this,ft,new Map),B(this,Ci,0)}build(t,n,r){const i=new rp({mutationCache:this,mutationId:++Ki(this,Ci)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){C(this,It).add(t);const n=Bi(t);if(typeof n=="string"){const r=C(this,ft).get(n);r?r.push(t):C(this,ft).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(C(this,It).delete(t)){const n=Bi(t);if(typeof n=="string"){const r=C(this,ft).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&C(this,ft).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Bi(t);if(typeof n=="string"){const r=C(this,ft).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=Bi(t);if(typeof n=="string"){const i=(r=C(this,ft).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){ge.batch(()=>{C(this,It).forEach(t=>{this.notify({type:"removed",mutation:t})}),C(this,It).clear(),C(this,ft).clear()})}getAll(){return Array.from(C(this,It))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>fu(n,r))}findAll(t={}){return this.getAll().filter(n=>fu(t,n))}notify(t){ge.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return ge.batch(()=>Promise.all(t.map(n=>n.continue().catch(ke))))}},It=new WeakMap,ft=new WeakMap,Ci=new WeakMap,Sd);function Bi(e){var t;return(t=e.options.scope)==null?void 0:t.id}function yo(e){return{onFetch:(t,n)=>{var g,c,h,f,p;const r=t.options,i=(h=(c=(g=t.fetchOptions)==null?void 0:g.meta)==null?void 0:c.fetchMore)==null?void 0:h.direction,o=((f=t.state.data)==null?void 0:f.pages)||[],a=((p=t.state.data)==null?void 0:p.pageParams)||[];let s={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const b=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},v=jd(t.options,t.fetchOptions),w=async(x,k,S)=>{if(m)return Promise.reject();if(k==null&&x.pages.length)return Promise.resolve(x);const R={client:t.client,queryKey:t.queryKey,pageParam:k,direction:S?"backward":"forward",meta:t.options.meta};b(R);const P=await v(R),{maxPages:I}=t.options,D=S?Gg:qg;return{pages:D(x.pages,P,I),pageParams:D(x.pageParams,k,I)}};if(i&&o.length){const x=i==="backward",k=x?qd:us,S={pages:o,pageParams:a},R=k(r,S);s=await w(S,R,x)}else{const x=e??o.length;do{const k=l===0?a[0]??r.initialPageParam:us(r,s);if(l>0&&k==null)break;s=await w(s,k),l++}while(l<x)}return s};t.options.persister?t.fetchFn=()=>{var m,b;return(b=(m=t.options).persister)==null?void 0:b.call(m,u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function us(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 qd(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 op(e,t){return t?us(e,t)!=null:!1}function ap(e,t){return!t||!e.getPreviousPageParam?!1:qd(e,t)!=null}var he,Gt,Qt,pr,mr,Yt,br,vr,$d,sp=($d=class{constructor(e={}){z(this,he);z(this,Gt);z(this,Qt);z(this,pr);z(this,mr);z(this,Yt);z(this,br);z(this,vr);B(this,he,e.queryCache||new np),B(this,Gt,e.mutationCache||new ip),B(this,Qt,e.defaultOptions||{}),B(this,pr,new Map),B(this,mr,new Map),B(this,Yt,0)}mount(){Ki(this,Yt)._++,C(this,Yt)===1&&(B(this,br,fl.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,he).onFocus())})),B(this,vr,vo.subscribe(async e=>{e&&(await this.resumePausedMutations(),C(this,he).onOnline())})))}unmount(){var e,t;Ki(this,Yt)._--,C(this,Yt)===0&&((e=C(this,br))==null||e.call(this),B(this,br,void 0),(t=C(this,vr))==null||t.call(this),B(this,vr,void 0))}isFetching(e){return C(this,he).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return C(this,Gt).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=C(this,he).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=C(this,he).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(or(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return C(this,he).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=C(this,he).get(r.queryHash),o=i==null?void 0:i.state.data,a=Ug(t,o);if(a!==void 0)return C(this,he).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ge.batch(()=>C(this,he).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,he).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=C(this,he);ge.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=C(this,he);return ge.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=ge.batch(()=>C(this,he).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(ke).catch(ke)}invalidateQueries(e,t={}){return ge.batch(()=>(C(this,he).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=ge.batch(()=>C(this,he).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(ke)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(ke)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=C(this,he).build(this,t);return n.isStaleByTime(or(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ke).catch(ke)}fetchInfiniteQuery(e){return e.behavior=yo(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ke).catch(ke)}ensureInfiniteQueryData(e){return e.behavior=yo(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return vo.isOnline()?C(this,Gt).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,he)}getMutationCache(){return C(this,Gt)}getDefaultOptions(){return C(this,Qt)}setDefaultOptions(e){B(this,Qt,e)}setQueryDefaults(e,t){C(this,pr).set(cn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...C(this,pr).values()],n={};return t.forEach(r=>{li(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){C(this,mr).set(cn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...C(this,mr).values()],n={};return t.forEach(r=>{li(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...C(this,Qt).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=cl(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===Ue&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...C(this,Qt).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){C(this,he).clear(),C(this,Gt).clear()}},he=new WeakMap,Gt=new WeakMap,Qt=new WeakMap,pr=new WeakMap,mr=new WeakMap,Yt=new WeakMap,br=new WeakMap,vr=new WeakMap,$d),Ie,J,Si,De,On,yr,Xt,Zt,$i,wr,xr,Dn,Tn,Jt,Cr,ie,Zr,cs,ds,fs,hs,gs,ps,ms,Gd,Ed,Mi=(Ed=class extends jn{constructor(t,n){super();z(this,ie);z(this,Ie);z(this,J);z(this,Si);z(this,De);z(this,On);z(this,yr);z(this,Xt);z(this,Zt);z(this,$i);z(this,wr);z(this,xr);z(this,Dn);z(this,Tn);z(this,Jt);z(this,Cr,new Set);this.options=n,B(this,Ie,t),B(this,Zt,null),B(this,Xt,ls()),this.options.experimental_prefetchInRender||C(this,Xt).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,J).addObserver(this),pu(C(this,J),this.options)?G(this,ie,Zr).call(this):this.updateResult(),G(this,ie,hs).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bs(C(this,J),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bs(C(this,J),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,G(this,ie,gs).call(this),G(this,ie,ps).call(this),C(this,J).removeObserver(this)}setOptions(t){const n=this.options,r=C(this,J);if(this.options=C(this,Ie).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof gt(this.options.enabled,C(this,J))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");G(this,ie,ms).call(this),C(this,J).setOptions(this.options),n._defaulted&&!bo(this.options,n)&&C(this,Ie).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,J),observer:this});const i=this.hasListeners();i&&mu(C(this,J),r,this.options,n)&&G(this,ie,Zr).call(this),this.updateResult(),i&&(C(this,J)!==r||gt(this.options.enabled,C(this,J))!==gt(n.enabled,C(this,J))||or(this.options.staleTime,C(this,J))!==or(n.staleTime,C(this,J)))&&G(this,ie,cs).call(this);const o=G(this,ie,ds).call(this);i&&(C(this,J)!==r||gt(this.options.enabled,C(this,J))!==gt(n.enabled,C(this,J))||o!==C(this,Jt))&&G(this,ie,fs).call(this,o)}getOptimisticResult(t){const n=C(this,Ie).getQueryCache().build(C(this,Ie),t),r=this.createResult(n,t);return up(this,r)&&(B(this,De,r),B(this,yr,this.options),B(this,On,C(this,J).state)),r}getCurrentResult(){return C(this,De)}trackResult(t,n){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),n==null||n(i),Reflect.get(r,i))})}trackProp(t){C(this,Cr).add(t)}getCurrentQuery(){return C(this,J)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=C(this,Ie).defaultQueryOptions(t),r=C(this,Ie).getQueryCache().build(C(this,Ie),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return G(this,ie,Zr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,De)))}createResult(t,n){var D;const r=C(this,J),i=this.options,o=C(this,De),a=C(this,On),s=C(this,yr),u=t!==r?t.state:C(this,Si),{state:g}=t;let c={...g},h=!1,f;if(n._optimisticResults){const L=this.hasListeners(),E=!L&&pu(t,n),N=L&&mu(t,r,n,i);(E||N)&&(c={...c,...Ud(g.data,t.options)}),n._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:b}=c;f=c.data;let v=!1;if(n.placeholderData!==void 0&&f===void 0&&b==="pending"){let L;o!=null&&o.isPlaceholderData&&n.placeholderData===(s==null?void 0:s.placeholderData)?(L=o.data,v=!0):L=typeof n.placeholderData=="function"?n.placeholderData((D=C(this,xr))==null?void 0:D.state.data,C(this,xr)):n.placeholderData,L!==void 0&&(b="success",f=ss(o==null?void 0:o.data,L,n),h=!0)}if(n.select&&f!==void 0&&!v)if(o&&f===(a==null?void 0:a.data)&&n.select===C(this,$i))f=C(this,wr);else try{B(this,$i,n.select),f=n.select(f),f=ss(o==null?void 0:o.data,f,n),B(this,wr,f),B(this,Zt,null)}catch(L){B(this,Zt,L)}C(this,Zt)&&(p=C(this,Zt),f=C(this,wr),m=Date.now(),b="error");const w=c.fetchStatus==="fetching",x=b==="pending",k=b==="error",S=x&&w,R=f!==void 0,I={status:b,fetchStatus:c.fetchStatus,isPending:x,isSuccess:b==="success",isError:k,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:c.dataUpdatedAt,error:p,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:w,isRefetching:w&&!x,isLoadingError:k&&!R,isPaused:c.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:k&&R,isStale:hl(t,n),refetch:this.refetch,promise:C(this,Xt)};if(this.options.experimental_prefetchInRender){const L=_=>{I.status==="error"?_.reject(I.error):I.data!==void 0&&_.resolve(I.data)},E=()=>{const _=B(this,Xt,I.promise=ls());L(_)},N=C(this,Xt);switch(N.status){case"pending":t.queryHash===r.queryHash&&L(N);break;case"fulfilled":(I.status==="error"||I.data!==N.value)&&E();break;case"rejected":(I.status!=="error"||I.error!==N.reason)&&E();break}}return I}updateResult(){const t=C(this,De),n=this.createResult(C(this,J),this.options);if(B(this,On,C(this,J).state),B(this,yr,this.options),C(this,On).data!==void 0&&B(this,xr,C(this,J)),bo(n,t))return;B(this,De,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!C(this,Cr).size)return!0;const a=new Set(o??C(this,Cr));return this.options.throwOnError&&a.add("error"),Object.keys(C(this,De)).some(s=>{const l=s;return C(this,De)[l]!==t[l]&&a.has(l)})};G(this,ie,Gd).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&G(this,ie,hs).call(this)}},Ie=new WeakMap,J=new WeakMap,Si=new WeakMap,De=new WeakMap,On=new WeakMap,yr=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,$i=new WeakMap,wr=new WeakMap,xr=new WeakMap,Dn=new WeakMap,Tn=new WeakMap,Jt=new WeakMap,Cr=new WeakMap,ie=new WeakSet,Zr=function(t){G(this,ie,ms).call(this);let n=C(this,J).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ke)),n},cs=function(){G(this,ie,gs).call(this);const t=or(this.options.staleTime,C(this,J));if(Ln||C(this,De).isStale||!os(t))return;const r=_d(C(this,De).dataUpdatedAt,t)+1;B(this,Dn,setTimeout(()=>{C(this,De).isStale||this.updateResult()},r))},ds=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,J)):this.options.refetchInterval)??!1},fs=function(t){G(this,ie,ps).call(this),B(this,Jt,t),!(Ln||gt(this.options.enabled,C(this,J))===!1||!os(C(this,Jt))||C(this,Jt)===0)&&B(this,Tn,setInterval(()=>{(this.options.refetchIntervalInBackground||fl.isFocused())&&G(this,ie,Zr).call(this)},C(this,Jt)))},hs=function(){G(this,ie,cs).call(this),G(this,ie,fs).call(this,G(this,ie,ds).call(this))},gs=function(){C(this,Dn)&&(clearTimeout(C(this,Dn)),B(this,Dn,void 0))},ps=function(){C(this,Tn)&&(clearInterval(C(this,Tn)),B(this,Tn,void 0))},ms=function(){const t=C(this,Ie).getQueryCache().build(C(this,Ie),this.options);if(t===C(this,J))return;const n=C(this,J);B(this,J,t),B(this,Si,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Gd=function(t){ge.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(C(this,De))}),C(this,Ie).getQueryCache().notify({query:C(this,J),type:"observerResultsUpdated"})})},Ed);function lp(e,t){return gt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function pu(e,t){return lp(e,t)||e.state.data!==void 0&&bs(e,t,t.refetchOnMount)}function bs(e,t,n){if(gt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&hl(e,t)}return!1}function mu(e,t,n,r){return(e!==t||gt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&hl(e,n)}function hl(e,t){return gt(t.enabled,e)!==!1&&e.isStaleByTime(or(t.staleTime,e))}function up(e,t){return!bo(e.getCurrentResult(),t)}function bu(e,t){return e.filter(n=>!t.includes(n))}function cp(e,t,n){const r=e.slice(0);return r[t]=n,r}var Sr,nt,$r,Er,rt,en,Ei,Pi,Ri,Ee,vs,ys,ws,xs,Cs,Pd,dp=(Pd=class extends jn{constructor(t,n,r){super();z(this,Ee);z(this,Sr);z(this,nt);z(this,$r);z(this,Er);z(this,rt);z(this,en);z(this,Ei);z(this,Pi);z(this,Ri,[]);B(this,Sr,t),B(this,Er,r),B(this,$r,[]),B(this,rt,[]),B(this,nt,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&C(this,rt).forEach(t=>{t.subscribe(n=>{G(this,Ee,xs).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,C(this,rt).forEach(t=>{t.destroy()})}setQueries(t,n){B(this,$r,t),B(this,Er,n),ge.batch(()=>{const r=C(this,rt),i=G(this,Ee,ws).call(this,C(this,$r));B(this,Ri,i),i.forEach(l=>l.observer.setOptions(l.defaultedQueryOptions));const o=i.map(l=>l.observer),a=o.map(l=>l.getCurrentResult()),s=o.some((l,u)=>l!==r[u]);r.length===o.length&&!s||(B(this,rt,o),B(this,nt,a),this.hasListeners()&&(bu(r,o).forEach(l=>{l.destroy()}),bu(o,r).forEach(l=>{l.subscribe(u=>{G(this,Ee,xs).call(this,l,u)})}),G(this,Ee,Cs).call(this)))})}getCurrentResult(){return C(this,nt)}getQueries(){return C(this,rt).map(t=>t.getCurrentQuery())}getObservers(){return C(this,rt)}getOptimisticResult(t,n){const r=G(this,Ee,ws).call(this,t),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions));return[i,o=>G(this,Ee,ys).call(this,o??i,n),()=>G(this,Ee,vs).call(this,i,r)]}},Sr=new WeakMap,nt=new WeakMap,$r=new WeakMap,Er=new WeakMap,rt=new WeakMap,en=new WeakMap,Ei=new WeakMap,Pi=new WeakMap,Ri=new WeakMap,Ee=new WeakSet,vs=function(t,n){return n.map((r,i)=>{const o=t[i];return r.defaultedQueryOptions.notifyOnChangeProps?o:r.observer.trackResult(o,a=>{n.forEach(s=>{s.observer.trackProp(a)})})})},ys=function(t,n){return n?((!C(this,en)||C(this,nt)!==C(this,Pi)||n!==C(this,Ei))&&(B(this,Ei,n),B(this,Pi,C(this,nt)),B(this,en,dl(C(this,en),n(t)))),C(this,en)):t},ws=function(t){const n=new Map(C(this,rt).map(i=>[i.options.queryHash,i])),r=[];return t.forEach(i=>{const o=C(this,Sr).defaultQueryOptions(i),a=n.get(o.queryHash);a?r.push({defaultedQueryOptions:o,observer:a}):r.push({defaultedQueryOptions:o,observer:new Mi(C(this,Sr),o)})}),r},xs=function(t,n){const r=C(this,rt).indexOf(t);r!==-1&&(B(this,nt,cp(C(this,nt),r,n)),G(this,Ee,Cs).call(this))},Cs=function(){var t;if(this.hasListeners()){const n=C(this,en),r=G(this,Ee,vs).call(this,C(this,nt),C(this,Ri)),i=G(this,Ee,ys).call(this,r,(t=C(this,Er))==null?void 0:t.combine);n!==i&&ge.batch(()=>{this.listeners.forEach(o=>{o(C(this,nt))})})}},Pd),Qd=class extends Mi{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:yo()})}getOptimisticResult(e){return e.behavior=yo(),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 p,m;const{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:o,isError:a,isRefetchError:s}=r,l=(m=(p=n.fetchMeta)==null?void 0:p.fetchMore)==null?void 0:m.direction,u=a&&l==="forward",g=i&&l==="forward",c=a&&l==="backward",h=i&&l==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:op(t,n.data),hasPreviousPage:ap(t,n.data),isFetchNextPageError:u,isFetchingNextPage:g,isFetchPreviousPageError:c,isFetchingPreviousPage:h,isRefetchError:s&&!u&&!c,isRefetching:o&&!g&&!h}}},tn,nn,Ne,Nt,_t,lo,Ss,Rd,fp=(Rd=class extends jn{constructor(n,r){super();z(this,_t);z(this,tn);z(this,nn);z(this,Ne);z(this,Nt);B(this,tn,n),this.setOptions(r),this.bindMethods(),G(this,_t,lo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=C(this,tn).defaultMutationOptions(n),bo(this.options,r)||C(this,tn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,Ne),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&cn(r.mutationKey)!==cn(this.options.mutationKey)?this.reset():((i=C(this,Ne))==null?void 0:i.state.status)==="pending"&&C(this,Ne).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=C(this,Ne))==null||n.removeObserver(this)}onMutationUpdate(n){G(this,_t,lo).call(this),G(this,_t,Ss).call(this,n)}getCurrentResult(){return C(this,nn)}reset(){var n;(n=C(this,Ne))==null||n.removeObserver(this),B(this,Ne,void 0),G(this,_t,lo).call(this),G(this,_t,Ss).call(this)}mutate(n,r){var i;return B(this,Nt,r),(i=C(this,Ne))==null||i.removeObserver(this),B(this,Ne,C(this,tn).getMutationCache().build(C(this,tn),this.options)),C(this,Ne).addObserver(this),C(this,Ne).execute(n)}},tn=new WeakMap,nn=new WeakMap,Ne=new WeakMap,Nt=new WeakMap,_t=new WeakSet,lo=function(){var r;const n=((r=C(this,Ne))==null?void 0:r.state)??Wd();B(this,nn,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Ss=function(n){ge.batch(()=>{var r,i,o,a,s,l,u,g;if(C(this,Nt)&&this.hasListeners()){const c=C(this,nn).variables,h=C(this,nn).context;(n==null?void 0:n.type)==="success"?((i=(r=C(this,Nt)).onSuccess)==null||i.call(r,n.data,c,h),(a=(o=C(this,Nt)).onSettled)==null||a.call(o,n.data,null,c,h)):(n==null?void 0:n.type)==="error"&&((l=(s=C(this,Nt)).onError)==null||l.call(s,n.error,c,h),(g=(u=C(this,Nt)).onSettled)==null||g.call(u,void 0,n.error,c,h))}this.listeners.forEach(c=>{c(C(this,nn))})})},Rd),Yd=$.createContext(void 0),ki=e=>{const t=$.useContext(Yd);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},hp=({client:e,children:t})=>($.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(Yd.Provider,{value:e,children:t})),Xd=$.createContext(!1),Zd=()=>$.useContext(Xd);Xd.Provider;function gp(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pp=$.createContext(gp()),Jd=()=>$.useContext(pp),ef=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},tf=e=>{$.useEffect(()=>{e.clearReset()},[e])},nf=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Kd(n,[e.error,r])),gl=(e,t)=>t.state.data===void 0,rf=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},of=(e,t)=>e.isLoading&&e.isFetching&&!t,$s=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,wo=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function af({queries:e,...t},n){const r=ki(n),i=Zd(),o=Jd(),a=$.useMemo(()=>e.map(m=>{const b=r.defaultQueryOptions(m);return b._optimisticResults=i?"isRestoring":"optimistic",b}),[e,r,i]);a.forEach(m=>{rf(m),ef(m,o)}),tf(o);const[s]=$.useState(()=>new dp(r,a,t)),[l,u,g]=s.getOptimisticResult(a,t.combine),c=!i&&t.subscribed!==!1;$.useSyncExternalStore($.useCallback(m=>c?s.subscribe(ge.batchCalls(m)):ke,[s,c]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),$.useEffect(()=>{s.setQueries(a,t)},[a,t,s]);const f=l.some((m,b)=>$s(a[b],m))?l.flatMap((m,b)=>{const v=a[b];if(v){const w=new Mi(r,v);if($s(v,m))return wo(v,w,o);of(m,i)&&wo(v,w,o)}return[]}):[];if(f.length>0)throw Promise.all(f);const p=l.find((m,b)=>{const v=a[b];return v&&nf({result:m,errorResetBoundary:o,throwOnError:v.throwOnError,query:r.getQueryCache().get(v.queryHash),suspense:v.suspense})});if(p!=null&&p.error)throw p.error;return u(g())}function Xo(e,t,n){var c,h,f,p,m;const r=ki(n),i=Zd(),o=Jd(),a=r.defaultQueryOptions(e);(h=(c=r.getDefaultOptions().queries)==null?void 0:c._experimental_beforeQuery)==null||h.call(c,a),a._optimisticResults=i?"isRestoring":"optimistic",rf(a),ef(a,o),tf(o);const s=!r.getQueryCache().get(a.queryHash),[l]=$.useState(()=>new t(r,a)),u=l.getOptimisticResult(a),g=!i&&e.subscribed!==!1;if($.useSyncExternalStore($.useCallback(b=>{const v=g?l.subscribe(ge.batchCalls(b)):ke;return l.updateResult(),v},[l,g]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),$.useEffect(()=>{l.setOptions(a)},[a,l]),$s(a,u))throw wo(a,l,o);if(nf({result:u,errorResetBoundary:o,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw u.error;if((p=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||p.call(f,a,u),a.experimental_prefetchInRender&&!Ln&&of(u,i)){const b=s?wo(a,l,o):(m=r.getQueryCache().get(a.queryHash))==null?void 0:m.promise;b==null||b.catch(ke).finally(()=>{l.updateResult()})}return a.notifyOnChangeProps?u:l.trackResult(u)}function mp(e,t){return Xo(e,Mi,t)}function bp(e,t){return Xo({...e,enabled:!0,suspense:!0,throwOnError:gl,placeholderData:void 0},Mi,t)}function vp(e,t){return Xo({...e,enabled:!0,suspense:!0,throwOnError:gl},Qd,t)}function yp(e,t){return af({...e,queries:e.queries.map(n=>({...n,suspense:!0,throwOnError:gl,enabled:!0,placeholderData:void 0}))},t)}function wp(e,t){const n=ki(t);n.getQueryState(e.queryKey)||n.prefetchQuery(e)}function xp(e,t){const n=ki(t);n.getQueryState(e.queryKey)||n.prefetchInfiniteQuery(e)}function Cp(e,t){const n=ki(t),[r]=$.useState(()=>new fp(n,e));$.useEffect(()=>{r.setOptions(e)},[r,e]);const i=$.useSyncExternalStore($.useCallback(a=>r.subscribe(ge.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=$.useCallback((a,s)=>{r.mutate(a,s).catch(ke)},[r]);if(i.error&&Kd(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function Sp(e,t){return Xo(e,Qd,t)}function Zo(e){const t={subscribe(n){let r=null,i=!1,o=!1,a=!1;function s(){if(r===null){a=!0;return}o||(o=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;i||(u=n.next)==null||u.call(n,l)},error(l){var u;i||(i=!0,(u=n.error)==null||u.call(n,l),s())},complete(){var l;i||(i=!0,(l=n.complete)==null||l.call(n),s())}}),a&&s(),{unsubscribe:s}},pipe(...n){return n.reduce($p,t)}};return t}function $p(e,t){return t(e)}function Ep(e){const t=new AbortController;return new Promise((r,i)=>{let o=!1;function a(){o||(o=!0,s.unsubscribe())}t.signal.addEventListener("abort",()=>{i(t.signal.reason)});const s=e.subscribe({next(l){o=!0,r(l),a()},error(l){i(l)},complete(){t.abort(),a()}})})}function Pp(e){return t=>{let n=0,r=null;const i=[];function o(){r||(r=t.subscribe({next(s){var l;for(const u of i)(l=u.next)==null||l.call(u,s)},error(s){var l;for(const u of i)(l=u.error)==null||l.call(u,s)},complete(){var s;for(const l of i)(s=l.complete)==null||s.call(l)}}))}function a(){if(n===0&&r){const s=r;r=null,s.unsubscribe()}}return Zo(s=>(n++,i.push(s),o(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===s);l>-1&&i.splice(l,1)}}))}}function Rp(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},i=a=>{n.splice(n.indexOf(a),1)},o=Zo(a=>(r(a),()=>{i(a)}));return o.next=a=>{if(t!==a){t=a;for(const s of n)s.next(a)}},o.get=()=>t,o}function Mp(e){return Zo(t=>{function n(i=0,o=e.op){const a=e.links[i];if(!a)throw new Error("No more links to execute - did you forget to add an ending link?");return a({op:o,next(l){return n(i+1,l)}})}return n().subscribe(t)})}const sf=()=>{},vu=e=>{Object.freeze&&Object.freeze(e)};function lf(e,t,n){var r,i;const o=t.join(".");return(r=n)[i=o]??(r[i]=new Proxy(sf,{get(a,s){if(!(typeof s!="string"||s==="then"))return lf(e,[...t,s],n)},apply(a,s,l){const u=t[t.length-1];let g={args:l,path:t};return u==="call"?g={args:l.length>=2?[l[1]]:[],path:t.slice(0,-1)}:u==="apply"&&(g={args:l.length>=2?l[1]:[],path:t.slice(0,-1)}),vu(g.args),vu(g.path),e(g)}})),n[o]}const Jo=e=>lf(e,[],Object.create(null)),pl=e=>new Proxy(sf,{get(t,n){if(n!=="then")return e(n)}});function In(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}const kp=typeof Symbol=="function"&&!!Symbol.asyncIterator;function uf(e){return kp&&In(e)&&Symbol.asyncIterator in e}function Op(e,t){if("error"in e){const r=t.deserialize(e.error);return{ok:!1,error:{...e,error:r}}}return{ok:!0,result:{...e.result,...(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)}}}}class Ea extends Error{constructor(){super("Unable to transform response from server")}}function Dp(e,t){let n;try{n=Op(e,t)}catch{throw new Ea}if(!n.ok&&(!In(n.error.error)||typeof n.error.error.code!="number"))throw new Ea;if(n.ok&&!In(n.result))throw new Ea;return n}var yu,wu;(yu=Symbol).dispose??(yu.dispose=Symbol());(wu=Symbol).asyncDispose??(wu.asyncDispose=Symbol());var Md,kd,Od,Dd,Td,Fd;typeof window>"u"||"Deno"in window||((kd=(Md=globalThis.process)==null?void 0:Md.env)==null?void 0:kd.NODE_ENV)==="test"||(Dd=(Od=globalThis.process)==null?void 0:Od.env)!=null&&Dd.JEST_WORKER_ID||(Fd=(Td=globalThis.process)==null?void 0:Td.env)!=null&&Fd.VITEST_WORKER_ID;function Hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tp(e){return e instanceof an||e instanceof Error&&e.name==="TRPCClientError"}function Fp(e){return In(e)&&In(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function Lp(e,t){return typeof e=="string"?e:In(e)&&typeof e.message=="string"?e.message:t}class an extends Error{static from(t,n={}){const r=t;return Tp(r)?(n.meta&&(r.meta={...r.meta,...n.meta}),r):Fp(r)?new an(r.error.message,{...n,result:r}):new an(Lp(r,"Unknown error"),{...n,cause:r})}constructor(t,n){var i,o;const r=n==null?void 0:n.cause;super(t,{cause:r}),Hi(this,"cause",void 0),Hi(this,"shape",void 0),Hi(this,"data",void 0),Hi(this,"meta",void 0),this.meta=n==null?void 0:n.meta,this.cause=r,this.shape=(i=n==null?void 0:n.result)==null?void 0:i.error,this.data=(o=n==null?void 0:n.result)==null?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,an.prototype)}}function Pa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class ea{$request(t){return Mp({links:this.links,op:{...t,context:t.context??{},id:++this.requestId}}).pipe(Pp())}async requestAsPromise(t){try{const n=this.$request(t);return(await Ep(n)).result.data}catch(n){throw an.from(n)}}query(t,n,r){return this.reques