vendor: 4,481 bytes, line 1
1import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-BhjfaixL.js";import{C as r,E as i,T as a,_ as o,b as s,c,f as l,h as u,n as d,o as f,s as p,v as m,w as h,x as g,y as _}from"./query-gQzzeikq.js";var v=class extends i{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=p(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),b(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return x(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return x(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof m(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!s(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&S(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||_(this.options.staleTime,this.#t)!==_(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return w(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=_(this.options.staleTime,this.#t);if(c.isServer()||this.#r.isStale||!l(e))return;let t=r(this.#r.dataUpdatedAt,e)+1;this.#d=h.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(c.isServer()||m(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=h.setInterval(()=>{(this.options.refetchIntervalInBackground||a.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(h.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(h.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},f=!1,h;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&b(e,t),o=i&&S(e,n,t,r);(a||o)&&(u={...u,...d(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:g,errorUpdatedAt:_,status:v}=u;h=u.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=i.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,h=o(i?.data,e,t),f=!0)}if(t.select&&h!==void 0&&!y)if(i&&h===a?.data&&t.select===this.#c)h=this.#l;else try{this.#c=t.select,h=t.select(h),h=o(i?.data,h,t),this.#l=h,this.#s=null}catch(e){this.#s=e}this.#s&&(g=this.#s,h=this.#l,_=Date.now(),v=`error`);let x=u.fetchStatus===`fetching`,w=v===`pending`,T=v===`error`,E=w&&x,D=h!==void 0,O={status:v,fetchStatus:u.fetchStatus,isPending:w,isSuccess:v===`
1success`,isError:T,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:u.dataUpdatedAt,error:g,errorUpdatedAt:_,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:T&&!D,isPaused:u.fetchStatus===`paused`,isPlaceholderData:f,isRefetchError:T&&D,isStale:C(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{let e=this.#o=O.promise=p();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!s(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){f.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function y(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&m(t.retryOnMount,e)===!1)}function b(e,t){return y(e,t)||e.state.data!==void 0&&x(e,t,t.refetchOnMount)}function x(e,t,n){if(m(t.enabled,e)!==!1&&_(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&C(e,t)}return!1}function S(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&C(e,n)}function C(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(_(t.staleTime,e))}function w(e,t){return!s(e.getCurrentResult(),t)}var T=e(n(),1),E=t(),D=T.createContext(void 0),O=e=>{let t=T.useContext(D);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},k=({client:e,children:t})=>(T.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,E.jsx)(D.Provider,{value:e,children:t})),A=T.createContext(!1),j=()=>T.useContext(A);A.Provider;function M(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var N=T.createContext(M()),P=()=>T.useContext(N),F=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?g(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},I=e=>{T.useEffect(()=>{e.clearReset()},[e])},L=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||g(n,[e.error,r])),R=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},z=(e,t)=>e.isLoading&&e.isFetching&&!t,B=(e,t)=>e?.suspense&&t.isPending,V=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function H(e,t,n){let r=j(),i=P(),a=O(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),l=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:l?`optimistic`:void 0,R(o),F(o,i,s),I(i);let d=!a.getQueryCache().get(o.queryHash),[p]=T.useState(()=>new t(a,o)),m=p.getOptimisticResult(o),h=!r&&l;if(T.useSyncExternalStore(T.useCallback(e=>{let t=h?p.subscribe(f.batchCalls(e)):u;return p.updateResult(),t},[p,h]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),T.useEffect(()=>{p.setOptions(o)},[o,p]),B(o,m))throw V(o,p,i);if(L({result:m,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw m.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,m),o.experimental_prefetchInRender&&!c.isServer()&&z(m,r)&&(d?V(o,p,i):s?.promise)?.catch(u).finally(()=>{p.updateResult()}),o.notifyOnChangeProps?m:p.trackResult(m)}function U(e,t){return H(e,v,t)}export{k as n,O as r,U as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.