var ts=s=>{throw TypeError(s)};var Et=(s,e,t)=>e.has(s)||ts("Cannot "+t);var a=(s,e,t)=>(Et(s,e,"read from private field"),t?t.call(s):e.get(s)),g=(s,e,t)=>e.has(s)?ts("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),h=(s,e,t,r)=>(Et(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t),C=(s,e,t)=>(Et(s,e,"access private method"),t);var _t=(s,e,t,r)=>({set _(i){h(s,e,i,t)},get _(){return a(s,e,r)}});import{r as L}from"./vendor-react-BsBmf7g_.js";import{j as er}from"./vendor-radix-DNxwLykc.js";var at=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Qe=typeof window>"u"||"Deno"in globalThis;function B(){}function tr(s,e){return typeof s=="function"?s(e):s}function Pt(s){return typeof s=="number"&&s>=0&&s!==1/0}function Zs(s,e){return Math.max(s+(e||0)-Date.now(),0)}function Oe(s,e){return typeof s=="function"?s(e):s}function Y(s,e){return typeof s=="function"?s(e):s}function ss(s,e){const{type:t="all",exact:r,fetchStatus:i,predicate:n,queryKey:o,stale:u}=s;if(o){if(r){if(e.queryHash!==Gt(o,e.options))return!1}else if(!dt(e.queryKey,o))return!1}if(t!=="all"){const c=e.isActive();if(t==="active"&&!c||t==="inactive"&&c)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||i&&i!==e.state.fetchStatus||n&&!n(e))}function rs(s,e){const{exact:t,status:r,predicate:i,mutationKey:n}=s;if(n){if(!e.options.mutationKey)return!1;if(t){if(Le(e.options.mutationKey)!==Le(n))return!1}else if(!dt(e.options.mutationKey,n))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function Gt(s,e){return((e==null?void 0:e.queryKeyHashFn)||Le)(s)}function Le(s){return JSON.stringify(s,(e,t)=>jt(t)?Object.keys(t).sort().reduce((r,i)=>(r[i]=t[i],r),{}):t)}function dt(s,e){return s===e?!0:typeof s!=typeof e?!1:s&&e&&typeof s=="object"&&typeof e=="object"?Object.keys(e).every(t=>dt(s[t],e[t])):!1}function Ds(s,e){if(s===e)return s;const t=is(s)&&is(e);if(t||jt(s)&&jt(e)){const r=t?s:Object.keys(s),i=r.length,n=t?e:Object.keys(e),o=n.length,u=t?[]:{},c=new Set(r);let l=0;for(let m=0;m{setTimeout(e,s)})}function Nt(s,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(s,e):t.structuralSharing!==!1?Ds(s,e):e}function rr(s,e,t=0){const r=[...s,e];return t&&r.length>t?r.slice(1):r}function ir(s,e,t=0){const r=[e,...s];return t&&r.length>t?r.slice(0,-1):r}var Jt=Symbol();function Qs(s,e){return!s.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!s.queryFn||s.queryFn===Jt?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function Ls(s,e){return typeof s=="function"?s(...e):!!s}var Ae,pe,Ve,Rs,nr=(Rs=class extends at{constructor(){super();g(this,Ae);g(this,pe);g(this,Ve);h(this,Ve,e=>{if(!Qe&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){a(this,pe)||this.setEventListener(a(this,Ve))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,pe))==null||e.call(this),h(this,pe,void 0))}setEventListener(e){var t;h(this,Ve,e),(t=a(this,pe))==null||t.call(this),h(this,pe,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){a(this,Ae)!==e&&(h(this,Ae,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof a(this,Ae)=="boolean"?a(this,Ae):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ae=new WeakMap,pe=new WeakMap,Ve=new WeakMap,Rs),Yt=new nr,ze,me,Be,Ts,ar=(Ts=class extends at{constructor(){super();g(this,ze,!0);g(this,me);g(this,Be);h(this,Be,e=>{if(!Qe&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){a(this,me)||this.setEventListener(a(this,Be))}onUnsubscribe(){var e;this.hasListeners()||((e=a(this,me))==null||e.call(this),h(this,me,void 0))}setEventListener(e){var t;h(this,Be,e),(t=a(this,me))==null||t.call(this),h(this,me,e(this.setOnline.bind(this)))}setOnline(e){a(this,ze)!==e&&(h(this,ze,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return a(this,ze)}},ze=new WeakMap,me=new WeakMap,Be=new WeakMap,Ts),wt=new ar;function Mt(){let s,e;const t=new Promise((i,n)=>{s=i,e=n});t.status="pending",t.catch(()=>{});function r(i){Object.assign(t,i),delete t.resolve,delete t.reject}return t.resolve=i=>{r({status:"fulfilled",value:i}),s(i)},t.reject=i=>{r({status:"rejected",reason:i}),e(i)},t}function or(s){return Math.min(1e3*2**s,3e4)}function $s(s){return(s??"online")==="online"?wt.isOnline():!0}var Us=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function At(s){return s instanceof Us}function qs(s){let e=!1,t=0,r=!1,i;const n=Mt(),o=k=>{var w;r||(x(new Us(k)),(w=s.abort)==null||w.call(s))},u=()=>{e=!0},c=()=>{e=!1},l=()=>Yt.isFocused()&&(s.networkMode==="always"||wt.isOnline())&&s.canRun(),m=()=>$s(s.networkMode)&&s.canRun(),v=k=>{var w;r||(r=!0,(w=s.onSuccess)==null||w.call(s,k),i==null||i(),n.resolve(k))},x=k=>{var w;r||(r=!0,(w=s.onError)==null||w.call(s,k),i==null||i(),n.reject(k))},O=()=>new Promise(k=>{var w;i=M=>{(r||l())&&k(M)},(w=s.onPause)==null||w.call(s)}).then(()=>{var k;i=void 0,r||(k=s.onContinue)==null||k.call(s)}),I=()=>{if(r)return;let k;const w=t===0?s.initialPromise:void 0;try{k=w??s.fn()}catch(M){k=Promise.reject(M)}Promise.resolve(k).then(v).catch(M=>{var ee;if(r)return;const U=s.retry??(Qe?0:3),P=s.retryDelay??or,Q=typeof P=="function"?P(t,M):P,W=U===!0||typeof U=="number"&&tl()?void 0:O()).then(()=>{e?x(M):I()})})};return{promise:n,cancel:o,continue:()=>(i==null||i(),n),cancelRetry:u,continueRetry:c,canStart:m,start:()=>(m()?I():O().then(I),n)}}var ur=s=>setTimeout(s,0);function cr(){let s=[],e=0,t=u=>{u()},r=u=>{u()},i=ur;const n=u=>{e?s.push(u):i(()=>{t(u)})},o=()=>{const u=s;s=[],u.length&&i(()=>{r(()=>{u.forEach(c=>{t(c)})})})};return{batch:u=>{let c;e++;try{c=u()}finally{e--,e||o()}return c},batchCalls:u=>(...c)=>{n(()=>{u(...c)})},schedule:n,setNotifyFunction:u=>{t=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{i=u}}}var D=cr(),Ie,Es,Vs=(Es=class{constructor(){g(this,Ie)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pt(this.gcTime)&&h(this,Ie,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Qe?1/0:5*60*1e3))}clearGcTimeout(){a(this,Ie)&&(clearTimeout(a(this,Ie)),h(this,Ie,void 0))}},Ie=new WeakMap,Es),Ke,Pe,J,je,$,pt,Ne,te,oe,As,dr=(As=class extends Vs{constructor(e){super();g(this,te);g(this,Ke);g(this,Pe);g(this,J);g(this,je);g(this,$);g(this,pt);g(this,Ne);h(this,Ne,!1),h(this,pt,e.defaultOptions),this.setOptions(e.options),this.observers=[],h(this,je,e.client),h(this,J,a(this,je).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,h(this,Ke,lr(this.options)),this.state=e.state??a(this,Ke),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=a(this,$))==null?void 0:e.promise}setOptions(e){this.options={...a(this,pt),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&a(this,J).remove(this)}setData(e,t){const r=Nt(this.state.data,e,this.options);return C(this,te,oe).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(e,t){C(this,te,oe).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var r,i;const t=(r=a(this,$))==null?void 0:r.promise;return(i=a(this,$))==null||i.cancel(e),t?t.then(B).catch(B):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(a(this,Ke))}isActive(){return this.observers.some(e=>Y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jt||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Oe(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Zs(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=a(this,$))==null||t.continue()}onOnline(){var t;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=a(this,$))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),a(this,J).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(a(this,$)&&(a(this,Ne)?a(this,$).cancel({revert:!0}):a(this,$).cancelRetry()),this.scheduleGc()),a(this,J).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||C(this,te,oe).call(this,{type:"invalidate"})}fetch(e,t){var l,m,v;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(a(this,$))return a(this,$).continueRetry(),a(this,$).promise}if(e&&this.setOptions(e),!this.options.queryFn){const x=this.observers.find(O=>O.options.queryFn);x&&this.setOptions(x.options)}const r=new AbortController,i=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(h(this,Ne,!0),r.signal)})},n=()=>{const x=Qs(this.options,t),I=(()=>{const k={client:a(this,je),queryKey:this.queryKey,meta:this.meta};return i(k),k})();return h(this,Ne,!1),this.options.persister?this.options.persister(x,I,this):x(I)},u=(()=>{const x={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:a(this,je),state:this.state,fetchFn:n};return i(x),x})();(l=this.options.behavior)==null||l.onFetch(u,this),h(this,Pe,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((m=u.fetchOptions)==null?void 0:m.meta))&&C(this,te,oe).call(this,{type:"fetch",meta:(v=u.fetchOptions)==null?void 0:v.meta});const c=x=>{var O,I,k,w;At(x)&&x.silent||C(this,te,oe).call(this,{type:"error",error:x}),At(x)||((I=(O=a(this,J).config).onError)==null||I.call(O,x,this),(w=(k=a(this,J).config).onSettled)==null||w.call(k,this.state.data,x,this)),this.scheduleGc()};return h(this,$,qs({initialPromise:t==null?void 0:t.initialPromise,fn:u.fetchFn,abort:r.abort.bind(r),onSuccess:x=>{var O,I,k,w;if(x===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(x)}catch(M){c(M);return}(I=(O=a(this,J).config).onSuccess)==null||I.call(O,x,this),(w=(k=a(this,J).config).onSettled)==null||w.call(k,x,this.state.error,this),this.scheduleGc()},onError:c,onFail:(x,O)=>{C(this,te,oe).call(this,{type:"failed",failureCount:x,error:O})},onPause:()=>{C(this,te,oe).call(this,{type:"pause"})},onContinue:()=>{C(this,te,oe).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0})),a(this,$).start()}},Ke=new WeakMap,Pe=new WeakMap,J=new WeakMap,je=new WeakMap,$=new WeakMap,pt=new WeakMap,Ne=new WeakMap,te=new WeakSet,oe=function(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...zs(r.data,this.options),fetchMeta:e.meta??null};case"success":return h(this,Pe,void 0),{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return At(i)&&i.revert&&a(this,Pe)?{...a(this,Pe),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),D.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),a(this,J).notify({query:this,type:"updated",action:e})})},As);function zs(s,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$s(e.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function lr(s){const e=typeof s.initialData=="function"?s.initialData():s.initialData,t=e!==void 0,r=t?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var re,Is,hr=(Is=class extends at{constructor(e={}){super();g(this,re);this.config=e,h(this,re,new Map)}build(e,t,r){const i=t.queryKey,n=t.queryHash??Gt(i,t);let o=this.get(n);return o||(o=new dr({client:e,queryKey:i,queryHash:n,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){a(this,re).has(e.queryHash)||(a(this,re).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=a(this,re).get(e.queryHash);t&&(e.destroy(),t===e&&a(this,re).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){D.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return a(this,re).get(e)}getAll(){return[...a(this,re).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>ss(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>ss(e,r)):t}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){D.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){D.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},re=new WeakMap,Is),ie,V,Me,ne,he,Ps,fr=(Ps=class extends Vs{constructor(e){super();g(this,ne);g(this,ie);g(this,V);g(this,Me);this.mutationId=e.mutationId,h(this,V,e.mutationCache),h(this,ie,[]),this.state=e.state||Bs(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){a(this,ie).includes(e)||(a(this,ie).push(e),this.clearGcTimeout(),a(this,V).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){h(this,ie,a(this,ie).filter(t=>t!==e)),this.scheduleGc(),a(this,V).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){a(this,ie).length||(this.state.status==="pending"?this.scheduleGc():a(this,V).remove(this))}continue(){var e;return((e=a(this,Me))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var n,o,u,c,l,m,v,x,O,I,k,w,M,U,P,Q,W,ee,ot,q;const t=()=>{C(this,ne,he).call(this,{type:"continue"})};h(this,Me,qs({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(F,Z)=>{C(this,ne,he).call(this,{type:"failed",failureCount:F,error:Z})},onPause:()=>{C(this,ne,he).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>a(this,V).canRun(this)}));const r=this.state.status==="pending",i=!a(this,Me).canStart();try{if(r)t();else{C(this,ne,he).call(this,{type:"pending",variables:e,isPaused:i}),await((o=(n=a(this,V).config).onMutate)==null?void 0:o.call(n,e,this));const Z=await((c=(u=this.options).onMutate)==null?void 0:c.call(u,e));Z!==this.state.context&&C(this,ne,he).call(this,{type:"pending",context:Z,variables:e,isPaused:i})}const F=await a(this,Me).start();return await((m=(l=a(this,V).config).onSuccess)==null?void 0:m.call(l,F,e,this.state.context,this)),await((x=(v=this.options).onSuccess)==null?void 0:x.call(v,F,e,this.state.context)),await((I=(O=a(this,V).config).onSettled)==null?void 0:I.call(O,F,null,this.state.variables,this.state.context,this)),await((w=(k=this.options).onSettled)==null?void 0:w.call(k,F,null,e,this.state.context)),C(this,ne,he).call(this,{type:"success",data:F}),F}catch(F){try{throw await((U=(M=a(this,V).config).onError)==null?void 0:U.call(M,F,e,this.state.context,this)),await((Q=(P=this.options).onError)==null?void 0:Q.call(P,F,e,this.state.context)),await((ee=(W=a(this,V).config).onSettled)==null?void 0:ee.call(W,void 0,F,this.state.variables,this.state.context,this)),await((q=(ot=this.options).onSettled)==null?void 0:q.call(ot,void 0,F,e,this.state.context)),F}finally{C(this,ne,he).call(this,{type:"error",error:F})}}finally{a(this,V).runNext(this)}}},ie=new WeakMap,V=new WeakMap,Me=new WeakMap,ne=new WeakSet,he=function(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),D.batch(()=>{a(this,ie).forEach(r=>{r.onMutationUpdate(e)}),a(this,V).notify({mutation:this,type:"updated",action:e})})},Ps);function Bs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ue,se,mt,js,pr=(js=class extends at{constructor(e={}){super();g(this,ue);g(this,se);g(this,mt);this.config=e,h(this,ue,new Set),h(this,se,new Map),h(this,mt,0)}build(e,t,r){const i=new fr({mutationCache:this,mutationId:++_t(this,mt)._,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){a(this,ue).add(e);const t=bt(e);if(typeof t=="string"){const r=a(this,se).get(t);r?r.push(e):a(this,se).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(a(this,ue).delete(e)){const t=bt(e);if(typeof t=="string"){const r=a(this,se).get(t);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&a(this,se).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=bt(e);if(typeof t=="string"){const r=a(this,se).get(t),i=r==null?void 0:r.find(n=>n.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const t=bt(e);if(typeof t=="string"){const i=(r=a(this,se).get(t))==null?void 0:r.find(n=>n!==e&&n.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){D.batch(()=>{a(this,ue).forEach(e=>{this.notify({type:"removed",mutation:e})}),a(this,ue).clear(),a(this,se).clear()})}getAll(){return Array.from(a(this,ue))}find(e){const t={exact:!0,...e};return this.getAll().find(r=>rs(t,r))}findAll(e={}){return this.getAll().filter(t=>rs(e,t))}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return D.batch(()=>Promise.all(e.map(t=>t.continue().catch(B))))}},ue=new WeakMap,se=new WeakMap,mt=new WeakMap,js);function bt(s){var e;return(e=s.options.scope)==null?void 0:e.id}function as(s){return{onFetch:(e,t)=>{var m,v,x,O,I;const r=e.options,i=(x=(v=(m=e.fetchOptions)==null?void 0:m.meta)==null?void 0:v.fetchMore)==null?void 0:x.direction,n=((O=e.state.data)==null?void 0:O.pages)||[],o=((I=e.state.data)==null?void 0:I.pageParams)||[];let u={pages:[],pageParams:[]},c=0;const l=async()=>{let k=!1;const w=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(e.signal.aborted?k=!0:e.signal.addEventListener("abort",()=>{k=!0}),e.signal)})},M=Qs(e.options,e.fetchOptions),U=async(P,Q,W)=>{if(k)return Promise.reject();if(Q==null&&P.pages.length)return Promise.resolve(P);const ot=(()=>{const Ee={client:e.client,queryKey:e.queryKey,pageParam:Q,direction:W?"backward":"forward",meta:e.options.meta};return w(Ee),Ee})(),q=await M(ot),{maxPages:F}=e.options,Z=W?ir:rr;return{pages:Z(P.pages,q,F),pageParams:Z(P.pageParams,Q,F)}};if(i&&n.length){const P=i==="backward",Q=P?mr:os,W={pages:n,pageParams:o},ee=Q(r,W);u=await U(W,ee,P)}else{const P=s??n.length;do{const Q=c===0?o[0]??r.initialPageParam:os(r,u);if(c>0&&Q==null)break;u=await U(u,Q),c++}while(c{var k,w;return(w=(k=e.options).persister)==null?void 0:w.call(k,l,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=l}}}function os(s,{pages:e,pageParams:t}){const r=e.length-1;return e.length>0?s.getNextPageParam(e[r],e,t[r],t):void 0}function mr(s,{pages:e,pageParams:t}){var r;return e.length>0?(r=s.getPreviousPageParam)==null?void 0:r.call(s,e[0],e,t[0],t):void 0}var j,ye,ve,He,We,ge,Ge,Je,Ns,ai=(Ns=class{constructor(s={}){g(this,j);g(this,ye);g(this,ve);g(this,He);g(this,We);g(this,ge);g(this,Ge);g(this,Je);h(this,j,s.queryCache||new hr),h(this,ye,s.mutationCache||new pr),h(this,ve,s.defaultOptions||{}),h(this,He,new Map),h(this,We,new Map),h(this,ge,0)}mount(){_t(this,ge)._++,a(this,ge)===1&&(h(this,Ge,Yt.subscribe(async s=>{s&&(await this.resumePausedMutations(),a(this,j).onFocus())})),h(this,Je,wt.subscribe(async s=>{s&&(await this.resumePausedMutations(),a(this,j).onOnline())})))}unmount(){var s,e;_t(this,ge)._--,a(this,ge)===0&&((s=a(this,Ge))==null||s.call(this),h(this,Ge,void 0),(e=a(this,Je))==null||e.call(this),h(this,Je,void 0))}isFetching(s){return a(this,j).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return a(this,ye).findAll({...s,status:"pending"}).length}getQueryData(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=a(this,j).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(s){const e=this.defaultQueryOptions(s),t=a(this,j).build(this,e),r=t.state.data;return r===void 0?this.fetchQuery(s):(s.revalidateIfStale&&t.isStaleByTime(Oe(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(s){return a(this,j).findAll(s).map(({queryKey:e,state:t})=>{const r=t.data;return[e,r]})}setQueryData(s,e,t){const r=this.defaultQueryOptions({queryKey:s}),i=a(this,j).get(r.queryHash),n=i==null?void 0:i.state.data,o=tr(e,n);if(o!==void 0)return a(this,j).build(this,r).setData(o,{...t,manual:!0})}setQueriesData(s,e,t){return D.batch(()=>a(this,j).findAll(s).map(({queryKey:r})=>[r,this.setQueryData(r,e,t)]))}getQueryState(s){var t;const e=this.defaultQueryOptions({queryKey:s});return(t=a(this,j).get(e.queryHash))==null?void 0:t.state}removeQueries(s){const e=a(this,j);D.batch(()=>{e.findAll(s).forEach(t=>{e.remove(t)})})}resetQueries(s,e){const t=a(this,j);return D.batch(()=>(t.findAll(s).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...s},e)))}cancelQueries(s,e={}){const t={revert:!0,...e},r=D.batch(()=>a(this,j).findAll(s).map(i=>i.cancel(t)));return Promise.all(r).then(B).catch(B)}invalidateQueries(s,e={}){return D.batch(()=>(a(this,j).findAll(s).forEach(t=>{t.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},e)))}refetchQueries(s,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},r=D.batch(()=>a(this,j).findAll(s).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let n=i.fetch(void 0,t);return t.throwOnError||(n=n.catch(B)),i.state.fetchStatus==="paused"?Promise.resolve():n}));return Promise.all(r).then(B)}fetchQuery(s){const e=this.defaultQueryOptions(s);e.retry===void 0&&(e.retry=!1);const t=a(this,j).build(this,e);return t.isStaleByTime(Oe(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(B).catch(B)}fetchInfiniteQuery(s){return s.behavior=as(s.pages),this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(B).catch(B)}ensureInfiniteQueryData(s){return s.behavior=as(s.pages),this.ensureQueryData(s)}resumePausedMutations(){return wt.isOnline()?a(this,ye).resumePausedMutations():Promise.resolve()}getQueryCache(){return a(this,j)}getMutationCache(){return a(this,ye)}getDefaultOptions(){return a(this,ve)}setDefaultOptions(s){h(this,ve,s)}setQueryDefaults(s,e){a(this,He).set(Le(s),{queryKey:s,defaultOptions:e})}getQueryDefaults(s){const e=[...a(this,He).values()],t={};return e.forEach(r=>{dt(s,r.queryKey)&&Object.assign(t,r.defaultOptions)}),t}setMutationDefaults(s,e){a(this,We).set(Le(s),{mutationKey:s,defaultOptions:e})}getMutationDefaults(s){const e=[...a(this,We).values()],t={};return e.forEach(r=>{dt(s,r.mutationKey)&&Object.assign(t,r.defaultOptions)}),t}defaultQueryOptions(s){if(s._defaulted)return s;const e={...a(this,ve).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return e.queryHash||(e.queryHash=Gt(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Jt&&(e.enabled=!1),e}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...a(this,ve).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){a(this,j).clear(),a(this,ye).clear()}},j=new WeakMap,ye=new WeakMap,ve=new WeakMap,He=new WeakMap,We=new WeakMap,ge=new WeakMap,Ge=new WeakMap,Je=new WeakMap,Ns),K,R,yt,z,Fe,Ye,_e,be,vt,Xe,et,Ze,De,xe,tt,A,ut,Ft,Zt,Dt,Qt,Lt,$t,Ut,Ks,Ms,yr=(Ms=class extends at{constructor(e,t){super();g(this,A);g(this,K);g(this,R);g(this,yt);g(this,z);g(this,Fe);g(this,Ye);g(this,_e);g(this,be);g(this,vt);g(this,Xe);g(this,et);g(this,Ze);g(this,De);g(this,xe);g(this,tt,new Set);this.options=t,h(this,K,e),h(this,be,null),h(this,_e,Mt()),this.options.experimental_prefetchInRender||a(this,_e).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(a(this,R).addObserver(this),us(a(this,R),this.options)?C(this,A,ut).call(this):this.updateResult(),C(this,A,Qt).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qt(a(this,R),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qt(a(this,R),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,C(this,A,Lt).call(this),C(this,A,$t).call(this),a(this,R).removeObserver(this)}setOptions(e){const t=this.options,r=a(this,R);if(this.options=a(this,K).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Y(this.options.enabled,a(this,R))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");C(this,A,Ut).call(this),a(this,R).setOptions(this.options),t._defaulted&&!kt(this.options,t)&&a(this,K).getQueryCache().notify({type:"observerOptionsUpdated",query:a(this,R),observer:this});const i=this.hasListeners();i&&cs(a(this,R),r,this.options,t)&&C(this,A,ut).call(this),this.updateResult(),i&&(a(this,R)!==r||Y(this.options.enabled,a(this,R))!==Y(t.enabled,a(this,R))||Oe(this.options.staleTime,a(this,R))!==Oe(t.staleTime,a(this,R)))&&C(this,A,Ft).call(this);const n=C(this,A,Zt).call(this);i&&(a(this,R)!==r||Y(this.options.enabled,a(this,R))!==Y(t.enabled,a(this,R))||n!==a(this,xe))&&C(this,A,Dt).call(this,n)}getOptimisticResult(e){const t=a(this,K).getQueryCache().build(a(this,K),e),r=this.createResult(t,e);return gr(this,r)&&(h(this,z,r),h(this,Ye,this.options),h(this,Fe,a(this,R).state)),r}getCurrentResult(){return a(this,z)}trackResult(e,t){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),t==null||t(i),Reflect.get(r,i))})}trackProp(e){a(this,tt).add(e)}getCurrentQuery(){return a(this,R)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=a(this,K).defaultQueryOptions(e),r=a(this,K).getQueryCache().build(a(this,K),t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return C(this,A,ut).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),a(this,z)))}createResult(e,t){var F;const r=a(this,R),i=this.options,n=a(this,z),o=a(this,Fe),u=a(this,Ye),l=e!==r?e.state:a(this,yt),{state:m}=e;let v={...m},x=!1,O;if(t._optimisticResults){const Z=this.hasListeners(),Ee=!Z&&us(e,t),Ue=Z&&cs(e,r,t,i);(Ee||Ue)&&(v={...v,...zs(m.data,e.options)}),t._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:I,errorUpdatedAt:k,status:w}=v;O=v.data;let M=!1;if(t.placeholderData!==void 0&&O===void 0&&w==="pending"){let Z;n!=null&&n.isPlaceholderData&&t.placeholderData===(u==null?void 0:u.placeholderData)?(Z=n.data,M=!0):Z=typeof t.placeholderData=="function"?t.placeholderData((F=a(this,et))==null?void 0:F.state.data,a(this,et)):t.placeholderData,Z!==void 0&&(w="success",O=Nt(n==null?void 0:n.data,Z,t),x=!0)}if(t.select&&O!==void 0&&!M)if(n&&O===(o==null?void 0:o.data)&&t.select===a(this,vt))O=a(this,Xe);else try{h(this,vt,t.select),O=t.select(O),O=Nt(n==null?void 0:n.data,O,t),h(this,Xe,O),h(this,be,null)}catch(Z){h(this,be,Z)}a(this,be)&&(I=a(this,be),O=a(this,Xe),k=Date.now(),w="error");const U=v.fetchStatus==="fetching",P=w==="pending",Q=w==="error",W=P&&U,ee=O!==void 0,q={status:w,fetchStatus:v.fetchStatus,isPending:P,isSuccess:w==="success",isError:Q,isInitialLoading:W,isLoading:W,data:O,dataUpdatedAt:v.dataUpdatedAt,error:I,errorUpdatedAt:k,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>l.dataUpdateCount||v.errorUpdateCount>l.errorUpdateCount,isFetching:U,isRefetching:U&&!P,isLoadingError:Q&&!ee,isPaused:v.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:Q&&ee,isStale:Xt(e,t),refetch:this.refetch,promise:a(this,_e),isEnabled:Y(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const Z=gt=>{q.status==="error"?gt.reject(q.error):q.data!==void 0&>.resolve(q.data)},Ee=()=>{const gt=h(this,_e,q.promise=Mt());Z(gt)},Ue=a(this,_e);switch(Ue.status){case"pending":e.queryHash===r.queryHash&&Z(Ue);break;case"fulfilled":(q.status==="error"||q.data!==Ue.value)&&Ee();break;case"rejected":(q.status!=="error"||q.error!==Ue.reason)&&Ee();break}}return q}updateResult(){const e=a(this,z),t=this.createResult(a(this,R),this.options);if(h(this,Fe,a(this,R).state),h(this,Ye,this.options),a(this,Fe).data!==void 0&&h(this,et,a(this,R)),kt(t,e))return;h(this,z,t);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,n=typeof i=="function"?i():i;if(n==="all"||!n&&!a(this,tt).size)return!0;const o=new Set(n??a(this,tt));return this.options.throwOnError&&o.add("error"),Object.keys(a(this,z)).some(u=>{const c=u;return a(this,z)[c]!==e[c]&&o.has(c)})};C(this,A,Ks).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&C(this,A,Qt).call(this)}},K=new WeakMap,R=new WeakMap,yt=new WeakMap,z=new WeakMap,Fe=new WeakMap,Ye=new WeakMap,_e=new WeakMap,be=new WeakMap,vt=new WeakMap,Xe=new WeakMap,et=new WeakMap,Ze=new WeakMap,De=new WeakMap,xe=new WeakMap,tt=new WeakMap,A=new WeakSet,ut=function(e){C(this,A,Ut).call(this);let t=a(this,R).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(B)),t},Ft=function(){C(this,A,Lt).call(this);const e=Oe(this.options.staleTime,a(this,R));if(Qe||a(this,z).isStale||!Pt(e))return;const r=Zs(a(this,z).dataUpdatedAt,e)+1;h(this,Ze,setTimeout(()=>{a(this,z).isStale||this.updateResult()},r))},Zt=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(a(this,R)):this.options.refetchInterval)??!1},Dt=function(e){C(this,A,$t).call(this),h(this,xe,e),!(Qe||Y(this.options.enabled,a(this,R))===!1||!Pt(a(this,xe))||a(this,xe)===0)&&h(this,De,setInterval(()=>{(this.options.refetchIntervalInBackground||Yt.isFocused())&&C(this,A,ut).call(this)},a(this,xe)))},Qt=function(){C(this,A,Ft).call(this),C(this,A,Dt).call(this,C(this,A,Zt).call(this))},Lt=function(){a(this,Ze)&&(clearTimeout(a(this,Ze)),h(this,Ze,void 0))},$t=function(){a(this,De)&&(clearInterval(a(this,De)),h(this,De,void 0))},Ut=function(){const e=a(this,K).getQueryCache().build(a(this,K),this.options);if(e===a(this,R))return;const t=a(this,R);h(this,R,e),h(this,yt,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},Ks=function(e){D.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(a(this,z))}),a(this,K).getQueryCache().notify({query:a(this,R),type:"observerResultsUpdated"})})},Ms);function vr(s,e){return Y(e.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&e.retryOnMount===!1)}function us(s,e){return vr(s,e)||s.state.data!==void 0&&qt(s,e,e.refetchOnMount)}function qt(s,e,t){if(Y(e.enabled,s)!==!1&&Oe(e.staleTime,s)!=="static"){const r=typeof t=="function"?t(s):t;return r==="always"||r!==!1&&Xt(s,e)}return!1}function cs(s,e,t,r){return(s!==e||Y(r.enabled,s)===!1)&&(!t.suspense||s.state.status!=="error")&&Xt(s,t)}function Xt(s,e){return Y(e.enabled,s)!==!1&&s.isStaleByTime(Oe(e.staleTime,s))}function gr(s,e){return!kt(s.getCurrentResult(),e)}var ke,we,H,ce,de,xt,Vt,Fs,_r=(Fs=class extends at{constructor(e,t){super();g(this,de);g(this,ke);g(this,we);g(this,H);g(this,ce);h(this,ke,e),this.setOptions(t),this.bindMethods(),C(this,de,xt).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var r;const t=this.options;this.options=a(this,ke).defaultMutationOptions(e),kt(this.options,t)||a(this,ke).getMutationCache().notify({type:"observerOptionsUpdated",mutation:a(this,H),observer:this}),t!=null&&t.mutationKey&&this.options.mutationKey&&Le(t.mutationKey)!==Le(this.options.mutationKey)?this.reset():((r=a(this,H))==null?void 0:r.state.status)==="pending"&&a(this,H).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||(e=a(this,H))==null||e.removeObserver(this)}onMutationUpdate(e){C(this,de,xt).call(this),C(this,de,Vt).call(this,e)}getCurrentResult(){return a(this,we)}reset(){var e;(e=a(this,H))==null||e.removeObserver(this),h(this,H,void 0),C(this,de,xt).call(this),C(this,de,Vt).call(this)}mutate(e,t){var r;return h(this,ce,t),(r=a(this,H))==null||r.removeObserver(this),h(this,H,a(this,ke).getMutationCache().build(a(this,ke),this.options)),a(this,H).addObserver(this),a(this,H).execute(e)}},ke=new WeakMap,we=new WeakMap,H=new WeakMap,ce=new WeakMap,de=new WeakSet,xt=function(){var t;const e=((t=a(this,H))==null?void 0:t.state)??Bs();h(this,we,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},Vt=function(e){D.batch(()=>{var t,r,i,n,o,u,c,l;if(a(this,ce)&&this.hasListeners()){const m=a(this,we).variables,v=a(this,we).context;(e==null?void 0:e.type)==="success"?((r=(t=a(this,ce)).onSuccess)==null||r.call(t,e.data,m,v),(n=(i=a(this,ce)).onSettled)==null||n.call(i,e.data,null,m,v)):(e==null?void 0:e.type)==="error"&&((u=(o=a(this,ce)).onError)==null||u.call(o,e.error,m,v),(l=(c=a(this,ce)).onSettled)==null||l.call(c,void 0,e.error,m,v))}this.listeners.forEach(m=>{m(a(this,we))})})},Fs),Hs=L.createContext(void 0),Ws=s=>{const e=L.useContext(Hs);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},oi=({client:s,children:e})=>(L.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),er.jsx(Hs.Provider,{value:s,children:e})),Gs=L.createContext(!1),br=()=>L.useContext(Gs);Gs.Provider;function xr(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var kr=L.createContext(xr()),wr=()=>L.useContext(kr),Cr=(s,e)=>{(s.suspense||s.throwOnError||s.experimental_prefetchInRender)&&(e.isReset()||(s.retryOnMount=!1))},Or=s=>{L.useEffect(()=>{s.clearReset()},[s])},Sr=({result:s,errorResetBoundary:e,throwOnError:t,query:r,suspense:i})=>s.isError&&!e.isReset()&&!s.isFetching&&r&&(i&&s.data===void 0||Ls(t,[s.error,r])),Rr=s=>{if(s.suspense){const e=r=>r==="static"?r:Math.max(r??1e3,1e3),t=s.staleTime;s.staleTime=typeof t=="function"?(...r)=>e(t(...r)):e(t),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},Tr=(s,e)=>s.isLoading&&s.isFetching&&!e,Er=(s,e)=>(s==null?void 0:s.suspense)&&e.isPending,ds=(s,e,t)=>e.fetchOptimistic(s).catch(()=>{t.clearReset()});function Ar(s,e,t){var v,x,O,I,k;const r=br(),i=wr(),n=Ws(),o=n.defaultQueryOptions(s);(x=(v=n.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||x.call(v,o),o._optimisticResults=r?"isRestoring":"optimistic",Rr(o),Cr(o,i),Or(i);const u=!n.getQueryCache().get(o.queryHash),[c]=L.useState(()=>new e(n,o)),l=c.getOptimisticResult(o),m=!r&&s.subscribed!==!1;if(L.useSyncExternalStore(L.useCallback(w=>{const M=m?c.subscribe(D.batchCalls(w)):B;return c.updateResult(),M},[c,m]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),L.useEffect(()=>{c.setOptions(o)},[o,c]),Er(o,l))throw ds(o,c,i);if(Sr({result:l,errorResetBoundary:i,throwOnError:o.throwOnError,query:n.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((I=(O=n.getDefaultOptions().queries)==null?void 0:O._experimental_afterQuery)==null||I.call(O,o,l),o.experimental_prefetchInRender&&!Qe&&Tr(l,r)){const w=u?ds(o,c,i):(k=n.getQueryCache().get(o.queryHash))==null?void 0:k.promise;w==null||w.catch(B).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function ui(s,e){return Ar(s,yr)}function ci(s,e){const t=Ws(),[r]=L.useState(()=>new _r(t,s));L.useEffect(()=>{r.setOptions(s)},[r,s]);const i=L.useSyncExternalStore(L.useCallback(o=>r.subscribe(D.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=L.useCallback((o,u)=>{r.mutate(o,u).catch(B)},[r]);if(i.error&&Ls(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}var E;(function(s){s.assertEqual=i=>{};function e(i){}s.assertIs=e;function t(i){throw new Error}s.assertNever=t,s.arrayToEnum=i=>{const n={};for(const o of i)n[o]=o;return n},s.getValidEnumValues=i=>{const n=s.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),o={};for(const u of n)o[u]=i[u];return s.objectValues(o)},s.objectValues=i=>s.objectKeys(i).map(function(n){return i[n]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const n=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&n.push(o);return n},s.find=(i,n)=>{for(const o of i)if(n(o))return o},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(i,n)=>typeof n=="bigint"?n.toString():n})(E||(E={}));var ls;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(ls||(ls={}));const p=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fe=s=>{switch(typeof s){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(s)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(s)?p.array:s===null?p.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?p.promise:typeof Map<"u"&&s instanceof Map?p.map:typeof Set<"u"&&s instanceof Set?p.set:typeof Date<"u"&&s instanceof Date?p.date:p.object;default:return p.unknown}},d=E.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class le extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},r={_errors:[]},i=n=>{for(const o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let u=r,c=0;for(;ct.message){const t={},r=[];for(const i of this.issues)if(i.path.length>0){const n=i.path[0];t[n]=t[n]||[],t[n].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}le.create=s=>new le(s);const zt=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===p.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,E.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${E.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${E.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${E.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:E.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,E.assertNever(s)}return{message:t}};let Ir=zt;function Pr(){return Ir}const jr=s=>{const{data:e,path:t,errorMaps:r,issueData:i}=s,n=[...t,...i.path||[]],o={...i,path:n};if(i.message!==void 0)return{...i,path:n,message:i.message};let u="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)u=l(o,{data:e,defaultError:u}).message;return{...i,path:n,message:u}};function f(s,e){const t=Pr(),r=jr({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===zt?void 0:zt].filter(i=>!!i)});s.common.issues.push(r)}class G{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const i of t){if(i.status==="aborted")return _;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const i of t){const n=await i.key,o=await i.value;r.push({key:n,value:o})}return G.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const i of t){const{key:n,value:o}=i;if(n.status==="aborted"||o.status==="aborted")return _;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[n.value]=o.value)}return{status:e.value,value:r}}}const _=Object.freeze({status:"aborted"}),ct=s=>({status:"dirty",value:s}),X=s=>({status:"valid",value:s}),hs=s=>s.status==="aborted",fs=s=>s.status==="dirty",st=s=>s.status==="valid",Ct=s=>typeof Promise<"u"&&s instanceof Promise;var y;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class Re{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const ps=(s,e)=>{if(st(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new le(s.common.issues);return this._error=t,this._error}}};function S(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:i}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,u)=>{const{message:c}=s;return o.code==="invalid_enum_value"?{message:c??u.defaultError}:typeof u.data>"u"?{message:c??r??u.defaultError}:o.code!=="invalid_type"?{message:u.defaultError}:{message:c??t??u.defaultError}},description:i}}class T{get description(){return this._def.description}_getType(e){return fe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new G,ctx:{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ct(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){const r={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)},i=this._parseSync({data:e,path:r.path,parent:r});return ps(r,i)}"~validate"(e){var r,i;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return st(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(i=(r=n==null?void 0:n.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>st(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)},i=this._parse({data:e,path:r.path,parent:r}),n=await(Ct(i)?i:Promise.resolve(i));return ps(r,n)}refine(e,t){const r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,n)=>{const o=e(i),u=()=>n.addIssue({code:d.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(u(),!1)):o?!0:(u(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new it({schema:this,typeName:b.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Se.create(this,this._def)}nullable(){return nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ae.create(this)}promise(){return Tt.create(this,this._def)}or(e){return St.create([this,e],this._def)}and(e){return Rt.create(this,e,this._def)}transform(e){return new it({...S(this._def),schema:this,typeName:b.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Kt({...S(this._def),innerType:this,defaultValue:t,typeName:b.ZodDefault})}brand(){return new si({typeName:b.ZodBranded,type:this,...S(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ht({...S(this._def),innerType:this,catchValue:t,typeName:b.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return es.create(this,e)}readonly(){return Wt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Nr=/^c[^\s-]{8,}$/i,Mr=/^[0-9a-z]+$/,Fr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Dr=/^[a-z0-9_-]{21}$/i,Qr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Lr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,$r=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ur="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let It;const qr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Vr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,zr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Br=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Js="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Wr=new RegExp(`^${Js}$`);function Ys(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Gr(s){return new RegExp(`^${Ys(s)}$`)}function Jr(s){let e=`${Js}T${Ys(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Yr(s,e){return!!((e==="v4"||!e)&&qr.test(s)||(e==="v6"||!e)&&zr.test(s))}function Xr(s,e){if(!Qr.test(s))return!1;try{const[t]=s.split(".");if(!t)return!1;const r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function ei(s,e){return!!((e==="v4"||!e)&&Vr.test(s)||(e==="v6"||!e)&&Br.test(s))}class Ce extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.string,received:n.parsedType}),_}const r=new G;let i;for(const n of this._def.checks)if(n.kind==="min")e.data.lengthn.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const o=e.data.length>n.value,u=e.data.lengthe.test(i),{validation:t,code:d.invalid_string,...y.errToObj(r)})}_addCheck(e){return new Ce({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ce({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Ce({checks:[],typeName:b.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...S(s)});function ti(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,n=Number.parseInt(s.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return n%o/10**i}class lt extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.number,received:n.parsedType}),_}let r;const i=new G;for(const n of this._def.checks)n.kind==="int"?E.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?ti(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_finite,message:n.message}),i.dirty()):E.assertNever(n);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,r,i){return new lt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:y.toString(i)}]})}_addCheck(e){return new lt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&E.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew lt({checks:[],typeName:b.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...S(s)});class ht extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let r;const i=new G;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.datan.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),f(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):E.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:p.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,r,i){return new ht({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:y.toString(i)}]})}_addCheck(e){return new ht({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew ht({checks:[],typeName:b.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...S(s)});class ms extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.boolean,received:r.parsedType}),_}return X(e.data)}}ms.create=s=>new ms({typeName:b.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...S(s)});class Ot extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:p.date,received:n.parsedType}),_}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_date}),_}const r=new G;let i;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()n.value&&(i=this._getOrReturnCtx(e,i),f(i,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):E.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ot({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Ot({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:b.ZodDate,...S(s)});class ys extends T{_parse(e){if(this._getType(e)!==p.symbol){const r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.symbol,received:r.parsedType}),_}return X(e.data)}}ys.create=s=>new ys({typeName:b.ZodSymbol,...S(s)});class vs extends T{_parse(e){if(this._getType(e)!==p.undefined){const r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.undefined,received:r.parsedType}),_}return X(e.data)}}vs.create=s=>new vs({typeName:b.ZodUndefined,...S(s)});class gs extends T{_parse(e){if(this._getType(e)!==p.null){const r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.null,received:r.parsedType}),_}return X(e.data)}}gs.create=s=>new gs({typeName:b.ZodNull,...S(s)});class _s extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return X(e.data)}}_s.create=s=>new _s({typeName:b.ZodAny,...S(s)});class bs extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return X(e.data)}}bs.create=s=>new bs({typeName:b.ZodUnknown,...S(s)});class Te extends T{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:p.never,received:t.parsedType}),_}}Te.create=s=>new Te({typeName:b.ZodNever,...S(s)});class xs extends T{_parse(e){if(this._getType(e)!==p.undefined){const r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.void,received:r.parsedType}),_}return X(e.data)}}xs.create=s=>new xs({typeName:b.ZodVoid,...S(s)});class ae extends T{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==p.array)return f(t,{code:d.invalid_type,expected:p.array,received:t.parsedType}),_;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,u=t.data.lengthi.maxLength.value&&(f(t,{code:d.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,u)=>i.type._parseAsync(new Re(t,o,t.path,u)))).then(o=>G.mergeArray(r,o));const n=[...t.data].map((o,u)=>i.type._parseSync(new Re(t,o,t.path,u)));return G.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new ae({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new ae({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new ae({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}ae.create=(s,e)=>new ae({type:s,minLength:null,maxLength:null,exactLength:null,typeName:b.ZodArray,...S(e)});function qe(s){if(s instanceof N){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=Se.create(qe(r))}return new N({...s._def,shape:()=>e})}else return s instanceof ae?new ae({...s._def,type:qe(s.element)}):s instanceof Se?Se.create(qe(s.unwrap())):s instanceof nt?nt.create(qe(s.unwrap())):s instanceof $e?$e.create(s.items.map(e=>qe(e))):s}class N extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=E.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const l=this._getOrReturnCtx(e);return f(l,{code:d.invalid_type,expected:p.object,received:l.parsedType}),_}const{status:r,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),u=[];if(!(this._def.catchall instanceof Te&&this._def.unknownKeys==="strip"))for(const l in i.data)o.includes(l)||u.push(l);const c=[];for(const l of o){const m=n[l],v=i.data[l];c.push({key:{status:"valid",value:l},value:m._parse(new Re(i,v,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Te){const l=this._def.unknownKeys;if(l==="passthrough")for(const m of u)c.push({key:{status:"valid",value:m},value:{status:"valid",value:i.data[m]}});else if(l==="strict")u.length>0&&(f(i,{code:d.unrecognized_keys,keys:u}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const m of u){const v=i.data[m];c.push({key:{status:"valid",value:m},value:l._parse(new Re(i,v,i.path,m)),alwaysSet:m in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const l=[];for(const m of c){const v=await m.key,x=await m.value;l.push({key:v,value:x,alwaysSet:m.alwaysSet})}return l}).then(l=>G.mergeObjectSync(r,l)):G.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new N({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,o;const i=((o=(n=this._def).errorMap)==null?void 0:o.call(n,t,r).message)??r.defaultError;return t.code==="unrecognized_keys"?{message:y.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new N({...this._def,unknownKeys:"strip"})}passthrough(){return new N({...this._def,unknownKeys:"passthrough"})}extend(e){return new N({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new N({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:b.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new N({...this._def,catchall:e})}pick(e){const t={};for(const r of E.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new N({...this._def,shape:()=>t})}omit(e){const t={};for(const r of E.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new N({...this._def,shape:()=>t})}deepPartial(){return qe(this)}partial(e){const t={};for(const r of E.objectKeys(this.shape)){const i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}return new N({...this._def,shape:()=>t})}required(e){const t={};for(const r of E.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof Se;)n=n._def.innerType;t[r]=n}return new N({...this._def,shape:()=>t})}keyof(){return Xs(E.objectKeys(this.shape))}}N.create=(s,e)=>new N({shape:()=>s,unknownKeys:"strip",catchall:Te.create(),typeName:b.ZodObject,...S(e)});N.strictCreate=(s,e)=>new N({shape:()=>s,unknownKeys:"strict",catchall:Te.create(),typeName:b.ZodObject,...S(e)});N.lazycreate=(s,e)=>new N({shape:s,unknownKeys:"strip",catchall:Te.create(),typeName:b.ZodObject,...S(e)});class St extends T{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function i(n){for(const u of n)if(u.result.status==="valid")return u.result;for(const u of n)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;const o=n.map(u=>new le(u.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:o}),_}if(t.common.async)return Promise.all(r.map(async n=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let n;const o=[];for(const c of r){const l={...t,common:{...t.common,issues:[]},parent:null},m=c._parseSync({data:t.data,path:t.path,parent:l});if(m.status==="valid")return m;m.status==="dirty"&&!n&&(n={result:m,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const u=o.map(c=>new le(c));return f(t,{code:d.invalid_union,unionErrors:u}),_}}get options(){return this._def.options}}St.create=(s,e)=>new St({options:s,typeName:b.ZodUnion,...S(e)});function Bt(s,e){const t=fe(s),r=fe(e);if(s===e)return{valid:!0,data:s};if(t===p.object&&r===p.object){const i=E.objectKeys(e),n=E.objectKeys(s).filter(u=>i.indexOf(u)!==-1),o={...s,...e};for(const u of n){const c=Bt(s[u],e[u]);if(!c.valid)return{valid:!1};o[u]=c.data}return{valid:!0,data:o}}else if(t===p.array&&r===p.array){if(s.length!==e.length)return{valid:!1};const i=[];for(let n=0;n{if(hs(n)||hs(o))return _;const u=Bt(n.value,o.value);return u.valid?((fs(n)||fs(o))&&t.dirty(),{status:t.value,value:u.data}):(f(r,{code:d.invalid_intersection_types}),_)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,o])=>i(n,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Rt.create=(s,e,t)=>new Rt({left:s,right:e,typeName:b.ZodIntersection,...S(t)});class $e extends T{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return f(r,{code:d.invalid_type,expected:p.array,received:r.parsedType}),_;if(r.data.lengththis._def.items.length&&(f(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((o,u)=>{const c=this._def.items[u]||this._def.rest;return c?c._parse(new Re(r,o,r.path,u)):null}).filter(o=>!!o);return r.common.async?Promise.all(n).then(o=>G.mergeArray(t,o)):G.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new $e({...this._def,rest:e})}}$e.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $e({items:s,typeName:b.ZodTuple,rest:null,...S(e)})};class ks extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return f(r,{code:d.invalid_type,expected:p.map,received:r.parsedType}),_;const i=this._def.keyType,n=this._def.valueType,o=[...r.data.entries()].map(([u,c],l)=>({key:i._parse(new Re(r,u,r.path,[l,"key"])),value:n._parse(new Re(r,c,r.path,[l,"value"]))}));if(r.common.async){const u=new Map;return Promise.resolve().then(async()=>{for(const c of o){const l=await c.key,m=await c.value;if(l.status==="aborted"||m.status==="aborted")return _;(l.status==="dirty"||m.status==="dirty")&&t.dirty(),u.set(l.value,m.value)}return{status:t.value,value:u}})}else{const u=new Map;for(const c of o){const l=c.key,m=c.value;if(l.status==="aborted"||m.status==="aborted")return _;(l.status==="dirty"||m.status==="dirty")&&t.dirty(),u.set(l.value,m.value)}return{status:t.value,value:u}}}}ks.create=(s,e,t)=>new ks({valueType:e,keyType:s,typeName:b.ZodMap,...S(t)});class ft extends T{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return f(r,{code:d.invalid_type,expected:p.set,received:r.parsedType}),_;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(f(r,{code:d.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const n=this._def.valueType;function o(c){const l=new Set;for(const m of c){if(m.status==="aborted")return _;m.status==="dirty"&&t.dirty(),l.add(m.value)}return{status:t.value,value:l}}const u=[...r.data.values()].map((c,l)=>n._parse(new Re(r,c,r.path,l)));return r.common.async?Promise.all(u).then(c=>o(c)):o(u)}min(e,t){return new ft({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new ft({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ft.create=(s,e)=>new ft({valueType:s,minSize:null,maxSize:null,typeName:b.ZodSet,...S(e)});class ws extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ws.create=(s,e)=>new ws({getter:s,typeName:b.ZodLazy,...S(e)});class Cs extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}Cs.create=(s,e)=>new Cs({value:s,typeName:b.ZodLiteral,...S(e)});function Xs(s,e){return new rt({values:s,typeName:b.ZodEnum,...S(e)})}class rt extends T{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return f(t,{expected:E.joinValues(r),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:r}),_}return X(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return rt.create(e,{...this._def,...t})}exclude(e,t=this._def){return rt.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}rt.create=Xs;class Os extends T{_parse(e){const t=E.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){const i=E.objectValues(t);return f(r,{expected:E.joinValues(i),received:r.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(E.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=E.objectValues(t);return f(r,{received:r.data,code:d.invalid_enum_value,options:i}),_}return X(e.data)}get enum(){return this._def.values}}Os.create=(s,e)=>new Os({values:s,typeName:b.ZodNativeEnum,...S(e)});class Tt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:p.promise,received:t.parsedType}),_;const r=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return X(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Tt.create=(s,e)=>new Tt({type:s,typeName:b.ZodPromise,...S(e)});class it extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===b.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:o=>{f(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){const o=i.transform(r.data,n);if(r.common.async)return Promise.resolve(o).then(async u=>{if(t.value==="aborted")return _;const c=await this._def.schema._parseAsync({data:u,path:r.path,parent:r});return c.status==="aborted"?_:c.status==="dirty"||t.value==="dirty"?ct(c.value):c});{if(t.value==="aborted")return _;const u=this._def.schema._parseSync({data:o,path:r.path,parent:r});return u.status==="aborted"?_:u.status==="dirty"||t.value==="dirty"?ct(u.value):u}}if(i.type==="refinement"){const o=u=>{const c=i.refinement(u,n);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(r.common.async===!1){const u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return u.status==="aborted"?_:(u.status==="dirty"&&t.dirty(),o(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>u.status==="aborted"?_:(u.status==="dirty"&&t.dirty(),o(u.value).then(()=>({status:t.value,value:u.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!st(o))return _;const u=i.transform(o.value,n);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>st(o)?Promise.resolve(i.transform(o.value,n)).then(u=>({status:t.value,value:u})):_);E.assertNever(i)}}it.create=(s,e,t)=>new it({schema:s,typeName:b.ZodEffects,effect:e,...S(t)});it.createWithPreprocess=(s,e,t)=>new it({schema:e,effect:{type:"preprocess",transform:s},typeName:b.ZodEffects,...S(t)});class Se extends T{_parse(e){return this._getType(e)===p.undefined?X(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(s,e)=>new Se({innerType:s,typeName:b.ZodOptional,...S(e)});class nt extends T{_parse(e){return this._getType(e)===p.null?X(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nt.create=(s,e)=>new nt({innerType:s,typeName:b.ZodNullable,...S(e)});class Kt extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Kt.create=(s,e)=>new Kt({innerType:s,typeName:b.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...S(e)});class Ht extends T{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ct(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new le(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new le(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ht.create=(s,e)=>new Ht({innerType:s,typeName:b.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...S(e)});class Ss extends T{_parse(e){if(this._getType(e)!==p.nan){const r=this._getOrReturnCtx(e);return f(r,{code:d.invalid_type,expected:p.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}}Ss.create=s=>new Ss({typeName:b.ZodNaN,...S(s)});class si extends T{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class es extends T{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?_:n.status==="dirty"?(t.dirty(),ct(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new es({in:e,out:t,typeName:b.ZodPipeline})}}class Wt extends T{_parse(e){const t=this._def.innerType._parse(e),r=i=>(st(i)&&(i.value=Object.freeze(i.value)),i);return Ct(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}}Wt.create=(s,e)=>new Wt({innerType:s,typeName:b.ZodReadonly,...S(e)});N.lazycreate;var b;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(b||(b={}));const di=Ce.create;Te.create;ae.create;const li=N.create;N.strictCreate;St.create;Rt.create;$e.create;rt.create;Tt.create;Se.create;nt.create;export{ai as Q,le as Z,oi as a,Ws as b,ci as c,li as o,di as s,ui as u};