"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[6111],{50581:function(t,e,i){i.d(e,{D:function(){return R}});var n,s,r,a,u,o,l=i(1413),c=i(29439),h=i(47313),v=i(15671),Z=i(43144),d=i(97326),f=i(60136),p=i(27277),b=i(40101),m=i(72346),k=i(86033),y=i(43889),w=i(13092),O=i(73547),C=i(28127),M=i(27542),S=i(66587),g=(n=new WeakMap,s=new WeakMap,r=new WeakMap,a=new WeakMap,u=new WeakSet,o=new WeakSet,function(t){(0,f.Z)(i,t);var e=(0,p.Z)(i);function i(t,l){var c;return(0,v.Z)(this,i),c=e.call(this),(0,b.Z)((0,d.Z)(c),o),(0,b.Z)((0,d.Z)(c),u),(0,m.Z)((0,d.Z)(c),n,{writable:!0,value:void 0}),(0,m.Z)((0,d.Z)(c),s,{writable:!0,value:void 0}),(0,m.Z)((0,d.Z)(c),r,{writable:!0,value:void 0}),(0,m.Z)((0,d.Z)(c),a,{writable:!0,value:void 0}),(0,w.Z)((0,d.Z)(c),n,t),c.setOptions(l),c.bindMethods(),(0,y.Z)((0,d.Z)(c),u,E).call((0,d.Z)(c)),c}return(0,Z.Z)(i,[{key:"bindMethods",value:function(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}},{key:"setOptions",value:function(t){var e,i=this.options;(this.options=(0,k.Z)(this,n).defaultMutationOptions(t),(0,S.VS)(this.options,i)||(0,k.Z)(this,n).getMutationCache().notify({type:"observerOptionsUpdated",mutation:(0,k.Z)(this,r),observer:this}),null!==i&&void 0!==i&&i.mutationKey&&this.options.mutationKey&&(0,S.Ym)(i.mutationKey)!==(0,S.Ym)(this.options.mutationKey))?this.reset():null===(e=(0,k.Z)(this,r))||void 0===e||e.setOptions(this.options)}},{key:"onUnsubscribe",value:function(){var t;this.hasListeners()||(null===(t=(0,k.Z)(this,r))||void 0===t||t.removeObserver(this))}},{key:"onMutationUpdate",value:function(t){(0,y.Z)(this,u,E).call(this),(0,y.Z)(this,o,W).call(this,t)}},{key:"getCurrentResult",value:function(){return(0,k.Z)(this,s)}},{key:"reset",value:function(){var t;null===(t=(0,k.Z)(this,r))||void 0===t||t.removeObserver(this),(0,w.Z)(this,r,void 0),(0,y.Z)(this,u,E).call(this),(0,y.Z)(this,o,W).call(this)}},{key:"mutate",value:function(t,e){var i;return(0,w.Z)(this,a,e),null===(i=(0,k.Z)(this,r))||void 0===i||i.removeObserver(this),(0,w.Z)(this,r,(0,k.Z)(this,n).getMutationCache().build((0,k.Z)(this,n),this.options)),(0,k.Z)(this,r).addObserver(this),(0,k.Z)(this,r).execute(t)}}]),i}(M.l));function E(){var t,e,i=null!==(t=null===(e=(0,k.Z)(this,r))||void 0===e?void 0:e.state)&&void 0!==t?t:(0,O.R)();(0,w.Z)(this,s,(0,l.Z)((0,l.Z)({},i),{},{isPending:"pending"===i.status,isSuccess:"success"===i.status,isError:"error"===i.status,isIdle:"idle"===i.status,mutate:this.mutate,reset:this.reset}))}function W(t){var e=this;C.V.batch((function(){if((0,k.Z)(e,a)&&e.hasListeners()){var i,n,r,u,o=(0,k.Z)(e,s).variables,l=(0,k.Z)(e,s).context;if("success"===(null===t||void 0===t?void 0:t.type))null===(i=(n=(0,k.Z)(e,a)).onSuccess)||void 0===i||i.call(n,t.data,o,l),null===(r=(u=(0,k.Z)(e,a)).onSettled)||void 0===r||r.call(u,t.data,null,o,l);else if("error"===(null===t||void 0===t?void 0:t.type)){var c,h,v,Z;null===(c=(h=(0,k.Z)(e,a)).onError)||void 0===c||c.call(h,t.error,o,l),null===(v=(Z=(0,k.Z)(e,a)).onSettled)||void 0===v||v.call(Z,void 0,t.error,o,l)}}e.listeners.forEach((function(t){t((0,k.Z)(e,s))}))}))}var K=i(67109),L=i(24772);function R(t,e){var i=(0,K.NL)(e),n=h.useState((function(){return new g(i,t)})),s=(0,c.Z)(n,1)[0];h.useEffect((function(){s.setOptions(t)}),[s,t]);var r=h.useSyncExternalStore(h.useCallback((function(t){return s.subscribe(C.V.batchCalls(t))}),[s]),(function(){return s.getCurrentResult()}),(function(){return s.getCurrentResult()})),a=h.useCallback((function(t,e){s.mutate(t,e).catch(_)}),[s]);if(r.error&&(0,L.L)(s.options.throwOnError,[r.error]))throw r.error;return(0,l.Z)((0,l.Z)({},r),{},{mutate:a,mutateAsync:r.mutate})}function _(){}},41962:function(t,e,i){i.d(e,{a:function(){return r}});var n=i(18948),s=i(51695);function r(t,e){return(0,s.r)(t,n.z,e)}}}]);