1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`3fb85819`};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`cf6e16ed-5c84-42bd-ae2a-4e36f934bdb5`,e._sentryDebugIdIdentifier=`sentry-dbid-cf6e16ed-5c84-42bd-ae2a-4e36f934bdb5`)}catch{}})();import{s as e,t}from"./react-BxJ5vIog.js";import{t as n}from"./src-jTF5SSYo.js";import{r,t as i}from"./persist-state-keys-DIv83xll.js";import{t as a}from"./compiler-runtime-BQBjb8-F.js";import{E as o,S as s,c,i as l,w as u}from"./useFetch-BoJLT2pS.js";import{C as d,N as f,P as p,_ as m,g as h,k as g,t as _,x as v,y}from"./useQuery-CmicRdJh.js";import{t as b}from"./useAuthentication-CQfCjEdo.js";var x=class extends h{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||S(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=m({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),y.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function S(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var C=class extends v{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),f(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&d(t.mutationKey)!==d(this.options.mutationKey)?this.reset():this.#n?.state.status===`pen
1ding`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??S();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){y.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},w=e(t(),1);function T(e,t){let n=o(t),[r]=w.useState(()=>new C(n,e));w.useEffect(()=>{r.setOptions(e)},[r,e]);let i=w.useSyncExternalStore(w.useCallback(e=>r.subscribe(y.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=w.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(g)},[r]);if(i.error&&p(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var E=a();function D(e){let t=(0,E.c)(38),a;t[0]===e?a=t[1]:(a=e||{},t[0]=e,t[1]=a);let{invalidateOnSettled:d}=a,f=d===void 0||d,{get:p,post:m}=l(),h=o(),{showErrorMessageFromResponse:g}=r(),{logout:v}=b(),y;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=c(`bloom_token`),t[2]=y):y=t[2];let x=y,S;t[3]!==p||t[4]!==v?(S=async function(){let e=await p(`${n.NEXT_PUBLIC_BLOOM_API}/api/users/me`);return e.status===s.SUCCESS?e.data.user:([401].includes(e.error.status)&&await v(),null)},t[3]=p,t[4]=v,t[5]=S):S=t[5];let C=S,D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=[u.USER_ME],t[6]=D):D=t[6];let O;t[7]===C?O=t[8]:(O={enabled:!!x,queryFn:C,queryKey:D},t[7]=C,t[8]=O);let{data:k,isFetching:A,refetch:j}=_(O),M,N;t[9]===k?(M=t[10],N=t[11]):(M=()=>{k&&localStorage.setItem(`bloom_active_account_id`,k.defaultAccountId)},N=[k],t[9]=k,t[10]=M,t[11]=N),(0,w.useEffect)(M,N);let P;t[12]===m?P=t[13]:(P=async function(e){return await m(`/api/users/me`,e,{headers:{"x-account":void 0}})},t[12]=m,t[13]=P);let F=P,I,L;t[14]===h?(I=t[15],L=t[16]):(L=(e,t,n)=>{h.setQueryData([u.USER_ME],n?.previousContact)},I=async e=>{await h.cancelQueries({queryKey:[u.USER_ME]});let t=h.getQueryData([u.USER_ME]);return h.setQueryData([u.USER_ME],t=>t&&{...t,...e}),{previousContact:t}},t[14]=h,t[15]=I,t[16]=L);let R;t[17]!==f||t[18]!==h?(R=async()=>{f&&await h.invalidateQueries({queryKey:[u.USER_ME]})},t[17]=f,t[18]=h,t[19]=R):R=t[19];let z;t[20]!==h||t[21]!==g?(z=e=>(e.status===s.SUCCESS&&h.setQueryData([u.USER_ME],()=>e.data.user),e.status===s.ERROR&&g(e),e),t[20]=h,t[21]=g,t[22]=z):z=t[22];let B;t[23]!==I||t[24]!==R||t[25]!==z||t[26]!==L||t[27]!==F?(B={mutationFn:F,onError:L,onMutate:I,onSettled:R,onSuccess:z},t[23]=I,t[24]=R,t[25]=z,t[26]=L,t[27]=F,t[28]=B):B=t[28];let{isPending:V,mutateAsync:H}=T(B),U,W;t[29]===k?(U=t[30],W=t[31]):(U=()=>{k&&localStorage.setItem(i.ACTIVE_ACCOUNT_ID,k.defaultAccountId)},W=[k],t[29]=k,t[30]=U,t[31]=W),(0,w.useEffect)(U,W);let G;return t[32]!==k||t[33]!==A||t[34]!==V||t[35]!==j||t[36]!==H?(G={isFetching:A,isUpdating:V,me:k,refetch:j,updateMe:H},t[32]=k,t[33]=A,t[34]=V,t[35]=j,t[36]=H,t[37]=G):G=t[37],G}export{T as n,x as r,D as t}; 2//# sourceMappingURL=useMe-D7pJMmC1.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.