1var nt=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)};var i=(s,t,e)=>(nt(s,t,"read from private field"),e?e.call(s):t.get(s)),c=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},u=(s,t,e,r)=>(nt(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e);var l=(s,t,e)=>(nt(s,t,"access private method"),e);import{co as Ft,cp as Ct,cq as S,cr as ht,cs as j,ct as ot,cu as ct,cv as Ot,cw as Pt,cx as et,cy as Lt,cz as Nt,cA as It,cB as Qt,r as C,cC as _t,Z as Bt}from"./index-a9db3765.js";var g,a,H,b,M,F,E,I,z,P,L,Q,_,w,N,U,A,W,ut,V,lt,K,dt,Z,ft,G,pt,J,bt,X,gt,st,Ut,Mt,kt=(Mt=class extends Ft{constructor(t,e){super();c(this,U);c(this,W);c(this,V);c(this,K);c(this,Z);c(this,G);c(this,J);c(this,X);c(this,st);c(this,g,void 0);c(this,a,void 0);c(this,H,void 0);c(this,b,void 0);c(this,M,void 0);c(this,F,void 0);c(this,E,void 0);c(this,I,void 0);c(this,z,void 0);c(this,P,void 0);c(this,L,void 0);c(this,Q,void 0);c(this,_,void 0);c(this,w,void 0);c(this,N,new Set);this.options=e,u(this,g,t),u(this,I,null),u(this,E,Ct()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,a).addObserver(this),wt(i(this,a),this.options)?l(this,U,A).call(this):this.updateResult(),l(this,Z,ft).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Rt(i(this,a),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Rt(i(this,a),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,l(this,G,pt).call(this),l(this,J,bt).call(this),i(this,a).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,a);if(this.options=i(this,g).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof S(this.options.enabled,i(this,a))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");l(this,X,gt).call(this),i(this,a).setOptions(this.options),e._defaulted&&!ht(this.options,e)&&i(this,g).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,a),observer:this});const n=this.hasListeners();n&&Tt(i(this,a),r,this.options,e)&&l(this,U,A).call(this),this.updateResult(),n&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||j(this.options.staleTime,i(this,a))!==j(e.staleTime,i(this,a)))&&l(this,W,ut).call(this);const h=l(this,V,lt).call(this);n&&(i(this,a)!==r||S(this.options.enabled,i(this,a))!==S(e.enabled,i(this,a))||h!==i(this,w))&&l(this,K,dt).call(this,h)}getOptimisticResult(t){const e=i(this,g).getQueryCache().build(i(this,g),t),r=this.createResult(e,t);return jt(this,r)&&(u(this,b,r),u(this,F,this.options),u(this,M,i(this,a).state)),r}getCurrentResult(){return i(this,b)}trackResult(t,e){return new Proxy(t,{get:(r,n)=>(this.trackProp(n),e==null||e(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&i(this,E).status==="pending"&&i(this,E).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,n))})}trackProp(t){i(this,N).add(t)}getCurrentQuery(){return i(this,a)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=i(this,g).defaultQueryOptions(t),r=i(this,g).getQueryCache().build(i(this,g),e);return r.fetch().then(()=>this.createResult(r,e))}fetch(t){return l(this,U,A).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,b)))}createResult(t,e){var yt;const r=i(this,a),n=this.options,h=i(this,b),o=i(this,M),v=i(this,F),p=t!==r?t.state:i(this,H),{state:y}=t;let d={...y},T=!1,f;if(e._optimisticResults){const m=this.hasListeners(),k=!m&&wt(t,e),$=m&&Tt(t,r,e,n);(k||$)&&(d={...d,...Nt(y.data,t.options)}),e._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:x,errorUpdatedAt:B,status:R}=d;f=d.data;let Y=!1;if(e.placeholderData!==void 0&&f===void 0&&R==="pending"){let m;h!=null&&h.isPlaceholderData&&e.placeholderData===(v==null?void 0:v.placeholderData)?(m=h.data,Y=!0):m=typeof e.placeholderData=="function"?e.placeholderData((yt=i(this,L))==null?void 0:yt.state.data,i(this,L)):e.placeholderData,m!==void 0&&(R="success",f=It(h==null?void 0:h.data,m,e),T=!0)}if(e.select&&f!==void 0&&!Y)if(h&&f===(o==null?void 0:o.data)&&e.select===i(this,z))f=i(this,P);else try{u(this,z,e.select),f=e.select(f),f=It(h==null?void 0:h.data,f,e),u(this,P,f),u(this,I,null)}catch(m){u(this,I,m)}i(this,I)&&(x=i(this,I),f=i(this,P),B=Date.now(),R="error");const it=d.fetchStatus==="fetching",rt=R==="pending",at=R==="error",vt=rt&&it,St=f!==void 0,O={status:R,fetchStatus:d.fetchStatus,isPending:rt,isSuccess:R==="success",isError:at,isInitialLoading:vt,isLoading:vt,data:f,dataUpdatedAt:d.dataUpdatedAt,error:x,errorUpdatedAt:B,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdate
1Count:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:it,isRefetching:it&&!rt,isLoadingError:at&&!St,isPaused:d.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:at&&St,isStale:mt(t,e),refetch:this.refetch,promise:i(this,E),isEnabled:S(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const m=O.data!==void 0,k=O.status==="error"&&!m,$=tt=>{k?tt.reject(O.error):m&&tt.resolve(O.data)},Et=()=>{const tt=u(this,E,O.promise=Ct());$(tt)},q=i(this,E);switch(q.status){case"pending":t.queryHash===r.queryHash&&$(q);break;case"fulfilled":(k||O.data!==q.value)&&Et();break;case"rejected":(!k||O.error!==q.reason)&&Et();break}}return O}updateResult(){const t=i(this,b),e=this.createResult(i(this,a),this.options);if(u(this,M,i(this,a).state),u(this,F,this.options),i(this,M).data!==void 0&&u(this,L,i(this,a)),ht(e,t))return;u(this,b,e);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,h=typeof n=="function"?n():n;if(h==="all"||!h&&!i(this,N).size)return!0;const o=new Set(h??i(this,N));return this.options.throwOnError&&o.add("error"),Object.keys(i(this,b)).some(v=>{const D=v;return i(this,b)[D]!==t[D]&&o.has(D)})};l(this,st,Ut).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&l(this,Z,ft).call(this)}},g=new WeakMap,a=new WeakMap,H=new WeakMap,b=new WeakMap,M=new WeakMap,F=new WeakMap,E=new WeakMap,I=new WeakMap,z=new WeakMap,P=new WeakMap,L=new WeakMap,Q=new WeakMap,_=new WeakMap,w=new WeakMap,N=new WeakMap,U=new WeakSet,A=function(t){l(this,X,gt).call(this);let e=i(this,a).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(ot)),e},W=new WeakSet,ut=function(){l(this,G,pt).call(this);const t=j(this.options.staleTime,i(this,a));if(ct||i(this,b).isStale||!Ot(t))return;const r=Pt(i(this,b).dataUpdatedAt,t)+1;u(this,Q,et.setTimeout(()=>{i(this,b).isStale||this.updateResult()},r))},V=new WeakSet,lt=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(i(this,a)):this.options.refetchInterval)??!1},K=new WeakSet,dt=function(t){l(this,J,bt).call(this),u(this,w,t),!(ct||S(this.options.enabled,i(this,a))===!1||!Ot(i(this,w))||i(this,w)===0)&&u(this,_,et.setInterval(()=>{(this.options.refetchIntervalInBackground||Lt.isFocused())&&l(this,U,A).call(this)},i(this,w)))},Z=new WeakSet,ft=function(){l(this,W,ut).call(this),l(this,K,dt).call(this,l(this,V,lt).call(this))},G=new WeakSet,pt=function(){i(this,Q)&&(et.clearTimeout(i(this,Q)),u(this,Q,void 0))},J=new WeakSet,bt=function(){i(this,_)&&(et.clearInterval(i(this,_)),u(this,_,void 0))},X=new WeakSet,gt=function(){const t=i(this,g).getQueryCache().build(i(this,g),this.options);if(t===i(this,a))return;const e=i(this,a);u(this,a,t),u(this,H,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},st=new WeakSet,Ut=function(t){Qt.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(i(this,b))}),i(this,g).getQueryCache().notify({query:i(this,a),type:"observerResultsUpdated"})})},Mt);function At(s,t){return S(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&t.retryOnMount===!1)}function wt(s,t){return At(s,t)||s.state.data!==void 0&&Rt(s,t,t.refetchOnMount)}function Rt(s,t,e){if(S(t.enabled,s)!==!1&&j(t.staleTime,s)!=="static"){const r=typeof e=="function"?e(s):e;return r==="always"||r!==!1&&mt(s,t)}return!1}function Tt(s,t,e,r){return(s!==t||S(r.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&mt(s,e)}function mt(s,t){return S(t.enabled,s)!==!1&&s.isStaleByTime(j(t.staleTime,s))}function jt(s,t){return!ht(s.getCurrentResult(),t)}var Dt=C.createContext(!1),Ht=()=>C.useContext(Dt);Dt.Provider;function zt(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var Wt=C.createContext(zt()),Vt=()=>C.useContext(Wt),Kt=(s,t,e)=>{const r=e!=null&&e.state.error&&typeof s.throwOnError=="function"?_t(s.throwOnError,[e.state.error,e]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||r)&&(t.isReset()||(s.retryOnMount=!1))},Zt=s=>{C.useEffect(()=>{s.clearReset()},[s])},Gt=({result:s,errorResetBoundary:t,throwOnError:e,query:r,suspense:n})=>s.isError&&!t.isReset()&&!s.isFetching&&r&&(n&&s.data===void 0||_t(e,[s.error,r])),Jt=s=>{if(s.suspense){const e=n=>n==="static"?n:Math.max(n??1e3,1e3),r=s.staleTime;s.staleTime=typeof r=="function"?(...n)=>e(r(...n)):e(r),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},Xt=(s,t)=>s.isLoading&&s.isFetching&&!t,Yt=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,xt=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function $t(s,t,e){var T,f,x,B;const r=Ht(),n=Vt(),h=Bt(e),o=h.defaultQueryOptions(s);(f=(T=h.getDefaultOptions().queries)==null?void 0:T._experimental_beforeQuery)==null||f.call(T,o);const v=h.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",Jt(o),Kt(o,n,v),Zt(n);const D=!h.getQueryCache().get(o.queryHash),[p]=C.useState(()=>new t(h,o)),y=p.getOptimisticResult(o),d=!r&&s.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(R=>{const Y=d?p.subscribe(Qt.batchCalls(R)):ot;return p.updateResult(),Y},[p,d]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),C.useEffect(()=>{p.setOptions(o)},[o,p]),Yt(o,y))throw xt(o,p,n);if(Gt({result:y,errorResetBoundary:n,throwOnError:o.throwOnError,query:v,suspense:o.suspense}))throw y.error;if((B=(x=h.getDefaultOptions().queries)==null?void 0:x._experimental_afterQuery)==null||B.call(x,o,y),o.experimental_prefetchInRender&&!ct&&Xt(y,r)){const R=D?xt(o,p,n):v==null?void 0:v.promise;R==null||R.catch(ot).finally(()=>{p.updateResult()})}return o.notifyOnChangeProps?y:p.trackResult(y)}function se(s,t){return $t(s,kt,t)}export{se as u}; 2//# sourceMappingURL=useQuery-6fefbac0.js.map
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.