forked from Stock-control-supervisors/awesome-go
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2644-ae19e1f8cba45200.js.download
1 lines (1 loc) · 8.25 KB
/
2644-ae19e1f8cba45200.js.download
1
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2644],{6385:function(e,t,r){function s(){return{onFetch:e=>{e.fetchFn=()=>{var t,r,s,u,a,o;let l;let c=null==(t=e.fetchOptions)?void 0:null==(r=t.meta)?void 0:r.refetchPage,h=null==(s=e.fetchOptions)?void 0:null==(u=s.meta)?void 0:u.fetchMore,d=null==h?void 0:h.pageParam,f=(null==h?void 0:h.direction)==="forward",v=(null==h?void 0:h.direction)==="backward",g=(null==(a=e.state.data)?void 0:a.pages)||[],p=(null==(o=e.state.data)?void 0:o.pageParams)||[],b=p,y=!1,m=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>{var t,r;return null!=(t=e.signal)&&t.aborted?y=!0:null==(r=e.signal)||r.addEventListener("abort",()=>{y=!0}),e.signal}})},P=e.options.queryFn||(()=>Promise.reject("Missing queryFn")),O=(e,t,r,s)=>(b=s?[t,...b]:[...b,t],s?[r,...e]:[...e,r]),Q=(t,r,s,i)=>{if(y)return Promise.reject("Cancelled");if(void 0===s&&!r&&t.length)return Promise.resolve(t);let n={queryKey:e.queryKey,pageParam:s,meta:e.options.meta};return m(n),Promise.resolve(P(n)).then(e=>O(t,s,e,i))};if(g.length){if(f){let t=void 0!==d,r=t?d:i(e.options,g);l=Q(g,t,r)}else if(v){let t=void 0!==d,r=t?d:n(e.options,g);l=Q(g,t,r,!0)}else{b=[];let t=void 0===e.options.getNextPageParam;l=!c||!g[0]||c(g[0],0,g)?Q([],t,p[0]):Promise.resolve(O([],p[0],g[0]));for(let r=1;r<g.length;r++)l=l.then(s=>{if(!c||!g[r]||c(g[r],r,g)){let n=t?p[r]:i(e.options,s);return Q(s,t,n)}return Promise.resolve(O(s,p[r],g[r]))})}}else l=Q([]);return l.then(e=>({pages:e,pageParams:b}))}}}}function i(e,t){return null==e.getNextPageParam?void 0:e.getNextPageParam(t[t.length-1],t)}function n(e,t){return null==e.getPreviousPageParam?void 0:e.getPreviousPageParam(t[0],t)}function u(e,t){if(e.getNextPageParam&&Array.isArray(t)){let r=i(e,t);return null!=r&&!1!==r}}function a(e,t){if(e.getPreviousPageParam&&Array.isArray(t)){let r=n(e,t);return null!=r&&!1!==r}}r.d(t,{Gm:function(){return s},Qy:function(){return u},ZF:function(){return a}})},71158:function(e,t,r){r.r(t),r.d(t,{Hydrate:function(){return u},useHydrate:function(){return n}});var s=r(91710),i=r(5159);function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,i.useQueryClient)({context:t.context}),n=s.useRef(t);n.current=t,s.useMemo(()=>{e&&function(e,t,r){if("object"!=typeof t||null===t)return;let s=e.getMutationCache(),i=e.getQueryCache(),n=t.mutations||[],u=t.queries||[];n.forEach(t=>{var i;s.build(e,{...null==r?void 0:null==(i=r.defaultOptions)?void 0:i.mutations,mutationKey:t.mutationKey},t.state)}),u.forEach(t=>{var s;let n=i.get(t.queryHash),u={...t.state,fetchStatus:"idle"};if(n){n.state.dataUpdatedAt<u.dataUpdatedAt&&n.setState(u);return}i.build(e,{...null==r?void 0:null==(s=r.defaultOptions)?void 0:s.queries,queryKey:t.queryKey,queryHash:t.queryHash},u)})}(r,e,n.current)},[r,e])}let u=e=>{let{children:t,options:r,state:s}=e;return n(s,r),t}},29933:function(e,t,r){r.r(t),r.d(t,{unstable_batchedUpdates:function(){return s}});let s=r(99719).unstable_batchedUpdates},80738:function(e,t,r){r.r(t),r.d(t,{useInfiniteQuery:function(){return o}});var s=r(48703),i=r(73704),n=r(6385);class u extends i.z{bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:(0,n.Gm)()},t)}getOptimisticResult(e){return e.behavior=(0,n.Gm)(),super.getOptimisticResult(e)}fetchNextPage(){let{pageParam:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.fetch({...t,meta:{fetchMore:{direction:"forward",pageParam:e}}})}fetchPreviousPage(){let{pageParam:e,...t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.fetch({...t,meta:{fetchMore:{direction:"backward",pageParam:e}}})}createResult(e,t){var r,s,i,u,a,o;let{state:l}=e,c=super.createResult(e,t),{isFetching:h,isRefetching:d}=c,f=h&&(null==(r=l.fetchMeta)?void 0:null==(s=r.fetchMore)?void 0:s.direction)==="forward",v=h&&(null==(i=l.fetchMeta)?void 0:null==(u=i.fetchMore)?void 0:u.direction)==="backward";return{...c,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,n.Qy)(t,null==(a=l.data)?void 0:a.pages),hasPreviousPage:(0,n.ZF)(t,null==(o=l.data)?void 0:o.pages),isFetchingNextPage:f,isFetchingPreviousPage:v,isRefetching:d&&!f&&!v}}constructor(e,t){super(e,t)}}var a=r(34540);function o(e,t,r){let i=(0,s._v)(e,t,r);return(0,a.r)(i,u)}},27446:function(e,t,r){r.r(t),r.d(t,{useIsFetching:function(){return o}});var s=r(91710),i=r(48703),n=r(99065),u=r(26542),a=r(5159);function o(e,t,r){let[o,l={}]=(0,i.I6)(e,t,r),c=(0,a.useQueryClient)({context:l.context}),h=c.getQueryCache();return(0,u.$)(s.useCallback(e=>h.subscribe(n.V.batchCalls(e)),[h]),()=>c.isFetching(o),()=>c.isFetching(o))}},93568:function(e,t,r){r.r(t),r.d(t,{useIsMutating:function(){return o}});var s=r(91710),i=r(26542),n=r(48703),u=r(99065),a=r(5159);function o(e,t,r){let[o,l={}]=(0,n.cb)(e,t,r),c=(0,a.useQueryClient)({context:l.context}),h=c.getMutationCache();return(0,i.$)(s.useCallback(e=>h.subscribe(u.V.batchCalls(e)),[h]),()=>c.isMutating(o),()=>c.isMutating(o))}},31334:function(e,t,r){r.r(t),r.d(t,{useQueries:function(){return g}});var s=r(91710),i=r(26542),n=r(48703),u=r(99065),a=r(73704),o=r(37343);class l extends o.l{onSubscribe(){1===this.listeners.length&&this.observers.forEach(e=>{e.subscribe(t=>{this.onUpdate(e,t)})})}onUnsubscribe(){this.listeners.length||this.destroy()}destroy(){this.listeners=[],this.observers.forEach(e=>{e.destroy()})}setQueries(e,t){this.queries=e,u.V.batch(()=>{let e=this.observers,r=this.findMatchingObservers(this.queries);r.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions,t));let s=r.map(e=>e.observer),i=Object.fromEntries(s.map(e=>[e.options.queryHash,e])),u=s.map(e=>e.getCurrentResult()),a=s.some((t,r)=>t!==e[r]);(e.length!==s.length||a)&&(this.observers=s,this.observersMap=i,this.result=u,this.hasListeners()&&((0,n.e5)(e,s).forEach(e=>{e.destroy()}),(0,n.e5)(s,e).forEach(e=>{e.subscribe(t=>{this.onUpdate(e,t)})}),this.notify()))})}getCurrentResult(){return this.result}getQueries(){return this.observers.map(e=>e.getCurrentQuery())}getObservers(){return this.observers}getOptimisticResult(e){return this.findMatchingObservers(e).map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions))}findMatchingObservers(e){let t=this.observers,r=e.map(e=>this.client.defaultQueryOptions(e)),s=r.flatMap(e=>{let r=t.find(t=>t.options.queryHash===e.queryHash);return null!=r?[{defaultedQueryOptions:e,observer:r}]:[]}),i=s.map(e=>e.defaultedQueryOptions.queryHash),n=r.filter(e=>!i.includes(e.queryHash)),u=t.filter(e=>!s.some(t=>t.observer===e)),o=e=>{let t=this.client.defaultQueryOptions(e),r=this.observersMap[t.queryHash];return null!=r?r:new a.z(this.client,t)},l=n.map((e,t)=>{if(e.keepPreviousData){let r=u[t];if(void 0!==r)return{defaultedQueryOptions:e,observer:r}}return{defaultedQueryOptions:e,observer:o(e)}});return s.concat(l).sort((e,t)=>r.indexOf(e.defaultedQueryOptions)-r.indexOf(t.defaultedQueryOptions))}onUpdate(e,t){let r=this.observers.indexOf(e);-1!==r&&(this.result=(0,n.Rc)(this.result,r,t),this.notify())}notify(){u.V.batch(()=>{this.listeners.forEach(e=>{e(this.result)})})}constructor(e,t){super(),this.client=e,this.queries=[],this.result=[],this.observers=[],this.observersMap={},t&&this.setQueries(t)}}var c=r(5159),h=r(35192),d=r(36344),f=r(15245),v=r(28754);function g(e){let{queries:t,context:r}=e,n=(0,c.useQueryClient)({context:r}),a=(0,h.useIsRestoring)(),o=s.useMemo(()=>t.map(e=>{let t=n.defaultQueryOptions(e);return t._optimisticResults=a?"isRestoring":"optimistic",t}),[t,n,a]),[g]=s.useState(()=>new l(n,o)),p=g.getOptimisticResult(o);(0,i.$)(s.useCallback(e=>a?()=>void 0:g.subscribe(u.V.batchCalls(e)),[g,a]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),s.useEffect(()=>{g.setQueries(o,{listeners:!1})},[o,g]);let b=(0,d.useQueryErrorResetBoundary)();o.forEach(e=>{(0,f.pf)(e,b),(0,v.Fb)(e)}),(0,f.JN)(b);let y=p.some((e,t)=>(0,v.SB)(o[t],e,a))?p.flatMap((e,t)=>{let r=o[t],s=g.getObservers()[t];if(r&&s){if((0,v.SB)(r,e,a))return(0,v.j8)(r,s,b);(0,v.Z$)(e,a)&&(0,v.j8)(r,s,b)}return[]}):[];if(y.length>0)throw Promise.all(y);let m=p.find((e,t)=>{var r,s;return(0,f.KJ)({result:e,errorResetBoundary:b,useErrorBoundary:null!=(r=null==(s=o[t])?void 0:s.useErrorBoundary)&&r,query:g.getQueries()[t]})});if(null!=m&&m.error)throw m.error;return p}}}]);