(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,58345,346974,e=>{"use strict";var t=e.i(619273);e.i(247167);var r=e.i(540143),n=e.i(936553),i=e.i(88587),s=class extends i.Removable{constructor(e){super(),this.#e=!1,this.#t=e.defaultOptions,this.#r(e.options),this.#n=[],this.#i=e.cache,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#s=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.#s,this.scheduleGc()}#s;#o;#i;#a;#u;#n;#t;#e;get meta(){return this.options.meta}#r(e){this.options={...this.#t,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.#n.length||"idle"!==this.state.fetchStatus||this.#i.remove(this)}setData(e,r){let n=(0,t.replaceData)(this.state.data,e,this.options);return this.#c({data:n,type:"success",dataUpdatedAt:r?.updatedAt,manual:r?.manual}),n}setState(e,t){this.#c({type:"setState",state:e,setStateOptions:t})}cancel(e){let r=this.#a;return this.#u?.cancel(e),r?r.then(t.noop).catch(t.noop):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#s)}isActive(){return this.#n.some(e=>!1!==e.options.enabled)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.#n.some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!(0,t.timeUntilStale)(this.state.dataUpdatedAt,e)}onFocus(){let e=this.#n.find(e=>e.shouldFetchOnWindowFocus());e?.refetch({cancelRefetch:!1}),this.#u?.continue()}onOnline(){let e=this.#n.find(e=>e.shouldFetchOnReconnect());e?.refetch({cancelRefetch:!1}),this.#u?.continue()}addObserver(e){this.#n.includes(e)||(this.#n.push(e),this.clearGcTimeout(),this.#i.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.#u&&(this.#e?this.#u.cancel({revert:!0}):this.#u.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.#n.length}invalidate(){this.state.isInvalidated||this.#c({type:"invalidate"})}fetch(e,t){if("idle"!==this.state.fetchStatus){if(this.state.dataUpdatedAt&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#u?.continueRetry(),this.#a}if(e&&this.#r(e),!this.options.queryFn){let e=this.#n.find(e=>e.options.queryFn);e&&this.#r(e.options)}let r=new AbortController,i={queryKey:this.queryKey,meta:this.meta},s=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#e=!0,r.signal)})};s(i);let o=()=>this.options.queryFn?(this.#e=!1,this.options.persister)?this.options.persister(this.options.queryFn,i,this):this.options.queryFn(i):Promise.reject(Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};s(a),this.options.behavior?.onFetch(a,this),this.#o=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:"fetch",meta:a.fetchOptions?.meta});let u=e=>{(0,n.isCancelledError)(e)&&e.silent||this.#c({type:"error",error:e}),(0,n.isCancelledError)(e)||(this.#i.config.onError?.(e,this),this.#i.config.onSettled?.(this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.#u=(0,n.createRetryer)({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{void 0===e?u(Error(`${this.queryHash} data is undefined`)):(this.setData(e),this.#i.config.onSuccess?.(e,this),this.#i.config.onSettled?.(e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1)},onError:u,onFail:(e,t)=>{this.#c({type:"failed",failureCount:e,error:t})},onPause:()=>{this.#c({type:"pause"})},onContinue:()=>{this.#c({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode}),this.#a=this.#u.promise,this.#a}#c(e){let t=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,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:(0,n.canFetch)(this.options.networkMode)?"fetching":"paused",...!t.dataUpdatedAt&&{error:null,status:"pending"}};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,n.isCancelledError)(r)&&r.revert&&this.#o)return{...this.#o,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=t(this.state),r.notifyManager.batch(()=>{this.#n.forEach(e=>{e.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:e})})}},o=e.i(915823),a=class extends o.Subscribable{constructor(e={}){super(),this.config=e,this.#l=new Map}#l;build(e,r,n){let i=r.queryKey,o=r.queryHash??(0,t.hashQueryKeyByOptions)(i,r),a=this.get(o);return a||(a=new s({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(r),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){this.#l.has(e.queryHash)||(this.#l.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#l.get(e.queryHash);t&&(e.destroy(),t===e&&this.#l.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){r.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#l.get(e)}getAll(){return[...this.#l.values()]}find(e){let r={exact:!0,...e};return this.getAll().find(e=>(0,t.matchQuery)(r,e))}findAll(e={}){let r=this.getAll();return Object.keys(e).length>0?r.filter(r=>(0,t.matchQuery)(e,r)):r}notify(e){r.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){r.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){r.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}};e.s(["QueryCache",()=>a],58345);var u=e.i(114272),c=o,l=class extends c.Subscribable{constructor(e={}){super(),this.config=e,this.#h=[],this.#f=0}#h;#f;#p;build(e,t,r){let n=new u.Mutation({mutationCache:this,mutationId:++this.#f,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#h.push(e),this.notify({type:"added",mutation:e})}remove(e){this.#h=this.#h.filter(t=>t!==e),this.notify({type:"removed",mutation:e})}clear(){r.notifyManager.batch(()=>{this.#h.forEach(e=>{this.remove(e)})})}getAll(){return this.#h}find(e){let r={exact:!0,...e};return this.#h.find(e=>(0,t.matchMutation)(r,e))}findAll(e={}){return this.#h.filter(r=>(0,t.matchMutation)(e,r))}notify(e){r.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){return this.#p=(this.#p??Promise.resolve()).then(()=>{let e=this.#h.filter(e=>e.state.isPaused);return r.notifyManager.batch(()=>e.reduce((e,r)=>e.then(()=>r.continue().catch(t.noop)),Promise.resolve()))}).then(()=>{this.#p=void 0}),this.#p}};e.s(["MutationCache",()=>l],346974)},992571,e=>{"use strict";var t=e.i(619273);function r(e){return{onFetch:(r,s)=>{let o=async()=>{let s,o=r.options,a=r.fetchOptions?.meta?.fetchMore?.direction,u=r.state.data?.pages||[],c=r.state.data?.pageParams||[],l=!1,h=r.options.queryFn||(()=>Promise.reject(Error(`Missing queryFn: '${r.options.queryHash}'`))),f=async(e,n,i)=>{if(l)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);let s={queryKey:r.queryKey,pageParam:n,direction:i?"backward":"forward",meta:r.options.meta};Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(r.signal.aborted?l=!0:r.signal.addEventListener("abort",()=>{l=!0}),r.signal)});let o=await h(s),{maxPages:a}=r.options,u=i?t.addToStart:t.addToEnd;return{pages:u(e.pages,o,a),pageParams:u(e.pageParams,n,a)}};if(a&&u.length){let e="backward"===a,t={pages:u,pageParams:c},r=(e?i:n)(o,t);s=await f(t,r,e)}else{s=await f({pages:[],pageParams:[]},c[0]??o.initialPageParam);let t=e??u.length;for(let e=1;er.options.persister?.(o,{queryKey:r.queryKey,meta:r.options.meta,signal:r.signal},s):r.fetchFn=o}}}function n(e,{pages:t,pageParams:r}){let n=t.length-1;return e.getNextPageParam(t[n],t,r[n],r)}function i(e,{pages:t,pageParams:r}){return e.getPreviousPageParam?.(t[0],t,r[0],r)}function s(e,t){return!!t&&null!=n(e,t)}function o(e,t){return!!t&&!!e.getPreviousPageParam&&null!=i(e,t)}e.s(["hasNextPage",()=>s,"hasPreviousPage",()=>o,"infiniteQueryBehavior",()=>r])},317751,e=>{"use strict";var t=e.i(619273),r=e.i(58345),n=e.i(346974),i=e.i(175555),s=e.i(814448),o=e.i(540143),a=e.i(992571),u=class{#d;#y;#t;#m;#g;#b;#v;#w;constructor(e={}){this.#d=e.queryCache||new r.QueryCache,this.#y=e.mutationCache||new n.MutationCache,this.#t=e.defaultOptions||{},this.#m=new Map,this.#g=new Map,this.#b=0}mount(){this.#b++,1===this.#b&&(this.#v=i.focusManager.subscribe(()=>{i.focusManager.isFocused()&&(this.resumePausedMutations(),this.#d.onFocus())}),this.#w=s.onlineManager.subscribe(()=>{s.onlineManager.isOnline()&&(this.resumePausedMutations(),this.#d.onOnline())}))}unmount(){this.#b--,0===this.#b&&(this.#v?.(),this.#v=void 0,this.#w?.(),this.#w=void 0)}isFetching(e){return this.#d.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#y.findAll({...e,status:"pending"}).length}getQueryData(e){return this.#d.find({queryKey:e})?.state.data}ensureQueryData(e){let t=this.getQueryData(e.queryKey);return void 0!==t?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,r,n){let i=this.#d.find({queryKey:e}),s=i?.state.data,o=(0,t.functionalUpdate)(r,s);if(void 0===o)return;let a=this.defaultQueryOptions({queryKey:e});return this.#d.build(this,a).setData(o,{...n,manual:!0})}setQueriesData(e,t,r){return o.notifyManager.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){return this.#d.find({queryKey:e})?.state}removeQueries(e){let t=this.#d;o.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#d,n={type:"active",...e};return o.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries(n,t)))}cancelQueries(e={},r={}){let n={revert:!0,...r};return Promise.all(o.notifyManager.batch(()=>this.#d.findAll(e).map(e=>e.cancel(n)))).then(t.noop).catch(t.noop)}invalidateQueries(e={},t={}){return o.notifyManager.batch(()=>{if(this.#d.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={},r){let n={...r,cancelRefetch:r?.cancelRefetch??!0};return Promise.all(o.notifyManager.batch(()=>this.#d.findAll(e).filter(e=>!e.isDisabled()).map(e=>{let r=e.fetch(void 0,n);return n.throwOnError||(r=r.catch(t.noop)),"paused"===e.state.fetchStatus?Promise.resolve():r}))).then(t.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let r=this.#d.build(this,t);return r.isStaleByTime(t.staleTime)?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t.noop).catch(t.noop)}fetchInfiniteQuery(e){return e.behavior=(0,a.infiniteQueryBehavior)(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t.noop).catch(t.noop)}resumePausedMutations(){return this.#y.resumePausedMutations()}getQueryCache(){return this.#d}getMutationCache(){return this.#y}getDefaultOptions(){return this.#t}setDefaultOptions(e){this.#t=e}setQueryDefaults(e,r){this.#m.set((0,t.hashKey)(e),{queryKey:e,defaultOptions:r})}getQueryDefaults(e){let r=[...this.#m.values()],n={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,r){this.#g.set((0,t.hashKey)(e),{mutationKey:e,defaultOptions:r})}getMutationDefaults(e){let r=[...this.#g.values()],n={};return r.forEach(r=>{(0,t.partialMatchKey)(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e?._defaulted)return e;let r={...this.#t.queries,...e?.queryKey&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return r.queryHash||(r.queryHash=(0,t.hashQueryKeyByOptions)(r.queryKey,r)),void 0===r.refetchOnReconnect&&(r.refetchOnReconnect="always"!==r.networkMode),void 0===r.throwOnError&&(r.throwOnError=!!r.suspense),void 0===r.networkMode&&r.persister&&(r.networkMode="offlineFirst"),r}defaultMutationOptions(e){return e?._defaulted?e:{...this.#t.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#d.clear(),this.#y.clear()}};e.s(["QueryClient",()=>u])},944362,94802,707749,541730,24235,93082,705010,295620,911712,760635,632082,156346,357892,818616,575117,e=>{"use strict";function t(e){return e}function r(e){let r={subscribe(t){let r=null,n=!1,i=!1,s=!1;function o(){if(null===r){s=!0;return}!i&&(i=!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())}}),s&&o(),{unsubscribe:o}},pipe:(...e)=>{var n;return(0===(n=e).length?t:1===n.length?n[0]:function(e){return n.reduce((e,t)=>t(e),e)})(r)}};return r}class n extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,n.prototype)}}function i(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 s(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}class o extends Error{}function a(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(s(e)){let t=new o;for(let r in e)t[r]=e[r];return t}}}class u extends Error{constructor(e){const t=a(e.cause);super(e.message??t?.message??e.code,{cause:t}),this.code=e.code,this.name="TRPCError",this.cause||(this.cause=t)}}var c={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};let l=Object.create(null);for(let e in c)l[c[e]]=e;let h=()=>{},f=e=>(function e(t,r){return new Proxy(h,{get(n,i){if("string"==typeof i&&"then"!==i)return e(t,[...r,i])},apply(e,n,i){let s="apply"===r[r.length-1];return t({args:s?i.length>=2?i[1]:[]:i,path:s?r.slice(0,-1):r})}})})(e,[]),p=e=>new Proxy(h,{get(t,r){if("string"==typeof r&&"then"!==r)return e(r)}});e.s(["createFlatProxy",()=>p,"createRecursiveProxy",()=>f],94802);let d=({shape:e})=>e,y="middlewareMarker";function m(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 g(e,t){let{middlewares:r=[],inputs:n,meta:s,...o}=t;return b({...i(e,o),inputs:[...e.inputs,...n??[]],middlewares:[...e.middlewares,...r],meta:e.meta&&s?{...e.meta,...s}:s??e.meta})}function b(e={}){let t={procedure:!0,inputs:[],middlewares:[],...e};return{_def:t,input(e){let r,n=m(e);return g(t,{inputs:[e],middlewares:[((r=async function(e){let t,r=await e.getRawInput();try{t=await n(r)}catch(e){throw new u({code:"BAD_REQUEST",cause:e})}let i=s(e.input)&&s(t)?{...e.input,...t}:t;return e.next({input:i})})._type="input",r)]})},output(e){let r,n=m(e);return g(t,{output:e,middlewares:[((r=async function({next:e}){let t=await e();if(!t.ok)return t;try{let e=await n(t.data);return{...t,data:e}}catch(e){throw new u({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:e})}})._type="output",r)]})},meta:e=>g(t,{meta:e}),use:e=>g(t,{middlewares:"_middlewares"in e?e._middlewares:[e]}),query:e=>v({...t,type:"query"},e),mutation:e=>v({...t,type:"mutation"},e),subscription:e=>v({...t,type:"subscription"},e)}}function v(e,t){var r=g(e,{resolver:t,middlewares:[async function(e){return{marker:y,ok:!0,data:await t(e),ctx:e.ctx}}]})._def;async function n(e){if(!e||!("getRawInput"in e))throw Error(w);async function t(n={index:0,ctx:e.ctx}){try{let i=r.middlewares[n.index];return await i({ctx:n.ctx,type:e.type,path:e.path,getRawInput:n.getRawInput??e.getRawInput,meta:r.meta,input:n.input,next:e=>t({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:function(e){if(e instanceof u||e instanceof Error&&"TRPCError"===e.name)return e;let t=new u({code:"INTERNAL_SERVER_ERROR",cause:e});return e instanceof Error&&e.stack&&(t.stack=e.stack),t}(e),marker:y}}}let n=await t();if(!n)throw new u({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 n._def=r,n}Symbol("unsetMarker");let w=` 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(),O="u"e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}};class E extends Error{constructor(){super("Unable to transform response from server")}}function C(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 E}if(!r.ok&&(!s(r.error.error)||"number"!=typeof r.error.error.code)||r.ok&&!s(r.result))throw new E;return r}let Q={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:d,transformer:R},S=["then"];function P(e){return function(t){var r;let n=new Set(Object.keys(t).filter(e=>S.includes(e)));if(n.size>0)throw Error("Reserved words used in `router({})` call: "+Array.from(n).join(", "));let i=(r={},Object.assign(Object.create(null),r));!function e(t,r=""){for(let[n,s]of Object.entries(t??{})){let t=`${r}${n}`;if("router"in s._def){e(s._def.procedures,`${t}.`);continue}if(i[t])throw Error(`Duplicate key: ${t}`);i[t]=s}}(t);let s={_config:e,router:!0,procedures:i,...Q,record:t};return{...t,_def:s,createCaller:e=>f(({path:t,args:r})=>{let n=t.join("."),i=s.procedures[n];return i({path:n,getRawInput:async()=>r[0],ctx:e,type:i._def.type})})}}}function q(...e){let t=i({},...e.map(e=>e._def.record));return P({errorFormatter:e.reduce((e,t)=>{if(t._def._config.errorFormatter&&t._def._config.errorFormatter!==d){if(e!==d&&e!==t._def._config.errorFormatter)throw Error("You seem to have several error formatters");return t._def._config.errorFormatter}return e},d),transformer:e.reduce((e,t)=>{if(t._def._config.transformer&&t._def._config.transformer!==R){if(e!==R&&e!==t._def._config.transformer)throw Error("You seem to have several transformers");return t._def._config.transformer}return e},R),isDev:e.some(e=>e._def._config.isDev),allowOutsideOfServer:e.some(e=>e._def._config.allowOutsideOfServer),isServer:e.some(e=>e._def._config.isServer),$types:e[0]?._def._config.$types})(t)}class T{context(){return new T}meta(){return new T}create(e){var t,r=e;let n=r?.errorFormatter??d,i={transformer:"input"in(t=r?.transformer??R)?t:{input:t,output:t},isDev:r?.isDev??globalThis.process?.env?.NODE_ENV!=="production",allowOutsideOfServer:r?.allowOutsideOfServer??!1,errorFormatter:n,isServer:r?.isServer??O,$types:p(e=>{throw Error(`Tried to access "$types.${e}" which is not available at runtime`)})};if(!(r?.isServer??O)&&r?.allowOutsideOfServer!==!0)throw Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");return{_config:i,procedure:b({meta:r?.defaultMeta}),middleware:function(e){return function e(t){return{_middlewares:t,unstable_pipe:r=>e([...t,..."_middlewares"in r?r._middlewares:[r]])}}([e])},router:P(i),mergeRouters:q,createCallerFactory:function(e){let t=e._def;return function(e){return f(({path:r,args:n})=>{let i=r.join("."),s=t.procedures[i],o=e=>s({path:i,getRawInput:async()=>n[0],ctx:e,type:s._def.type});if("function"==typeof e){let t=e();return t instanceof Promise?t.then(o):o(t)}return o(e)})}}}}}function x(e){return r(t=>(function t(r=0,n=e.op){let i=e.links[r];if(!i)throw Error("No more links to execute - did you forget to add an ending link?");return i({op:n,next:e=>t(r+1,e)})})().subscribe(t))}new T,e.s([],707749);class I extends Error{static from(e,t={}){return e instanceof I||e instanceof Error&&"TRPCClientError"===e.name?(t.meta&&(e.meta={...e.meta,...t.meta}),e):s(e)&&s(e.error)&&"number"==typeof e.error.code&&"string"==typeof e.error.message?new I(e.error.message,{...t,result:e}):e instanceof Error?new I(e.message,{...t,cause:a(e)}):new I("Unknown error",{...t,cause:e})}constructor(e,t){const 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,I.prototype)}}e.s(["TRPCClientError",()=>I],541730);class D{$request({type:e,input:t,path:r,context:n={}}){return x({links:this.links,op:{id:++this.requestId,type:e,path:r,input:t,context:n}}).pipe(e=>{let t=0,r=null,n=[];return{subscribe:i=>(t++,n.push(i),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(){if(0==--t&&r){let e=r;r=null,e.unsubscribe()}let e=n.findIndex(e=>e===i);e>-1&&n.splice(e,1)}})}})}requestAsPromise(e){var t;let r,{promise:i,abort:s}=(t=this.$request(e),{promise:new Promise((e,i)=>{let s=!1;function o(){s||(s=!0,i(new n("This operation was aborted.")),a.unsubscribe())}let a=t.subscribe({next(t){s=!0,e(t),o()},error(e){s=!0,i(e),o()},complete(){s=!0,o()}});r=o}),abort:r});return new Promise((t,r)=>{e.signal?.addEventListener("abort",s),i.then(e=>{t(e.result.data)}).catch(e=>{r(I.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;const 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 A(e){return new D(e)}e.s(["TRPCUntypedClient",()=>D],24235),e.s(["createTRPCUntypedClient",()=>A],93082);let k={query:"query",mutate:"mutation",subscribe:"subscription"},M=e=>k[e];function U(e){return p(t=>e.hasOwnProperty(t)?e[t]:"__untypedClient"===t?e:f(({path:r,args:n})=>{let i=[t,...r],s=M(i.pop()),o=i.join(".");return e[s](o,...n)}))}function _(e){return U(new D(e))}function j(e){return e.__untypedClient}function F(e){if(e)return e;if("u">typeof window&&"function"==typeof window.fetch)return window.fetch;if("u">typeof globalThis&&"function"==typeof globalThis.fetch)return globalThis.fetch;throw Error("No fetch implementation found")}e.s(["clientCallTypeToProcedureType",()=>M,"createTRPCClient",()=>_,"createTRPCClientProxy",()=>U,"getUntypedClient",()=>j],705010),e.s(["getFetch",()=>F],295620);let N=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function K(e){let t=null,r=null;function n(){let n=function(t){let r=[[]],n=0;for(;;){let i=t[n];if(!i)break;let s=r[r.length-1];if(i.aborted){i.reject?.(Error("Aborted")),n++;continue}if(e.validate(s.concat(i).map(e=>e.key))){s.push(i),n++;continue}if(0===s.length){i.reject?.(Error("Input is too big for a single dispatch")),n++;continue}r.push([])}return r}(t);for(let i of(clearTimeout(r),r=null,t=null,n)){if(!i.length)continue;let t={items:i,cancel:N};for(let e of i)e.batch=t;let r=(e,r)=>{let n=t.items[e];n.resolve?.(r),n.batch=null,n.reject=null,n.resolve=null},{promise:n,cancel:s}=e.fetch(t.items.map(e=>e.key),r);t.cancel=s,n.then(e=>{for(let t=0;t{for(let r of t.items)r.reject?.(e),r.batch=null})}}return{load:function(e){let i={aborted:!1,key:e,batch:null,resolve:N,reject:N},s=new Promise((e,r)=>{i.reject=r,i.resolve=e,t||(t=[]),t.push(i)});return r||(r=setTimeout(n)),{promise:s,cancel:()=>{i.aborted=!0,i.batch?.items.every(e=>e.aborted)&&(i.batch.cancel(),i.batch=null)}}}}}function L(e){var t;return{url:e.url.toString().replace(/\/$/,""),fetch:e.fetch,AbortController:(t=e.AbortController)?t:"u">typeof window&&window.AbortController?window.AbortController:"u">typeof globalThis&&globalThis.AbortController?globalThis.AbortController:null}}let H={query:"GET",mutation:"POST"};function B(e){return"input"in e?e.runtime.transformer.serialize(e.input):function(e){let t={};for(let r=0;re.runtime.transformer.serialize(t)))}let z=e=>{let t=e.url+"/"+e.path,r=[];if("inputs"in e&&r.push("batch=1"),"query"===e.type){let t=B(e);void 0!==t&&r.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return r.length&&(t+="?"+r.join("&")),t},V=e=>{if("query"===e.type)return;let t=B(e);return void 0!==t?JSON.stringify(t):void 0},$=e=>G({...e,contentTypeHeader:"application/json",getUrl:z,getBody:V});async function W(e,t){let r=e.getUrl(e),n=e.getBody(e),{type:i}=e,s=await (async()=>{let t=await e.headers();return Symbol.iterator in t?Object.fromEntries(t):t})();if("subscription"===i)throw Error("Subscriptions should use wsLink");let o={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.batchModeHeader?{"trpc-batch-mode":e.batchModeHeader}:{},...s};return F(e.fetch)(r,{method:H[i],signal:t?.signal,body:n,headers:o})}function G(e){let t=e.AbortController?new e.AbortController:null,r={},n=!1;return{promise:new Promise((i,s)=>{W(e,t).then(e=>(r.response=e,n=!0,e.json())).then(e=>{r.responseJSON=e,i({json:e,meta:r})}).catch(e=>{n=!0,s(I.from(e,{meta:r}))})}),cancel:()=>{n||t?.abort()}}}function J(e){return function(t){let n=L(t),i=t.maxURLLength??1/0;return s=>{let o=r=>({validate:e=>{if(i===1/0)return!0;let t=e.map(e=>e.path).join(","),o=e.map(e=>e.input);return z({...n,runtime:s,type:r,path:t,inputs:o}).length<=i},fetch:e({...n,runtime:s,type:r,opts:t})}),a=K(o("query")),u=K(o("mutation")),c={query:a,subscription:K(o("subscription")),mutation:u};return({op:e})=>r(t=>{let r,{promise:n,cancel:i}=c[e.type].load(e);return n.then(e=>{r=e;let n=C(e.json,s.transformer);n.ok?(t.next({context:e.meta,result:n.result}),t.complete()):t.error(I.from(n.error,{meta:e.meta}))}).catch(e=>{t.error(I.from(e,{meta:r?.meta}))}),()=>{i()}})}}}let Y=J(e=>t=>{let r=t.map(e=>e.path).join(","),n=t.map(e=>e.input),{promise:i,cancel:s}=$({...e,path:r,inputs:n,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:t}):e.opts.headers:{}});return{promise:i.then(e=>(Array.isArray(e.json)?e.json:t.map(()=>e.json)).map(t=>({meta:e.meta,json:t}))),cancel:s}});async function X(e){let t=e.parse??JSON.parse;await Z(e.readableStream,r=>{if(e.signal?.aborted||!r||"}"===r)return;let n=r.indexOf(":"),i=r.substring(2,n-1),s=r.substring(n+1);e.onSingle(Number(i),t(s))},e.textDecoder)}async function Z(e,t,r){var n,i;let s="",o=e=>{let n=r.decode(e).split("\n");if(1===n.length)s+=n[0];else if(n.length>1){t(s+n[0]);for(let e=1;e{n.on("data",i),n.on("end",e)})),t(s)}async function ee(e,t){let r=e.getReader(),n=await r.read();for(;!n.done;)t(n.value),n=await r.read()}e.s(["httpBatchLink",()=>Y],911712);let et=J(e=>{let t=function(e){if(e)return e;if("u">typeof window&&window.TextDecoder)return new window.TextDecoder;if("u">typeof globalThis&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw Error("No TextDecoder implementation found")}(e.opts.textDecoder);return(r,n)=>{var i,s;let o,a=r.map(e=>e.path).join(","),u=r.map(e=>e.input),{cancel:c,promise:l}=(i={...e,textDecoder:t,path:a,inputs:u,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:r}):e.opts.headers:{}},s=(e,t)=>{n(e,t)},o=i.AbortController?new i.AbortController:null,{cancel:()=>o?.abort(),promise:W({...i,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:z,getBody:V},o).then(async e=>{if(!e.body)throw Error("Received response without body");let t={response:e};return X({readableStream:e.body,onSingle:s,parse:e=>({json:JSON.parse(e),meta:t}),signal:o?.signal,textDecoder:i.textDecoder})})});return{promise:l.then(()=>[]),cancel:c}}});function er(e){return t=>{let n=L(t);return i=>({op:s})=>r(r=>{let o,{path:a,input:u,type:c}=s,{promise:l,cancel:h}=e.requester({...n,runtime:i,type:c,path:a,input:u,headers:()=>t.headers?"function"==typeof t.headers?t.headers({op:s}):t.headers:{}});return l.then(e=>{o=e.meta;let t=C(e.json,i.transformer);t.ok?(r.next({context:e.meta,result:t.result}),r.complete()):r.error(I.from(t.error,{meta:o}))}).catch(e=>{r.error(I.from(e,{meta:o}))}),()=>{h()}})}}e.s(["unstable_httpBatchStreamLink",()=>et],760635);let en=er({requester:$});e.s(["httpLink",()=>en,"httpLinkFactory",()=>er],632082);let ei={query:["72e3ff","3fb0d8"],mutation:["c5a3fc","904dfc"],subscription:["ff49e1","d83fbe"]},es={query:["\x1b[30;46m","\x1b[97;46m"],mutation:["\x1b[30;45m","\x1b[97;45m"],subscription:["\x1b[30;42m","\x1b[97;42m"]},eo={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"]};function ea(e={}){let{enabled:t=()=>!0}=e,n=e.colorMode??("u"r=>{let n=r.input,i=!("u">":"<<",r,"up"===t?c:l,`#${i}`,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,c]=ei[r],l=` background-color: #${"up"===t?u:c}; color: ${"up"===t?"black":"white"}; padding: 2px; `;return o.push("%c","up"===t?">>":"<<",r,`#${i}`,`%c${n}%c`,"%O"),a.push(l,`${l}; font-weight: bold;`,`${l}; font-weight: normal;`),"up"===t?a.push({input:s,context:e.context}):a.push({input:s,result:e.result,elapsedMs:e.elapsedMs,context:e.context}),{parts:o,args:a}}({...r,colorMode:t,input:i});e["down"===r.direction&&r.result&&(r.result instanceof Error||"error"in r.result.result)?"error":"log"].apply(null,[s.join(" ")].concat(o))})({c:e.console,colorMode:n})}=e;return()=>({op:e,next:n})=>r(r=>{var s;t({...e,direction:"up"})&&i({...e,direction:"up"});let o=Date.now();function a(r){let n=Date.now()-o;t({...e,direction:"down",result:r})&&i({...e,direction:"down",elapsedMs:n,result:r})}return n(e).pipe((s={next(e){a(e)},error(e){a(e)}},e=>({subscribe:t=>e.subscribe({next(e){s.next?.(e),t.next?.(e)},error(e){s.error?.(e),t.error?.(e)},complete(){s.complete?.(),t.complete?.()}})}))).subscribe(r)})}function eu(e){return Array.isArray(e)?e:[e]}function ec(e){return t=>{let n=eu(e.true).map(e=>e(t)),i=eu(e.false).map(e=>e(t));return t=>r(r=>{let s=e.condition(t.op)?n:i;return x({op:t.op,links:s}).subscribe(r)})}}e.s(["loggerLink",()=>ea],156346),e.s(["splitLink",()=>ec],357892);let el=e=>0===e?0:Math.min(1e3*2**e,3e4),eh={enabled:!1,closeMs:0};function ef(e){let t,r,{url:n,WebSocket:i=WebSocket,retryDelayMs:s=el,onOpen:o,onClose:a}=e,u={...eh,...e.lazy};if(!i)throw Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");let c=[],l=Object.create(null),h=0,f=0,p=u.enabled?null:O();function d(){if(!p){p=O();return}setTimeout(()=>{if(p?.state==="open"){for(let e of Object.values(l))e.connection||(e.connection=p);1===c.length?p.ws.send(JSON.stringify(c.pop())):p.ws.send(JSON.stringify(c)),c=[],w()}})}function y(e){var r;t||(e.state="connecting",r=s(h++),t||(t=setTimeout(g,r)))}function m(e){let t=Object.values(l);return e?t.some(t=>t.connection===e):t.length>0}function g(){if(u.enabled&&!m())return;let e=p;p=O(),e&&b(e)}function b(e){m(e)||e.ws?.close()}function v(e){c.some(t=>t.id===e.op.id)||R(e.op,e.callbacks)}let w=()=>{u.enabled&&(clearTimeout(r),r=setTimeout(()=>{p&&(m(p)||(p.ws?.close(),p=null))},u.closeMs))};function O(){let e={id:++f,state:"connecting"};clearTimeout(r);let s=()=>{e.state="closed",e===p&&y(e)};return(async()=>{let r=new i("function"==typeof n?await n():n);e.ws=r,clearTimeout(t),t=void 0,r.addEventListener("open",()=>{p?.ws===r&&(h=0,e.state="open",o?.(),d())}),r.addEventListener("error",s),r.addEventListener("message",({data:t})=>{w();let r=JSON.parse(t);if("method"in r){if(e===p&&"reconnect"===r.method)for(let e of(g(),Object.values(l)))"subscription"===e.type&&v(e)}else{let t=null!==r.id&&l[r.id];if(t){if(t.callbacks.next?.(r),e===p&&t.connection!==p){let r=t.connection;t.connection=e,r&&b(r)}"result"in r&&"stopped"===r.result.type&&p===e&&t.callbacks.complete()}}e!==p&&b(e)}),r.addEventListener("close",({code:t})=>{for(let[r,n]of("open"===e.state&&a?.({code:t}),e.state="closed",p===e&&y(e),Object.entries(l)))if(n.connection===e){if("closed"===e.state){delete l[r],n.callbacks.complete?.();continue}"subscription"===n.type?v(n):(delete l[r],n.callbacks.error?.(I.from(new ep("WebSocket closed prematurely"))))}})})().catch(s),e}function R(e,t){let{type:r,input:n,path:i,id:s}=e;return l[s]={connection:null,type:r,callbacks:t,op:e},c.push({id:s,method:r,params:{input:n,path:i}}),d(),()=>{let t=l[s]?.callbacks;delete l[s],c=c.filter(e=>e.id!==s),t?.complete?.(),p?.state==="open"&&"subscription"===e.type&&(c.push({id:s,method:"subscription.stop"}),d()),w()}}return{close:()=>{for(let e of(h=0,Object.values(l)))"subscription"===e.type?e.callbacks.complete():e.connection||e.callbacks.error(I.from(Error("Closed before connection was established")));p&&b(p),clearTimeout(t),t=void 0,p=null},request:R,get connection(){return p}}}class ep extends Error{constructor(e){super(e),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,ep.prototype)}}function ed(e){return t=>{let{client:n}=e;return({op:e})=>r(r=>{let{type:i,path:s,id:o,context:a}=e,u=t.transformer.serialize(e.input),c=n.request({type:i,path:s,input:u,id:o,context:a},{error(e){r.error(e),c()},complete(){r.complete()},next(n){let i=C(n,t.transformer);i.ok?(r.next({result:i.result}),"subscription"!==e.type&&(c(),r.complete())):r.error(I.from(i.error))}});return()=>{c()}})}}e.s(["createWSClient",()=>ef,"wsLink",()=>ed],818616);let ey=er({requester:e=>{if("mutation"!==e.type)throw Error("We only handle mutations with formdata");return G({...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}}})}});e.s(["experimental_formDataLink",()=>ey],575117),e.s([],944362)},189627,e=>{"use strict";function t(e,t,r){let n=e.flatMap(e=>e.split("."));if(!t&&(!r||"any"===r))return n.length?[n]:[];if("infinite"===r&&t&&"object"==typeof t&&"cursor"in t){let{cursor:e,...r}=t;return[n,{input:r,type:"infinite"}]}return[n,{...void 0!==t&&{input:t},...r&&"any"!==r&&{type:r}}]}e.s(["getQueryKeyInternal",()=>t])},431300,385283,e=>{"use strict";e.i(707749);var t=e.i(94802);function r(e,r){return(0,t.createRecursiveProxy)(({path:t,args:n})=>{let i=[e,...t],s=i.pop();if("useMutation"===s)return r[s](i,...n);if("_def"===s)return{path:i};let[o,...a]=n,u=a[0]||{};return r[s](i,o,u)})}e.s(["createReactDecoration",()=>r],431300);var n=e.i(271645);let i=["client","ssrContext","ssrState","abortOnUnmount"],s=n.createContext?.(null);e.s(["TRPCContext",()=>s,"contextProps",()=>i],385283)},70773,e=>{"use strict";e.i(944362);var t=e.i(705010);e.i(707749);var r=e.i(94802),n=e.i(385283),i=e.i(189627);function s(e,t){return(0,r.createRecursiveProxy)(r=>{let n=[t,...r.path],s=n.pop(),o=[...r.args],a=o.shift(),u=(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"}})(s),c=(0,i.getQueryKeyInternal)(n,a,u);return({fetch:()=>e.fetchQuery(c,...o),fetchInfinite:()=>e.fetchInfiniteQuery(c,o[0]),prefetch:()=>e.prefetchQuery(c,...o),prefetchInfinite:()=>e.prefetchInfiniteQuery(c,o[0]),ensureData:()=>e.ensureQueryData(c,...o),invalidate:()=>e.invalidateQueries(c,...o),reset:()=>e.resetQueries(c,...o),refetch:()=>e.refetchQueries(c,...o),cancel:()=>e.cancelQuery(c,...o),setData:()=>{e.setQueryData(c,o[0],o[1])},setInfiniteData:()=>{e.setInfiniteQueryData(c,o[0],o[1])},getData:()=>e.getQueryData(c),getInfiniteData:()=>e.getInfiniteQueryData(c)})[s]()})}function o(e){return(0,r.createFlatProxy)(r=>"client"===r?(0,t.createTRPCClientProxy)(e.client):n.contextProps.includes(r)?e[r]:s(e,r))}function a(e){return(0,r.createFlatProxy)(t=>s(e,t))}e.s(["createQueryUtilsProxy",()=>a,"createReactQueryUtils",()=>o])},266027,869230,673664,977805,427001,254440,469637,e=>{"use strict";let t;var r=e.i(619273),n=e.i(540143),i=e.i(175555),s=e.i(915823),o=e.i(936553),a=class extends s.Subscribable{constructor(e,t){super(),this.options=t,this.#O=e,this.#R=null,this.bindMethods(),this.setOptions(t)}#O;#E=void 0;#C=void 0;#Q=void 0;#S;#P;#R;#q;#T;#x;#I;#D;#A;#k=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#E.addObserver(this),u(this.#E,this.options)?this.#M():this.updateResult(),this.#U())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return c(this.#E,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return c(this.#E,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#_(),this.#j(),this.#E.removeObserver(this)}setOptions(e,t){let n=this.options,i=this.#E;if(this.options=this.#O.defaultQueryOptions(e),(0,r.shallowEqualObjects)(n,this.options)||this.#O.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#E,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=n.queryKey),this.#F();let s=this.hasListeners();s&&l(this.#E,i,this.options,n)&&this.#M(),this.updateResult(t),s&&(this.#E!==i||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&this.#N();let o=this.#K();s&&(this.#E!==i||this.options.enabled!==n.enabled||o!==this.#A)&&this.#L(o)}getOptimisticResult(e){var t,n;let i=this.#O.getQueryCache().build(this.#O,e),s=this.createResult(i,e);return t=this,n=s,(0,r.shallowEqualObjects)(t.getCurrentResult(),n)||(this.#Q=s,this.#P=this.options,this.#S=this.#E.state),s}getCurrentResult(){return this.#Q}trackResult(e){let t={};return Object.keys(e).forEach(r=>{Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:()=>(this.#k.add(r),e[r])})}),t}getCurrentQuery(){return this.#E}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#O.defaultQueryOptions(e),r=this.#O.getQueryCache().build(this.#O,t);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#M({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#Q))}#M(e){this.#F();let t=this.#E.fetch(this.options,e);return e?.throwOnError||(t=t.catch(r.noop)),t}#N(){if(this.#_(),r.isServer||this.#Q.isStale||!(0,r.isValidTimeout)(this.options.staleTime))return;let e=(0,r.timeUntilStale)(this.#Q.dataUpdatedAt,this.options.staleTime);this.#I=setTimeout(()=>{this.#Q.isStale||this.updateResult()},e+1)}#K(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#E):this.options.refetchInterval)??!1}#L(e){this.#j(),this.#A=e,!r.isServer&&!1!==this.options.enabled&&(0,r.isValidTimeout)(this.#A)&&0!==this.#A&&(this.#D=setInterval(()=>{(this.options.refetchIntervalInBackground||i.focusManager.isFocused())&&this.#M()},this.#A))}#U(){this.#N(),this.#L(this.#K())}#_(){this.#I&&(clearTimeout(this.#I),this.#I=void 0)}#j(){this.#D&&(clearInterval(this.#D),this.#D=void 0)}createResult(e,t){let n,i=this.#E,s=this.options,a=this.#Q,c=this.#S,f=this.#P,p=e!==i?e.state:this.#C,{state:d}=e,{error:y,errorUpdatedAt:m,fetchStatus:g,status:b}=d,v=!1;if(t._optimisticResults){let r=this.hasListeners(),n=!r&&u(e,t),a=r&&l(e,i,t,s);(n||a)&&(g=(0,o.canFetch)(e.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(b="pending")),"isRestoring"===t._optimisticResults&&(g="idle")}if(t.select&&void 0!==d.data)if(a&&d.data===c?.data&&t.select===this.#q)n=this.#T;else try{this.#q=t.select,n=t.select(d.data),n=(0,r.replaceData)(a?.data,n,t),this.#T=n,this.#R=null}catch(e){this.#R=e}else n=d.data;if(void 0!==t.placeholderData&&void 0===n&&"pending"===b){let e;if(a?.isPlaceholderData&&t.placeholderData===f?.placeholderData)e=a.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(this.#x?.state.data,this.#x):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),this.#R=null}catch(e){this.#R=e}void 0!==e&&(b="success",n=(0,r.replaceData)(a?.data,e,t),v=!0)}this.#R&&(y=this.#R,n=this.#T,m=Date.now(),b="error");let w="fetching"===g,O="pending"===b,R="error"===b,E=O&&w;return{status:b,fetchStatus:g,isPending:O,isSuccess:"success"===b,isError:R,isInitialLoading:E,isLoading:E,data:n,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:m,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:w,isRefetching:w&&!O,isLoadingError:R&&0===d.dataUpdatedAt,isPaused:"paused"===g,isPlaceholderData:v,isRefetchError:R&&0!==d.dataUpdatedAt,isStale:h(e,t),refetch:this.refetch}}updateResult(e){let t=this.#Q,n=this.createResult(this.#E,this.options);if(this.#S=this.#E.state,this.#P=this.options,void 0!==this.#S.data&&(this.#x=this.#E),(0,r.shallowEqualObjects)(n,t))return;this.#Q=n;let i={},s=()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,r="function"==typeof e?e():e;if("all"===r||!r&&!this.#k.size)return!0;let n=new Set(r??this.#k);return this.options.throwOnError&&n.add("error"),Object.keys(this.#Q).some(e=>this.#Q[e]!==t[e]&&n.has(e))};e?.listeners!==!1&&s()&&(i.listeners=!0),this.#H({...i,...e})}#F(){let e=this.#O.getQueryCache().build(this.#O,this.options);if(e===this.#E)return;let t=this.#E;this.#E=e,this.#C=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#U()}#H(e){n.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#Q)}),this.#O.getQueryCache().notify({query:this.#E,type:"observerResultsUpdated"})})}};function u(e,t){return!1!==t.enabled&&!e.state.dataUpdatedAt&&("error"!==e.state.status||!1!==t.retryOnMount)||e.state.dataUpdatedAt>0&&c(e,t,t.refetchOnMount)}function c(e,t,r){if(!1!==t.enabled){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&h(e,t)}return!1}function l(e,t,r,n){return!1!==r.enabled&&(e!==t||!1===n.enabled)&&(!r.suspense||"error"!==e.state.status)&&h(e,r)}function h(e,t){return e.isStaleByTime(t.staleTime)}e.s(["QueryObserver",()=>a],869230),e.i(247167);var f=e.i(271645),p=f.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),d=()=>f.useContext(p);e.s(["useQueryErrorResetBoundary",()=>d],673664);var y=e.i(912598),m=f.createContext(!1),g=()=>f.useContext(m);m.Provider,e.s(["useIsRestoring",()=>g],977805);var b=e.i(811076),v=(e,t)=>{(e.suspense||e.throwOnError)&&!t.isReset()&&(e.retryOnMount=!1)},w=e=>{f.useEffect(()=>{e.clearReset()},[e])},O=({result:e,errorResetBoundary:t,throwOnError:r,query:n})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(0,b.shouldThrowError)(r,[e.error,n]);e.s(["ensurePreventErrorBoundaryRetry",()=>v,"getHasError",()=>O,"useClearResetErrorBoundary",()=>w],427001);var R=(e,t)=>void 0===t.state.data,E=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},C=(e,t)=>e.isLoading&&e.isFetching&&!t,Q=(e,t)=>e?.suspense&&t.isPending,S=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function P(e,t,r){let i=(0,y.useQueryClient)(r),s=g(),o=d(),a=i.defaultQueryOptions(e);a._optimisticResults=s?"isRestoring":"optimistic",E(a),v(a,o),w(o);let[u]=f.useState(()=>new t(i,a)),c=u.getOptimisticResult(a);if(f.useSyncExternalStore(f.useCallback(e=>{let t=s?()=>void 0:u.subscribe(n.notifyManager.batchCalls(e));return u.updateResult(),t},[u,s]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),f.useEffect(()=>{u.setOptions(a,{listeners:!1})},[a,u]),Q(a,c))throw S(a,u,o);if(O({result:c,errorResetBoundary:o,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash)}))throw c.error;return a.notifyOnChangeProps?c:u.trackResult(c)}function q(e,t){return P(e,a,t)}e.s(["defaultThrowOnError",()=>R,"ensureStaleTime",()=>E,"fetchOptimistic",()=>S,"shouldSuspend",()=>Q,"willFetch",()=>C],254440),e.s(["useBaseQuery",()=>P],469637),e.s(["useQuery",()=>q],266027)},154452,e=>{"use strict";var t=e.i(869230),r=e.i(469637),n=e.i(254440);function i(e,i){return(0,r.useBaseQuery)({...e,enabled:!0,suspense:!0,throwOnError:n.defaultThrowOnError},t.QueryObserver,i)}e.s(["useSuspenseQuery",()=>i])},621482,727767,586448,324174,637615,337843,607309,e=>{"use strict";var t=e.i(869230),r=e.i(992571),n=class extends t.QueryObserver{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,r.infiniteQueryBehavior)()},t)}getOptimisticResult(e){return e.behavior=(0,r.infiniteQueryBehavior)(),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:n}=e,i=super.createResult(e,t),{isFetching:s,isRefetching:o}=i,a=s&&n.fetchMeta?.fetchMore?.direction==="forward",u=s&&n.fetchMeta?.fetchMore?.direction==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,r.hasNextPage)(t,n.data),hasPreviousPage:(0,r.hasPreviousPage)(t,n.data),isFetchingNextPage:a,isFetchingPreviousPage:u,isRefetching:o&&!a&&!u}}},i=e.i(469637);function s(e,t){return(0,i.useBaseQuery)(e,n,t)}e.s(["useInfiniteQuery",()=>s],621482);var o=e.i(254440);function a(e,t){return(0,i.useBaseQuery)({...e,enabled:!0,suspense:!0,throwOnError:o.defaultThrowOnError},n,t)}e.s(["useSuspenseInfiniteQuery",()=>a],727767);var u=e.i(271645),c=e.i(540143),l=e.i(915823),h=e.i(619273);function f(e,t){return e.filter(e=>!t.includes(e))}var p=class extends l.Subscribable{#O;#B;#l;#n;#z;#V;constructor(e,t,r){super(),this.#O=e,this.#l=[],this.#n=[],this.#$([]),this.setQueries(t,r)}#$(e){this.#B=e,this.#V=this.#W(e,this.#z?.combine)}onSubscribe(){1===this.listeners.size&&this.#n.forEach(e=>{e.subscribe(t=>{this.#G(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#n.forEach(e=>{e.destroy()})}setQueries(e,t,r){this.#l=e,this.#z=t,c.notifyManager.batch(()=>{let e=this.#n,t=this.#J(this.#l);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions,r));let n=t.map(e=>e.observer),i=n.map(e=>e.getCurrentResult()),s=n.some((t,r)=>t!==e[r]);e.length===n.length&&!s||(this.#n=n,this.#$(i),this.hasListeners()&&(f(e,n).forEach(e=>{e.destroy()}),f(n,e).forEach(e=>{e.subscribe(t=>{this.#G(e,t)})}),this.#H()))})}getCurrentResult(){return this.#V}getQueries(){return this.#n.map(e=>e.getCurrentQuery())}getObservers(){return this.#n}getOptimisticResult(e,t){let r=this.#J(e),n=r.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions));return[n,e=>this.#W(e??n,t),()=>r.map((e,t)=>{let r=n[t];return e.defaultedQueryOptions.notifyOnChangeProps?r:e.observer.trackResult(r)})]}#W(e,t){return t?(0,h.replaceEqualDeep)(this.#V,t(e)):e}#J(e){let r=new Map(this.#n.map(e=>[e.options.queryHash,e])),n=e.map(e=>this.#O.defaultQueryOptions(e)),i=n.flatMap(e=>{let t=r.get(e.queryHash);return null!=t?[{defaultedQueryOptions:e,observer:t}]:[]}),s=new Set(i.map(e=>e.defaultedQueryOptions.queryHash)),o=n.filter(e=>!s.has(e.queryHash)),a=e=>{let r=this.#O.defaultQueryOptions(e);return this.#n.find(e=>e.options.queryHash===r.queryHash)??new t.QueryObserver(this.#O,r)},u=o.map(e=>({defaultedQueryOptions:e,observer:a(e)}));return i.concat(u).sort((e,t)=>n.indexOf(e.defaultedQueryOptions)-n.indexOf(t.defaultedQueryOptions))}#G(e,t){let r=this.#n.indexOf(e);if(-1!==r){var n;let e;this.#$((n=this.#B,(e=n.slice(0))[r]=t,e)),this.#H()}}#H(){c.notifyManager.batch(()=>{this.listeners.forEach(e=>{e(this.#B)})})}},d=e.i(912598),y=e.i(977805),m=e.i(673664),g=e.i(427001);function b({queries:e,...r},n){let i=(0,d.useQueryClient)(n),s=(0,y.useIsRestoring)(),a=(0,m.useQueryErrorResetBoundary)(),l=u.useMemo(()=>e.map(e=>{let t=i.defaultQueryOptions(e);return t._optimisticResults=s?"isRestoring":"optimistic",t}),[e,i,s]);l.forEach(e=>{(0,o.ensureStaleTime)(e),(0,g.ensurePreventErrorBoundaryRetry)(e,a)}),(0,g.useClearResetErrorBoundary)(a);let[h]=u.useState(()=>new p(i,l,r)),[f,b,v]=h.getOptimisticResult(l,r.combine);u.useSyncExternalStore(u.useCallback(e=>s?()=>void 0:h.subscribe(c.notifyManager.batchCalls(e)),[h,s]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),u.useEffect(()=>{h.setQueries(l,r,{listeners:!1})},[l,r,h]);let w=f.some((e,t)=>(0,o.shouldSuspend)(l[t],e))?f.flatMap((e,r)=>{let n=l[r];if(n){let r=new t.QueryObserver(i,n);if((0,o.shouldSuspend)(n,e))return(0,o.fetchOptimistic)(n,r,a);(0,o.willFetch)(e,s)&&(0,o.fetchOptimistic)(n,r,a)}return[]}):[];if(w.length>0)throw Promise.all(w);let O=f.find((e,t)=>{let r=l[t];return r&&(0,g.getHasError)({result:e,errorResetBoundary:a,throwOnError:r.throwOnError,query:i.getQueryCache().get(r.queryHash)})});if(O?.error)throw O.error;return b(v())}function v(e,t){return b({...e,queries:e.queries.map(e=>({...e,suspense:!0,throwOnError:o.defaultThrowOnError,enabled:!0}))},t)}function w(e,t,r){let n=e[0],i=e[1]?.input;return r&&(i.cursor=r),[n.join("."),i,t?.trpc]}function O(e){let t=u.useRef(e);return t.current.path=e.path,t.current}e.s(["useQueries",()=>b],586448),e.s(["useSuspenseQueries",()=>v],324174),e.s(["getClientArgs",()=>w],637615),e.s(["useHookResult",()=>O],337843),e.i(944362);var R=e.i(24235),E=e.i(705010);function C(e){let{client:t,queryClient:r}=e,n=t instanceof R.TRPCUntypedClient?t:(0,E.getUntypedClient)(t);return{fetchQuery:(e,t)=>r.fetchQuery({...t,queryKey:e,queryFn:()=>n.query(...w(e,t))}),fetchInfiniteQuery:(e,t)=>r.fetchInfiniteQuery({...t,queryKey:e,queryFn:({pageParam:r})=>n.query(...w(e,t,r)),initialPageParam:t?.initialCursor??null}),prefetchQuery:(e,t)=>r.prefetchQuery({...t,queryKey:e,queryFn:()=>n.query(...w(e,t))}),prefetchInfiniteQuery:(e,t)=>r.prefetchInfiniteQuery({...t,queryKey:e,queryFn:({pageParam:r})=>n.query(...w(e,t,r)),initialPageParam:t?.initialCursor??null}),ensureQueryData:(e,t)=>r.ensureQueryData({...t,queryKey:e,queryFn:()=>n.query(...w(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)}}e.s(["createUtilityFunctions",()=>C],607309)},606209,e=>{"use strict";e.i(707749);var t=e.i(94802),r=e.i(189627);function n(e){return(0,t.createRecursiveProxy)(t=>{let n=t.path,i=n.join("."),[s,o]=t.args;return{queryKey:(0,r.getQueryKeyInternal)(n,s,"query"),queryFn:()=>e.query(i,s,o?.trpc),...o}})}e.s(["createUseQueries",()=>n])},455111,e=>{"use strict";var t=e.i(266027),r=e.i(154452),n=e.i(912598),i=e.i(954616),s=e.i(619273),o=e.i(621482),a=e.i(727767),u=e.i(586448),c=e.i(324174);e.i(944362);var l=e.i(93082),h=e.i(271645),f=e.i(385283),p=e.i(637615),d=e.i(189627),y=e.i(337843),m=e.i(607309),g=e.i(606209);function b(e){let b=e?.overrides?.useMutation?.onSuccess??(e=>e.originalFn()),v=e?.context??f.TRPCContext;function w(){let e=h.useContext(v);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:n}=w();return n&&"mounted"!==n&&r.getQueryCache().find({queryKey:e})?.state.status==="error"?{retryOnMount:!1,...t}:t}return{Provider:e=>{let{abortOnUnmount:t=!1,client:r,queryClient:n,ssrContext:i}=e,[s,o]=h.useState(e.ssrState??!1),a=h.useMemo(()=>(0,m.createUtilityFunctions)({client:r,queryClient:n}),[r,n]),u=h.useMemo(()=>({abortOnUnmount:t,queryClient:n,client:r,ssrContext:i??null,ssrState:s,...a}),[t,r,a,n,i,s]);return h.useEffect(()=>{o(e=>!!e&&"mounted")},[]),h.createElement(v.Provider,{value:u},e.children)},createClient:e=>(0,l.createTRPCUntypedClient)(e),useContext:w,useUtils:w,useQuery:function(r,n,i){let{abortOnUnmount:s,client:o,ssrState:a,queryClient:u,prefetchQuery:c}=w(),l=(0,d.getQueryKeyInternal)(r,n,"query"),h=u.getQueryDefaults(l);"u"{let t={...f,trpc:{...f?.trpc,...m?{signal:e.signal}:{}}};return o.query(...(0,p.getClientArgs)(l,t))}},u);return g.trpc=(0,y.useHookResult)({path:r.join(".")}),g},useSuspenseQuery:function(t,n,i){let s=w(),o=(0,d.getQueryKeyInternal)(t,n,"query"),a=i?.trpc?.abortOnUnmount??e?.abortOnUnmount??s.abortOnUnmount,u=(0,r.useSuspenseQuery)({...i,queryKey:o,queryFn:e=>{let t={trpc:{...a?{signal:e.signal}:{}}};return s.client.query(...(0,p.getClientArgs)(o,t))}},s.queryClient);return u.trpc=(0,y.useHookResult)({path:t.join(".")}),[u.data,u]},useQueries:e=>{let{ssrState:t,queryClient:r,prefetchQuery:n,client:i}=w(),s=e((0,g.createUseQueries)(i));if("u"({...e,queryKey:e.queryKey}))},r)},useSuspenseQueries:e=>{let{queryClient:t,client:r}=w(),n=e((0,g.createUseQueries)(r)),i=(0,c.useSuspenseQueries)({queries:n.map(e=>({...e,queryKey:e.queryKey}))},t);return[i.map(e=>e.data),i]},useMutation:function(e,t){let{client:r}=w(),s=(0,n.useQueryClient)(),o=[e],a=s.getMutationDefaults(o),u=(0,i.useMutation)({...t,mutationKey:o,mutationFn:n=>r.mutation(...(0,p.getClientArgs)([e,{input:n}],t)),onSuccess:(...e)=>b({originalFn:()=>t?.onSuccess?.(...e)??a?.onSuccess?.(...e),queryClient:s,meta:t?.meta??a?.meta??{}})},s);return u.trpc=(0,y.useHookResult)({path:e.join(".")}),u},useSubscription:function(e,t,r){let n=r?.enabled??!0,i=(0,s.hashKey)((0,d.getQueryKeyInternal)(e,t,"any")),{client:o}=w(),a=h.useRef(r);a.current=r,h.useEffect(()=>{if(!n)return;let i=!1,s=o.subscription(e.join("."),t??void 0,{onStarted:()=>{i||a.current.onStarted?.()},onData:e=>{i||r.onData(e)},onError:e=>{i||a.current.onError?.(e)}});return()=>{i=!0,s.unsubscribe()}},[i,n])},useDehydratedState:(e,t)=>h.useMemo(()=>t?e.runtime.transformer.deserialize(t):t,[t,e]),useInfiniteQuery:function(e,t,r){let{client:n,ssrState:i,prefetchInfiniteQuery:s,queryClient:a,abortOnUnmount:u}=w(),c=(0,d.getQueryKeyInternal)(e,t,"infinite"),l=a.getQueryDefaults(c);"u"{let t={...h,trpc:{...h?.trpc,...f?{signal:e.signal}:{}}};return n.query(...(0,p.getClientArgs)(c,t,e.pageParam??r.initialCursor))}},a);return m.trpc=(0,y.useHookResult)({path:e.join(".")}),m},useSuspenseInfiniteQuery:function(e,t,r){let n=w(),i=(0,d.getQueryKeyInternal)(e,t,"infinite"),s=n.queryClient.getQueryDefaults(i),o=O(i,{...s,...r}),u=r?.trpc?.abortOnUnmount??n.abortOnUnmount,c=(0,a.useSuspenseInfiniteQuery)({...r,initialPageParam:r.initialCursor??null,queryKey:i,queryFn:e=>{let t={...o,trpc:{...o?.trpc,...u?{signal:e.signal}:{}}};return n.client.query(...(0,p.getClientArgs)(i,t,e.pageParam??r.initialCursor))}},n.queryClient);return c.trpc=(0,y.useHookResult)({path:e.join(".")}),[c.data,c]}}}e.s(["createRootHooks",()=>b])},654291,e=>{"use strict";e.i(247167);var t,r,n,i=function(){function e(){this.keyToValue=new Map,this.valueToKey=new Map}return e.prototype.set=function(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)},e.prototype.getByKey=function(e){return this.keyToValue.get(e)},e.prototype.getByValue=function(e){return this.valueToKey.get(e)},e.prototype.clear=function(){this.keyToValue.clear(),this.valueToKey.clear()},e}(),s=function(){function e(e){this.generateIdentifier=e,this.kv=new i}return e.prototype.register=function(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))},e.prototype.clear=function(){this.kv.clear()},e.prototype.getIdentifier=function(e){return this.kv.getByValue(e)},e.prototype.getValue=function(e){return this.kv.getByKey(e)},e}(),o=(n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=new(function(e){function t(){var t=e.call(this,function(e){return e.name})||this;return t.classToAllowedProps=new Map,t}return o(t,e),t.prototype.register=function(t,r){"object"==typeof r?(r.allowProps&&this.classToAllowedProps.set(t,r.allowProps),e.prototype.register.call(this,t,r.identifier)):e.prototype.register.call(this,t,r)},t.prototype.getAllowedProps=function(e){return this.classToAllowedProps.get(e)},t}(s)),u=new s(function(e){var t;return null!=(t=e.description)?t:""}),c=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o};function l(e,t){Object.entries(e).forEach(function(e){var r=c(e,2),n=r[0];return t(r[1],n)})}function h(e,t){return -1!==e.indexOf(t)}function f(e,t){for(var r=0;r0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},g=function(e,t){for(var r=0,n=t.length,i=e.length;r0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},k=function(e,t){for(var r=0,n=t.length,i=e.length;rtypeof BigInt?BigInt(e):(console.error("Please add a BigInt polyfill."),e)}),M(function(e){return e instanceof Date&&!isNaN(e.valueOf())},"Date",function(e){return e.toISOString()},function(e){return new Date(e)}),M(function(e){return e instanceof Error},"Error",function(e){var t={name:e.name,message:e.message};return b.forEach(function(r){t[r]=e[r]}),t},function(e){var t=Error(e.message);return t.name=e.name,t.stack=e.stack,b.forEach(function(r){t[r]=e[r]}),t}),M(function(e){return e instanceof RegExp},"regexp",function(e){return""+e},function(e){return new RegExp(e.slice(1,e.lastIndexOf("/")),e.slice(e.lastIndexOf("/")+1))}),M(Q,"set",function(e){return k([],A(e.values()))},function(e){return new Set(e)}),M(C,"map",function(e){return k([],A(e.entries()))},function(e){return new Map(e)}),M(function(e){var t;return P(e)||(t=e)===1/0||t===-1/0},"number",function(e){return P(e)?"NaN":e>0?"Infinity":"-Infinity"},Number),M(function(e){return 0===e&&1/e==-1/0},"number",function(){return"-0"},Number)];function _(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var j=_(function(e){return!!S(e)&&!!u.getIdentifier(e)},function(e){return["symbol",u.getIdentifier(e)]},function(e){return e.description},function(e,t){var r=u.getValue(t[1]);if(!r)throw Error("Trying to deserialize unknown symbol");return r}),F=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce(function(e,t){return e[t.name]=t,e},{}),N=_(function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},function(e){return["typed-array",e.constructor.name]},function(e){return k([],A(e))},function(e,t){var r=F[t[1]];if(!r)throw Error("Trying to deserialize unknown typed array");return new r(e)});function K(e){return null!=e&&!!e.constructor&&!!a.getIdentifier(e.constructor)}var L=_(K,function(e){return["class",a.getIdentifier(e.constructor)]},function(e){var t=a.getAllowedProps(e.constructor);if(!t)return D({},e);var r={};return t.forEach(function(t){r[t]=e[t]}),r},function(e,t){var r=a.getValue(t[1]);if(!r)throw Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),e)}),H=_(function(e){return!!y(e)},function(e){return["custom",y(e).name]},function(e){return y(e).serialize(e)},function(e,t){var r=p[t[1]];if(!r)throw Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),B=[L,j,H,N],z=function(e){var t=f(B,function(t){return t.isApplicable(e)});if(t)return{value:t.transform(e),type:t.annotation(e)};var r=f(U,function(t){return t.isApplicable(e)});if(r)return{value:r.transform(e),type:r.annotation}},V={};U.forEach(function(e){V[e.annotation]=e});var $=function(e,t){if(E(t))switch(t[0]){case"symbol":return j.untransform(e,t);case"class":return L.untransform(e,t);case"custom":return H.untransform(e,t);case"typed-array":return N.untransform(e,t);default:throw Error("Unknown transformation: "+t)}var r=V[t];if(!r)throw Error("Unknown transformation: "+t);return r.untransform(e)},W=function(e,t){for(var r=e.keys();t>0;)r.next(),t--;return r.next().value};function G(e){if(h(e,"__proto__"))throw Error("__proto__ is not allowed as a property");if(h(e,"prototype"))throw Error("prototype is not allowed as a property");if(h(e,"constructor"))throw Error("constructor is not allowed as a property")}var J=function(e,t,r){if(G(t),0===t.length)return r(e);for(var n=e,i=0;i0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},X=function(e,t){for(var r=0,n=t.length,i=e.length;re(t,r)):"Object"!==ee(t)||t.constructor!==Object||Object.getPrototypeOf(t)!==Object.prototype?t:[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].reduce((n,i)=>{var s;let o;if(et(r.props)&&!r.props.includes(i))return n;let a=e(t[i],r);return s=r.nonenumerable,"enumerable"==(o=({}).propertyIsEnumerable.call(t,i)?"enumerable":"nonenumerable")&&(n[i]=a),s&&"nonenumerable"===o&&Object.defineProperty(n,i,{value:a,enumerable:!1,writable:!0,configurable:!0}),n},{})}(r);return(null==n?void 0:n.values)&&(t=i,function e(t,r,n){if(void 0===n&&(n=[]),t){if(!E(t))return void l(t,function(t,i){return e(t,r,X(X([],Y(n)),Y(I(i))))});var i=Y(t,2),s=i[0],o=i[1];o&&l(o,function(t,i){e(t,r,X(X([],Y(n)),Y(I(i))))}),r(s,n)}}(n.values,function(e,r){t=J(t,r,function(t){return $(t,e)})}),i=t),(null==n?void 0:n.referentialEqualities)&&(i=function(e,t){function r(t,r){var n,i,s=(n=e,G(i=I(r)),i.forEach(function(e){n=n[e]}),n);t.map(I).forEach(function(t){e=J(e,t,function(){return s})})}if(E(t)){var n=Y(t,2),i=n[0],s=n[1];i.forEach(function(t){e=J(e,I(t),function(){return e})}),s&&l(s,r)}else l(t,r);return e}(i,n.referentialEqualities)),i};e.s(["default",0,{stringify:function(e){return JSON.stringify(en(e))},parse:function(e){return ei(JSON.parse(e))},serialize:en,deserialize:ei,registerClass:function(e,t){return a.register(e,t)},registerSymbol:function(e,t){return u.register(e,t)},registerCustom:function(e,t){return d(er({name:t},e))},allowErrorProps:function(){for(var e=[],t=0;t{"use strict";e.i(431300),e.i(70773),e.i(606209),e.i(455111);var t=e.i(317751);let r=e=>e.queryClient??new t.QueryClient(e.queryClientConfig);e.s(["getQueryClient",()=>r],608129),e.i(637615),e.i(385283),e.s([],86336)},287402,e=>{"use strict";e.i(86336),e.s(["ENDPOINTS",0,["loggedInViewerRouter","admin","apiKeys","appRoutingForms","apps","auth","availability","appBasecamp3","bookings","calendars","calVideo","credentials","deploymentSetup","dsync","eventTypes","eventTypesHeavy","features","feedback","holidays","featureOptIn","i18n","insights","me","ooo","payments","public","timezones","saml","slots","teams","organizations","travelSchedules","users","viewer","webhook","workflows","googleWorkspace","oAuth","attributes","delegationCredential","routingForms","credits","filterSegments","aiVoiceAgent","phoneNumber","pbac","attributeSync"]])},372775,660678,e=>{"use strict";function t(e){return e.state.isPaused}function r(e){return"success"===e.state.status}function n(e,i={}){let s=i.shouldDehydrateMutation??t,o=e.getMutationCache().getAll().flatMap(e=>s(e)?[{mutationKey:e.options.mutationKey,state:e.state,...e.meta&&{meta:e.meta}}]:[]),a=i.shouldDehydrateQuery??r;return{mutations:o,queries:e.getQueryCache().getAll().flatMap(e=>a(e)?[{state:e.state,queryKey:e.queryKey,queryHash:e.queryHash,...e.meta&&{meta:e.meta}}]:[])}}function i(e,t,r){if("object"!=typeof t||null===t)return;let n=e.getMutationCache(),i=e.getQueryCache(),s=t.mutations||[],o=t.queries||[];s.forEach(t=>{n.build(e,{...r?.defaultOptions?.mutations,mutationKey:t.mutationKey,meta:t.meta},t.state)}),o.forEach(({queryKey:t,state:n,queryHash:s,meta:o})=>{let a=i.get(s);if(a){if(a.state.dataUpdatedAtn,"hydrate",()=>i],372775);var s=e.i(271645),o=e.i(912598),a=({children:e,options:t={},state:r,queryClient:n})=>{let a=(0,o.useQueryClient)(n),[u,c]=s.useState(),l=s.useRef(t);return l.current=t,s.useMemo(()=>{if(r){if("object"!=typeof r)return;let e=a.getQueryCache(),t=r.queries||[],n=[],s=[];for(let r of t){let t=e.get(r.queryHash);if(t){let e=r.state.dataUpdatedAt>t.state.dataUpdatedAt,n=u?.find(e=>e.queryHash===r.queryHash);e&&(!n||r.state.dataUpdatedAt>n.state.dataUpdatedAt)&&s.push(r)}else n.push(r)}n.length>0&&i(a,{queries:n},l.current),s.length>0&&c(e=>e?[...e,...s]:s)}},[a,u,r]),s.useEffect(()=>{u&&(i(a,{queries:u},l.current),c(void 0))},[a,u]),e};e.s(["HydrationBoundary",()=>a],660678)},916923,546278,e=>{"use strict";var t=e.i(372775),r=e.i(912598),n=e.i(660678);e.i(944362);var i=e.i(93082);e.i(86336);var s=e.i(455111),o=e.i(608129),a=e.i(271645);function u(e){let t=e.state.error;if(t instanceof Error&&"TRPCClientError"===t.name){let r={message:t.message,data:t.data,shape:t.shape};return{...e,state:{...e.state,error:r}}}return e}var c=e.i(70773),l=e.i(431300);e.i(707749);var h=e.i(94802);function f(f){let p=(0,s.createRootHooks)(f),d=function(c){let{config:l}=c;return h=>{let f=(0,s.createRootHooks)(c),p=e=>{let[t]=(0,a.useState)(()=>{if(e.trpc)return e.trpc;let t=l({}),r=(0,o.getQueryClient)(t),n=f.createClient(t);return{abortOnUnmount:t.abortOnUnmount,queryClient:r,trpcClient:n,ssrState:!!c.ssr&&"mounting",ssrContext:null}}),{queryClient:i,trpcClient:s,ssrState:u,ssrContext:p}=t,d=f.useDehydratedState(s,e.pageProps?.trpcState);return a.default.createElement(f.Provider,{abortOnUnmount:t.abortOnUnmount??!1,client:s,queryClient:i,ssrState:u,ssrContext:p},a.default.createElement(r.QueryClientProvider,{client:i},a.default.createElement(n.HydrationBoundary,{state:d},a.default.createElement(h,Object.assign({},e)))))};(h.getInitialProps??c.ssr)&&(p.getInitialProps=async r=>{let n=async()=>{if("function"==typeof c.ssr){if("u">typeof window)return!1;try{return await c.ssr({ctx:r.ctx})}catch(e){return!1}}return c.ssr},s=await n(),f=r.AppTree,p=!!r.Component,d=p?r.ctx:r,y={};if(h.getInitialProps){let e=await h.getInitialProps(r);y={...p?e.pageProps??{}:e,...y}}let m=e=>p?{pageProps:e}:e;if("u">typeof window||!s)return m(y);let g=l({ctx:d}),b=(0,i.createTRPCUntypedClient)(g),v=(0,o.getQueryClient)(g),w={pageProps:y,trpc:{config:g,trpcClient:b,queryClient:v,ssrState:"prepass",ssrContext:d}},O=await e.A(852441);for(;O.renderToString((0,a.createElement)(f,w)),v.isFetching();)await new Promise(e=>{let t=v.getQueryCache().subscribe(r=>{r?.query.getObserversCount()===0&&(e(),t())})});let R=(0,t.dehydrate)(v,{shouldDehydrateQuery:e=>"idle"!==e.state.fetchStatus||"pending"!==e.state.status}),E={...R,queries:R.queries.map(u),mutations:R.mutations.map(u)};y.trpcState=b.runtime.combinedTransformer.output.serialize(E);let C=m(y);if("responseMeta"in c){let e=c.responseMeta?.({ctx:d,clientErrors:[...R.queries,...R.mutations].map(e=>e.state.error).flatMap(e=>e instanceof Error&&"TRPCClientError"===e.name?[e]:[])})??{};for(let[t,r]of Object.entries(e.headers??{}))"string"==typeof r&&d.res?.setHeader(t,r);e.status&&d.res&&(d.res.statusCode=e.status)}return C});let d=h.displayName??h.name??"Component";return p.displayName=`withTRPC(${d})`,p}}(f);return(0,h.createFlatProxy)(e=>"useContext"===e||"useUtils"===e?()=>{let e=p.useUtils();return(0,a.useMemo)(()=>(0,c.createReactQueryUtils)(e),[e])}:"useQueries"===e?p.useQueries:"useSuspenseQueries"===e?p.useSuspenseQueries:"withTRPC"===e?d:(0,l.createReactDecoration)(e,p))}e.s(["createTRPCNext",()=>f],546278),e.s([],916923)},273446,e=>{"use strict";var t=e.i(247167),r=e.i(654291);e.i(944362);var n=e.i(911712),i=e.i(632082),s=e.i(156346),o=e.i(357892);e.i(916923);var a=e.i(546278),u=e.i(287402);let c=e=>t=>{let r,n=t.op.path.split("."),i="";return 2==n.length?(r=n[0],i=n[1]):(r=n[1],i=n.splice(2,n.length-2).join(".")),e[r]({...t,op:{...t.op,path:i}})},l=(0,a.createTRPCNext)({config(){let e="/api/trpc";return{links:[(0,s.loggerLink)({enabled:e=>"number"==typeof t.default.env.NEXT_PUBLIC_LOGGER_LEVEL&&t.default.env.NEXT_PUBLIC_LOGGER_LEVEL>=0||"down"===e.direction&&e.result instanceof Error}),(0,o.splitLink)({condition:e=>!!e.context.skipBatch,true:t=>c(Object.fromEntries(u.ENDPOINTS.map(r=>[r,(0,i.httpLink)({url:`${e}/${r}`})(t)]))),false:t=>c(Object.fromEntries(u.ENDPOINTS.map(r=>[r,(0,n.httpBatchLink)({url:`${e}/${r}`})(t)])))})],queryClientConfig:{defaultOptions:{queries:{staleTime:1e3,retry(e,t){let r=t?.data?.code;return"BAD_REQUEST"!==r&&"FORBIDDEN"!==r&&"UNAUTHORIZED"!==r&&e<3}}}},transformer:r.default}},ssr:!1});r.default,e.s(["trpc",0,l])}]); //# sourceMappingURL=38ef1b16ad155c6e.js.map