Files
boc/landvex-site/assets/useQuery-CHKCqCt4.js
T

3 lines
10 KiB
JavaScript
Raw Normal View History

var bt=s=>{throw TypeError(s)};var Z=(s,t,e)=>t.has(s)||bt("Cannot "+e);var i=(s,t,e)=>(Z(s,t,"read from private field"),e?e.call(s):t.get(s)),p=(s,t,e)=>t.has(s)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),u=(s,t,e,r)=>(Z(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),d=(s,t,e)=>(Z(s,t,"access private method"),e);import{a$ as Tt,bk as vt,bl as R,b0 as q,bm as W,b5 as tt,bn as et,bo as gt,bp as Mt,bq as J,br as Qt,bs as xt,bt as mt,b3 as Ct,r as C,b6 as Ot,b4 as _t}from"./index-CZD3_4lD.js";var g,n,z,v,x,U,E,w,V,D,P,_,F,T,L,a,H,st,it,rt,nt,at,ht,ot,It,Et,Ft=(Et=class extends Tt{constructor(t,e){super();p(this,a);p(this,g);p(this,n);p(this,z);p(this,v);p(this,x);p(this,U);p(this,E);p(this,w);p(this,V);p(this,D);p(this,P);p(this,_);p(this,F);p(this,T);p(this,L,new Set);this.options=e,u(this,g,t),u(this,w,null),u(this,E,vt()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(i(this,n).addObserver(this),Rt(i(this,n),this.options)?d(this,a,H).call(this):this.updateResult(),d(this,a,nt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ct(i(this,n),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ct(i(this,n),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,d(this,a,at).call(this),d(this,a,ht).call(this),i(this,n).removeObserver(this)}setOptions(t){const e=this.options,r=i(this,n);if(this.options=i(this,g).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof R(this.options.enabled,i(this,n))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");d(this,a,ot).call(this),i(this,n).setOptions(this.options),e._defaulted&&!q(this.options,e)&&i(this,g).getQueryCache().notify({type:"observerOptionsUpdated",query:i(this,n),observer:this});const h=this.hasListeners();h&&St(i(this,n),r,this.options,e)&&d(this,a,H).call(this),this.updateResult(),h&&(i(this,n)!==r||R(this.options.enabled,i(this,n))!==R(e.enabled,i(this,n))||W(this.options.staleTime,i(this,n))!==W(e.staleTime,i(this,n)))&&d(this,a,st).call(this);const o=d(this,a,it).call(this);h&&(i(this,n)!==r||R(this.options.enabled,i(this,n))!==R(e.enabled,i(this,n))||o!==i(this,T))&&d(this,a,rt).call(this,o)}getOptimisticResult(t){const e=i(this,g).getQueryCache().build(i(this,g),t),r=this.createResult(e,t);return Dt(this,r)&&(u(this,v,r),u(this,U,this.options),u(this,x,i(this,n).state)),r}getCurrentResult(){return i(this,v)}trackResult(t,e){return new Proxy(t,{get:(r,h)=>(this.trackProp(h),e==null||e(h),h==="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,h))})}trackProp(t){i(this,L).add(t)}getCurrentQuery(){return i(this,n)}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 d(this,a,H).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),i(this,v)))}createResult(t,e){var ft;const r=i(this,n),h=this.options,o=i(this,v),c=i(this,x),S=i(this,U),N=t!==r?t.state:i(this,z),{state:b}=t;let l={...b},k=!1,f;if(e._optimisticResults){const m=this.hasListeners(),j=!m&&Rt(t,e),K=m&&St(t,r,e,h);(j||K)&&(l={...l,...xt(b.data,t.options)}),e._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:B,errorUpdatedAt:Q,status:y}=l;f=l.data;let O=!1;if(e.placeholderData!==void 0&&f===void 0&&y==="pending"){let m;o!=null&&o.isPlaceholderData&&e.placeholderData===(S==null?void 0:S.placeholderData)?(m=o.data,O=!0):m=typeof e.placeholderData=="function"?e.placeholderData((ft=i(this,P))==null?void 0:ft.state.data,i(this,P)):e.placeholderData,m!==void 0&&(y="succes
//# sourceMappingURL=useQuery-CHKCqCt4.js.map