"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[750],{9555:function(e,t,r){r.d(t,{j:function(){return i}});var n=r(4614),s=r(6063),i=new class extends n.l{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!s.sk&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return"boolean"==typeof this.#e?this.#e:globalThis.document?.visibilityState!=="hidden"}}},5612:function(e,t,r){r.d(t,{Gm:function(){return s},Qy:function(){return a},ZF:function(){return u}});var n=r(6063);function s(e){return{onFetch:(t,r)=>{let s=async()=>{let r;let s=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,u=t.state.data?.pages||[],l=t.state.data?.pageParams||[],c=!1,h=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn&&t.options.queryFn!==n.CN?t.options.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.options.queryHash}'`)),d=async(e,r,s)=>{if(c)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);let i={queryKey:t.queryKey,pageParam:r,direction:s?"backward":"forward",meta:t.options.meta};h(i);let o=await f(i),{maxPages:a}=t.options,u=s?n.Ht:n.VX;return{pages:u(e.pages,o,a),pageParams:u(e.pageParams,r,a)}};if(a&&u.length){let e="backward"===a,t={pages:u,pageParams:l},n=(e?o:i)(s,t);r=await d(t,n,e)}else{r=await d({pages:[],pageParams:[]},l[0]??s.initialPageParam);let t=e??u.length;for(let e=1;e<t;e++){let e=i(s,r);r=await d(r,e)}}return r};t.options.persister?t.fetchFn=()=>t.options.persister?.(s,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=s}}}function i(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function o(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function a(e,t){return!!t&&null!=i(e,t)}function u(e,t){return!!t&&!!e.getPreviousPageParam&&null!=o(e,t)}},1793:function(e,t,r){r.d(t,{R:function(){return a},m:function(){return o}});var n=r(5139),s=r(2041),i=r(326),o=class extends s.F{#n;#s;#i;#o;constructor(e){super(),this.mutationId=e.mutationId,this.#s=e.defaultOptions,this.#i=e.mutationCache,this.#n=[],this.state=e.state||a(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#n.includes(e)||(this.#n.push(e),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#n=this.#n.filter(t=>t!==e),this.scheduleGc(),this.#i.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#n.length||("pending"===this.state.status?this.scheduleGc():this.#i.remove(this))}continue(){return this.#o?.continue()??this.execute(this.state.variables)}async execute(e){let t="pending"===this.state.status;try{if(!t){this.#a({type:"pending",variables:e}),await this.#i.config.onMutate?.(e,this);let t=await this.options.onMutate?.(e);t!==this.state.context&&this.#a({type:"pending",context:t,variables:e})}let r=await (this.#o=(0,i.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(Error("No mutationFn found")),onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.#o.promise);return await this.#i.config.onSuccess?.(r,e,this.state.context,this),await this.options.onSuccess?.(r,e,this.state.context),await this.#i.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,e,this.state.context),this.#a({type:"success",data:r}),r}catch(t){try{throw await this.#i.config.onError?.(t,e,this.state.context,this),await this.options.onError?.(t,e,this.state.context),await this.#i.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,t,e,this.state.context),t}finally{this.#a({type:"error",error:t})}}}#a(e){this.state=(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:!(0,i.Kw)(this.options.networkMode),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),n.V.batch(()=>{this.#n.forEach(t=>{t.onMutationUpdate(e)}),this.#i.notify({mutation:this,type:"updated",action:e})})}};function a(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}},5139:function(e,t,r){r.d(t,{V:function(){return n}});var n=function(){let e=[],t=0,r=e=>{e()},n=e=>{e()},s=e=>setTimeout(e,0),i=n=>{t?e.push(n):s(()=>{r(n)})},o=()=>{let t=e;e=[],t.length&&s(()=>{n(()=>{t.forEach(e=>{r(e)})})})};return{batch:e=>{let r;t++;try{r=e()}finally{--t||o()}return r},batchCalls:e=>(...t)=>{i(()=>{e(...t)})},schedule:i,setNotifyFunction:e=>{r=e},setBatchNotifyFunction:e=>{n=e},setScheduler:e=>{s=e}}}()},7211:function(e,t,r){r.d(t,{N:function(){return i}});var n=r(4614),s=r(6063),i=new class extends n.l{#u=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!s.sk&&window.addEventListener){let t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#u!==e&&(this.#u=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#u}}},4668:function(e,t,r){r.d(t,{A:function(){return a},z:function(){return u}});var n=r(6063),s=r(5139),i=r(326),o=r(2041),a=class extends o.F{#l;#c;#h;#o;#n;#s;#f;constructor(e){super(),this.#f=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.#n=[],this.#h=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#l=e.state||function(e){let t="function"==typeof e.initialData?e.initialData():e.initialData,r=void 0!==t,n=r?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=this.#l,this.scheduleGc()}get meta(){return this.options.meta}setOptions(e){this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.#n.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(e,t){let r=(0,n.oE)(this.state.data,e,this.options);return this.#a({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#a({type:"setState",state:e,setStateOptions:t})}cancel(e){let t=this.#o?.promise;return this.#o?.cancel(e),t?t.then(n.ZT).catch(n.ZT):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#l)}isActive(){return this.#n.some(e=>!1!==e.options.enabled)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.#n.some(e=>e.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!(0,n.Kp)(this.state.dataUpdatedAt,e)}onFocus(){let e=this.#n.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){let e=this.#n.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.#n.includes(e)||(this.#n.push(e),this.clearGcTimeout(),this.#h.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.#n.includes(e)&&(this.#n=this.#n.filter(t=>t!==e),this.#n.length||(this.#o&&(this.#f?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.#n.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.#n.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let r=new AbortController,s={queryKey:this.queryKey,meta:this.meta},o=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})};o(s);let a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>this.options.queryFn&&this.options.queryFn!==n.CN?(this.#f=!1,this.options.persister)?this.options.persister(this.options.queryFn,s,this):this.options.queryFn(s):Promise.reject(Error(`Missing queryFn: '${this.options.queryHash}'`))};o(a),this.options.behavior?.onFetch(a,this),this.#c=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#a({type:"fetch",meta:a.fetchOptions?.meta});let u=e=>{(0,i.DV)(e)&&e.silent||this.#a({type:"error",error:e}),(0,i.DV)(e)||(this.#h.config.onError?.(e,this),this.#h.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#o=(0,i.Mz)({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{if(void 0===e){u(Error(`${this.queryHash} data is undefined`));return}this.setData(e),this.#h.config.onSuccess?.(e,this),this.#h.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:u,onFail:(e,t)=>{this.#a({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode}),this.#o.promise}#a(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...u(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let r=e.error;if((0,i.DV)(r)&&r.revert&&this.#c)return{...this.#c,fetchStatus:"idle"};return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),s.V.batch(()=>{this.#n.forEach(e=>{e.onQueryUpdate()}),this.#h.notify({query:this,type:"updated",action:e})})}};function u(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:(0,i.Kw)(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}},8748:function(e,t,r){r.d(t,{S:function(){return d}});var n=r(6063),s=r(4668),i=r(5139),o=r(4614),a=class extends o.l{constructor(e={}){super(),this.config=e,this.#d=new Map}#d;build(e,t,r){let i=t.queryKey,o=t.queryHash??(0,n.Rm)(i,t),a=this.get(o);return a||(a=new s.A({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){this.#d.has(e.queryHash)||(this.#d.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#d.get(e.queryHash);t&&(e.destroy(),t===e&&this.#d.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){i.V.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#d.get(e)}getAll(){return[...this.#d.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,n._x)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,n._x)(e,t)):t}notify(e){i.V.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){i.V.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){i.V.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=r(1793),l=class extends o.l{constructor(e={}){super(),this.config=e,this.#p=[],this.#y=0}#p;#y;#m;build(e,t,r){let n=new u.m({mutationCache:this,mutationId:++this.#y,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#p.push(e),this.notify({type:"added",mutation:e})}remove(e){this.#p=this.#p.filter(t=>t!==e),this.notify({type:"removed",mutation:e})}clear(){i.V.batch(()=>{this.#p.forEach(e=>{this.remove(e)})})}getAll(){return this.#p}find(e){let t={exact:!0,...e};return this.#p.find(e=>(0,n.X7)(t,e))}findAll(e={}){return this.#p.filter(t=>(0,n.X7)(e,t))}notify(e){i.V.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){return this.#m=(this.#m??Promise.resolve()).then(()=>{let e=this.#p.filter(e=>e.state.isPaused);return i.V.batch(()=>e.reduce((e,t)=>e.then(()=>t.continue().catch(n.ZT)),Promise.resolve()))}).then(()=>{this.#m=void 0}),this.#m}},c=r(9555),h=r(7211),f=r(5612),d=class{#b;#i;#s;#g;#v;#w;#O;#R;constructor(e={}){this.#b=e.queryCache||new a,this.#i=e.mutationCache||new l,this.#s=e.defaultOptions||{},this.#g=new Map,this.#v=new Map,this.#w=0}mount(){this.#w++,1===this.#w&&(this.#O=c.j.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#b.onFocus())}),this.#R=h.N.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#b.onOnline())}))}unmount(){this.#w--,0===this.#w&&(this.#O?.(),this.#O=void 0,this.#R?.(),this.#R=void 0)}isFetching(e){return this.#b.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#i.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#b.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.getQueryData(e.queryKey);if(void 0===t)return this.fetchQuery(e);{let r=this.defaultQueryOptions(e),n=this.#b.build(this,r);return e.revalidateIfStale&&n.isStaleByTime(r.staleTime)&&this.prefetchQuery(r),Promise.resolve(t)}}getQueriesData(e){return this.#b.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,r){let s=this.defaultQueryOptions({queryKey:e}),i=this.#b.get(s.queryHash),o=i?.state.data,a=(0,n.SE)(t,o);if(void 0!==a)return this.#b.build(this,s).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return i.V.batch(()=>this.#b.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#b.get(t.queryHash)?.state}removeQueries(e){let t=this.#b;i.V.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#b,n={type:"active",...e};return i.V.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries(n,t)))}cancelQueries(e={},t={}){let r={revert:!0,...t};return Promise.all(i.V.batch(()=>this.#b.findAll(e).map(e=>e.cancel(r)))).then(n.ZT).catch(n.ZT)}invalidateQueries(e={},t={}){return i.V.batch(()=>{if(this.#b.findAll(e).forEach(e=>{e.invalidate()}),"none"===e.refetchType)return Promise.resolve();let r={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(r,t)})}refetchQueries(e={},t){let r={...t,cancelRefetch:t?.cancelRefetch??!0};return Promise.all(i.V.batch(()=>this.#b.findAll(e).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,r);return r.throwOnError||(t=t.catch(n.ZT)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(n.ZT)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#b.build(this,t);return r.isStaleByTime(t.staleTime)?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(n.ZT).catch(n.ZT)}fetchInfiniteQuery(e){return e.behavior=(0,f.Gm)(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(n.ZT).catch(n.ZT)}resumePausedMutations(){return h.N.isOnline()?this.#i.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#b}getMutationCache(){return this.#i}getDefaultOptions(){return this.#s}setDefaultOptions(e){this.#s=e}setQueryDefaults(e,t){this.#g.set((0,n.Ym)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#g.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.queryKey)&&(r={...r,...t.defaultOptions})}),r}setMutationDefaults(e,t){this.#v.set((0,n.Ym)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#v.values()],r={};return t.forEach(t=>{(0,n.to)(e,t.mutationKey)&&(r={...r,...t.defaultOptions})}),r}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#s.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,n.Rm)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===n.CN&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#s.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#b.clear(),this.#i.clear()}}},2041:function(e,t,r){r.d(t,{F:function(){return s}});var n=r(6063),s=class{#E;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,n.PN)(this.gcTime)&&(this.#E=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(n.sk?1/0:3e5))}clearGcTimeout(){this.#E&&(clearTimeout(this.#E),this.#E=void 0)}}},326:function(e,t,r){r.d(t,{DV:function(){return l},Kw:function(){return a},Mz:function(){return c}});var n=r(9555),s=r(7211),i=r(6063);function o(e){return Math.min(1e3*2**e,3e4)}function a(e){return(e??"online")!=="online"||s.N.isOnline()}var u=class{constructor(e){this.revert=e?.revert,this.silent=e?.silent}};function l(e){return e instanceof u}function c(e){let t,r,l,c=!1,h=0,f=!1,d=new Promise((e,t)=>{r=e,l=t}),p=()=>!n.j.isFocused()||"always"!==e.networkMode&&!s.N.isOnline(),y=n=>{f||(f=!0,e.onSuccess?.(n),t?.(),r(n))},m=r=>{f||(f=!0,e.onError?.(r),t?.(),l(r))},b=()=>new Promise(r=>{t=e=>{let t=f||!p();return t&&r(e),t},e.onPause?.()}).then(()=>{t=void 0,f||e.onContinue?.()}),g=()=>{let t;if(!f){try{t=e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(y).catch(t=>{if(f)return;let r=e.retry??(i.sk?0:3),n=e.retryDelay??o,s="function"==typeof n?n(h,t):n,a=!0===r||"number"==typeof r&&h<r||"function"==typeof r&&r(h,t);if(c||!a){m(t);return}h++,e.onFail?.(h,t),(0,i._v)(s).then(()=>{if(p())return b()}).then(()=>{c?m(t):g()})})}};return a(e.networkMode)?g():b().then(g),{promise:d,cancel:t=>{f||(m(new u(t)),e.abort?.())},continue:()=>t?.()?d:Promise.resolve(),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1}}}},4614:function(e,t,r){r.d(t,{l:function(){return n}});var n=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},6063:function(e,t,r){r.d(t,{CN:function(){return R},Ht:function(){return O},Kp:function(){return a},PN:function(){return o},Q$:function(){return d},Rm:function(){return c},SE:function(){return i},VS:function(){return p},VX:function(){return w},X7:function(){return l},Ym:function(){return h},ZT:function(){return s},_v:function(){return g},_x:function(){return u},oE:function(){return v},sk:function(){return n},to:function(){return f}});var n="undefined"==typeof window||"Deno"in globalThis;function s(){}function i(e,t){return"function"==typeof e?e(t):e}function o(e){return"number"==typeof e&&e>=0&&e!==1/0}function a(e,t){return Math.max(e+(t||0)-Date.now(),0)}function u(e,t){let{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(n){if(t.queryHash!==c(o,t.options))return!1}else if(!f(t.queryKey,o))return!1}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof a||t.isStale()===a)&&(!s||s===t.state.fetchStatus)&&(!i||!!i(t))}function l(e,t){let{exact:r,status:n,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(h(t.options.mutationKey)!==h(i))return!1}else if(!f(t.options.mutationKey,i))return!1}return(!n||t.state.status===n)&&(!s||!!s(t))}function c(e,t){return(t?.queryKeyHashFn||h)(e)}function h(e){return JSON.stringify(e,(e,t)=>m(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function f(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&!Object.keys(t).some(r=>!f(e[r],t[r]))}function d(e,t){if(e===t)return e;let r=y(e)&&y(t);if(r||m(e)&&m(t)){let n=r?e:Object.keys(e),s=n.length,i=r?t:Object.keys(t),o=i.length,a=r?[]:{},u=0;for(let s=0;s<o;s++){let o=r?s:i[s];!r&&void 0===e[o]&&void 0===t[o]&&n.includes(o)?(a[o]=void 0,u++):(a[o]=d(e[o],t[o]),a[o]===e[o]&&void 0!==e[o]&&u++)}return s===o&&u===s?e:a}return t}function p(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function y(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function m(e){if(!b(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!(b(r)&&r.hasOwnProperty("isPrototypeOf"))}function b(e){return"[object Object]"===Object.prototype.toString.call(e)}function g(e){return new Promise(t=>{setTimeout(t,e)})}function v(e,t,r){return"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?d(e,t):t}function w(e,t,r=0){let n=[...e,t];return r&&n.length>r?n.slice(1):n}function O(e,t,r=0){let n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var R=Symbol()},7082:function(e,t,r){r.d(t,{NL:function(){return o},aH:function(){return a}});var n=r(2265),s=r(7437),i=n.createContext(void 0),o=e=>{let t=n.useContext(i);if(e)return e;if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},a=e=>{let{client:t,children:r}=e;return n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,s.jsx)(i.Provider,{value:t,children:r})}},1506:function(e,t,r){function n(e){let t={subscribe(t){let r=null,n=!1,s=!1,i=!1;function o(){if(null===r){i=!0;return}!s&&(s=!0,"function"==typeof r?r():r&&r.unsubscribe())}return r=e({next(e){n||t.next?.(e)},error(e){n||(n=!0,t.error?.(e),o())},complete(){n||(n=!0,t.complete?.(),o())}}),i&&o(),{unsubscribe:o}},pipe:(...e)=>e.reduce(s,t)};return t}function s(e,t){return t(e)}r.d(t,{NT:function(){return u},Bm:function(){return f},fE:function(){return l},ny:function(){return d},gb:function(){return F},Pq:function(){return I}});class i extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,i.prototype)}}var o=r(868);class a extends Error{static from(e,t={}){return e instanceof a||e instanceof Error&&"TRPCClientError"===e.name?(t.meta&&(e.meta={...e.meta,...t.meta}),e):(0,o.Kn)(e)&&(0,o.Kn)(e.error)&&"number"==typeof e.error.code&&"string"==typeof e.error.message?new a(e.error.message,{...t,result:e}):e instanceof Error?new a(e.message,{...t,cause:(0,o.sZ)(e)}):new a("Unknown error",{...t,cause:e})}constructor(e,t){let r=t?.cause;super(e,{cause:r}),this.meta=t?.meta,this.cause=r,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,a.prototype)}}class u{$request({type:e,input:t,path:r,context:s={}}){var i;return(i={links:this.links,op:{id:++this.requestId,type:e,path:r,input:t,context:s}},n(e=>(function e(t=0,r=i.op){let n=i.links[t];if(!n)throw Error("No more links to execute - did you forget to add an ending link?");return n({op:r,next:r=>e(t+1,r)})})().subscribe(e))).pipe(e=>{let t=0,r=null,s=[];return n(n=>(t++,s.push(n),r||(r=e.subscribe({next(e){for(let t of s)t.next?.(e)},error(e){for(let t of s)t.error?.(e)},complete(){for(let e of s)e.complete?.()}})),{unsubscribe(){t--,function(){if(0===t&&r){let e=r;r=null,e.unsubscribe()}}();let e=s.findIndex(e=>e===n);e>-1&&s.splice(e,1)}}))})}requestAsPromise(e){var t;let r;let{promise:n,abort:s}=(t=this.$request(e),{promise:new Promise((e,n)=>{let s=!1;function o(){s||(s=!0,n(new i("This operation was aborted.")),a.unsubscribe())}let a=t.subscribe({next(t){s=!0,e(t),o()},error(e){s=!0,n(e),o()},complete(){s=!0,o()}});r=o}),abort:r});return new Promise((t,r)=>{e.signal?.addEventListener("abort",s),n.then(e=>{t(e.result.data)}).catch(e=>{r(a.from(e))})})}query(e,t,r){return this.requestAsPromise({type:"query",path:e,input:t,context:r?.context,signal:r?.signal})}mutation(e,t,r){return this.requestAsPromise({type:"mutation",path:e,input:t,context:r?.context,signal:r?.signal})}subscription(e,t,r){return this.$request({type:"subscription",path:e,input:t,context:r?.context}).subscribe({next(e){"started"===e.result.type?r.onStarted?.():"stopped"===e.result.type?r.onStopped?.():r.onData?.(e.result.data)},error(e){r.onError?.(e)},complete(){r.onComplete?.()}})}constructor(e){this.requestId=0,this.runtime={},this.links=e.links.map(e=>e(this.runtime))}}function l(e){return new u(e)}let c={query:"query",mutate:"mutation",subscribe:"subscription"},h=e=>c[e];function f(e){return(0,o.yh)(t=>e.hasOwnProperty(t)?e[t]:"__untypedClient"===t?e:(0,o.IX)(({path:r,args:n})=>{let s=[t,...r],i=h(s.pop()),o=s.join(".");return e[i](o,...n)}))}function d(e){return e.__untypedClient}let p=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function y(e){let t=null,r=null,n=()=>{clearTimeout(r),r=null,t=null};function s(){let r=function(t){let r=[[]],n=0;for(;;){let s=t[n];if(!s)break;let i=r[r.length-1];if(s.aborted){s.reject?.(Error("Aborted")),n++;continue}if(e.validate(i.concat(s).map(e=>e.key))){i.push(s),n++;continue}if(0===i.length){s.reject?.(Error("Input is too big for a single dispatch")),n++;continue}r.push([])}return r}(t);for(let t of(n(),r)){if(!t.length)continue;let r={items:t,cancel:p};for(let e of t)e.batch=r;let n=(e,t)=>{let n=r.items[e];n.resolve?.(t),n.batch=null,n.reject=null,n.resolve=null},{promise:s,cancel:i}=e.fetch(r.items.map(e=>e.key),n);r.cancel=i,s.then(e=>{for(let t=0;t<e.length;t++){let r=e[t];n(t,r)}for(let e of r.items)e.reject?.(Error("Missing result")),e.batch=null}).catch(e=>{for(let t of r.items)t.reject?.(e),t.batch=null})}}return{load:function(e){let n={aborted:!1,key:e,batch:null,resolve:p,reject:p},i=new Promise((e,r)=>{n.reject=r,n.resolve=e,t||(t=[]),t.push(n)});return r||(r=setTimeout(s)),{promise:i,cancel:()=>{n.aborted=!0,n.batch?.items.every(e=>e.aborted)&&(n.batch.cancel(),n.batch=null)}}}}}let m=e=>"function"==typeof e;function b(e){var t,r;return{url:e.url.toString().replace(/\/$/,""),fetch:e.fetch,AbortController:(t=e.AbortController)?t:"undefined"!=typeof window&&window.AbortController?window.AbortController:"undefined"!=typeof globalThis&&globalThis.AbortController?globalThis.AbortController:null,transformer:(r=e.transformer)?"input"in r?r:{input:r,output:r}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}},methodOverride:e.methodOverride}}let g={query:"GET",mutation:"POST"};function v(e){return"input"in e?e.transformer.input.serialize(e.input):function(e){let t={};for(let r=0;r<e.length;r++){let n=e[r];t[r]=n}return t}(e.inputs.map(t=>e.transformer.input.serialize(t)))}let w=e=>{let t=e.url+"/"+e.path,r=[];if("inputs"in e&&r.push("batch=1"),"query"===e.type){let t=v(e);void 0!==t&&"POST"!==e.methodOverride&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(t+="?"+r.join("&")),t},O=e=>{if("query"===e.type&&"POST"!==e.methodOverride)return;let t=v(e);return void 0!==t?JSON.stringify(t):void 0},R=e=>C({...e,contentTypeHeader:"application/json",getUrl:w,getBody:O});async function E(e,t){let r=e.getUrl(e),n=e.getBody(e),{type:s}=e,i=await (async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})();/* istanbul ignore if -- @preserve */if("subscription"===s)throw Error("Subscriptions should use wsLink");let o={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.batchModeHeader?{"trpc-batch-mode":e.batchModeHeader}:{},...i};return(function(e){if(e)return e;if("undefined"!=typeof window&&m(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&m(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")})(e.fetch)(r,{method:e.methodOverride??g[s],signal:t?.signal,body:n,headers:o})}function C(e){let t=e.AbortController?new e.AbortController:null,r={},n=!1;return{promise:new Promise((s,i)=>{E(e,t).then(e=>(r.response=e,n=!0,e.json())).then(e=>{r.responseJSON=e,s({json:e,meta:r})}).catch(e=>{n=!0,i(a.from(e,{meta:r}))})}),cancel:()=>{n||t?.abort()}}}function S(e){return function(t){let r=b(t),s=t.maxURLLength??1/0;return i=>{let u=n=>({validate:e=>{if(s===1/0)return!0;let t=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return w({...r,type:n,path:t,inputs:i}).length<=s},fetch:e({...r,runtime:i,type:n,opts:t})}),l=y(u("query")),c=y(u("mutation")),h={query:l,subscription:y(u("subscription")),mutation:c};return({op:e})=>n(t=>{let n;let{promise:s,cancel:i}=h[e.type].load(e);return s.then(e=>{n=e;let s=(0,o.F7)(e.json,r.transformer.output);if(!s.ok){t.error(a.from(s.error,{meta:e.meta}));return}t.next({context:e.meta,result:s.result}),t.complete()}).catch(e=>{t.error(a.from(e,{meta:n?.meta}))}),()=>{i()}})}}}async function q(e){let t=e.parse??JSON.parse;await P(e.readableStream,r=>{if(e.signal?.aborted||!r||"}"===r)return;let n=r.indexOf(":"),s=r.substring(2,n-1),i=r.substring(n+1);e.onSingle(Number(s),t(i))},e.textDecoder)}async function P(e,t,r){let n="",s=e=>{let s=r.decode(e).split("\n");if(1===s.length)n+=s[0];else if(s.length>1){t(n+s[0]);for(let e=1;e<s.length-1;e++)t(s[e]);n=s[s.length-1]}};"getReader"in e?await x(e,s):await new Promise(t=>{e.on("data",s),e.on("end",t)}),t(n)}async function x(e,t){let r=e.getReader(),n=await r.read();for(;!n.done;)t(n.value),n=await r.read()}S(e=>t=>{let r=t.map(e=>e.path).join(","),n=t.map(e=>e.input),{promise:s,cancel:i}=R({...e,path:r,inputs:n,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:t}):e.opts.headers:{}});return{promise:s.then(e=>(Array.isArray(e.json)?e.json:t.map(()=>e.json)).map(t=>({meta:e.meta,json:t}))),cancel:i}});let Q=(e,t)=>{let r=e.AbortController?new e.AbortController:null;return{cancel:()=>r?.abort(),promise:E({...e,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:w,getBody:O},r).then(async n=>{if(!n.body)throw Error("Received response without body");let s={response:n};return q({readableStream:n.body,onSingle:t,parse:e=>({json:JSON.parse(e),meta:s}),signal:r?.signal,textDecoder:e.textDecoder})})}},I=S(e=>{let t=function(e){if(e)return e;if("undefined"!=typeof window&&window.TextDecoder)return new window.TextDecoder;if("undefined"!=typeof globalThis&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw Error("No TextDecoder implementation found")}(e.opts.textDecoder);return(r,n)=>{let s=r.map(e=>e.path).join(","),i=r.map(e=>e.input),{cancel:o,promise:a}=Q({...e,textDecoder:t,path:s,inputs:i,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:r}):e.opts.headers:{}},(e,t)=>{n(e,t)});return{promise:a.then(()=>[]),cancel:o}}});function T(e){return t=>{let r=b(t);return()=>({op:s})=>n(n=>{let i;let{path:u,input:l,type:c}=s,{promise:h,cancel:f}=e.requester({...r,type:c,path:u,input:l,headers:()=>t.headers?"function"==typeof t.headers?t.headers({op:s}):t.headers:{}});return h.then(e=>{i=e.meta;let t=(0,o.F7)(e.json,r.transformer.output);if(!t.ok){n.error(a.from(t.error,{meta:i}));return}n.next({context:e.meta,result:t.result}),n.complete()}).catch(e=>{n.error(a.from(e,{meta:i}))}),()=>{f()}})}}T({requester:R});let D={css:{query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},ansi:{regular:{query:["\x1b[30;46m","\x1b[97;46m"],mutation:["\x1b[30;45m","\x1b[97;45m"],subscription:["\x1b[30;42m","\x1b[97;42m"]},bold:{query:["\x1b[1;30;46m","\x1b[1;97;46m"],mutation:["\x1b[1;30;45m","\x1b[1;97;45m"],subscription:["\x1b[1;30;42m","\x1b[1;97;42m"]}}},k=({c:e=console,colorMode:t="css"})=>r=>{let n=r.input,s="undefined"!=typeof FormData&&n instanceof FormData?Object.fromEntries(n):n,{parts:i,args:o}=function(e){let{direction:t,type:r,path:n,id:s,input:i}=e,o=[],a=[];if("ansi"===e.colorMode){let[i,u]=D.ansi.regular[r],[l,c]=D.ansi.bold[r];return o.push("up"===t?i:u,"up"===t?">>":"<<",r,"up"===t?l:c,`#${s}`,n,"\x1b[0m"),"up"===t?a.push({input:e.input}):a.push({input:e.input,result:"result"in e.result?e.result.result:e.result,elapsedMs:e.elapsedMs}),{parts:o,args:a}}let[u,l]=D.css[r],c=`
    background-color: #${"up"===t?u:l};
    color: ${"up"===t?"black":"white"};
    padding: 2px;
  `;return o.push("%c","up"===t?">>":"<<",r,`#${s}`,`%c${n}%c`,"%O"),a.push(c,`${c}; font-weight: bold;`,`${c}; font-weight: normal;`),"up"===t?a.push({input:i,context:e.context}):a.push({input:i,result:e.result,elapsedMs:e.elapsedMs,context:e.context}),{parts:o,args:a}}({...r,colorMode:t,input:s});e["down"===r.direction&&r.result&&(r.result instanceof Error||"error"in r.result.result)?"error":"log"].apply(null,[i.join(" ")].concat(o))};function F(e={}){let{enabled:t=()=>!0}=e,r=e.colorMode??("undefined"==typeof window?"ansi":"css"),{logger:s=k({c:e.console,colorMode:r})}=e;return()=>({op:e,next:r})=>n(i=>{var o;t({...e,direction:"up"})&&s({...e,direction:"up"});let a=Date.now();function u(r){let n=Date.now()-a;t({...e,direction:"down",result:r})&&s({...e,direction:"down",elapsedMs:n,result:r})}return r(e).pipe((o={next(e){u(e)},error(e){u(e)}},e=>n(t=>e.subscribe({next(e){o.next?.(e),t.next(e)},error(e){o.error?.(e),t.error(e)},complete(){o.complete?.(),t.complete()}})))).subscribe(i)})}T({requester:e=>{if("mutation"!==e.type)throw Error("We only handle mutations with formdata");return C({...e,getUrl:()=>`${e.url}/${e.path}`,getBody(e){if("input"in e){if(!(e.input instanceof FormData))throw Error("Input is not FormData");return e.input}}})}})},2932:function(e,t,r){let n;r.d(t,{ec:function(){return B}});var s=r(1506),i=r(6063),o=r(868);function a(e,t,r){let n=e.flatMap(e=>e.split("."));if(!t&&(!r||"any"===r))return n.length?[n]:[];if("infinite"===r&&(0,o.Kn)(t)&&("direction"in t||"cursor"in t)){let{cursor:e,direction:r,...s}=t;return[n,{input:s,type:"infinite"}]}return[n,{...void 0!==t&&t!==i.CN&&{input:t},...r&&"any"!==r&&{type:r}}]}var u=r(2265);let l=["client","ssrContext","ssrState","abortOnUnmount"],c=u.createContext?.(null),h=e=>{switch(e){case"fetch":case"ensureData":case"prefetch":case"getData":case"setData":return"query";case"fetchInfinite":case"prefetchInfinite":case"getInfiniteData":case"setInfiniteData":return"infinite";case"cancel":case"invalidate":case"refetch":case"reset":return"any"}};var f=r(5139),d=r(9555),p=r(4614),y=r(4668),m=class extends p.l{constructor(e,t){super(),this.options=t,this.#C=e,this.#S=null,this.bindMethods(),this.setOptions(t)}#C;#q=void 0;#P=void 0;#x=void 0;#Q;#I;#S;#T;#D;#k;#F;#M;#_;#A=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#q.addObserver(this),b(this.#q,this.options)?this.#j():this.updateResult(),this.#U())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return g(this.#q,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return g(this.#q,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#N(),this.#V(),this.#q.removeObserver(this)}setOptions(e,t){let r=this.options,n=this.#q;if(this.options=this.#C.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled)throw Error("Expected enabled to be a boolean");this.#K(),this.#q.setOptions(this.options),r._defaulted&&!(0,i.VS)(this.options,r)&&this.#C.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#q,observer:this});let s=this.hasListeners();s&&v(this.#q,n,this.options,r)&&this.#j(),this.updateResult(t),s&&(this.#q!==n||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&this.#L();let o=this.#z();s&&(this.#q!==n||this.options.enabled!==r.enabled||o!==this.#_)&&this.#H(o)}getOptimisticResult(e){let t=this.#C.getQueryCache().build(this.#C,e),r=this.createResult(t,e);return(0,i.VS)(this.getCurrentResult(),r)||(this.#x=r,this.#I=this.options,this.#Q=this.#q.state),r}getCurrentResult(){return this.#x}trackResult(e,t){let r={};return Object.keys(e).forEach(n=>{Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(n),t?.(n),e[n])})}),r}trackProp(e){this.#A.add(e)}getCurrentQuery(){return this.#q}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#C.defaultQueryOptions(e),r=this.#C.getQueryCache().build(this.#C,t);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#j({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#x))}#j(e){this.#K();let t=this.#q.fetch(this.options,e);return e?.throwOnError||(t=t.catch(i.ZT)),t}#L(){if(this.#N(),i.sk||this.#x.isStale||!(0,i.PN)(this.options.staleTime))return;let e=(0,i.Kp)(this.#x.dataUpdatedAt,this.options.staleTime);this.#F=setTimeout(()=>{this.#x.isStale||this.updateResult()},e+1)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#q):this.options.refetchInterval)??!1}#H(e){this.#V(),this.#_=e,!i.sk&&!1!==this.options.enabled&&(0,i.PN)(this.#_)&&0!==this.#_&&(this.#M=setInterval(()=>{(this.options.refetchIntervalInBackground||d.j.isFocused())&&this.#j()},this.#_))}#U(){this.#L(),this.#H(this.#z())}#N(){this.#F&&(clearTimeout(this.#F),this.#F=void 0)}#V(){this.#M&&(clearInterval(this.#M),this.#M=void 0)}createResult(e,t){let r;let n=this.#q,s=this.options,o=this.#x,a=this.#Q,u=this.#I,l=e!==n?e.state:this.#P,{state:c}=e,h={...c},f=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&b(e,t),o=r&&v(e,n,t,s);(i||o)&&(h={...h,...(0,y.z)(c.data,e.options)}),"isRestoring"===t._optimisticResults&&(h.fetchStatus="idle")}let{error:d,errorUpdatedAt:p,status:m}=h;if(t.select&&void 0!==h.data){if(o&&h.data===a?.data&&t.select===this.#T)r=this.#D;else try{this.#T=t.select,r=t.select(h.data),r=(0,i.oE)(o?.data,r,t),this.#D=r,this.#S=null}catch(e){this.#S=e}}else r=h.data;if(void 0!==t.placeholderData&&void 0===r&&"pending"===m){let e;if(o?.isPlaceholderData&&t.placeholderData===u?.placeholderData)e=o.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#k?.state.data,this.#k):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#S=null}catch(e){this.#S=e}void 0!==e&&(m="success",r=(0,i.oE)(o?.data,e,t),f=!0)}this.#S&&(d=this.#S,r=this.#D,p=Date.now(),m="error");let g="fetching"===h.fetchStatus,O="pending"===m,R="error"===m,E=O&&g,C=void 0!==r;return{status:m,fetchStatus:h.fetchStatus,isPending:O,isSuccess:"success"===m,isError:R,isInitialLoading:E,isLoading:E,data:r,dataUpdatedAt:h.dataUpdatedAt,error:d,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>l.dataUpdateCount||h.errorUpdateCount>l.errorUpdateCount,isFetching:g,isRefetching:g&&!O,isLoadingError:R&&!C,isPaused:"paused"===h.fetchStatus,isPlaceholderData:f,isRefetchError:R&&C,isStale:w(e,t),refetch:this.refetch}}updateResult(e){let t=this.#x,r=this.createResult(this.#q,this.options);if(this.#Q=this.#q.state,this.#I=this.options,void 0!==this.#Q.data&&(this.#k=this.#q),(0,i.VS)(r,t))return;this.#x=r;let n={};e?.listeners!==!1&&(()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#A.size)return!0;let n=new Set(r??this.#A);return this.options.throwOnError&&n.add("error"),Object.keys(this.#x).some(e=>this.#x[e]!==t[e]&&n.has(e))})()&&(n.listeners=!0),this.#$({...n,...e})}#K(){let e=this.#C.getQueryCache().build(this.#C,this.options);if(e===this.#q)return;let t=this.#q;this.#q=e,this.#P=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#U()}#$(e){f.V.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#x)}),this.#C.getQueryCache().notify({query:this.#q,type:"observerResultsUpdated"})})}};function b(e,t){return!1!==t.enabled&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)||void 0!==e.state.data&&g(e,t,t.refetchOnMount)}function g(e,t,r){if(!1!==t.enabled){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&w(e,t)}return!1}function v(e,t,r,n){return(e!==t||!1===n.enabled)&&(!r.suspense||"error"!==e.state.status)&&w(e,r)}function w(e,t){return!1!==t.enabled&&e.isStaleByTime(t.staleTime)}r(7437);var O=u.createContext((n=!1,{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n})),R=()=>u.useContext(O),E=r(7082),C=u.createContext(!1),S=()=>u.useContext(C);function q(e,t){return"function"==typeof e?e(...t):!!e}function P(){}C.Provider;var x=(e,t)=>{(e.suspense||e.throwOnError)&&!t.isReset()&&(e.retryOnMount=!1)},Q=e=>{u.useEffect(()=>{e.clearReset()},[e])},I=e=>{let{result:t,errorResetBoundary:r,throwOnError:n,query:s}=e;return t.isError&&!r.isReset()&&!t.isFetching&&s&&q(n,[t.error,s])},T=(e,t)=>void 0===t.state.data,D=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},k=(e,t)=>e.isLoading&&e.isFetching&&!t,F=(e,t)=>e?.suspense&&t.isPending,M=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function _(e,t,r){let n=(0,E.NL)(r),s=S(),i=R(),o=n.defaultQueryOptions(e);o._optimisticResults=s?"isRestoring":"optimistic",D(o),x(o,i),Q(i);let[a]=u.useState(()=>new t(n,o)),l=a.getOptimisticResult(o);if(u.useSyncExternalStore(u.useCallback(e=>{let t=s?()=>void 0:a.subscribe(f.V.batchCalls(e));return a.updateResult(),t},[a,s]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),u.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),F(o,l))throw M(o,a,i);if(I({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:n.getQueryCache().get(o.queryHash)}))throw l.error;return o.notifyOnChangeProps?l:a.trackResult(l)}var A=r(1793),j=class extends p.l{#C;#x=void 0;#B;#G;constructor(e,t){super(),this.#C=e,this.setOptions(t),this.bindMethods(),this.#Z()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#C.defaultMutationOptions(e),(0,i.VS)(this.options,t)||this.#C.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#B,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,i.Ym)(t.mutationKey)!==(0,i.Ym)(this.options.mutationKey)?this.reset():this.#B?.state.status==="pending"&&this.#B.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#B?.removeObserver(this)}onMutationUpdate(e){this.#Z(),this.#$(e)}getCurrentResult(){return this.#x}reset(){this.#B?.removeObserver(this),this.#B=void 0,this.#Z(),this.#$()}mutate(e,t){return this.#G=t,this.#B?.removeObserver(this),this.#B=this.#C.getMutationCache().build(this.#C,this.options),this.#B.addObserver(this),this.#B.execute(e)}#Z(){let e=this.#B?.state??(0,A.R)();this.#x={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#$(e){f.V.batch(()=>{if(this.#G&&this.hasListeners()){let t=this.#x.variables,r=this.#x.context;e?.type==="success"?(this.#G.onSuccess?.(e.data,t,r),this.#G.onSettled?.(e.data,null,t,r)):e?.type==="error"&&(this.#G.onError?.(e.error,t,r),this.#G.onSettled?.(void 0,e.error,t,r))}this.listeners.forEach(e=>{e(this.#x)})})}},U=r(5612),N=class extends m{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:(0,U.Gm)()},t)}getOptimisticResult(e){return e.behavior=(0,U.Gm)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:r}=e,n=super.createResult(e,t),{isFetching:s,isRefetching:i}=n,o=s&&r.fetchMeta?.fetchMore?.direction==="forward",a=s&&r.fetchMeta?.fetchMore?.direction==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,U.Qy)(t,r.data),hasPreviousPage:(0,U.ZF)(t,r.data),isFetchingNextPage:o,isFetchingPreviousPage:a,isRefetching:i&&!o&&!a}}};function V(e,t){return e.filter(e=>!t.includes(e))}var K=class extends p.l{#C;#X;#d;#n;#J;#W;constructor(e,t,r){super(),this.#C=e,this.#d=[],this.#n=[],this.#Y([]),this.setQueries(t,r)}#Y(e){this.#X=e,this.#W=this.#ee(e,this.#J?.combine)}onSubscribe(){1===this.listeners.size&&this.#n.forEach(e=>{e.subscribe(t=>{this.#et(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#n.forEach(e=>{e.destroy()})}setQueries(e,t,r){this.#d=e,this.#J=t,f.V.batch(()=>{let e=this.#n,t=this.#er(this.#d);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions,r));let n=t.map(e=>e.observer),s=n.map(e=>e.getCurrentResult()),i=n.some((t,r)=>t!==e[r]);(e.length!==n.length||i)&&(this.#n=n,this.#Y(s),this.hasListeners()&&(V(e,n).forEach(e=>{e.destroy()}),V(n,e).forEach(e=>{e.subscribe(t=>{this.#et(e,t)})}),this.#$()))})}getCurrentResult(){return this.#W}getQueries(){return this.#n.map(e=>e.getCurrentQuery())}getObservers(){return this.#n}getOptimisticResult(e,t){let r=this.#er(e),n=r.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions));return[n,e=>this.#ee(e??n,t),()=>r.map((e,t)=>{let s=n[t];return e.defaultedQueryOptions.notifyOnChangeProps?s:e.observer.trackResult(s,e=>{r.forEach(t=>{t.observer.trackProp(e)})})})]}#ee(e,t){return t?(0,i.Q$)(this.#W,t(e)):e}#er(e){let t=this.#n,r=new Map(t.map(e=>[e.options.queryHash,e])),n=e.map(e=>this.#C.defaultQueryOptions(e)),s=n.flatMap(e=>{let t=r.get(e.queryHash);return null!=t?[{defaultedQueryOptions:e,observer:t}]:[]}),i=new Set(s.map(e=>e.defaultedQueryOptions.queryHash)),o=n.filter(e=>!i.has(e.queryHash)),a=e=>{let t=this.#C.defaultQueryOptions(e);return this.#n.find(e=>e.options.queryHash===t.queryHash)??new m(this.#C,t)},u=o.map(e=>({defaultedQueryOptions:e,observer:a(e)}));return s.concat(u).sort((e,t)=>n.indexOf(e.defaultedQueryOptions)-n.indexOf(t.defaultedQueryOptions))}#et(e,t){let r=this.#n.indexOf(e);-1!==r&&(this.#Y(function(e,t,r){let n=e.slice(0);return n[t]=r,n}(this.#X,r,t)),this.#$())}#$(){f.V.batch(()=>{this.listeners.forEach(e=>{e(this.#X)})})}};function L(e,t){let{queries:r,...n}=e,s=(0,E.NL)(t),i=S(),o=R(),a=u.useMemo(()=>r.map(e=>{let t=s.defaultQueryOptions(e);return t._optimisticResults=i?"isRestoring":"optimistic",t}),[r,s,i]);a.forEach(e=>{D(e),x(e,o)}),Q(o);let[l]=u.useState(()=>new K(s,a,n)),[c,h,d]=l.getOptimisticResult(a,n.combine);u.useSyncExternalStore(u.useCallback(e=>i?()=>void 0:l.subscribe(f.V.batchCalls(e)),[l,i]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),u.useEffect(()=>{l.setQueries(a,n,{listeners:!1})},[a,n,l]);let p=c.some((e,t)=>F(a[t],e))?c.flatMap((e,t)=>{let r=a[t];if(r){let t=new m(s,r);if(F(r,e))return M(r,t,o);k(e,i)&&M(r,t,o)}return[]}):[];if(p.length>0)throw Promise.all(p);let y=c.find((e,t)=>{let r=a[t];return r&&I({result:e,errorResetBoundary:o,throwOnError:r.throwOnError,query:s.getQueryCache().get(r.queryHash)})});if(null==y?void 0:y.error)throw y.error;return h(d())}function z(e,t,r){let n=e[0],s=e[1]?.input;return r&&(s={...s??{},...r.pageParam?{cursor:r.pageParam}:{},direction:r.direction}),[n.join("."),s,t?.trpc]}function H(e){let t=e.path.join(".");return u.useMemo(()=>({path:t}),[t])}function $(e){return(0,o.IX)(t=>{let r=t.path,n=r.join("."),[s,i]=t.args;return{queryKey:a(r,s,"query"),queryFn:()=>e.query(n,s,i?.trpc),...i}})}function B(e){var t;return t=function(e){let t=e?.overrides?.useMutation?.onSuccess??(e=>e.originalFn()),r=e?.context??c;function n(){let e=u.useContext(r);if(!e)throw Error("Unable to find tRPC Context. Did you forget to wrap your App inside `withTRPC` HoC?");return e}function o(e,t){let{queryClient:r,ssrState:s}=n();return s&&"mounted"!==s&&r.getQueryCache().find({queryKey:e})?.state.status==="error"?{retryOnMount:!1,...t}:t}return{Provider:e=>{let{abortOnUnmount:t=!1,client:n,queryClient:i,ssrContext:o}=e,[a,l]=u.useState(e.ssrState??!1),c=u.useMemo(()=>(function(e){let{client:t,queryClient:r}=e,n=t instanceof s.NT?t:(0,s.ny)(t);return{fetchQuery:(e,t)=>r.fetchQuery({...t,queryKey:e,queryFn:()=>n.query(...z(e,t))}),fetchInfiniteQuery:(e,t)=>r.fetchInfiniteQuery({...t,queryKey:e,queryFn:({pageParam:r,direction:s})=>n.query(...z(e,t,{pageParam:r,direction:s})),initialPageParam:t?.initialCursor??null}),prefetchQuery:(e,t)=>r.prefetchQuery({...t,queryKey:e,queryFn:()=>n.query(...z(e,t))}),prefetchInfiniteQuery:(e,t)=>r.prefetchInfiniteQuery({...t,queryKey:e,queryFn:({pageParam:r,direction:s})=>n.query(...z(e,t,{pageParam:r,direction:s})),initialPageParam:t?.initialCursor??null}),ensureQueryData:(e,t)=>r.ensureQueryData({...t,queryKey:e,queryFn:()=>n.query(...z(e,t))}),invalidateQueries:(e,t,n)=>r.invalidateQueries({...t,queryKey:e},n),resetQueries:(e,t,n)=>r.resetQueries({...t,queryKey:e},n),refetchQueries:(e,t,n)=>r.refetchQueries({...t,queryKey:e},n),cancelQuery:(e,t)=>r.cancelQueries({queryKey:e},t),setQueryData:(e,t,n)=>r.setQueryData(e,t,n),getQueryData:e=>r.getQueryData(e),setInfiniteQueryData:(e,t,n)=>r.setQueryData(e,t,n),getInfiniteQueryData:e=>r.getQueryData(e)}})({client:n,queryClient:i}),[n,i]),h=u.useMemo(()=>({abortOnUnmount:t,queryClient:i,client:n,ssrContext:o??null,ssrState:a,...c}),[t,n,c,i,o,a]);return u.useEffect(()=>{l(e=>!!e&&"mounted")},[]),u.createElement(r.Provider,{value:h},e.children)},createClient:e=>(0,s.fE)(e),useContext:n,useUtils:n,useQuery:function(t,r,s){let{abortOnUnmount:u,client:l,ssrState:c,queryClient:h,prefetchQuery:f}=n(),d=a(t,r,"query"),p=h.getQueryDefaults(d),y=r===i.CN;"undefined"!=typeof window||"prepass"!==c||s?.trpc?.ssr===!1||(s?.enabled??p?.enabled)===!1||y||h.getQueryCache().find({queryKey:d})||f(d,s);let b=o(d,{...p,...s}),g=s?.trpc?.abortOnUnmount??e?.abortOnUnmount??u,v=_({...b,queryKey:d,queryFn:y?r:e=>{let t={...b,trpc:{...b?.trpc,...g?{signal:e.signal}:{}}};return l.query(...z(d,t))}},m,h);return v.trpc=H({path:t}),v},useSuspenseQuery:function(t,r,s){var i,o;let u=n(),l=a(t,r,"query"),c=s?.trpc?.abortOnUnmount??e?.abortOnUnmount??u.abortOnUnmount,h=(i={...s,queryKey:l,queryFn:e=>{let t={trpc:{...c?{signal:e.signal}:{}}};return u.client.query(...z(l,t))}},o=u.queryClient,_({...i,enabled:!0,suspense:!0,throwOnError:T,placeholderData:void 0},m,o));return h.trpc=H({path:t}),[h.data,h]},useQueries:e=>{let{ssrState:t,queryClient:r,prefetchQuery:s,client:i}=n(),o=e($(i));if("undefined"==typeof window&&"prepass"===t)for(let e of o)e.trpc?.ssr===!1||r.getQueryCache().find({queryKey:e.queryKey})||s(e.queryKey,e);return L({queries:o.map(e=>({...e,queryKey:e.queryKey}))},r)},useSuspenseQueries:e=>{var t;let{queryClient:r,client:s}=n(),i=L({...t={queries:e($(s)).map(e=>({...e,queryKey:e.queryKey}))},queries:t.queries.map(e=>({...e,suspense:!0,throwOnError:T,enabled:!0,placeholderData:void 0}))},r);return[i.map(e=>e.data),i]},useMutation:function(e,r){let{client:s}=n(),i=(0,E.NL)(),o=[e],a=i.getMutationDefaults(o),l=function(e,t){let r=(0,E.NL)(t),[n]=u.useState(()=>new j(r,e));u.useEffect(()=>{n.setOptions(e)},[n,e]);let s=u.useSyncExternalStore(u.useCallback(e=>n.subscribe(f.V.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),i=u.useCallback((e,t)=>{n.mutate(e,t).catch(P)},[n]);if(s.error&&q(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}({...r,mutationKey:o,mutationFn:t=>s.mutation(...z([e,{input:t}],r)),onSuccess:(...e)=>t({originalFn:()=>r?.onSuccess?.(...e)??a?.onSuccess?.(...e),queryClient:i,meta:r?.meta??a?.meta??{}})},i);return l.trpc=H({path:e}),l},useSubscription:/* istanbul ignore next -- @preserve */function(e,t,r){let s=r?.enabled??!0,o=(0,i.Ym)(a(e,t,"any")),{client:l}=n(),c=u.useRef(r);c.current=r,u.useEffect(()=>{if(!s)return;let n=!1,i=l.subscription(e.join("."),t??void 0,{onStarted:()=>{n||c.current.onStarted?.()},onData:e=>{n||r.onData(e)},onError:e=>{n||c.current.onError?.(e)}});return()=>{n=!0,i.unsubscribe()}},[o,s])},useInfiniteQuery:function(e,t,r){let{client:s,ssrState:u,prefetchInfiniteQuery:l,queryClient:c,abortOnUnmount:h}=n(),f=a(e,t,"infinite"),d=c.getQueryDefaults(f),p=t===i.CN;"undefined"!=typeof window||"prepass"!==u||r?.trpc?.ssr===!1||(r?.enabled??d?.enabled)===!1||p||c.getQueryCache().find({queryKey:f})||l(f,{...d,...r});let y=o(f,{...d,...r}),m=r?.trpc?.abortOnUnmount??h,b=_({...y,initialPageParam:r.initialCursor??null,persister:r.persister,queryKey:f,queryFn:p?t:e=>{let t={...y,trpc:{...y?.trpc,...m?{signal:e.signal}:{}}};return s.query(...z(f,t,{pageParam:e.pageParam??r.initialCursor,direction:e.direction}))}},N,c);return b.trpc=H({path:e}),b},useSuspenseInfiniteQuery:function(e,t,r){var s,i;let u=n(),l=a(e,t,"infinite"),c=u.queryClient.getQueryDefaults(l),h=o(l,{...c,...r}),f=r?.trpc?.abortOnUnmount??u.abortOnUnmount,d=(s={...r,initialPageParam:r.initialCursor??null,queryKey:l,queryFn:e=>{let t={...h,trpc:{...h?.trpc,...f?{signal:e.signal}:{}}};return u.client.query(...z(l,t,{pageParam:e.pageParam??r.initialCursor,direction:e.direction}))}},i=u.queryClient,_({...s,enabled:!0,suspense:!0,throwOnError:T},N,i));return d.trpc=H({path:e}),[d.data,d]}}}(e),(0,o.yh)(e=>"useContext"===e||"useUtils"===e?()=>{let e=t.useUtils();return u.useMemo(()=>(0,o.yh)(t=>"client"===t?(0,s.Bm)(e.client):l.includes(t)?e[t]:(0,o.IX)(r=>{let n=[t,...r.path],s=n.pop(),i=[...r.args],o=a(n,i.shift(),h(s));return({fetch:()=>e.fetchQuery(o,...i),fetchInfinite:()=>e.fetchInfiniteQuery(o,i[0]),prefetch:()=>e.prefetchQuery(o,...i),prefetchInfinite:()=>e.prefetchInfiniteQuery(o,i[0]),ensureData:()=>e.ensureQueryData(o,...i),invalidate:()=>e.invalidateQueries(o,...i),reset:()=>e.resetQueries(o,...i),refetch:()=>e.refetchQueries(o,...i),cancel:()=>e.cancelQuery(o,...i),setData:()=>{e.setQueryData(o,i[0],i[1])},setInfiniteData:()=>{e.setInfiniteQueryData(o,i[0],i[1])},getData:()=>e.getQueryData(o),getInfiniteData:()=>e.getInfiniteQueryData(o)})[s]()})),[e])}:t.hasOwnProperty(e)?t[e]:(0,o.IX)(({path:r,args:n})=>{let s=[e,...r],i=s.pop();if("useMutation"===i)return t[i](s,...n);if("_def"===i)return{path:s};let[o,...a]=n,u=a[0]||{};return t[i](s,o,u)}))}},868:function(e,t,r){r.d(t,{yh:function(){return i},IX:function(){return s},sZ:function(){return h},Kn:function(){return a},F7:function(){return b}});let n=()=>{},s=e=>(function e(t,r){return new Proxy(n,{get(n,s){if("string"==typeof s&&"then"!==s)return e(t,[...r,s])},apply(e,n,s){let i="apply"===r[r.length-1];return t({args:i?s.length>=2?s[1]:[]:s,path:i?r.slice(0,-1):r})}})})(e,[]),i=e=>new Proxy(n,{get(t,r){if("string"==typeof r&&"then"!==r)return e(r)}});function o(e,...t){let r=Object.assign(Object.create(null),e);for(let e of t)for(let t in e){if(t in r&&r[t]!==e[t])throw Error(`Duplicate key ${t}`);r[t]=e[t]}return r}function a(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}function u(e){return Object.assign(Object.create(null),e)}let l=i(e=>{throw Error(`Tried to access "$types.${e}" which is not available at runtime`)});class c extends Error{}function h(e){if(e instanceof Error)return e;let t=typeof e;if("undefined"!==t&&"function"!==t&&null!==e){if("object"!==t)return Error(String(e));if(a(e)){let t=new c;for(let r in e)t[r]=e[r];return t}}}function f(e){if(e instanceof d||e instanceof Error&&"TRPCError"===e.name)return e;let t=new d({code:"INTERNAL_SERVER_ERROR",cause:e});return e instanceof Error&&e.stack&&(t.stack=e.stack),t}class d extends Error{constructor(e){let t=h(e.cause);super(e.message??t?.message??e.code,{cause:t}),this.code=e.code,this.name="TRPCError",this.cause||(this.cause=t)}}let p=({shape:e})=>e,y={input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}};class m extends Error{constructor(){super("Unable to transform response from server")}}function b(e,t){let r;try{r=function(e,t){if("error"in e){let r=t.deserialize(e.error);return{ok:!1,error:{...e,error:r}}}return{ok:!0,result:{...e.result,...(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.deserialize(e.result.data)}}}}(e,t)}catch(e){throw new m}if(!r.ok&&(!a(r.error.error)||"number"!=typeof r.error.error.code)||r.ok&&!a(r.result))throw new m;return r}let g={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:p,transformer:y},v=["then"];function w(e){return function(t){let r=new Set(Object.keys(t).filter(e=>v.includes(e)));if(r.size>0)throw Error("Reserved words used in `router({})` call: "+Array.from(r).join(", "));let n=u({}),s=function e(t,r=[]){let s=u({});for(let[i,o]of Object.entries(t??{})){if(o._def&&"router"in o._def){s[i]=e(o._def.record,[...r,i]);continue}if("function"!=typeof o){s[i]=e(o,[...r,i]);continue}let t=[...r,i].join(".");if(n[t])throw Error(`Duplicate key: ${t}`);n[t]=o,s[i]=o}return s}(t),i={_config:e,router:!0,procedures:n,...g,record:s};return{...s,_def:i,createCaller:O()({_def:i})}}}function O(){return function(e){let t=e._def;return function(e,r){return s(async({path:n,args:s})=>{let i;let o=n.join("."),a=t.procedures[o];try{return i="function"==typeof e?await Promise.resolve(e()):e,await a({path:o,getRawInput:async()=>s[0],ctx:i,type:a._def.type})}catch(e){throw r?.onError?.({ctx:i,error:f(e),input:s[0],path:o,type:a._def.type}),e}})}}}function R(...e){let t=o({},...e.map(e=>e._def.record));return w({errorFormatter:e.reduce((e,t)=>{if(t._def._config.errorFormatter&&t._def._config.errorFormatter!==p){if(e!==p&&e!==t._def._config.errorFormatter)throw Error("You seem to have several error formatters");return t._def._config.errorFormatter}return e},p),transformer:e.reduce((e,t)=>{if(t._def._config.transformer&&t._def._config.transformer!==y){if(e!==y&&e!==t._def._config.transformer)throw Error("You seem to have several transformers");return t._def._config.transformer}return e},y),isDev:e.every(e=>e._def._config.isDev),allowOutsideOfServer:e.every(e=>e._def._config.allowOutsideOfServer),isServer:e.every(e=>e._def._config.isServer),$types:e[0]?._def._config.$types})(t)}let E="middlewareMarker";function C(e){if("function"==typeof e)return e;if("function"==typeof e.parseAsync)return e.parseAsync.bind(e);if("function"==typeof e.parse)return e.parse.bind(e);if("function"==typeof e.validateSync)return e.validateSync.bind(e);if("function"==typeof e.create)return e.create.bind(e);if("function"==typeof e.assert)return t=>(e.assert(t),t);throw Error("Could not find a validator fn")}function S(e,t){let{middlewares:r=[],inputs:n,meta:s,...i}=t;return q({...o(e,i),inputs:[...e.inputs,...n??[]],middlewares:[...e.middlewares,...r],meta:e.meta&&s?{...e.meta,...s}:s??e.meta})}function q(e={}){let t={procedure:!0,inputs:[],middlewares:[],...e};return{_def:t,input(e){let r=C(e);return S(t,{inputs:[e],middlewares:[function(e){let t=async function(t){let r;let n=await t.getRawInput();try{r=await e(n)}catch(e){throw new d({code:"BAD_REQUEST",cause:e})}let s=a(t.input)&&a(r)?{...t.input,...r}:r;return t.next({input:s})};return t._type="input",t}(r)]})},output(e){let r=C(e);return S(t,{output:e,middlewares:[function(e){let t=async function({next:t}){let r=await t();if(!r.ok)return r;try{let t=await e(r.data);return{...r,data:t}}catch(e){throw new d({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:e})}};return t._type="output",t}(r)]})},meta:e=>S(t,{meta:e}),use:e=>S(t,{middlewares:"_middlewares"in e?e._middlewares:[e]}),unstable_concat:e=>S(t,e._def),query:e=>P({...t,type:"query"},e),mutation:e=>P({...t,type:"mutation"},e),subscription:e=>P({...t,type:"subscription"},e),experimental_caller:e=>S(t,{caller:e})}}function P(e,t){let r=S(e,{resolver:t,middlewares:[async function(e){return{marker:E,ok:!0,data:await t(e),ctx:e.ctx}}]}),n={...r._def,type:e.type,experimental_caller:!!r._def.caller,meta:r._def.meta,$types:l},s=function(e){async function t(t){if(!t||!("getRawInput"in t))throw Error(x);async function r(n={index:0,ctx:t.ctx}){try{let s=e.middlewares[n.index];return await s({ctx:n.ctx,type:t.type,path:t.path,getRawInput:n.getRawInput??t.getRawInput,meta:e.meta,input:n.input,next:e=>r({index:n.index+1,ctx:e&&"ctx"in e?{...n.ctx,...e.ctx}:n.ctx,input:e&&"input"in e?e.input:n.input,getRawInput:e&&"getRawInput"in e?e.getRawInput:n.getRawInput})})}catch(e){return{ok:!1,error:f(e),marker:E}}}let n=await r();if(!n)throw new d({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!n.ok)throw n.error;return n.data}return t._def=e,t}(r._def),i=r._def.caller;if(!i)return s;let o=async(...e)=>await i({args:e,invoke:s,_def:n});return o._def=n,o}Symbol("unsetMarker");let x=`
This is a client-only function.
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
`.trim(),Q="undefined"==typeof window||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID;class I{context(){return new I}meta(){return new I}create(e){var t;let r={transformer:"input"in(t=e?.transformer??y)?t:{input:t,output:t},isDev:e?.isDev??globalThis.process?.env.NODE_ENV!=="production",allowOutsideOfServer:e?.allowOutsideOfServer??!1,errorFormatter:e?.errorFormatter??p,isServer:e?.isServer??Q,$types:l};if(!(e?.isServer??Q)&&e?.allowOutsideOfServer!==!0)throw Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");return{_config:r,procedure:q({meta:e?.defaultMeta}),middleware:function(e){return function e(t){return{_middlewares:t,unstable_pipe:r=>e([...t,..."_middlewares"in r?r._middlewares:[r]])}}([e])},router:w(r),mergeRouters:R,createCallerFactory:O()}}}new I,Symbol("TypeError")},5047:function(e,t,r){r.d(t,{ZP:function(){return Z}});class n{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}}class s{constructor(e){this.generateIdentifier=e,this.kv=new n}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}}class i extends s{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){"object"==typeof t?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}}function o(e,t){Object.entries(e).forEach(([e,r])=>t(r,e))}function a(e,t){return -1!==e.indexOf(t)}function u(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(t(n))return n}}class l{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return function(e,t){let r=function(e){if("values"in Object)return Object.values(e);let t=[];for(let r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}(e);if("find"in r)return r.find(t);for(let e=0;e<r.length;e++){let n=r[e];if(t(n))return n}}(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}}let c=e=>Object.prototype.toString.call(e).slice(8,-1),h=e=>void 0===e,f=e=>null===e,d=e=>"object"==typeof e&&null!==e&&e!==Object.prototype&&(null===Object.getPrototypeOf(e)||Object.getPrototypeOf(e)===Object.prototype),p=e=>d(e)&&0===Object.keys(e).length,y=e=>Array.isArray(e),m=e=>"string"==typeof e,b=e=>"number"==typeof e&&!isNaN(e),g=e=>"boolean"==typeof e,v=e=>e instanceof Map,w=e=>e instanceof Set,O=e=>"Symbol"===c(e),R=e=>"number"==typeof e&&isNaN(e),E=e=>g(e)||f(e)||h(e)||b(e)||m(e)||O(e),C=e=>e===1/0||e===-1/0,S=e=>e.replace(/\./g,"\\."),q=e=>e.map(String).map(S).join("."),P=e=>{let t=[],r="";for(let n=0;n<e.length;n++){let s=e.charAt(n);if("\\"===s&&"."===e.charAt(n+1)){r+=".",n++;continue}if("."===s){t.push(r),r="";continue}r+=s}let n=r;return t.push(n),t};function x(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}let Q=[x(h,"undefined",()=>null,()=>void 0),x(e=>"bigint"==typeof e,"bigint",e=>e.toString(),e=>"undefined"!=typeof BigInt?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),x(e=>e instanceof Date&&!isNaN(e.valueOf()),"Date",e=>e.toISOString(),e=>new Date(e)),x(e=>e instanceof Error,"Error",(e,t)=>{let r={name:e.name,message:e.message};return t.allowedErrorProps.forEach(t=>{r[t]=e[t]}),r},(e,t)=>{let r=Error(e.message);return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(t=>{r[t]=e[t]}),r}),x(e=>e instanceof RegExp,"regexp",e=>""+e,e=>new RegExp(e.slice(1,e.lastIndexOf("/")),e.slice(e.lastIndexOf("/")+1))),x(w,"set",e=>[...e.values()],e=>new Set(e)),x(v,"map",e=>[...e.entries()],e=>new Map(e)),x(e=>R(e)||C(e),"number",e=>R(e)?"NaN":e>0?"Infinity":"-Infinity",Number),x(e=>0===e&&1/e==-1/0,"number",()=>"-0",Number),x(e=>e instanceof URL,"URL",e=>e.toString(),e=>new URL(e))];function I(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}let T=I((e,t)=>!!O(e)&&!!t.symbolRegistry.getIdentifier(e),(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{let n=r.symbolRegistry.getValue(t[1]);if(!n)throw Error("Trying to deserialize unknown symbol");return n}),D=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),k=I(e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{let r=D[t[1]];if(!r)throw Error("Trying to deserialize unknown typed array");return new r(e)});function F(e,t){return!!e?.constructor&&!!t.classRegistry.getIdentifier(e.constructor)}let M=I(F,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{let r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};let n={};return r.forEach(t=>{n[t]=e[t]}),n},(e,t,r)=>{let n=r.classRegistry.getValue(t[1]);if(!n)throw Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(n.prototype),e)}),_=I((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{let n=r.customTransformerRegistry.findByName(t[1]);if(!n)throw Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),A=[M,T,_,k],j=(e,t)=>{let r=u(A,r=>r.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};let n=u(Q,r=>r.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},U={};Q.forEach(e=>{U[e.annotation]=e});let N=(e,t,r)=>{if(y(t))switch(t[0]){case"symbol":return T.untransform(e,t,r);case"class":return M.untransform(e,t,r);case"custom":return _.untransform(e,t,r);case"typed-array":return k.untransform(e,t,r);default:throw Error("Unknown transformation: "+t)}else{let n=U[t];if(!n)throw Error("Unknown transformation: "+t);return n.untransform(e,r)}},V=(e,t)=>{let r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function K(e){if(a(e,"__proto__"))throw Error("__proto__ is not allowed as a property");if(a(e,"prototype"))throw Error("prototype is not allowed as a property");if(a(e,"constructor"))throw Error("constructor is not allowed as a property")}let L=(e,t)=>{K(t);for(let r=0;r<t.length;r++){let n=t[r];if(w(e))e=V(e,+n);else if(v(e)){let s=+n,i=0==+t[++r]?"key":"value",o=V(e,s);switch(i){case"key":e=o;break;case"value":e=e.get(o)}}else e=e[n]}return e},z=(e,t,r)=>{if(K(t),0===t.length)return r(e);let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(y(n))n=n[+r];else if(d(n))n=n[r];else if(w(n))n=V(n,+r);else if(v(n)){if(e===t.length-2)break;let s=+r,i=0==+t[++e]?"key":"value",o=V(n,s);switch(i){case"key":n=o;break;case"value":n=n.get(o)}}}let s=t[t.length-1];if(y(n)?n[+s]=r(n[+s]):d(n)&&(n[s]=r(n[s])),w(n)){let e=V(n,+s),t=r(e);e!==t&&(n.delete(e),n.add(t))}if(v(n)){let e=V(n,+t[t.length-2]);switch(0==+s?"key":"value"){case"key":{let t=r(e);n.set(t,n.get(e)),t!==e&&n.delete(e);break}case"value":n.set(e,r(n.get(e)))}}return e},H=(e,t)=>d(e)||y(e)||v(e)||w(e)||F(e,t),$=(e,t,r,n,s=[],i=[],u=new Map)=>{let l=E(e);if(!l){!function(e,t,r){let n=r.get(e);n?n.push(t):r.set(e,[t])}(e,s,t);let r=u.get(e);if(r)return n?{transformedValue:null}:r}if(!H(e,r)){let t=j(e,r),n=t?{transformedValue:t.value,annotations:[t.type]}:{transformedValue:e};return l||u.set(e,n),n}if(a(i,e))return{transformedValue:null};let c=j(e,r),h=c?.value??e,f=y(h)?[]:{},m={};o(h,(a,l)=>{if("__proto__"===l||"constructor"===l||"prototype"===l)throw Error(`Detected property ${l}. This is a prototype pollution risk, please remove it from your object.`);let c=$(a,t,r,n,[...s,l],[...i,e],u);f[l]=c.transformedValue,y(c.annotations)?m[l]=c.annotations:d(c.annotations)&&o(c.annotations,(e,t)=>{m[S(l)+"."+t]=e})});let b=p(m)?{transformedValue:f,annotations:c?[c.type]:void 0}:{transformedValue:f,annotations:c?[c.type,m]:m};return l||u.set(e,b),b};function B(e){return Object.prototype.toString.call(e).slice(8,-1)}function G(e){return"Array"===B(e)}class Z{constructor({dedupe:e=!1}={}){this.classRegistry=new i,this.symbolRegistry=new s(e=>e.description??""),this.customTransformerRegistry=new l,this.allowedErrorProps=[],this.dedupe=e}serialize(e){let t=new Map,r=$(e,t,this,this.dedupe),n={json:r.transformedValue};r.annotations&&(n.meta={...n.meta,values:r.annotations});let s=function(e,t){let r;let n={};return(e.forEach(e=>{if(e.length<=1)return;t||(e=e.map(e=>e.map(String)).sort((e,t)=>e.length-t.length));let[s,...i]=e;0===s.length?r=i.map(q):n[q(s)]=i.map(q)}),r)?p(n)?[r]:[r,n]:p(n)?void 0:n}(t,this.dedupe);return s&&(n.meta={...n.meta,referentialEqualities:s}),n}deserialize(e){let{json:t,meta:r}=e,n=function e(t,r={}){return G(t)?t.map(t=>e(t,r)):!function(e){if("Object"!==B(e))return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}(t)?t:[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].reduce((n,s)=>{if(G(r.props)&&!r.props.includes(s))return n;let i=e(t[s],r);return!function(e,t,r,n,s){let i=({}).propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";"enumerable"===i&&(e[t]=r),s&&"nonenumerable"===i&&Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0})}(n,s,i,t,r.nonenumerable),n},{})}(t);if(r?.values){var s,i,a;s=n,i=r.values,a=this,function e(t,r,n=[]){if(!t)return;if(!y(t)){o(t,(t,s)=>e(t,r,[...n,...P(s)]));return}let[s,i]=t;i&&o(i,(t,s)=>{e(t,r,[...n,...P(s)])}),r(s,n)}(i,(e,t)=>{s=z(s,t,t=>N(t,e,a))}),n=s}return r?.referentialEqualities&&(n=function(e,t){function r(t,r){let n=L(e,P(r));t.map(P).forEach(t=>{e=z(e,t,()=>n)})}if(y(t)){let[n,s]=t;n.forEach(t=>{e=z(e,P(t),()=>e)}),s&&o(s,r)}else o(t,r);return e}(n,r.referentialEqualities)),n}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}}Z.defaultInstance=new Z,Z.serialize=Z.defaultInstance.serialize.bind(Z.defaultInstance),Z.deserialize=Z.defaultInstance.deserialize.bind(Z.defaultInstance),Z.stringify=Z.defaultInstance.stringify.bind(Z.defaultInstance),Z.parse=Z.defaultInstance.parse.bind(Z.defaultInstance),Z.registerClass=Z.defaultInstance.registerClass.bind(Z.defaultInstance),Z.registerSymbol=Z.defaultInstance.registerSymbol.bind(Z.defaultInstance),Z.registerCustom=Z.defaultInstance.registerCustom.bind(Z.defaultInstance),Z.allowErrorProps=Z.defaultInstance.allowErrorProps.bind(Z.defaultInstance),Z.serialize,Z.deserialize,Z.stringify,Z.parse,Z.registerClass,Z.registerCustom,Z.registerSymbol,Z.allowErrorProps}}]);