"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6552],{34492:function(e,t,r){/**
 * @license React
 * use-sync-external-store-shim.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var n=r(2265),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=n.useState,o=n.useEffect,u=n.useLayoutEffect,a=n.useDebugValue;function l(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!s(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=i({inst:{value:r,getSnapshot:t}}),s=n[0].inst,c=n[1];return u(function(){s.value=r,s.getSnapshot=t,l(s)&&c({inst:s})},[e,r,t]),o(function(){return l(s)&&c({inst:s}),e(function(){l(s)&&c({inst:s})})},[e]),a(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},10554:function(e,t,r){e.exports=r(34492)},68781:function(e,t,r){r.d(t,{j:function(){return o}});var n=r(31811),s=r(75025);class i extends n.l{constructor(){super(),this.setup=e=>{if(!s.sk&&window.addEventListener){let t=()=>e();return window.addEventListener("visibilitychange",t,!1),window.addEventListener("focus",t,!1),()=>{window.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;null==(e=this.cleanup)||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,null==(t=this.cleanup)||t.call(this),this.cleanup=e(e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})}setFocused(e){this.focused!==e&&(this.focused=e,this.onFocus())}onFocus(){this.listeners.forEach(({listener:e})=>{e()})}isFocused(){return"boolean"==typeof this.focused?this.focused:"undefined"==typeof document||[void 0,"visible","prerender"].includes(document.visibilityState)}}let o=new i},88172:function(e,t,r){function n(){return{onFetch:e=>{e.fetchFn=()=>{var t,r,n,o,u,a;let l;let c=null==(t=e.fetchOptions)?void 0:null==(r=t.meta)?void 0:r.refetchPage,h=null==(n=e.fetchOptions)?void 0:null==(o=n.meta)?void 0:o.fetchMore,f=null==h?void 0:h.pageParam,d=(null==h?void 0:h.direction)==="forward",p=(null==h?void 0:h.direction)==="backward",y=(null==(u=e.state.data)?void 0:u.pages)||[],b=(null==(a=e.state.data)?void 0:a.pageParams)||[],v=b,m=!1,g=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>{var t,r;return null!=(t=e.signal)&&t.aborted?m=!0:null==(r=e.signal)||r.addEventListener("abort",()=>{m=!0}),e.signal}})},w=e.options.queryFn||(()=>Promise.reject("Missing queryFn for queryKey '"+e.options.queryHash+"'")),R=(e,t,r,n)=>(v=n?[t,...v]:[...v,t],n?[r,...e]:[...e,r]),E=(t,r,n,s)=>{if(m)return Promise.reject("Cancelled");if(void 0===n&&!r&&t.length)return Promise.resolve(t);let i={queryKey:e.queryKey,pageParam:n,meta:e.options.meta};return g(i),Promise.resolve(w(i)).then(e=>R(t,n,e,s))};if(y.length){if(d){let t=void 0!==f,r=t?f:s(e.options,y);l=E(y,t,r)}else if(p){let t=void 0!==f,r=t?f:i(e.options,y);l=E(y,t,r,!0)}else{v=[];let t=void 0===e.options.getNextPageParam;l=!c||!y[0]||c(y[0],0,y)?E([],t,b[0]):Promise.resolve(R([],b[0],y[0]));for(let r=1;r<y.length;r++)l=l.then(n=>{if(!c||!y[r]||c(y[r],r,y)){let i=t?b[r]:s(e.options,n);return E(n,t,i)}return Promise.resolve(R(n,b[r],y[r]))})}}else l=E([]);return l.then(e=>({pages:e,pageParams:v}))}}}}function s(e,t){return null==e.getNextPageParam?void 0:e.getNextPageParam(t[t.length-1],t)}function i(e,t){return null==e.getPreviousPageParam?void 0:e.getPreviousPageParam(t[0],t)}function o(e,t){if(e.getNextPageParam&&Array.isArray(t)){let r=s(e,t);return null!=r&&!1!==r}}function u(e,t){if(e.getPreviousPageParam&&Array.isArray(t)){let r=i(e,t);return null!=r&&!1!==r}}r.d(t,{Gm:function(){return n},Qy:function(){return o},ZF:function(){return u}})},74502:function(e,t,r){r.d(t,{_:function(){return n}});let n=console},3976:function(e,t,r){r.d(t,{R:function(){return a},m:function(){return u}});var n=r(74502),s=r(96176),i=r(23318),o=r(34786);class u extends i.F{constructor(e){super(),this.defaultOptions=e.defaultOptions,this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.logger=e.logger||n._,this.observers=[],this.state=e.state||a(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(e){this.dispatch({type:"setState",state:e})}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.observers=this.observers.filter(t=>t!==e),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.observers.length||("loading"===this.state.status?this.scheduleGc():this.mutationCache.remove(this))}continue(){var e,t;return null!=(e=null==(t=this.retryer)?void 0:t.continue())?e:this.execute()}async execute(){var e,t,r,n,s,i,u,a,l,c,h,f,d,p,y,b,v,m,g,w;let R="loading"===this.state.status;try{if(!R){this.dispatch({type:"loading",variables:this.options.variables}),await (null==(l=(c=this.mutationCache.config).onMutate)?void 0:l.call(c,this.state.variables,this));let e=await (null==(h=(f=this.options).onMutate)?void 0:h.call(f,this.state.variables));e!==this.state.context&&this.dispatch({type:"loading",context:e,variables:this.state.variables})}let d=await (()=>{var e;return this.retryer=(0,o.Mz)({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(e,t)=>{this.dispatch({type:"failed",failureCount:e,error:t})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:null!=(e=this.options.retry)?e:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise})();return await (null==(e=(t=this.mutationCache.config).onSuccess)?void 0:e.call(t,d,this.state.variables,this.state.context,this)),await (null==(r=(n=this.options).onSuccess)?void 0:r.call(n,d,this.state.variables,this.state.context)),await (null==(s=(i=this.mutationCache.config).onSettled)?void 0:s.call(i,d,null,this.state.variables,this.state.context,this)),await (null==(u=(a=this.options).onSettled)?void 0:u.call(a,d,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:d}),d}catch(e){try{throw await (null==(d=(p=this.mutationCache.config).onError)?void 0:d.call(p,e,this.state.variables,this.state.context,this)),await (null==(y=(b=this.options).onError)?void 0:y.call(b,e,this.state.variables,this.state.context)),await (null==(v=(m=this.mutationCache.config).onSettled)?void 0:v.call(m,void 0,e,this.state.variables,this.state.context,this)),await (null==(g=(w=this.options).onSettled)?void 0:g.call(w,void 0,e,this.state.variables,this.state.context)),e}finally{this.dispatch({type:"error",error:e})}}}dispatch(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"loading":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!(0,o.Kw)(this.options.networkMode),status:"loading",variables:e.variables};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"};case"setState":return{...t,...e.state}}})(this.state),s.V.batch(()=>{this.observers.forEach(t=>{t.onMutationUpdate(e)}),this.mutationCache.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}}},96176:function(e,t,r){r.d(t,{V:function(){return s}});var n=r(75025);let s=function(){let e=[],t=0,r=e=>{e()},s=e=>{e()},i=s=>{t?e.push(s):(0,n.A4)(()=>{r(s)})},o=()=>{let t=e;e=[],t.length&&(0,n.A4)(()=>{s(()=>{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=>{s=e}}}()},56906:function(e,t,r){r.d(t,{N:function(){return u}});var n=r(31811),s=r(75025);let i=["online","offline"];class o extends n.l{constructor(){super(),this.setup=e=>{if(!s.sk&&window.addEventListener){let t=()=>e();return i.forEach(e=>{window.addEventListener(e,t,!1)}),()=>{i.forEach(e=>{window.removeEventListener(e,t)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;null==(e=this.cleanup)||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,null==(t=this.cleanup)||t.call(this),this.cleanup=e(e=>{"boolean"==typeof e?this.setOnline(e):this.onOnline()})}setOnline(e){this.online!==e&&(this.online=e,this.onOnline())}onOnline(){this.listeners.forEach(({listener:e})=>{e()})}isOnline(){return"boolean"==typeof this.online?this.online:"undefined"==typeof navigator||void 0===navigator.onLine||navigator.onLine}}let u=new o},23318:function(e,t,r){r.d(t,{F:function(){return s}});var n=r(75025);class s{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),(0,n.PN)(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(e){this.cacheTime=Math.max(this.cacheTime||0,null!=e?e:n.sk?1/0:3e5)}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}},34786:function(e,t,r){r.d(t,{DV:function(){return l},Kw:function(){return u},Mz:function(){return c}});var n=r(68781),s=r(56906),i=r(75025);function o(e){return Math.min(1e3*2**e,3e4)}function u(e){return(null!=e?e:"online")!=="online"||s.N.isOnline()}class a{constructor(e){this.revert=null==e?void 0:e.revert,this.silent=null==e?void 0:e.silent}}function l(e){return e instanceof a}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,null==e.onSuccess||e.onSuccess(n),null==t||t(),r(n))},b=r=>{f||(f=!0,null==e.onError||e.onError(r),null==t||t(),l(r))},v=()=>new Promise(r=>{t=e=>{let t=f||!p();return t&&r(e),t},null==e.onPause||e.onPause()}).then(()=>{t=void 0,f||null==e.onContinue||e.onContinue()}),m=()=>{let t;if(!f){try{t=e.fn()}catch(e){t=Promise.reject(e)}Promise.resolve(t).then(y).catch(t=>{var r,n;if(f)return;let s=null!=(r=e.retry)?r:3,u=null!=(n=e.retryDelay)?n:o,a="function"==typeof u?u(h,t):u,l=!0===s||"number"==typeof s&&h<s||"function"==typeof s&&s(h,t);if(c||!l){b(t);return}h++,null==e.onFail||e.onFail(h,t),(0,i.Gh)(a).then(()=>{if(p())return v()}).then(()=>{c?b(t):m()})})}};return u(e.networkMode)?m():v().then(m),{promise:d,cancel:t=>{f||(b(new a(t)),null==e.abort||e.abort())},continue:()=>(null==t?void 0:t())?d:Promise.resolve(),cancelRetry:()=>{c=!0},continueRetry:()=>{c=!1}}}},31811:function(e,t,r){r.d(t,{l:function(){return n}});class n{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){let t={listener:e};return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}},75025:function(e,t,r){r.d(t,{A4:function(){return S},G9:function(){return Q},Gh:function(){return C},I6:function(){return f},Kp:function(){return l},PN:function(){return o},Rc:function(){return a},Rm:function(){return y},SE:function(){return i},VS:function(){return g},X7:function(){return p},ZT:function(){return s},_v:function(){return c},_x:function(){return d},e5:function(){return u},lV:function(){return h},oE:function(){return x},sk:function(){return n},to:function(){return v},yF:function(){return b}});let n="undefined"==typeof window||"Deno"in window;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 u(e,t){return e.filter(e=>!t.includes(e))}function a(e,t,r){let n=e.slice(0);return n[t]=r,n}function l(e,t){return Math.max(e+(t||0)-Date.now(),0)}function c(e,t,r){return O(e)?"function"==typeof t?{...r,queryKey:e,queryFn:t}:{...t,queryKey:e}:e}function h(e,t,r){return O(e)?"function"==typeof t?{...r,mutationKey:e,mutationFn:t}:{...t,mutationKey:e}:"function"==typeof e?{...t,mutationFn:e}:{...e}}function f(e,t,r){return O(e)?[{...t,queryKey:e},r]:[e||{},t]}function d(e,t){let{type:r="all",exact:n,fetchStatus:s,predicate:i,queryKey:o,stale:u}=e;if(O(o)){if(n){if(t.queryHash!==y(o,t.options))return!1}else{if(!m(t.queryKey,o))return!1}}if("all"!==r){let e=t.isActive();if("active"===r&&!e||"inactive"===r&&e)return!1}return("boolean"!=typeof u||t.isStale()===u)&&(void 0===s||s===t.state.fetchStatus)&&(!i||!!i(t))}function p(e,t){let{exact:r,fetching:n,predicate:s,mutationKey:i}=e;if(O(i)){if(!t.options.mutationKey)return!1;if(r){if(b(t.options.mutationKey)!==b(i))return!1}else{if(!m(t.options.mutationKey,i))return!1}}return("boolean"!=typeof n||"loading"===t.state.status===n)&&(!s||!!s(t))}function y(e,t){return((null==t?void 0:t.queryKeyHashFn)||b)(e)}function b(e){return JSON.stringify(e,(e,t)=>R(t)?Object.keys(t).sort().reduce((e,r)=>(e[r]=t[r],e),{}):t)}function v(e,t){return m(e,t)}function m(e,t){return e===t||typeof e==typeof t&&!!e&&!!t&&"object"==typeof e&&"object"==typeof t&&!Object.keys(t).some(r=>!m(e[r],t[r]))}function g(e,t){if(e&&!t||t&&!e)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}function w(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function R(e){if(!E(e))return!1;let t=e.constructor;if(void 0===t)return!0;let r=t.prototype;return!!(E(r)&&r.hasOwnProperty("isPrototypeOf"))}function E(e){return"[object Object]"===Object.prototype.toString.call(e)}function O(e){return Array.isArray(e)}function C(e){return new Promise(t=>{setTimeout(t,e)})}function S(e){C(0).then(e)}function Q(){if("function"==typeof AbortController)return new AbortController}function x(e,t,r){return null!=r.isDataEqual&&r.isDataEqual(e,t)?e:"function"==typeof r.structuralSharing?r.structuralSharing(e,t):!1!==r.structuralSharing?function e(t,r){if(t===r)return t;let n=w(t)&&w(r);if(n||R(t)&&R(r)){let s=n?t.length:Object.keys(t).length,i=n?r:Object.keys(r),o=i.length,u=n?[]:{},a=0;for(let s=0;s<o;s++){let o=n?s:i[s];u[o]=e(t[o],r[o]),u[o]===t[o]&&a++}return s===o&&a===s?t:u}return r}(e,t):t}},27079:function(e,t,r){r.d(t,{NL:function(){return u},aH:function(){return a}});var n=r(2265);let s=n.createContext(void 0),i=n.createContext(!1);function o(e,t){return e||(t&&"undefined"!=typeof window?(window.ReactQueryClientContext||(window.ReactQueryClientContext=s),window.ReactQueryClientContext):s)}let u=function(){let{context:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.useContext(o(e,n.useContext(i)));if(!t)throw Error("No QueryClient set, use QueryClientProvider to set one");return t},a=e=>{let{client:t,children:r,context:s,contextSharing:u=!1}=e;n.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]);let a=o(s,u);return n.createElement(i.Provider,{value:!s&&u},n.createElement(a.Provider,{value:t},r))}},89605: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)=>(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce((e,t)=>t(e),t)})(t)};return t}r.d(t,{BJ:function(){return S},Bm:function(){return P},K5:function(){return q},ch:function(){return O}});class s extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,s.prototype)}}var i=r(88106);function o(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}class u extends Error{constructor(){super("Unable to transform response from server")}}function a(e,t){let r;try{r=function(e,t){if("error"in e){let r=t.transformer.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.transformer.deserialize(e.result.data)}}}}(e,t)}catch(e){throw new u}if(!r.ok&&(!o(r.error.error)||"number"!=typeof r.error.error.code)||r.ok&&!o(r.result))throw new u;return r}class l extends Error{static from(e,t={}){return e instanceof l||e instanceof Error&&"TRPCClientError"===e.name?(t.meta&&(e.meta={...e.meta,...t.meta}),e):o(e)&&o(e.error)&&"number"==typeof e.error.code&&"string"==typeof e.error.message?new l(e.error.message,{...t,result:e}):e instanceof Error?new l(e.message,{...t,cause:(0,i.sZ)(e)}):new l("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,l.prototype)}}let c=e=>"function"==typeof e;function h(e){var t;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}}let f={query:"GET",mutation:"POST"};function d(e){return"input"in e?e.runtime.transformer.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.runtime.transformer.serialize(t)))}let p=e=>{let t=e.url+"/"+e.path,r=[];if("inputs"in e&&r.push("batch=1"),"query"===e.type){let t=d(e);void 0!==t&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(t+="?"+r.join("&")),t},y=e=>{if("query"===e.type)return;let t=d(e);return void 0!==t?JSON.stringify(t):void 0},b=e=>m({...e,contentTypeHeader:"application/json",getUrl:p,getBody:y});async function v(e,t){let r=e.getUrl(e),n=e.getBody(e),{type:s}=e,i=await e.headers();/* 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&&c(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&c(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")})(e.fetch)(r,{method:f[s],signal:t?.signal,body:n,headers:o})}function m(e){let t=e.AbortController?new e.AbortController:null,r={},n=!1;return{promise:new Promise((s,i)=>{v(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(l.from(e,{meta:r}))})}),cancel:()=>{n||t?.abort()}}}let g=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function w(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:g};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:g,reject:g},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)}}}}}function R(e){return function(t){let r=h(t),s=t.maxURLLength??1/0;return i=>{let o=n=>({validate:e=>{if(s===1/0)return!0;let t=e.map(e=>e.path).join(","),o=e.map(e=>e.input);return p({...r,runtime:i,type:n,path:t,inputs:o}).length<=s},fetch:e({...r,runtime:i,type:n,opts:t})}),u=w(o("query")),c=w(o("mutation")),h={query:u,subscription:w(o("subscription")),mutation:c};return({op:e})=>n(t=>{let r;let{promise:n,cancel:s}=h[e.type].load(e);return n.then(e=>{r=e;let n=a(e.json,i);if(!n.ok){t.error(l.from(n.error,{meta:e.meta}));return}t.next({context:e.meta,result:n.result}),t.complete()}).catch(e=>{t.error(l.from(e,{meta:r?.meta}))}),()=>{s()}})}}}function E(e){return t=>{let r=h(t);return s=>({op:i})=>n(n=>{let o;let{path:u,input:c,type:h}=i,{promise:f,cancel:d}=e.requester({...r,runtime:s,type:h,path:u,input:c,headers:()=>t.headers?"function"==typeof t.headers?t.headers({op:i}):t.headers:{}});return f.then(e=>{o=e.meta;let t=a(e.json,s);if(!t.ok){n.error(l.from(t.error,{meta:o}));return}n.next({context:e.meta,result:t.result}),n.complete()}).catch(e=>{n.error(l.from(e,{meta:o}))}),()=>{d()}})}}R(e=>t=>{let r=t.map(e=>e.path).join(","),n=t.map(e=>e.input),{promise:s,cancel:i}=b({...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 O=E({requester:b});class C{$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,n=[];return{subscribe:s=>(t++,n.push(s),r||(r=e.subscribe({next(e){for(let t of n)t.next?.(e)},error(e){for(let t of n)t.error?.(e)},complete(){for(let e of n)e.complete?.()}})),{unsubscribe(){t--,function(){if(0===t&&r){let e=r;r=null,e.unsubscribe()}}();let e=n.findIndex(e=>e===s);e>-1&&n.splice(e,1)}})}})}requestAsPromise(e){var t;let r;let{promise:n,abort:i}=(t=this.$request(e),{promise:new Promise((e,n)=>{let i=!1;function o(){i||(i=!0,n(new s("This operation was aborted.")),u.unsubscribe())}let u=t.subscribe({next(t){i=!0,e(t),o()},error(e){i=!0,n(e),o()},complete(){i=!0,o()}});r=o}),abort:r});return new Promise((t,r)=>{e.signal?.addEventListener("abort",i),n.then(e=>{t(e.result.data)}).catch(e=>{r(l.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;let t=(()=>{let t=e.transformer;return t?"input"in t?e.transformer:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}})();this.runtime={transformer:{serialize:e=>t.input.serialize(e),deserialize:e=>t.output.deserialize(e)},combinedTransformer:t},this.links=e.links.map(e=>e(this.runtime))}}function S(e){return new C(e)}let Q={query:"query",mutate:"mutation",subscribe:"subscription"},x=e=>Q[e];function P(e){return(0,i.yh)(t=>e.hasOwnProperty(t)?e[t]:"__untypedClient"===t?e:(0,i.IX)(({path:r,args:n})=>{let s=[t,...r],i=x(s.pop()),o=s.join(".");return e[i](o,...n)}))}function q(e){return P(new C(e))}async function T(e){let t=e.parse??JSON.parse;await I(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 I(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 D(e,s):await new Promise(t=>{e.on("data",s),e.on("end",t)}),t(n)}async function D(e,t){let r=e.getReader(),n=await r.read();for(;!n.done;)t(n.value),n=await r.read()}let M=(e,t)=>{let r=e.AbortController?new e.AbortController:null;return{cancel:()=>r?.abort(),promise:v({...e,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:p,getBody:y},r).then(async n=>{if(!n.body)throw Error("Received response without body");let s={response:n};return T({readableStream:n.body,onSingle:t,parse:e=>({json:JSON.parse(e),meta:s}),signal:r?.signal,textDecoder:e.textDecoder})})}};R(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:u}=M({...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:u.then(()=>[]),cancel:o}}});let k=e=>{if("input"in e){if(!(e.input instanceof FormData))throw Error("Input is not FormData");return e.input}};E({requester:e=>{if("mutation"!==e.type)throw Error("We only handle mutations with formdata");return m({...e,getUrl:()=>`${e.url}/${e.path}`,getBody:k})}})},76552:function(e,t,r){let n;r.d(t,{ec:function(){return z}});var s=r(89605),i=r(88106);function o(e,t){let[r,n]=Array.isArray(e)?e:[e],s="string"!=typeof r||""===r?[]:r.split(".");return n||t&&"any"!==t?[s,{...void 0!==n&&{input:n},...t&&"any"!==t&&{type:t}}]:s.length?[s]:[]}var u=r(75025),a=r(96176),l=r(68781),c=r(31811),h=r(34786);class f extends c.l{constructor(e,t){super(),this.client=e,this.options=t,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.currentQuery.addObserver(this),d(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return p(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return p(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(e,t){let r=this.options,n=this.currentQuery;if(this.options=this.client.defaultQueryOptions(e),(0,u.VS)(r,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled)throw Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),this.updateQuery();let s=this.hasListeners();s&&y(this.currentQuery,n,this.options,r)&&this.executeFetch(),this.updateResult(t),s&&(this.currentQuery!==n||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&this.updateStaleTimeout();let i=this.computeRefetchInterval();s&&(this.currentQuery!==n||this.options.enabled!==r.enabled||i!==this.currentRefetchInterval)&&this.updateRefetchInterval(i)}getOptimisticResult(e){let t=this.client.getQueryCache().build(this.client,e),r=this.createResult(t,e);return e.keepPreviousData||(void 0!==e.placeholderData?!r.isPlaceholderData:(0,u.VS)(this.getCurrentResult(),r))||(this.currentResult=r,this.currentResultOptions=this.options,this.currentResultState=this.currentQuery.state),r}getCurrentResult(){return this.currentResult}trackResult(e){let t={};return Object.keys(e).forEach(r=>{Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(r),e[r])})}),t}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:e,...t}={}){return this.fetch({...t,meta:{refetchPage:e}})}fetchOptimistic(e){let t=this.client.defaultQueryOptions(e),r=this.client.getQueryCache().build(this.client,t);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,t))}fetch(e){var t;return this.executeFetch({...e,cancelRefetch:null==(t=e.cancelRefetch)||t}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(e){this.updateQuery();let t=this.currentQuery.fetch(this.options,e);return null!=e&&e.throwOnError||(t=t.catch(u.ZT)),t}updateStaleTimeout(){if(this.clearStaleTimeout(),u.sk||this.currentResult.isStale||!(0,u.PN)(this.options.staleTime))return;let e=(0,u.Kp)(this.currentResult.dataUpdatedAt,this.options.staleTime);this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},e+1)}computeRefetchInterval(){var e;return"function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.currentResult.data,this.currentQuery):null!=(e=this.options.refetchInterval)&&e}updateRefetchInterval(e){this.clearRefetchInterval(),this.currentRefetchInterval=e,!u.sk&&!1!==this.options.enabled&&(0,u.PN)(this.currentRefetchInterval)&&0!==this.currentRefetchInterval&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||l.j.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(e,t){let r;let n=this.currentQuery,s=this.options,i=this.currentResult,o=this.currentResultState,a=this.currentResultOptions,l=e!==n,c=l?e.state:this.currentQueryInitialState,f=l?this.currentResult:this.previousQueryResult,{state:p}=e,{dataUpdatedAt:v,error:m,errorUpdatedAt:g,fetchStatus:w,status:R}=p,E=!1,O=!1;if(t._optimisticResults){let r=this.hasListeners(),i=!r&&d(e,t),o=r&&y(e,n,t,s);(i||o)&&(w=(0,h.Kw)(e.options.networkMode)?"fetching":"paused",v||(R="loading")),"isRestoring"===t._optimisticResults&&(w="idle")}if(t.keepPreviousData&&!p.dataUpdatedAt&&null!=f&&f.isSuccess&&"error"!==R)r=f.data,v=f.dataUpdatedAt,R=f.status,E=!0;else if(t.select&&void 0!==p.data){if(i&&p.data===(null==o?void 0:o.data)&&t.select===this.selectFn)r=this.selectResult;else try{this.selectFn=t.select,r=t.select(p.data),r=(0,u.oE)(null==i?void 0:i.data,r,t),this.selectResult=r,this.selectError=null}catch(e){this.selectError=e}}else r=p.data;if(void 0!==t.placeholderData&&void 0===r&&"loading"===R){let e;if(null!=i&&i.isPlaceholderData&&t.placeholderData===(null==a?void 0:a.placeholderData))e=i.data;else if(e="function"==typeof t.placeholderData?t.placeholderData():t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.selectError=null}catch(e){this.selectError=e}void 0!==e&&(R="success",r=(0,u.oE)(null==i?void 0:i.data,e,t),O=!0)}this.selectError&&(m=this.selectError,r=this.selectResult,g=Date.now(),R="error");let C="fetching"===w,S="loading"===R,Q="error"===R;return{status:R,fetchStatus:w,isLoading:S,isSuccess:"success"===R,isError:Q,isInitialLoading:S&&C,data:r,dataUpdatedAt:v,error:m,errorUpdatedAt:g,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>c.dataUpdateCount||p.errorUpdateCount>c.errorUpdateCount,isFetching:C,isRefetching:C&&!S,isLoadingError:Q&&0===p.dataUpdatedAt,isPaused:"paused"===w,isPlaceholderData:O,isPreviousData:E,isRefetchError:Q&&0!==p.dataUpdatedAt,isStale:b(e,t),refetch:this.refetch,remove:this.remove}}updateResult(e){let t=this.currentResult,r=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,(0,u.VS)(r,t))return;this.currentResult=r;let n={cache:!0};(null==e?void 0:e.listeners)!==!1&&(()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.trackedProps.size)return!0;let n=new Set(null!=r?r:this.trackedProps);return this.options.useErrorBoundary&&n.add("error"),Object.keys(this.currentResult).some(e=>this.currentResult[e]!==t[e]&&n.has(e))})()&&(n.listeners=!0),this.notify({...n,...e})}updateQuery(){let e=this.client.getQueryCache().build(this.client,this.options);if(e===this.currentQuery)return;let t=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(null==t||t.removeObserver(this),e.addObserver(this))}onQueryUpdate(e){let t={};"success"===e.type?t.onSuccess=!e.manual:"error"!==e.type||(0,h.DV)(e.error)||(t.onError=!0),this.updateResult(t),this.hasListeners()&&this.updateTimers()}notify(e){a.V.batch(()=>{var t,r,n,s,i,o,u,a;e.onSuccess?(null==(t=(r=this.options).onSuccess)||t.call(r,this.currentResult.data),null==(n=(s=this.options).onSettled)||n.call(s,this.currentResult.data,null)):e.onError&&(null==(i=(o=this.options).onError)||i.call(o,this.currentResult.error),null==(u=(a=this.options).onSettled)||u.call(a,void 0,this.currentResult.error)),e.listeners&&this.listeners.forEach(({listener:e})=>{e(this.currentResult)}),e.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function d(e,t){return!1!==t.enabled&&!e.state.dataUpdatedAt&&!("error"===e.state.status&&!1===t.retryOnMount)||e.state.dataUpdatedAt>0&&p(e,t,t.refetchOnMount)}function p(e,t,r){if(!1!==t.enabled){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&b(e,t)}return!1}function y(e,t,r,n){return!1!==r.enabled&&(e!==t||!1===n.enabled)&&(!r.suspense||"error"!==e.state.status)&&b(e,r)}function b(e,t){return e.isStaleByTime(t.staleTime)}var v=r(2265);let m=r(10554).useSyncExternalStore,g=v.createContext((n=!1,{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n})),w=()=>v.useContext(g);var R=r(27079);let E=v.createContext(!1),O=()=>v.useContext(E);function C(e,t){return"function"==typeof e?e(...t):!!e}E.Provider;let S=(e,t)=>{(e.suspense||e.useErrorBoundary)&&!t.isReset()&&(e.retryOnMount=!1)},Q=e=>{v.useEffect(()=>{e.clearReset()},[e])},x=e=>{let{result:t,errorResetBoundary:r,useErrorBoundary:n,query:s}=e;return t.isError&&!r.isReset()&&!t.isFetching&&C(n,[t.error,s])},P=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},q=(e,t)=>e.isLoading&&e.isFetching&&!t,T=(e,t,r)=>(null==e?void 0:e.suspense)&&q(t,r),I=(e,t,r)=>t.fetchOptimistic(e).then(({data:t})=>{null==e.onSuccess||e.onSuccess(t),null==e.onSettled||e.onSettled(t,null)}).catch(t=>{r.clearReset(),null==e.onError||e.onError(t),null==e.onSettled||e.onSettled(void 0,t)});function D(e,t){let r=(0,R.NL)({context:e.context}),n=O(),s=w(),i=r.defaultQueryOptions(e);i._optimisticResults=n?"isRestoring":"optimistic",i.onError&&(i.onError=a.V.batchCalls(i.onError)),i.onSuccess&&(i.onSuccess=a.V.batchCalls(i.onSuccess)),i.onSettled&&(i.onSettled=a.V.batchCalls(i.onSettled)),P(i),S(i,s),Q(s);let[o]=v.useState(()=>new t(r,i)),u=o.getOptimisticResult(i);if(m(v.useCallback(e=>{let t=n?()=>void 0:o.subscribe(a.V.batchCalls(e));return o.updateResult(),t},[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),v.useEffect(()=>{o.setOptions(i,{listeners:!1})},[i,o]),T(i,u,n))throw I(i,o,s);if(x({result:u,errorResetBoundary:s,useErrorBoundary:i.useErrorBoundary,query:o.getCurrentQuery()}))throw u.error;return i.notifyOnChangeProps?u:o.trackResult(u)}var M=r(3976);class k extends c.l{constructor(e,t){super(),this.client=e,this.setOptions(t),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;let r=this.options;this.options=this.client.defaultMutationOptions(e),(0,u.VS)(r,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),null==(t=this.currentMutation)||t.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var e;null==(e=this.currentMutation)||e.removeObserver(this)}}onMutationUpdate(e){this.updateResult();let t={listeners:!0};"success"===e.type?t.onSuccess=!0:"error"===e.type&&(t.onError=!0),this.notify(t)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(e,t){return this.mutateOptions=t,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:void 0!==e?e:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){let e=this.currentMutation?this.currentMutation.state:(0,M.R)(),t={...e,isLoading:"loading"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset};this.currentResult=t}notify(e){a.V.batch(()=>{if(this.mutateOptions&&this.hasListeners()){var t,r,n,s,i,o,u,a;e.onSuccess?(null==(t=(r=this.mutateOptions).onSuccess)||t.call(r,this.currentResult.data,this.currentResult.variables,this.currentResult.context),null==(n=(s=this.mutateOptions).onSettled)||n.call(s,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)):e.onError&&(null==(i=(o=this.mutateOptions).onError)||i.call(o,this.currentResult.error,this.currentResult.variables,this.currentResult.context),null==(u=(a=this.mutateOptions).onSettled)||u.call(a,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context))}e.listeners&&this.listeners.forEach(({listener:e})=>{e(this.currentResult)})})}}function F(){}var A=r(88172);class j extends f{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,A.Gm)()},t)}getOptimisticResult(e){return e.behavior=(0,A.Gm)(),super.getOptimisticResult(e)}fetchNextPage({pageParam:e,...t}={}){return this.fetch({...t,meta:{fetchMore:{direction:"forward",pageParam:e}}})}fetchPreviousPage({pageParam:e,...t}={}){return this.fetch({...t,meta:{fetchMore:{direction:"backward",pageParam:e}}})}createResult(e,t){var r,n,s,i,o,u;let{state:a}=e,l=super.createResult(e,t),{isFetching:c,isRefetching:h}=l,f=c&&(null==(r=a.fetchMeta)?void 0:null==(n=r.fetchMore)?void 0:n.direction)==="forward",d=c&&(null==(s=a.fetchMeta)?void 0:null==(i=s.fetchMore)?void 0:i.direction)==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,A.Qy)(t,null==(o=a.data)?void 0:o.pages),hasPreviousPage:(0,A.ZF)(t,null==(u=a.data)?void 0:u.pages),isFetchingNextPage:f,isFetchingPreviousPage:d,isRefetching:h&&!f&&!d}}}class N extends c.l{constructor(e,t){super(),this.client=e,this.queries=[],this.result=[],this.observers=[],this.observersMap={},t&&this.setQueries(t)}onSubscribe(){1===this.listeners.size&&this.observers.forEach(e=>{e.subscribe(t=>{this.onUpdate(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.observers.forEach(e=>{e.destroy()})}setQueries(e,t){this.queries=e,a.V.batch(()=>{let e=this.observers,r=this.findMatchingObservers(this.queries);r.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions,t));let n=r.map(e=>e.observer),s=Object.fromEntries(n.map(e=>[e.options.queryHash,e])),i=n.map(e=>e.getCurrentResult()),o=n.some((t,r)=>t!==e[r]);(e.length!==n.length||o)&&(this.observers=n,this.observersMap=s,this.result=i,this.hasListeners()&&((0,u.e5)(e,n).forEach(e=>{e.destroy()}),(0,u.e5)(n,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=new Map(t.map(e=>[e.options.queryHash,e])),n=e.map(e=>this.client.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)),u=new Set(s.map(e=>e.observer)),a=t.filter(e=>!u.has(e)),l=e=>{let t=this.client.defaultQueryOptions(e),r=this.observersMap[t.queryHash];return null!=r?r:new f(this.client,t)},c=o.map((e,t)=>{if(e.keepPreviousData){let r=a[t];if(void 0!==r)return{defaultedQueryOptions:e,observer:r}}return{defaultedQueryOptions:e,observer:l(e)}});return s.concat(c).sort((e,t)=>n.indexOf(e.defaultedQueryOptions)-n.indexOf(t.defaultedQueryOptions))}onUpdate(e,t){let r=this.observers.indexOf(e);-1!==r&&(this.result=(0,u.Rc)(this.result,r,t),this.notify())}notify(){a.V.batch(()=>{this.listeners.forEach(({listener:e})=>{e(this.result)})})}}function U(e,t){return e.length?void 0===t?[e]:[e,t]:[]}let L=["client","ssrContext","ssrState","abortOnUnmount"],K=(0,v.createContext)(null);function _(e,t){let[r,n]=e;return[r,n,t?.trpc]}function V(e){let{path:t}=e;return(0,v.useMemo)(()=>({path:t}),[t])}function z(e){var t;return t=function(e){let t=(e?.overrides??e?.unstable_overrides)?.useMutation?.onSuccess??(e=>e.originalFn()),r=e?.context??K,n=e?.reactQueryContext;function l(){return v.useContext(r)}function c(e,t,r){let{queryClient:n,ssrState:s}=l();return s&&"mounted"!==s&&n.getQueryCache().find(o(e,t))?.state.status==="error"?{retryOnMount:!1,...r}:r}return{Provider:e=>{let{abortOnUnmount:t=!1,client:n,queryClient:s,ssrContext:i}=e,[u,a]=(0,v.useState)(e.ssrState??!1);return(0,v.useEffect)(()=>{a(e=>!!e&&"mounted")},[]),v.createElement(r.Provider,{value:{abortOnUnmount:t,queryClient:s,client:n,ssrContext:i??null,ssrState:u,fetchQuery:(0,v.useCallback)((e,t)=>s.fetchQuery({...t,queryKey:o(e,"query"),queryFn:()=>n.query(..._(e,t))}),[n,s]),fetchInfiniteQuery:(0,v.useCallback)((e,t)=>s.fetchInfiniteQuery({...t,queryKey:o(e,"infinite"),queryFn:({pageParam:r})=>{let[s,i]=e,o={...i,cursor:r};return n.query(..._([s,o],t))}}),[n,s]),prefetchQuery:(0,v.useCallback)((e,t)=>s.prefetchQuery({...t,queryKey:o(e,"query"),queryFn:()=>n.query(..._(e,t))}),[n,s]),prefetchInfiniteQuery:(0,v.useCallback)((e,t)=>s.prefetchInfiniteQuery({...t,queryKey:o(e,"infinite"),queryFn:({pageParam:r})=>{let[s,i]=e,o={...i,cursor:r};return n.query(..._([s,o],t))}}),[n,s]),ensureQueryData:(0,v.useCallback)((e,t)=>s.ensureQueryData({...t,queryKey:o(e,"query"),queryFn:()=>n.query(..._(e,t))}),[n,s]),invalidateQueries:(0,v.useCallback)((e,t,r)=>s.invalidateQueries({...t,queryKey:o(e,"any")},r),[s]),resetQueries:(0,v.useCallback)((...e)=>{let[t,r,n]=e;return s.resetQueries({...r,queryKey:o(t,"any")},n)},[s]),refetchQueries:(0,v.useCallback)((...e)=>{let[t,r,n]=e;return s.refetchQueries({...r,queryKey:o(t,"any")},n)},[s]),cancelQuery:(0,v.useCallback)(e=>s.cancelQueries({queryKey:o(e,"any")}),[s]),setQueryData:(0,v.useCallback)((...e)=>{let[t,...r]=e;return s.setQueryData(o(t,"query"),...r)},[s]),getQueryData:(0,v.useCallback)((...e)=>{let[t,...r]=e;return s.getQueryData(o(t,"query"),...r)},[s]),setInfiniteQueryData:(0,v.useCallback)((...e)=>{let[t,...r]=e;return s.setQueryData(o(t,"infinite"),...r)},[s]),getInfiniteQueryData:(0,v.useCallback)((...e)=>{let[t,...r]=e;return s.getQueryData(o(t,"infinite"),...r)},[s])}},e.children)},createClient:e=>(0,s.BJ)(e),useContext:l,useUtils:l,useQuery:function(t,r){var s;let i=l();if(!i)throw Error("Unable to retrieve application context. Did you forget to wrap your App inside `withTRPC` HoC?");let{abortOnUnmount:a,client:h,ssrState:d,queryClient:p,prefetchQuery:y}=i,b=p.getQueryDefaults(o(t,"query"));"undefined"!=typeof window||"prepass"!==d||r?.trpc?.ssr===!1||(r?.enabled??b?.enabled)===!1||p.getQueryCache().find(o(t,"query"))||y(t,r);let v=c(t,"query",{...b,...r}),m=r?.trpc?.abortOnUnmount??e?.abortOnUnmount??a,g=(s={...v,queryKey:o(t,"query"),queryFn:e=>{let r={...v,trpc:{...v?.trpc,...m?{signal:e.signal}:{}}};return h.query(..._(t,r))},context:n},D((0,u._v)(s,void 0,void 0),f));return g.trpc=V({path:t[0]}),g},useQueries:(e,t)=>{let{ssrState:r,queryClient:n,prefetchQuery:s,client:u}=l(),c=e((0,i.IX)(e=>{let t=e.path.join("."),[r,n]=e.args;return{queryKey:U(t,r),queryFn:()=>u.query(t,r,n?.trpc),...n}}));if("undefined"==typeof window&&"prepass"===r)for(let e of c)e.trpc?.ssr===!1||n.getQueryCache().find(o(e.queryKey,"query"))||s(e.queryKey,e);return function(e){let{queries:t,context:r}=e,n=(0,R.NL)({context:r}),s=O(),i=w(),o=v.useMemo(()=>t.map(e=>{let t=n.defaultQueryOptions(e);return t._optimisticResults=s?"isRestoring":"optimistic",t}),[t,n,s]);o.forEach(e=>{P(e),S(e,i)}),Q(i);let[u]=v.useState(()=>new N(n,o)),l=u.getOptimisticResult(o);m(v.useCallback(e=>s?()=>void 0:u.subscribe(a.V.batchCalls(e)),[u,s]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),v.useEffect(()=>{u.setQueries(o,{listeners:!1})},[o,u]);let c=l.some((e,t)=>T(o[t],e,s))?l.flatMap((e,t)=>{let r=o[t],n=u.getObservers()[t];if(r&&n){if(T(r,e,s))return I(r,n,i);q(e,s)&&I(r,n,i)}return[]}):[];if(c.length>0)throw Promise.all(c);let h=u.getQueries(),f=l.find((e,t)=>{var r,n;return x({result:e,errorResetBoundary:i,useErrorBoundary:null!=(r=null==(n=o[t])?void 0:n.useErrorBoundary)&&r,query:h[t]})});if(null!=f&&f.error)throw f.error;return l}({queries:c.map(e=>({...e,queryKey:o(e.queryKey,"query")})),context:t})},useMutation:function(e,r){let{client:s}=l(),i=(0,R.NL)({context:n}),o=Array.isArray(e)?e[0]:e,c=i.getMutationDefaults([o.split(".")]),h=function(e,t,r){let n=(0,u.lV)(e,void 0,void 0),s=(0,R.NL)({context:n.context}),[i]=v.useState(()=>new k(s,n));v.useEffect(()=>{i.setOptions(n)},[i,n]);let o=m(v.useCallback(e=>i.subscribe(a.V.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),l=v.useCallback((e,t)=>{i.mutate(e,t).catch(F)},[i]);if(o.error&&C(i.options.useErrorBoundary,[o.error]))throw o.error;return{...o,mutate:l,mutateAsync:o.mutate}}({...r,mutationKey:[o.split(".")],mutationFn:e=>s.mutation(..._([o,e],r)),context:n,onSuccess:(...e)=>t({originalFn:()=>r?.onSuccess?.(...e)??c?.onSuccess?.(...e),queryClient:i,meta:r?.meta??c?.meta??{}})});return h.trpc=V({path:o}),h},useSubscription:/* istanbul ignore next -- @preserve */function(e,t){let r=t?.enabled??!0,n=(0,u.yF)(e),{client:s}=l(),i=(0,v.useRef)(t);i.current=t,(0,v.useEffect)(()=>{if(!r)return;let[t,n]=e,o=!1,u=s.subscription(t,n??void 0,{onStarted:()=>{o||i.current.onStarted?.()},onData:e=>{o||i.current.onData(e)},onError:e=>{o||i.current.onError?.(e)}});return()=>{o=!0,u.unsubscribe()}},[n,r])},useDehydratedState:(e,t)=>(0,v.useMemo)(()=>t?e.runtime.transformer.deserialize(t):t,[t,e]),useInfiniteQuery:function(e,t){var r;let[s,i]=e,{client:a,ssrState:h,prefetchInfiniteQuery:f,queryClient:d,abortOnUnmount:p}=l(),y=d.getQueryDefaults(o(e,"infinite"));"undefined"!=typeof window||"prepass"!==h||t?.trpc?.ssr===!1||(t?.enabled??y?.enabled)===!1||d.getQueryCache().find(o(e,"infinite"))||f(e,{...y,...t});let b=c(e,"infinite",{...y,...t}),v=t?.trpc?.abortOnUnmount??p,m=(r={...b,queryKey:o(e,"infinite"),queryFn:e=>{let r={...b,trpc:{...b?.trpc,...v?{signal:e.signal}:{}}},n={...i??{},cursor:e.pageParam??t?.initialCursor};return a.query(..._([s,n],r))},context:n},D((0,u._v)(r,void 0,void 0),j));return m.trpc=V({path:s}),m}}}(e),(0,i.yh)(e=>"useContext"===e||"useUtils"===e?()=>{let e=t.useUtils();return(0,v.useMemo)(()=>(0,i.yh)(t=>"client"===t?(0,s.Bm)(e.client):L.includes(t)?e[t]:(0,i.IX)(({path:r,args:n})=>{let s=[t,...r],i=s.pop(),o=s.join("."),{queryKey:u,rest:a,updater:l}=(e=>{if(["setData","setInfiniteData"].includes(e)){let[e,t,...r]=n;return{queryKey:U(o,e),updater:t,rest:r}}let[t,...r]=n;return{queryKey:U(o,t),rest:r}})(i);return({fetch:()=>e.fetchQuery(u,...a),fetchInfinite:()=>e.fetchInfiniteQuery(u,...a),prefetch:()=>e.prefetchQuery(u,...a),prefetchInfinite:()=>e.prefetchInfiniteQuery(u,...a),ensureData:()=>e.ensureQueryData(u,...a),invalidate:()=>e.invalidateQueries(u,...a),reset:()=>e.resetQueries(u,...a),refetch:()=>e.refetchQueries(u,...a),cancel:()=>e.cancelQuery(u,...a),setData:()=>{e.setQueryData(u,l,...a)},setInfiniteData:()=>{e.setInfiniteQueryData(u,l,...a)},getData:()=>e.getQueryData(u),getInfiniteData:()=>e.getInfiniteQueryData(u)})[i]()})),[e])}:t.hasOwnProperty(e)?t[e]:(0,i.IX)(r=>{let n=r.args,s=[e,...r.path],i=s.pop(),u=s.join(".");if("useMutation"===i)return t[i](u,...n);let[a,...l]=n,c=U(u,a);if("getQueryKey"===i)return o(c,l[0]??"any");if("_def"===i)return{path:s};if(i.startsWith("useSuspense")){let e=l[0]||{},r=t["useSuspenseQuery"===i?"useQuery":"useInfiniteQuery"](c,{...e,suspense:!0,enabled:!0});return[r.data,r]}return t[i](c,...l)}))}},88106:function(e,t,r){function n(e){let t=Object.create(null);for(let r in e)t[e[r]]=r;return t}r.d(t,{yh:function(){return u},IX:function(){return o},sZ:function(){return l}});let s={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};n(s),n(s);let i=()=>{},o=e=>(function e(t,r){return new Proxy(i,{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,[]),u=e=>new Proxy(i,{get(t,r){if("string"==typeof r&&"then"!==r)return e(r)}});class a extends Error{}function l(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(e&&!Array.isArray(e)&&"object"==typeof e){let t=new a;for(let r in e)t[r]=e[r];return t}}}}}]);