diff --git a/console/embedded/native_ecma.cpp b/console/embedded/native_ecma.cpp index 70002ebe..0b56e504 100644 --- a/console/embedded/native_ecma.cpp +++ b/console/embedded/native_ecma.cpp @@ -22,68 +22,68 @@ namespace libbitcoin { namespace server { DEFINE_EMBEDDED_PAGE(native_pages, char, ecma, - R"DELIM(function qS(e,a){for(var i=0;il[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function i(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(s){if(s.ep)return;s.ep=!0;const u=i(s);fetch(s.href,u)}})();function mh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pd={exports:{}},ro={};var Zg;function PS(){if(Zg)return ro;Zg=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(l,s,u){var c=null;if(u!==void 0&&(c=""+u),s.key!==void 0&&(c=""+s.key),"key"in s){u={};for(var d in s)d!=="key"&&(u[d]=s[d])}else u=s;return s=u.ref,{$$typeof:e,type:l,key:c,ref:s!==void 0?s:null,props:u}}return ro.Fragment=a,ro.jsx=i,ro.jsxs=i,ro}var qg;function QS(){return qg||(qg=1,pd.exports=PS()),pd.exports}var v=QS(),yd={exports:{}},Oe={};var Pg;function FS(){if(Pg)return Oe;Pg=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function _(z){return z===null||typeof z!="object"?null:(z=x&&z[x]||z["@@iterator"],typeof z=="function"?z:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,k={};function Y(z,C,$){this.props=z,this.context=C,this.refs=k,this.updater=$||R}Y.prototype.isReactComponent={},Y.prototype.setState=function(z,C){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,C,"setState")},Y.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function X(){}X.prototype=Y.prototype;function ne(z,C,$){this.props=z,this.context=C,this.refs=k,this.updater=$||R}var se=ne.prototype=new X;se.constructor=ne,T(se,Y.prototype),se.isPureReactComponent=!0;var te=Array.isArray;function xe(){}var O={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function L(z,C,$){var G=$.ref;return{$$typeof:e,type:z,key:C,ref:G!==void 0?G:null,props:$}}function H(z,C){return L(z.type,C,z.props)}function Q(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function K(z){var C={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function($){return C[$]})}var he=/\/+/g;function me(z,C){return typeof z=="object"&&z!==null&&z.key!=null?K(""+z.key):C.toString(36)}function W(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(xe,xe):(z.status="pending",z.then(function(C){z.status==="pending"&&(z.status="fulfilled",z.value=C)},function(C){z.status==="pending"&&(z.status="rejected",z.reason=C)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function N(z,C,$,G,ie){var fe=typeof z;(fe==="undefined"||fe==="boolean")&&(z=null);var I=!1;if(z===null)I=!0;else switch(fe){case"bigint":case"string":case"number":I=!0;break;case"object":switch(z.$$typeof){case e:case a:I=!0;break;case b:return I=z._init,N(I(z._payload),C,$,G,ie)}}if(I)return ie=ie(z),I=G===""?"."+me(z,0):G,te(ie)?($="",I!=null&&($=I.replace(he,"$&/")+"/"),N(ie,C,$,"",function(tt){return tt})):ie!=null&&(Q(ie)&&(ie=H(ie,$+(ie.key==null||z&&z.key===ie.key?"":(""+ie.key).replace(he,"$&/")+"/")+I)),C.push(ie)),1;I=0;var ge=G===""?".":G+":";if(te(z))for(var be=0;be>>1,ce=N[de];if(0>>1;des($,ue))Gs(ie,$)?(N[de]=ie,N[G]=ue,de=G):(N[de]=$,N[C]=ue,de=C);else if(Gs(ie,ue))N[de]=ie)DELIM" - R"DELIM(,N[G]=ue,de=G;else break e}}return B}function s(N,B){var ue=N.sortIndex-B.sortIndex;return ue!==0?ue:N.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],p=[],b=1,g=null,x=3,_=!1,R=!1,T=!1,k=!1,Y=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function se(N){for(var B=i(p);B!==null;){if(B.callback===null)l(p);else if(B.startTime<=N)l(p),B.sortIndex=B.expirationTime,a(m,B);else break;B=i(p)}}function te(N){if(T=!1,se(N),!R)if(i(m)!==null)R=!0,xe||(xe=!0,K());else{var B=i(p);B!==null&&W(te,B.startTime-N)}}var xe=!1,O=-1,w=5,L=-1;function H(){return k?!0:!(e.unstable_now()-LN&&H());){var de=g.callback;if(typeof de=="function"){g.callback=null,x=g.priorityLevel;var ce=de(g.expirationTime<=N);if(N=e.unstable_now(),typeof ce=="function"){g.callback=ce,se(N),B=!0;break t}g===i(m)&&l(m),se(N)}else l(m);g=i(m)}if(g!==null)B=!0;else{var z=i(p);z!==null&&W(te,z.startTime-N),B=!1}}break e}finally{g=null,x=ue,_=!1}B=void 0}}finally{B?K():xe=!1}}}var K;if(typeof ne=="function")K=function(){ne(Q)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,me=he.port2;he.port1.onmessage=Q,K=function(){me.postMessage(null)}}else K=function(){Y(Q,0)};function W(N,B){O=Y(function(){N(e.unstable_now())},B)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(N){N.callback=null},e.unstable_forceFrameRate=function(N){0>N||125de?(N.sortIndex=ue,a(p,N),i(m)===null&&N===i(p)&&(T?(X(O),O=-1):T=!0,W(te,ue-de))):(N.sortIndex=ce,a(m,N),R||_||(R=!0,xe||(xe=!0,K()))),N},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(N){var B=x;return function(){var ue=x;x=B;try{return N.apply(this,arguments)}finally{x=ue}}}})(bd)),bd}var Yg;function KS(){return Yg||(Yg=1,vd.exports=GS()),vd.exports}var xd={exports:{}},Vt={};var Gg;function VS(){if(Gg)return Vt;Gg=1;var e=ph();function a(m){var p="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),xd.exports=VS(),xd.exports}var Vg;function XS(){if(Vg)return io;Vg=1;var e=KS(),a=ph(),i=O0();function l(t){var n="https://react.dev/errors/"+t;if(1ce||(t.current=de[ce],de[ce]=null,ce--)}function $(t,n){ce++,de[ce]=t.current,t.current=n}var G=z(null),ie=z(null),fe=z(null),I=z(null);function ge(t,n){switch($(fe,n),$(ie,t),$(G,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?cg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=cg(n),t=fg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}C(G),$(G,t)}function be(){C(G),C(ie),C(fe)}function tt(t){t.memoizedState!==null&&$(I,t);var n=G.current,r=fg(n,t.type);n!==r&&($(ie,t),$(G,r))}function dt(t){ie.current===t&&(C(G),C(ie)),I.current===t&&(C(I),eo._currentValue=ue)}var xt,ut;function je(t){if(xt===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);xt=n&&n[1]||"",ut=-1l[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function i(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(s){if(s.ep)return;s.ep=!0;const u=i(s);fetch(s.href,u)}})();function hh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var md={exports:{}},ro={};var Zg;function QS(){if(Zg)return ro;Zg=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(l,s,u){var c=null;if(u!==void 0&&(c=""+u),s.key!==void 0&&(c=""+s.key),"key"in s){u={};for(var d in s)d!=="key"&&(u[d]=s[d])}else u=s;return s=u.ref,{$$typeof:e,type:l,key:c,ref:s!==void 0?s:null,props:u}}return ro.Fragment=a,ro.jsx=i,ro.jsxs=i,ro}var qg;function FS(){return qg||(qg=1,md.exports=QS()),md.exports}var v=FS(),pd={exports:{}},Oe={};var Pg;function YS(){if(Pg)return Oe;Pg=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function _(R){return R===null||typeof R!="object"?null:(R=x&&R[x]||R["@@iterator"],typeof R=="function"?R:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,k={};function Z(R,C,$){this.props=R,this.context=C,this.refs=k,this.updater=$||z}Z.prototype.isReactComponent={},Z.prototype.setState=function(R,C){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,C,"setState")},Z.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function X(){}X.prototype=Z.prototype;function ne(R,C,$){this.props=R,this.context=C,this.refs=k,this.updater=$||z}var se=ne.prototype=new X;se.constructor=ne,T(se,Z.prototype),se.isPureReactComponent=!0;var te=Array.isArray;function xe(){}var O={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function L(R,C,$){var G=$.ref;return{$$typeof:e,type:R,key:C,ref:G!==void 0?G:null,props:$}}function H(R,C){return L(R.type,C,R.props)}function F(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function K(R){var C={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function($){return C[$]})}var he=/\/+/g;function me(R,C){return typeof R=="object"&&R!==null&&R.key!=null?K(""+R.key):C.toString(36)}function W(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(xe,xe):(R.status="pending",R.then(function(C){R.status==="pending"&&(R.status="fulfilled",R.value=C)},function(C){R.status==="pending"&&(R.status="rejected",R.reason=C)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function N(R,C,$,G,ie){var fe=typeof R;(fe==="undefined"||fe==="boolean")&&(R=null);var I=!1;if(R===null)I=!0;else switch(fe){case"bigint":case"string":case"number":I=!0;break;case"object":switch(R.$$typeof){case e:case a:I=!0;break;case b:return I=R._init,N(I(R._payload),C,$,G,ie)}}if(I)return ie=ie(R),I=G===""?"."+me(R,0):G,te(ie)?($="",I!=null&&($=I.replace(he,"$&/")+"/"),N(ie,C,$,"",function(tt){return tt})):ie!=null&&(F(ie)&&(ie=H(ie,$+(ie.key==null||R&&R.key===ie.key?"":(""+ie.key).replace(he,"$&/")+"/")+I)),C.push(ie)),1;I=0;var ge=G===""?".":G+":";if(te(R))for(var be=0;be>>1,ce=N[de];if(0>>1;des($,ue))Gs(ie,$)?(N[de]=ie,N[G]=ue,de=G):(N[de]=$,N[C]=ue,de=C);else if(Gs(ie,ue))N[de]=ie)DELIM" + R"DELIM(,N[G]=ue,de=G;else break e}}return B}function s(N,B){var ue=N.sortIndex-B.sortIndex;return ue!==0?ue:N.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],p=[],b=1,g=null,x=3,_=!1,z=!1,T=!1,k=!1,Z=typeof setTimeout=="function"?setTimeout:null,X=typeof clearTimeout=="function"?clearTimeout:null,ne=typeof setImmediate<"u"?setImmediate:null;function se(N){for(var B=i(p);B!==null;){if(B.callback===null)l(p);else if(B.startTime<=N)l(p),B.sortIndex=B.expirationTime,a(m,B);else break;B=i(p)}}function te(N){if(T=!1,se(N),!z)if(i(m)!==null)z=!0,xe||(xe=!0,K());else{var B=i(p);B!==null&&W(te,B.startTime-N)}}var xe=!1,O=-1,w=5,L=-1;function H(){return k?!0:!(e.unstable_now()-LN&&H());){var de=g.callback;if(typeof de=="function"){g.callback=null,x=g.priorityLevel;var ce=de(g.expirationTime<=N);if(N=e.unstable_now(),typeof ce=="function"){g.callback=ce,se(N),B=!0;break t}g===i(m)&&l(m),se(N)}else l(m);g=i(m)}if(g!==null)B=!0;else{var R=i(p);R!==null&&W(te,R.startTime-N),B=!1}}break e}finally{g=null,x=ue,_=!1}B=void 0}}finally{B?K():xe=!1}}}var K;if(typeof ne=="function")K=function(){ne(F)};else if(typeof MessageChannel<"u"){var he=new MessageChannel,me=he.port2;he.port1.onmessage=F,K=function(){me.postMessage(null)}}else K=function(){Z(F,0)};function W(N,B){O=Z(function(){N(e.unstable_now())},B)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(N){N.callback=null},e.unstable_forceFrameRate=function(N){0>N||125de?(N.sortIndex=ue,a(p,N),i(m)===null&&N===i(p)&&(T?(X(O),O=-1):T=!0,W(te,ue-de))):(N.sortIndex=ce,a(m,N),z||_||(z=!0,xe||(xe=!0,K()))),N},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(N){var B=x;return function(){var ue=x;x=B;try{return N.apply(this,arguments)}finally{x=ue}}}})(vd)),vd}var Yg;function VS(){return Yg||(Yg=1,gd.exports=KS()),gd.exports}var bd={exports:{}},Kt={};var Gg;function XS(){if(Gg)return Kt;Gg=1;var e=mh();function a(m){var p="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),bd.exports=XS(),bd.exports}var Vg;function IS(){if(Vg)return io;Vg=1;var e=VS(),a=mh(),i=M0();function l(t){var n="https://react.dev/errors/"+t;if(1ce||(t.current=de[ce],de[ce]=null,ce--)}function $(t,n){ce++,de[ce]=t.current,t.current=n}var G=R(null),ie=R(null),fe=R(null),I=R(null);function ge(t,n){switch($(fe,n),$(ie,t),$(G,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?cg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=cg(n),t=fg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}C(G),$(G,t)}function be(){C(G),C(ie),C(fe)}function tt(t){t.memoizedState!==null&&$(I,t);var n=G.current,r=fg(n,t.type);n!==r&&($(ie,t),$(G,r))}function dt(t){ie.current===t&&(C(G),C(ie)),I.current===t&&(C(I),eo._currentValue=ue)}var xt,ut;function je(t){if(xt===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);xt=n&&n[1]||"",ut=-1)":-1f||A[o]!==q[f]){var J=` +`+xt+t+ut}var Je=!1;function Ue(t,n){if(!t||Je)return"";Je=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(n){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(V){var Y=V}Reflect.construct(t,[],ae)}else{try{ae.call()}catch(V){Y=V}t.call(ae.prototype)}}else{try{throw Error()}catch(V){Y=V}(ae=t())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(V){if(V&&Y&&typeof V.stack=="string")return[V.stack,Y.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=o.DetermineComponentFrameRoot(),y=h[0],S=h[1];if(y&&S){var A=y.split(` +`),P=S.split(` +`);for(f=o=0;of||A[o]!==P[f]){var J=` `+A[o].replace(" at new "," at ");return t.displayName&&J.includes("")&&(J=J.replace("",t.displayName)),J}while(1<=o&&0<=f);break}}}finally{Je=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?je(r):""}function Qe(t,n){switch(t.tag){case 26:case 27:case 5:return je(t.type);case 16:return je("Lazy");case 13:return t.child!==n&&n!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return Ue(t.type,!1);case 11:return Ue(t.type.render,!1);case 1:return Ue(t.type,!0);case 31:return je("Activity");default:return""}}function An(t){try{var n="",r=null;do n+=Qe(t,r),r=t,t=t.return;while(t);return n}catch(o){return` Error generating stack: `+o.message+` -`+o.stack}}var ya=Object.prototype.hasOwnProperty,Ut=e.unstable_scheduleCallback,ga=e.unstable_cancelCallback,Mr=e.unstable_shouldYield,hl=e.unstable_requestPaint,Jt=e.unstable_now,va=e.unstable_getCurrentPriorityLevel,Fa=e.unstable_ImmediatePriority,ml=e.unstable_UserBlockingPriority,Ya=e.unstable_NormalPriority,Yn=e.unstable_LowPriority,Cn=e.unstable_IdlePriority,ic=e.log,lc=e.unstable_setDisableYieldValue,ba=null,Wt=null;function Ht(t){if(typeof ic=="function"&&lc(t),Wt&&typeof Wt.setStrictMode=="function")try{Wt.setStrictMode(ba,t)}catch{}}var Kt=Math.clz32?Math.clz32:oc,Go=Math.log,Ko=Math.LN2;function oc(t){return t>>>=0,t===0?32:31-(Go(t)/Ko|0)|0}var kr=256,xa=262144,Dr=4194304;function Gn(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function ci(t,n,r){var o=t.pendingLanes;if(o===0)return 0;var f=0,h=t.suspendedLanes,y=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~h,o!==0?f=Gn(o):(y&=S,y!==0?f=Gn(y):r||(r=S&~t,r!==0&&(f=Gn(r))))):(S=o&~h,S!==0?f=Gn(S):y!==0?f=Gn(y):r||(r=o&~t,r!==0&&(f=Gn(r)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,r=n&-n,h>=r||h===32&&(r&4194048)!==0)?n:f}function Ga(t,n){return(t)DELIM" -R"DELIM(.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function sc(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pl(){var t=Dr;return Dr<<=1,(Dr&62914560)===0&&(Dr=4194304),t}function Ka(t){for(var n=[],r=0;31>r;r++)n.push(t);return n}function aa(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Vo(t,n,r,o,f,h){var y=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var S=t.entanglements,A=t.expirationTimes,q=t.hiddenUpdates;for(r=y&~r;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var _a=/[\n"\\]/g;function tn(t){return t.replace(_a,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function yl(t,n,r,o,f,h,y,S){t.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?t.type=y:t.removeAttribute("type"),n!=null?y==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+ct(n)):t.value!==""+ct(n)&&(t.value=""+ct(n)):y!=="submit"&&y!=="reset"||t.removeAttribute("value"),n!=null?uc(t,y,ct(n)):r!=null?uc(t,y,ct(r)):o!=null&&t.removeAttribute("value"),f==null&&h!=null&&(t.defaultChecked=!!h),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+ct(S):t.removeAttribute("name")}function rm(t,n,r,o,f,h,y,S){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(t.type=h),n!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){hi(t);return}r=r!=null?""+ct(r):"",n=n!=null?""+ct(n):r,S||n===t.value||(t.value=n),t.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.name=y),hi(t)}function uc(t,n,r){n==="number"&&nt(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function pi(t,n,r,o){if(t=t.options,n){n={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mc=!1;if(Ta)try{var vl={};Object.defineProperty(vl,"passive",{get:function(){mc=!0}}),window.addEventListener("test",vl,vl),window.removeEventListener("test",vl,vl)}catch{mc=!1}var Xa=null,pc=null,Wo=null;function fm(){if(Wo)return Wo;var t,n=pc,r=n.length,o,f="value"in Xa?Xa.value:Xa.textContent,h=f.length;for(t=0;t=Sl),gm=" ",vm=!1;function bm(t,n){switch(t){case"keyup":return c1.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var bi=!1;function d1(t,n){switch(t){case"compositionend":return xm(n);case"keypress":return n.which!==32?null:(vm=!0,gm);case"textInput":return t=n.data,t===gm&&vm?null:t;default:return null}}function h1(t,n){if(bi)return t==="compositionend"||!xc&&bm(t,n)?(t=fm(),Wo=pc=Xa=null,bi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:r,offset:n-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Am(r)}}function jm(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?jm(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Nm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=nt(t.document);n instanceof t.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)t=n.contentWindow;else break;n=nt(t.document)}return n}function _c(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var S1=Ta&&"documentMode"in document&&11>=document.documentMode,xi=null,Ec=null,Tl=null,Tc=!1;function Om(t,n,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Tc||xi==null||xi!==nt(o)||(o=xi,"selectionStart"in o&&_c(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Tl&&El(Tl,o)||(Tl=o,o=Ys(Ec,"onSelect"),0>=y,f-=y,ra=1<<32-Kt(n)+f|r<Le?(qe=_e,_e=null):qe=_e.sibling;var Xe=F(U,_e,Z[Le],ee);if(Xe===null){_e===null&&(_e=qe);break}t&&_e&&Xe.alternate===null&&n(U,_e),M=h(Xe,M,Le),Ve===null?Ee=Xe:Ve.sibling=Xe,Ve=Xe,_e=qe}if(Le===Z.length)return r(U,_e),Pe&&za(U,Le),Ee;if(_e===null){for(;LeLe?(qe=_e,_e=null):qe=_e.sibling;var vr=F(U,_e,Xe.value,ee);if(vr===null){_e===null&&(_e=qe);break}t&&_e&&vr.alternate===null&&n(U,_e),M)DELIM" -R"DELIM(=h(vr,M,Le),Ve===null?Ee=vr:Ve.sibling=vr,Ve=vr,_e=qe}if(Xe.done)return r(U,_e),Pe&&za(U,Le),Ee;if(_e===null){for(;!Xe.done;Le++,Xe=Z.next())Xe=ae(U,Xe.value,ee),Xe!==null&&(M=h(Xe,M,Le),Ve===null?Ee=Xe:Ve.sibling=Xe,Ve=Xe);return Pe&&za(U,Le),Ee}for(_e=o(_e);!Xe.done;Le++,Xe=Z.next())Xe=V(_e,U,Le,Xe.value,ee),Xe!==null&&(t&&Xe.alternate!==null&&_e.delete(Xe.key===null?Le:Xe.key),M=h(Xe,M,Le),Ve===null?Ee=Xe:Ve.sibling=Xe,Ve=Xe);return t&&_e.forEach(function(ZS){return n(U,ZS)}),Pe&&za(U,Le),Ee}function ot(U,M,Z,ee){if(typeof Z=="object"&&Z!==null&&Z.type===T&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case _:e:{for(var Ee=Z.key;M!==null;){if(M.key===Ee){if(Ee=Z.type,Ee===T){if(M.tag===7){r(U,M.sibling),ee=f(M,Z.props.children),ee.return=U,U=ee;break e}}else if(M.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===w&&Fr(Ee)===M.type){r(U,M.sibling),ee=f(M,Z.props),Nl(ee,Z),ee.return=U,U=ee;break e}r(U,M);break}else n(U,M);M=M.sibling}Z.type===T?(ee=$r(Z.props.children,U.mode,ee,Z.key),ee.return=U,U=ee):(ee=us(Z.type,Z.key,Z.props,null,U.mode,ee),Nl(ee,Z),ee.return=U,U=ee)}return y(U);case R:e:{for(Ee=Z.key;M!==null;){if(M.key===Ee)if(M.tag===4&&M.stateNode.containerInfo===Z.containerInfo&&M.stateNode.implementation===Z.implementation){r(U,M.sibling),ee=f(M,Z.children||[]),ee.return=U,U=ee;break e}else{r(U,M);break}else n(U,M);M=M.sibling}ee=Oc(Z,U.mode,ee),ee.return=U,U=ee}return y(U);case w:return Z=Fr(Z),ot(U,M,Z,ee)}if(W(Z))return we(U,M,Z,ee);if(K(Z)){if(Ee=K(Z),typeof Ee!="function")throw Error(l(150));return Z=Ee.call(Z),Ae(U,M,Z,ee)}if(typeof Z.then=="function")return ot(U,M,ys(Z),ee);if(Z.$$typeof===ne)return ot(U,M,ds(U,Z),ee);gs(U,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,M!==null&&M.tag===6?(r(U,M.sibling),ee=f(M,Z),ee.return=U,U=ee):(r(U,M),ee=Nc(Z,U.mode,ee),ee.return=U,U=ee),y(U)):r(U,M)}return function(U,M,Z,ee){try{jl=0;var Ee=ot(U,M,Z,ee);return Ni=null,Ee}catch(_e){if(_e===ji||_e===ms)throw _e;var Ve=vn(29,_e,null,U.mode);return Ve.lanes=ee,Ve.return=U,Ve}}}var Gr=tp(!0),np=tp(!1),tr=!1;function Qc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function nr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ar(t,n,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(We&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=ss(t),Hm(t,null,r),n}return os(t,o,n,r),ss(t)}function Ol(t,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,Io(t,r)}}function Yc(t,n){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var f=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var y={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?f=h=y:h=h.next=y,r=r.next}while(r!==null);h===null?f=h=n:h=h.next=n}else f=h=n;r={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=n:t.next=n,r.lastBaseUpdate=n}var Gc=!1;function Ml(){if(Gc){var t=Ci;if(t!==null)throw t}}function kl(t,n,r,o){Gc=!1;var f=t.updateQueue;tr=!1;var h=f.firstBaseUpdate,y=f.lastBaseUpdate,S=f.shared.pending;if(S!==null){f.shared.pending=null;var A=S,q=A.next;A.next=null,y===null?h=q:y.next=q,y=A;var J=t.alternate;J!==null&&(J=J.updateQueue,S=J.lastBaseUpdate,S!==y&&(S===null?J.firstBaseUpdate=q:S.next=q,J.lastBaseUpdate=A))}if(h!==null){var ae=f.baseState;y=0,J=q=A=null,S=h;do{var F=S.lane&-536870913,V=F!==S.lane;if(V?(Ze&F)===F:(o&F)===F){F!==0&&F===Ai&&(Gc=!0),J!==null&&(J=J.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var we=t,Ae=S;F=n;var ot=r;switch(Ae.tag){case 1:if(we=Ae.payload,typeof we=="function"){ae=we.call(ot,ae,F);break e}ae=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ae.payload,F=typeof we=="function"?we.call(ot,ae,F):we,F==null)break e;ae=g({},ae,F);break e;case 2:tr=!0}}F=S.callback,F!==null&&(t.flags|=64,V&&(t.flags|=8192),V=f.callbacks,V===null?f.callbacks=[F]:V.push(F))}else V={lane:F,tag:S.tag,payload:S.payload,callback:S.callback,next:null},J===null?(q=J=V,A=ae):J=J.next=V,y|=F;if(S=S.next,S===null){if(S=f.shared.pending,S===null)break;V=S,S=V.next,V.next=null,f.lastBaseUpdate=V,f.shared.pending=null}}while(!0);J===null&&(A=ae),f.baseState=A,f.firstBaseUpdate=q,f.lastBaseUpdate=J,h===null&&(f.shared.lanes=0),sr|=y,t.lanes=y,t.memoizedState=ae}}function ap(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function rp(t,n){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;th?h:8;var y=N.T,S={};N.T=S,hf(t,!1,n,r);try{var A=f(),q=N.S;if(q!==null&&q(S,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var J=j1(A,o);Bl(t,n,J,_n(t))}else Bl(t,n,o,_n(t))}catch(ae){Bl(t,n,{then:function(){},status:"rejected",reason:ae},_n())}finally{B.p=h,y!==null&&S.types!==null&&(y.types=S.types),N.T=y}}function L1(){}function ff(t,n,r,o){if(t.tag!==5)throw Error(l(476));var f=Lp(t).queue;Dp(t,f,n,ue,r===null?L1:function(){return Bp(t),r(o)})}function Lp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:ue},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:r},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Bp(t){var n=Lp(t);n.next===null&&(n=t.alternate.memoizedState),Bl(t,n.next.queue,{},_n())}function df(){return qt(eo)}function Up(){return Rt().memoizedState}function Hp(){return Rt().memoizedState}function B1(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var r=_n();t=nr(r);var o=ar(n,t,r);o!==null&&(hn(o,n,r),Ol(o,n,r)),n={cache:$c()},t.payload=n;return}n=n.return}}function U1(t,n,r){var o=_n();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},zs(t)?Zp(n,r):(r=Cc(t,n,r,o),r!==null&&(hn(r,t,o),qp(r,n,o)))}function $p(t,n,r){var o=_n();Bl(t,n,r,o)}function Bl(t,n,r,o){var f={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(zs(t))Zp(n,f);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,S=h(y,r);if(f.hasEagerState=!0,f.eagerState=S,gn(S,y))return os(t,n,f,0),ft===null&&ls(),!1}catch{}if(r=Cc(t,n,f,o),r!==null)return hn(r,t,o),qp(r,n,o),!0}return!1}function hf(t,n,r,o){if(o={lane:2,revertLane:Ff(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},zs(t)){if(n)throw Error(l(479))}else n=Cc(t,r,o,2),n!==null&&hn(n,t,2)}function zs(t){var n=t.alternate;return t===De||n!==null&&n===De}function Zp(t,n){Mi=xs=!0;var r=t.pending;r===null?n.next=n:(n.next=r.next,r.next=n),t.pending=n}function qp(t,n,r){if((r&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,Io(t,r)}}var Ul={readContext:qt,use:_s,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St};Ul.useEffectEvent=St;var Pp={readContext:qt,use:_s,useCallback:function(t,n){return nn().memoizedState=[t,n===void 0?null:n],t},useContext:qt,useEffect:Rp,useImperativeHandle:function(t,n,r){r=r!=null?r.concat([t]):null,Ts(4194308,4,jp.bind(null,n,t),r)},useLayoutEffect:function(t,n){return Ts(4194308,4,t,n)},useInsertionEffect:function(t,n){Ts(4,2,t,n)},useMemo:function(t,n){var r=nn();n=n===void 0?null:n;var o=t();if(Kr){Ht(!0);try{t()}finally{Ht(!1)}}return r.memoizedState=[o,n],o},useReducer:function(t,n,r){var o=nn();if(r!==void 0){var f=r(n);if(Kr){Ht(!0);try{r(n)}finally{Ht(!1)}}}else f=n;return o.memoizedState=o.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},o.queue=t,t=t.dispatch=U1.bind(null,De,t),[o.memoizedState,t]},useRef:function(t){var n=nn();return t={current:t},n.memoizedState=t},useState:function(t){t=lf(t);var n=t.queue,r=$p.bind(null,De,n);return n.dispatch=r,[t.memoizedState,r]},useDebugValue:uf,useDeferredValue:function(t,n){var r=nn();return cf(r,t,n)},useTransition:function(){var t=lf(!1);return t=Dp.bind(null,De,t.queue,!0,!1),nn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,r){var o=De,f=nn();if(Pe){if(r===void 0)throw Error(l(407));r=r()}else{if(r=n(),ft===null)throw Error(l(349));(Ze&127)!==0||cp(o,n,r)}f.memoizedState=r;var h={value:r,getSnapshot:n};return f.queue=h,)DELIM" -R"DELIM(Rp(dp.bind(null,o,h,t),[t]),o.flags|=2048,Di(9,{destroy:void 0},fp.bind(null,o,h,r,n),null),r},useId:function(){var t=nn(),n=ft.identifierPrefix;if(Pe){var r=ia,o=ra;r=(o&~(1<<32-Kt(o)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Ss++,0<\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?y.createElement(f,{is:o.is}):y.createElement(f)}}h[pe]=n,h[ve]=o;e:for(y=n.child;y!==null;){if(y.tag===5||y.tag===6)h.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===n)break e;for(;y.sibling===null;){if(y.return===null||y.return===n)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}n.stateNode=h;e:switch(Qt(h,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ma(n)}}return pt(n),zf(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,r),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&Ma(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(l(166));if(t=fe.current,Ri(n)){if(t=n.stateNode,r=n.memoizedProps,o=null,f=Zt,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}t[pe]=n,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||sg(t.nodeValue,r)),t||Wa(n,!0)}else t=Gs(t).createTextNode(o),t[pe]=n,n.stateNode=t}return pt(n),null;case 31:if(r=n.memoizedState,t===null||t.memoizedState!==null){if(o=Ri(n),r!==null){if(t===null){if(!o)throw Error(l(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[pe]=n}else Zr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;pt(n),t=!1}else r=Lc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return n.flags&256?(xn(n),n):(xn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return pt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=Ri(n),o!==null&&o.dehydrated!==null){if(t===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[pe]=n}else Zr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;pt(n),f=!1}else f=Lc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(xn(n),n):(xn(n),null)}return xn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==f&&(o.flags|=2048)),r!==t&&r&&(n.child.flags|=8192),Os(n,n.updateQueue),pt(n),null);case 4:return be(),t===null&&Vf(n.stateNode.containerInfo),pt(n),null;case 10:return Ca(n.type),pt(n),null;case 19:if(C(Tt),o=n.memoizedState,o===null)return pt(n),null;if(f=(n.flags&128)!==0,h=o.rendering,h===null)if(f)$l(o,!1);else{if(wt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(h=bs(t),h!==null){for(n.flags|=128,$l(o,!1),t=h.updateQueue,n.updateQueue=t,Os(n,t),n.subtreeFlags=0,t=r,r=n.child;r!==null;)$m(r,t),r=r.sibling;return $(Tt,Tt.current&1|2),Pe&&za(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&Jt()>Bs&&(n.flags|=128,f=!0,$l(o,!1),n.lanes=4194304)}else{if(!f)if(t=bs(h),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,Os(n,t),$l(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!Pe)return pt(n),null}else 2*Jt()-o.renderingStartTime>Bs&&r!==536870912&&(n.flags|=128,f=!0,$l(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(t=o.last,t!==null?t.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Jt(),t.sibling=null,r=Tt.current,$(Tt,f?r&1|2:r&1),Pe&&za(n,o.treeForkCount),t):(pt(n),null);case 22:case 23:return xn(n),Vc(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(r&536870912)!==0&&(n.flags&128)===0&&(pt(n),n.subtreeFlags&6&&(n.flags|=8192)):pt(n),r=n.updateQueue,r!==null&&Os(n,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==r&&(n.flags|=2048),t!==null&&C(Qr),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Ca(Nt),pt(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function P1(t,n){switch(kc(n),n.tag){case 1:return )DELIM" -R"DELIM(t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Ca(Nt),be(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return dt(n),null;case 31:if(n.memoizedState!==null){if(xn(n),n.alternate===null)throw Error(l(340));Zr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(xn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));Zr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return C(Tt),null;case 4:return be(),null;case 10:return Ca(n.type),null;case 22:case 23:return xn(n),Vc(),t!==null&&C(Qr),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Ca(Nt),null;case 25:return null;default:return null}}function hy(t,n){switch(kc(n),n.tag){case 3:Ca(Nt),be();break;case 26:case 27:case 5:dt(n);break;case 4:be();break;case 31:n.memoizedState!==null&&xn(n);break;case 13:xn(n);break;case 19:C(Tt);break;case 10:Ca(n.type);break;case 22:case 23:xn(n),Vc(),t!==null&&C(Qr);break;case 24:Ca(Nt)}}function Zl(t,n){try{var r=n.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var f=o.next;r=f;do{if((r.tag&t)===t){o=void 0;var h=r.create,y=r.inst;o=h(),y.destroy=o}r=r.next}while(r!==f)}}catch(S){rt(n,n.return,S)}}function lr(t,n,r){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var h=f.next;o=h;do{if((o.tag&t)===t){var y=o.inst,S=y.destroy;if(S!==void 0){y.destroy=void 0,f=n;var A=r,q=S;try{q()}catch(J){rt(f,A,J)}}}o=o.next}while(o!==h)}}catch(J){rt(n,n.return,J)}}function my(t){var n=t.updateQueue;if(n!==null){var r=t.stateNode;try{rp(n,r)}catch(o){rt(t,t.return,o)}}}function py(t,n,r){r.props=Vr(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){rt(t,n,o)}}function ql(t,n){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(f){rt(t,n,f)}}function la(t,n){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(f){rt(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(f){rt(t,n,f)}else r.current=null}function yy(t){var n=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(f){rt(t,t.return,f)}}function Af(t,n,r){try{var o=t.stateNode;fS(o,t.type,r,n),o[ve]=n}catch(f){rt(t,t.return,f)}}function gy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&hr(t.type)||t.tag===4}function Cf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||gy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&hr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function jf(t,n,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(t),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=Ea));else if(o!==4&&(o===27&&hr(t.type)&&(r=t.stateNode,n=null),t=t.child,t!==null))for(jf(t,n,r),t=t.sibling;t!==null;)jf(t,n,r),t=t.sibling}function Ms(t,n,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?r.insertBefore(t,n):r.appendChild(t);else if(o!==4&&(o===27&&hr(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(Ms(t,n,r),t=t.sibling;t!==null;)Ms(t,n,r),t=t.sibling}function vy(t){var n=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Qt(n,o,r),n[pe]=t,n[ve]=r}catch(h){rt(t,t.return,h)}}var ka=!1,kt=!1,Nf=!1,by=typeof WeakSet=="function"?WeakSet:Set,$t=null;function Q1(t,n){if(t=t.containerInfo,Jf=eu,t=Nm(t),_c(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var f=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var y=0,S=-1,A=-1,q=0,J=0,ae=t,F=null;t:for(;;){for(var V;ae!==r||f!==0&&ae.nodeType!==3||(S=y+f),ae!==h||o!==0&&ae.nodeType!==3||(A=y+o),ae.nodeType===3&&(y+=ae.nodeValue.length),(V=ae.firstChild)!==null;)F=ae,ae=V;for(;;){if(ae===t)break t;if(F===r&&++q===f&&(S=y),F===h&&++J===o&&(A=y),(V=ae.nextSibling)!==null)break;ae=F,F=ae.parentNode}ae=V}r=S===-1||A===-1?null:{start:S,end:A}}else r=null}r=r||{start:0,end:0}}else r=null;for(Wf={focusedElem:t,selectionRange:r},eu=!1,$t=n;$t!==null;)if(n=$t,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,$t=t;else for(;$t!==null;){switch(n=$t,h=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r title"))),Qt(h,o,r),h[pe]=t,Ye(h),o=h;break e;case"link":var y=Tg("link","href",f).get(o+(r.href||""));if(y){for(var S=0;Sot&&(y=ot,ot=Ae,Ae=y);var U=Cm(S,Ae),M=Cm(S,ot);if(U&&M&&(V.rangeCount!==1||V.anchorNode!==U.node||V.anchorOffset!==U.offset||V.focusNode!==M.node||V.focusOffset!==M.offset)){var Z=ae.createRange();Z.setStart(U.node,U.offset),V.removeAllRanges(),Ae>ot?(V.addRange(Z),V.extend(M.node,M.offset)):(Z.setEnd(M.node,M.offset),V.addRange(Z))}}}}for(ae=[],V=S;V=V.parentNode;)V.nodeType===1&&ae.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;Sr?32:r,N.T=null,r=Uf,Uf=null;var h=cr,y=Ha;if(Bt=0,$i=cr=null,Ha=0,(We&6)!==0)throw Error(l(331));var S=We;if(We|=4,jy(h.current),zy(h,h.current,y,r),We=S,Kl(0,!1),Wt&&typeof Wt.onPostCommitFiberRoot=="function")try{Wt.onPostCommitFiberRoot(ba,h)}catch{}return!0}finally{B.p=f,N.T=o,Ky(t,n)}}function Xy(t,n,r){n=On(r,n),n=gf(t.stateNode,n,2),t=ar(t,n,2),t!==null&&(aa(t,2),oa(t))}function rt(t,n,r){if(t.tag===3)Xy(t,t,r);else for(;n!==null;){if(n.tag===3){Xy(n,t,r);break}else if(n.tag===1){var o=n.stateNode;if(typeof )DELIM" -R"DELIM(n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(ur===null||!ur.has(o))){t=On(r,t),r=Ip(2),o=ar(n,r,2),o!==null&&(Jp(r,o,n,t),aa(o,2),oa(o));break}}n=n.return}}function qf(t,n,r){var o=t.pingCache;if(o===null){o=t.pingCache=new G1;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(r)||(kf=!0,f.add(r),t=J1.bind(null,t,n,r),n.then(t,t))}function J1(t,n,r){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,ft===t&&(Ze&r)===r&&(wt===4||wt===3&&(Ze&62914560)===Ze&&300>Jt()-Ls?(We&2)===0&&Zi(t,0):Df|=r,Hi===Ze&&(Hi=0)),oa(t)}function Iy(t,n){n===0&&(n=pl()),t=Hr(t,n),t!==null&&(aa(t,n),oa(t))}function W1(t){var n=t.memoizedState,r=0;n!==null&&(r=n.retryLane),Iy(t,r)}function eS(t,n){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,f=t.memoizedState;f!==null&&(r=f.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(l(314))}o!==null&&o.delete(n),Iy(t,r)}function tS(t,n){return Ut(t,n)}var Ps=null,Pi=null,Pf=!1,Qs=!1,Qf=!1,dr=0;function oa(t){t!==Pi&&t.next===null&&(Pi===null?Ps=Pi=t:Pi=Pi.next=t),Qs=!0,Pf||(Pf=!0,aS())}function Kl(t,n){if(!Qf&&Qs){Qf=!0;do for(var r=!1,o=Ps;o!==null;){if(t!==0){var f=o.pendingLanes;if(f===0)var h=0;else{var y=o.suspendedLanes,S=o.pingedLanes;h=(1<<31-Kt(42|t)+1)-1,h&=f&~(y&~S),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,tg(o,h))}else h=Ze,h=ci(o,o===ft?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||Ga(o,h)||(r=!0,tg(o,h));o=o.next}while(r);Qf=!1}}function nS(){Jy()}function Jy(){Qs=Pf=!1;var t=0;dr!==0&&hS()&&(t=dr);for(var n=Jt(),r=null,o=Ps;o!==null;){var f=o.next,h=Wy(o,n);h===0?(o.next=null,r===null?Ps=f:r.next=f,f===null&&(Pi=r)):(r=o,(t!==0||(h&3)!==0)&&(Qs=!0)),o=f}Bt!==0&&Bt!==5||Kl(t),dr!==0&&(dr=0)}function Wy(t,n){for(var r=t.suspendedLanes,o=t.pingedLanes,f=t.expirationTimes,h=t.pendingLanes&-62914561;0S)break;var J=A.transferSize,ae=A.initiatorType;J&&ug(ae)&&(A=A.responseEnd,y+=J*(A"u"?null:document;function Sg(t,n,r){var o=Qi;if(o&&typeof n=="string"&&n){var f=tn(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof r=="string"&&(f+='[crossorigin="'+r+'"]'),xg.has(f)||(xg.add(f),t={rel:t,crossOrigin:r,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),Qt(n,"link",t),Ye(n),o.head.appendChild(n)))}}function wS(t){$a.D(t),Sg("dns-prefetch",t,null)}function _S(t,n){$a.C(t,n),Sg("preconnect",t,n)}function ES(t,n,r){$a.L(t,n,r);var o=Qi;if(o&&t&&n){var f='link[rel="preload"][as="'+tn(n)+'"]';n==="image"&&r&&r.imageSrcSet?(f+='[imagesrcset="'+tn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(f+='[imagesizes="'+tn(r.imageSizes)+'"]')):f+='[href="'+tn(t)+'"]';var h=f;switch(n){case"style":h=Fi(t);break;case"script":h=Yi(t)}Un.has(h)||(t=g({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:t,as:n},r),Un.set(h,t),o.querySelector(f)!==null||n==="style"&&o.querySelector(Jl(h))||n==="script"&&o.querySelector(Wl(h))||(n=o.createElement("link"),Qt(n,"link",t),Ye(n),o.head.appendChild(n)))}}function TS(t,n){$a.m(t,n);var r=Qi;if(r&&t){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modu)DELIM" -R"DELIM(lepreload"][as="'+tn(o)+'"][href="'+tn(t)+'"]',h=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Yi(t)}if(!Un.has(h)&&(t=g({rel:"modulepreload",href:t},n),Un.set(h,t),r.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Wl(h)))return}o=r.createElement("link"),Qt(o,"link",t),Ye(o),r.head.appendChild(o)}}}function RS(t,n,r){$a.S(t,n,r);var o=Qi;if(o&&t){var f=Et(o).hoistableStyles,h=Fi(t);n=n||"default";var y=f.get(h);if(!y){var S={loading:0,preload:null};if(y=o.querySelector(Jl(h)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":n},r),(r=Un.get(h))&&ld(t,r);var A=y=o.createElement("link");Ye(A),Qt(A,"link",t),A._p=new Promise(function(q,J){A.onload=q,A.onerror=J}),A.addEventListener("load",function(){S.loading|=1}),A.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Vs(y,n,o)}y={type:"stylesheet",instance:y,count:1,state:S},f.set(h,y)}}}function zS(t,n){$a.X(t,n);var r=Qi;if(r&&t){var o=Et(r).hoistableScripts,f=Yi(t),h=o.get(f);h||(h=r.querySelector(Wl(f)),h||(t=g({src:t,async:!0},n),(n=Un.get(f))&&od(t,n),h=r.createElement("script"),Ye(h),Qt(h,"link",t),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(f,h))}}function AS(t,n){$a.M(t,n);var r=Qi;if(r&&t){var o=Et(r).hoistableScripts,f=Yi(t),h=o.get(f);h||(h=r.querySelector(Wl(f)),h||(t=g({src:t,async:!0,type:"module"},n),(n=Un.get(f))&&od(t,n),h=r.createElement("script"),Ye(h),Qt(h,"link",t),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(f,h))}}function wg(t,n,r,o){var f=(f=fe.current)?Ks(f):null;if(!f)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=Fi(r.href),r=Et(f).hoistableStyles,o=r.get(n),o||(o={type:"style",instance:null,count:0,state:null},r.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Fi(r.href);var h=Et(f).hoistableStyles,y=h.get(t);if(y||(f=f.ownerDocument||f,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(t,y),(h=f.querySelector(Jl(t)))&&!h._p&&(y.instance=h,y.state.loading=5),Un.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Un.set(t,r),h||CS(f,t,r,y.state))),n&&o===null)throw Error(l(528,""));return y}if(n&&o!==null)throw Error(l(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Yi(r),r=Et(f).hoistableScripts,o=r.get(n),o||(o={type:"script",instance:null,count:0,state:null},r.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Fi(t){return'href="'+tn(t)+'"'}function Jl(t){return'link[rel="stylesheet"]['+t+"]"}function _g(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function CS(t,n,r,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Qt(n,"link",r),Ye(n),t.head.appendChild(n))}function Yi(t){return'[src="'+tn(t)+'"]'}function Wl(t){return"script[async]"+t}function Eg(t,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+tn(r.href)+'"]');if(o)return n.instance=o,Ye(o),o;var f=g({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Ye(o),Qt(o,"style",f),Vs(o,r.precedence,t),n.instance=o;case"stylesheet":f=Fi(r.href);var h=t.querySelector(Jl(f));if(h)return n.state.loading|=4,n.instance=h,Ye(h),h;o=_g(r),(f=Un.get(f))&&ld(o,f),h=(t.ownerDocument||t).createElement("link"),Ye(h);var y=h;return y._p=new Promise(function(S,A){y.onload=S,y.onerror=A}),Qt(h,"link",o),n.state.loading|=4,Vs(h,r.precedence,t),n.instance=h;case"script":return h=Yi(r.src),(f=t.querySelector(Wl(h)))?(n.instance=f,Ye(f),f):(o=r,(f=Un.get(h))&&(o=g({},r),od(o,f)),t=t.ownerDocument||t,f=t.createElement("script"),Ye(f),Qt(f,"link",o),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Vs(o,r.precedence,t));return n.instance}function Vs(t,n,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,h=f,y=0;y title"):null)}function jS(t,n,r){if(r===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function zg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function NS(t,n,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=Fi(o.href),h=n.querySelector(Jl(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Is.bind(t),n.then(t,t)),r.state.loading|=4,r.instance=h,Ye(h);return}h=n.ownerDocument||n,o=_g(o),(f=Un.get(f))&&ld(o,f),h=h.createElement("link"),Ye(h);var y=h;y._p=new Promise(function(S,A){y.onload=S,y.onerror=A}),Qt(h,"link",o),r.instance=h}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Is.bind(t),n.addEventListener("load",r),n.addEventListener("error",r))}}var sd=0;function OS(t,n){return t.stylesheets&&t.count===0&&Ws(t,t.stylesheets),0sd?50:800)+n);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function Is(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ws(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Js=null;function Ws(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Js=new Map,n.forEach(MS,t),Js=null,Is.call(t))}function MS(t,n){if(!(n.state.loading&4)){var r=Js.get(t);if(r)var o=r.get(null);else{r=new Map,Js.set(t,r);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),gd.exports=XS(),gd.exports}var JS=IS();const WS=mh(JS);var Do=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ew=class extends Do{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const a=()=>e();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=v)DELIM" -R"DELIM(oid 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(a=>{a(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},yh=new ew,tw={setTimeout:(e,a)=>setTimeout(e,a),clearTimeout:e=>clearTimeout(e),setInterval:(e,a)=>setInterval(e,a),clearInterval:e=>clearInterval(e)},nw=class{#e=tw;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,a){return this.#e.setTimeout(e,a)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,a){return this.#e.setInterval(e,a)}clearInterval(e){this.#e.clearInterval(e)}},ti=new nw;function aw(e){setTimeout(e,0)}var rw=typeof window>"u"||"Deno"in globalThis;function mn(){}function iw(e,a){return typeof e=="function"?e(a):e}function Yd(e){return typeof e=="number"&&e>=0&&e!==1/0}function M0(e,a){return Math.max(e+(a||0)-Date.now(),0)}function Cr(e,a){return typeof e=="function"?e(a):e}function En(e,a){return typeof e=="function"?e(a):e}function Ig(e,a){const{type:i="all",exact:l,fetchStatus:s,predicate:u,queryKey:c,stale:d}=e;if(c){if(l){if(a.queryHash!==gh(c,a.options))return!1}else if(!_o(a.queryKey,c))return!1}if(i!=="all"){const m=a.isActive();if(i==="active"&&!m||i==="inactive"&&m)return!1}return!(typeof d=="boolean"&&a.isStale()!==d||s&&s!==a.state.fetchStatus||u&&!u(a))}function Jg(e,a){const{exact:i,status:l,predicate:s,mutationKey:u}=e;if(u){if(!a.options.mutationKey)return!1;if(i){if(wo(a.options.mutationKey)!==wo(u))return!1}else if(!_o(a.options.mutationKey,u))return!1}return!(l&&a.state.status!==l||s&&!s(a))}function gh(e,a){return(a?.queryKeyHashFn||wo)(e)}function wo(e){return JSON.stringify(e,(a,i)=>Kd(i)?Object.keys(i).sort().reduce((l,s)=>(l[s]=i[s],l),{}):i)}function _o(e,a){return e===a?!0:typeof e!=typeof a?!1:e&&a&&typeof e=="object"&&typeof a=="object"?Object.keys(a).every(i=>_o(e[i],a[i])):!1}var lw=Object.prototype.hasOwnProperty;function k0(e,a,i=0){if(e===a)return e;if(i>500)return a;const l=Wg(e)&&Wg(a);if(!l&&!(Kd(e)&&Kd(a)))return a;const u=(l?e:Object.keys(e)).length,c=l?a:Object.keys(a),d=c.length,m=l?new Array(d):{};let p=0;for(let b=0;b{ti.setTimeout(a,e)})}function Vd(e,a,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,a):i.structuralSharing!==!1?k0(e,a):a}function sw(e,a,i=0){const l=[...e,a];return i&&l.length>i?l.slice(1):l}function uw(e,a,i=0){const l=[a,...e];return i&&l.length>i?l.slice(0,-1):l}var vh=Symbol();function D0(e,a){return!e.queryFn&&a?.initialPromise?()=>a.initialPromise:!e.queryFn||e.queryFn===vh?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function L0(e,a){return typeof e=="function"?e(...a):!!e}function cw(e,a,i){let l=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=a(),l||(l=!0,s.aborted?i():s.addEventListener("abort",i,{once:!0})),s)}),e}var Eo=(()=>{let e=()=>rw;return{isServer(){return e()},setIsServer(a){e=a}}})();function Xd(){let e,a;const i=new Promise((s,u)=>{e=s,a=u});i.status="pending",i.catch(()=>{});function l(s){Object.assign(i,s),delete i.resolve,delete i.reject}return i.resolve=s=>{l({status:"fulfilled",value:s}),e(s)},i.reject=s=>{l({status:"rejected",reason:s}),a(s)},i}var fw=aw;function dw(){let e=[],a=0,i=d=>{d()},l=d=>{d()},s=fw;const u=d=>{a?e.push(d):s(()=>{i(d)})},c=()=>{const d=e;e=[],d.length&&s(()=>{l(()=>{d.forEach(m=>{i(m)})})})};return{batch:d=>{let m;a++;try{m=d()}finally{a--,a||c()}return m},batchCalls:d=>(...m)=>{u(()=>{d(...m)})},schedule:u,setNotifyFunction:d=>{i=d},setBatchNotifyFunction:d=>{l=d},setScheduler:d=>{s=d}}}var Yt=dw(),hw=class extends Do{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const a=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(t)DELIM" -R"DELIM(his.#e=e,this.listeners.forEach(i=>{i(e)}))}isOnline(){return this.#e}},Ou=new hw;function mw(e){return Math.min(1e3*2**e,3e4)}function B0(e){return(e??"online")==="online"?Ou.isOnline():!0}var Id=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function U0(e){let a=!1,i=0,l;const s=Xd(),u=()=>s.status!=="pending",c=T=>{if(!u()){const k=new Id(T);x(k),e.onCancel?.(k)}},d=()=>{a=!0},m=()=>{a=!1},p=()=>yh.isFocused()&&(e.networkMode==="always"||Ou.isOnline())&&e.canRun(),b=()=>B0(e.networkMode)&&e.canRun(),g=T=>{u()||(l?.(),s.resolve(T))},x=T=>{u()||(l?.(),s.reject(T))},_=()=>new Promise(T=>{l=k=>{(u()||p())&&T(k)},e.onPause?.()}).then(()=>{l=void 0,u()||e.onContinue?.()}),R=()=>{if(u())return;let T;const k=i===0?e.initialPromise:void 0;try{T=k??e.fn()}catch(Y){T=Promise.reject(Y)}Promise.resolve(T).then(g).catch(Y=>{if(u())return;const X=e.retry??(Eo.isServer()?0:3),ne=e.retryDelay??mw,se=typeof ne=="function"?ne(i,Y):ne,te=X===!0||typeof X=="number"&&ip()?void 0:_()).then(()=>{a?x(Y):R()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(l?.(),s),cancelRetry:d,continueRetry:m,canStart:b,start:()=>(b()?R():_().then(R),s)}}var H0=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yd(this.gcTime)&&(this.#e=ti.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Eo.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(ti.clearTimeout(this.#e),this.#e=void 0)}};function pw(e){return{onFetch:(a,i)=>{const l=a.options,s=a.fetchOptions?.meta?.fetchMore?.direction,u=a.state.data?.pages||[],c=a.state.data?.pageParams||[];let d={pages:[],pageParams:[]},m=0;const p=async()=>{let b=!1;const g=R=>{cw(R,()=>a.signal,()=>b=!0)},x=D0(a.options,a.fetchOptions),_=async(R,T,k)=>{if(b)return Promise.reject(a.signal.reason);if(T==null&&R.pages.length)return Promise.resolve(R);const X=(()=>{const xe={client:a.client,queryKey:a.queryKey,pageParam:T,direction:k?"backward":"forward",meta:a.options.meta};return g(xe),xe})(),ne=await x(X),{maxPages:se}=a.options,te=k?uw:sw;return{pages:te(R.pages,ne,se),pageParams:te(R.pageParams,T,se)}};if(s&&u.length){const R=s==="backward",T=R?yw:tv,k={pages:u,pageParams:c},Y=T(l,k);d=await _(k,Y,R)}else{const R=e??u.length;do{const T=m===0?c[0]??l.initialPageParam:tv(l,d);if(m>0&&T==null)break;d=await _(d,T),m++}while(ma.options.persister?.(p,{client:a.client,queryKey:a.queryKey,meta:a.options.meta,signal:a.signal},i):a.fetchFn=p}}}function tv(e,{pages:a,pageParams:i}){const l=a.length-1;return a.length>0?e.getNextPageParam(a[l],a,i[l],i):void 0}function yw(e,{pages:a,pageParams:i}){return a.length>0?e.getPreviousPageParam?.(a[0],a,i[0],i):void 0}var gw=class extends H0{#e;#t;#n;#a;#i;#r;#o;#l;constructor(e){super(),this.#l=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#a=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=av(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=av(this.options);a.data!==void 0&&(this.setState(nv(a.data,a.dataUpdatedAt)),this.#t=a)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(e,a){const i=Vd(this.state.data,e,this.options);return this.#s({data:i,type:"success",dataUpdatedAt:a?.updatedAt,manual:a?.manual}),i}setState(e){this.#s({type:"setState",state:e})}cancel(e){const a=this.#r?.promise;return this.#r?.cancel(e),a?a.then(mn).catch(mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>En(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===vh||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Cr(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:!M0(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(a=>a.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(a=>a.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.obser)DELIM" -R"DELIM(vers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(a=>a!==e),this.observers.length||(this.#r&&(this.#l||this.#c()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,a){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&a?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const i=new AbortController,l=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#l=!0,i.signal)})},s=()=>{const m=D0(this.options,a),b=(()=>{const g={client:this.#i,queryKey:this.queryKey,meta:this.meta};return l(g),g})();return this.#l=!1,this.options.persister?this.options.persister(m,b,this):m(b)},c=(()=>{const m={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return l(m),m})();(this.#e==="infinite"?pw(this.options.pages):this.options.behavior)?.onFetch(c,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==c.fetchOptions?.meta)&&this.#s({type:"fetch",meta:c.fetchOptions?.meta}),this.#r=U0({initialPromise:a?.initialPromise,fn:c.fetchFn,onCancel:m=>{m instanceof Id&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),i.abort()},onFail:(m,p)=>{this.#s({type:"failed",failureCount:m,error:p})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0});try{const m=await this.#r.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#a.config.onSuccess?.(m,this),this.#a.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof Id){if(m.silent)return this.#r.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#s({type:"error",error:m}),this.#a.config.onError?.(m,this),this.#a.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#s(e){const a=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...$0(i.data,this.options),fetchMeta:e.meta??null};case"success":const l={...i,...nv(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?l:void 0,l;case"error":const s=e.error;return{...i,error:s,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=a(this.state),Yt.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:e})})}};function $0(e,a){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:B0(a.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function nv(e,a){return{data:e,dataUpdatedAt:a??Date.now(),error:null,isInvalidated:!1,status:"success"}}function av(e){const a=typeof e.initialData=="function"?e.initialData():e.initialData,i=a!==void 0,l=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:a,dataUpdateCount:0,dataUpdatedAt:i?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var vw=class extends Do{constructor(e,a){super(),this.options=a,this.#e=e,this.#l=null,this.#o=Xd(),this.bindMethods(),this.setOptions(a)}#e;#t=void 0;#n=void 0;#a=void 0;#i;#r;#o;#l;#c;#s;#m;#f;#d;#u;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),rv(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Jd(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Jd(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#t.removeObserver(this)}setOptions(e){const a=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOption)DELIM" -R"DELIM(s(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof En(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),a._defaulted&&!Gd(this.options,a)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&iv(this.#t,i,this.options,a)&&this.#h(),this.updateResult(),l&&(this.#t!==i||En(this.options.enabled,this.#t)!==En(a.enabled,this.#t)||Cr(this.options.staleTime,this.#t)!==Cr(a.staleTime,this.#t))&&this.#y();const s=this.#g();l&&(this.#t!==i||En(this.options.enabled,this.#t)!==En(a.enabled,this.#t)||s!==this.#u)&&this.#v(s)}getOptimisticResult(e){const a=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(a,e);return xw(this,i)&&(this.#a=i,this.#r=this.options,this.#i=this.#t.state),i}getCurrentResult(){return this.#a}trackResult(e,a){return new Proxy(e,{get:(i,l)=>(this.trackProp(l),a?.(l),l==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,l))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const a=this.#e.defaultQueryOptions(e),i=this.#e.getQueryCache().build(this.#e,a);return i.fetch().then(()=>this.createResult(i,a))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#h(e){this.#w();let a=this.#t.fetch(this.options,e);return e?.throwOnError||(a=a.catch(mn)),a}#y(){this.#x();const e=Cr(this.options.staleTime,this.#t);if(Eo.isServer()||this.#a.isStale||!Yd(e))return;const i=M0(this.#a.dataUpdatedAt,e)+1;this.#f=ti.setTimeout(()=>{this.#a.isStale||this.updateResult()},i)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#S(),this.#u=e,!(Eo.isServer()||En(this.options.enabled,this.#t)===!1||!Yd(this.#u)||this.#u===0)&&(this.#d=ti.setInterval(()=>{(this.options.refetchIntervalInBackground||yh.isFocused())&&this.#h()},this.#u))}#b(){this.#y(),this.#v(this.#g())}#x(){this.#f!==void 0&&(ti.clearTimeout(this.#f),this.#f=void 0)}#S(){this.#d!==void 0&&(ti.clearInterval(this.#d),this.#d=void 0)}createResult(e,a){const i=this.#t,l=this.options,s=this.#a,u=this.#i,c=this.#r,m=e!==i?e.state:this.#n,{state:p}=e;let b={...p},g=!1,x;if(a._optimisticResults){const w=this.hasListeners(),L=!w&&rv(e,a),H=w&&iv(e,i,a,l);(L||H)&&(b={...b,...$0(p.data,e.options)}),a._optimisticResults==="isRestoring"&&(b.fetchStatus="idle")}let{error:_,errorUpdatedAt:R,status:T}=b;x=b.data;let k=!1;if(a.placeholderData!==void 0&&x===void 0&&T==="pending"){let w;s?.isPlaceholderData&&a.placeholderData===c?.placeholderData?(w=s.data,k=!0):w=typeof a.placeholderData=="function"?a.placeholderData(this.#m?.state.data,this.#m):a.placeholderData,w!==void 0&&(T="success",x=Vd(s?.data,w,a),g=!0)}if(a.select&&x!==void 0&&!k)if(s&&x===u?.data&&a.select===this.#c)x=this.#s;else try{this.#c=a.select,x=a.select(x),x=Vd(s?.data,x,a),this.#s=x,this.#l=null}catch(w){this.#l=w}this.#l&&(_=this.#l,x=this.#s,R=Date.now(),T="error");const Y=b.fetchStatus==="fetching",X=T==="pending",ne=T==="error",se=X&&Y,te=x!==void 0,O={status:T,fetchStatus:b.fetchStatus,isPending:X,isSuccess:T==="success",isError:ne,isInitialLoading:se,isLoading:se,data:x,dataUpdatedAt:b.dataUpdatedAt,error:_,errorUpdatedAt:R,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:b.dataUpdateCount>m.dataUpdateCount||b.errorUpdateCount>m.errorUpdateCount,isFetching:Y,isRefetching:Y&&!X,isLoadingError:ne&&!te,isPaused:b.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:ne&&te,isStale:bh(e,a),refetch:this.refetch,promise:this.#o,isEnabled:En(a.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const w=O.data!==void 0,L=O.status==="error"&&!w,H=he=>{L?he.reject(O.error):w&&he.resolve(O.data)},Q=()=>{const he=this.#o=O.promise=Xd();H(he)},K=this.#o;switch(K.status){case"pending":e.queryHash===i.queryHash&&H(K);break;case"fulfilled":(L||O.data!==K.value)&&Q();break;case"rejected":(!L||O.error!==K.reason)&&Q();break}}return O}updateResult(){const e=this.#a,a=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#r=this.options,this.#i.data!==void 0&&(this.#m=this.#t),Gd(a,e))return;this.#a=a;const i=()=>{if(!e)return!0;const{notifyOnChangeProps:l}=this.options,s=typeof l=="function"?l():l;if(s==="all"||!s&&!this.#p.size)return!0;const u=new Set(s??this.#p);return this.options.throwOnError&&u.add("error"),Object.keys(this.#a).some(c=>{const d=c;return this.#a[d]!==e[d]&&u.has(d)})};this.#_({listeners:i()})}#w(){const e=this.#e.getQuer)DELIM" -R"DELIM(yCache().build(this.#e,this.options);if(e===this.#t)return;const a=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(a?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#_(e){Yt.batch(()=>{e.listeners&&this.listeners.forEach(a=>{a(this.#a)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function bw(e,a){return En(a.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&En(a.retryOnMount,e)===!1)}function rv(e,a){return bw(e,a)||e.state.data!==void 0&&Jd(e,a,a.refetchOnMount)}function Jd(e,a,i){if(En(a.enabled,e)!==!1&&Cr(a.staleTime,e)!=="static"){const l=typeof i=="function"?i(e):i;return l==="always"||l!==!1&&bh(e,a)}return!1}function iv(e,a,i,l){return(e!==a||En(l.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&bh(e,i)}function bh(e,a){return En(a.enabled,e)!==!1&&e.isStaleByTime(Cr(a.staleTime,e))}function xw(e,a){return!Gd(e.getCurrentResult(),a)}var Sw=class extends H0{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ww(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(a=>a!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const a=()=>{this.#i({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=U0({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(u,c)=>{this.#i({type:"failed",failureCount:u,error:c})},onPause:()=>{this.#i({type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const l=this.state.status==="pending",s=!this.#a.canStart();try{if(l)a();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,i);const c=await this.options.onMutate?.(e,i);c!==this.state.context&&this.#i({type:"pending",context:c,variables:e,isPaused:s})}const u=await this.#a.start();return await this.#n.config.onSuccess?.(u,e,this.state.context,this,i),await this.options.onSuccess?.(u,e,this.state.context,i),await this.#n.config.onSettled?.(u,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(u,null,e,this.state.context,i),this.#i({type:"success",data:u}),u}catch(u){try{await this.#n.config.onError?.(u,e,this.state.context,this,i)}catch(c){Promise.reject(c)}try{await this.options.onError?.(u,e,this.state.context,i)}catch(c){Promise.reject(c)}try{await this.#n.config.onSettled?.(void 0,u,this.state.variables,this.state.context,this,i)}catch(c){Promise.reject(c)}try{await this.options.onSettled?.(void 0,u,e,this.state.context,i)}catch(c){Promise.reject(c)}throw this.#i({type:"error",error:u}),u}finally{this.#n.runNext(this)}}#i(e){const a=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,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{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=a(this.state),Yt.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function ww(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _w=class extends Do{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,a,i){const l=new Sw({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(a),state:i});return this.add(l),l}add(e){this.#e.add(e);const a=ou(e);if(typeof a=="string"){const i=this.#t.get(a);i?i.push(e):this.#t.set(a,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const a=ou(e);if(typeof a=="string"){const i=this.#t.get(a);if(i)if(i.length>1){const l=i.indexOf(e);l!==-1&&i.splice(l,1)}else i[0]===e&&this.#t.delete(a)}}this.notify({type:"removed",mutation:e})}canRun(e){const a=ou(e);if(typeof a=="string"){co)DELIM" -R"DELIM(nst l=this.#t.get(a)?.find(s=>s.state.status==="pending");return!l||l===e}else return!0}runNext(e){const a=ou(e);return typeof a=="string"?this.#t.get(a)?.find(l=>l!==e&&l.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Yt.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const a={exact:!0,...e};return this.getAll().find(i=>Jg(a,i))}findAll(e={}){return this.getAll().filter(a=>Jg(e,a))}notify(e){Yt.batch(()=>{this.listeners.forEach(a=>{a(e)})})}resumePausedMutations(){const e=this.getAll().filter(a=>a.state.isPaused);return Yt.batch(()=>Promise.all(e.map(a=>a.continue().catch(mn))))}};function ou(e){return e.options.scope?.id}var Ew=class extends Do{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,a,i){const l=a.queryKey,s=a.queryHash??gh(l,a);let u=this.get(s);return u||(u=new gw({client:e,queryKey:l,queryHash:s,options:e.defaultQueryOptions(a),state:i,defaultOptions:e.getQueryDefaults(l)}),this.add(u)),u}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const a=this.#e.get(e.queryHash);a&&(e.destroy(),a===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Yt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const a={exact:!0,...e};return this.getAll().find(i=>Ig(a,i))}findAll(e={}){const a=this.getAll();return Object.keys(e).length>0?a.filter(i=>Ig(e,i)):a}notify(e){Yt.batch(()=>{this.listeners.forEach(a=>{a(e)})})}onFocus(){Yt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Yt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Tw=class{#e;#t;#n;#a;#i;#r;#o;#l;constructor(e={}){this.#e=e.queryCache||new Ew,this.#t=e.mutationCache||new _w,this.#n=e.defaultOptions||{},this.#a=new Map,this.#i=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#o=yh.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Ou.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#o?.(),this.#o=void 0,this.#l?.(),this.#l=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const a=this.defaultQueryOptions({queryKey:e});return this.#e.get(a.queryHash)?.state.data}ensureQueryData(e){const a=this.defaultQueryOptions(e),i=this.#e.build(this,a),l=i.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(Cr(a.staleTime,i))&&this.prefetchQuery(a),Promise.resolve(l))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:a,state:i})=>{const l=i.data;return[a,l]})}setQueryData(e,a,i){const l=this.defaultQueryOptions({queryKey:e}),u=this.#e.get(l.queryHash)?.state.data,c=iw(a,u);if(c!==void 0)return this.#e.build(this,l).setData(c,{...i,manual:!0})}setQueriesData(e,a,i){return Yt.batch(()=>this.#e.findAll(e).map(({queryKey:l})=>[l,this.setQueryData(l,a,i)]))}getQueryState(e){const a=this.defaultQueryOptions({queryKey:e});return this.#e.get(a.queryHash)?.state}removeQueries(e){const a=this.#e;Yt.batch(()=>{a.findAll(e).forEach(i=>{a.remove(i)})})}resetQueries(e,a){const i=this.#e;return Yt.batch(()=>(i.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},a)))}cancelQueries(e,a={}){const i={revert:!0,...a},l=Yt.batch(()=>this.#e.findAll(e).map(s=>s.cancel(i)));return Promise.all(l).then(mn).catch(mn)}invalidateQueries(e,a={}){return Yt.batch(()=>(this.#e.findAll(e).forEach(i=>{i.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},a)))}refetchQueries(e,a={}){const i={...a,cancelRefetch:a.cancelRefetch??!0},l=Yt.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let u=s.fetch(void 0,i);return i.throwOnError||(u=u.catch(mn)),s.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(mn)}fetchQuery(e){const a=this.defaultQueryOptions(e);a.retry===void 0&&(a.retry=!1);const i=this.#e.build(this,a);return i.isStaleByTime(Cr(a.staleTime,i))?i.fetch(a):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(mn).catch(mn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(mn).catch(mn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Ou.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,a){this.#a.set(wo(e),{queryKey:e,defaultOptions:a})}getQueryDefaults(e){const a=[...this.#a.values()],i={};return a.forEach(l=>{_o(e,l.qu)DELIM" -R"DELIM(eryKey)&&Object.assign(i,l.defaultOptions)}),i}setMutationDefaults(e,a){this.#i.set(wo(e),{mutationKey:e,defaultOptions:a})}getMutationDefaults(e){const a=[...this.#i.values()],i={};return a.forEach(l=>{_o(e,l.mutationKey)&&Object.assign(i,l.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const a={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return a.queryHash||(a.queryHash=gh(a.queryKey,a)),a.refetchOnReconnect===void 0&&(a.refetchOnReconnect=a.networkMode!=="always"),a.throwOnError===void 0&&(a.throwOnError=!!a.suspense),!a.networkMode&&a.persister&&(a.networkMode="offlineFirst"),a.queryFn===vh&&(a.enabled=!1),a}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Z0=E.createContext(void 0),Gu=e=>{const a=E.useContext(Z0);if(!a)throw new Error("No QueryClient set, use QueryClientProvider to set one");return a},Rw=({client:e,children:a})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),v.jsx(Z0.Provider,{value:e,children:a})),q0=E.createContext(!1),zw=()=>E.useContext(q0);q0.Provider;function Aw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Cw=E.createContext(Aw()),jw=()=>E.useContext(Cw),Nw=(e,a,i)=>{const l=i?.state.error&&typeof e.throwOnError=="function"?L0(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||l)&&(a.isReset()||(e.retryOnMount=!1))},Ow=e=>{E.useEffect(()=>{e.clearReset()},[e])},Mw=({result:e,errorResetBoundary:a,throwOnError:i,query:l,suspense:s})=>e.isError&&!a.isReset()&&!e.isFetching&&l&&(s&&e.data===void 0||L0(i,[e.error,l])),kw=e=>{if(e.suspense){const i=s=>s==="static"?s:Math.max(s??1e3,1e3),l=e.staleTime;e.staleTime=typeof l=="function"?(...s)=>i(l(...s)):i(l),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Dw=(e,a)=>e.isLoading&&e.isFetching&&!a,Lw=(e,a)=>e?.suspense&&a.isPending,lv=(e,a,i)=>a.fetchOptimistic(e).catch(()=>{i.clearReset()});function Bw(e,a,i){const l=zw(),s=jw(),u=Gu(),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);const d=u.getQueryCache().get(c.queryHash),m=e.subscribed!==!1;c._optimisticResults=l?"isRestoring":m?"optimistic":void 0,kw(c),Nw(c,s,d),Ow(s);const p=!u.getQueryCache().get(c.queryHash),[b]=E.useState(()=>new a(u,c)),g=b.getOptimisticResult(c),x=!l&&m;if(E.useSyncExternalStore(E.useCallback(_=>{const R=x?b.subscribe(Yt.batchCalls(_)):mn;return b.updateResult(),R},[b,x]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),E.useEffect(()=>{b.setOptions(c)},[c,b]),Lw(c,g))throw lv(c,b,s);if(Mw({result:g,errorResetBoundary:s,throwOnError:c.throwOnError,query:d,suspense:c.suspense}))throw g.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(c,g),c.experimental_prefetchInRender&&!Eo.isServer()&&Dw(g,l)&&(p?lv(c,b,s):d?.promise)?.catch(mn).finally(()=>{b.updateResult()}),c.notifyOnChangeProps?g:b.trackResult(g)}function Uw(e,a){return Bw(e,vw)}var ov;function re(e,a,i){function l(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),a(d,m);const p=c.prototype,b=Object.keys(p);for(let g=0;gi?.Parent&&d instanceof i.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(c,"name",{value:e}),c}class rl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class P0 extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(ov=globalThis).__zod_globalConfig??(ov.__zod_globalConfig={});const xh=globalThis.__zod_globalConfig;function ri(e){return xh}function Q0(e){const a=Object.values(e).filter(l=>typeof l=="number");return Object.entries(e).filter(([l,s])=>a.indexOf(+l)===-1).map(([l,s])=>s)}function Wd(e,a){return typeof a=="bigint"?a.toString():a}function Sh(e){return{get value(){{const a=e();return Object.defineProperty(this,"value",{value:a}),a}}}}function wh(e){return e==null}function _h(e){const a=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(a,i)}function Hw(e,a){const i=e/a,l=Math.round(i),s=Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-l){};function Mu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zw=Sh(()=>{if(xh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function To(e){if(Mu(e)===!1)return!1;const a=e.constructor;if(a===void 0||typeof a!="function")return!0;const i=a.prototype;return!(Mu(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function Y0(e){return To(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const qw=new Set(["string","number","symbol"]);function Ku(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Or(e,a,i){const l=new e._zod.constr(a??e._zod.def);return(!a||i?.parent)&&(l._zod.parent=e),l}function ze(e){const a=e;if(!a)return{};if(typeof a=="string")return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");a.error=a.message}return delete a.message,typeof a.error=="string"?{...a,error:()=>a.error}:a}function Pw(e){return Object.keys(e).filter(a=>e[a]._zod.optin==="optional"&&e[a]._zod.optout==="optional")}const Qw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Fw(e,a){const i=e._zod.def,l=i.checks;if(l&&l.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const u=Nr(e._zod.def,{get shape(){const c={};for(const d in a){if(!(d in i.shape))throw new Error(`Unrecognized key: "${d}"`);a[d]&&(c[d]=i.shape[d])}return oi(this,"shape",c),c},checks:[]});return Or(e,u)}function Yw(e,a){const i=e._zod.def,l=i.checks;if(l&&l.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const u=Nr(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const d in a){if(!(d in i.shape))throw new Error(`Unrecognized key: "${d}"`);a[d]&&delete c[d]}return oi(this,"shape",c),c},checks:[]});return Or(e,u)}function Gw(e,a){if(!To(a))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const u=e._zod.def.shape;for(const c in a)if(Object.getOwnPropertyDescriptor(u,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Nr(e._zod.def,{get shape(){const u={...e._zod.def.shape,...a};return oi(this,"shape",u),u}});return Or(e,s)}function Kw(e,a){if(!To(a))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Nr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...a};return oi(this,"shape",l),l}});return Or(e,i)}function Vw(e,a){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i=Nr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...a._zod.def.shape};return oi(this,"shape",l),l},get catchall(){return a._zod.def.catchall},checks:a._zod.def.checks??[]});return Or(e,i)}function Xw(e,a,i){const s=a._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=Nr(a._zod.def,{get shape(){const d=a._zod.def.shape,m={...d};if(i)for(const p in i){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);i[p]&&(m[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)m[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return oi(this,"shape",m),m},checks:[]});return Or(a,c)}function Iw(e,a,i){const l=Nr(a._zod.def,{get shape(){const s=a._zod.def.shape,u={...s};if(i)for(const c in i){if(!(c in u))throw new Error(`Unrecognized key: "${c}"`);i[c]&&(u[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)u[c]=new e({type:"nonoptional",innerType:s[c]});return oi(this,"shape",u),u}});return Or(a,l)}function nl(e,a=0){if(e.aborted===!0)return!0;for(let i=a;i{var l;return(l=i).path??(l.path=[]),i.path.unshift(e),i})}function su(e){return typeof e=="string"?e:e?.message}function ii(e,a,i){const l=e.message?e.message:su(e.inst?._zod.def?.error?.(e))??su(a?.error?.(e))??su(i.customError?.(e))??su(i.localeError?.(e))??"Invalid input",{inst:s,continue:u,input:c,...d}=e;re)DELIM" -R"DELIM(turn d.path??(d.path=[]),d.message=l,a?.reportInput&&(d.input=c),d}function Eh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ro(...e){const[a,i,l]=e;return typeof a=="string"?{message:a,code:"custom",input:i,inst:l}:{...a}}const K0=(e,a)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:a,enumerable:!1}),e.message=JSON.stringify(a,Wd,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},V0=re("$ZodError",K0),X0=re("$ZodError",K0,{Parent:Error});function Ww(e,a=i=>i.message){const i={},l=[];for(const s of e.issues)s.path.length>0?(i[s.path[0]]=i[s.path[0]]||[],i[s.path[0]].push(a(s))):l.push(a(s));return{formErrors:l,fieldErrors:i}}function e2(e,a=i=>i.message){const i={_errors:[]},l=(s,u=[])=>{for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(d=>l({issues:d},[...u,...c.path]));else if(c.code==="invalid_key")l({issues:c.issues},[...u,...c.path]);else if(c.code==="invalid_element")l({issues:c.issues},[...u,...c.path]);else{const d=[...u,...c.path];if(d.length===0)i._errors.push(a(c));else{let m=i,p=0;for(;p(a,i,l,s)=>{const u=l?{...l,async:!1}:{async:!1},c=a._zod.run({value:i,issues:[]},u);if(c instanceof Promise)throw new rl;if(c.issues.length){const d=new(s?.Err??e)(c.issues.map(m=>ii(m,u,ri())));throw F0(d,s?.callee),d}return c.value},Rh=e=>async(a,i,l,s)=>{const u=l?{...l,async:!0}:{async:!0};let c=a._zod.run({value:i,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){const d=new(s?.Err??e)(c.issues.map(m=>ii(m,u,ri())));throw F0(d,s?.callee),d}return c.value},Vu=e=>(a,i,l)=>{const s=l?{...l,async:!1}:{async:!1},u=a._zod.run({value:i,issues:[]},s);if(u instanceof Promise)throw new rl;return u.issues.length?{success:!1,error:new(e??V0)(u.issues.map(c=>ii(c,s,ri())))}:{success:!0,data:u.value}},t2=Vu(X0),Xu=e=>async(a,i,l)=>{const s=l?{...l,async:!0}:{async:!0};let u=a._zod.run({value:i,issues:[]},s);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(c=>ii(c,s,ri())))}:{success:!0,data:u.value}},n2=Xu(X0),a2=e=>(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Th(e)(a,i,s)},r2=e=>(a,i,l)=>Th(e)(a,i,l),i2=e=>async(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Rh(e)(a,i,s)},l2=e=>async(a,i,l)=>Rh(e)(a,i,l),o2=e=>(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Vu(e)(a,i,s)},s2=e=>(a,i,l)=>Vu(e)(a,i,l),u2=e=>async(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Xu(e)(a,i,s)},c2=e=>async(a,i,l)=>Xu(e)(a,i,l),f2=/^[cC][0-9a-z]{6,}$/,d2=/^[0-9a-z]+$/,h2=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,m2=/^[0-9a-vA-V]{20}$/,p2=/^[A-Za-z0-9]{27}$/,y2=/^[a-zA-Z0-9_-]{21}$/,g2=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,v2=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cv=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,b2=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,x2="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function S2(){return new RegExp(x2,"u")}const w2=/^(?:(?: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])$/,_2=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,E2=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,T2=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R2=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,I0=/^[A-Za-z0-9_-]*$/,z2=/^https?$/,A2=/^\+[1-9]\d{6,14}$/,J0="(?:(?:\\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])))",C2=new RegExp(`^${J0}$`);function W0(e){const a="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${a}`:e.precision===0?`${a}:[0-5]\\d`:`${a}:[0-5]\\d\\.\\d{${e)DELIM" -R"DELIM(.precision}}`:`${a}(?::[0-5]\\d(?:\\.\\d+)?)?`}function j2(e){return new RegExp(`^${W0(e)}$`)}function N2(e){const a=W0({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const l=`${a}(?:${i.join("|")})`;return new RegExp(`^${J0}T(?:${l})$`)}const O2=e=>{const a=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${a}$`)},M2=/^-?\d+$/,k2=/^-?\d+(?:\.\d+)?$/,D2=/^(?:true|false)$/i,L2=/^[^A-Z]*$/,B2=/^[^a-z]*$/,pn=re("$ZodCheck",(e,a)=>{var i;e._zod??(e._zod={}),e._zod.def=a,(i=e._zod).onattach??(i.onattach=[])}),eb={number:"number",bigint:"bigint",object:"date"},tb=re("$ZodCheckLessThan",(e,a)=>{pn.init(e,a);const i=eb[typeof a.value];e._zod.onattach.push(l=>{const s=l._zod.bag,u=(a.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;a.value{(a.inclusive?l.value<=a.value:l.value{pn.init(e,a);const i=eb[typeof a.value];e._zod.onattach.push(l=>{const s=l._zod.bag,u=(a.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;a.value>u&&(a.inclusive?s.minimum=a.value:s.exclusiveMinimum=a.value)}),e._zod.check=l=>{(a.inclusive?l.value>=a.value:l.value>a.value)||l.issues.push({origin:i,code:"too_small",minimum:typeof a.value=="object"?a.value.getTime():a.value,input:l.value,inclusive:a.inclusive,inst:e,continue:!a.abort})}}),U2=re("$ZodCheckMultipleOf",(e,a)=>{pn.init(e,a),e._zod.onattach.push(i=>{var l;(l=i._zod.bag).multipleOf??(l.multipleOf=a.value)}),e._zod.check=i=>{if(typeof i.value!=typeof a.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%a.value===BigInt(0):Hw(i.value,a.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:a.value,input:i.value,inst:e,continue:!a.abort})}}),H2=re("$ZodCheckNumberFormat",(e,a)=>{pn.init(e,a),a.format=a.format||"float64";const i=a.format?.includes("int"),l=i?"int":"number",[s,u]=Qw[a.format];e._zod.onattach.push(c=>{const d=c._zod.bag;d.format=a.format,d.minimum=s,d.maximum=u,i&&(d.pattern=M2)}),e._zod.check=c=>{const d=c.value;if(i){if(!Number.isInteger(d)){c.issues.push({expected:l,format:a.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?c.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:l,inclusive:!0,continue:!a.abort}):c.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:l,inclusive:!0,continue:!a.abort});return}}du&&c.issues.push({origin:"number",input:d,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!a.abort})}}),$2=re("$ZodCheckMaxLength",(e,a)=>{var i;pn.init(e,a),(i=e._zod.def).when??(i.when=l=>{const s=l.value;return!wh(s)&&s.length!==void 0}),e._zod.onattach.push(l=>{const s=l._zod.bag.maximum??Number.POSITIVE_INFINITY;a.maximum{const s=l.value;if(s.length<=a.maximum)return;const c=Eh(s);l.issues.push({origin:c,code:"too_big",maximum:a.maximum,inclusive:!0,input:s,inst:e,continue:!a.abort})}}),Z2=re("$ZodCheckMinLength",(e,a)=>{var i;pn.init(e,a),(i=e._zod.def).when??(i.when=l=>{const s=l.value;return!wh(s)&&s.length!==void 0}),e._zod.onattach.push(l=>{const s=l._zod.bag.minimum??Number.NEGATIVE_INFINITY;a.minimum>s&&(l._zod.bag.minimum=a.minimum)}),e._zod.check=l=>{const s=l.value;if(s.length>=a.minimum)return;const c=Eh(s);l.issues.push({origin:c,code:"too_small",minimum:a.minimum,inclusive:!0,input:s,inst:e,continue:!a.abort})}}),q2=re("$ZodCheckLengthEquals",(e,a)=>{var i;pn.init(e,a),(i=e._zod.def).when??(i.when=l=>{const s=l.value;return!wh(s)&&s.length!==void 0}),e._zod.onattach.push(l=>{const s=l._zod.bag;s.minimum=a.length,s.maximum=a.length,s.length=a.length}),e._zod.check=l=>{const s=l.value,u=s.length;if(u===a.length)return;const c=Eh(s),d=u>a.length;l.issues.push({origin:c,...d?{code:"too_big",maximum:a.length}:{code:"too_small",minimum:a.length},inclusive:!0,exact:!0,input:l.value,inst:e,continue:!a.abort})}}),Iu=re("$ZodCheckStringFormat",(e,a)=>{var i,l;pn.init(e,a),e._zod.onattach.push(s=>{const u=s._zod.bag;u.format=a.format,a.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(a.pattern))}),a.pattern?(i=e._zod).check??(i.check=s=>{a.pattern.lastIndex=0,!a.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:a.format,input:s.value,...a.pattern?{pattern:a.pattern.toString()}:{},inst:e,continue:!a.abort})}):(l=e._zod).check??(l.check=()=>{})}),)DELIM" -R"DELIM(P2=re("$ZodCheckRegex",(e,a)=>{Iu.init(e,a),e._zod.check=i=>{a.pattern.lastIndex=0,!a.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:a.pattern.toString(),inst:e,continue:!a.abort})}}),Q2=re("$ZodCheckLowerCase",(e,a)=>{a.pattern??(a.pattern=L2),Iu.init(e,a)}),F2=re("$ZodCheckUpperCase",(e,a)=>{a.pattern??(a.pattern=B2),Iu.init(e,a)}),Y2=re("$ZodCheckIncludes",(e,a)=>{pn.init(e,a);const i=Ku(a.includes),l=new RegExp(typeof a.position=="number"?`^.{${a.position}}${i}`:i);a.pattern=l,e._zod.onattach.push(s=>{const u=s._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),e._zod.check=s=>{s.value.includes(a.includes,a.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:a.includes,input:s.value,inst:e,continue:!a.abort})}}),G2=re("$ZodCheckStartsWith",(e,a)=>{pn.init(e,a);const i=new RegExp(`^${Ku(a.prefix)}.*`);a.pattern??(a.pattern=i),e._zod.onattach.push(l=>{const s=l._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=l=>{l.value.startsWith(a.prefix)||l.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:a.prefix,input:l.value,inst:e,continue:!a.abort})}}),K2=re("$ZodCheckEndsWith",(e,a)=>{pn.init(e,a);const i=new RegExp(`.*${Ku(a.suffix)}$`);a.pattern??(a.pattern=i),e._zod.onattach.push(l=>{const s=l._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=l=>{l.value.endsWith(a.suffix)||l.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:a.suffix,input:l.value,inst:e,continue:!a.abort})}}),V2=re("$ZodCheckOverwrite",(e,a)=>{pn.init(e,a),e._zod.check=i=>{i.value=a.tx(i.value)}});class X2{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if(typeof a=="function"){a(this,{execution:"sync"}),a(this,{execution:"async"});return}const l=a.split(` +`+o.stack}}var ya=Object.prototype.hasOwnProperty,Ut=e.unstable_scheduleCallback,ga=e.unstable_cancelCallback,Mr=e.unstable_shouldYield,hl=e.unstable_requestPaint,Jt=e.unstable_now,va=e.unstable_getCurrentPriorityLevel,Fa=e.unstable_ImmediatePriority,ml=e.unstable_UserBlockingPriority,Ya=e.unstable_NormalPriority,Yn=e.unstable_LowPriority,Cn=e.unstable_IdlePriority,rc=e.log,ic=e.unstable_setDisableYieldValue,ba=null,Wt=null;function Ht(t){if(typeof rc=="function"&&ic(t),Wt&&typeof Wt.setStrictMode=="function")try{Wt.setStrictMode(ba,t)}catch{}}var Gt=Math.clz32?Math.clz32:lc,Go=Math.log,Ko=Math.LN2;function lc(t){return t>>>=0,t===0?32:31-(Go(t)/Ko|0)|0}var kr=256,xa=262144,Dr=4194304;function Gn(t){var n=t&42;if(n!==0)return n;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function ci(t,n,r){var o=t.pendingLanes;if(o===0)return 0;var f=0,h=t.suspendedLanes,y=t.pingedLanes;t=t.warmLanes;var S=o&134217727;return S!==0?(o=S&~h,o!==0?f=Gn(o):(y&=S,y!==0?f=Gn(y):r||(r=S&~t,r!==0&&(f=Gn(r))))):(S=o&~h,S!==0?f=Gn(S):y!==0?f=Gn(y):r||(r=o&~t,r!==0&&(f=Gn(r)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,r=n&-n,h>=r||h===32&&(r&4194048)!==0)?n:f}function Ga(t,n){return(t)DELIM" +R"DELIM(.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function oc(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pl(){var t=Dr;return Dr<<=1,(Dr&62914560)===0&&(Dr=4194304),t}function Ka(t){for(var n=[],r=0;31>r;r++)n.push(t);return n}function aa(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Vo(t,n,r,o,f,h){var y=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var S=t.entanglements,A=t.expirationTimes,P=t.hiddenUpdates;for(r=y&~r;0"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var _a=/[\n"\\]/g;function tn(t){return t.replace(_a,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function yl(t,n,r,o,f,h,y,S){t.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?t.type=y:t.removeAttribute("type"),n!=null?y==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+ct(n)):t.value!==""+ct(n)&&(t.value=""+ct(n)):y!=="submit"&&y!=="reset"||t.removeAttribute("value"),n!=null?sc(t,y,ct(n)):r!=null?sc(t,y,ct(r)):o!=null&&t.removeAttribute("value"),f==null&&h!=null&&(t.defaultChecked=!!h),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+ct(S):t.removeAttribute("name")}function rm(t,n,r,o,f,h,y,S){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(t.type=h),n!=null||r!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){hi(t);return}r=r!=null?""+ct(r):"",n=n!=null?""+ct(n):r,S||n===t.value||(t.value=n),t.defaultValue=n}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,t.checked=S?t.checked:!!o,t.defaultChecked=!!o,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.name=y),hi(t)}function sc(t,n,r){n==="number"&&nt(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function pi(t,n,r,o){if(t=t.options,n){n={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hc=!1;if(Ta)try{var vl={};Object.defineProperty(vl,"passive",{get:function(){hc=!0}}),window.addEventListener("test",vl,vl),window.removeEventListener("test",vl,vl)}catch{hc=!1}var Xa=null,mc=null,Wo=null;function fm(){if(Wo)return Wo;var t,n=mc,r=n.length,o,f="value"in Xa?Xa.value:Xa.textContent,h=f.length;for(t=0;t=Sl),gm=" ",vm=!1;function bm(t,n){switch(t){case"keyup":return f1.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xm(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var bi=!1;function h1(t,n){switch(t){case"compositionend":return xm(n);case"keypress":return n.which!==32?null:(vm=!0,gm);case"textInput":return t=n.data,t===gm&&vm?null:t;default:return null}}function m1(t,n){if(bi)return t==="compositionend"||!bc&&bm(t,n)?(t=fm(),Wo=mc=Xa=null,bi=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:r,offset:n-t};t=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Am(r)}}function jm(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?jm(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function Nm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=nt(t.document);n instanceof t.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)t=n.contentWindow;else break;n=nt(t.document)}return n}function wc(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var w1=Ta&&"documentMode"in document&&11>=document.documentMode,xi=null,_c=null,Tl=null,Ec=!1;function Om(t,n,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ec||xi==null||xi!==nt(o)||(o=xi,"selectionStart"in o&&wc(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),Tl&&El(Tl,o)||(Tl=o,o=Ys(_c,"onSelect"),0>=y,f-=y,ra=1<<32-Gt(n)+f|r<Le?(qe=_e,_e=null):qe=_e.sibling;var Ie=Y(U,_e,q[Le],ee);if(Ie===null){_e===null&&(_e=qe);break}t&&_e&&Ie.alternate===null&&n(U,_e),M=h(Ie,M,Le),Xe===null?Ee=Ie:Xe.sibling=Ie,Xe=Ie,_e=qe}if(Le===q.length)return r(U,_e),Pe&&za(U,Le),Ee;if(_e===null){for(;LeLe?(qe=_e,_e=null):qe=_e.sibling;var vr=Y(U,_e,Ie.value,ee);if(vr===null){_e===null&&(_e=qe);break}t&&_e&&vr.alternate===null&&n(U,_e),M)DELIM" +R"DELIM(=h(vr,M,Le),Xe===null?Ee=vr:Xe.sibling=vr,Xe=vr,_e=qe}if(Ie.done)return r(U,_e),Pe&&za(U,Le),Ee;if(_e===null){for(;!Ie.done;Le++,Ie=q.next())Ie=ae(U,Ie.value,ee),Ie!==null&&(M=h(Ie,M,Le),Xe===null?Ee=Ie:Xe.sibling=Ie,Xe=Ie);return Pe&&za(U,Le),Ee}for(_e=o(_e);!Ie.done;Le++,Ie=q.next())Ie=V(_e,U,Le,Ie.value,ee),Ie!==null&&(t&&Ie.alternate!==null&&_e.delete(Ie.key===null?Le:Ie.key),M=h(Ie,M,Le),Xe===null?Ee=Ie:Xe.sibling=Ie,Xe=Ie);return t&&_e.forEach(function(qS){return n(U,qS)}),Pe&&za(U,Le),Ee}function ot(U,M,q,ee){if(typeof q=="object"&&q!==null&&q.type===T&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case _:e:{for(var Ee=q.key;M!==null;){if(M.key===Ee){if(Ee=q.type,Ee===T){if(M.tag===7){r(U,M.sibling),ee=f(M,q.props.children),ee.return=U,U=ee;break e}}else if(M.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===w&&Fr(Ee)===M.type){r(U,M.sibling),ee=f(M,q.props),Nl(ee,q),ee.return=U,U=ee;break e}r(U,M);break}else n(U,M);M=M.sibling}q.type===T?(ee=$r(q.props.children,U.mode,ee,q.key),ee.return=U,U=ee):(ee=us(q.type,q.key,q.props,null,U.mode,ee),Nl(ee,q),ee.return=U,U=ee)}return y(U);case z:e:{for(Ee=q.key;M!==null;){if(M.key===Ee)if(M.tag===4&&M.stateNode.containerInfo===q.containerInfo&&M.stateNode.implementation===q.implementation){r(U,M.sibling),ee=f(M,q.children||[]),ee.return=U,U=ee;break e}else{r(U,M);break}else n(U,M);M=M.sibling}ee=Nc(q,U.mode,ee),ee.return=U,U=ee}return y(U);case w:return q=Fr(q),ot(U,M,q,ee)}if(W(q))return we(U,M,q,ee);if(K(q)){if(Ee=K(q),typeof Ee!="function")throw Error(l(150));return q=Ee.call(q),Ae(U,M,q,ee)}if(typeof q.then=="function")return ot(U,M,ys(q),ee);if(q.$$typeof===ne)return ot(U,M,ds(U,q),ee);gs(U,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,M!==null&&M.tag===6?(r(U,M.sibling),ee=f(M,q),ee.return=U,U=ee):(r(U,M),ee=jc(q,U.mode,ee),ee.return=U,U=ee),y(U)):r(U,M)}return function(U,M,q,ee){try{jl=0;var Ee=ot(U,M,q,ee);return Ni=null,Ee}catch(_e){if(_e===ji||_e===ms)throw _e;var Xe=vn(29,_e,null,U.mode);return Xe.lanes=ee,Xe.return=U,Xe}}}var Gr=tp(!0),np=tp(!1),tr=!1;function Pc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qc(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function nr(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ar(t,n,r){var o=t.updateQueue;if(o===null)return null;if(o=o.shared,(We&2)!==0){var f=o.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),o.pending=n,n=ss(t),Hm(t,null,r),n}return os(t,o,n,r),ss(t)}function Ol(t,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,Io(t,r)}}function Fc(t,n){var r=t.updateQueue,o=t.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var f=null,h=null;if(r=r.firstBaseUpdate,r!==null){do{var y={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};h===null?f=h=y:h=h.next=y,r=r.next}while(r!==null);h===null?f=h=n:h=h.next=n}else f=h=n;r={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:o.shared,callbacks:o.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=n:t.next=n,r.lastBaseUpdate=n}var Yc=!1;function Ml(){if(Yc){var t=Ci;if(t!==null)throw t}}function kl(t,n,r,o){Yc=!1;var f=t.updateQueue;tr=!1;var h=f.firstBaseUpdate,y=f.lastBaseUpdate,S=f.shared.pending;if(S!==null){f.shared.pending=null;var A=S,P=A.next;A.next=null,y===null?h=P:y.next=P,y=A;var J=t.alternate;J!==null&&(J=J.updateQueue,S=J.lastBaseUpdate,S!==y&&(S===null?J.firstBaseUpdate=P:S.next=P,J.lastBaseUpdate=A))}if(h!==null){var ae=f.baseState;y=0,J=P=A=null,S=h;do{var Y=S.lane&-536870913,V=Y!==S.lane;if(V?(Ze&Y)===Y:(o&Y)===Y){Y!==0&&Y===Ai&&(Yc=!0),J!==null&&(J=J.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var we=t,Ae=S;Y=n;var ot=r;switch(Ae.tag){case 1:if(we=Ae.payload,typeof we=="function"){ae=we.call(ot,ae,Y);break e}ae=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ae.payload,Y=typeof we=="function"?we.call(ot,ae,Y):we,Y==null)break e;ae=g({},ae,Y);break e;case 2:tr=!0}}Y=S.callback,Y!==null&&(t.flags|=64,V&&(t.flags|=8192),V=f.callbacks,V===null?f.callbacks=[Y]:V.push(Y))}else V={lane:Y,tag:S.tag,payload:S.payload,callback:S.callback,next:null},J===null?(P=J=V,A=ae):J=J.next=V,y|=Y;if(S=S.next,S===null){if(S=f.shared.pending,S===null)break;V=S,S=V.next,V.next=null,f.lastBaseUpdate=V,f.shared.pending=null}}while(!0);J===null&&(A=ae),f.baseState=A,f.firstBaseUpdate=P,f.lastBaseUpdate=J,h===null&&(f.shared.lanes=0),sr|=y,t.lanes=y,t.memoizedState=ae}}function ap(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function rp(t,n){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;th?h:8;var y=N.T,S={};N.T=S,df(t,!1,n,r);try{var A=f(),P=N.S;if(P!==null&&P(S,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var J=N1(A,o);Bl(t,n,J,_n(t))}else Bl(t,n,o,_n(t))}catch(ae){Bl(t,n,{then:function(){},status:"rejected",reason:ae},_n())}finally{B.p=h,y!==null&&S.types!==null&&(y.types=S.types),N.T=y}}function B1(){}function cf(t,n,r,o){if(t.tag!==5)throw Error(l(476));var f=Lp(t).queue;Dp(t,f,n,ue,r===null?B1:function(){return Bp(t),r(o)})}function Lp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ue,baseState:ue,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:ue},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:r},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Bp(t){var n=Lp(t);n.next===null&&(n=t.alternate.memoizedState),Bl(t,n.next.queue,{},_n())}function ff(){return qt(eo)}function Up(){return Rt().memoizedState}function Hp(){return Rt().memoizedState}function U1(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var r=_n();t=nr(r);var o=ar(n,t,r);o!==null&&(hn(o,n,r),Ol(o,n,r)),n={cache:Hc()},t.payload=n;return}n=n.return}}function H1(t,n,r){var o=_n();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},zs(t)?Zp(n,r):(r=Ac(t,n,r,o),r!==null&&(hn(r,t,o),qp(r,n,o)))}function $p(t,n,r){var o=_n();Bl(t,n,r,o)}function Bl(t,n,r,o){var f={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(zs(t))Zp(n,f);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,S=h(y,r);if(f.hasEagerState=!0,f.eagerState=S,gn(S,y))return os(t,n,f,0),ft===null&&ls(),!1}catch{}if(r=Ac(t,n,f,o),r!==null)return hn(r,t,o),qp(r,n,o),!0}return!1}function df(t,n,r,o){if(o={lane:2,revertLane:Qf(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},zs(t)){if(n)throw Error(l(479))}else n=Ac(t,r,o,2),n!==null&&hn(n,t,2)}function zs(t){var n=t.alternate;return t===De||n!==null&&n===De}function Zp(t,n){Mi=xs=!0;var r=t.pending;r===null?n.next=n:(n.next=r.next,r.next=n),t.pending=n}function qp(t,n,r){if((r&4194048)!==0){var o=n.lanes;o&=t.pendingLanes,r|=o,n.lanes=r,Io(t,r)}}var Ul={readContext:qt,use:_s,useCallback:St,useContext:St,useEffect:St,useImperativeHandle:St,useLayoutEffect:St,useInsertionEffect:St,useMemo:St,useReducer:St,useRef:St,useState:St,useDebugValue:St,useDeferredValue:St,useTransition:St,useSyncExternalStore:St,useId:St,useHostTransitionStatus:St,useFormState:St,useActionState:St,useOptimistic:St,useMemoCache:St,useCacheRefresh:St};Ul.useEffectEvent=St;var Pp={readContext:qt,use:_s,useCallback:function(t,n){return nn().memoizedState=[t,n===void 0?null:n],t},useContext:qt,useEffect:Rp,useImperativeHandle:function(t,n,r){r=r!=null?r.concat([t]):null,Ts(4194308,4,jp.bind(null,n,t),r)},useLayoutEffect:function(t,n){return Ts(4194308,4,t,n)},useInsertionEffect:function(t,n){Ts(4,2,t,n)},useMemo:function(t,n){var r=nn();n=n===void 0?null:n;var o=t();if(Kr){Ht(!0);try{t()}finally{Ht(!1)}}return r.memoizedState=[o,n],o},useReducer:function(t,n,r){var o=nn();if(r!==void 0){var f=r(n);if(Kr){Ht(!0);try{r(n)}finally{Ht(!1)}}}else f=n;return o.memoizedState=o.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},o.queue=t,t=t.dispatch=H1.bind(null,De,t),[o.memoizedState,t]},useRef:function(t){var n=nn();return t={current:t},n.memoizedState=t},useState:function(t){t=rf(t);var n=t.queue,r=$p.bind(null,De,n);return n.dispatch=r,[t.memoizedState,r]},useDebugValue:sf,useDeferredValue:function(t,n){var r=nn();return uf(r,t,n)},useTransition:function(){var t=rf(!1);return t=Dp.bind(null,De,t.queue,!0,!1),nn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,r){var o=De,f=nn();if(Pe){if(r===void 0)throw Error(l(407));r=r()}else{if(r=n(),ft===null)throw Error(l(349));(Ze&127)!==0||cp(o,n,r)}f.memoizedState=r;var h={value:r,getSnapshot:n};return f.queue=h,)DELIM" +R"DELIM(Rp(dp.bind(null,o,h,t),[t]),o.flags|=2048,Di(9,{destroy:void 0},fp.bind(null,o,h,r,n),null),r},useId:function(){var t=nn(),n=ft.identifierPrefix;if(Pe){var r=ia,o=ra;r=(o&~(1<<32-Gt(o)-1)).toString(32)+r,n="_"+n+"R_"+r,r=Ss++,0<\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof o.is=="string"?y.createElement("select",{is:o.is}):y.createElement("select"),o.multiple?h.multiple=!0:o.size&&(h.size=o.size);break;default:h=typeof o.is=="string"?y.createElement(f,{is:o.is}):y.createElement(f)}}h[pe]=n,h[ve]=o;e:for(y=n.child;y!==null;){if(y.tag===5||y.tag===6)h.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===n)break e;for(;y.sibling===null;){if(y.return===null||y.return===n)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}n.stateNode=h;e:switch(Qt(h,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Ma(n)}}return pt(n),Rf(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,r),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==o&&Ma(n);else{if(typeof o!="string"&&n.stateNode===null)throw Error(l(166));if(t=fe.current,Ri(n)){if(t=n.stateNode,r=n.memoizedProps,o=null,f=Zt,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}t[pe]=n,t=!!(t.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||sg(t.nodeValue,r)),t||Wa(n,!0)}else t=Gs(t).createTextNode(o),t[pe]=n,n.stateNode=t}return pt(n),null;case 31:if(r=n.memoizedState,t===null||t.memoizedState!==null){if(o=Ri(n),r!==null){if(t===null){if(!o)throw Error(l(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[pe]=n}else Zr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;pt(n),t=!1}else r=Dc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return n.flags&256?(xn(n),n):(xn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return pt(n),null;case 13:if(o=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=Ri(n),o!==null&&o.dehydrated!==null){if(t===null){if(!f)throw Error(l(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[pe]=n}else Zr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;pt(n),f=!1}else f=Dc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(xn(n),n):(xn(n),null)}return xn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=o!==null,t=t!==null&&t.memoizedState!==null,r&&(o=n.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),h=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(h=o.memoizedState.cachePool.pool),h!==f&&(o.flags|=2048)),r!==t&&r&&(n.child.flags|=8192),Os(n,n.updateQueue),pt(n),null);case 4:return be(),t===null&&Kf(n.stateNode.containerInfo),pt(n),null;case 10:return Ca(n.type),pt(n),null;case 19:if(C(Tt),o=n.memoizedState,o===null)return pt(n),null;if(f=(n.flags&128)!==0,h=o.rendering,h===null)if(f)$l(o,!1);else{if(wt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(h=bs(t),h!==null){for(n.flags|=128,$l(o,!1),t=h.updateQueue,n.updateQueue=t,Os(n,t),n.subtreeFlags=0,t=r,r=n.child;r!==null;)$m(r,t),r=r.sibling;return $(Tt,Tt.current&1|2),Pe&&za(n,o.treeForkCount),n.child}t=t.sibling}o.tail!==null&&Jt()>Bs&&(n.flags|=128,f=!0,$l(o,!1),n.lanes=4194304)}else{if(!f)if(t=bs(h),t!==null){if(n.flags|=128,f=!0,t=t.updateQueue,n.updateQueue=t,Os(n,t),$l(o,!0),o.tail===null&&o.tailMode==="hidden"&&!h.alternate&&!Pe)return pt(n),null}else 2*Jt()-o.renderingStartTime>Bs&&r!==536870912&&(n.flags|=128,f=!0,$l(o,!1),n.lanes=4194304);o.isBackwards?(h.sibling=n.child,n.child=h):(t=o.last,t!==null?t.sibling=h:n.child=h,o.last=h)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Jt(),t.sibling=null,r=Tt.current,$(Tt,f?r&1|2:r&1),Pe&&za(n,o.treeForkCount),t):(pt(n),null);case 22:case 23:return xn(n),Kc(),o=n.memoizedState!==null,t!==null?t.memoizedState!==null!==o&&(n.flags|=8192):o&&(n.flags|=8192),o?(r&536870912)!==0&&(n.flags&128)===0&&(pt(n),n.subtreeFlags&6&&(n.flags|=8192)):pt(n),r=n.updateQueue,r!==null&&Os(n,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),o=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),o!==r&&(n.flags|=2048),t!==null&&C(Qr),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),Ca(Nt),pt(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function Q1(t,n){switch(Mc(n),n.tag){case 1:return )DELIM" +R"DELIM(t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Ca(Nt),be(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return dt(n),null;case 31:if(n.memoizedState!==null){if(xn(n),n.alternate===null)throw Error(l(340));Zr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(xn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));Zr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return C(Tt),null;case 4:return be(),null;case 10:return Ca(n.type),null;case 22:case 23:return xn(n),Kc(),t!==null&&C(Qr),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Ca(Nt),null;case 25:return null;default:return null}}function hy(t,n){switch(Mc(n),n.tag){case 3:Ca(Nt),be();break;case 26:case 27:case 5:dt(n);break;case 4:be();break;case 31:n.memoizedState!==null&&xn(n);break;case 13:xn(n);break;case 19:C(Tt);break;case 10:Ca(n.type);break;case 22:case 23:xn(n),Kc(),t!==null&&C(Qr);break;case 24:Ca(Nt)}}function Zl(t,n){try{var r=n.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var f=o.next;r=f;do{if((r.tag&t)===t){o=void 0;var h=r.create,y=r.inst;o=h(),y.destroy=o}r=r.next}while(r!==f)}}catch(S){rt(n,n.return,S)}}function lr(t,n,r){try{var o=n.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var h=f.next;o=h;do{if((o.tag&t)===t){var y=o.inst,S=y.destroy;if(S!==void 0){y.destroy=void 0,f=n;var A=r,P=S;try{P()}catch(J){rt(f,A,J)}}}o=o.next}while(o!==h)}}catch(J){rt(n,n.return,J)}}function my(t){var n=t.updateQueue;if(n!==null){var r=t.stateNode;try{rp(n,r)}catch(o){rt(t,t.return,o)}}}function py(t,n,r){r.props=Vr(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(o){rt(t,n,o)}}function ql(t,n){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var o=t.stateNode;break;case 30:o=t.stateNode;break;default:o=t.stateNode}typeof r=="function"?t.refCleanup=r(o):r.current=o}}catch(f){rt(t,n,f)}}function la(t,n){var r=t.ref,o=t.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(f){rt(t,n,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(f){rt(t,n,f)}else r.current=null}function yy(t){var n=t.type,r=t.memoizedProps,o=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(f){rt(t,t.return,f)}}function zf(t,n,r){try{var o=t.stateNode;dS(o,t.type,r,n),o[ve]=n}catch(f){rt(t,t.return,f)}}function gy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&hr(t.type)||t.tag===4}function Af(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||gy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&hr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Cf(t,n,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(t),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=Ea));else if(o!==4&&(o===27&&hr(t.type)&&(r=t.stateNode,n=null),t=t.child,t!==null))for(Cf(t,n,r),t=t.sibling;t!==null;)Cf(t,n,r),t=t.sibling}function Ms(t,n,r){var o=t.tag;if(o===5||o===6)t=t.stateNode,n?r.insertBefore(t,n):r.appendChild(t);else if(o!==4&&(o===27&&hr(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(Ms(t,n,r),t=t.sibling;t!==null;)Ms(t,n,r),t=t.sibling}function vy(t){var n=t.stateNode,r=t.memoizedProps;try{for(var o=t.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Qt(n,o,r),n[pe]=t,n[ve]=r}catch(h){rt(t,t.return,h)}}var ka=!1,kt=!1,jf=!1,by=typeof WeakSet=="function"?WeakSet:Set,$t=null;function F1(t,n){if(t=t.containerInfo,If=eu,t=Nm(t),wc(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var f=o.anchorOffset,h=o.focusNode;o=o.focusOffset;try{r.nodeType,h.nodeType}catch{r=null;break e}var y=0,S=-1,A=-1,P=0,J=0,ae=t,Y=null;t:for(;;){for(var V;ae!==r||f!==0&&ae.nodeType!==3||(S=y+f),ae!==h||o!==0&&ae.nodeType!==3||(A=y+o),ae.nodeType===3&&(y+=ae.nodeValue.length),(V=ae.firstChild)!==null;)Y=ae,ae=V;for(;;){if(ae===t)break t;if(Y===r&&++P===f&&(S=y),Y===h&&++J===o&&(A=y),(V=ae.nextSibling)!==null)break;ae=Y,Y=ae.parentNode}ae=V}r=S===-1||A===-1?null:{start:S,end:A}}else r=null}r=r||{start:0,end:0}}else r=null;for(Jf={focusedElem:t,selectionRange:r},eu=!1,$t=n;$t!==null;)if(n=$t,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,$t=t;else for(;$t!==null;){switch(n=$t,h=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r title"))),Qt(h,o,r),h[pe]=t,Ye(h),o=h;break e;case"link":var y=Tg("link","href",f).get(o+(r.href||""));if(y){for(var S=0;Sot&&(y=ot,ot=Ae,Ae=y);var U=Cm(S,Ae),M=Cm(S,ot);if(U&&M&&(V.rangeCount!==1||V.anchorNode!==U.node||V.anchorOffset!==U.offset||V.focusNode!==M.node||V.focusOffset!==M.offset)){var q=ae.createRange();q.setStart(U.node,U.offset),V.removeAllRanges(),Ae>ot?(V.addRange(q),V.extend(M.node,M.offset)):(q.setEnd(M.node,M.offset),V.addRange(q))}}}}for(ae=[],V=S;V=V.parentNode;)V.nodeType===1&&ae.push({element:V,left:V.scrollLeft,top:V.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;Sr?32:r,N.T=null,r=Bf,Bf=null;var h=cr,y=Ha;if(Bt=0,$i=cr=null,Ha=0,(We&6)!==0)throw Error(l(331));var S=We;if(We|=4,jy(h.current),zy(h,h.current,y,r),We=S,Kl(0,!1),Wt&&typeof Wt.onPostCommitFiberRoot=="function")try{Wt.onPostCommitFiberRoot(ba,h)}catch{}return!0}finally{B.p=f,N.T=o,Ky(t,n)}}function Xy(t,n,r){n=On(r,n),n=yf(t.stateNode,n,2),t=ar(t,n,2),t!==null&&(aa(t,2),oa(t))}function rt(t,n,r){if(t.tag===3)Xy(t,t,r);else for(;n!==null;){if(n.tag===3){Xy(n,t,r);break}else if(n.tag===1){var o=n.stateNode;if(typeof )DELIM" +R"DELIM(n.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(ur===null||!ur.has(o))){t=On(r,t),r=Ip(2),o=ar(n,r,2),o!==null&&(Jp(r,o,n,t),aa(o,2),oa(o));break}}n=n.return}}function Zf(t,n,r){var o=t.pingCache;if(o===null){o=t.pingCache=new K1;var f=new Set;o.set(n,f)}else f=o.get(n),f===void 0&&(f=new Set,o.set(n,f));f.has(r)||(Mf=!0,f.add(r),t=W1.bind(null,t,n,r),n.then(t,t))}function W1(t,n,r){var o=t.pingCache;o!==null&&o.delete(n),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,ft===t&&(Ze&r)===r&&(wt===4||wt===3&&(Ze&62914560)===Ze&&300>Jt()-Ls?(We&2)===0&&Zi(t,0):kf|=r,Hi===Ze&&(Hi=0)),oa(t)}function Iy(t,n){n===0&&(n=pl()),t=Hr(t,n),t!==null&&(aa(t,n),oa(t))}function eS(t){var n=t.memoizedState,r=0;n!==null&&(r=n.retryLane),Iy(t,r)}function tS(t,n){var r=0;switch(t.tag){case 31:case 13:var o=t.stateNode,f=t.memoizedState;f!==null&&(r=f.retryLane);break;case 19:o=t.stateNode;break;case 22:o=t.stateNode._retryCache;break;default:throw Error(l(314))}o!==null&&o.delete(n),Iy(t,r)}function nS(t,n){return Ut(t,n)}var Ps=null,Pi=null,qf=!1,Qs=!1,Pf=!1,dr=0;function oa(t){t!==Pi&&t.next===null&&(Pi===null?Ps=Pi=t:Pi=Pi.next=t),Qs=!0,qf||(qf=!0,rS())}function Kl(t,n){if(!Pf&&Qs){Pf=!0;do for(var r=!1,o=Ps;o!==null;){if(t!==0){var f=o.pendingLanes;if(f===0)var h=0;else{var y=o.suspendedLanes,S=o.pingedLanes;h=(1<<31-Gt(42|t)+1)-1,h&=f&~(y&~S),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(r=!0,tg(o,h))}else h=Ze,h=ci(o,o===ft?h:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(h&3)===0||Ga(o,h)||(r=!0,tg(o,h));o=o.next}while(r);Pf=!1}}function aS(){Jy()}function Jy(){Qs=qf=!1;var t=0;dr!==0&&mS()&&(t=dr);for(var n=Jt(),r=null,o=Ps;o!==null;){var f=o.next,h=Wy(o,n);h===0?(o.next=null,r===null?Ps=f:r.next=f,f===null&&(Pi=r)):(r=o,(t!==0||(h&3)!==0)&&(Qs=!0)),o=f}Bt!==0&&Bt!==5||Kl(t),dr!==0&&(dr=0)}function Wy(t,n){for(var r=t.suspendedLanes,o=t.pingedLanes,f=t.expirationTimes,h=t.pendingLanes&-62914561;0S)break;var J=A.transferSize,ae=A.initiatorType;J&&ug(ae)&&(A=A.responseEnd,y+=J*(A"u"?null:document;function Sg(t,n,r){var o=Qi;if(o&&typeof n=="string"&&n){var f=tn(n);f='link[rel="'+t+'"][href="'+f+'"]',typeof r=="string"&&(f+='[crossorigin="'+r+'"]'),xg.has(f)||(xg.add(f),t={rel:t,crossOrigin:r,href:n},o.querySelector(f)===null&&(n=o.createElement("link"),Qt(n,"link",t),Ye(n),o.head.appendChild(n)))}}function _S(t){$a.D(t),Sg("dns-prefetch",t,null)}function ES(t,n){$a.C(t,n),Sg("preconnect",t,n)}function TS(t,n,r){$a.L(t,n,r);var o=Qi;if(o&&t&&n){var f='link[rel="preload"][as="'+tn(n)+'"]';n==="image"&&r&&r.imageSrcSet?(f+='[imagesrcset="'+tn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(f+='[imagesizes="'+tn(r.imageSizes)+'"]')):f+='[href="'+tn(t)+'"]';var h=f;switch(n){case"style":h=Fi(t);break;case"script":h=Yi(t)}Un.has(h)||(t=g({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:t,as:n},r),Un.set(h,t),o.querySelector(f)!==null||n==="style"&&o.querySelector(Jl(h))||n==="script"&&o.querySelector(Wl(h))||(n=o.createElement("link"),Qt(n,"link",t),Ye(n),o.head.appendChild(n)))}}function RS(t,n){$a.m(t,n);var r=Qi;if(r&&t){var o=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modu)DELIM" +R"DELIM(lepreload"][as="'+tn(o)+'"][href="'+tn(t)+'"]',h=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Yi(t)}if(!Un.has(h)&&(t=g({rel:"modulepreload",href:t},n),Un.set(h,t),r.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Wl(h)))return}o=r.createElement("link"),Qt(o,"link",t),Ye(o),r.head.appendChild(o)}}}function zS(t,n,r){$a.S(t,n,r);var o=Qi;if(o&&t){var f=Et(o).hoistableStyles,h=Fi(t);n=n||"default";var y=f.get(h);if(!y){var S={loading:0,preload:null};if(y=o.querySelector(Jl(h)))S.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":n},r),(r=Un.get(h))&&id(t,r);var A=y=o.createElement("link");Ye(A),Qt(A,"link",t),A._p=new Promise(function(P,J){A.onload=P,A.onerror=J}),A.addEventListener("load",function(){S.loading|=1}),A.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Vs(y,n,o)}y={type:"stylesheet",instance:y,count:1,state:S},f.set(h,y)}}}function AS(t,n){$a.X(t,n);var r=Qi;if(r&&t){var o=Et(r).hoistableScripts,f=Yi(t),h=o.get(f);h||(h=r.querySelector(Wl(f)),h||(t=g({src:t,async:!0},n),(n=Un.get(f))&&ld(t,n),h=r.createElement("script"),Ye(h),Qt(h,"link",t),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(f,h))}}function CS(t,n){$a.M(t,n);var r=Qi;if(r&&t){var o=Et(r).hoistableScripts,f=Yi(t),h=o.get(f);h||(h=r.querySelector(Wl(f)),h||(t=g({src:t,async:!0,type:"module"},n),(n=Un.get(f))&&ld(t,n),h=r.createElement("script"),Ye(h),Qt(h,"link",t),r.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},o.set(f,h))}}function wg(t,n,r,o){var f=(f=fe.current)?Ks(f):null;if(!f)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=Fi(r.href),r=Et(f).hoistableStyles,o=r.get(n),o||(o={type:"style",instance:null,count:0,state:null},r.set(n,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Fi(r.href);var h=Et(f).hoistableStyles,y=h.get(t);if(y||(f=f.ownerDocument||f,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(t,y),(h=f.querySelector(Jl(t)))&&!h._p&&(y.instance=h,y.state.loading=5),Un.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Un.set(t,r),h||jS(f,t,r,y.state))),n&&o===null)throw Error(l(528,""));return y}if(n&&o!==null)throw Error(l(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=Yi(r),r=Et(f).hoistableScripts,o=r.get(n),o||(o={type:"script",instance:null,count:0,state:null},r.set(n,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Fi(t){return'href="'+tn(t)+'"'}function Jl(t){return'link[rel="stylesheet"]['+t+"]"}function _g(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function jS(t,n,r,o){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?o.loading=1:(n=t.createElement("link"),o.preload=n,n.addEventListener("load",function(){return o.loading|=1}),n.addEventListener("error",function(){return o.loading|=2}),Qt(n,"link",r),Ye(n),t.head.appendChild(n))}function Yi(t){return'[src="'+tn(t)+'"]'}function Wl(t){return"script[async]"+t}function Eg(t,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var o=t.querySelector('style[data-href~="'+tn(r.href)+'"]');if(o)return n.instance=o,Ye(o),o;var f=g({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(t.ownerDocument||t).createElement("style"),Ye(o),Qt(o,"style",f),Vs(o,r.precedence,t),n.instance=o;case"stylesheet":f=Fi(r.href);var h=t.querySelector(Jl(f));if(h)return n.state.loading|=4,n.instance=h,Ye(h),h;o=_g(r),(f=Un.get(f))&&id(o,f),h=(t.ownerDocument||t).createElement("link"),Ye(h);var y=h;return y._p=new Promise(function(S,A){y.onload=S,y.onerror=A}),Qt(h,"link",o),n.state.loading|=4,Vs(h,r.precedence,t),n.instance=h;case"script":return h=Yi(r.src),(f=t.querySelector(Wl(h)))?(n.instance=f,Ye(f),f):(o=r,(f=Un.get(h))&&(o=g({},r),ld(o,f)),t=t.ownerDocument||t,f=t.createElement("script"),Ye(f),Qt(f,"link",o),t.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(o=n.instance,n.state.loading|=4,Vs(o,r.precedence,t));return n.instance}function Vs(t,n,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,h=f,y=0;y title"):null)}function NS(t,n,r){if(r===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(t=n.disabled,typeof n.precedence=="string"&&t==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function zg(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function OS(t,n,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=Fi(o.href),h=n.querySelector(Jl(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Is.bind(t),n.then(t,t)),r.state.loading|=4,r.instance=h,Ye(h);return}h=n.ownerDocument||n,o=_g(o),(f=Un.get(f))&&id(o,f),h=h.createElement("link"),Ye(h);var y=h;y._p=new Promise(function(S,A){y.onload=S,y.onerror=A}),Qt(h,"link",o),r.instance=h}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Is.bind(t),n.addEventListener("load",r),n.addEventListener("error",r))}}var od=0;function MS(t,n){return t.stylesheets&&t.count===0&&Ws(t,t.stylesheets),0od?50:800)+n);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function Is(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ws(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Js=null;function Ws(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Js=new Map,n.forEach(kS,t),Js=null,Is.call(t))}function kS(t,n){if(!(n.state.loading&4)){var r=Js.get(t);if(r)var o=r.get(null);else{r=new Map,Js.set(t,r);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(a){console.error(a)}}return e(),yd.exports=IS(),yd.exports}var WS=JS();const ew=hh(WS);var Do=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tw=class extends Do{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const a=()=>e();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=v)DELIM" +R"DELIM(oid 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(a=>{a(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ph=new tw,nw={setTimeout:(e,a)=>setTimeout(e,a),clearTimeout:e=>clearTimeout(e),setInterval:(e,a)=>setInterval(e,a),clearInterval:e=>clearInterval(e)},aw=class{#e=nw;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,a){return this.#e.setTimeout(e,a)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,a){return this.#e.setInterval(e,a)}clearInterval(e){this.#e.clearInterval(e)}},ti=new aw;function rw(e){setTimeout(e,0)}var iw=typeof window>"u"||"Deno"in globalThis;function mn(){}function lw(e,a){return typeof e=="function"?e(a):e}function Fd(e){return typeof e=="number"&&e>=0&&e!==1/0}function k0(e,a){return Math.max(e+(a||0)-Date.now(),0)}function Cr(e,a){return typeof e=="function"?e(a):e}function En(e,a){return typeof e=="function"?e(a):e}function Ig(e,a){const{type:i="all",exact:l,fetchStatus:s,predicate:u,queryKey:c,stale:d}=e;if(c){if(l){if(a.queryHash!==yh(c,a.options))return!1}else if(!_o(a.queryKey,c))return!1}if(i!=="all"){const m=a.isActive();if(i==="active"&&!m||i==="inactive"&&m)return!1}return!(typeof d=="boolean"&&a.isStale()!==d||s&&s!==a.state.fetchStatus||u&&!u(a))}function Jg(e,a){const{exact:i,status:l,predicate:s,mutationKey:u}=e;if(u){if(!a.options.mutationKey)return!1;if(i){if(wo(a.options.mutationKey)!==wo(u))return!1}else if(!_o(a.options.mutationKey,u))return!1}return!(l&&a.state.status!==l||s&&!s(a))}function yh(e,a){return(a?.queryKeyHashFn||wo)(e)}function wo(e){return JSON.stringify(e,(a,i)=>Gd(i)?Object.keys(i).sort().reduce((l,s)=>(l[s]=i[s],l),{}):i)}function _o(e,a){return e===a?!0:typeof e!=typeof a?!1:e&&a&&typeof e=="object"&&typeof a=="object"?Object.keys(a).every(i=>_o(e[i],a[i])):!1}var ow=Object.prototype.hasOwnProperty;function D0(e,a,i=0){if(e===a)return e;if(i>500)return a;const l=Wg(e)&&Wg(a);if(!l&&!(Gd(e)&&Gd(a)))return a;const u=(l?e:Object.keys(e)).length,c=l?a:Object.keys(a),d=c.length,m=l?new Array(d):{};let p=0;for(let b=0;b{ti.setTimeout(a,e)})}function Kd(e,a,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,a):i.structuralSharing!==!1?D0(e,a):a}function uw(e,a,i=0){const l=[...e,a];return i&&l.length>i?l.slice(1):l}function cw(e,a,i=0){const l=[a,...e];return i&&l.length>i?l.slice(0,-1):l}var gh=Symbol();function L0(e,a){return!e.queryFn&&a?.initialPromise?()=>a.initialPromise:!e.queryFn||e.queryFn===gh?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function B0(e,a){return typeof e=="function"?e(...a):!!e}function fw(e,a,i){let l=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=a(),l||(l=!0,s.aborted?i():s.addEventListener("abort",i,{once:!0})),s)}),e}var Eo=(()=>{let e=()=>iw;return{isServer(){return e()},setIsServer(a){e=a}}})();function Vd(){let e,a;const i=new Promise((s,u)=>{e=s,a=u});i.status="pending",i.catch(()=>{});function l(s){Object.assign(i,s),delete i.resolve,delete i.reject}return i.resolve=s=>{l({status:"fulfilled",value:s}),e(s)},i.reject=s=>{l({status:"rejected",reason:s}),a(s)},i}var dw=rw;function hw(){let e=[],a=0,i=d=>{d()},l=d=>{d()},s=dw;const u=d=>{a?e.push(d):s(()=>{i(d)})},c=()=>{const d=e;e=[],d.length&&s(()=>{l(()=>{d.forEach(m=>{i(m)})})})};return{batch:d=>{let m;a++;try{m=d()}finally{a--,a||c()}return m},batchCalls:d=>(...m)=>{u(()=>{d(...m)})},schedule:u,setNotifyFunction:d=>{i=d},setBatchNotifyFunction:d=>{l=d},setScheduler:d=>{s=d}}}var Ft=hw(),mw=class extends Do{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const a=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",i)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(t)DELIM" +R"DELIM(his.#e=e,this.listeners.forEach(i=>{i(e)}))}isOnline(){return this.#e}},Nu=new mw;function pw(e){return Math.min(1e3*2**e,3e4)}function U0(e){return(e??"online")==="online"?Nu.isOnline():!0}var Xd=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function H0(e){let a=!1,i=0,l;const s=Vd(),u=()=>s.status!=="pending",c=T=>{if(!u()){const k=new Xd(T);x(k),e.onCancel?.(k)}},d=()=>{a=!0},m=()=>{a=!1},p=()=>ph.isFocused()&&(e.networkMode==="always"||Nu.isOnline())&&e.canRun(),b=()=>U0(e.networkMode)&&e.canRun(),g=T=>{u()||(l?.(),s.resolve(T))},x=T=>{u()||(l?.(),s.reject(T))},_=()=>new Promise(T=>{l=k=>{(u()||p())&&T(k)},e.onPause?.()}).then(()=>{l=void 0,u()||e.onContinue?.()}),z=()=>{if(u())return;let T;const k=i===0?e.initialPromise:void 0;try{T=k??e.fn()}catch(Z){T=Promise.reject(Z)}Promise.resolve(T).then(g).catch(Z=>{if(u())return;const X=e.retry??(Eo.isServer()?0:3),ne=e.retryDelay??pw,se=typeof ne=="function"?ne(i,Z):ne,te=X===!0||typeof X=="number"&&ip()?void 0:_()).then(()=>{a?x(Z):z()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(l?.(),s),cancelRetry:d,continueRetry:m,canStart:b,start:()=>(b()?z():_().then(z),s)}}var $0=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Fd(this.gcTime)&&(this.#e=ti.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Eo.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(ti.clearTimeout(this.#e),this.#e=void 0)}};function yw(e){return{onFetch:(a,i)=>{const l=a.options,s=a.fetchOptions?.meta?.fetchMore?.direction,u=a.state.data?.pages||[],c=a.state.data?.pageParams||[];let d={pages:[],pageParams:[]},m=0;const p=async()=>{let b=!1;const g=z=>{fw(z,()=>a.signal,()=>b=!0)},x=L0(a.options,a.fetchOptions),_=async(z,T,k)=>{if(b)return Promise.reject(a.signal.reason);if(T==null&&z.pages.length)return Promise.resolve(z);const X=(()=>{const xe={client:a.client,queryKey:a.queryKey,pageParam:T,direction:k?"backward":"forward",meta:a.options.meta};return g(xe),xe})(),ne=await x(X),{maxPages:se}=a.options,te=k?cw:uw;return{pages:te(z.pages,ne,se),pageParams:te(z.pageParams,T,se)}};if(s&&u.length){const z=s==="backward",T=z?gw:tv,k={pages:u,pageParams:c},Z=T(l,k);d=await _(k,Z,z)}else{const z=e??u.length;do{const T=m===0?c[0]??l.initialPageParam:tv(l,d);if(m>0&&T==null)break;d=await _(d,T),m++}while(ma.options.persister?.(p,{client:a.client,queryKey:a.queryKey,meta:a.options.meta,signal:a.signal},i):a.fetchFn=p}}}function tv(e,{pages:a,pageParams:i}){const l=a.length-1;return a.length>0?e.getNextPageParam(a[l],a,i[l],i):void 0}function gw(e,{pages:a,pageParams:i}){return a.length>0?e.getPreviousPageParam?.(a[0],a,i[0],i):void 0}var vw=class extends $0{#e;#t;#n;#a;#i;#r;#o;#l;constructor(e){super(),this.#l=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#a=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=av(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const a=av(this.options);a.data!==void 0&&(this.setState(nv(a.data,a.dataUpdatedAt)),this.#t=a)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#a.remove(this)}setData(e,a){const i=Kd(this.state.data,e,this.options);return this.#s({data:i,type:"success",dataUpdatedAt:a?.updatedAt,manual:a?.manual}),i}setState(e){this.#s({type:"setState",state:e})}cancel(e){const a=this.#r?.promise;return this.#r?.cancel(e),a?a.then(mn).catch(mn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>En(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gh||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Cr(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:!k0(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(a=>a.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(a=>a.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.obser)DELIM" +R"DELIM(vers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#a.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(a=>a!==e),this.observers.length||(this.#r&&(this.#l||this.#c()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#a.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}async fetch(e,a){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&a?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const i=new AbortController,l=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#l=!0,i.signal)})},s=()=>{const m=L0(this.options,a),b=(()=>{const g={client:this.#i,queryKey:this.queryKey,meta:this.meta};return l(g),g})();return this.#l=!1,this.options.persister?this.options.persister(m,b,this):m(b)},c=(()=>{const m={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:s};return l(m),m})();(this.#e==="infinite"?yw(this.options.pages):this.options.behavior)?.onFetch(c,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==c.fetchOptions?.meta)&&this.#s({type:"fetch",meta:c.fetchOptions?.meta}),this.#r=H0({initialPromise:a?.initialPromise,fn:c.fetchFn,onCancel:m=>{m instanceof Xd&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),i.abort()},onFail:(m,p)=>{this.#s({type:"failed",failureCount:m,error:p})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0});try{const m=await this.#r.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#a.config.onSuccess?.(m,this),this.#a.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof Xd){if(m.silent)return this.#r.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#s({type:"error",error:m}),this.#a.config.onError?.(m,this),this.#a.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#s(e){const a=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...Z0(i.data,this.options),fetchMeta:e.meta??null};case"success":const l={...i,...nv(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?l:void 0,l;case"error":const s=e.error;return{...i,error:s,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=a(this.state),Ft.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),this.#a.notify({query:this,type:"updated",action:e})})}};function Z0(e,a){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:U0(a.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function nv(e,a){return{data:e,dataUpdatedAt:a??Date.now(),error:null,isInvalidated:!1,status:"success"}}function av(e){const a=typeof e.initialData=="function"?e.initialData():e.initialData,i=a!==void 0,l=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:a,dataUpdateCount:0,dataUpdatedAt:i?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}var bw=class extends Do{constructor(e,a){super(),this.options=a,this.#e=e,this.#l=null,this.#o=Vd(),this.bindMethods(),this.setOptions(a)}#e;#t=void 0;#n=void 0;#a=void 0;#i;#r;#o;#l;#c;#s;#m;#f;#d;#u;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),rv(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Id(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Id(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#t.removeObserver(this)}setOptions(e){const a=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOption)DELIM" +R"DELIM(s(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof En(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#w(),this.#t.setOptions(this.options),a._defaulted&&!Yd(this.options,a)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&iv(this.#t,i,this.options,a)&&this.#h(),this.updateResult(),l&&(this.#t!==i||En(this.options.enabled,this.#t)!==En(a.enabled,this.#t)||Cr(this.options.staleTime,this.#t)!==Cr(a.staleTime,this.#t))&&this.#y();const s=this.#g();l&&(this.#t!==i||En(this.options.enabled,this.#t)!==En(a.enabled,this.#t)||s!==this.#u)&&this.#v(s)}getOptimisticResult(e){const a=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(a,e);return Sw(this,i)&&(this.#a=i,this.#r=this.options,this.#i=this.#t.state),i}getCurrentResult(){return this.#a}trackResult(e,a){return new Proxy(e,{get:(i,l)=>(this.trackProp(l),a?.(l),l==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,l))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const a=this.#e.defaultQueryOptions(e),i=this.#e.getQueryCache().build(this.#e,a);return i.fetch().then(()=>this.createResult(i,a))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#h(e){this.#w();let a=this.#t.fetch(this.options,e);return e?.throwOnError||(a=a.catch(mn)),a}#y(){this.#x();const e=Cr(this.options.staleTime,this.#t);if(Eo.isServer()||this.#a.isStale||!Fd(e))return;const i=k0(this.#a.dataUpdatedAt,e)+1;this.#f=ti.setTimeout(()=>{this.#a.isStale||this.updateResult()},i)}#g(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#S(),this.#u=e,!(Eo.isServer()||En(this.options.enabled,this.#t)===!1||!Fd(this.#u)||this.#u===0)&&(this.#d=ti.setInterval(()=>{(this.options.refetchIntervalInBackground||ph.isFocused())&&this.#h()},this.#u))}#b(){this.#y(),this.#v(this.#g())}#x(){this.#f!==void 0&&(ti.clearTimeout(this.#f),this.#f=void 0)}#S(){this.#d!==void 0&&(ti.clearInterval(this.#d),this.#d=void 0)}createResult(e,a){const i=this.#t,l=this.options,s=this.#a,u=this.#i,c=this.#r,m=e!==i?e.state:this.#n,{state:p}=e;let b={...p},g=!1,x;if(a._optimisticResults){const w=this.hasListeners(),L=!w&&rv(e,a),H=w&&iv(e,i,a,l);(L||H)&&(b={...b,...Z0(p.data,e.options)}),a._optimisticResults==="isRestoring"&&(b.fetchStatus="idle")}let{error:_,errorUpdatedAt:z,status:T}=b;x=b.data;let k=!1;if(a.placeholderData!==void 0&&x===void 0&&T==="pending"){let w;s?.isPlaceholderData&&a.placeholderData===c?.placeholderData?(w=s.data,k=!0):w=typeof a.placeholderData=="function"?a.placeholderData(this.#m?.state.data,this.#m):a.placeholderData,w!==void 0&&(T="success",x=Kd(s?.data,w,a),g=!0)}if(a.select&&x!==void 0&&!k)if(s&&x===u?.data&&a.select===this.#c)x=this.#s;else try{this.#c=a.select,x=a.select(x),x=Kd(s?.data,x,a),this.#s=x,this.#l=null}catch(w){this.#l=w}this.#l&&(_=this.#l,x=this.#s,z=Date.now(),T="error");const Z=b.fetchStatus==="fetching",X=T==="pending",ne=T==="error",se=X&&Z,te=x!==void 0,O={status:T,fetchStatus:b.fetchStatus,isPending:X,isSuccess:T==="success",isError:ne,isInitialLoading:se,isLoading:se,data:x,dataUpdatedAt:b.dataUpdatedAt,error:_,errorUpdatedAt:z,failureCount:b.fetchFailureCount,failureReason:b.fetchFailureReason,errorUpdateCount:b.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:b.dataUpdateCount>m.dataUpdateCount||b.errorUpdateCount>m.errorUpdateCount,isFetching:Z,isRefetching:Z&&!X,isLoadingError:ne&&!te,isPaused:b.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:ne&&te,isStale:vh(e,a),refetch:this.refetch,promise:this.#o,isEnabled:En(a.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const w=O.data!==void 0,L=O.status==="error"&&!w,H=he=>{L?he.reject(O.error):w&&he.resolve(O.data)},F=()=>{const he=this.#o=O.promise=Vd();H(he)},K=this.#o;switch(K.status){case"pending":e.queryHash===i.queryHash&&H(K);break;case"fulfilled":(L||O.data!==K.value)&&F();break;case"rejected":(!L||O.error!==K.reason)&&F();break}}return O}updateResult(){const e=this.#a,a=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#r=this.options,this.#i.data!==void 0&&(this.#m=this.#t),Yd(a,e))return;this.#a=a;const i=()=>{if(!e)return!0;const{notifyOnChangeProps:l}=this.options,s=typeof l=="function"?l():l;if(s==="all"||!s&&!this.#p.size)return!0;const u=new Set(s??this.#p);return this.options.throwOnError&&u.add("error"),Object.keys(this.#a).some(c=>{const d=c;return this.#a[d]!==e[d]&&u.has(d)})};this.#_({listeners:i()})}#w(){const e=this.#e.getQuer)DELIM" +R"DELIM(yCache().build(this.#e,this.options);if(e===this.#t)return;const a=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(a?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#_(e){Ft.batch(()=>{e.listeners&&this.listeners.forEach(a=>{a(this.#a)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function xw(e,a){return En(a.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&En(a.retryOnMount,e)===!1)}function rv(e,a){return xw(e,a)||e.state.data!==void 0&&Id(e,a,a.refetchOnMount)}function Id(e,a,i){if(En(a.enabled,e)!==!1&&Cr(a.staleTime,e)!=="static"){const l=typeof i=="function"?i(e):i;return l==="always"||l!==!1&&vh(e,a)}return!1}function iv(e,a,i,l){return(e!==a||En(l.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&vh(e,i)}function vh(e,a){return En(a.enabled,e)!==!1&&e.isStaleByTime(Cr(a.staleTime,e))}function Sw(e,a){return!Yd(e.getCurrentResult(),a)}var ww=class extends $0{#e;#t;#n;#a;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||_w(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(a=>a!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(e){const a=()=>{this.#i({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=H0({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(u,c)=>{this.#i({type:"failed",failureCount:u,error:c})},onPause:()=>{this.#i({type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const l=this.state.status==="pending",s=!this.#a.canStart();try{if(l)a();else{this.#i({type:"pending",variables:e,isPaused:s}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,i);const c=await this.options.onMutate?.(e,i);c!==this.state.context&&this.#i({type:"pending",context:c,variables:e,isPaused:s})}const u=await this.#a.start();return await this.#n.config.onSuccess?.(u,e,this.state.context,this,i),await this.options.onSuccess?.(u,e,this.state.context,i),await this.#n.config.onSettled?.(u,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(u,null,e,this.state.context,i),this.#i({type:"success",data:u}),u}catch(u){try{await this.#n.config.onError?.(u,e,this.state.context,this,i)}catch(c){Promise.reject(c)}try{await this.options.onError?.(u,e,this.state.context,i)}catch(c){Promise.reject(c)}try{await this.#n.config.onSettled?.(void 0,u,this.state.variables,this.state.context,this,i)}catch(c){Promise.reject(c)}try{await this.options.onSettled?.(void 0,u,e,this.state.context,i)}catch(c){Promise.reject(c)}throw this.#i({type:"error",error:u}),u}finally{this.#n.runNext(this)}}#i(e){const a=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,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{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=a(this.state),Ft.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function _w(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ew=class extends Do{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,a,i){const l=new ww({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(a),state:i});return this.add(l),l}add(e){this.#e.add(e);const a=ou(e);if(typeof a=="string"){const i=this.#t.get(a);i?i.push(e):this.#t.set(a,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const a=ou(e);if(typeof a=="string"){const i=this.#t.get(a);if(i)if(i.length>1){const l=i.indexOf(e);l!==-1&&i.splice(l,1)}else i[0]===e&&this.#t.delete(a)}}this.notify({type:"removed",mutation:e})}canRun(e){const a=ou(e);if(typeof a=="string"){co)DELIM" +R"DELIM(nst l=this.#t.get(a)?.find(s=>s.state.status==="pending");return!l||l===e}else return!0}runNext(e){const a=ou(e);return typeof a=="string"?this.#t.get(a)?.find(l=>l!==e&&l.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ft.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const a={exact:!0,...e};return this.getAll().find(i=>Jg(a,i))}findAll(e={}){return this.getAll().filter(a=>Jg(e,a))}notify(e){Ft.batch(()=>{this.listeners.forEach(a=>{a(e)})})}resumePausedMutations(){const e=this.getAll().filter(a=>a.state.isPaused);return Ft.batch(()=>Promise.all(e.map(a=>a.continue().catch(mn))))}};function ou(e){return e.options.scope?.id}var Tw=class extends Do{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,a,i){const l=a.queryKey,s=a.queryHash??yh(l,a);let u=this.get(s);return u||(u=new vw({client:e,queryKey:l,queryHash:s,options:e.defaultQueryOptions(a),state:i,defaultOptions:e.getQueryDefaults(l)}),this.add(u)),u}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const a=this.#e.get(e.queryHash);a&&(e.destroy(),a===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ft.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const a={exact:!0,...e};return this.getAll().find(i=>Ig(a,i))}findAll(e={}){const a=this.getAll();return Object.keys(e).length>0?a.filter(i=>Ig(e,i)):a}notify(e){Ft.batch(()=>{this.listeners.forEach(a=>{a(e)})})}onFocus(){Ft.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ft.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Rw=class{#e;#t;#n;#a;#i;#r;#o;#l;constructor(e={}){this.#e=e.queryCache||new Tw,this.#t=e.mutationCache||new Ew,this.#n=e.defaultOptions||{},this.#a=new Map,this.#i=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#o=ph.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Nu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#o?.(),this.#o=void 0,this.#l?.(),this.#l=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const a=this.defaultQueryOptions({queryKey:e});return this.#e.get(a.queryHash)?.state.data}ensureQueryData(e){const a=this.defaultQueryOptions(e),i=this.#e.build(this,a),l=i.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(Cr(a.staleTime,i))&&this.prefetchQuery(a),Promise.resolve(l))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:a,state:i})=>{const l=i.data;return[a,l]})}setQueryData(e,a,i){const l=this.defaultQueryOptions({queryKey:e}),u=this.#e.get(l.queryHash)?.state.data,c=lw(a,u);if(c!==void 0)return this.#e.build(this,l).setData(c,{...i,manual:!0})}setQueriesData(e,a,i){return Ft.batch(()=>this.#e.findAll(e).map(({queryKey:l})=>[l,this.setQueryData(l,a,i)]))}getQueryState(e){const a=this.defaultQueryOptions({queryKey:e});return this.#e.get(a.queryHash)?.state}removeQueries(e){const a=this.#e;Ft.batch(()=>{a.findAll(e).forEach(i=>{a.remove(i)})})}resetQueries(e,a){const i=this.#e;return Ft.batch(()=>(i.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},a)))}cancelQueries(e,a={}){const i={revert:!0,...a},l=Ft.batch(()=>this.#e.findAll(e).map(s=>s.cancel(i)));return Promise.all(l).then(mn).catch(mn)}invalidateQueries(e,a={}){return Ft.batch(()=>(this.#e.findAll(e).forEach(i=>{i.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},a)))}refetchQueries(e,a={}){const i={...a,cancelRefetch:a.cancelRefetch??!0},l=Ft.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let u=s.fetch(void 0,i);return i.throwOnError||(u=u.catch(mn)),s.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(mn)}fetchQuery(e){const a=this.defaultQueryOptions(e);a.retry===void 0&&(a.retry=!1);const i=this.#e.build(this,a);return i.isStaleByTime(Cr(a.staleTime,i))?i.fetch(a):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(mn).catch(mn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(mn).catch(mn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Nu.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,a){this.#a.set(wo(e),{queryKey:e,defaultOptions:a})}getQueryDefaults(e){const a=[...this.#a.values()],i={};return a.forEach(l=>{_o(e,l.qu)DELIM" +R"DELIM(eryKey)&&Object.assign(i,l.defaultOptions)}),i}setMutationDefaults(e,a){this.#i.set(wo(e),{mutationKey:e,defaultOptions:a})}getMutationDefaults(e){const a=[...this.#i.values()],i={};return a.forEach(l=>{_o(e,l.mutationKey)&&Object.assign(i,l.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const a={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return a.queryHash||(a.queryHash=yh(a.queryKey,a)),a.refetchOnReconnect===void 0&&(a.refetchOnReconnect=a.networkMode!=="always"),a.throwOnError===void 0&&(a.throwOnError=!!a.suspense),!a.networkMode&&a.persister&&(a.networkMode="offlineFirst"),a.queryFn===gh&&(a.enabled=!1),a}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},q0=E.createContext(void 0),Yu=e=>{const a=E.useContext(q0);if(!a)throw new Error("No QueryClient set, use QueryClientProvider to set one");return a},zw=({client:e,children:a})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),v.jsx(q0.Provider,{value:e,children:a})),P0=E.createContext(!1),Aw=()=>E.useContext(P0);P0.Provider;function Cw(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var jw=E.createContext(Cw()),Nw=()=>E.useContext(jw),Ow=(e,a,i)=>{const l=i?.state.error&&typeof e.throwOnError=="function"?B0(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||l)&&(a.isReset()||(e.retryOnMount=!1))},Mw=e=>{E.useEffect(()=>{e.clearReset()},[e])},kw=({result:e,errorResetBoundary:a,throwOnError:i,query:l,suspense:s})=>e.isError&&!a.isReset()&&!e.isFetching&&l&&(s&&e.data===void 0||B0(i,[e.error,l])),Dw=e=>{if(e.suspense){const i=s=>s==="static"?s:Math.max(s??1e3,1e3),l=e.staleTime;e.staleTime=typeof l=="function"?(...s)=>i(l(...s)):i(l),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Lw=(e,a)=>e.isLoading&&e.isFetching&&!a,Bw=(e,a)=>e?.suspense&&a.isPending,lv=(e,a,i)=>a.fetchOptimistic(e).catch(()=>{i.clearReset()});function Uw(e,a,i){const l=Aw(),s=Nw(),u=Yu(),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);const d=u.getQueryCache().get(c.queryHash),m=e.subscribed!==!1;c._optimisticResults=l?"isRestoring":m?"optimistic":void 0,Dw(c),Ow(c,s,d),Mw(s);const p=!u.getQueryCache().get(c.queryHash),[b]=E.useState(()=>new a(u,c)),g=b.getOptimisticResult(c),x=!l&&m;if(E.useSyncExternalStore(E.useCallback(_=>{const z=x?b.subscribe(Ft.batchCalls(_)):mn;return b.updateResult(),z},[b,x]),()=>b.getCurrentResult(),()=>b.getCurrentResult()),E.useEffect(()=>{b.setOptions(c)},[c,b]),Bw(c,g))throw lv(c,b,s);if(kw({result:g,errorResetBoundary:s,throwOnError:c.throwOnError,query:d,suspense:c.suspense}))throw g.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(c,g),c.experimental_prefetchInRender&&!Eo.isServer()&&Lw(g,l)&&(p?lv(c,b,s):d?.promise)?.catch(mn).finally(()=>{b.updateResult()}),c.notifyOnChangeProps?g:b.trackResult(g)}function Hw(e,a){return Uw(e,bw)}var ov;function re(e,a,i){function l(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),a(d,m);const p=c.prototype,b=Object.keys(p);for(let g=0;gi?.Parent&&d instanceof i.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(c,"name",{value:e}),c}class rl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Q0 extends Error{constructor(a){super(`Encountered unidirectional transform during encode: ${a}`),this.name="ZodEncodeError"}}(ov=globalThis).__zod_globalConfig??(ov.__zod_globalConfig={});const bh=globalThis.__zod_globalConfig;function ri(e){return bh}function F0(e){const a=Object.values(e).filter(l=>typeof l=="number");return Object.entries(e).filter(([l,s])=>a.indexOf(+l)===-1).map(([l,s])=>s)}function Jd(e,a){return typeof a=="bigint"?a.toString():a}function xh(e){return{get value(){{const a=e();return Object.defineProperty(this,"value",{value:a}),a}}}}function Sh(e){return e==null}function wh(e){const a=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(a,i)}function $w(e,a){const i=e/a,l=Math.round(i),s=Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-l){};function Ou(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qw=xh(()=>{if(bh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function To(e){if(Ou(e)===!1)return!1;const a=e.constructor;if(a===void 0||typeof a!="function")return!0;const i=a.prototype;return!(Ou(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function G0(e){return To(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Pw=new Set(["string","number","symbol"]);function Gu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Or(e,a,i){const l=new e._zod.constr(a??e._zod.def);return(!a||i?.parent)&&(l._zod.parent=e),l}function ze(e){const a=e;if(!a)return{};if(typeof a=="string")return{error:()=>a};if(a?.message!==void 0){if(a?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");a.error=a.message}return delete a.message,typeof a.error=="string"?{...a,error:()=>a.error}:a}function Qw(e){return Object.keys(e).filter(a=>e[a]._zod.optin==="optional"&&e[a]._zod.optout==="optional")}const Fw={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Yw(e,a){const i=e._zod.def,l=i.checks;if(l&&l.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const u=Nr(e._zod.def,{get shape(){const c={};for(const d in a){if(!(d in i.shape))throw new Error(`Unrecognized key: "${d}"`);a[d]&&(c[d]=i.shape[d])}return oi(this,"shape",c),c},checks:[]});return Or(e,u)}function Gw(e,a){const i=e._zod.def,l=i.checks;if(l&&l.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const u=Nr(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const d in a){if(!(d in i.shape))throw new Error(`Unrecognized key: "${d}"`);a[d]&&delete c[d]}return oi(this,"shape",c),c},checks:[]});return Or(e,u)}function Kw(e,a){if(!To(a))throw new Error("Invalid input to extend: expected a plain object");const i=e._zod.def.checks;if(i&&i.length>0){const u=e._zod.def.shape;for(const c in a)if(Object.getOwnPropertyDescriptor(u,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Nr(e._zod.def,{get shape(){const u={...e._zod.def.shape,...a};return oi(this,"shape",u),u}});return Or(e,s)}function Vw(e,a){if(!To(a))throw new Error("Invalid input to safeExtend: expected a plain object");const i=Nr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...a};return oi(this,"shape",l),l}});return Or(e,i)}function Xw(e,a){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const i=Nr(e._zod.def,{get shape(){const l={...e._zod.def.shape,...a._zod.def.shape};return oi(this,"shape",l),l},get catchall(){return a._zod.def.catchall},checks:a._zod.def.checks??[]});return Or(e,i)}function Iw(e,a,i){const s=a._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=Nr(a._zod.def,{get shape(){const d=a._zod.def.shape,m={...d};if(i)for(const p in i){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);i[p]&&(m[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)m[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return oi(this,"shape",m),m},checks:[]});return Or(a,c)}function Jw(e,a,i){const l=Nr(a._zod.def,{get shape(){const s=a._zod.def.shape,u={...s};if(i)for(const c in i){if(!(c in u))throw new Error(`Unrecognized key: "${c}"`);i[c]&&(u[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)u[c]=new e({type:"nonoptional",innerType:s[c]});return oi(this,"shape",u),u}});return Or(a,l)}function nl(e,a=0){if(e.aborted===!0)return!0;for(let i=a;i{var l;return(l=i).path??(l.path=[]),i.path.unshift(e),i})}function su(e){return typeof e=="string"?e:e?.message}function ii(e,a,i){const l=e.message?e.message:su(e.inst?._zod.def?.error?.(e))??su(a?.error?.(e))??su(i.customError?.(e))??su(i.localeError?.(e))??"Invalid input",{inst:s,continue:u,input:c,...d}=e;re)DELIM" +R"DELIM(turn d.path??(d.path=[]),d.message=l,a?.reportInput&&(d.input=c),d}function _h(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ro(...e){const[a,i,l]=e;return typeof a=="string"?{message:a,code:"custom",input:i,inst:l}:{...a}}const V0=(e,a)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:a,enumerable:!1}),e.message=JSON.stringify(a,Jd,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},X0=re("$ZodError",V0),I0=re("$ZodError",V0,{Parent:Error});function e_(e,a=i=>i.message){const i={},l=[];for(const s of e.issues)s.path.length>0?(i[s.path[0]]=i[s.path[0]]||[],i[s.path[0]].push(a(s))):l.push(a(s));return{formErrors:l,fieldErrors:i}}function t_(e,a=i=>i.message){const i={_errors:[]},l=(s,u=[])=>{for(const c of s.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(d=>l({issues:d},[...u,...c.path]));else if(c.code==="invalid_key")l({issues:c.issues},[...u,...c.path]);else if(c.code==="invalid_element")l({issues:c.issues},[...u,...c.path]);else{const d=[...u,...c.path];if(d.length===0)i._errors.push(a(c));else{let m=i,p=0;for(;p(a,i,l,s)=>{const u=l?{...l,async:!1}:{async:!1},c=a._zod.run({value:i,issues:[]},u);if(c instanceof Promise)throw new rl;if(c.issues.length){const d=new(s?.Err??e)(c.issues.map(m=>ii(m,u,ri())));throw Y0(d,s?.callee),d}return c.value},Th=e=>async(a,i,l,s)=>{const u=l?{...l,async:!0}:{async:!0};let c=a._zod.run({value:i,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){const d=new(s?.Err??e)(c.issues.map(m=>ii(m,u,ri())));throw Y0(d,s?.callee),d}return c.value},Ku=e=>(a,i,l)=>{const s=l?{...l,async:!1}:{async:!1},u=a._zod.run({value:i,issues:[]},s);if(u instanceof Promise)throw new rl;return u.issues.length?{success:!1,error:new(e??X0)(u.issues.map(c=>ii(c,s,ri())))}:{success:!0,data:u.value}},n_=Ku(I0),Vu=e=>async(a,i,l)=>{const s=l?{...l,async:!0}:{async:!0};let u=a._zod.run({value:i,issues:[]},s);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(c=>ii(c,s,ri())))}:{success:!0,data:u.value}},a_=Vu(I0),r_=e=>(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Eh(e)(a,i,s)},i_=e=>(a,i,l)=>Eh(e)(a,i,l),l_=e=>async(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Th(e)(a,i,s)},o_=e=>async(a,i,l)=>Th(e)(a,i,l),s_=e=>(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Ku(e)(a,i,s)},u_=e=>(a,i,l)=>Ku(e)(a,i,l),c_=e=>async(a,i,l)=>{const s=l?{...l,direction:"backward"}:{direction:"backward"};return Vu(e)(a,i,s)},f_=e=>async(a,i,l)=>Vu(e)(a,i,l),d_=/^[cC][0-9a-z]{6,}$/,h_=/^[0-9a-z]+$/,m_=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,p_=/^[0-9a-vA-V]{20}$/,y_=/^[A-Za-z0-9]{27}$/,g_=/^[a-zA-Z0-9_-]{21}$/,v_=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,b_=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cv=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,x_=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,S_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function w_(){return new RegExp(S_,"u")}const __=/^(?:(?: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])$/,E_=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,T_=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,R_=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z_=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,J0=/^[A-Za-z0-9_-]*$/,A_=/^https?$/,C_=/^\+[1-9]\d{6,14}$/,W0="(?:(?:\\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])))",j_=new RegExp(`^${W0}$`);function eb(e){const a="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${a}`:e.precision===0?`${a}:[0-5]\\d`:`${a}:[0-5]\\d\\.\\d{${e)DELIM" +R"DELIM(.precision}}`:`${a}(?::[0-5]\\d(?:\\.\\d+)?)?`}function N_(e){return new RegExp(`^${eb(e)}$`)}function O_(e){const a=eb({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const l=`${a}(?:${i.join("|")})`;return new RegExp(`^${W0}T(?:${l})$`)}const M_=e=>{const a=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${a}$`)},k_=/^-?\d+$/,D_=/^-?\d+(?:\.\d+)?$/,L_=/^(?:true|false)$/i,B_=/^[^A-Z]*$/,U_=/^[^a-z]*$/,pn=re("$ZodCheck",(e,a)=>{var i;e._zod??(e._zod={}),e._zod.def=a,(i=e._zod).onattach??(i.onattach=[])}),tb={number:"number",bigint:"bigint",object:"date"},nb=re("$ZodCheckLessThan",(e,a)=>{pn.init(e,a);const i=tb[typeof a.value];e._zod.onattach.push(l=>{const s=l._zod.bag,u=(a.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;a.value{(a.inclusive?l.value<=a.value:l.value{pn.init(e,a);const i=tb[typeof a.value];e._zod.onattach.push(l=>{const s=l._zod.bag,u=(a.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;a.value>u&&(a.inclusive?s.minimum=a.value:s.exclusiveMinimum=a.value)}),e._zod.check=l=>{(a.inclusive?l.value>=a.value:l.value>a.value)||l.issues.push({origin:i,code:"too_small",minimum:typeof a.value=="object"?a.value.getTime():a.value,input:l.value,inclusive:a.inclusive,inst:e,continue:!a.abort})}}),H_=re("$ZodCheckMultipleOf",(e,a)=>{pn.init(e,a),e._zod.onattach.push(i=>{var l;(l=i._zod.bag).multipleOf??(l.multipleOf=a.value)}),e._zod.check=i=>{if(typeof i.value!=typeof a.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%a.value===BigInt(0):$w(i.value,a.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:a.value,input:i.value,inst:e,continue:!a.abort})}}),$_=re("$ZodCheckNumberFormat",(e,a)=>{pn.init(e,a),a.format=a.format||"float64";const i=a.format?.includes("int"),l=i?"int":"number",[s,u]=Fw[a.format];e._zod.onattach.push(c=>{const d=c._zod.bag;d.format=a.format,d.minimum=s,d.maximum=u,i&&(d.pattern=k_)}),e._zod.check=c=>{const d=c.value;if(i){if(!Number.isInteger(d)){c.issues.push({expected:l,format:a.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?c.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:l,inclusive:!0,continue:!a.abort}):c.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:l,inclusive:!0,continue:!a.abort});return}}du&&c.issues.push({origin:"number",input:d,code:"too_big",maximum:u,inclusive:!0,inst:e,continue:!a.abort})}}),Z_=re("$ZodCheckMaxLength",(e,a)=>{var i;pn.init(e,a),(i=e._zod.def).when??(i.when=l=>{const s=l.value;return!Sh(s)&&s.length!==void 0}),e._zod.onattach.push(l=>{const s=l._zod.bag.maximum??Number.POSITIVE_INFINITY;a.maximum{const s=l.value;if(s.length<=a.maximum)return;const c=_h(s);l.issues.push({origin:c,code:"too_big",maximum:a.maximum,inclusive:!0,input:s,inst:e,continue:!a.abort})}}),q_=re("$ZodCheckMinLength",(e,a)=>{var i;pn.init(e,a),(i=e._zod.def).when??(i.when=l=>{const s=l.value;return!Sh(s)&&s.length!==void 0}),e._zod.onattach.push(l=>{const s=l._zod.bag.minimum??Number.NEGATIVE_INFINITY;a.minimum>s&&(l._zod.bag.minimum=a.minimum)}),e._zod.check=l=>{const s=l.value;if(s.length>=a.minimum)return;const c=_h(s);l.issues.push({origin:c,code:"too_small",minimum:a.minimum,inclusive:!0,input:s,inst:e,continue:!a.abort})}}),P_=re("$ZodCheckLengthEquals",(e,a)=>{var i;pn.init(e,a),(i=e._zod.def).when??(i.when=l=>{const s=l.value;return!Sh(s)&&s.length!==void 0}),e._zod.onattach.push(l=>{const s=l._zod.bag;s.minimum=a.length,s.maximum=a.length,s.length=a.length}),e._zod.check=l=>{const s=l.value,u=s.length;if(u===a.length)return;const c=_h(s),d=u>a.length;l.issues.push({origin:c,...d?{code:"too_big",maximum:a.length}:{code:"too_small",minimum:a.length},inclusive:!0,exact:!0,input:l.value,inst:e,continue:!a.abort})}}),Xu=re("$ZodCheckStringFormat",(e,a)=>{var i,l;pn.init(e,a),e._zod.onattach.push(s=>{const u=s._zod.bag;u.format=a.format,a.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(a.pattern))}),a.pattern?(i=e._zod).check??(i.check=s=>{a.pattern.lastIndex=0,!a.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:a.format,input:s.value,...a.pattern?{pattern:a.pattern.toString()}:{},inst:e,continue:!a.abort})}):(l=e._zod).check??(l.check=()=>{})}),)DELIM" +R"DELIM(Q_=re("$ZodCheckRegex",(e,a)=>{Xu.init(e,a),e._zod.check=i=>{a.pattern.lastIndex=0,!a.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:a.pattern.toString(),inst:e,continue:!a.abort})}}),F_=re("$ZodCheckLowerCase",(e,a)=>{a.pattern??(a.pattern=B_),Xu.init(e,a)}),Y_=re("$ZodCheckUpperCase",(e,a)=>{a.pattern??(a.pattern=U_),Xu.init(e,a)}),G_=re("$ZodCheckIncludes",(e,a)=>{pn.init(e,a);const i=Gu(a.includes),l=new RegExp(typeof a.position=="number"?`^.{${a.position}}${i}`:i);a.pattern=l,e._zod.onattach.push(s=>{const u=s._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(l)}),e._zod.check=s=>{s.value.includes(a.includes,a.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:a.includes,input:s.value,inst:e,continue:!a.abort})}}),K_=re("$ZodCheckStartsWith",(e,a)=>{pn.init(e,a);const i=new RegExp(`^${Gu(a.prefix)}.*`);a.pattern??(a.pattern=i),e._zod.onattach.push(l=>{const s=l._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=l=>{l.value.startsWith(a.prefix)||l.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:a.prefix,input:l.value,inst:e,continue:!a.abort})}}),V_=re("$ZodCheckEndsWith",(e,a)=>{pn.init(e,a);const i=new RegExp(`.*${Gu(a.suffix)}$`);a.pattern??(a.pattern=i),e._zod.onattach.push(l=>{const s=l._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),e._zod.check=l=>{l.value.endsWith(a.suffix)||l.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:a.suffix,input:l.value,inst:e,continue:!a.abort})}}),X_=re("$ZodCheckOverwrite",(e,a)=>{pn.init(e,a),e._zod.check=i=>{i.value=a.tx(i.value)}});class I_{constructor(a=[]){this.content=[],this.indent=0,this&&(this.args=a)}indented(a){this.indent+=1,a(this),this.indent-=1}write(a){if(typeof a=="function"){a(this,{execution:"sync"}),a(this,{execution:"async"});return}const l=a.split(` `).filter(c=>c),s=Math.min(...l.map(c=>c.length-c.trimStart().length)),u=l.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of u)this.content.push(c)}compile(){const a=Function,i=this?.args,s=[...(this?.content??[""]).map(u=>` ${u}`)];return new a(...i,s.join(` -`))}}const I2={major:4,minor:4,patch:3},Ct=re("$ZodType",(e,a)=>{var i;e??(e={}),e._zod.def=a,e._zod.bag=e._zod.bag||{},e._zod.version=I2;const l=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&l.unshift(e);for(const s of l)for(const u of s._zod.onattach)u(e);if(l.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,d,m)=>{let p=nl(c),b;for(const g of d){if(g._zod.def.when){if(Jw(c)||!g._zod.def.when(c))continue}else if(p)continue;const x=c.issues.length,_=g._zod.check(c);if(_ instanceof Promise&&m?.async===!1)throw new rl;if(b||_ instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await _,c.issues.length!==x&&(p||(p=nl(c,x)))});else{if(c.issues.length===x)continue;p||(p=nl(c,x))}}return b?b.then(()=>c):c},u=(c,d,m)=>{if(nl(c))return c.aborted=!0,c;const p=s(d,l,m);if(p instanceof Promise){if(m.async===!1)throw new rl;return p.then(b=>e._zod.parse(b,m))}return e._zod.parse(p,m)};e._zod.run=(c,d)=>{if(d.skipChecks)return e._zod.parse(c,d);if(d.direction==="backward"){const p=e._zod.parse({value:c.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(b=>u(b,c,d)):u(p,c,d)}const m=e._zod.parse(c,d);if(m instanceof Promise){if(d.async===!1)throw new rl;return m.then(p=>s(p,l,d))}return s(m,l,d)}}st(e,"~standard",()=>({validate:s=>{try{const u=t2(e,s);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return n2(e,s).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},vendor:"zod",version:1}))}),zh=re("$ZodString",(e,a)=>{Ct.init(e,a),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??O2(e._zod.bag),e._zod.parse=(i,l)=>{if(a.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),gt=re("$ZodStringFormat",(e,a)=>{Iu.init(e,a),zh.init(e,a)}),J2=re("$ZodGUID",(e,a)=>{a.pattern??(a.pattern=v2),gt.init(e,a)}),W2=re("$ZodUUID",(e,a)=>{if(a.version){const l={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[a.version];if(l===void 0)throw new Error(`Invalid UUID version: "${a.version}"`);a.pattern??(a.pattern=cv(l))}else a.pattern??(a.pattern=cv());gt.init(e,a)}),e_=re("$ZodEmail",(e,a)=>{a.pattern??(a.pattern=b2),gt.init(e,a)}),t_=re("$ZodURL",(e,a)=>{gt.init(e,a),e._zod.check=i=>{try{const l=i.value.trim();if(!a.normalize&&a.protocol?.source===z2.source&&!/^https?:\/\//i.test(l)){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!a.abort});return}const s=new URL(l);a.hostname&&(a.hostname.lastIndex=0,a.hostname.test(s.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:a.hostname.source,input:i.value,inst:e,continue:!a.ab)DELIM" -R"DELIM(ort})),a.protocol&&(a.protocol.lastIndex=0,a.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:a.protocol.source,input:i.value,inst:e,continue:!a.abort})),a.normalize?i.value=s.href:i.value=l;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!a.abort})}}}),n_=re("$ZodEmoji",(e,a)=>{a.pattern??(a.pattern=S2()),gt.init(e,a)}),a_=re("$ZodNanoID",(e,a)=>{a.pattern??(a.pattern=y2),gt.init(e,a)}),r_=re("$ZodCUID",(e,a)=>{a.pattern??(a.pattern=f2),gt.init(e,a)}),i_=re("$ZodCUID2",(e,a)=>{a.pattern??(a.pattern=d2),gt.init(e,a)}),l_=re("$ZodULID",(e,a)=>{a.pattern??(a.pattern=h2),gt.init(e,a)}),o_=re("$ZodXID",(e,a)=>{a.pattern??(a.pattern=m2),gt.init(e,a)}),s_=re("$ZodKSUID",(e,a)=>{a.pattern??(a.pattern=p2),gt.init(e,a)}),u_=re("$ZodISODateTime",(e,a)=>{a.pattern??(a.pattern=N2(a)),gt.init(e,a)}),c_=re("$ZodISODate",(e,a)=>{a.pattern??(a.pattern=C2),gt.init(e,a)}),f_=re("$ZodISOTime",(e,a)=>{a.pattern??(a.pattern=j2(a)),gt.init(e,a)}),d_=re("$ZodISODuration",(e,a)=>{a.pattern??(a.pattern=g2),gt.init(e,a)}),h_=re("$ZodIPv4",(e,a)=>{a.pattern??(a.pattern=w2),gt.init(e,a),e._zod.bag.format="ipv4"}),m_=re("$ZodIPv6",(e,a)=>{a.pattern??(a.pattern=_2),gt.init(e,a),e._zod.bag.format="ipv6",e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!a.abort})}}}),p_=re("$ZodCIDRv4",(e,a)=>{a.pattern??(a.pattern=E2),gt.init(e,a)}),y_=re("$ZodCIDRv6",(e,a)=>{a.pattern??(a.pattern=T2),gt.init(e,a),e._zod.check=i=>{const l=i.value.split("/");try{if(l.length!==2)throw new Error;const[s,u]=l;if(!u)throw new Error;const c=Number(u);if(`${c}`!==u)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!a.abort})}}});function ab(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const g_=re("$ZodBase64",(e,a)=>{a.pattern??(a.pattern=R2),gt.init(e,a),e._zod.bag.contentEncoding="base64",e._zod.check=i=>{ab(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!a.abort})}});function v_(e){if(!I0.test(e))return!1;const a=e.replace(/[-_]/g,l=>l==="-"?"+":"/"),i=a.padEnd(Math.ceil(a.length/4)*4,"=");return ab(i)}const b_=re("$ZodBase64URL",(e,a)=>{a.pattern??(a.pattern=I0),gt.init(e,a),e._zod.bag.contentEncoding="base64url",e._zod.check=i=>{v_(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!a.abort})}}),x_=re("$ZodE164",(e,a)=>{a.pattern??(a.pattern=A2),gt.init(e,a)});function S_(e,a=null){try{const i=e.split(".");if(i.length!==3)return!1;const[l]=i;if(!l)return!1;const s=JSON.parse(atob(l));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||a&&(!("alg"in s)||s.alg!==a))}catch{return!1}}const w_=re("$ZodJWT",(e,a)=>{gt.init(e,a),e._zod.check=i=>{S_(i.value,a.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!a.abort})}}),rb=re("$ZodNumber",(e,a)=>{Ct.init(e,a),e._zod.pattern=e._zod.bag.pattern??k2,e._zod.parse=(i,l)=>{if(a.coerce)try{i.value=Number(i.value)}catch{}const s=i.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return i;const u=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return i.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...u?{received:u}:{}}),i}}),__=re("$ZodNumberFormat",(e,a)=>{H2.init(e,a),rb.init(e,a)}),E_=re("$ZodBoolean",(e,a)=>{Ct.init(e,a),e._zod.pattern=D2,e._zod.parse=(i,l)=>{if(a.coerce)try{i.value=!!i.value}catch{}const s=i.value;return typeof s=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),i}}),T_=re("$ZodUnknown",(e,a)=>{Ct.init(e,a),e._zod.parse=i=>i}),R_=re("$ZodNever",(e,a)=>{Ct.init(e,a),e._zod.parse=(i,l)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)});function fv(e,a,i){e.issues.length&&a.issues.push(...G0(i,e.issues)),a.value[i]=e.value}const z_=re("$ZodArray",(e,a)=>{Ct.init(e,a),e._zod.parse=(i,l)=>{const s=i.value;if(!Array.isArray(s))return i.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),i;i.value=Array(s.length);const u=[];for(let c=0;cfv(p,i,c))):fv(m,i,c)}return u.length?Promise.all(u).then(()=>i):i}});function ku(e,a,i,l,s,u){const c=i in l;if(e.issues.length){if(s&&u&&!c)return;a.issues.push(...G0(i,e.issues))}if(!c&&!s){e.issues.length||a.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?c&&(a.value[i]=void 0):a.value[i]=e.value}function ib(e){const a=Object.keys(e.shape);for(const l of a)if(!e.shape?.[l]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at k)DELIM" -R"DELIM(ey "${l}": expected a Zod schema`);const i=Pw(e.shape);return{...e,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function lb(e,a,i,l,s,u){const c=[],d=s.keySet,m=s.catchall._zod,p=m.def.type,b=m.optin==="optional",g=m.optout==="optional";for(const x in a){if(x==="__proto__"||d.has(x))continue;if(p==="never"){c.push(x);continue}const _=m.run({value:a[x],issues:[]},l);_ instanceof Promise?e.push(_.then(R=>ku(R,i,x,a,b,g))):ku(_,i,x,a,b,g)}return c.length&&i.issues.push({code:"unrecognized_keys",keys:c,input:a,inst:u}),e.length?Promise.all(e).then(()=>i):i}const A_=re("$ZodObject",(e,a)=>{if(Ct.init(e,a),!Object.getOwnPropertyDescriptor(a,"shape")?.get){const d=a.shape;Object.defineProperty(a,"shape",{get:()=>{const m={...d};return Object.defineProperty(a,"shape",{value:m}),m}})}const l=Sh(()=>ib(a));st(e._zod,"propValues",()=>{const d=a.shape,m={};for(const p in d){const b=d[p]._zod;if(b.values){m[p]??(m[p]=new Set);for(const g of b.values)m[p].add(g)}}return m});const s=Mu,u=a.catchall;let c;e._zod.parse=(d,m)=>{c??(c=l.value);const p=d.value;if(!s(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const b=[],g=c.shape;for(const x of c.keys){const _=g[x],R=_._zod.optin==="optional",T=_._zod.optout==="optional",k=_._zod.run({value:p[x],issues:[]},m);k instanceof Promise?b.push(k.then(Y=>ku(Y,d,x,p,R,T))):ku(k,d,x,p,R,T)}return u?lb(b,p,d,m,l.value,e):b.length?Promise.all(b).then(()=>d):d}}),C_=re("$ZodObjectJIT",(e,a)=>{A_.init(e,a);const i=e._zod.parse,l=Sh(()=>ib(a)),s=x=>{const _=new X2(["shape","payload","ctx"]),R=l.value,T=ne=>{const se=uv(ne);return`shape[${se}]._zod.run({ value: input[${se}], issues: [] }, ctx)`};_.write("const input = payload.value;");const k=Object.create(null);let Y=0;for(const ne of R.keys)k[ne]=`key_${Y++}`;_.write("const newResult = {};");for(const ne of R.keys){const se=k[ne],te=uv(ne),xe=x[ne],O=xe?._zod?.optin==="optional",w=xe?._zod?.optout==="optional";_.write(`const ${se} = ${T(ne)};`),O&&w?_.write(` +`))}}const J_={major:4,minor:4,patch:3},Ct=re("$ZodType",(e,a)=>{var i;e??(e={}),e._zod.def=a,e._zod.bag=e._zod.bag||{},e._zod.version=J_;const l=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&l.unshift(e);for(const s of l)for(const u of s._zod.onattach)u(e);if(l.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(c,d,m)=>{let p=nl(c),b;for(const g of d){if(g._zod.def.when){if(Ww(c)||!g._zod.def.when(c))continue}else if(p)continue;const x=c.issues.length,_=g._zod.check(c);if(_ instanceof Promise&&m?.async===!1)throw new rl;if(b||_ instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await _,c.issues.length!==x&&(p||(p=nl(c,x)))});else{if(c.issues.length===x)continue;p||(p=nl(c,x))}}return b?b.then(()=>c):c},u=(c,d,m)=>{if(nl(c))return c.aborted=!0,c;const p=s(d,l,m);if(p instanceof Promise){if(m.async===!1)throw new rl;return p.then(b=>e._zod.parse(b,m))}return e._zod.parse(p,m)};e._zod.run=(c,d)=>{if(d.skipChecks)return e._zod.parse(c,d);if(d.direction==="backward"){const p=e._zod.parse({value:c.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(b=>u(b,c,d)):u(p,c,d)}const m=e._zod.parse(c,d);if(m instanceof Promise){if(d.async===!1)throw new rl;return m.then(p=>s(p,l,d))}return s(m,l,d)}}st(e,"~standard",()=>({validate:s=>{try{const u=n_(e,s);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return a_(e,s).then(c=>c.success?{value:c.data}:{issues:c.error?.issues})}},vendor:"zod",version:1}))}),Rh=re("$ZodString",(e,a)=>{Ct.init(e,a),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??M_(e._zod.bag),e._zod.parse=(i,l)=>{if(a.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),gt=re("$ZodStringFormat",(e,a)=>{Xu.init(e,a),Rh.init(e,a)}),W_=re("$ZodGUID",(e,a)=>{a.pattern??(a.pattern=b_),gt.init(e,a)}),e2=re("$ZodUUID",(e,a)=>{if(a.version){const l={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[a.version];if(l===void 0)throw new Error(`Invalid UUID version: "${a.version}"`);a.pattern??(a.pattern=cv(l))}else a.pattern??(a.pattern=cv());gt.init(e,a)}),t2=re("$ZodEmail",(e,a)=>{a.pattern??(a.pattern=x_),gt.init(e,a)}),n2=re("$ZodURL",(e,a)=>{gt.init(e,a),e._zod.check=i=>{try{const l=i.value.trim();if(!a.normalize&&a.protocol?.source===A_.source&&!/^https?:\/\//i.test(l)){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!a.abort});return}const s=new URL(l);a.hostname&&(a.hostname.lastIndex=0,a.hostname.test(s.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:a.hostname.source,input:i.value,inst:e,continue:!a.ab)DELIM" +R"DELIM(ort})),a.protocol&&(a.protocol.lastIndex=0,a.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:a.protocol.source,input:i.value,inst:e,continue:!a.abort})),a.normalize?i.value=s.href:i.value=l;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!a.abort})}}}),a2=re("$ZodEmoji",(e,a)=>{a.pattern??(a.pattern=w_()),gt.init(e,a)}),r2=re("$ZodNanoID",(e,a)=>{a.pattern??(a.pattern=g_),gt.init(e,a)}),i2=re("$ZodCUID",(e,a)=>{a.pattern??(a.pattern=d_),gt.init(e,a)}),l2=re("$ZodCUID2",(e,a)=>{a.pattern??(a.pattern=h_),gt.init(e,a)}),o2=re("$ZodULID",(e,a)=>{a.pattern??(a.pattern=m_),gt.init(e,a)}),s2=re("$ZodXID",(e,a)=>{a.pattern??(a.pattern=p_),gt.init(e,a)}),u2=re("$ZodKSUID",(e,a)=>{a.pattern??(a.pattern=y_),gt.init(e,a)}),c2=re("$ZodISODateTime",(e,a)=>{a.pattern??(a.pattern=O_(a)),gt.init(e,a)}),f2=re("$ZodISODate",(e,a)=>{a.pattern??(a.pattern=j_),gt.init(e,a)}),d2=re("$ZodISOTime",(e,a)=>{a.pattern??(a.pattern=N_(a)),gt.init(e,a)}),h2=re("$ZodISODuration",(e,a)=>{a.pattern??(a.pattern=v_),gt.init(e,a)}),m2=re("$ZodIPv4",(e,a)=>{a.pattern??(a.pattern=__),gt.init(e,a),e._zod.bag.format="ipv4"}),p2=re("$ZodIPv6",(e,a)=>{a.pattern??(a.pattern=E_),gt.init(e,a),e._zod.bag.format="ipv6",e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!a.abort})}}}),y2=re("$ZodCIDRv4",(e,a)=>{a.pattern??(a.pattern=T_),gt.init(e,a)}),g2=re("$ZodCIDRv6",(e,a)=>{a.pattern??(a.pattern=R_),gt.init(e,a),e._zod.check=i=>{const l=i.value.split("/");try{if(l.length!==2)throw new Error;const[s,u]=l;if(!u)throw new Error;const c=Number(u);if(`${c}`!==u)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!a.abort})}}});function rb(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const v2=re("$ZodBase64",(e,a)=>{a.pattern??(a.pattern=z_),gt.init(e,a),e._zod.bag.contentEncoding="base64",e._zod.check=i=>{rb(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!a.abort})}});function b2(e){if(!J0.test(e))return!1;const a=e.replace(/[-_]/g,l=>l==="-"?"+":"/"),i=a.padEnd(Math.ceil(a.length/4)*4,"=");return rb(i)}const x2=re("$ZodBase64URL",(e,a)=>{a.pattern??(a.pattern=J0),gt.init(e,a),e._zod.bag.contentEncoding="base64url",e._zod.check=i=>{b2(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!a.abort})}}),S2=re("$ZodE164",(e,a)=>{a.pattern??(a.pattern=C_),gt.init(e,a)});function w2(e,a=null){try{const i=e.split(".");if(i.length!==3)return!1;const[l]=i;if(!l)return!1;const s=JSON.parse(atob(l));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||a&&(!("alg"in s)||s.alg!==a))}catch{return!1}}const _2=re("$ZodJWT",(e,a)=>{gt.init(e,a),e._zod.check=i=>{w2(i.value,a.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!a.abort})}}),ib=re("$ZodNumber",(e,a)=>{Ct.init(e,a),e._zod.pattern=e._zod.bag.pattern??D_,e._zod.parse=(i,l)=>{if(a.coerce)try{i.value=Number(i.value)}catch{}const s=i.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return i;const u=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return i.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...u?{received:u}:{}}),i}}),E2=re("$ZodNumberFormat",(e,a)=>{$_.init(e,a),ib.init(e,a)}),T2=re("$ZodBoolean",(e,a)=>{Ct.init(e,a),e._zod.pattern=L_,e._zod.parse=(i,l)=>{if(a.coerce)try{i.value=!!i.value}catch{}const s=i.value;return typeof s=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),i}}),R2=re("$ZodUnknown",(e,a)=>{Ct.init(e,a),e._zod.parse=i=>i}),z2=re("$ZodNever",(e,a)=>{Ct.init(e,a),e._zod.parse=(i,l)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)});function fv(e,a,i){e.issues.length&&a.issues.push(...K0(i,e.issues)),a.value[i]=e.value}const A2=re("$ZodArray",(e,a)=>{Ct.init(e,a),e._zod.parse=(i,l)=>{const s=i.value;if(!Array.isArray(s))return i.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),i;i.value=Array(s.length);const u=[];for(let c=0;cfv(p,i,c))):fv(m,i,c)}return u.length?Promise.all(u).then(()=>i):i}});function Mu(e,a,i,l,s,u){const c=i in l;if(e.issues.length){if(s&&u&&!c)return;a.issues.push(...K0(i,e.issues))}if(!c&&!s){e.issues.length||a.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?c&&(a.value[i]=void 0):a.value[i]=e.value}function lb(e){const a=Object.keys(e.shape);for(const l of a)if(!e.shape?.[l]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at k)DELIM" +R"DELIM(ey "${l}": expected a Zod schema`);const i=Qw(e.shape);return{...e,keys:a,keySet:new Set(a),numKeys:a.length,optionalKeys:new Set(i)}}function ob(e,a,i,l,s,u){const c=[],d=s.keySet,m=s.catchall._zod,p=m.def.type,b=m.optin==="optional",g=m.optout==="optional";for(const x in a){if(x==="__proto__"||d.has(x))continue;if(p==="never"){c.push(x);continue}const _=m.run({value:a[x],issues:[]},l);_ instanceof Promise?e.push(_.then(z=>Mu(z,i,x,a,b,g))):Mu(_,i,x,a,b,g)}return c.length&&i.issues.push({code:"unrecognized_keys",keys:c,input:a,inst:u}),e.length?Promise.all(e).then(()=>i):i}const C2=re("$ZodObject",(e,a)=>{if(Ct.init(e,a),!Object.getOwnPropertyDescriptor(a,"shape")?.get){const d=a.shape;Object.defineProperty(a,"shape",{get:()=>{const m={...d};return Object.defineProperty(a,"shape",{value:m}),m}})}const l=xh(()=>lb(a));st(e._zod,"propValues",()=>{const d=a.shape,m={};for(const p in d){const b=d[p]._zod;if(b.values){m[p]??(m[p]=new Set);for(const g of b.values)m[p].add(g)}}return m});const s=Ou,u=a.catchall;let c;e._zod.parse=(d,m)=>{c??(c=l.value);const p=d.value;if(!s(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const b=[],g=c.shape;for(const x of c.keys){const _=g[x],z=_._zod.optin==="optional",T=_._zod.optout==="optional",k=_._zod.run({value:p[x],issues:[]},m);k instanceof Promise?b.push(k.then(Z=>Mu(Z,d,x,p,z,T))):Mu(k,d,x,p,z,T)}return u?ob(b,p,d,m,l.value,e):b.length?Promise.all(b).then(()=>d):d}}),j2=re("$ZodObjectJIT",(e,a)=>{C2.init(e,a);const i=e._zod.parse,l=xh(()=>lb(a)),s=x=>{const _=new I_(["shape","payload","ctx"]),z=l.value,T=ne=>{const se=uv(ne);return`shape[${se}]._zod.run({ value: input[${se}], issues: [] }, ctx)`};_.write("const input = payload.value;");const k=Object.create(null);let Z=0;for(const ne of z.keys)k[ne]=`key_${Z++}`;_.write("const newResult = {};");for(const ne of z.keys){const se=k[ne],te=uv(ne),xe=x[ne],O=xe?._zod?.optin==="optional",w=xe?._zod?.optout==="optional";_.write(`const ${se} = ${T(ne)};`),O&&w?_.write(` if (${se}.issues.length) { if (${te} in input) { payload.issues = payload.issues.concat(${se}.issues.map(iss => ({ @@ -142,68 +142,68 @@ R"DELIM(ey "${l}": expected a Zod schema`);const i=Pw(e.shape);return{...e,keys: } } - `)}_.write("payload.value = newResult;"),_.write("return payload;");const X=_.compile();return(ne,se)=>X(x,ne,se)};let u;const c=Mu,d=!xh.jitless,p=d&&Zw.value,b=a.catchall;let g;e._zod.parse=(x,_)=>{g??(g=l.value);const R=x.value;return c(R)?d&&p&&_?.async===!1&&_.jitless!==!0?(u||(u=s(a.shape)),x=u(x,_),b?lb([],R,x,_,g,e):x):i(x,_):(x.issues.push({expected:"object",code:"invalid_type",input:R,inst:e}),x)}});function dv(e,a,i,l){for(const u of e)if(u.issues.length===0)return a.value=u.value,a;const s=e.filter(u=>!nl(u));return s.length===1?(a.value=s[0].value,s[0]):(a.issues.push({code:"invalid_union",input:a.value,inst:i,errors:e.map(u=>u.issues.map(c=>ii(c,l,ri())))}),a)}const j_=re("$ZodUnion",(e,a)=>{Ct.init(e,a),st(e._zod,"optin",()=>a.options.some(l=>l._zod.optin==="optional")?"optional":void 0),st(e._zod,"optout",()=>a.options.some(l=>l._zod.optout==="optional")?"optional":void 0),st(e._zod,"values",()=>{if(a.options.every(l=>l._zod.values))return new Set(a.options.flatMap(l=>Array.from(l._zod.values)))}),st(e._zod,"pattern",()=>{if(a.options.every(l=>l._zod.pattern)){const l=a.options.map(s=>s._zod.pattern);return new RegExp(`^(${l.map(s=>_h(s.source)).join("|")})$`)}});const i=a.options.length===1?a.options[0]._zod.run:null;e._zod.parse=(l,s)=>{if(i)return i(l,s);let u=!1;const)DELIM" - R"DELIM( c=[];for(const d of a.options){const m=d._zod.run({value:l.value,issues:[]},s);if(m instanceof Promise)c.push(m),u=!0;else{if(m.issues.length===0)return m;c.push(m)}}return u?Promise.all(c).then(d=>dv(d,l,e,s)):dv(c,l,e,s)}}),N_=re("$ZodIntersection",(e,a)=>{Ct.init(e,a),e._zod.parse=(i,l)=>{const s=i.value,u=a.left._zod.run({value:s,issues:[]},l),c=a.right._zod.run({value:s,issues:[]},l);return u instanceof Promise||c instanceof Promise?Promise.all([u,c]).then(([m,p])=>hv(i,m,p)):hv(i,u,c)}});function eh(e,a){if(e===a)return{valid:!0,data:e};if(e instanceof Date&&a instanceof Date&&+e==+a)return{valid:!0,data:e};if(To(e)&&To(a)){const i=Object.keys(a),l=Object.keys(e).filter(u=>i.indexOf(u)!==-1),s={...e,...a};for(const u of l){const c=eh(e[u],a[u]);if(!c.valid)return{valid:!1,mergeErrorPath:[u,...c.mergeErrorPath]};s[u]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(a)){if(e.length!==a.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let l=0;ld.l&&d.r).map(([d])=>d);if(u.length&&s&&e.issues.push({...s,keys:u}),nl(e))return e;const c=eh(a.value,i.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const O_=re("$ZodEnum",(e,a)=>{Ct.init(e,a);const i=Q0(a.entries),l=new Set(i);e._zod.values=l,e._zod.pattern=new RegExp(`^(${i.filter(s=>qw.has(typeof s)).map(s=>typeof s=="string"?Ku(s):s.toString()).join("|")})$`),e._zod.parse=(s,u)=>{const c=s.value;return l.has(c)||s.issues.push({code:"invalid_value",values:i,input:c,inst:e}),s}}),M_=re("$ZodTransform",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",e._zod.parse=(i,l)=>{if(l.direction==="backward")throw new P0(e.constructor.name);const s=a.transform(i.value,i);if(l.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(i.value=c,i.fallback=!0,i));if(s instanceof Promise)throw new rl;return i.value=s,i.fallback=!0,i}});function mv(e,a){return a===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ob=re("$ZodOptional",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",e._zod.optout="optional",st(e._zod,"values",()=>a.innerType._zod.values?new Set([...a.innerType._zod.values,void 0]):void 0),st(e._zod,"pattern",()=>{const i=a.innerType._zod.pattern;return i?new RegExp(`^(${_h(i.source)})?$`):void 0}),e._zod.parse=(i,l)=>{if(a.innerType._zod.optin==="optional"){const s=i.value,u=a.innerType._zod.run(i,l);return u instanceof Promise?u.then(c=>mv(c,s)):mv(u,s)}return i.value===void 0?i:a.innerType._zod.run(i,l)}}),k_=re("$ZodExactOptional",(e,a)=>{ob.init(e,a),st(e._zod,"values",()=>a.innerType._zod.values),st(e._zod,"pattern",()=>a.innerType._zod.pattern),e._zod.parse=(i,l)=>a.innerType._zod.run(i,l)}),D_=re("$ZodNullable",(e,a)=>{Ct.init(e,a),st(e._zod,"optin",()=>a.innerType._zod.optin),st(e._zod,"optout",()=>a.innerType._zod.optout),st(e._zod,"pattern",()=>{const i=a.innerType._zod.pattern;return i?new RegExp(`^(${_h(i.source)}|null)$`):void 0}),st(e._zod,"values",()=>a.innerType._zod.values?new Set([...a.innerType._zod.values,null]):void 0),e._zod.parse=(i,l)=>i.value===null?i:a.innerType._zod.run(i,l)}),L_=re("$ZodDefault",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",st(e._zod,"values",()=>a.innerType._zod.values),e._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);if(i.value===void 0)return i.value=a.defaultValue,i;const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(u=>pv(u,a)):pv(s,a)}});function pv(e,a){return e.value===void 0&&(e.value=a.defaultValue),e}const B_=re("$ZodPrefault",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",st(e._zod,"values",()=>a.innerType._zod.values),e._zod.parse=(i,l)=>(l.direction==="backward"||i.value===void 0&&(i.value=a.defaultValue),a.innerType._zod.run(i,l))}),U_=re("$ZodNonOptional",(e,a)=>{Ct.init(e,a),st(e._zod,"values",()=>{const i=a.innerType._zod.values;return i?new Set([...i].filter(l=>l!==void 0)):void 0}),e._zod.parse=(i,l)=>{const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(u=>yv(u,e)):yv(s,e)}});function yv(e,a){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:a}),e}const H_=re("$ZodCatch",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",st(e._zod,"optout",()=>a.innerType._zod.optout),st(e._zod,"values",()=>a.innerType._zod.values),e._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);const s=a.inner)DELIM" - R"DELIM(Type._zod.run(i,l);return s instanceof Promise?s.then(u=>(i.value=u.value,u.issues.length&&(i.value=a.catchValue({...i,error:{issues:u.issues.map(c=>ii(c,l,ri()))},input:i.value}),i.issues=[],i.fallback=!0),i)):(i.value=s.value,s.issues.length&&(i.value=a.catchValue({...i,error:{issues:s.issues.map(u=>ii(u,l,ri()))},input:i.value}),i.issues=[],i.fallback=!0),i)}}),$_=re("$ZodPipe",(e,a)=>{Ct.init(e,a),st(e._zod,"values",()=>a.in._zod.values),st(e._zod,"optin",()=>a.in._zod.optin),st(e._zod,"optout",()=>a.out._zod.optout),st(e._zod,"propValues",()=>a.in._zod.propValues),e._zod.parse=(i,l)=>{if(l.direction==="backward"){const u=a.out._zod.run(i,l);return u instanceof Promise?u.then(c=>uu(c,a.in,l)):uu(u,a.in,l)}const s=a.in._zod.run(i,l);return s instanceof Promise?s.then(u=>uu(u,a.out,l)):uu(s,a.out,l)}});function uu(e,a,i){return e.issues.length?(e.aborted=!0,e):a._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},i)}const Z_=re("$ZodReadonly",(e,a)=>{Ct.init(e,a),st(e._zod,"propValues",()=>a.innerType._zod.propValues),st(e._zod,"values",()=>a.innerType._zod.values),st(e._zod,"optin",()=>a.innerType?._zod?.optin),st(e._zod,"optout",()=>a.innerType?._zod?.optout),e._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(gv):gv(s)}});function gv(e){return e.value=Object.freeze(e.value),e}const q_=re("$ZodCustom",(e,a)=>{pn.init(e,a),Ct.init(e,a),e._zod.parse=(i,l)=>i,e._zod.check=i=>{const l=i.value,s=a.fn(l);if(s instanceof Promise)return s.then(u=>vv(u,i,l,e));vv(s,i,l,e)}});function vv(e,a,i,l){if(!e){const s={code:"custom",input:i,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(s.params=l._zod.def.params),a.issues.push(Ro(s))}}var bv;class P_{constructor(){this._map=new WeakMap,this._idmap=new Map}add(a,...i){const l=i[0];return this._map.set(a,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,a),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(a){const i=this._map.get(a);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(a),this}get(a){const i=a._zod.parent;if(i){const l={...this.get(i)??{}};delete l.id;const s={...l,...this._map.get(a)};return Object.keys(s).length?s:void 0}return this._map.get(a)}has(a){return this._map.has(a)}}function Q_(){return new P_}(bv=globalThis).__zod_globalRegistry??(bv.__zod_globalRegistry=Q_());const po=globalThis.__zod_globalRegistry;function F_(e,a){return new e({type:"string",...ze(a)})}function Y_(e,a){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ze(a)})}function xv(e,a){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ze(a)})}function G_(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ze(a)})}function K_(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ze(a)})}function V_(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ze(a)})}function X_(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ze(a)})}function I_(e,a){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ze(a)})}function J_(e,a){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ze(a)})}function W_(e,a){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ze(a)})}function eE(e,a){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ze(a)})}function tE(e,a){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ze(a)})}function nE(e,a){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ze(a)})}function aE(e,a){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ze(a)})}function rE(e,a){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ze(a)})}function iE(e,a){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ze(a)})}function lE(e,a){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ze(a)})}function oE(e,a){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ze(a)})}function sE(e,a){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ze(a)})}function uE(e,a){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ze(a)})}function cE(e,a){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ze(a)})}function fE(e,a){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ze(a)})}function dE(e,a){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ze(a)})}function hE(e,a){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ze(a)})}function mE(e,a){return new)DELIM" - R"DELIM( e({type:"string",format:"date",check:"string_format",...ze(a)})}function pE(e,a){return new e({type:"string",format:"time",check:"string_format",precision:null,...ze(a)})}function yE(e,a){return new e({type:"string",format:"duration",check:"string_format",...ze(a)})}function gE(e,a){return new e({type:"number",checks:[],...ze(a)})}function vE(e,a){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ze(a)})}function bE(e,a){return new e({type:"boolean",...ze(a)})}function xE(e){return new e({type:"unknown"})}function SE(e,a){return new e({type:"never",...ze(a)})}function Sv(e,a){return new tb({check:"less_than",...ze(a),value:e,inclusive:!1})}function Sd(e,a){return new tb({check:"less_than",...ze(a),value:e,inclusive:!0})}function wv(e,a){return new nb({check:"greater_than",...ze(a),value:e,inclusive:!1})}function wd(e,a){return new nb({check:"greater_than",...ze(a),value:e,inclusive:!0})}function _v(e,a){return new U2({check:"multiple_of",...ze(a),value:e})}function sb(e,a){return new $2({check:"max_length",...ze(a),maximum:e})}function Du(e,a){return new Z2({check:"min_length",...ze(a),minimum:e})}function ub(e,a){return new q2({check:"length_equals",...ze(a),length:e})}function wE(e,a){return new P2({check:"string_format",format:"regex",...ze(a),pattern:e})}function _E(e){return new Q2({check:"string_format",format:"lowercase",...ze(e)})}function EE(e){return new F2({check:"string_format",format:"uppercase",...ze(e)})}function TE(e,a){return new Y2({check:"string_format",format:"includes",...ze(a),includes:e})}function RE(e,a){return new G2({check:"string_format",format:"starts_with",...ze(a),prefix:e})}function zE(e,a){return new K2({check:"string_format",format:"ends_with",...ze(a),suffix:e})}function cl(e){return new V2({check:"overwrite",tx:e})}function AE(e){return cl(a=>a.normalize(e))}function CE(){return cl(e=>e.trim())}function jE(){return cl(e=>e.toLowerCase())}function NE(){return cl(e=>e.toUpperCase())}function OE(){return cl(e=>$w(e))}function ME(e,a,i){return new e({type:"array",element:a,...ze(i)})}function kE(e,a,i){return new e({type:"custom",check:"custom",fn:a,...ze(i)})}function DE(e,a){const i=LE(l=>(l.addIssue=s=>{if(typeof s=="string")l.issues.push(Ro(s,l.value,i._zod.def));else{const u=s;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=l.value),u.inst??(u.inst=i),u.continue??(u.continue=!i._zod.def.abort),l.issues.push(Ro(u))}},e(l.value,l)),a);return i}function LE(e,a){const i=new pn({check:"custom",...ze(a)});return i._zod.check=e,i}function cb(e){let a=e?.target??"draft-2020-12";return a==="draft-4"&&(a="draft-04"),a==="draft-7"&&(a="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??po,target:a,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Gt(e,a,i={path:[],schemaPath:[]}){var l;const s=e._zod.def,u=a.seen.get(e);if(u)return u.count++,i.schemaPath.includes(e)&&(u.cycle=i.path),u.schema;const c={schema:{},count:1,cycle:void 0,path:i.path};a.seen.set(e,c);const d=e._zod.toJSONSchema?.();if(d)c.schema=d;else{const b={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(a,c.schema,b);else{const x=c.schema,_=a.processors[s.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);_(e,a,x,b)}const g=e._zod.parent;g&&(c.ref||(c.ref=g),Gt(g,a,b),a.seen.get(g).isParent=!0)}const m=a.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),a.io==="input"&&an(e)&&(delete c.schema.examples,delete c.schema.default),a.io==="input"&&"_prefault"in c.schema&&((l=c.schema).default??(l.default=c.schema._prefault)),delete c.schema._prefault,a.seen.get(e).schema}function fb(e,a){const i=e.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const c of e.seen.entries()){const d=e.metadataRegistry.get(c[0])?.id;if(d){const m=l.get(d);if(m&&m!==c[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(d,c[0])}}const s=c=>{const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(c[0])?.id,x=e.external.uri??(R=>R);if(g)return{ref:x(g)};const _=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=_,{defId:_,ref:`${x("__shared")}#/${d}/${_}`}}if(c[1]===i)return{ref:"#"};const p=`#/${d}/`,b=c[1].schema.id??`__schema${e.counter++}`;return{defId:b,ref:p+b}},u=c=>{if(c[1].schema.$ref)return;const d=c[1],{ref:m,defId:p}=s(c);d.def={...d.schema},p&&(d.defId=p);const b=d.schema;for(const g in b)delete b[g];b.$ref=m};if(e.cycles==="throw")for(const c of e.seen.entries()){const d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ + `)}_.write("payload.value = newResult;"),_.write("return payload;");const X=_.compile();return(ne,se)=>X(x,ne,se)};let u;const c=Ou,d=!bh.jitless,p=d&&qw.value,b=a.catchall;let g;e._zod.parse=(x,_)=>{g??(g=l.value);const z=x.value;return c(z)?d&&p&&_?.async===!1&&_.jitless!==!0?(u||(u=s(a.shape)),x=u(x,_),b?ob([],z,x,_,g,e):x):i(x,_):(x.issues.push({expected:"object",code:"invalid_type",input:z,inst:e}),x)}});function dv(e,a,i,l){for(const u of e)if(u.issues.length===0)return a.value=u.value,a;const s=e.filter(u=>!nl(u));return s.length===1?(a.value=s[0].value,s[0]):(a.issues.push({code:"invalid_union",input:a.value,inst:i,errors:e.map(u=>u.issues.map(c=>ii(c,l,ri())))}),a)}const N2=re("$ZodUnion",(e,a)=>{Ct.init(e,a),st(e._zod,"optin",()=>a.options.some(l=>l._zod.optin==="optional")?"optional":void 0),st(e._zod,"optout",()=>a.options.some(l=>l._zod.optout==="optional")?"optional":void 0),st(e._zod,"values",()=>{if(a.options.every(l=>l._zod.values))return new Set(a.options.flatMap(l=>Array.from(l._zod.values)))}),st(e._zod,"pattern",()=>{if(a.options.every(l=>l._zod.pattern)){const l=a.options.map(s=>s._zod.pattern);return new RegExp(`^(${l.map(s=>wh(s.source)).join("|")})$`)}});const i=a.options.length===1?a.options[0]._zod.run:null;e._zod.parse=(l,s)=>{if(i)return i(l,s);let u=!1;const)DELIM" + R"DELIM( c=[];for(const d of a.options){const m=d._zod.run({value:l.value,issues:[]},s);if(m instanceof Promise)c.push(m),u=!0;else{if(m.issues.length===0)return m;c.push(m)}}return u?Promise.all(c).then(d=>dv(d,l,e,s)):dv(c,l,e,s)}}),O2=re("$ZodIntersection",(e,a)=>{Ct.init(e,a),e._zod.parse=(i,l)=>{const s=i.value,u=a.left._zod.run({value:s,issues:[]},l),c=a.right._zod.run({value:s,issues:[]},l);return u instanceof Promise||c instanceof Promise?Promise.all([u,c]).then(([m,p])=>hv(i,m,p)):hv(i,u,c)}});function Wd(e,a){if(e===a)return{valid:!0,data:e};if(e instanceof Date&&a instanceof Date&&+e==+a)return{valid:!0,data:e};if(To(e)&&To(a)){const i=Object.keys(a),l=Object.keys(e).filter(u=>i.indexOf(u)!==-1),s={...e,...a};for(const u of l){const c=Wd(e[u],a[u]);if(!c.valid)return{valid:!1,mergeErrorPath:[u,...c.mergeErrorPath]};s[u]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(a)){if(e.length!==a.length)return{valid:!1,mergeErrorPath:[]};const i=[];for(let l=0;ld.l&&d.r).map(([d])=>d);if(u.length&&s&&e.issues.push({...s,keys:u}),nl(e))return e;const c=Wd(a.value,i.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const M2=re("$ZodEnum",(e,a)=>{Ct.init(e,a);const i=F0(a.entries),l=new Set(i);e._zod.values=l,e._zod.pattern=new RegExp(`^(${i.filter(s=>Pw.has(typeof s)).map(s=>typeof s=="string"?Gu(s):s.toString()).join("|")})$`),e._zod.parse=(s,u)=>{const c=s.value;return l.has(c)||s.issues.push({code:"invalid_value",values:i,input:c,inst:e}),s}}),k2=re("$ZodTransform",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",e._zod.parse=(i,l)=>{if(l.direction==="backward")throw new Q0(e.constructor.name);const s=a.transform(i.value,i);if(l.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(i.value=c,i.fallback=!0,i));if(s instanceof Promise)throw new rl;return i.value=s,i.fallback=!0,i}});function mv(e,a){return a===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const sb=re("$ZodOptional",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",e._zod.optout="optional",st(e._zod,"values",()=>a.innerType._zod.values?new Set([...a.innerType._zod.values,void 0]):void 0),st(e._zod,"pattern",()=>{const i=a.innerType._zod.pattern;return i?new RegExp(`^(${wh(i.source)})?$`):void 0}),e._zod.parse=(i,l)=>{if(a.innerType._zod.optin==="optional"){const s=i.value,u=a.innerType._zod.run(i,l);return u instanceof Promise?u.then(c=>mv(c,s)):mv(u,s)}return i.value===void 0?i:a.innerType._zod.run(i,l)}}),D2=re("$ZodExactOptional",(e,a)=>{sb.init(e,a),st(e._zod,"values",()=>a.innerType._zod.values),st(e._zod,"pattern",()=>a.innerType._zod.pattern),e._zod.parse=(i,l)=>a.innerType._zod.run(i,l)}),L2=re("$ZodNullable",(e,a)=>{Ct.init(e,a),st(e._zod,"optin",()=>a.innerType._zod.optin),st(e._zod,"optout",()=>a.innerType._zod.optout),st(e._zod,"pattern",()=>{const i=a.innerType._zod.pattern;return i?new RegExp(`^(${wh(i.source)}|null)$`):void 0}),st(e._zod,"values",()=>a.innerType._zod.values?new Set([...a.innerType._zod.values,null]):void 0),e._zod.parse=(i,l)=>i.value===null?i:a.innerType._zod.run(i,l)}),B2=re("$ZodDefault",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",st(e._zod,"values",()=>a.innerType._zod.values),e._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);if(i.value===void 0)return i.value=a.defaultValue,i;const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(u=>pv(u,a)):pv(s,a)}});function pv(e,a){return e.value===void 0&&(e.value=a.defaultValue),e}const U2=re("$ZodPrefault",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",st(e._zod,"values",()=>a.innerType._zod.values),e._zod.parse=(i,l)=>(l.direction==="backward"||i.value===void 0&&(i.value=a.defaultValue),a.innerType._zod.run(i,l))}),H2=re("$ZodNonOptional",(e,a)=>{Ct.init(e,a),st(e._zod,"values",()=>{const i=a.innerType._zod.values;return i?new Set([...i].filter(l=>l!==void 0)):void 0}),e._zod.parse=(i,l)=>{const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(u=>yv(u,e)):yv(s,e)}});function yv(e,a){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:a}),e}const $2=re("$ZodCatch",(e,a)=>{Ct.init(e,a),e._zod.optin="optional",st(e._zod,"optout",()=>a.innerType._zod.optout),st(e._zod,"values",()=>a.innerType._zod.values),e._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);const s=a.inner)DELIM" + R"DELIM(Type._zod.run(i,l);return s instanceof Promise?s.then(u=>(i.value=u.value,u.issues.length&&(i.value=a.catchValue({...i,error:{issues:u.issues.map(c=>ii(c,l,ri()))},input:i.value}),i.issues=[],i.fallback=!0),i)):(i.value=s.value,s.issues.length&&(i.value=a.catchValue({...i,error:{issues:s.issues.map(u=>ii(u,l,ri()))},input:i.value}),i.issues=[],i.fallback=!0),i)}}),Z2=re("$ZodPipe",(e,a)=>{Ct.init(e,a),st(e._zod,"values",()=>a.in._zod.values),st(e._zod,"optin",()=>a.in._zod.optin),st(e._zod,"optout",()=>a.out._zod.optout),st(e._zod,"propValues",()=>a.in._zod.propValues),e._zod.parse=(i,l)=>{if(l.direction==="backward"){const u=a.out._zod.run(i,l);return u instanceof Promise?u.then(c=>uu(c,a.in,l)):uu(u,a.in,l)}const s=a.in._zod.run(i,l);return s instanceof Promise?s.then(u=>uu(u,a.out,l)):uu(s,a.out,l)}});function uu(e,a,i){return e.issues.length?(e.aborted=!0,e):a._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},i)}const q2=re("$ZodReadonly",(e,a)=>{Ct.init(e,a),st(e._zod,"propValues",()=>a.innerType._zod.propValues),st(e._zod,"values",()=>a.innerType._zod.values),st(e._zod,"optin",()=>a.innerType?._zod?.optin),st(e._zod,"optout",()=>a.innerType?._zod?.optout),e._zod.parse=(i,l)=>{if(l.direction==="backward")return a.innerType._zod.run(i,l);const s=a.innerType._zod.run(i,l);return s instanceof Promise?s.then(gv):gv(s)}});function gv(e){return e.value=Object.freeze(e.value),e}const P2=re("$ZodCustom",(e,a)=>{pn.init(e,a),Ct.init(e,a),e._zod.parse=(i,l)=>i,e._zod.check=i=>{const l=i.value,s=a.fn(l);if(s instanceof Promise)return s.then(u=>vv(u,i,l,e));vv(s,i,l,e)}});function vv(e,a,i,l){if(!e){const s={code:"custom",input:i,inst:l,path:[...l._zod.def.path??[]],continue:!l._zod.def.abort};l._zod.def.params&&(s.params=l._zod.def.params),a.issues.push(Ro(s))}}var bv;class Q2{constructor(){this._map=new WeakMap,this._idmap=new Map}add(a,...i){const l=i[0];return this._map.set(a,l),l&&typeof l=="object"&&"id"in l&&this._idmap.set(l.id,a),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(a){const i=this._map.get(a);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(a),this}get(a){const i=a._zod.parent;if(i){const l={...this.get(i)??{}};delete l.id;const s={...l,...this._map.get(a)};return Object.keys(s).length?s:void 0}return this._map.get(a)}has(a){return this._map.has(a)}}function F2(){return new Q2}(bv=globalThis).__zod_globalRegistry??(bv.__zod_globalRegistry=F2());const po=globalThis.__zod_globalRegistry;function Y2(e,a){return new e({type:"string",...ze(a)})}function G2(e,a){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ze(a)})}function xv(e,a){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ze(a)})}function K2(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ze(a)})}function V2(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ze(a)})}function X2(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ze(a)})}function I2(e,a){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ze(a)})}function J2(e,a){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ze(a)})}function W2(e,a){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ze(a)})}function eE(e,a){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ze(a)})}function tE(e,a){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ze(a)})}function nE(e,a){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ze(a)})}function aE(e,a){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ze(a)})}function rE(e,a){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ze(a)})}function iE(e,a){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ze(a)})}function lE(e,a){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ze(a)})}function oE(e,a){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ze(a)})}function sE(e,a){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ze(a)})}function uE(e,a){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ze(a)})}function cE(e,a){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ze(a)})}function fE(e,a){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ze(a)})}function dE(e,a){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ze(a)})}function hE(e,a){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ze(a)})}function mE(e,a){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ze(a)})}function pE(e,a){return new)DELIM" + R"DELIM( e({type:"string",format:"date",check:"string_format",...ze(a)})}function yE(e,a){return new e({type:"string",format:"time",check:"string_format",precision:null,...ze(a)})}function gE(e,a){return new e({type:"string",format:"duration",check:"string_format",...ze(a)})}function vE(e,a){return new e({type:"number",checks:[],...ze(a)})}function bE(e,a){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ze(a)})}function xE(e,a){return new e({type:"boolean",...ze(a)})}function SE(e){return new e({type:"unknown"})}function wE(e,a){return new e({type:"never",...ze(a)})}function Sv(e,a){return new nb({check:"less_than",...ze(a),value:e,inclusive:!1})}function xd(e,a){return new nb({check:"less_than",...ze(a),value:e,inclusive:!0})}function wv(e,a){return new ab({check:"greater_than",...ze(a),value:e,inclusive:!1})}function Sd(e,a){return new ab({check:"greater_than",...ze(a),value:e,inclusive:!0})}function _v(e,a){return new H_({check:"multiple_of",...ze(a),value:e})}function ub(e,a){return new Z_({check:"max_length",...ze(a),maximum:e})}function ku(e,a){return new q_({check:"min_length",...ze(a),minimum:e})}function cb(e,a){return new P_({check:"length_equals",...ze(a),length:e})}function _E(e,a){return new Q_({check:"string_format",format:"regex",...ze(a),pattern:e})}function EE(e){return new F_({check:"string_format",format:"lowercase",...ze(e)})}function TE(e){return new Y_({check:"string_format",format:"uppercase",...ze(e)})}function RE(e,a){return new G_({check:"string_format",format:"includes",...ze(a),includes:e})}function zE(e,a){return new K_({check:"string_format",format:"starts_with",...ze(a),prefix:e})}function AE(e,a){return new V_({check:"string_format",format:"ends_with",...ze(a),suffix:e})}function cl(e){return new X_({check:"overwrite",tx:e})}function CE(e){return cl(a=>a.normalize(e))}function jE(){return cl(e=>e.trim())}function NE(){return cl(e=>e.toLowerCase())}function OE(){return cl(e=>e.toUpperCase())}function ME(){return cl(e=>Zw(e))}function kE(e,a,i){return new e({type:"array",element:a,...ze(i)})}function DE(e,a,i){return new e({type:"custom",check:"custom",fn:a,...ze(i)})}function LE(e,a){const i=BE(l=>(l.addIssue=s=>{if(typeof s=="string")l.issues.push(Ro(s,l.value,i._zod.def));else{const u=s;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=l.value),u.inst??(u.inst=i),u.continue??(u.continue=!i._zod.def.abort),l.issues.push(Ro(u))}},e(l.value,l)),a);return i}function BE(e,a){const i=new pn({check:"custom",...ze(a)});return i._zod.check=e,i}function fb(e){let a=e?.target??"draft-2020-12";return a==="draft-4"&&(a="draft-04"),a==="draft-7"&&(a="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??po,target:a,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Yt(e,a,i={path:[],schemaPath:[]}){var l;const s=e._zod.def,u=a.seen.get(e);if(u)return u.count++,i.schemaPath.includes(e)&&(u.cycle=i.path),u.schema;const c={schema:{},count:1,cycle:void 0,path:i.path};a.seen.set(e,c);const d=e._zod.toJSONSchema?.();if(d)c.schema=d;else{const b={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(a,c.schema,b);else{const x=c.schema,_=a.processors[s.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);_(e,a,x,b)}const g=e._zod.parent;g&&(c.ref||(c.ref=g),Yt(g,a,b),a.seen.get(g).isParent=!0)}const m=a.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),a.io==="input"&&an(e)&&(delete c.schema.examples,delete c.schema.default),a.io==="input"&&"_prefault"in c.schema&&((l=c.schema).default??(l.default=c.schema._prefault)),delete c.schema._prefault,a.seen.get(e).schema}function db(e,a){const i=e.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const c of e.seen.entries()){const d=e.metadataRegistry.get(c[0])?.id;if(d){const m=l.get(d);if(m&&m!==c[0])throw new Error(`Duplicate schema id "${d}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(d,c[0])}}const s=c=>{const d=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(c[0])?.id,x=e.external.uri??(z=>z);if(g)return{ref:x(g)};const _=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=_,{defId:_,ref:`${x("__shared")}#/${d}/${_}`}}if(c[1]===i)return{ref:"#"};const p=`#/${d}/`,b=c[1].schema.id??`__schema${e.counter++}`;return{defId:b,ref:p+b}},u=c=>{if(c[1].schema.$ref)return;const d=c[1],{ref:m,defId:p}=s(c);d.def={...d.schema},p&&(d.defId=p);const b=d.schema;for(const g in b)delete b[g];b.$ref=m};if(e.cycles==="throw")for(const c of e.seen.entries()){const d=c[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/ Set the \`cycles\` parameter )DELIM" -R"DELIM(to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const d=c[1];if(a===c[0]){u(c);continue}if(e.external){const p=e.external.registry.get(c[0])?.id;if(a!==c[0]&&p){u(c);continue}}if(e.metadataRegistry.get(c[0])?.id){u(c);continue}if(d.cycle){u(c);continue}if(d.count>1&&e.reused==="ref"){u(c);continue}}}function db(e,a){const i=e.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=d=>{const m=e.seen.get(d);if(m.ref===null)return;const p=m.def??m.schema,b={...p},g=m.ref;if(m.ref=null,g){l(g);const _=e.seen.get(g),R=_.schema;if(R.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(R)):Object.assign(p,R),Object.assign(p,b),d._zod.parent===g)for(const k in p)k==="$ref"||k==="allOf"||k in b||delete p[k];if(R.$ref&&_.def)for(const k in p)k==="$ref"||k==="allOf"||k in _.def&&JSON.stringify(p[k])===JSON.stringify(_.def[k])&&delete p[k]}const x=d._zod.parent;if(x&&x!==g){l(x);const _=e.seen.get(x);if(_?.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const R in p)R==="$ref"||R==="allOf"||R in _.def&&JSON.stringify(p[R])===JSON.stringify(_.def[R])&&delete p[R]}e.override({zodSchema:d,jsonSchema:p,path:m.path??[]})};for(const d of[...e.seen.entries()].reverse())l(d[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const d=e.external.registry.get(a)?.id;if(!d)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(d)}Object.assign(s,i.def??i.schema);const u=e.metadataRegistry.get(a)?.id;u!==void 0&&s.id===u&&delete s.id;const c=e.external?.defs??{};for(const d of e.seen.entries()){const m=d[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,c[m.defId]=m.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?s.$defs=c:s.definitions=c);try{const d=JSON.parse(JSON.stringify(s));return Object.defineProperty(d,"~standard",{value:{...a["~standard"],jsonSchema:{input:Lu(a,"input",e.processors),output:Lu(a,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function an(e,a){const i=a??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const l=e._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return an(l.element,i);if(l.type==="set")return an(l.valueType,i);if(l.type==="lazy")return an(l.getter(),i);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault")return an(l.innerType,i);if(l.type==="intersection")return an(l.left,i)||an(l.right,i);if(l.type==="record"||l.type==="map")return an(l.keyType,i)||an(l.valueType,i);if(l.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:an(l.in,i)||an(l.out,i);if(l.type==="object"){for(const s in l.shape)if(an(l.shape[s],i))return!0;return!1}if(l.type==="union"){for(const s of l.options)if(an(s,i))return!0;return!1}if(l.type==="tuple"){for(const s of l.items)if(an(s,i))return!0;return!!(l.rest&&an(l.rest,i))}return!1}const BE=(e,a={})=>i=>{const l=cb({...i,processors:a});return Gt(e,l),fb(l,e),db(l,e)},Lu=(e,a,i={})=>l=>{const{libraryOptions:s,target:u}=l??{},c=cb({...s??{},target:u,io:a,processors:i});return Gt(e,c),fb(c,e),db(c,e)},UE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},HE=(e,a,i,l)=>{const s=i;s.type="string";const{minimum:u,maximum:c,format:d,patterns:m,contentEncoding:p}=e._zod.bag;if(typeof u=="number"&&(s.minLength=u),typeof c=="number"&&(s.maxLength=c),d&&(s.format=UE[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),p&&(s.contentEncoding=p),m&&m.size>0){const b=[...m];b.length===1?s.pattern=b[0].source:b.length>1&&(s.allOf=[...b.map(g=>({...a.target==="draft-07"||a.target==="draft-04"||a.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},$E=(e,a,i,l)=>{const s=i,{minimum:u,maximum:c,format:d,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:b}=e._zod.bag;typeof d=="string"&&d.includes("int")?s.type="integer":s.type="number";const g=typeof b=="number"&&b>=(u??Number.NEGATIVE_INFINITY),x=typeof p=="number"&&p<=(c??Number.POSITIVE_INFINITY),_=a.target==="draft-04"||a.target==="openapi-3.0";g?_?(s.minimum=b,s.exclusiveMinimum=!0):s.exclusiveMinimum=b:typeof u=="number"&&(s.minimum=u),x?_?(s.maximum=p,s.exclusiveMaximum=!0):s.exclusiveMaximum=p:typeof c=="number"&&(s.maximum=c),typeof m=="number"&&(s.multipleOf=m)},ZE=(e,a,i,l)=>{i.type="boolean"},qE=(e,a,i,l)=>{i.not={}},PE=(e,a,i,l)=>{},QE=(e,a,i,l)=>{const s=e._zod.def,u=Q0(s.entries);u.every(c=>typeof c=="number")&&(i.type="number"),u.every(c=>typeof c=="string")&&(i.type="string"),i.enum=u},FE=(e,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schem)DELIM" -R"DELIM(a")},YE=(e,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},GE=(e,a,i,l)=>{const s=i,u=e._zod.def,{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof d=="number"&&(s.maxItems=d),s.type="array",s.items=Gt(u.element,a,{...l,path:[...l.path,"items"]})},KE=(e,a,i,l)=>{const s=i,u=e._zod.def;s.type="object",s.properties={};const c=u.shape;for(const p in c)s.properties[p]=Gt(c[p],a,{...l,path:[...l.path,"properties",p]});const d=new Set(Object.keys(c)),m=new Set([...d].filter(p=>{const b=u.shape[p]._zod;return a.io==="input"?b.optin===void 0:b.optout===void 0}));m.size>0&&(s.required=Array.from(m)),u.catchall?._zod.def.type==="never"?s.additionalProperties=!1:u.catchall?u.catchall&&(s.additionalProperties=Gt(u.catchall,a,{...l,path:[...l.path,"additionalProperties"]})):a.io==="output"&&(s.additionalProperties=!1)},VE=(e,a,i,l)=>{const s=e._zod.def,u=s.inclusive===!1,c=s.options.map((d,m)=>Gt(d,a,{...l,path:[...l.path,u?"oneOf":"anyOf",m]}));u?i.oneOf=c:i.anyOf=c},XE=(e,a,i,l)=>{const s=e._zod.def,u=Gt(s.left,a,{...l,path:[...l.path,"allOf",0]}),c=Gt(s.right,a,{...l,path:[...l.path,"allOf",1]}),d=p=>"allOf"in p&&Object.keys(p).length===1,m=[...d(u)?u.allOf:[u],...d(c)?c.allOf:[c]];i.allOf=m},IE=(e,a,i,l)=>{const s=e._zod.def,u=Gt(s.innerType,a,l),c=a.seen.get(e);a.target==="openapi-3.0"?(c.ref=s.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},JE=(e,a,i,l)=>{const s=e._zod.def;Gt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType},WE=(e,a,i,l)=>{const s=e._zod.def;Gt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType,i.default=JSON.parse(JSON.stringify(s.defaultValue))},eT=(e,a,i,l)=>{const s=e._zod.def;Gt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType,a.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},tT=(e,a,i,l)=>{const s=e._zod.def;Gt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=c},nT=(e,a,i,l)=>{const s=e._zod.def,u=s.in._zod.traits.has("$ZodTransform"),c=a.io==="input"?u?s.out:s.in:s.out;Gt(c,a,l);const d=a.seen.get(e);d.ref=c},aT=(e,a,i,l)=>{const s=e._zod.def;Gt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType,i.readOnly=!0},hb=(e,a,i,l)=>{const s=e._zod.def;Gt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType},rT=re("ZodISODateTime",(e,a)=>{u_.init(e,a),bt.init(e,a)});function iT(e){return hE(rT,e)}const lT=re("ZodISODate",(e,a)=>{c_.init(e,a),bt.init(e,a)});function oT(e){return mE(lT,e)}const sT=re("ZodISOTime",(e,a)=>{f_.init(e,a),bt.init(e,a)});function uT(e){return pE(sT,e)}const cT=re("ZodISODuration",(e,a)=>{d_.init(e,a),bt.init(e,a)});function fT(e){return yE(cT,e)}const dT=(e,a)=>{V0.init(e,a),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>e2(e,i)},flatten:{value:i=>Ww(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Wd,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Wd,2)}},isEmpty:{get(){return e.issues.length===0}}})},Pn=re("ZodError",dT,{Parent:Error}),hT=Th(Pn),mT=Rh(Pn),pT=Vu(Pn),yT=Xu(Pn),gT=a2(Pn),vT=r2(Pn),bT=i2(Pn),xT=l2(Pn),ST=o2(Pn),wT=s2(Pn),_T=u2(Pn),ET=c2(Pn),Ev=new WeakMap;function Lo(e,a,i){const l=Object.getPrototypeOf(e);let s=Ev.get(l);if(s||(s=new Set,Ev.set(l,s)),!s.has(a)){s.add(a);for(const u in i){const c=i[u];Object.defineProperty(l,u,{configurable:!0,enumerable:!1,get(){const d=c.bind(this);return Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:d}),d},set(d){Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:d})}})}}}const jt=re("ZodType",(e,a)=>(Ct.init(e,a),Object.assign(e["~standard"],{jsonSchema:{input:Lu(e,"input"),output:Lu(e,"output")}}),e.toJSONSchema=BE(e,{}),e.def=a,e.type=a.type,Object.defineProperty(e,"_def",{value:a}),e.parse=(i,l)=>hT(e,i,l,{callee:e.parse}),e.safeParse=(i,l)=>pT(e,i,l),e.parseAsync=async(i,l)=>mT(e,i,l,{callee:e.parseAsync}),e.safeParseAsync=async(i,l)=>yT(e,i,l),e.spa=e.safeParseAsync,e.encode=(i,l)=>gT(e,i,l),e.decode=(i,l)=>vT(e,i,l),e.encodeAsync=async(i,l)=>bT(e,i,l),e.decodeAsync=async(i,l)=>xT(e,i,l),e.safeEncode=(i,l)=>ST(e,i,l),e.safeDecode=(i,l)=>wT(e,i,l),e.safeEncodeAsync=async(i,l)=>_T(e,i,l),e.safeDecodeAsync=async(i,l)=>ET(e,i,l),Lo(e,"ZodType",{check(...i){const l=this.def;return this.clone(Nr(l,{checks:[...l.checks??[],...i.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...i){return this.check(...i)},clone(i,l){return Or(this,i,l)},brand(){return this},register(i,l){return i.add(this,l),this},refine(i,l){return this.check(g4(i,l))},superRefine(i,l){return this.check(v4(i,l))},overwrite(i){return this.check(cl(i))},optional(){return Av(this)},exactOptional(){return r4(this)},nullable(){return Cv(this)},nullish(){return Av(Cv(this))},nonoptional(i){return c4(this,i))DELIM" -R"DELIM(},array(){return sl(this)},or(i){return IT([this,i])},and(i){return WT(this,i)},transform(i){return jv(this,n4(i))},default(i){return o4(this,i)},prefault(i){return u4(this,i)},catch(i){return d4(this,i)},pipe(i){return jv(this,i)},readonly(){return p4(this)},describe(i){const l=this.clone();return po.add(l,{description:i}),l},meta(...i){if(i.length===0)return po.get(this);const l=this.clone();return po.add(l,i[0]),l},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(i){return i(this)}}),Object.defineProperty(e,"description",{get(){return po.get(e)?.description},configurable:!0}),e)),mb=re("_ZodString",(e,a)=>{zh.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(l,s,u)=>HE(e,l,s);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,Lo(e,"_ZodString",{regex(...l){return this.check(wE(...l))},includes(...l){return this.check(TE(...l))},startsWith(...l){return this.check(RE(...l))},endsWith(...l){return this.check(zE(...l))},min(...l){return this.check(Du(...l))},max(...l){return this.check(sb(...l))},length(...l){return this.check(ub(...l))},nonempty(...l){return this.check(Du(1,...l))},lowercase(l){return this.check(_E(l))},uppercase(l){return this.check(EE(l))},trim(){return this.check(CE())},normalize(...l){return this.check(AE(...l))},toLowerCase(){return this.check(jE())},toUpperCase(){return this.check(NE())},slugify(){return this.check(OE())}})}),TT=re("ZodString",(e,a)=>{zh.init(e,a),mb.init(e,a),e.email=i=>e.check(Y_(RT,i)),e.url=i=>e.check(I_(zT,i)),e.jwt=i=>e.check(dE(qT,i)),e.emoji=i=>e.check(J_(AT,i)),e.guid=i=>e.check(xv(Tv,i)),e.uuid=i=>e.check(G_(cu,i)),e.uuidv4=i=>e.check(K_(cu,i)),e.uuidv6=i=>e.check(V_(cu,i)),e.uuidv7=i=>e.check(X_(cu,i)),e.nanoid=i=>e.check(W_(CT,i)),e.guid=i=>e.check(xv(Tv,i)),e.cuid=i=>e.check(eE(jT,i)),e.cuid2=i=>e.check(tE(NT,i)),e.ulid=i=>e.check(nE(OT,i)),e.base64=i=>e.check(uE(HT,i)),e.base64url=i=>e.check(cE($T,i)),e.xid=i=>e.check(aE(MT,i)),e.ksuid=i=>e.check(rE(kT,i)),e.ipv4=i=>e.check(iE(DT,i)),e.ipv6=i=>e.check(lE(LT,i)),e.cidrv4=i=>e.check(oE(BT,i)),e.cidrv6=i=>e.check(sE(UT,i)),e.e164=i=>e.check(fE(ZT,i)),e.datetime=i=>e.check(iT(i)),e.date=i=>e.check(oT(i)),e.time=i=>e.check(uT(i)),e.duration=i=>e.check(fT(i))});function Lt(e){return F_(TT,e)}const bt=re("ZodStringFormat",(e,a)=>{gt.init(e,a),mb.init(e,a)}),RT=re("ZodEmail",(e,a)=>{e_.init(e,a),bt.init(e,a)}),Tv=re("ZodGUID",(e,a)=>{J2.init(e,a),bt.init(e,a)}),cu=re("ZodUUID",(e,a)=>{W2.init(e,a),bt.init(e,a)}),zT=re("ZodURL",(e,a)=>{t_.init(e,a),bt.init(e,a)}),AT=re("ZodEmoji",(e,a)=>{n_.init(e,a),bt.init(e,a)}),CT=re("ZodNanoID",(e,a)=>{a_.init(e,a),bt.init(e,a)}),jT=re("ZodCUID",(e,a)=>{r_.init(e,a),bt.init(e,a)}),NT=re("ZodCUID2",(e,a)=>{i_.init(e,a),bt.init(e,a)}),OT=re("ZodULID",(e,a)=>{l_.init(e,a),bt.init(e,a)}),MT=re("ZodXID",(e,a)=>{o_.init(e,a),bt.init(e,a)}),kT=re("ZodKSUID",(e,a)=>{s_.init(e,a),bt.init(e,a)}),DT=re("ZodIPv4",(e,a)=>{h_.init(e,a),bt.init(e,a)}),LT=re("ZodIPv6",(e,a)=>{m_.init(e,a),bt.init(e,a)}),BT=re("ZodCIDRv4",(e,a)=>{p_.init(e,a),bt.init(e,a)}),UT=re("ZodCIDRv6",(e,a)=>{y_.init(e,a),bt.init(e,a)}),HT=re("ZodBase64",(e,a)=>{g_.init(e,a),bt.init(e,a)}),$T=re("ZodBase64URL",(e,a)=>{b_.init(e,a),bt.init(e,a)}),ZT=re("ZodE164",(e,a)=>{x_.init(e,a),bt.init(e,a)}),qT=re("ZodJWT",(e,a)=>{w_.init(e,a),bt.init(e,a)}),pb=re("ZodNumber",(e,a)=>{rb.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(l,s,u)=>$E(e,l,s),Lo(e,"ZodNumber",{gt(l,s){return this.check(wv(l,s))},gte(l,s){return this.check(wd(l,s))},min(l,s){return this.check(wd(l,s))},lt(l,s){return this.check(Sv(l,s))},lte(l,s){return this.check(Sd(l,s))},max(l,s){return this.check(Sd(l,s))},int(l){return this.check(Rv(l))},safe(l){return this.check(Rv(l))},positive(l){return this.check(wv(0,l))},nonnegative(l){return this.check(wd(0,l))},negative(l){return this.check(Sv(0,l))},nonpositive(l){return this.check(Sd(0,l))},multipleOf(l,s){return this.check(_v(l,s))},step(l,s){return this.check(_v(l,s))},finite(){return this}});const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function Ge(e){return gE(pb,e)}const PT=re("ZodNumberFormat",(e,a)=>{__.init(e,a),pb.init(e,a)});function Rv(e){return vE(PT,e)}const QT=re("ZodBoolean",(e,a)=>{E_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>ZE(e,i,l)});function Ah(e){return bE(QT,e)}const FT=re("ZodUnknown",(e,a)=>{T_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>PE()});function zv(){return xE(FT)}const YT=re("ZodNever",(e,a)=>{R_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>qE(e,i,l)});function GT(e){return SE(YT,e)}const KT=re("ZodArray",(e,a)=>{z_.init(e,a),j)DELIM" -R"DELIM(t.init(e,a),e._zod.processJSONSchema=(i,l,s)=>GE(e,i,l,s),e.element=a.element,Lo(e,"ZodArray",{min(i,l){return this.check(Du(i,l))},nonempty(i){return this.check(Du(1,i))},max(i,l){return this.check(sb(i,l))},length(i,l){return this.check(ub(i,l))},unwrap(){return this.element}})});function sl(e,a){return ME(KT,e,a)}const VT=re("ZodObject",(e,a)=>{C_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>KE(e,i,l,s),st(e,"shape",()=>a.shape),Lo(e,"ZodObject",{keyof(){return e4(Object.keys(this._zod.def.shape))},catchall(i){return this.clone({...this._zod.def,catchall:i})},passthrough(){return this.clone({...this._zod.def,catchall:zv()})},loose(){return this.clone({...this._zod.def,catchall:zv()})},strict(){return this.clone({...this._zod.def,catchall:GT()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(i){return Gw(this,i)},safeExtend(i){return Kw(this,i)},merge(i){return Vw(this,i)},pick(i){return Fw(this,i)},omit(i){return Yw(this,i)},partial(...i){return Xw(yb,this,i[0])},required(...i){return Iw(gb,this,i[0])}})});function da(e,a){const i={type:"object",shape:e??{},...ze(a)};return new VT(i)}const XT=re("ZodUnion",(e,a)=>{j_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>VE(e,i,l,s),e.options=a.options});function IT(e,a){return new XT({type:"union",options:e,...ze(a)})}const JT=re("ZodIntersection",(e,a)=>{N_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>XE(e,i,l,s)});function WT(e,a){return new JT({type:"intersection",left:e,right:a})}const th=re("ZodEnum",(e,a)=>{O_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(l,s,u)=>QE(e,l,s),e.enum=a.entries,e.options=Object.values(a.entries);const i=new Set(Object.keys(a.entries));e.extract=(l,s)=>{const u={};for(const c of l)if(i.has(c))u[c]=a.entries[c];else throw new Error(`Key ${c} not found in enum`);return new th({...a,checks:[],...ze(s),entries:u})},e.exclude=(l,s)=>{const u={...a.entries};for(const c of l)if(i.has(c))delete u[c];else throw new Error(`Key ${c} not found in enum`);return new th({...a,checks:[],...ze(s),entries:u})}});function e4(e,a){const i=Array.isArray(e)?Object.fromEntries(e.map(l=>[l,l])):e;return new th({type:"enum",entries:i,...ze(a)})}const t4=re("ZodTransform",(e,a)=>{M_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>YE(e,i),e._zod.parse=(i,l)=>{if(l.direction==="backward")throw new P0(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(Ro(u,i.value,a));else{const c=u;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=i.value),c.inst??(c.inst=e),i.issues.push(Ro(c))}};const s=a.transform(i.value,i);return s instanceof Promise?s.then(u=>(i.value=u,i.fallback=!0,i)):(i.value=s,i.fallback=!0,i)}});function n4(e){return new t4({type:"transform",transform:e})}const yb=re("ZodOptional",(e,a)=>{ob.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>hb(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function Av(e){return new yb({type:"optional",innerType:e})}const a4=re("ZodExactOptional",(e,a)=>{k_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>hb(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function r4(e){return new a4({type:"optional",innerType:e})}const i4=re("ZodNullable",(e,a)=>{D_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>IE(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function Cv(e){return new i4({type:"nullable",innerType:e})}const l4=re("ZodDefault",(e,a)=>{L_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>WE(e,i,l,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function o4(e,a){return new l4({type:"default",innerType:e,get defaultValue(){return typeof a=="function"?a():Y0(a)}})}const s4=re("ZodPrefault",(e,a)=>{B_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>eT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function u4(e,a){return new s4({type:"prefault",innerType:e,get defaultValue(){return typeof a=="function"?a():Y0(a)}})}const gb=re("ZodNonOptional",(e,a)=>{U_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>JE(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function c4(e,a){return new gb({type:"nonoptional",innerType:e,...ze(a)})}const f4=re("ZodCatch",(e,a)=>{H_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>tT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function d4(e,a){return new f4({type:"catch",innerType:e,catchValue:typeof a=="function"?a:()=>a})}const h4=re("ZodPipe",(e,a)=>{$_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>nT(e,i,l,s),e.in=a.in,e.out=a.out});function jv(e,a){return new h4({type:"pipe",in:e,out:a})}const m4=re("ZodReadonly",(e,a)=>{Z_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>aT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function p4(e){return new m4({type:"readonly",innerType:e})}const y4=re("ZodCustom",(e,a)=>{q_.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>FE(e,i)});function g4(e,a={}){return kE(y4,e,a)}function v4(e,a){return DE(e,a)}function li(e){if(!e)return;c)DELIM" -R"DELIM(onst a=e.trim();if(!a)return;const i=a.toLowerCase(),l=i.indexOf("1");if(l>0){const c=i.slice(0,l);if(["bc","tb","bcrt","ltc","sb"].includes(c)){const d=i.slice(l+1);if(!d)return;const m=d.charAt(0);return m==="p"?"p2tr":m==="q"?d.length===39||d.length===40||e.length===42?"p2wpkh":d.length===59||d.length===60||e.length===62?"p2wsh":"segwit":"segwit"}}const s=/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(a)&&a.length>=26&&a.length<=35;switch(i[0]){case"1":case"m":case"n":return s?"p2pkh":void 0;case"3":case"2":return s?"p2sh":void 0;default:return}}class Ch extends Error{constructor(a,i){super(a),this.status=i}status}const nh=da({id:Lt(),height:Ge(),timestamp:Ge().optional(),mediantime:Ge().optional(),tx_count:Ge().optional(),size:Ge().optional(),weight:Ge().optional(),difficulty:Ge().optional(),bits:Ge().optional(),merkle_root:Lt().optional(),previousblockhash:Lt().nullable().optional(),nonce:Ge().optional(),version:Ge().optional()}).loose(),b4=da({confirmed:Ah(),block_height:Ge().optional(),block_hash:Lt().optional(),block_time:Ge().optional()}),x4=da({txid:Lt().optional().nullable(),vout:Ge().optional().nullable(),sequence:Ge().optional(),scriptsig:Lt().optional().nullable(),scriptsig_asm:Lt().optional().nullable(),witness:sl(Lt()).optional(),is_coinbase:Ah().optional(),prevout:da({scriptpubkey_type:Lt().optional(),scriptpubkey_address:Lt().optional(),scriptpubkey:Lt().optional(),scriptpubkey_asm:Lt().optional(),value:Ge().optional()}).partial().nullable().optional()}).loose(),S4=da({scriptpubkey_type:Lt().optional(),scriptpubkey_address:Lt().optional(),scriptpubkey:Lt().optional(),scriptpubkey_asm:Lt().optional(),value:Ge(),n:Ge().optional()}).loose(),Su=da({txid:Lt(),hash:Lt().optional(),fee:Ge().optional(),version:Ge(),locktime:Ge(),vin:sl(x4),vout:sl(S4),size:Ge(),weight:Ge(),status:b4}).loose(),wu=sl(nh),Bu=sl(Su),Nv=da({in_best_chain:Ah(),next_best:Lt().optional(),height:Ge().optional()}),Ov=da({address:Lt(),chain_stats:da({funded_txo_count:Ge().optional(),funded_txo_sum:Ge().optional(),spent_txo_count:Ge().optional(),spent_txo_sum:Ge().optional(),tx_count:Ge().optional()}),mempool_stats:da({funded_txo_count:Ge().optional(),funded_txo_sum:Ge().optional(),spent_txo_count:Ge().optional(),spent_txo_sum:Ge().optional(),tx_count:Ge().optional()})});async function Ft(e,a,i){const l=a.startsWith("/")?a:`/${a}`,s=await fetch(`${e}${l}`);if(!s.ok)throw new Ch(`Request to ${a} failed with status ${String(s.status)}`,s.status);const u=await s.json();return i.parse(u)}async function Mv(e,a){const i=await fetch(`${e}/blocks/tip/height`);if(!i.ok)throw new Ch("Unable to fetch tip height",i.status);const l=await i.text(),s=Number(l.trim());if(!Number.isFinite(s))throw new TypeError("Invalid tip height response");return a.lastKnownHeight=s,s}async function Ki(e,a,i){if(a.lastKnownHeight===null){await Mv(e,a);return}typeof i=="number"&&a.lastKnownHeightu.scriptpubkey_address===e?s+u.value:s,0),l=a.vin.reduce((s,u)=>{const c=u.prevout;return c?.scriptpubkey_address===e&&typeof c.value=="number"?s+c.value:s},0);return i-l}async function _d(e,a){if(a==="latest"||a==="tip"){const i=await Ft(e,"/blocks",wu);if(i.length===0)throw new Error("No blocks returned from API");return i[0].id}if(/^\d+$/.test(a)){const i=await fetch(`${e}/block-height/${a}`);if(!i.ok)throw new Ch("Unable to resolve block height",i.status);return(await i.text()).trim()}return a}async function kv(e,a,i){if(i.lastKnownHeight==null||a>=i.lastKnownHeight)return null;const l=a+1;try{const s=await fetch(`${e}/block-height/${String(l)}`);return s.ok&&(await s.text()).trim()||null}catch(s){return console.warn(`Failed to resolve hash for height ${String(l)}`,s),null}}function lo(e){return{hash:e.id,height:e.height,timestamp:e.timestamp??e.mediantime??0,txCount:e.tx_count??0,size:e.size??0,weight:e.weight??0,difficulty:e.difficulty,previousBlockHash:e.previousblockhash??null}}function Ed(e,a){const i=e.status.confirmed?"confirmed":"unconfirmed",l=e.vin.map((m,p)=>{const b=m.is_coinbase||m.txid==null?void 0:typeof m.vout=="number"&&m.vout!==4294967295?m.vout:void 0;return{index:p,prevTxId:m.txid??void 0,prevOutputIndex:b,address:m.prevout?.scriptpubkey_address??void 0,valueSats:m.prevout?.value,scriptType:m.prevout?.scriptpubkey_type,isCoinbase:m.is_coinbase??!1,script:m.scriptsig||m.scriptsig_asm?{hex:m.scriptsig??void 0,mnemonic:m.scriptsig_asm??void 0}:void 0,witness:m.witness??void 0,sequence:m.sequence}}),s=e.vout.map((m,p)=>({index:p,address:m.scriptpubkey_address??void 0,valueSats:m.value,scriptType:m.scriptpubkey_type,spent:void 0,script:m.scriptpubkey||m.scriptpubkey_asm?{hex:m.scriptpubkey??void 0,mnemonic:m.scriptpubkey_asm??void 0}:void 0})),u=s.reduce((m,p)=>m+p.valueSats,0),c=a.lastKnownHeight;let d=0;return e.status.block_height&&i==="confirmed"&&(d=c&&c>=e.status.block_height?c-e.status.block_height+1:1),{txid:e.txid,hash:e.hash??e.txid,status:i,confirmat)DELIM" -R"DELIM(ions:d,blockHeight:e.status.block_height,blockHash:e.status.block_hash,receivedTime:e.status.block_time,feeSats:e.fee??null,feeRate:e.fee?e.fee/e.weight*4:null,size:e.size,weight:e.weight,version:e.version,locktime:e.locktime,totalInput:null,totalOutput:u,inputs:l,outputs:s}}function _4(e,a){const i=e.chain_stats,l=e.mempool_stats,s=(i.funded_txo_sum??0)-(i.spent_txo_sum??0),u=vb(e.address,a.slice(0,25));return{address:e.address,addressType:li(e.address),balance:s,totalReceived:(i.funded_txo_sum??0)+(l.funded_txo_sum??0),totalSent:(i.spent_txo_sum??0)+(l.spent_txo_sum??0),txCount:(i.tx_count??0)+(l.tx_count??0),utxoCount:(i.funded_txo_count??0)-(i.spent_txo_count??0),transactions:u}}function E4(e){const a=e.chain_stats,i=e.mempool_stats,l=(a.funded_txo_sum??0)-(a.spent_txo_sum??0);return{address:e.address,addressType:li(e.address),balance:l,totalReceived:(a.funded_txo_sum??0)+(i.funded_txo_sum??0),totalSent:(a.spent_txo_sum??0)+(i.spent_txo_sum??0),txCount:(a.tx_count??0)+(i.tx_count??0),utxoCount:(a.funded_txo_count??0)-(a.spent_txo_count??0)}}function vb(e,a){return a.map(i=>({txid:i.txid,timestamp:i.status.block_time,valueChange:w4(e,i),blockHeight:i.status.block_height}))}async function Dv(e,a,i=0){const l=i>0?`/block/${a}/txs/${String(i)}`:`/block/${a}/txs`;return Ft(e,l,Bu)}async function T4(e,a,i){return i?Ft(e,`/address/${a}/txs/chain/${i}`,Bu):Ft(e,`/address/${a}/txs`,Bu)}function bb({baseUrl:e}){const a=new Set;let i=null;const l={lastBlockHash:null,lastKnownHeight:null};async function s(d){const m=await Ft(e,`/tx/${d}`,Su);return await(m.status.block_height?Ki(e,l,m.status.block_height):Ki(e,l)),Ed(m,l)}function u(){i||a.size===0||(i=setInterval(async()=>{try{const d=await Ft(e,"/blocks",wu);if(d.length===0)return;const m=d[0];if(m.id!==l.lastBlockHash){l.lastBlockHash=m.id,l.lastKnownHeight=Math.max(m.height,l.lastKnownHeight??0);const p=lo(m);for(const b of a)b({type:"block.new",payload:p})}}catch(d){console.warn("Block polling failed",d)}},15e3))}function c(){i&&(clearInterval(i),i=null)}return{metadata:{id:"blockstream",label:"Blockstream.info",type:"external",connectionState:"connected",supportsWebsocket:!1,endpoint:e,description:"Read-only adapter using Blockstream public REST API."},getConfiguration(){return Promise.resolve({address:!0,filter:!1,turbo:!1,witness:!0,retarget:!1,difficult:!1})},async getLatestBlocks(d=10){const m=await Ft(e,"/blocks",wu);return m.length>0&&(l.lastBlockHash=m[0].id,l.lastKnownHeight=Math.max(m[0].height,l.lastKnownHeight??0)),m.slice(0,d).map(p=>lo(p))},async getBlocksBefore(d,m=10){const p=Math.max(d,0),b=await Ft(e,`/blocks/${String(p)}`,wu);return b.length>0&&(l.lastKnownHeight=Math.max(b[0].height,l.lastKnownHeight??0)),b.slice(0,m).map(g=>lo(g))},async getBlockHeader(d){const m=await _d(e,d);await Ki(e,l);const[p,b]=await Promise.all([Ft(e,`/block/${m}`,nh),Ft(e,`/block/${m}/status`,Nv).catch(()=>null)]),g=lo(p);l.lastBlockHash=g.hash,l.lastKnownHeight=Math.max(g.height,l.lastKnownHeight??g.height);let x=b?.next_best??null;return x||(x=await kv(e,g.height,l)),{...g,merkleRoot:p.merkle_root,nonce:p.nonce,bits:p.bits,version:p.version,nextBlockHash:x}},getBlockStats(d){return Promise.resolve({})},async getBlock(d){const m=await _d(e,d);await Ki(e,l);const p=await Ft(e,`/block/${m}`,nh),[b,g]=await Promise.allSettled([Dv(e,m),Ft(e,`/block/${m}/status`,Nv)]);b.status==="rejected"&&console.warn("Failed to load block transactions, defaulting to empty set",b.reason),g.status==="rejected"&&console.warn("Failed to load block status, defaulting to unknown",g.reason);const x=lo(p);l.lastBlockHash=x.hash,l.lastKnownHeight=Math.max(x.height,l.lastKnownHeight??x.height);const _=b.status==="fulfilled"?b.value:[];let T=(g.status==="fulfilled"?g.value:null)?.next_best??null;return T||(T=await kv(e,x.height,l)),{...x,merkleRoot:p.merkle_root,nonce:p.nonce,bits:p.bits,version:p.version,nextBlockHash:T,transactions:_.map(Y=>Ed(Y,l))}},async getBlockTransactions(d,m=0){const p=await _d(e,d),b=await Dv(e,p,m),g=b.reduce((x,_)=>_.status.block_height?x===null?_.status.block_height:Math.max(x,_.status.block_height):x,null);return await(typeof g=="number"?Ki(e,l,g):Ki(e,l)),b.map(x=>Ed(x,l))},async getTransactionHeader(d){return s(d)},async getTransaction(d){return s(d)},async getTransactionInputScriptHex(d,m){const p=await Ft(e,`/tx/${d}`,Su);if(m<0||m>=p.vin.length)throw new RangeError(`Input index ${String(m)} not found`);const g=p.vin[m].scriptsig;return typeof g=="string"?g:""},async getTransactionOutputScriptHex(d,m){const p=await Ft(e,`/tx/${d}`,Su);if(m<0||m>=p.vout.length)throw new RangeError(`Output index ${String(m)} not found`);const g=p.vout[m].scriptpubkey;if(typeof g!="string")throw new TypeError("Output script missing in provider response");return g},async getAddressSummary(d){const m=await Ft(e,`/address/${d}`,Ov);return E4(m)},async getAddress(d){const m=await Ft(e,`/address/${d}`,Ov),p=await Ft(e,`/address/${d}/txs`,Bu);return _4(m,p)},async getAddressTransacti)DELIM" -R"DELIM(ons(d,m){const p=await T4(e,d,m);return vb(d,p)},subscribeToEvents(d){return a.add(d),u(),()=>{a.delete(d),a.size===0&&c()}}}}function R4({baseUrl:e}){const a=bb({baseUrl:e});return{...a,metadata:{...a.metadata,id:"mempool",label:"mempool.space",endpoint:e,description:"Adapter backed by mempool.space REST API."}}}function zo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function xb(e,a){return Array.isArray(a)?a.length===0?!0:e?a.every(i=>typeof i=="string"):a.every(i=>Number.isSafeInteger(i)):!1}function jh(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function Ao(e,a){if(typeof a!="string")throw new TypeError(`${e}: string expected`);return!0}function Bo(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function Uu(e){if(!Array.isArray(e))throw new TypeError("array expected")}function Sb(e,a){if(!xb(!0,a))throw new TypeError(`${e}: array of strings expected`)}function Nh(e,a){if(!xb(!1,a))throw new TypeError(`${e}: array of numbers expected`)}function Oh(...e){const a=u=>u,i=(u,c)=>d=>u(c(d)),l=e.map(u=>u.encode).reduceRight(i,a),s=e.map(u=>u.decode).reduce(i,a);return{encode:l,decode:s}}function wb(e){const a=typeof e=="string"?e.split(""):e,i=a.length;Sb("alphabet",a);const l=new Map(a.map((s,u)=>[s,u]));return{encode:s=>(Uu(s),s.map(u=>{if(!Number.isSafeInteger(u)||u<0||u>=i)throw new Error(`alphabet.encode: digit index outside alphabet "${u}". Allowed: ${e}`);return a[u]})),decode:s=>(Uu(s),s.map(u=>{Ao("alphabet.decode",u);const c=l.get(u);if(c===void 0)throw new Error(`Unknown letter: "${u}". Allowed: ${e}`);return c}))}}function _b(e=""){return Ao("join",e),{encode:a=>(Sb("join.decode",a),a.join(e)),decode:a=>(Ao("join.decode",a),a.split(e))}}function Lv(e,a,i){if(a<2)throw new RangeError(`convertRadix: invalid from=${a}, base cannot be less than 2`);if(i<2)throw new RangeError(`convertRadix: invalid to=${i}, base cannot be less than 2`);if(Uu(e),!e.length)return[];let l=0;const s=[],u=Array.from(e,d=>{if(Bo(d),d<0||d>=a)throw new Error(`invalid integer: ${d}`);return d}),c=u.length;for(;;){let d=0,m=!0;for(let p=l;pa===0?e:Eb(a,e%a),Hu=(e,a)=>e+(a-Eb(e,a)),_u=(()=>{let e=[];for(let a=0;a<40;a++)e.push(2**a);return e})();function ah(e,a,i,l){if(Uu(e),a<=0||a>32)throw new RangeError(`convertRadix2: wrong from=${a}`);if(i<=0||i>32)throw new RangeError(`convertRadix2: wrong to=${i}`);if(Hu(a,i)>32)throw new Error(`convertRadix2: carry overflow from=${a} to=${i} carryBits=${Hu(a,i)}`);let s=0,u=0;const c=_u[a],d=_u[i]-1,m=[];for(const p of e){if(Bo(p),p>=c)throw new Error(`convertRadix2: invalid data word=${p} from=${a}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${u} from=${a}`);for(u+=a;u>=i;u-=i)m.push((s>>u-i&d)>>>0);const b=_u[u];if(b===void 0)throw new Error("invalid carry");s&=b-1}if(s=s<=a)throw new Error("Excess padding");if(!l&&s>0)throw new Error(`Non-zero padding: ${s}`);return l&&u>0&&m.push(s>>>0),m}function z4(e){Bo(e);const a=2**8;return{encode:i=>{if(!zo(i))throw new TypeError("radix.encode input should be Uint8Array");return Lv(Array.from(i),a,e)},decode:i=>(Nh("radix.decode",i),Uint8Array.from(Lv(i,e,a)))}}function A4(e,a=!1){if(Bo(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(Hu(8,e)>32||Hu(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:i=>{if(!zo(i))throw new TypeError("radix2.encode input should be Uint8Array");return ah(Array.from(i),8,e,!a)},decode:i=>(Nh("radix2.decode",i),Uint8Array.from(ah(i,e,8,a)))}}function Bv(e){return jh(e),function(...a){try{return e.apply(null,a)}catch{}}}function C4(e,a){if(Bo(e),e<=0)throw new RangeError(`checksum length must be positive: ${e}`);jh(a);const i=a;return{encode(l){if(!zo(l))throw new TypeError("checksum.encode: input should be Uint8Array");const s=i(l).slice(0,e),u=new Uint8Array(l.length+e);return u.set(l),u.set(s,l.length),u},decode(l){if(!zo(l))throw new TypeError("checksum.decode: input should be Uint8Array");const s=l.slice(0,-e),u=l.slice(-e),c=i(s).slice(0,e);for(let d=0;dOh(z4(58),wb(e),_b("")),N4=Object.freeze(j4("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),O4=e=>{jh(e);const a=e;return Oh(C4(4,i=>a(a(i))),N4)},rh=Oh(wb("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),_b("")),Uv=[996825010,642813549,513874426,1027748829,705979059];functi)DELIM" -R"DELIM(on oo(e){const a=e>>25;let i=(e&33554431)<<5;for(let l=0;l>l&1)===1&&(i^=Uv[l]);return i}function Hv(e,a,i=1){const l=e.length;let s=1;for(let u=0;u126)throw new Error(`Invalid prefix (${e})`);s=oo(s)^c>>5}s=oo(s);for(let u=0;u_)throw new TypeError(`Length ${T} exceeds limit ${_}`);const k=g.toLowerCase(),Y=Hv(k,x,a);return`${k}1${rh.encode(x)}${Y}`}function d(g,x=90){Ao("bech32.decode input",g);const _=g.length;if(_<8||x!==!1&&_>x)throw new TypeError(`invalid string length: ${_} (${g}). Expected (8..${x})`);const R=g.toLowerCase();if(g!==R&&g!==g.toUpperCase())throw new Error("String must be lowercase or uppercase");const T=R.lastIndexOf("1");if(T===0||T===-1)throw new Error('Letter "1" must be present between prefix and data only');const k=R.slice(0,T),Y=R.slice(T+1);if(Y.length<6)throw new Error("Data must be at least 6 characters long");const X=rh.decode(Y).slice(0,-6),ne=Hv(k,X,a);if(!Y.endsWith(ne))throw new Error(`Invalid checksum in ${g}: expected "${ne}"`);return{prefix:k,words:X}}const m=Bv(d);function p(g){const{prefix:x,words:_}=d(g,!1);return{prefix:x,words:_,bytes:l(_)}}function b(g,x){return c(g,s(x))}return{encode:c,decode:d,encodeFromBytes:b,decodeToBytes:p,decodeUnsafe:m,fromWords:l,fromWordsUnsafe:u,toWords:s}}const $u=Object.freeze(Tb("bech32")),ih=Object.freeze(Tb("bech32m"));function M4(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Mh(e,a,i=""){const l=M4(e),s=e?.length;if(!l||a!==void 0){const c=i&&`"${i}" `,d="",m=l?`length=${s}`:`type=${typeof e}`,p=c+"expected Uint8Array"+d+", got "+m;throw l?new RangeError(p):new TypeError(p)}return e}function $v(e,a=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(a&&e.finished)throw new Error("Hash#digest() has already been called")}function k4(e,a){Mh(e,void 0,"digestInto() output");const i=a.outputLen;if(e.length='+i)}function lh(...e){for(let a=0;a>>a}const D4=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",L4=Array.from({length:256},(e,a)=>a.toString(16).padStart(2,"0"));function Eu(e){if(Mh(e),D4)return e.toHex();let a="";for(let i=0;ie(u).update(s).digest(),l=e(void 0);return i.outputLen=l.outputLen,i.blockLen=l.blockLen,i.canXOF=l.canXOF,i.create=s=>e(s),Object.assign(i,a),Object.freeze(i)}const U4=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function H4(e,a,i){return e&a^~e&i}function $4(e,a,i){return e&a^e&i^a&i}class Z4{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,i,l,s){this.blockLen=a,this.outputLen=i,this.padOffset=l,this.isLE=s,this.buffer=new Uint8Array(a),this.view=Td(this.buffer)}update(a){$v(this),Mh(a);const{view:i,buffer:l,blockLen:s}=this,u=a.length;for(let c=0;cs-c&&(this.process(l,0),c=0);for(let g=c;gb.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,T=sa(_,17)^sa(_,19)^_>>>10;xr[g]=T+xr[g-7]+R+xr[g-16]|0}let{A:l,B:s,C:u,D:c,E:d,F:m,G:p,H:b}=this;for(let g=0;g<64;g++){const x=sa(d,6)^sa(d,11)^sa(d,25),_=b+x+H4(d,m,p)+q4[g]+xr[g]|0,T=(sa(l,2)^sa(l,13)^sa(l,22))+$4(l,s,u)|0;b=p,p=m,m=d,d=c+_|0,c=u,u=s,s=l,l=_+T|0}l=l+this.A|0,s=s+this.B|0,u=u+this.C|0,c=c+this.D|0,d=d+this.E|0,m=m+this.F|0,p=p+this.G|0,b=b+this.H|0,this.set(l,s,u,c,d,m,p,b)}roundClean(){lh(xr)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),lh(this.buffer)}}class Q4 extends P4{A=br[0]|0;B=br[1]|0;C=br[2]|0;D=br[3]|0;E=br[4]|0;F=br[5]|0;G=br[6]|0;H=br[7]|0;constructor(){super(32)}}const Rb=B4(()=>new Q4,U4(1)),zb=O4(Rb),F4=0x00000000ffff0000000000000000000000000000000000000000000000000000n;function kh(e){if(e.length%2!==0)throw new Error("Invalid hex string");const a=new Uint8Array(e.length/2);for(let i=0;i>>24,i=e&8388607;if(i===0||a<3)return;const l=BigInt(i)*(1n<i[1]).filter(Boolean);return a.length>0?a:[e]}function Dh(e){const a=e.toLowerCase();if(a.includes("dup hash160")&&a.includes("equalverify checksig"))return"p2pkh";if(a.startsWith("hash160")&&a.includes("equal"))return"p2sh";if(a.startsWith("zero [")){const l=a.match(/zero \[([0-9a-f]+)\]/)?.[1]??"";return l.length===40?"p2wpkh":l.length===64?"p2wsh":"segwit"}if(a.startsWith("1 ["))return"p2tr"}function Uo(){return"mainnet"}function Ho(e){return e==="testnet"||e==="regtest"?{p2pkh:111,p2sh:196,hrp:e==="regtest"?"bcrt":"tb"}:{p2pkh:0,p2sh:5,hrp:"bc"}}function Zv(e,a){const i=new Uint8Array(a.length/2+1);return i[0]=e,i.set(kh(a),1),zb.encode(i)}function Rd(e,a,i){const l=kh(i),s=$u.toWords(l);return s.unshift(a),(a===0?$u:ih).encode(e,s)}function Ab(e,a){const i=e.toLowerCase(),l=i.match(/dup hash160 \[([0-9a-f]{40})\] equalverify checksig/);if(l)return{address:Zv(a.p2pkh,l[1]),type:"p2pkh"};const s=i.match(/^hash160 \[([0-9a-f]{40})\] equal$/);if(s)return{address:Zv(a.p2sh,s[1]),type:"p2sh"};const u=i.match(/^zero \[([0-9a-f]{40})\]/);if(u)return{address:Rd(a.hrp,0,u[1]),type:"p2wpkh"};const c=i.match(/^zero \[([0-9a-f]{64})\]/);if(c)return{address:Rd(a.hrp,0,c[1]),type:"p2wsh"};const d=i.match(/^1 \[([0-9a-f]{64})\]/);return d?{address:Rd(a.hrp,1,d[1]),type:"p2tr"}:{type:Dh(e)}}function K4(e,a){try{const s=zb.decode(e),u=s[0],c=Eu(s.slice(1));if(c.length===40&&u===a.p2pkh)return{scriptHex:`76a914${c}88ac`,type:"p2pkh"};if(c.length===40&&u===a.p2sh)return{scriptHex:`a914${c}87`,type:"p2sh"}}catch{}const i=e.toLowerCase();if(i.indexOf("1")>0&&i.startsWith(`${a.hrp}1`)){const s=i,u=m=>{try{return m.decode(s,90)}catch{return null}},c=u($u);if(c&&c.prefix===a.hrp){const m=c.words[0],p=$u.fromWords(c.words.slice(1)),b=Eu(p),g=p.length.toString(16).padStart(2,"0");if(m===0&&(p.length===20||p.length===32))return{scriptHex:`00${g}${b}`,type:p.length===20?"p2wpkh":"p2wsh"}}const d=u(ih);if(d&&d.prefix===a.hrp){const m=d.words[0],p=ih.fromWords(d.words.slice(1)),b=Eu(p),g=p.length.toString(16).padStart(2,"0");if(m===1&&p.length===32)return{scriptHex:`51${g}${b}`,type:"p2tr"}}}return null}function jr(e,a){const i=e.toLowerCase();if(/^[0-9a-f]{64}$/.test(i))return{hash:i,type:"script-hash"};const l=K4(e,a);if(!l)return null;const s=Rb(kh(l.scriptHex)),u=Uint8Array.from(s).reverse();return{hash:Eu(u),type:l.type}}function so(e,a){return{hash:e.hash,height:e.height,timestamp:e.timestamp,txCount:a,size:void 0,weight:void 0,difficulty:Y4(e.bits),previousBlockHash:e.previous}}function V4(e){const a=G4(e);return a&&a.length>0?a:void 0}function X4(e,a,i,l){const s=/^0{64}$/u.test(e.point.hash),u=a?Ab(a.script,i):{address:void 0,type:void 0},c=a?a.value:void 0,d=a?a.script:void 0;return{index:l,prevTxId:s?void 0:e.point.hash,prevOutputIndex:s?void 0:e.point.index,address:u.address,valueSats:c,scriptType:u.type??Dh(d??e.script),isCoinbas)DELIM" -R"DELIM(e:s,script:e.script?{mnemonic:e.script}:void 0,witness:V4(e.witness),sequence:e.sequence}}function I4(e,a,i){const l=Ab(e.script,i);return{index:a,address:l.address,valueSats:e.value,scriptType:l.type??Dh(e.script),spent:void 0,script:e.script?{mnemonic:e.script}:void 0}}function J4(e,a){return typeof e!="number"||typeof a!="number"?0:Math.max(0,e-a+1)}function fu(e,a,i,l,s){const u=e.outputs.map((b,g)=>I4(b,g,i)),c=u.reduce((b,g)=>b+g.valueSats,0),d=a.reduce((b,g)=>g?(b??0)+g.value:b,null),m=J4(l.tipHeight,l.blockHeight),p=typeof l.blockHeight=="number"?"confirmed":"unconfirmed";return{txid:e.hash,hash:e.hash,status:p,confirmations:m,blockHeight:l.blockHeight,blockHash:l.blockHash,receivedTime:l.timestamp,feeSats:Number.isFinite(s)?s:void 0,feeRate:null,size:void 0,weight:void 0,version:e.version,locktime:e.locktime,totalInput:d,totalOutput:c,inputs:e.inputs.map((b,g)=>X4(b,a[g],i,g)),outputs:u}}const du=25,W4="/v1/top/subscribe?format=json",eR="/v1/top/subscribe?format=json&stop=true",tR=5e3,nR=2500,qv=5e3,zd=new Map,Ad=new Map,Zu={address:!0,filter:!1,turbo:!0,witness:!0,retarget:!1,difficult:!1};function aR(e){if(!e||typeof e!="object"||Array.isArray(e))return Zu;const a=e,i=l=>typeof a[l]=="boolean"?a[l]:Zu[l];return{address:i("address"),filter:i("filter"),turbo:i("turbo"),witness:i("witness"),retarget:i("retarget"),difficult:i("difficult")}}function Vi(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const i=e.state;if(!i||typeof i!="object"||Array.isArray(i))return null;const l=i,s=typeof l.count=="number"?l.count:void 0,u=typeof l.size=="number"?l.size:void 0,c=typeof l.weight=="number"?l.weight:void 0;return s===void 0&&u===void 0&&c===void 0?null:{count:s,size:u,weight:c}}function uo(e){return e?.weight??e?.size}function rR(e,a){return!Number.isFinite(e)||!Number.isFinite(a)||a<=0?null:e/a*4}function hu(e,a){if(!a)return e;const i=typeof a.fee=="number"?a.fee:void 0,l=typeof a.weight=="number"?a.weight:void 0,s=typeof i=="number"&&typeof l=="number"?rR(i,l):e.feeRate;return{...e,wtxid:a.wtxid||e.wtxid,feeSats:typeof a.fee=="number"?a.fee:e.feeSats,feeRate:s,size:typeof a.maximal=="number"?a.maximal:e.size,weight:typeof a.weight=="number"?a.weight:e.weight,sigops:typeof a.confirmed?.sigops=="number"?a.confirmed.sigops:e.sigops,totalInput:typeof a.value=="number"?a.value:e.totalInput,totalOutput:typeof a.spend=="number"?a.spend:e.totalOutput}}async function rn(e,a,i){const l=a.startsWith("/")?a:`/${a}`;let s=l.includes("?")?`${e}${l}`:`${e}${l}?format=json`;i&&(s+=s.includes("?")?"&turbo=true":"?turbo=true");const u=Ad.get(s);if(u)return u;const c=(async()=>{const d=await fetch(s,{headers:{Accept:"application/json"}});if(!d.ok){const p=await d.text().catch(()=>"");throw new Error(`Request failed ${String(d.status)}: ${p||d.statusText}`)}const m=await d.text();try{return JSON.parse(m)}catch{return m}})();Ad.set(s,c);try{return await c}finally{Ad.delete(s)}}async function zt(e,a,i){try{return await rn(e,a,i)}catch{return null}}async function Cb(e,a){const i=await rn(e,"/v1/top?format=json",a),l=typeof i=="number"?i:Number(i);if(!Number.isFinite(l))throw new Error("Invalid top height");return l}function iR(e){return/^[0-9a-f]{64}$/iu.test(e)}function lR(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e.trim()):null}function oh(e){const a=lR(e);if(a!==null)return a;if(typeof e=="string"){const s=e.trim();return iR(s)?s:null}if(!e||typeof e!="object"||Array.isArray(e))return null;const i=e,l=[i.payload,i.top,i.block,i.header,i.hash,i.height];for(const s of l){if(s===e)continue;const u=oh(s);if(u!==null)return u}return null}function oR(e){return typeof e=="string"?Promise.resolve(e):e instanceof ArrayBuffer?Promise.resolve(new TextDecoder().decode(e)):e instanceof Blob?e.text():Promise.resolve(null)}function sR(e){const a=e.trim();if(!a)return null;try{return oh(JSON.parse(a))}catch{return oh(a)}}function uR(e){const a=e.trim();if(!a)return null;const l=/^[a-z][a-z\d+\-.]*:\/\//iu.test(a)?a:`http://${a}`,s=globalThis.window;try{const u=new URL(l,s?.location.href??"http://localhost");if(u.protocol==="http:")u.protocol="ws:";else if(u.protocol==="https:")u.protocol="wss:";else if(u.protocol!=="ws:"&&u.protocol!=="wss:")return null;return u.hash="",u.search="",u.toString()}catch{return null}}async function Jr(e,a){const i=Date.now(),l=`${e}|0`,s=zd.get(l);if(s&&s.expiresAt>i)return s.promise;const u=Cb(e,a).then(c=>(zd.set(l,{promise:u,value:c,expiresAt:Date.now()+qv}),c));return zd.set(l,{promise:u,value:s?.value??null,expiresAt:i+qv}),u}async function mu(e,a,i){if(a==="latest"||a==="tip"){const l=await Jr(e,i);return{path:`/v1/block/height/${String(l)}`,height:l}}return/^\d+$/u.test(a)?{path:`/v1/block/height/${a}`}:{path:`/v1/block/hash/${a}`}}function cR(e,a){const i=new Map;return(l,s)=>{const u=`${l}:${String(s)}`,c=i.get(u);if(c)return c;const d=rn(e,`/v1/output/${l}/${String(s)}?format=json`,a).catch(()=>null);return i.set(u,d),d})DELIM" -R"DELIM(}async function Pv(e,a,i,l){return rn(e,`${a}/tx/${String(i)}?format=json`,l)}async function Qv(e,a,i){const l=await zt(e,`/v1/address/${a}/confirmed?format=json`,i);return Array.isArray(l)?l:[]}async function fR(e,a,i){const l=await zt(e,`/v1/address/${a}?format=json`,i);return Array.isArray(l)?l:[]}const Fv=25,dR=8,hR=3e4;function mR(e){if(e===void 0)return 0;const a=Number(e);return Number.isInteger(a)&&a>0?a:0}async function pR(e,a,i){const l=await zt(e,`/v1/output/${a}/${String(i)}/spender?format=json`);return l&&typeof l.hash=="string"?l:null}async function yR(e,a,i){const l=new Array(e.length);let s=0;async function u(){for(;su())),l}async function gR(e,a,i){const l=await yR(a,dR,u=>pR(e,u.point.hash,u.point.index)),s=[];for(const[u,c]of a.entries()){const{hash:d,index:m}=c.point,p=l[u];s.push({id:`in:${d}:${String(m)}`,txid:d,outputIndex:m,valueChange:c.value,direction:"received",spent:p!==null,...i!==null?{cursor:i}:{}}),p&&s.push({id:`out:${d}:${String(m)}`,txid:p.hash,valueChange:-c.value,direction:"sent",...i!==null?{cursor:i}:{}})}return s}function Yv(e,a){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const l=Number(e);if(Number.isFinite(l))return l}let i=0;for(const l of a)i+=l.value;return i}function Cd({baseUrl:e,pollIntervalMs:a=15e3,turbo:i=!1}){const l=new Set,s=new Set;let u=null,c=null,d=null,m=null,p=!1,b=!1,g="idle",x=null,_=null;const R=Ho(Uo());let T=null,k=null;const Y=uR(e),X=!!(Y&&globalThis.WebSocket),ne=new Map;async function se(C,$){const G=Date.now(),ie=ne.get(C);if(ie&&ie.expiresAt>G)return ie.outputs;const fe=await fR(e,C,$);return ne.set(C,{outputs:fe,expiresAt:G+hR}),fe}async function te(C,$,G){const ie=await se(C,$),fe=mR(G),I=ie.slice(fe,fe+Fv),ge=fe+Fv,be=ge{const $=aR(C);return T=$,$}).catch(C=>(console.warn("Libbitcoin configuration fetch failed",C),T=Zu,Zu)),k)}function O(C){return C.address}function w(C){return O(C)&&C.turbo}function L(){return{transport:g,websocketAvailable:X&&!p}}function H(C){if(g===C)return;g=C;const $=L();for(const G of s)G($)}async function Q(C){const $=typeof C=="number"?`/v1/block/height/${String(C)}`:`/v1/block/hash/${C}`,[G,ie]=await Promise.all([rn(e,`${$}/header?format=json`),zt(e,`${$}/header/context?format=json`)]);if(_===G.hash||x!==null&&G.heightx&&await Q(C)}catch(C){console.warn("Libbitcoin poller failed",C)}}function he(){u||l.size===0||(u=setInterval(()=>{K()},a),H("polling"))}function me(){u&&(clearInterval(u),u=null)}function W(){d&&(clearTimeout(d),d=null)}function N(){m&&(clearTimeout(m),m=null)}function B(C){if(W(),!!c){b=!0;try{C&&c.readyState===1&&c.send(eR),c.close()}catch{}finally{c=null}}}function ue(){if(N(),c)return!0;if(!X||!Y||p||l.size===0)return!1;try{b=!1,c=new WebSocket(Y),H("connecting")}catch($){return console.warn("Libbitcoin websocket unavailable, falling back to polling",$),p=!0,!1}const C=c;return d=setTimeout(()=>{c===C&&(p=!0,B(!1),he())},tR),C.addEventListener("open",()=>{if(c===C){W();try{C.send(W4),me(),H("websocket")}catch($){console.warn("Libbitcoin websocket subscribe failed, falling back to polling",$),p=!0,B(!1),he()}}}),C.addEventListener("message",$=>{(async()=>{try{const G=await oR($.data);if(G===null)return;const ie=sR(G);if(ie===null)return;await Q(ie)}catch(G){console.warn("Libbitcoin websocket event handling failed",G)}})()}),C.addEventListener("error",$=>{b||c!==C||(console.warn("Libbitcoin websocket failed, falling back to polling",$),p=!0,B(!1),he())}),C.addEventListener("close",()=>{if(W(),c===C&&(c=null),b){b=!1;return}l.size!==0&&(p=!0,he())}),!0}function de(){ue()||he()}function ce(){N(),me(),B(!0),H("idle")}function z(){l.size>0||m||(m=setTimeout(()=>{m=null,l.size===0&&ce()},nR))}return{metadata:{id:"libbitcoin",label:"Server",type:"local",connectionState:"connected",supportsWebsocket:X,endpoint:e,description:"Adapter for the libbitcoin embedded REST API."},getConfiguration(){return xe()},async getLatestBlocks(C=10){const $=await Jr(e);x=$;const G=Array.from({length:C},(I,ge)=>$-ge).filter(I=>I>=0),[ie,fe]=await Promise.all([Promise.all(G.map(I=>rn(e,`/v1/block/height/${String(I)}/header?format=json`))),Promise.all(G.map(I=>zt(e,`/v1/block/height/${String(I)}/header/context?format=json`)))]);return ie.map((I,ge)=>{const be=Vi(fe[ge]),tt=so(I,be?.count);return ge===0&&(_=I.hash),{...tt,size:uo(be)}})},async getBlocksBefore(C,$=10){const G=Array.from({length:$},(I,ge)=>C-ge).filter(I=>I>=0),[ie,fe]=await Promise.all([Promise.all(G.map(I=>rn(e,`/v1/block)DELIM" -R"DELIM(/height/${String(I)}/header?format=json`))),Promise.all(G.map(I=>zt(e,`/v1/block/height/${String(I)}/header/context?format=json`)))]);return ie.map((I,ge)=>{const be=Vi(fe[ge]);return{...so(I,be?.count),size:uo(be)}})},async getBlockHeader(C){const{path:$,height:G}=await mu(e,C),ie=G===void 0?Jr(e):Promise.resolve(G),[fe,I,ge]=await Promise.all([rn(e,`${$}/header?format=json`),ie,zt(e,`${$}/header/context?format=json`)]);x=Math.max(x??0,I);let be=null;fe.heightga),Qe=(await Promise.all(Je.map(Ut=>Pv(e,$,Ut).catch(()=>null)))).filter(Ut=>Ut!==null),An=await Promise.all(Qe.map(Ut=>zt(e,`/v1/tx/${Ut.hash}/details?format=json`))),ya=Qe.map((Ut,ga)=>{const Mr=An[ga],hl=fu(Ut,[],R,{blockHeight:fe.height,blockHash:fe.hash,tipHeight:I,timestamp:fe.timestamp},typeof Mr?.fee=="number"?Mr.fee:void 0);return hu(hl,Mr)});return{...ut,size:be?.maximal??uo(dt),weight:be?.weight,merkleRoot:fe.merkle_root,nonce:fe.nonce,bits:fe.bits,version:fe.version,nextBlockHash:tt,feesSats:be?.fees,subsidySats:be?.subsidy,sigops:be?.sigops,transactions:ya}},async getBlockTransactions(C,$=0){const{path:G}=await mu(e,C),[ie,fe,I]=await Promise.all([rn(e,`${G}/header?format=json`),Jr(e),zt(e,`${G}/header/context?format=json`)]);x=Math.max(x??0,fe);const ge=Vi(I)?.count;if(typeof ge=="number"&&$>=ge)return[];const be=typeof ge=="number"?Math.min($+du,ge):$+du,tt=Array.from({length:Math.max(0,be-$)},(je,Je)=>$+Je),xt=(await Promise.all(tt.map(je=>Pv(e,G,je).catch(()=>null)))).filter(je=>je!==null);if(xt.length===0)return[];const ut=await Promise.all(xt.map(je=>zt(e,`/v1/tx/${je.hash}/details?format=json`)));return xt.map((je,Je)=>{const Ue=ut[Je],Qe=fu(je,[],R,{blockHeight:ie.height,blockHash:ie.hash,tipHeight:fe,timestamp:ie.timestamp},typeof Ue?.fee=="number"?Ue.fee:void 0);return hu(Qe,Ue)})},async getTransaction(C){const $=await rn(e,`/v1/tx/${C}?format=json`),G=cR(e),ie=Promise.all($.inputs.map(dt=>/^0{64}$/u.test(dt.point.hash)?Promise.resolve(null):G(dt.point.hash,dt.point.index))),[fe,I,ge,be]=await Promise.all([zt(e,`/v1/tx/${C}/header?format=json`),Jr(e).catch(()=>null),zt(e,`/v1/tx/${C}/details?format=json`),ie]);typeof I=="number"&&(x=Math.max(x??0,I));const tt=fu($,be,R,{blockHeight:fe?.height,blockHash:fe?.hash,tipHeight:typeof I=="number"?I:void 0,timestamp:fe?.timestamp},typeof ge?.fee=="number"?ge.fee:void 0);return hu(tt,ge)},async getTransactionHeader(C){const $=await rn(e,`/v1/tx/${C}?format=json`),[G,ie,fe]=await Promise.all([zt(e,`/v1/tx/${C}/header?format=json`),Jr(e).catch(()=>null),zt(e,`/v1/tx/${C}/details?format=json`)]);typeof ie=="number"&&(x=Math.max(x??0,ie));const I=fu($,[],R,{blockHeight:G?.height,blockHash:G?.hash,tipHeight:typeof ie=="number"?ie:void 0,timestamp:G?.timestamp},typeof fe?.fee=="number"?fe.fee:void 0);return hu(I,fe)},async getTransactionInputScriptHex(C,$){return(await rn(e,`/v1/input/${C}/${String($)}/script?format=text`)).trim()},async getTransactionOutputScriptHex(C,$){return(await rn(e,`/v1/output/${C}/${String($)}/script?format=text`)).trim()},async getAddress(C){const $=jr(C,R);if(!$)throw new Error("Unsupported address format for libbitcoin adapter");const G=T??await xe();if(!O(G))throw new Error("Address endpoints are disabled by server configuration");const ie=i&&w(G),[fe,I]=await Promise.all([zt(e,`/v1/address/${$.hash}/balance?format=json`,ie),Qv(e,$.hash,ie)]),ge=Yv(fe,I),be=await te($.hash,ie);return{address:C,addressType:$.type,balance:ge,totalReceived:void 0,totalSent:void 0,txCount:void 0,utxoCount:I.length,transactions:be}},async getAddressSummary(C){const $=jr(C,R);if(!$)throw new Error("Unsupported address format for libbitcoin adapter");const G=T??await xe();if(!O(G))throw new Error("Address endpoints are disabled by server configuration");const ie=i&&w(G),[fe,I]=await Promise.all([zt(e,`/v1/address/${$.hash}/balance?format=json`,ie),Qv(e,$.hash,ie)]),ge=Yv(fe,I);return{address:C,addressType:$.type,balance:ge,totalReceived:void 0,totalSent:void 0,txCount:void 0,utxoCount:I.length}},async getAddressTransactions(C,$){const G=jr(C,R);if(!G)DELIM" -R"DELIM()return[];const ie=T??await xe();if(!O(ie))return[];const fe=i&&w(ie);return te(G.hash,fe,$)},subscribeToEvents(C){return N(),l.add(C),de(),()=>{l.delete(C),z()}},getEventStatus:L,subscribeToEventStatus(C){return s.add(C),C(L()),()=>{s.delete(C)}}}}const jb=E.createContext(null),Nb=E.createContext(null),Ob=E.createContext(null);function vR({children:e,client:a}){return v.jsx(jb.Provider,{value:a,children:e})}function bR({children:e,provider:a,setProvider:i,availableProviders:l}){return v.jsx(Nb.Provider,{value:{provider:a,setProvider:i,availableProviders:l},children:e})}function xR({children:e,turbo:a,setTurbo:i}){return v.jsx(Ob.Provider,{value:{turbo:a,setTurbo:i},children:e})}function Qa(){const e=E.useContext(jb);if(!e)throw new Error("BlockchainClientProvider missing in component tree");return e}function $o(){return Qa().metadata}function Mb(){const e=E.useContext(Nb);if(!e)throw new Error("ProviderSwitcherProvider missing in component tree");return e}function kb(){const e=E.useContext(Ob);if(!e)throw new Error("TurboProvider missing in component tree");return e}function jd(){const e=globalThis.window;return e?.location.origin?e.location.origin:"http://localhost:8080"}function SR(e,a){if(e==="blockstream")return bb({baseUrl:"https://blockstream.info/api"});if(e==="mempool")return R4({baseUrl:"https://mempool.space/api"});if(e==="libbitcoin"){const l=jd();return Cd({baseUrl:l,turbo:a?.turboEnabled})}if(e==="external"){console.warn("No external API URL provided, falling back to libbitcoin provider");const l=jd();return Cd({baseUrl:l,turbo:a?.turboEnabled})}console.warn(`Unknown provider "${e}", falling back to libbitcoin provider`);const i=jd();return Cd({baseUrl:i,turbo:a?.turboEnabled})}function wR(){return[...new Set(["libbitcoin","blockstream","mempool"])]}const Nd=10,_R=20;function Db(e){return e.metadata.endpoint?{providerId:e.metadata.id,endpoint:e.metadata.endpoint}:{providerId:e.metadata.id}}function ER(e,a){if(!e||typeof e!="object"||Array.isArray(e))return!1;const i=e;return i.providerId===a.providerId&&i.endpoint===a.endpoint}function TR(e,a){if(!e||typeof e!="object"||Array.isArray(e))return a;const i=e.limit;return typeof i=="number"&&Number.isFinite(i)&&i>0?i:a}function RR(e,a,i){const l=e.getQueryCache().findAll({predicate:s=>{const u=s.queryKey;return u.length>=4&&ER(u[0],a)&&u[1]==="blocks"&&u[2]==="latest"}});for(const s of l){const u=TR(s.queryKey[3],Nd);e.setQueryData(s.queryKey,c=>[i,...(c??[]).filter(p=>p.hash!==i.hash)].slice(0,u))}e.setQueryData([a,"blocks","latest",{limit:Nd}],s=>[i,...(s??[]).filter(d=>d.hash!==i.hash)].slice(0,Nd))}function zR(e,a,i){e.setQueryData([a,"transactions","recent"],l=>[i,...(l??[]).filter(c=>c.txid!==i.txid)].slice(0,_R))}function AR(e,a,i){i.type==="block.new"&&RR(e,a,i.payload),i.type==="tx.new"&&zR(e,a,i.payload)}function Qn({queryKey:e,queryFn:a,enabled:i,staleTime:l,initialData:s}){const u=Qa();return Uw({queryKey:[Db(u),...e],queryFn:()=>a(u),enabled:i,staleTime:l,initialData:s})}function Lb(e=10){return Qn({queryKey:["blocks","latest",{limit:e}],queryFn:a=>a.getLatestBlocks(e)})}function Bb(){return Qn({queryKey:["configuration"],queryFn:e=>e.getConfiguration(),staleTime:6e4})}function Ub(e){return Qn({queryKey:["block",e,"header"],queryFn:a=>a.getBlockHeader(e)})}function Hb(e,a){return Qn({queryKey:["block",e,"stats"],queryFn:i=>i.getBlockStats(e),enabled:(a?.enabled??!0)&&!!e.trim(),staleTime:1/0})}function CR(e,a=0){return Qn({queryKey:["block",e,"transactions",{startIndex:a}],queryFn:i=>i.getBlockTransactions(e,a)})}function jR(e){return Qn({queryKey:["transaction",e,"header"],queryFn:a=>a.getTransactionHeader(e),enabled:!!e.trim()})}function NR(e,a){return Qn({queryKey:["transaction",e],queryFn:i=>i.getTransaction(e),enabled:a?.enabled??!!e.trim()})}function OR(e,a,i){return Qn({queryKey:["transaction",e,"input",a,"scriptHex"],queryFn:l=>l.getTransactionInputScriptHex(e,a),enabled:(i?.enabled??!0)&&!!e.trim()})}function MR(e,a,i){return Qn({queryKey:["transaction",e,"output",a,"scriptHex"],queryFn:l=>l.getTransactionOutputScriptHex(e,a),enabled:(i?.enabled??!0)&&!!e.trim()})}function kR(e){return Qn({queryKey:["address",e,"summary"],queryFn:a=>a.getAddressSummary(e),enabled:!!e.trim()})}function DR(e,a){return Qn({queryKey:["address",e,"transactions",{lastSeenTxid:null}],queryFn:i=>i.getAddressTransactions(e,a),enabled:!!e.trim()})}function LR(e){const a=Qa(),i=E.useRef(e);E.useEffect(()=>{i.current=e},[e]),E.useEffect(()=>{const l=a.subscribeToEvents(s=>{i.current(s)});return()=>{l()}},[a])}function BR(){const e=Qa(),a=E.useMemo(()=>({transport:e.metadata.supportsWebsocket?"websocket":"polling",websocketAvailable:e.metadata.supportsWebsocket}),[e.metadata.supportsWebsocket]),[i,l]=E.useState(()=>e.getEventStatus?e.getEventStatus():a);return E.useEffect(()=>{const s=e.getEventStatus?e.getEventStatus():a;return l(s),e.subscribeToEventStatus?.(l)},[e,a]),i}function UR(){const e=Qa(),a=E.useMemo(()=>Db(e),[e]),i=Gu(),l=E.useCallback(s=>{AR)DELIM" -R"DELIM((i,a,s)},[i,a]);return LR(l),null}function HR(e=10){const{data:a,...i}=Lb(e),{data:l=[]}=Qn({queryKey:["transactions","recent"],queryFn:()=>Promise.resolve([]),enabled:!1,initialData:[]});return{data:a,recentTransactions:l,...i}}function $R({children:e}){const a="libbitcoin",i=wR(),l=(()=>{const g=globalThis.window;return g?g.localStorage.getItem("turboEnabled")==="true":!1})(),s=(()=>{const g=globalThis.window;if(!g)return a;const x=g.localStorage.getItem("blockchainProvider");return x&&i.includes(x)?x:a})(),[u,c]=E.useState(l),[d,m]=E.useState(s),[p]=E.useState(()=>new Tw({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}})),b=E.useMemo(()=>SR(d,{turboEnabled:u}),[d,u]);return E.useEffect(()=>{const g=globalThis.window;g&&g.localStorage.setItem("turboEnabled",u?"true":"false")},[u]),E.useEffect(()=>{const g=globalThis.window;g&&g.localStorage.setItem("blockchainProvider",d)},[d]),v.jsx(bR,{provider:d,setProvider:m,availableProviders:i,children:v.jsx(xR,{turbo:u,setTurbo:c,children:v.jsx(vR,{client:b,children:v.jsxs(Rw,{client:p,children:[v.jsx(UR,{}),e,null]})})})})}var $b=e=>{throw TypeError(e)},Zb=(e,a,i)=>a.has(e)||$b("Cannot "+i),Hn=(e,a,i)=>(Zb(e,a,"read from private field"),i?i.call(e):a.get(e)),yo=(e,a,i)=>a.has(e)?$b("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(e):a.set(e,i),ua=(e,a,i,l)=>(Zb(e,a,"write to private field"),a.set(e,i),i),Ju=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Lh=/^[\\/]{2}/;function qb(e,a){return a+e.replace(/\\/g,"/")}var Gv="popstate";function Kv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ZR(e={}){function a(l,s){let u=s.state?.masked,{pathname:c,search:d,hash:m}=u||l.location;return Co("",{pathname:c,search:d,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function i(l,s){return typeof s=="string"?s:ha(s)}return PR(a,i,null,e)}function Me(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function _t(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function qR(){return Math.random().toString(36).substring(2,10)}function Vv(e,a){return{usr:e.state,key:e.key,idx:a,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Co(e,a,i=null,l,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?ma(a):a,state:i,key:a&&a.key||l||qR(),mask:s}}function ha({pathname:e="/",search:a="",hash:i=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function ma(e){let a={};if(e){let i=e.indexOf("#");i>=0&&(a.hash=e.substring(i),e=e.substring(0,i));let l=e.indexOf("?");l>=0&&(a.search=e.substring(l),e=e.substring(0,l)),e&&(a.pathname=e)}return a}function PR(e,a,i,l={}){let{window:s=document.defaultView,v5Compat:u=!1}=l,c=s.history,d="POP",m=null,p=b();p==null&&(p=0,c.replaceState({...c.state,idx:p},""));function b(){return(c.state||{idx:null}).idx}function g(){d="POP";let k=b(),Y=k==null?null:k-p;p=k,m&&m({action:d,location:T.location,delta:Y})}function x(k,Y){d="PUSH";let X=Kv(k)?k:Co(T.location,k,Y);p=b()+1;let ne=Vv(X,p),se=T.createHref(X.mask||X);try{c.pushState(ne,"",se)}catch(te){if(te instanceof DOMException&&te.name==="DataCloneError")throw te;s.location.assign(se)}u&&m&&m({action:d,location:T.location,delta:1})}function _(k,Y){d="REPLACE";let X=Kv(k)?k:Co(T.location,k,Y);p=b();let ne=Vv(X,p),se=T.createHref(X.mask||X);c.replaceState(ne,"",se),u&&m&&m({action:d,location:T.location,delta:0})}function R(k){return Pb(s,k)}let T={get action(){return d},get location(){return e(s,c)},listen(k){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(Gv,g),m=k,()=>{s.removeEventListener(Gv,g),m=null}},createHref(k){return a(s,k)},createURL:R,encodeLocation(k){let Y=R(k);return{pathname:Y.pathname,search:Y.search,hash:Y.hash}},push:x,replace:_,go(k){return c.go(k)}};return T}function Pb(e,a,i=!1){let l="http://localhost";e&&(l=e.location.origin!=="null"?e.location.origin:e.location.href),Me(l,"No window.location.(origin|href) available to create URL");let s=typeof a=="string"?a:ha(a);return s=s.replace(/ $/,"%20"),!i&&Lh.test(s)&&(s=l+s),new URL(s,l)}var go,Xv=class{constructor(e){if(yo(this,go,new Map),e)for(let[a,i]of e)this.set(a,i)}get(e){if(Hn(this,go).has(e))return Hn(this,go).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,a){Hn(this,go).set(e,a)}};go=new WeakMap;var QR=new Set(["lazy","caseSensitive","path","id","index","children"]);function FR(e){return QR.has(e)}var YR=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function GR(e){return YR.has(e)}function KR(e){return e.index===!0}function jo(e,a,i=[],l={},s=!1){return e.map((u,c)=>{let d=[...i,String(c)],m=typeof u.id=="string"?u.id:d.join(")DELIM" -R"DELIM(-");if(Me(u.index!==!0||!u.children,"Cannot specify children on an index route"),Me(s||!l[m],`Found a route id collision on id "${m}". Route id's must be globally unique within Data Router usages`),KR(u)){let p={...u,id:m};return l[m]=Iv(p,a(p)),p}else{let p={...u,id:m,children:void 0};return l[m]=Iv(p,a(p)),u.children&&(p.children=jo(u.children,a,d,l,s)),p}})}function Iv(e,a){return Object.assign(e,{...a,...typeof a.lazy=="object"&&a.lazy!=null?{lazy:{...e.lazy,...a.lazy}}:{}})}function Qb(e,a,i="/"){return ta(e,a,i,!1)}function ta(e,a,i,l,s){let u=typeof a=="string"?ma(a):a,c=qn(u.pathname||"/",i);if(c==null)return null;let d=s??Tu(e),m=null,p=l3(c);for(let b=0;m==null&&b{let b={relativePath:p===void 0?c.path||"":p,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(l)&&m)return;Me(b.relativePath.startsWith(l),`Absolute route path "${b.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(l.length)}let g=Zn([l,b.relativePath]),x=i.concat(b);c.children&&c.children.length>0&&(Me(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Fb(c.children,a,x,g,m)),!(c.path==null&&!c.index)&&a.push({path:g,score:a3(g,c.index),routesMeta:x.map((_,R)=>{let[T,k]=Kb(_.relativePath,_.caseSensitive,R===x.length-1);return{..._,matcher:T,compiledParams:k}})})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))u(c,d);else for(let m of Yb(c.path))u(c,d,!0,m)}),a}function Yb(e){let a=e.split("/");if(a.length===0)return[];let[i,...l]=a,s=i.endsWith("?"),u=i.replace(/\?$/,"");if(l.length===0)return s?[u,""]:[u];let c=Yb(l.join("/")),d=[];return d.push(...c.map(m=>m===""?u:[u,m].join("/"))),s&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function XR(e){e.sort((a,i)=>a.score!==i.score?i.score-a.score:r3(a.routesMeta.map(l=>l.childrenIndex),i.routesMeta.map(l=>l.childrenIndex)))}var IR=/^:[\w-]+$/,JR=3,WR=2,e3=1,t3=10,n3=-2,Jv=e=>e==="*";function a3(e,a){let i=e.split("/"),l=i.length;return i.some(Jv)&&(l+=n3),a&&(l+=WR),i.filter(s=>!Jv(s)).reduce((s,u)=>s+(IR.test(u)?JR:u===""?e3:t3),l)}function r3(e,a){return e.length===a.length&&e.slice(0,-1).every((l,s)=>l===a[s])?e[e.length-1]-a[a.length-1]:0}function i3(e,a,i=!1){let{routesMeta:l}=e,s={},u="/",c=[];for(let d=0;d{if(b==="*"){let R=d[x]||"";c=u.slice(0,u.length-R.length).replace(/(.)\/+$/,"$1")}const _=d[x];return g&&!_?p[b]=void 0:p[b]=(_||"").replace(/%2F/g,"/"),p},{}),pathname:u,pathnameBase:c,pattern:e}}function Kb(e,a=!1,i=!0){_t(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let l=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m,p,b)=>{if(l.push({paramName:d,isOptional:m!=null}),m){let g=b.charAt(p+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,a?void 0:"i"),l]}function l3(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return _t(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${a}).`),e}}function qn(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let i=a.endsWith("/")?a.length-1:a.length,l=e.charAt(i);return l&&l!==")DELIM" -R"DELIM(/"?null:e.slice(i)||"/"}function o3({basename:e,pathname:a}){return a==="/"?e:Zn([e,a])}var Bh=e=>Ju.test(e);function s3(e,a="/"){let{pathname:i,search:l="",hash:s=""}=typeof e=="string"?ma(e):e,u;return i?(i=Uh(i),i.startsWith("/")?u=Wv(i.substring(1),"/"):u=Wv(i,a)):u=a,{pathname:u,search:c3(l),hash:f3(s)}}function Wv(e,a){let i=Pu(a).split("/");return e.split("/").forEach(s=>{s===".."?i.length>1&&i.pop():s!=="."&&i.push(s)}),i.length>1?i.join("/"):"/"}function Od(e,a,i,l){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Vb(e){return e.filter((a,i)=>i===0||a.route.path&&a.route.path.length>0)}function Wu(e){let a=Vb(e);return a.map((i,l)=>l===a.length-1?i.pathname:i.pathnameBase)}function Zo(e,a,i,l=!1){let s;typeof e=="string"?s=ma(e):(s={...e},Me(!s.pathname||!s.pathname.includes("?"),Od("?","pathname","search",s)),Me(!s.pathname||!s.pathname.includes("#"),Od("#","pathname","hash",s)),Me(!s.search||!s.search.includes("#"),Od("#","search","hash",s)));let u=e===""||s.pathname==="",c=u?"/":s.pathname,d;if(c==null)d=i;else{let g=a.length-1;if(!l&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;s.pathname=x.join("/")}d=g>=0?a[g]:"/"}let m=s3(s,d),p=c&&c!=="/"&&c.endsWith("/"),b=(u||c===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(p||b)&&(m.pathname+="/"),m}var Uh=e=>e.replace(/[\\/]{2,}/g,"/"),Zn=e=>Uh(e.join("/")),Pu=e=>e.replace(/\/+$/,""),u3=e=>Pu(e).replace(/^\/*/,"/"),c3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,f3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,d3=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],qo=class{constructor(e,a,i,l=!1){this.status=e,this.statusText=a||"",this.internal=l,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function No(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Po(e){let a=e.map(i=>i.route.path).filter(Boolean);return Zn(a)||"/"}var Xb=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ib(e,a){let i=e;if(typeof i!="string"||!Ju.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let l=i,s=!1;if(Xb)try{let u=new URL(window.location.href),c=Lh.test(i)?new URL(qb(i,u.protocol)):new URL(i),d=qn(c.pathname,a);c.origin===u.origin&&d!=null?i=d+c.search+c.hash:s=!0}catch{_t(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:s,to:i}}var Ar=Symbol("Uninstrumented");function h3(e,a){let i={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(s=>s({id:a.id,index:a.index,path:a.path,instrument(u){let c=Object.keys(i);for(let d of c)u[d]&&i[d].push(u[d])}}));let l={};if(typeof a.lazy=="function"&&i.lazy.length>0){let s=al(i.lazy,a.lazy,()=>{});s&&(l.lazy=s)}if(typeof a.lazy=="object"){let s=a.lazy;["middleware","loader","action"].forEach(u=>{let c=s[u],d=i[`lazy.${u}`];if(typeof c=="function"&&d.length>0){let m=al(d,c,()=>{});m&&(l.lazy=Object.assign(l.lazy||{},{[u]:m}))}})}return["loader","action"].forEach(s=>{let u=a[s];if(typeof u=="function"&&i[s].length>0){let c=u[Ar]??u,d=al(i[s],c,(...m)=>e0(m[0]));d&&(s==="loader"&&c.hydrate===!0&&(d.hydrate=!0),d[Ar]=c,l[s]=d)}}),a.middleware&&a.middleware.length>0&&i.middleware.length>0&&(l.middleware=a.middleware.map(s=>{let u=s[Ar]??s,c=al(i.middleware,u,(...d)=>e0(d[0]));return c?(c[Ar]=u,c):s})),l}function m3(e,a){let i={navigate:[],fetch:[]};if(a.forEach(l=>l({instrument(s){let u=Object.keys(s);for(let c of u)s[c]&&i[c].push(s[c])}})),i.navigate.length>0){let l=e.navigate[Ar]??e.navigate,s=al(i.navigate,l,(...u)=>{let[c,d]=u;return{to:typeof c=="number"||typeof c=="string"?c:c?ha(c):".",...t0(e,d??{})}});s&&(s[Ar]=l,e.navigate=s)}if(i.fetch.length>0){let l=e.fetch[Ar]??e.fetch,s=al(i.fetch,l,(...u)=>{let[c,,d,m]=u;return{href:d??".",fetcherKey:c,...t0(e,m??{})}});s&&(s[Ar]=l,e.fetch=s)}return e}function al(e,a,i){return e.length===0?null:async(...l)=>{let s=await Jb(e,i(...l),()=>a(...l),e.length-1);if(s.type==="error")throw s.value;return s.value}}async function Jb(e,a,i,l){let s=e[l],u;if(s){let c,d=async()=>(c?console.error("You cannot call instrumented handlers more than once"):c=Jb(e,a,i,l-1),u=await c,Me(u,"Expected a result"),u.type==="error"&&u.value instanceof Error?{status:"error",error:u.value}:{status:"success",error:void 0});try{await s(d,a)}catch(m){console.error("An instrumentation function threw an error:",m)}c||await d(),await c}else try{u={type:"success",value:await i()}}catch(c){u={type:"error",value:c}}return u||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function e0(e){let{reques)DELIM" -R"DELIM(t:a,context:i,params:l,pattern:s}=e;return{request:p3(a),params:{...l},pattern:s,context:y3(i)}}function t0(e,a){return{currentUrl:ha(e.state.location),..."formMethod"in a?{formMethod:a.formMethod}:{},..."formEncType"in a?{formEncType:a.formEncType}:{},..."formData"in a?{formData:a.formData}:{},..."body"in a?{body:a.body}:{}}}function p3(e){return{method:e.method,url:e.url,headers:{get:(...a)=>e.headers.get(...a)}}}function y3(e){if(v3(e)){let a={...e};return Object.freeze(a),a}else return{get:a=>e.get(a)}}var g3=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function v3(e){if(e===null||typeof e!="object")return!1;const a=Object.getPrototypeOf(e);return a===Object.prototype||a===null||Object.getOwnPropertyNames(a).sort().join("\0")===g3}var Wb=["POST","PUT","PATCH","DELETE"],b3=new Set(Wb),x3=["GET",...Wb],S3=new Set(x3),ex=new Set([301,302,303,307,308]),w3=new Set([307,308]),Md={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},_3={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},co={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},E3=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),tx="remix-router-transitions",nx=Symbol("ResetLoaderData"),Wr,Wi,Er,el,T3=class{constructor(e){yo(this,Wr),yo(this,Wi),yo(this,Er),yo(this,el),ua(this,Wr,e),ua(this,Wi,Tu(e))}get stableRoutes(){return Hn(this,Wr)}get activeRoutes(){return Hn(this,Er)??Hn(this,Wr)}get branches(){return Hn(this,el)??Hn(this,Wi)}get hasHMRRoutes(){return Hn(this,Er)!=null}setRoutes(e){ua(this,Wr,e),ua(this,Wi,Tu(e))}setHmrRoutes(e){ua(this,Er,e),ua(this,el,Tu(e))}commitHmrRoutes(){Hn(this,Er)&&(ua(this,Wr,Hn(this,Er)),ua(this,Wi,Hn(this,el)),ua(this,Er,void 0),ua(this,el,void 0))}};Wr=new WeakMap;Wi=new WeakMap;Er=new WeakMap;el=new WeakMap;function R3(e){const a=e.window?e.window:typeof window<"u"?window:void 0,i=typeof a<"u"&&typeof a.document<"u"&&typeof a.document.createElement<"u";Me(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let l=e.hydrationRouteProperties||[],s=e.mapRouteProperties||E3,u=s;if(e.instrumentations){let j=e.instrumentations;u=D=>({...s(D),...h3(j.map(P=>P.route).filter(Boolean),D)})}let c={},d=new T3(jo(e.routes,u,void 0,c)),m=e.basename||"/";m.startsWith("/")||(m=`/${m}`);let p=e.dataStrategy||N3,b={...e.future},g=null,x=new Set,_=null,R=null,T=null,k=null,Y=e.hydrationData!=null,X=ta(d.activeRoutes,e.history.location,m,!1,d.branches),ne=!1,se=null,te,xe;if(X==null&&!e.patchRoutesOnNavigation){let j=$n(404,{pathname:e.history.location.pathname}),{matches:D,route:P}=pu(d.activeRoutes);te=!0,xe=!te,X=D,se={[P.id]:j}}else if(X&&!e.hydrationData&&Ka(X,d.activeRoutes,e.history.location.pathname).active&&(X=null),X)if(X.some(j=>j.route.lazy))te=!1,xe=!te;else if(!X.some(j=>Hh(j.route)))te=!0,xe=!te;else{let j=e.hydrationData?e.hydrationData.loaderData:null,D=e.hydrationData?e.hydrationData.errors:null,P=X;if(D){let le=X.findIndex(oe=>D[oe.route.id]!==void 0);P=P.slice(0,le+1)}xe=!1,te=!0,P.forEach(le=>{let oe=ax(le.route,j,D);xe=xe||oe.renderFallback,te=te&&!oe.shouldLoad})}else{te=!1,xe=!te,X=[];let j=Ka(null,d.activeRoutes,e.history.location.pathname);j.active&&j.matches&&(ne=!0,X=j.matches)}let O,w={historyAction:e.history.action,location:e.history.location,matches:X,initialized:te,renderFallback:xe,navigation:Md,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||se,fetchers:new Map,blockers:new Map},L="POP",H=null,Q=!1,K,he=!1,me=new Map,W=null,N=!1,B=!1,ue=new Set,de=new Map,ce=0,z=-1,C=new Map,$=new Set,G=new Map,ie=new Map,fe=new Set,I=new Map,ge,be=null;function tt(){if(g=e.history.listen(({action:j,location:D,delta:P})=>{if(ge){ge(),ge=void 0;return}_t(I.size===0||P!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let le=Dr({currentLocation:w.location,nextLocation:D,historyAction:j});if(le&&P!=null){let oe=new Promise(Se=>{ge=Se});e.history.go(P*-1),xa(le,{state:"blocked",location:D,proceed(){xa(le,{state:"proceeding",proceed:void 0,reset:void 0,location:D}),oe.then(()=>e.history.go(P))},reset(){let Se=new Map(w.blockers);Se.set(le,co),ut({blockers:Se})}}),H?.resolve(),H=null;return}return Qe(j,D)}),i){X3(a,me);let j=()=>I3(a,me);a.addEventListener("pagehide",j),W=()=>a.removeEventListener("pagehide",j)}return w.initialized||Qe)DELIM" -R"DELIM(("POP",w.location,{initialHydration:!0}),O}function dt(){g&&g(),W&&W(),x.clear(),K&&K.abort(),w.fetchers.forEach((j,D)=>ba(w.fetchers,D)),w.blockers.forEach((j,D)=>kr(D))}function xt(j){if(x.add(j),_){let{newErrors:D}=_;_=null,j(w,{deletedFetchers:[],newErrors:D,viewTransitionOpts:void 0,flushSync:!1})}return()=>x.delete(j)}function ut(j,D={}){j.matches&&(j.matches=j.matches.map(oe=>{let Se=c[oe.route.id],pe=oe.route;return pe.element!==Se.element||pe.errorElement!==Se.errorElement||pe.hydrateFallbackElement!==Se.hydrateFallbackElement?{...oe,route:Se}:oe})),w={...w,...j};let P=[],le=[];w.fetchers.forEach((oe,Se)=>{oe.state==="idle"&&(fe.has(Se)?P.push(Se):le.push(Se))}),fe.forEach(oe=>{!w.fetchers.has(oe)&&!de.has(oe)&&P.push(oe)}),x.size===0&&(_={newErrors:j.errors??null}),[...x].forEach(oe=>oe(w,{deletedFetchers:P,newErrors:j.errors??null,viewTransitionOpts:D.viewTransitionOpts,flushSync:D.flushSync===!0})),P.forEach(oe=>ba(w.fetchers,oe)),le.forEach(oe=>w.fetchers.delete(oe))}function je(j,D,{flushSync:P}={}){let le=w.actionData!=null&&w.navigation.formMethod!=null&&It(w.navigation.formMethod)&&w.navigation.state==="loading"&&j.state?._isRedirect!==!0,oe;D.actionData?Object.keys(D.actionData).length>0?oe=D.actionData:oe=null:le?oe=w.actionData:oe=null;let Se=D.loaderData?f0(w.loaderData,D.loaderData,D.matches||[],D.errors):w.loaderData,pe=w.blockers;pe.size>0&&(pe=new Map(pe),pe.forEach((Re,ke)=>pe.set(ke,co)));let ve=N?!1:pl(j,D.matches||w.matches),ye=Q===!0||w.navigation.formMethod!=null&&It(w.navigation.formMethod)&&j.state?._isRedirect!==!0;d.commitHmrRoutes(),N||L==="POP"||(L==="PUSH"?e.history.push(j,j.state):L==="REPLACE"&&e.history.replace(j,j.state));let Te;if(L==="POP"){let Re=me.get(w.location.pathname);Re&&Re.has(j.pathname)?Te={currentLocation:w.location,nextLocation:j}:me.has(j.pathname)&&(Te={currentLocation:j,nextLocation:w.location})}else if(he){let Re=me.get(w.location.pathname);Re?Re.add(j.pathname):(Re=new Set([j.pathname]),me.set(w.location.pathname,Re)),Te={currentLocation:w.location,nextLocation:j}}ut({...D,actionData:oe,loaderData:Se,historyAction:L,location:j,initialized:!0,renderFallback:!1,navigation:Md,revalidation:"idle",restoreScrollPosition:ve,preventScrollReset:ye,blockers:pe},{viewTransitionOpts:Te,flushSync:P===!0}),L="POP",Q=!1,he=!1,N=!1,B=!1,H?.resolve(),H=null,be?.resolve(),be=null}async function Je(j,D){if(H?.resolve(),H=null,typeof j=="number"){H||(H=p0());let Ke=H.promise;return e.history.go(j),Ke}let P=sh(w.location,w.matches,m,j,D?.fromRouteId,D?.relative),{path:le,submission:oe,error:Se}=n0(!1,P,D),pe;D?.mask&&(pe={pathname:"",search:"",hash:"",...typeof D.mask=="string"?ma(D.mask):{...w.location.mask,...D.mask}});let ve=w.location,ye=Co(ve,le,D&&D.state,void 0,pe);ye={...ye,...e.history.encodeLocation(ye)};let Te=D&&D.replace!=null?D.replace:void 0,Re="PUSH";Te===!0?Re="REPLACE":Te===!1||oe!=null&&It(oe.formMethod)&&oe.formAction===w.location.pathname+w.location.search&&(Re="REPLACE");let ke=D&&"preventScrollReset"in D?D.preventScrollReset===!0:void 0,Ce=(D&&D.flushSync)===!0,Be=Dr({currentLocation:ve,nextLocation:ye,historyAction:Re});if(Be){xa(Be,{state:"blocked",location:ye,proceed(){xa(Be,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),Je(j,D)},reset(){let Ke=new Map(w.blockers);Ke.set(Be,co),ut({blockers:Ke})}});return}await Qe(Re,ye,{submission:oe,pendingError:Se,preventScrollReset:ke,replace:D&&D.replace,enableViewTransition:D&&D.viewTransition,flushSync:Ce,callSiteDefaultShouldRevalidate:D&&D.defaultShouldRevalidate})}function Ue(){be||(be=p0()),Ya(),ut({revalidation:"loading"});let j=be.promise;return w.navigation.state==="submitting"?j:w.navigation.state==="idle"?(Qe(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),j):(Qe(L||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:he===!0}),j)}async function Qe(j,D,P){K&&K.abort(),K=null,L=j,N=(P&&P.startUninterruptedRevalidation)===!0,sc(w.location,w.matches),Q=(P&&P.preventScrollReset)===!0,he=(P&&P.enableViewTransition)===!0;let le=d.activeRoutes,oe=P?.initialHydration&&w.matches&&w.matches.length>0&&!ne?w.matches:ta(le,D,m,!1,d.branches),Se=(P&&P.flushSync)===!0;if(oe&&w.initialized&&!B&&$3(w.location,D)&&!(P&&P.submission&&It(P.submission.formMethod))){je(D,{matches:oe},{flushSync:Se});return}let pe=Ka(oe,le,D.pathname);if(pe.active&&pe.matches&&(oe=pe.matches),!oe){let{error:et,notFoundMatches:Fe,route:Et}=Gn(D.pathname);je(D,{matches:Fe,loaderData:{},errors:{[Et.id]:et}},{flushSync:Se});return}let ve=P&&P.overrideNavigation?{...P.overrideNavigation,matches:oe,historyAction:j}:void 0;K=new AbortController;let ye=tl(e.history,D,K.signal,P&&P.submission),Te=e.getContext?await e.getContext():new Xv,Re;if(P&&P.pendingError)Re=[zr(oe).route.id,{type:"error",error:P.pendingError}];else if(P&&P.submission&&It(P.submission.formMethod)){let et=await An(ye,D,P.submission,oe,j,Te,pe.active,P&&P.initialHydration===!0,{replace:P.replace,flushS)DELIM" -R"DELIM(ync:Se});if(et.shortCircuited)return;if(et.pendingActionResult){let[Fe,Et]=et.pendingActionResult;if(Tn(Et)&&No(Et.error)&&Et.error.status===404){K=null,je(D,{matches:et.matches,loaderData:{},errors:{[Fe]:Et.error}});return}}oe=et.matches||oe,Re=et.pendingActionResult,ve=kd(D,oe,j,P.submission),Se=!1,pe.active=!1,ye=tl(e.history,ye.url,ye.signal)}let{shortCircuited:ke,matches:Ce,loaderData:Be,errors:Ke,workingFetchers:ht}=await ya(ye,D,oe,j,Te,pe.active,ve,P&&P.submission,P&&P.fetcherSubmission,P&&P.replace,P&&P.initialHydration===!0,Se,Re,P&&P.callSiteDefaultShouldRevalidate);ke||(K=null,je(D,{matches:Ce||oe,...d0(Re),loaderData:Be,errors:Ke,...ht?{fetchers:ht}:{}}))}async function An(j,D,P,le,oe,Se,pe,ve,ye={}){Ya();let Te=K3(D,le,oe,P);if(ut({navigation:Te},{flushSync:ye.flushSync===!0}),pe){let Ce=await aa(le,D.pathname,j.signal);if(Ce.type==="aborted")return{shortCircuited:!0};if(Ce.type==="error"){if(Ce.partialMatches.length===0){let{matches:Ke,route:ht}=pu(d.activeRoutes);return{matches:Ke,pendingActionResult:[ht.id,{type:"error",error:Ce.error}]}}let Be=zr(Ce.partialMatches).route.id;return{matches:Ce.partialMatches,pendingActionResult:[Be,{type:"error",error:Ce.error}]}}else if(Ce.matches)le=Ce.matches;else{let{notFoundMatches:Be,error:Ke,route:ht}=Gn(D.pathname);return{matches:Be,pendingActionResult:[ht.id,{type:"error",error:Ke}]}}}let Re,ke=Ru(le,D);if(!ke.route.action&&!ke.route.lazy)Re={type:"error",error:$n(405,{method:j.method,pathname:D.pathname,routeId:ke.route.id})};else{let Ce=il(u,c,j,D,le,ke,ve?[]:l,Se),Be=await Fa(j,D,Ce,Se,null);if(Re=Be[ke.route.id],!Re){for(let Ke of le)if(Be[Ke.route.id]){Re=Be[Ke.route.id];break}}if(j.signal.aborted)return{shortCircuited:!0}}if(ni(Re)){let Ce;return ye&&ye.replace!=null?Ce=ye.replace:Ce=s0(Re.response.headers.get("Location"),new URL(j.url),m,e.history)===w.location.pathname+w.location.search,await va(j,Re,!0,{submission:P,replace:Ce}),{shortCircuited:!0}}if(Tn(Re)){let Ce=zr(le,ke.route.id);return(ye&&ye.replace)!==!0&&(L="PUSH"),{matches:le,pendingActionResult:[Ce.route.id,Re,ke.route.id]}}return{matches:le,pendingActionResult:[ke.route.id,Re]}}async function ya(j,D,P,le,oe,Se,pe,ve,ye,Te,Re,ke,Ce,Be){let Ke=pe||kd(D,P,le,ve),ht=ve||ye||m0(Ke),et=!N&&!Re;if(Se){if(et){let ct=Ut(Ce);ut({navigation:Ke,...ct!==void 0?{actionData:ct}:{}},{flushSync:ke})}let Ne=await aa(P,D.pathname,j.signal);if(Ne.type==="aborted")return{shortCircuited:!0};if(Ne.type==="error"){if(Ne.partialMatches.length===0){let{matches:yn,route:Xn}=pu(d.activeRoutes);return{matches:yn,loaderData:{},errors:{[Xn.id]:Ne.error}}}let ct=zr(Ne.partialMatches).route.id;return{matches:Ne.partialMatches,loaderData:{},errors:{[ct]:Ne.error}}}else if(Ne.matches)P=Ne.matches;else{let{error:ct,notFoundMatches:yn,route:Xn}=Gn(D.pathname);return{matches:yn,loaderData:{},errors:{[Xn.id]:ct}}}}let Fe=d.activeRoutes,{dsMatches:Et,revalidatingFetchers:Ye}=a0(j,oe,u,c,e.history,w,P,ht,D,Re?[]:l,Re===!0,B,ue,fe,G,$,Fe,m,e.patchRoutesOnNavigation!=null,d.branches,Ce,Be);if(z=++ce,!e.dataStrategy&&!Et.some(Ne=>Ne.shouldLoad)&&!Et.some(Ne=>Ne.route.middleware&&Ne.route.middleware.length>0)&&Ye.length===0){let Ne=new Map(w.fetchers),ct=Go(Ne);return je(D,{matches:P,loaderData:{},errors:Ce&&Tn(Ce[1])?{[Ce[0]]:Ce[1].error}:null,...d0(Ce),...ct?{fetchers:Ne}:{}},{flushSync:ke}),{shortCircuited:!0}}if(et){let Ne={};if(!Se){Ne.navigation=Ke;let ct=Ut(Ce);ct!==void 0&&(Ne.actionData=ct)}Ye.length>0&&(Ne.fetchers=ga(Ye)),ut(Ne,{flushSync:ke})}Ye.forEach(Ne=>{Ht(Ne.key),Ne.controller&&de.set(Ne.key,Ne.controller)});let Va=()=>Ye.forEach(Ne=>Ht(Ne.key));K&&K.signal.addEventListener("abort",Va);let{loaderResults:Kn,fetcherResults:on}=await ml(Et,Ye,j,D,oe);if(j.signal.aborted)return{shortCircuited:!0};K&&K.signal.removeEventListener("abort",Va),Ye.forEach(Ne=>de.delete(Ne.key));let en=yu(Kn);if(en)return await va(j,en.result,!0,{replace:Te}),{shortCircuited:!0};if(en=yu(on),en)return $.add(en.key),await va(j,en.result,!0,{replace:Te}),{shortCircuited:!0};let jn=new Map(w.fetchers),{loaderData:fi,errors:Vn}=c0(w,P,Kn,Ce,Ye,on,jn);Re&&w.errors&&(Vn={...w.errors,...Vn});let di=Go(jn),Sa=Ko(z,jn),wa=di||Sa||Ye.length>0;return{matches:P,loaderData:fi,errors:Vn,...wa?{workingFetchers:jn}:{}}}function Ut(j){if(j&&!Tn(j[1]))return{[j[0]]:j[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function ga(j){let D=new Map(w.fetchers);return j.forEach(P=>{let le=D.get(P.key),oe=fo(void 0,le?le.data:void 0);D.set(P.key,oe)}),D}async function Mr(j,D,P,le){Ht(j);let oe=(le&&le.flushSync)===!0,Se=d.activeRoutes,pe=sh(w.location,w.matches,m,P,D,le?.relative),ve=ta(Se,pe,m,!1,d.branches),ye=Ka(ve,Se,pe);if(ye.active&&ye.matches&&(ve=ye.matches),!ve){Cn(j,D,$n(404,{pathname:pe}),{flushSync:oe});return}let{path:Te,submission:Re,error:ke}=n0(!0,pe,le);if(ke){Cn(j,D,ke,{flushSync:oe});return}let Ce=e.getContext?await e.getContext():new Xv,Be=(le&&le.preventScrollReset)===!0;if(Re&&It(Re.formMethod)){a)DELIM" -R"DELIM(wait hl(j,D,Te,ve,Ce,ye.active,oe,Be,Re,le&&le.defaultShouldRevalidate);return}G.set(j,{routeId:D,path:Te}),await Jt(j,D,Te,ve,Ce,ye.active,oe,Be,Re)}async function hl(j,D,P,le,oe,Se,pe,ve,ye,Te){Ya(),G.delete(j);let Re=w.fetchers.get(j);Yn(j,V3(ye,Re),{flushSync:pe});let ke=new AbortController,Ce=tl(e.history,P,ke.signal,ye);if(Se){let nt=await aa(le,new URL(Ce.url).pathname,Ce.signal,j);if(nt.type==="aborted")return;if(nt.type==="error"){Cn(j,D,nt.error,{flushSync:pe});return}else if(nt.matches)le=nt.matches;else{Cn(j,D,$n(404,{pathname:P}),{flushSync:pe});return}}let Be=Ru(le,P);if(!Be.route.action&&!Be.route.lazy){let nt=$n(405,{method:ye.formMethod,pathname:P,routeId:D});Cn(j,D,nt,{flushSync:pe});return}de.set(j,ke);let Ke=ce,ht=il(u,c,Ce,P,le,Be,l,oe),et=await Fa(Ce,P,ht,oe,j),Fe=et[Be.route.id];if(!Fe){for(let nt of ht)if(et[nt.route.id]){Fe=et[nt.route.id];break}}if(Ce.signal.aborted){de.get(j)===ke&&de.delete(j);return}if(fe.has(j)){if(ni(Fe)||Tn(Fe)){Yn(j,fa(void 0));return}}else{if(ni(Fe))if(de.delete(j),z>Ke){Yn(j,fa(void 0));return}else return $.add(j),Yn(j,fo(ye)),va(Ce,Fe,!1,{fetcherSubmission:ye,preventScrollReset:ve});if(Tn(Fe)){Cn(j,D,Fe.error);return}}let Et=w.navigation.location||w.location,Ye=tl(e.history,Et,ke.signal),Va=d.activeRoutes,Kn=w.navigation.state!=="idle"?ta(Va,w.navigation.location,m,!1,d.branches):w.matches;Me(Kn,"Didn't find any matches after fetcher action");let on=++ce;C.set(j,on);let{dsMatches:en,revalidatingFetchers:jn}=a0(Ye,oe,u,c,e.history,w,Kn,ye,Et,l,!1,B,ue,fe,G,$,Va,m,e.patchRoutesOnNavigation!=null,d.branches,[Be.route.id,Fe],Te),fi=fo(ye,Fe.data),Vn=new Map(w.fetchers);Vn.set(j,fi),jn.filter(nt=>nt.key!==j).forEach(nt=>{let _a=nt.key,tn=Vn.get(_a),yl=fo(void 0,tn?tn.data:void 0);Vn.set(_a,yl),Ht(_a),nt.controller&&de.set(_a,nt.controller)}),ut({fetchers:Vn});let di=()=>jn.forEach(nt=>Ht(nt.key));ke.signal.addEventListener("abort",di);let{loaderResults:Sa,fetcherResults:wa}=await ml(en,jn,Ye,Et,oe);if(ke.signal.aborted)return;ke.signal.removeEventListener("abort",di),C.delete(j),de.delete(j),jn.forEach(nt=>de.delete(nt.key));let Ne=w.fetchers.has(j),ct=nt=>{if(!Ne)return nt;let _a=new Map(nt.fetchers);return _a.set(j,fa(Fe.data)),{...nt,fetchers:_a}},yn=yu(Sa);if(yn)return w=ct(w),va(Ye,yn.result,!1,{preventScrollReset:ve});if(yn=yu(wa),yn)return $.add(yn.key),w=ct(w),va(Ye,yn.result,!1,{preventScrollReset:ve});let Xn=new Map(w.fetchers);Ne&&Xn.set(j,fa(Fe.data));let{loaderData:hi,errors:mi}=c0(w,Kn,Sa,void 0,jn,wa,Xn);Ko(on,Xn),w.navigation.state==="loading"&&on>z?(Me(L,"Expected pending action"),K&&K.abort(),je(w.navigation.location,{matches:Kn,loaderData:hi,errors:mi,fetchers:Xn})):(ut({errors:mi,loaderData:f0(w.loaderData,hi,Kn,mi),fetchers:Xn}),B=!1)}async function Jt(j,D,P,le,oe,Se,pe,ve,ye){let Te=w.fetchers.get(j);Yn(j,fo(ye,Te?Te.data:void 0),{flushSync:pe});let Re=new AbortController,ke=tl(e.history,P,Re.signal);if(Se){let Fe=await aa(le,new URL(ke.url).pathname,ke.signal,j);if(Fe.type==="aborted")return;if(Fe.type==="error"){Cn(j,D,Fe.error,{flushSync:pe});return}else if(Fe.matches)le=Fe.matches;else{Cn(j,D,$n(404,{pathname:P}),{flushSync:pe});return}}let Ce=Ru(le,P);de.set(j,Re);let Be=ce,Ke=il(u,c,ke,P,le,Ce,l,oe),ht=await Fa(ke,P,Ke,oe,j),et=ht[Ce.route.id];if(!et){for(let Fe of le)if(ht[Fe.route.id]){et=ht[Fe.route.id];break}}if(de.get(j)===Re&&de.delete(j),!ke.signal.aborted){if(fe.has(j)){Yn(j,fa(void 0));return}if(ni(et))if(z>Be){Yn(j,fa(void 0));return}else{$.add(j),await va(ke,et,!1,{preventScrollReset:ve});return}if(Tn(et)){Cn(j,D,et.error);return}Yn(j,fa(et.data))}}async function va(j,D,P,{submission:le,fetcherSubmission:oe,preventScrollReset:Se,replace:pe}={}){P||(H?.resolve(),H=null),D.response.headers.has("X-Remix-Revalidate")&&(B=!0);let ve=D.response.headers.get("Location");Me(ve,"Expected a Location header on the redirect Response"),ve=s0(ve,new URL(j.url),m,e.history);let ye=Co(w.location,ve,{_isRedirect:!0});if(i){let Ke=!1;if(D.response.headers.has("X-Remix-Reload-Document"))Ke=!0;else if(Bh(ve)){const ht=Pb(a,ve,!0);Ke=ht.origin!==a.location.origin||qn(ht.pathname,m)==null}if(Ke){pe?a.location.replace(ve):a.location.assign(ve);return}}K=null;let Te=pe===!0||D.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Re,formAction:ke,formEncType:Ce}=w.navigation;!le&&!oe&&Re&&ke&&Ce&&(le=m0(w.navigation));let Be=le||oe;if(w3.has(D.response.status)&&Be&&It(Be.formMethod))await Qe(Te,ye,{submission:{...Be,formAction:ve},preventScrollReset:Se||Q,enableViewTransition:P?he:void 0});else{let Ke=kd(ye,[],Te,le);await Qe(Te,ye,{overrideNavigation:Ke,fetcherSubmission:oe,preventScrollReset:Se||Q,enableViewTransition:P?he:void 0})}}async function Fa(j,D,P,le,oe){let Se,pe={};try{Se=await M3(p,j,D,P,oe,le,!1)}catch(ve){return P.filter(ye=>ye.shouldLoad).forEach(ye=>{pe[ye.route.id]={type:"error",error:ve}}),pe}if(j.signal.aborted)return pe;if(!It(j.method))for(let ve of P){if(Se[ve.route.id]?.type==="error")break;!Se.hasOwnProper)DELIM" -R"DELIM(ty(ve.route.id)&&!w.loaderData.hasOwnProperty(ve.route.id)&&(!w.errors||!w.errors.hasOwnProperty(ve.route.id))&&ve.shouldCallHandler()&&(Se[ve.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${ve.route.id}`)})}for(let[ve,ye]of Object.entries(Se))if(Q3(ye)){let Te=ye.result;pe[ve]={type:"redirect",response:B3(Te,j,ve,P,m)}}else pe[ve]=await L3(ye);return pe}async function ml(j,D,P,le,oe){let Se=Fa(P,le,j,oe,null),pe=Promise.all(D.map(async Te=>{if(Te.matches&&Te.match&&Te.request&&Te.controller){let ke=(await Fa(Te.request,Te.path,Te.matches,oe,Te.key))[Te.match.route.id];return{[Te.key]:ke}}else return Promise.resolve({[Te.key]:{type:"error",error:$n(404,{pathname:Te.path})}})})),ve=await Se,ye=(await pe).reduce((Te,Re)=>Object.assign(Te,Re),{});return{loaderResults:ve,fetcherResults:ye}}function Ya(){B=!0,G.forEach((j,D)=>{de.has(D)&&ue.add(D),Ht(D)})}function Yn(j,D,P={}){let le=new Map(w.fetchers);le.set(j,D),ut({fetchers:le},{flushSync:(P&&P.flushSync)===!0})}function Cn(j,D,P,le={}){let oe=zr(w.matches,D),Se=new Map(w.fetchers);ba(Se,j),ut({errors:{[oe.route.id]:P},fetchers:Se},{flushSync:(le&&le.flushSync)===!0})}function ic(j){return ie.set(j,(ie.get(j)||0)+1),fe.has(j)&&fe.delete(j),w.fetchers.get(j)||_3}function lc(j,D){Ht(j,D?.reason),Yn(j,fa(null))}function ba(j,D){let P=w.fetchers.get(D);de.has(D)&&!(P&&P.state==="loading"&&C.has(D))&&Ht(D),G.delete(D),C.delete(D),$.delete(D),fe.delete(D),ue.delete(D),j.delete(D)}function Wt(j){let D=(ie.get(j)||0)-1;D<=0?(ie.delete(j),fe.add(j)):ie.set(j,D),ut({fetchers:new Map(w.fetchers)})}function Ht(j,D){let P=de.get(j);P&&(P.abort(D),de.delete(j))}function Kt(j,D){for(let P of j){let le=D.get(P);Me(le,`Expected fetcher: ${P}`);let oe=fa(le.data);D.set(P,oe)}}function Go(j){let D=[],P=!1;for(let le of $){let oe=j.get(le);Me(oe,`Expected fetcher: ${le}`),oe.state==="loading"&&($.delete(le),D.push(le),P=!0)}return Kt(D,j),P}function Ko(j,D){let P=[];for(let[le,oe]of C)if(oe0}function oc(j,D){let P=w.blockers.get(j)||co;return I.get(j)!==D&&I.set(j,D),P}function kr(j){w.blockers.delete(j),I.delete(j)}function xa(j,D){let P=w.blockers.get(j)||co;Me(P.state==="unblocked"&&D.state==="blocked"||P.state==="blocked"&&D.state==="blocked"||P.state==="blocked"&&D.state==="proceeding"||P.state==="blocked"&&D.state==="unblocked"||P.state==="proceeding"&&D.state==="unblocked",`Invalid blocker state transition: ${P.state} -> ${D.state}`);let le=new Map(w.blockers);le.set(j,D),ut({blockers:le})}function Dr({currentLocation:j,nextLocation:D,historyAction:P}){if(I.size===0)return;I.size>1&&_t(!1,"A router only supports one blocker at a time");let le=Array.from(I.entries()),[oe,Se]=le[le.length-1],pe=w.blockers.get(oe);if(!(pe&&pe.state==="proceeding")&&Se({currentLocation:j,nextLocation:D,historyAction:P}))return oe}function Gn(j){let D=$n(404,{pathname:j}),P=d.activeRoutes,{matches:le,route:oe}=pu(P);return{notFoundMatches:le,route:oe,error:D}}function ci(j,D,P){if(R=j,k=D,T=P||null,!Y&&w.navigation===Md){Y=!0;let le=pl(w.location,w.matches);le!=null&&ut({restoreScrollPosition:le})}return()=>{R=null,k=null,T=null}}function Ga(j,D){return T&&T(j,D.map(le=>VR(le,w.loaderData)))||j.key}function sc(j,D){if(R&&k){let P=Ga(j,D);R[P]=k()}}function pl(j,D){if(R){let P=Ga(j,D),le=R[P];if(typeof le=="number")return le}return null}function Ka(j,D,P){if(e.patchRoutesOnNavigation){let le=d.branches;if(j){if(Object.keys(j[0].params).length>0)return{active:!0,matches:ta(D,P,m,!0,le)}}else return{active:!0,matches:ta(D,P,m,!0,le)||[]}}return{active:!1,matches:null}}async function aa(j,D,P,le){if(!e.patchRoutesOnNavigation)return{type:"success",matches:j};let oe=j;for(;;){let Se=c;try{await e.patchRoutesOnNavigation({signal:P,path:D,matches:oe,fetcherKey:le,patch:(Te,Re)=>{P.aborted||r0(Te,Re,d,Se,u,!1)}})}catch(Te){return{type:"error",error:Te,partialMatches:oe}}if(P.aborted)return{type:"aborted"};let pe=d.branches,ve=ta(d.activeRoutes,D,m,!1,pe),ye=null;if(ve){if(Object.keys(ve[0].params).length===0)return{type:"success",matches:ve};if(ye=ta(d.activeRoutes,D,m,!0,pe),!(ye&&oe.lengthP.route.id===D[le].route.id)}function Xo(j){c={},d.setHmrRoutes(jo(j,u,void 0,c))}function Io(j,D,P=!1){r0(j,D,d,c,u,P),d.hasHMRRoutes||ut({})}return O={get basename(){return m},get future(){return b},get state(){return w},get routes(){return d.stableRoutes},get branches(){return d.branches},get manifest(){return c},get window(){return a},initialize:tt,subscribe:xt,enableScrollRestoration:ci,navigate:Je,fetch:Mr,revalidate:Ue,createHref:j=>e.history.createHref(j),encodeLocation:j=>e.history.encodeLocation(j),g)DELIM" -R"DELIM(etFetcher:ic,resetFetcher:lc,deleteFetcher:Wt,dispose:dt,getBlocker:oc,deleteBlocker:kr,patchRoutes:Io,_internalFetchControllers:de,_internalSetRoutes:Xo,_internalSetStateDoNotUseOrYouWillBreakYourApp(j){ut(j)}},e.instrumentations&&(O=m3(O,e.instrumentations.map(j=>j.router).filter(Boolean))),O}function z3(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function sh(e,a,i,l,s,u){let c,d;if(s){c=[];for(let p of a)if(c.push(p),p.route.id===s){d=p;break}}else c=a,d=a[a.length-1];let m=Zo(l||".",Wu(c),qn(e.pathname,i)||e.pathname,u==="path");if(l==null&&(m.search=e.search,m.hash=e.hash),(l==null||l===""||l===".")&&d){let p=Zh(m.search);if(d.route.index&&!p)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&p){let b=new URLSearchParams(m.search),g=b.getAll("index");b.delete("index"),g.filter(_=>_).forEach(_=>b.append("index",_));let x=b.toString();m.search=x?`?${x}`:""}}return i!=="/"&&(m.pathname=o3({basename:i,pathname:m.pathname})),ha(m)}function n0(e,a,i){if(!i||!z3(i))return{path:a};if(i.formMethod&&!G3(i.formMethod))return{path:a,error:$n(405,{method:i.formMethod})};let l=()=>({path:a,error:$n(400,{type:"invalid-body"})}),u=(i.formMethod||"get").toUpperCase(),c=cx(a);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!It(u))return l();let g=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((x,[_,R])=>`${x}${_}=${R} -`,""):String(i.body);return{path:a,submission:{formMethod:u,formAction:c,formEncType:i.formEncType,formData:void 0,json:void 0,text:g}}}else if(i.formEncType==="application/json"){if(!It(u))return l();try{let g=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:a,submission:{formMethod:u,formAction:c,formEncType:i.formEncType,formData:void 0,json:g,text:void 0}}}catch{return l()}}}Me(typeof FormData=="function","FormData is not available in this environment");let d,m;if(i.formData)d=fh(i.formData),m=i.formData;else if(i.body instanceof FormData)d=fh(i.body),m=i.body;else if(i.body instanceof URLSearchParams)d=i.body,m=u0(d);else if(i.body==null)d=new URLSearchParams,m=new FormData;else try{d=new URLSearchParams(i.body),m=u0(d)}catch{return l()}let p={formMethod:u,formAction:c,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(It(p.formMethod))return{path:a,submission:p};let b=ma(a);return e&&b.search&&Zh(b.search)&&d.append("index",""),b.search=`?${d}`,{path:ha(b),submission:p}}function a0(e,a,i,l,s,u,c,d,m,p,b,g,x,_,R,T,k,Y,X,ne,se,te){let xe=se?Tn(se[1])?se[1].error:se[1].data:void 0,O=s.createURL(u.location),w=s.createURL(m),L;if(b&&u.errors){let N=Object.keys(u.errors)[0];L=c.findIndex(B=>B.route.id===N)}else if(se&&Tn(se[1])){let N=se[0];L=c.findIndex(B=>B.route.id===N)-1}let H=se?se[1].statusCode:void 0,Q=H&&H>=400,K={currentUrl:O,currentParams:u.matches[0]?.params||{},nextUrl:w,nextParams:c[0].params,...d,actionResult:xe,actionStatus:H},he=Po(c),me=c.map((N,B)=>{let{route:ue}=N,de=null;if(L!=null&&B>L)de=!1;else if(ue.lazy)de=!0;else if(!Hh(ue))de=!1;else if(b){let{shouldLoad:$}=ax(ue,u.loaderData,u.errors);de=$}else A3(u.loaderData,u.matches[B],N)&&(de=!0);if(de!==null)return uh(i,l,e,m,he,N,p,a,de);let ce=!1;typeof te=="boolean"?ce=te:Q?ce=!1:(g||O.pathname+O.search===w.pathname+w.search||O.search!==w.search||C3(u.matches[B],N))&&(ce=!0);let z={...K,defaultShouldRevalidate:ce},C=bo(N,z);return uh(i,l,e,m,he,N,p,a,C,z,te)}),W=[];return R.forEach((N,B)=>{if(b||!c.some(ie=>ie.route.id===N.routeId)||_.has(B))return;let ue=u.fetchers.get(B),de=ue&&ue.state!=="idle"&&ue.data===void 0,ce=ta(k,N.path,Y??"/",!1,ne);if(!ce){if(X&&de)return;W.push({key:B,routeId:N.routeId,path:N.path,matches:null,match:null,request:null,controller:null});return}if(T.has(B))return;let z=Ru(ce,N.path),C=new AbortController,$=tl(s,N.path,C.signal),G=null;if(x.has(B))x.delete(B),G=il(i,l,$,N.path,ce,z,p,a);else if(de)g&&(G=il(i,l,$,N.path,ce,z,p,a));else{let ie;typeof te=="boolean"?ie=te:Q?ie=!1:ie=g;let fe={...K,defaultShouldRevalidate:ie};bo(z,fe)&&(G=il(i,l,$,N.path,ce,z,p,a,fe))}G&&W.push({key:B,routeId:N.routeId,path:N.path,matches:G,match:z,request:$,controller:C})}),{dsMatches:me,revalidatingFetchers:W}}function Hh(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function ax(e,a,i){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Hh(e))return{shouldLoad:!1,renderFallback:!1};let l=a!=null&&e.id in a,s=i!=null&&i[e.id]!==void 0;if(!l&&s)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!l};let u=!l&&!s;return{shouldLoad:u,renderFallback:u}}function A3(e,a,i){let l=!a||i.route.id!==a.route.id,s=!e.hasOwnProperty(i.route.id);return l||s}function C3(e,a){let i=e.route.path;return e.pathname!==a.pathname||i!=null&&i.endsWith("*")&&e.params["*"]!==a.params["*"]}function bo(e,a){if(e.route.shouldRevalid)DELIM" -R"DELIM(ate){let i=e.route.shouldRevalidate(a);if(typeof i=="boolean")return i}return a.defaultShouldRevalidate}function r0(e,a,i,l,s,u){let c;if(e){let p=l[e];Me(p,`No route found to patch children into: routeId = ${e}`),p.children||(p.children=[]),c=p.children}else c=i.activeRoutes;let d=[],m=[];if(a.forEach(p=>{let b=c.find(g=>rx(p,g));b?m.push({existingRoute:b,newRoute:p}):d.push(p)}),d.length>0){let p=jo(d,s,[e||"_","patch",String(c?.length||"0")],l);c.push(...p)}if(u&&m.length>0)for(let p=0;pa.children?.some(s=>rx(i,s)))??!1:!1}var i0=new WeakMap,ix=({key:e,route:a,manifest:i,mapRouteProperties:l})=>{let s=i[a.id];if(Me(s,"No route found in manifest"),!s.lazy||typeof s.lazy!="object")return;let u=s.lazy[e];if(!u)return;let c=i0.get(s);c||(c={},i0.set(s,c));let d=c[e];if(d)return d;let m=(async()=>{let p=FR(e),g=s[e]!==void 0&&e!=="hasErrorBoundary";if(p)_t(!p,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),c[e]=Promise.resolve();else if(g)_t(!1,`Route "${s.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let x=await u();x!=null&&(Object.assign(s,{[e]:x}),Object.assign(s,l(s)))}typeof s.lazy=="object"&&(s.lazy[e]=void 0,Object.values(s.lazy).every(x=>x===void 0)&&(s.lazy=void 0))})();return c[e]=m,m},l0=new WeakMap;function j3(e,a,i,l,s){let u=i[e.id];if(Me(u,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let b=l0.get(u);if(b)return{lazyRoutePromise:b,lazyHandlerPromise:b};let g=(async()=>{Me(typeof e.lazy=="function","No lazy route function found");let x=await e.lazy(),_={};for(let R in x){let T=x[R];if(T===void 0)continue;let k=GR(R),X=u[R]!==void 0&&R!=="hasErrorBoundary";k?_t(!k,"Route property "+R+" is not a supported property to be returned from a lazy route function. This property will be ignored."):X?_t(!X,`Route "${u.id}" has a static property "${R}" defined but its lazy function is also returning a value for this property. The lazy route property "${R}" will be ignored.`):_[R]=T}Object.assign(u,_),Object.assign(u,{...l(u),lazy:void 0})})();return l0.set(u,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let c=Object.keys(e.lazy),d=[],m;for(let b of c){if(s&&s.includes(b))continue;let g=ix({key:b,route:e,manifest:i,mapRouteProperties:l});g&&(d.push(g),b===a&&(m=g))}let p=d.length>0?Promise.all(d).then(()=>{}):void 0;return p?.catch(()=>{}),m?.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:m}}async function o0(e){let a=e.matches.filter(s=>s.shouldLoad),i={};return(await Promise.all(a.map(s=>s.resolve()))).forEach((s,u)=>{i[a[u].route.id]=s}),i}async function N3(e){return e.matches.some(a=>a.route.middleware)?lx(e,()=>o0(e)):o0(e)}function lx(e,a){return O3(e,a,l=>{if(Y3(l))throw l;return l},q3,i);function i(l,s,u){if(u)return Promise.resolve(Object.assign(u.value,{[s]:{type:"error",result:l}}));{let{matches:c}=e,d=Math.min(Math.max(c.findIndex(p=>p.route.id===s),0),Math.max(c.findIndex(p=>p.shouldCallHandler()),0)),m=zr(c,c[d].route.id).route.id;return Promise.resolve({[m]:{type:"error",result:l}})}}}async function O3(e,a,i,l,s){let{matches:u,...c}=e,d=u.flatMap(p=>p.route.middleware?p.route.middleware.map(b=>[p.route.id,b]):[]);return await ox(c,d,a,i,l,s)}async function ox(e,a,i,l,s,u,c=0){let{request:d}=e;if(d.signal.aborted)throw d.signal.reason??new Error(`Request aborted: ${d.method} ${d.url}`);let m=a[c];if(!m)return await i();let[p,b]=m,g,x=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await ox(e,a,i,l,s,u,c+1)},g.value}catch(_){return g={value:await u(_,p,g)},g.value}};try{let _=await b(e,x),R=_!=null?l(_):void 0;return s(R)?R:g?R??g.value:(g={value:await x()},g.value)}catch(_){return await u(_,p,g)}}function sx(e,a,i,l,s){let u=ix({key:"middleware",route:l.route,manifest:a,mapRouteProperties:e}),c=j3(l.route,It(i.method)?"action":"loader",a,e,s);return{middleware:u,route:c.lazyRoutePromise,handler:c.lazyHandlerPromise}}function uh(e,a,i,l,s,u,c,d,m,p=null,b){let g=!1,x=sx(e,a,i,u,c);return{...u,_lazyPromises:x,shouldLoad:m,shouldRevalidateArgs:p,shouldCallHandler(_){return g=!0,p?typeof b=="boolean"?bo(u,{...p,defaultShouldRevalidate:b}):typeof _=="boolean"?bo(u,{...p,defaultShouldRevalidate:_}):bo(u,p):m},resolve(_){let{lazy:R,loader:T,middleware:k}=u.route,Y=g||m||_&&!It(i.method)&&(R||T),X=k&&k.len)DELIM" -R"DELIM(gth>0&&!T&&!R;return Y&&(It(i.method)||!X)?k3({request:i,path:l,pattern:s,match:u,lazyHandlerPromise:x?.handler,lazyRoutePromise:x?.route,handlerOverride:_,scopedContext:d}):Promise.resolve({type:"data",result:void 0})}}}function il(e,a,i,l,s,u,c,d,m=null){return s.map(p=>p.route.id!==u.route.id?{...p,shouldLoad:!1,shouldRevalidateArgs:m,shouldCallHandler:()=>!1,_lazyPromises:sx(e,a,i,p,c),resolve:()=>Promise.resolve({type:"data",result:void 0})}:uh(e,a,i,l,Po(s),p,c,d,!0,m))}async function M3(e,a,i,l,s,u,c){l.some(b=>b._lazyPromises?.middleware)&&await Promise.all(l.map(b=>b._lazyPromises?.middleware));let d={request:a,url:ux(a,i),pattern:Po(l),params:l[0].params,context:u,matches:l},p=await e({...d,fetcherKey:s,runClientMiddleware:b=>{let g=d;return lx(g,()=>b({...g,fetcherKey:s,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(l.flatMap(b=>[b._lazyPromises?.handler,b._lazyPromises?.route]))}catch{}return p}async function k3({request:e,path:a,pattern:i,match:l,lazyHandlerPromise:s,lazyRoutePromise:u,handlerOverride:c,scopedContext:d}){let m,p,b=It(e.method),g=b?"action":"loader",x=_=>{let R,T=new Promise((X,ne)=>R=ne);p=()=>R(),e.signal.addEventListener("abort",p);let k=X=>typeof _!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${g}" [routeId: ${l.route.id}]`)):_({request:e,url:ux(e,a),pattern:i,params:l.params,context:d},...X!==void 0?[X]:[]),Y=(async()=>{try{return{type:"data",result:await(c?c(ne=>k(ne)):k())}}catch(X){return{type:"error",result:X}}})();return Promise.race([Y,T])};try{let _=b?l.route.action:l.route.loader;if(s||u)if(_){let R,[T]=await Promise.all([x(_).catch(k=>{R=k}),s,u]);if(R!==void 0)throw R;m=T}else{await s;let R=b?l.route.action:l.route.loader;if(R)[m]=await Promise.all([x(R),u]);else if(g==="action"){let T=new URL(e.url),k=T.pathname+T.search;throw $n(405,{method:e.method,pathname:k,routeId:l.route.id})}else return{type:"data",result:void 0}}else if(_)m=await x(_);else{let R=new URL(e.url),T=R.pathname+R.search;throw $n(404,{pathname:T})}}catch(_){return{type:"error",result:_}}finally{p&&e.signal.removeEventListener("abort",p)}return m}async function D3(e){let a=e.headers.get("Content-Type");return a&&/\bapplication\/json\b/.test(a)?e.body==null?null:e.json():e.text()}async function L3(e){let{result:a,type:i}=e;if($h(a)){let l;try{l=await D3(a)}catch(s){return{type:"error",error:s}}return i==="error"?{type:"error",error:new qo(a.status,a.statusText,l),statusCode:a.status,headers:a.headers}:{type:"data",data:l,statusCode:a.status,headers:a.headers}}return i==="error"?h0(a)?a.data instanceof Error?{type:"error",error:a.data,statusCode:a.init?.status,headers:a.init?.headers?new Headers(a.init.headers):void 0}:{type:"error",error:Z3(a),statusCode:No(a)?a.status:void 0,headers:a.init?.headers?new Headers(a.init.headers):void 0}:{type:"error",error:a,statusCode:No(a)?a.status:void 0}:h0(a)?{type:"data",data:a.data,statusCode:a.init?.status,headers:a.init?.headers?new Headers(a.init.headers):void 0}:{type:"data",data:a}}function B3(e,a,i,l,s){let u=e.headers.get("Location");if(Me(u,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bh(u)){let c=l.slice(0,l.findIndex(d=>d.route.id===i)+1);u=sh(new URL(a.url),c,s,u),e.headers.set("Location",u)}return e}var U3=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function ch(e){try{return U3.includes(new URL(e).protocol)}catch{return!1}}function s0(e,a,i,l){if(Bh(e)){let s=e,u=Lh.test(s)?new URL(qb(s,a.protocol)):new URL(s);if(ch(u.toString()))throw new Error("Invalid redirect location");let c=qn(u.pathname,i)!=null;if(u.origin===a.origin&&c)return Uh(u.pathname)+u.search+u.hash}try{let s=l.createURL(e);if(ch(s.toString()))throw new Error("Invalid redirect location")}catch{}return e}function tl(e,a,i,l){let s=e.createURL(cx(a)).toString(),u={signal:i};if(l&&It(l.formMethod)){let{formMethod:c,formEncType:d}=l;u.method=c.toUpperCase(),d==="application/json"?(u.headers=new Headers({"Content-Type":d}),u.body=JSON.stringify(l.json)):d==="text/plain"?u.body=l.text:d==="application/x-www-form-urlencoded"&&l.formData?u.body=fh(l.formData):u.body=l.formData}return new Request(s,u)}function ux(e,a){let i=new URL(e.url),l=typeof a=="string"?ma(a):a;if(i.pathname=l.pathname||"/",l.search){let s=new URLSearchParams(l.search),u=s.getAll("index");s.delete("index");for(let c of u.filter(Boolean))s.append("index",c);i.search=s.size?`?${s.toString()}`:""}else i.search="";return i.hash=l.hash||"",i}function fh(e){let a=new URLSearchParams;for(let[i,l]of e.entries())a.append(i,typeof l=="string"?l:l.name);return a}function u0(e){let a=new FormData;for(let[i,l]of e.entries())a.append(i,l);return a}function H3(e,a,i,l=!1,s=!1){let u={},c=null,d,m=!1,p={},b=i&&Tn(i[1])?i[1].error:void 0;return e.forEach(g=>{if(!(g.ro)DELIM" -R"DELIM(ute.id in a))return;let x=g.route.id,_=a[x];if(Me(!ni(_),"Cannot handle redirect results in processLoaderData"),Tn(_)){let R=_.error;if(b!==void 0&&(R=b,b=void 0),c=c||{},s)c[x]=R;else{let T=zr(e,x);c[T.route.id]==null&&(c[T.route.id]=R)}l||(u[x]=nx),m||(m=!0,d=No(_.error)?_.error.status:500),_.headers&&(p[x]=_.headers)}else u[x]=_.data,_.statusCode&&_.statusCode!==200&&!m&&(d=_.statusCode),_.headers&&(p[x]=_.headers)}),b!==void 0&&i&&(c={[i[0]]:b},i[2]&&(u[i[2]]=void 0)),{loaderData:u,errors:c,statusCode:d||200,loaderHeaders:p}}function c0(e,a,i,l,s,u,c){let{loaderData:d,errors:m}=H3(a,i,l);return s.filter(p=>!p.matches||p.matches.some(b=>b.shouldLoad)).forEach(p=>{let{key:b,match:g,controller:x}=p;if(x&&x.signal.aborted)return;let _=u[b];if(Me(_,"Did not find corresponding fetcher result"),Tn(_)){let R=zr(e.matches,g?.route.id);m&&m[R.route.id]||(m={...m,[R.route.id]:_.error}),c.delete(b)}else if(ni(_))Me(!1,"Unhandled fetcher revalidation redirect");else{let R=fa(_.data);c.set(b,R)}}),{loaderData:d,errors:m}}function f0(e,a,i,l){let s=Object.entries(a).filter(([,u])=>u!==nx).reduce((u,[c,d])=>(u[c]=d,u),{});for(let u of i){let c=u.route.id;if(!a.hasOwnProperty(c)&&e.hasOwnProperty(c)&&u.route.loader&&(s[c]=e[c]),l&&l.hasOwnProperty(c))break}return s}function d0(e){return e?Tn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function zr(e,a){return(a?e.slice(0,e.findIndex(l=>l.route.id===a)+1):[...e]).reverse().find(l=>l.route.hasErrorBoundary===!0)||e[0]}function pu(e){let a=e.length===1?e[0]:e.find(i=>i.index||!i.path||i.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:a}],route:a}}function $n(e,{pathname:a,routeId:i,method:l,type:s,message:u}={}){let c="Unknown Server Error",d="Unknown @remix-run/router error";return e===400?(c="Bad Request",l&&a&&i?d=`You made a ${l} request to "${a}" but did not provide a \`loader\` for route "${i}", so there is no way to handle the request.`:s==="invalid-body"&&(d="Unable to encode submission body")):e===403?(c="Forbidden",d=`Route "${i}" does not match URL "${a}"`):e===404?(c="Not Found",d=`No route matches URL "${a}"`):e===405&&(c="Method Not Allowed",l&&a&&i?d=`You made a ${l.toUpperCase()} request to "${a}" but did not provide an \`action\` for route "${i}", so there is no way to handle the request.`:l&&(d=`Invalid request method "${l.toUpperCase()}"`)),new qo(e||500,c,new Error(d),!0)}function yu(e){let a=Object.entries(e);for(let i=a.length-1;i>=0;i--){let[l,s]=a[i];if(ni(s))return{key:l,result:s}}}function cx(e){let a=typeof e=="string"?ma(e):e;return ha({...a,hash:""})}function $3(e,a){return e.pathname!==a.pathname||e.search!==a.search?!1:e.hash===""?a.hash!=="":e.hash===a.hash?!0:a.hash!==""}function Z3(e){return new qo(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function q3(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([a,i])=>typeof a=="string"&&P3(i))}function P3(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function Q3(e){return $h(e.result)&&ex.has(e.result.status)}function Tn(e){return e.type==="error"}function ni(e){return(e&&e.type)==="redirect"}function h0(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function $h(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function F3(e){return ex.has(e)}function Y3(e){return $h(e)&&F3(e.status)&&e.headers.has("Location")}function G3(e){return S3.has(e.toUpperCase())}function It(e){return b3.has(e.toUpperCase())}function Zh(e){return new URLSearchParams(e).getAll("index").some(a=>a==="")}function Ru(e,a){let i=typeof a=="string"?ma(a).search:a.search;if(e[e.length-1].route.index&&Zh(i||""))return e[e.length-1];let l=Vb(e);return l[l.length-1]}function m0(e){let{formMethod:a,formAction:i,formEncType:l,text:s,formData:u,json:c}=e;if(!(!a||!i||!l)){if(s!=null)return{formMethod:a,formAction:i,formEncType:l,formData:void 0,json:void 0,text:s};if(u!=null)return{formMethod:a,formAction:i,formEncType:l,formData:u,json:void 0,text:void 0};if(c!==void 0)return{formMethod:a,formAction:i,formEncType:l,formData:void 0,json:c,text:void 0}}}function kd(e,a,i,l){return l?{state:"loading",location:e,matches:a,historyAction:i,formMethod:l.formMethod,formAction:l.formAction,formEncType:l.formEncType,formData:l.formData,json:l.json,text:l.text}:{state:"loading",location:e,matches:a,historyAction:i,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function K3(e,a,i,l){return{state:"submitting",location:e,matches:a,historyAction:i,formMethod:l.formMethod,formAction:l.formAction,formEncType:l.formEncType,formData:l.formData,json:l.json,text:l.text}}function fo(e,a){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,)DELIM" -R"DELIM(text:e.text,data:a}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:a}}function V3(e,a){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:a?a.data:void 0}}function fa(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function X3(e,a){try{let i=e.sessionStorage.getItem(tx);if(i){let l=JSON.parse(i);for(let[s,u]of Object.entries(l||{}))u&&Array.isArray(u)&&a.set(s,new Set(u||[]))}}catch{}}function I3(e,a){if(a.size>0){let i={};for(let[l,s]of a)i[l]=[...s];try{e.sessionStorage.setItem(tx,JSON.stringify(i))}catch(l){_t(!1,`Failed to save applied view transitions in sessionStorage (${l}).`)}}}function p0(){let e,a,i=new Promise((l,s)=>{e=async u=>{l(u);try{await i}catch{}},a=async u=>{s(u);try{await i}catch{}}});return{promise:i,resolve:e,reject:a}}var si=E.createContext(null);si.displayName="DataRouter";var Qo=E.createContext(null);Qo.displayName="DataRouterState";var fx=E.createContext(!1);function dx(){return E.useContext(fx)}var qh=E.createContext({isTransitioning:!1});qh.displayName="ViewTransition";var hx=E.createContext(new Map);hx.displayName="Fetchers";var J3=E.createContext(null);J3.displayName="Await";var Rn=E.createContext(null);Rn.displayName="Navigation";var ec=E.createContext(null);ec.displayName="Location";var Fn=E.createContext({outlet:null,matches:[],isDataRoute:!1});Fn.displayName="Route";var Ph=E.createContext(null);Ph.displayName="RouteError";var mx="REACT_ROUTER_ERROR",W3="REDIRECT",ez="ROUTE_ERROR_RESPONSE";function tz(e){if(e.startsWith(`${mx}:${W3}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function nz(e){if(e.startsWith(`${mx}:${ez}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new qo(a.status,a.statusText,a.data)}catch{}}function az(e,{relative:a}={}){Me(fl(),"useHref() may be used only in the context of a component.");let{basename:i,navigator:l}=E.useContext(Rn),{hash:s,pathname:u,search:c}=Fo(e,{relative:a}),d=u;return i!=="/"&&(d=u==="/"?i:Zn([i,u])),l.createHref({pathname:d,search:c,hash:s})}function fl(){return E.useContext(ec)!=null}function zn(){return Me(fl(),"useLocation() may be used only in the context of a component."),E.useContext(ec).location}var px="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yx(e){E.useContext(Rn).static||E.useLayoutEffect(e)}function pa(){let{isDataRoute:e}=E.useContext(Fn);return e?gz():rz()}function rz(){Me(fl(),"useNavigate() may be used only in the context of a component.");let e=E.useContext(si),{basename:a,navigator:i}=E.useContext(Rn),{matches:l}=E.useContext(Fn),{pathname:s}=zn(),u=JSON.stringify(Wu(l)),c=E.useRef(!1);return yx(()=>{c.current=!0}),E.useCallback((m,p={})=>{if(_t(c.current,px),!c.current)return;if(typeof m=="number"){i.go(m);return}let b=Zo(m,JSON.parse(u),s,p.relative==="path");e==null&&a!=="/"&&(b.pathname=b.pathname==="/"?a:Zn([a,b.pathname])),(p.replace?i.replace:i.push)(b,p.state,p)},[a,i,u,s,e])}var iz=E.createContext(null);function lz(e){let a=E.useContext(Fn).outlet;return E.useMemo(()=>a&&E.createElement(iz.Provider,{value:e},a),[a,e])}function Qh(){let{matches:e}=E.useContext(Fn);return e[e.length-1]?.params??{}}function Fo(e,{relative:a}={}){let{matches:i}=E.useContext(Fn),{pathname:l}=zn(),s=JSON.stringify(Wu(i));return E.useMemo(()=>Zo(e,JSON.parse(s),l,a==="path"),[e,s,l,a])}function oz(e,a,i){Me(fl(),"useRoutes() may be used only in the context of a component.");let{navigator:l}=E.useContext(Rn),{matches:s}=E.useContext(Fn),u=s[s.length-1],c=u?u.params:{},d=u?u.pathname:"/",m=u?u.pathnameBase:"/",p=u&&u.route;{let k=p&&p.path||"";bx(d,!p||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${d}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. +R"DELIM(to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const c of e.seen.entries()){const d=c[1];if(a===c[0]){u(c);continue}if(e.external){const p=e.external.registry.get(c[0])?.id;if(a!==c[0]&&p){u(c);continue}}if(e.metadataRegistry.get(c[0])?.id){u(c);continue}if(d.cycle){u(c);continue}if(d.count>1&&e.reused==="ref"){u(c);continue}}}function hb(e,a){const i=e.seen.get(a);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=d=>{const m=e.seen.get(d);if(m.ref===null)return;const p=m.def??m.schema,b={...p},g=m.ref;if(m.ref=null,g){l(g);const _=e.seen.get(g),z=_.schema;if(z.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(z)):Object.assign(p,z),Object.assign(p,b),d._zod.parent===g)for(const k in p)k==="$ref"||k==="allOf"||k in b||delete p[k];if(z.$ref&&_.def)for(const k in p)k==="$ref"||k==="allOf"||k in _.def&&JSON.stringify(p[k])===JSON.stringify(_.def[k])&&delete p[k]}const x=d._zod.parent;if(x&&x!==g){l(x);const _=e.seen.get(x);if(_?.schema.$ref&&(p.$ref=_.schema.$ref,_.def))for(const z in p)z==="$ref"||z==="allOf"||z in _.def&&JSON.stringify(p[z])===JSON.stringify(_.def[z])&&delete p[z]}e.override({zodSchema:d,jsonSchema:p,path:m.path??[]})};for(const d of[...e.seen.entries()].reverse())l(d[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const d=e.external.registry.get(a)?.id;if(!d)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(d)}Object.assign(s,i.def??i.schema);const u=e.metadataRegistry.get(a)?.id;u!==void 0&&s.id===u&&delete s.id;const c=e.external?.defs??{};for(const d of e.seen.entries()){const m=d[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,c[m.defId]=m.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?s.$defs=c:s.definitions=c);try{const d=JSON.parse(JSON.stringify(s));return Object.defineProperty(d,"~standard",{value:{...a["~standard"],jsonSchema:{input:Du(a,"input",e.processors),output:Du(a,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function an(e,a){const i=a??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);const l=e._zod.def;if(l.type==="transform")return!0;if(l.type==="array")return an(l.element,i);if(l.type==="set")return an(l.valueType,i);if(l.type==="lazy")return an(l.getter(),i);if(l.type==="promise"||l.type==="optional"||l.type==="nonoptional"||l.type==="nullable"||l.type==="readonly"||l.type==="default"||l.type==="prefault")return an(l.innerType,i);if(l.type==="intersection")return an(l.left,i)||an(l.right,i);if(l.type==="record"||l.type==="map")return an(l.keyType,i)||an(l.valueType,i);if(l.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:an(l.in,i)||an(l.out,i);if(l.type==="object"){for(const s in l.shape)if(an(l.shape[s],i))return!0;return!1}if(l.type==="union"){for(const s of l.options)if(an(s,i))return!0;return!1}if(l.type==="tuple"){for(const s of l.items)if(an(s,i))return!0;return!!(l.rest&&an(l.rest,i))}return!1}const UE=(e,a={})=>i=>{const l=fb({...i,processors:a});return Yt(e,l),db(l,e),hb(l,e)},Du=(e,a,i={})=>l=>{const{libraryOptions:s,target:u}=l??{},c=fb({...s??{},target:u,io:a,processors:i});return Yt(e,c),db(c,e),hb(c,e)},HE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$E=(e,a,i,l)=>{const s=i;s.type="string";const{minimum:u,maximum:c,format:d,patterns:m,contentEncoding:p}=e._zod.bag;if(typeof u=="number"&&(s.minLength=u),typeof c=="number"&&(s.maxLength=c),d&&(s.format=HE[d]??d,s.format===""&&delete s.format,d==="time"&&delete s.format),p&&(s.contentEncoding=p),m&&m.size>0){const b=[...m];b.length===1?s.pattern=b[0].source:b.length>1&&(s.allOf=[...b.map(g=>({...a.target==="draft-07"||a.target==="draft-04"||a.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},ZE=(e,a,i,l)=>{const s=i,{minimum:u,maximum:c,format:d,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:b}=e._zod.bag;typeof d=="string"&&d.includes("int")?s.type="integer":s.type="number";const g=typeof b=="number"&&b>=(u??Number.NEGATIVE_INFINITY),x=typeof p=="number"&&p<=(c??Number.POSITIVE_INFINITY),_=a.target==="draft-04"||a.target==="openapi-3.0";g?_?(s.minimum=b,s.exclusiveMinimum=!0):s.exclusiveMinimum=b:typeof u=="number"&&(s.minimum=u),x?_?(s.maximum=p,s.exclusiveMaximum=!0):s.exclusiveMaximum=p:typeof c=="number"&&(s.maximum=c),typeof m=="number"&&(s.multipleOf=m)},qE=(e,a,i,l)=>{i.type="boolean"},PE=(e,a,i,l)=>{i.not={}},QE=(e,a,i,l)=>{},FE=(e,a,i,l)=>{const s=e._zod.def,u=F0(s.entries);u.every(c=>typeof c=="number")&&(i.type="number"),u.every(c=>typeof c=="string")&&(i.type="string"),i.enum=u},YE=(e,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schem)DELIM" +R"DELIM(a")},GE=(e,a,i,l)=>{if(a.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},KE=(e,a,i,l)=>{const s=i,u=e._zod.def,{minimum:c,maximum:d}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof d=="number"&&(s.maxItems=d),s.type="array",s.items=Yt(u.element,a,{...l,path:[...l.path,"items"]})},VE=(e,a,i,l)=>{const s=i,u=e._zod.def;s.type="object",s.properties={};const c=u.shape;for(const p in c)s.properties[p]=Yt(c[p],a,{...l,path:[...l.path,"properties",p]});const d=new Set(Object.keys(c)),m=new Set([...d].filter(p=>{const b=u.shape[p]._zod;return a.io==="input"?b.optin===void 0:b.optout===void 0}));m.size>0&&(s.required=Array.from(m)),u.catchall?._zod.def.type==="never"?s.additionalProperties=!1:u.catchall?u.catchall&&(s.additionalProperties=Yt(u.catchall,a,{...l,path:[...l.path,"additionalProperties"]})):a.io==="output"&&(s.additionalProperties=!1)},XE=(e,a,i,l)=>{const s=e._zod.def,u=s.inclusive===!1,c=s.options.map((d,m)=>Yt(d,a,{...l,path:[...l.path,u?"oneOf":"anyOf",m]}));u?i.oneOf=c:i.anyOf=c},IE=(e,a,i,l)=>{const s=e._zod.def,u=Yt(s.left,a,{...l,path:[...l.path,"allOf",0]}),c=Yt(s.right,a,{...l,path:[...l.path,"allOf",1]}),d=p=>"allOf"in p&&Object.keys(p).length===1,m=[...d(u)?u.allOf:[u],...d(c)?c.allOf:[c]];i.allOf=m},JE=(e,a,i,l)=>{const s=e._zod.def,u=Yt(s.innerType,a,l),c=a.seen.get(e);a.target==="openapi-3.0"?(c.ref=s.innerType,i.nullable=!0):i.anyOf=[u,{type:"null"}]},WE=(e,a,i,l)=>{const s=e._zod.def;Yt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType},eT=(e,a,i,l)=>{const s=e._zod.def;Yt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType,i.default=JSON.parse(JSON.stringify(s.defaultValue))},tT=(e,a,i,l)=>{const s=e._zod.def;Yt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType,a.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},nT=(e,a,i,l)=>{const s=e._zod.def;Yt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=c},aT=(e,a,i,l)=>{const s=e._zod.def,u=s.in._zod.traits.has("$ZodTransform"),c=a.io==="input"?u?s.out:s.in:s.out;Yt(c,a,l);const d=a.seen.get(e);d.ref=c},rT=(e,a,i,l)=>{const s=e._zod.def;Yt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType,i.readOnly=!0},mb=(e,a,i,l)=>{const s=e._zod.def;Yt(s.innerType,a,l);const u=a.seen.get(e);u.ref=s.innerType},iT=re("ZodISODateTime",(e,a)=>{c2.init(e,a),bt.init(e,a)});function lT(e){return mE(iT,e)}const oT=re("ZodISODate",(e,a)=>{f2.init(e,a),bt.init(e,a)});function sT(e){return pE(oT,e)}const uT=re("ZodISOTime",(e,a)=>{d2.init(e,a),bt.init(e,a)});function cT(e){return yE(uT,e)}const fT=re("ZodISODuration",(e,a)=>{h2.init(e,a),bt.init(e,a)});function dT(e){return gE(fT,e)}const hT=(e,a)=>{X0.init(e,a),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>t_(e,i)},flatten:{value:i=>e_(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,Jd,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,Jd,2)}},isEmpty:{get(){return e.issues.length===0}}})},Pn=re("ZodError",hT,{Parent:Error}),mT=Eh(Pn),pT=Th(Pn),yT=Ku(Pn),gT=Vu(Pn),vT=r_(Pn),bT=i_(Pn),xT=l_(Pn),ST=o_(Pn),wT=s_(Pn),_T=u_(Pn),ET=c_(Pn),TT=f_(Pn),Ev=new WeakMap;function Lo(e,a,i){const l=Object.getPrototypeOf(e);let s=Ev.get(l);if(s||(s=new Set,Ev.set(l,s)),!s.has(a)){s.add(a);for(const u in i){const c=i[u];Object.defineProperty(l,u,{configurable:!0,enumerable:!1,get(){const d=c.bind(this);return Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:d}),d},set(d){Object.defineProperty(this,u,{configurable:!0,writable:!0,enumerable:!0,value:d})}})}}}const jt=re("ZodType",(e,a)=>(Ct.init(e,a),Object.assign(e["~standard"],{jsonSchema:{input:Du(e,"input"),output:Du(e,"output")}}),e.toJSONSchema=UE(e,{}),e.def=a,e.type=a.type,Object.defineProperty(e,"_def",{value:a}),e.parse=(i,l)=>mT(e,i,l,{callee:e.parse}),e.safeParse=(i,l)=>yT(e,i,l),e.parseAsync=async(i,l)=>pT(e,i,l,{callee:e.parseAsync}),e.safeParseAsync=async(i,l)=>gT(e,i,l),e.spa=e.safeParseAsync,e.encode=(i,l)=>vT(e,i,l),e.decode=(i,l)=>bT(e,i,l),e.encodeAsync=async(i,l)=>xT(e,i,l),e.decodeAsync=async(i,l)=>ST(e,i,l),e.safeEncode=(i,l)=>wT(e,i,l),e.safeDecode=(i,l)=>_T(e,i,l),e.safeEncodeAsync=async(i,l)=>ET(e,i,l),e.safeDecodeAsync=async(i,l)=>TT(e,i,l),Lo(e,"ZodType",{check(...i){const l=this.def;return this.clone(Nr(l,{checks:[...l.checks??[],...i.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...i){return this.check(...i)},clone(i,l){return Or(this,i,l)},brand(){return this},register(i,l){return i.add(this,l),this},refine(i,l){return this.check(v4(i,l))},superRefine(i,l){return this.check(b4(i,l))},overwrite(i){return this.check(cl(i))},optional(){return Av(this)},exactOptional(){return i4(this)},nullable(){return Cv(this)},nullish(){return Av(Cv(this))},nonoptional(i){return f4(this,i))DELIM" +R"DELIM(},array(){return sl(this)},or(i){return JT([this,i])},and(i){return e4(this,i)},transform(i){return jv(this,a4(i))},default(i){return s4(this,i)},prefault(i){return c4(this,i)},catch(i){return h4(this,i)},pipe(i){return jv(this,i)},readonly(){return y4(this)},describe(i){const l=this.clone();return po.add(l,{description:i}),l},meta(...i){if(i.length===0)return po.get(this);const l=this.clone();return po.add(l,i[0]),l},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(i){return i(this)}}),Object.defineProperty(e,"description",{get(){return po.get(e)?.description},configurable:!0}),e)),pb=re("_ZodString",(e,a)=>{Rh.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(l,s,u)=>$E(e,l,s);const i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,Lo(e,"_ZodString",{regex(...l){return this.check(_E(...l))},includes(...l){return this.check(RE(...l))},startsWith(...l){return this.check(zE(...l))},endsWith(...l){return this.check(AE(...l))},min(...l){return this.check(ku(...l))},max(...l){return this.check(ub(...l))},length(...l){return this.check(cb(...l))},nonempty(...l){return this.check(ku(1,...l))},lowercase(l){return this.check(EE(l))},uppercase(l){return this.check(TE(l))},trim(){return this.check(jE())},normalize(...l){return this.check(CE(...l))},toLowerCase(){return this.check(NE())},toUpperCase(){return this.check(OE())},slugify(){return this.check(ME())}})}),RT=re("ZodString",(e,a)=>{Rh.init(e,a),pb.init(e,a),e.email=i=>e.check(G2(zT,i)),e.url=i=>e.check(J2(AT,i)),e.jwt=i=>e.check(hE(PT,i)),e.emoji=i=>e.check(W2(CT,i)),e.guid=i=>e.check(xv(Tv,i)),e.uuid=i=>e.check(K2(cu,i)),e.uuidv4=i=>e.check(V2(cu,i)),e.uuidv6=i=>e.check(X2(cu,i)),e.uuidv7=i=>e.check(I2(cu,i)),e.nanoid=i=>e.check(eE(jT,i)),e.guid=i=>e.check(xv(Tv,i)),e.cuid=i=>e.check(tE(NT,i)),e.cuid2=i=>e.check(nE(OT,i)),e.ulid=i=>e.check(aE(MT,i)),e.base64=i=>e.check(cE($T,i)),e.base64url=i=>e.check(fE(ZT,i)),e.xid=i=>e.check(rE(kT,i)),e.ksuid=i=>e.check(iE(DT,i)),e.ipv4=i=>e.check(lE(LT,i)),e.ipv6=i=>e.check(oE(BT,i)),e.cidrv4=i=>e.check(sE(UT,i)),e.cidrv6=i=>e.check(uE(HT,i)),e.e164=i=>e.check(dE(qT,i)),e.datetime=i=>e.check(lT(i)),e.date=i=>e.check(sT(i)),e.time=i=>e.check(cT(i)),e.duration=i=>e.check(dT(i))});function Lt(e){return Y2(RT,e)}const bt=re("ZodStringFormat",(e,a)=>{gt.init(e,a),pb.init(e,a)}),zT=re("ZodEmail",(e,a)=>{t2.init(e,a),bt.init(e,a)}),Tv=re("ZodGUID",(e,a)=>{W_.init(e,a),bt.init(e,a)}),cu=re("ZodUUID",(e,a)=>{e2.init(e,a),bt.init(e,a)}),AT=re("ZodURL",(e,a)=>{n2.init(e,a),bt.init(e,a)}),CT=re("ZodEmoji",(e,a)=>{a2.init(e,a),bt.init(e,a)}),jT=re("ZodNanoID",(e,a)=>{r2.init(e,a),bt.init(e,a)}),NT=re("ZodCUID",(e,a)=>{i2.init(e,a),bt.init(e,a)}),OT=re("ZodCUID2",(e,a)=>{l2.init(e,a),bt.init(e,a)}),MT=re("ZodULID",(e,a)=>{o2.init(e,a),bt.init(e,a)}),kT=re("ZodXID",(e,a)=>{s2.init(e,a),bt.init(e,a)}),DT=re("ZodKSUID",(e,a)=>{u2.init(e,a),bt.init(e,a)}),LT=re("ZodIPv4",(e,a)=>{m2.init(e,a),bt.init(e,a)}),BT=re("ZodIPv6",(e,a)=>{p2.init(e,a),bt.init(e,a)}),UT=re("ZodCIDRv4",(e,a)=>{y2.init(e,a),bt.init(e,a)}),HT=re("ZodCIDRv6",(e,a)=>{g2.init(e,a),bt.init(e,a)}),$T=re("ZodBase64",(e,a)=>{v2.init(e,a),bt.init(e,a)}),ZT=re("ZodBase64URL",(e,a)=>{x2.init(e,a),bt.init(e,a)}),qT=re("ZodE164",(e,a)=>{S2.init(e,a),bt.init(e,a)}),PT=re("ZodJWT",(e,a)=>{_2.init(e,a),bt.init(e,a)}),yb=re("ZodNumber",(e,a)=>{ib.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(l,s,u)=>ZE(e,l,s),Lo(e,"ZodNumber",{gt(l,s){return this.check(wv(l,s))},gte(l,s){return this.check(Sd(l,s))},min(l,s){return this.check(Sd(l,s))},lt(l,s){return this.check(Sv(l,s))},lte(l,s){return this.check(xd(l,s))},max(l,s){return this.check(xd(l,s))},int(l){return this.check(Rv(l))},safe(l){return this.check(Rv(l))},positive(l){return this.check(wv(0,l))},nonnegative(l){return this.check(Sd(0,l))},negative(l){return this.check(Sv(0,l))},nonpositive(l){return this.check(xd(0,l))},multipleOf(l,s){return this.check(_v(l,s))},step(l,s){return this.check(_v(l,s))},finite(){return this}});const i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function Ge(e){return vE(yb,e)}const QT=re("ZodNumberFormat",(e,a)=>{E2.init(e,a),yb.init(e,a)});function Rv(e){return bE(QT,e)}const FT=re("ZodBoolean",(e,a)=>{T2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>qE(e,i,l)});function zh(e){return xE(FT,e)}const YT=re("ZodUnknown",(e,a)=>{R2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>QE()});function zv(){return SE(YT)}const GT=re("ZodNever",(e,a)=>{z2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>PE(e,i,l)});function KT(e){return wE(GT,e)}const VT=re("ZodArray",(e,a)=>{A2.init(e,a),j)DELIM" +R"DELIM(t.init(e,a),e._zod.processJSONSchema=(i,l,s)=>KE(e,i,l,s),e.element=a.element,Lo(e,"ZodArray",{min(i,l){return this.check(ku(i,l))},nonempty(i){return this.check(ku(1,i))},max(i,l){return this.check(ub(i,l))},length(i,l){return this.check(cb(i,l))},unwrap(){return this.element}})});function sl(e,a){return kE(VT,e,a)}const XT=re("ZodObject",(e,a)=>{j2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>VE(e,i,l,s),st(e,"shape",()=>a.shape),Lo(e,"ZodObject",{keyof(){return t4(Object.keys(this._zod.def.shape))},catchall(i){return this.clone({...this._zod.def,catchall:i})},passthrough(){return this.clone({...this._zod.def,catchall:zv()})},loose(){return this.clone({...this._zod.def,catchall:zv()})},strict(){return this.clone({...this._zod.def,catchall:KT()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(i){return Kw(this,i)},safeExtend(i){return Vw(this,i)},merge(i){return Xw(this,i)},pick(i){return Yw(this,i)},omit(i){return Gw(this,i)},partial(...i){return Iw(gb,this,i[0])},required(...i){return Jw(vb,this,i[0])}})});function da(e,a){const i={type:"object",shape:e??{},...ze(a)};return new XT(i)}const IT=re("ZodUnion",(e,a)=>{N2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>XE(e,i,l,s),e.options=a.options});function JT(e,a){return new IT({type:"union",options:e,...ze(a)})}const WT=re("ZodIntersection",(e,a)=>{O2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>IE(e,i,l,s)});function e4(e,a){return new WT({type:"intersection",left:e,right:a})}const eh=re("ZodEnum",(e,a)=>{M2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(l,s,u)=>FE(e,l,s),e.enum=a.entries,e.options=Object.values(a.entries);const i=new Set(Object.keys(a.entries));e.extract=(l,s)=>{const u={};for(const c of l)if(i.has(c))u[c]=a.entries[c];else throw new Error(`Key ${c} not found in enum`);return new eh({...a,checks:[],...ze(s),entries:u})},e.exclude=(l,s)=>{const u={...a.entries};for(const c of l)if(i.has(c))delete u[c];else throw new Error(`Key ${c} not found in enum`);return new eh({...a,checks:[],...ze(s),entries:u})}});function t4(e,a){const i=Array.isArray(e)?Object.fromEntries(e.map(l=>[l,l])):e;return new eh({type:"enum",entries:i,...ze(a)})}const n4=re("ZodTransform",(e,a)=>{k2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>GE(e,i),e._zod.parse=(i,l)=>{if(l.direction==="backward")throw new Q0(e.constructor.name);i.addIssue=u=>{if(typeof u=="string")i.issues.push(Ro(u,i.value,a));else{const c=u;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=i.value),c.inst??(c.inst=e),i.issues.push(Ro(c))}};const s=a.transform(i.value,i);return s instanceof Promise?s.then(u=>(i.value=u,i.fallback=!0,i)):(i.value=s,i.fallback=!0,i)}});function a4(e){return new n4({type:"transform",transform:e})}const gb=re("ZodOptional",(e,a)=>{sb.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>mb(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function Av(e){return new gb({type:"optional",innerType:e})}const r4=re("ZodExactOptional",(e,a)=>{D2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>mb(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function i4(e){return new r4({type:"optional",innerType:e})}const l4=re("ZodNullable",(e,a)=>{L2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>JE(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function Cv(e){return new l4({type:"nullable",innerType:e})}const o4=re("ZodDefault",(e,a)=>{B2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>eT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function s4(e,a){return new o4({type:"default",innerType:e,get defaultValue(){return typeof a=="function"?a():G0(a)}})}const u4=re("ZodPrefault",(e,a)=>{U2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>tT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function c4(e,a){return new u4({type:"prefault",innerType:e,get defaultValue(){return typeof a=="function"?a():G0(a)}})}const vb=re("ZodNonOptional",(e,a)=>{H2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>WE(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function f4(e,a){return new vb({type:"nonoptional",innerType:e,...ze(a)})}const d4=re("ZodCatch",(e,a)=>{$2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>nT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function h4(e,a){return new d4({type:"catch",innerType:e,catchValue:typeof a=="function"?a:()=>a})}const m4=re("ZodPipe",(e,a)=>{Z2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>aT(e,i,l,s),e.in=a.in,e.out=a.out});function jv(e,a){return new m4({type:"pipe",in:e,out:a})}const p4=re("ZodReadonly",(e,a)=>{q2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>rT(e,i,l,s),e.unwrap=()=>e._zod.def.innerType});function y4(e){return new p4({type:"readonly",innerType:e})}const g4=re("ZodCustom",(e,a)=>{P2.init(e,a),jt.init(e,a),e._zod.processJSONSchema=(i,l,s)=>YE(e,i)});function v4(e,a={}){return DE(g4,e,a)}function b4(e,a){return LE(e,a)}function li(e){if(!e)return;c)DELIM" +R"DELIM(onst a=e.trim();if(!a)return;const i=a.toLowerCase(),l=i.indexOf("1");if(l>0){const c=i.slice(0,l);if(["bc","tb","bcrt","ltc","sb"].includes(c)){const d=i.slice(l+1);if(!d)return;const m=d.charAt(0);return m==="p"?"p2tr":m==="q"?d.length===39||d.length===40||e.length===42?"p2wpkh":d.length===59||d.length===60||e.length===62?"p2wsh":"segwit":"segwit"}}const s=/^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$/u.test(a)&&a.length>=26&&a.length<=35;switch(i[0]){case"1":case"m":case"n":return s?"p2pkh":void 0;case"3":case"2":return s?"p2sh":void 0;default:return}}class Ah extends Error{constructor(a,i){super(a),this.status=i}status}const th=da({id:Lt(),height:Ge(),timestamp:Ge().optional(),mediantime:Ge().optional(),tx_count:Ge().optional(),size:Ge().optional(),weight:Ge().optional(),difficulty:Ge().optional(),bits:Ge().optional(),merkle_root:Lt().optional(),previousblockhash:Lt().nullable().optional(),nonce:Ge().optional(),version:Ge().optional()}).loose(),x4=da({confirmed:zh(),block_height:Ge().optional(),block_hash:Lt().optional(),block_time:Ge().optional()}),S4=da({txid:Lt().optional().nullable(),vout:Ge().optional().nullable(),sequence:Ge().optional(),scriptsig:Lt().optional().nullable(),scriptsig_asm:Lt().optional().nullable(),witness:sl(Lt()).optional(),is_coinbase:zh().optional(),prevout:da({scriptpubkey_type:Lt().optional(),scriptpubkey_address:Lt().optional(),scriptpubkey:Lt().optional(),scriptpubkey_asm:Lt().optional(),value:Ge().optional()}).partial().nullable().optional()}).loose(),w4=da({scriptpubkey_type:Lt().optional(),scriptpubkey_address:Lt().optional(),scriptpubkey:Lt().optional(),scriptpubkey_asm:Lt().optional(),value:Ge(),n:Ge().optional()}).loose(),Su=da({txid:Lt(),hash:Lt().optional(),fee:Ge().optional(),version:Ge(),locktime:Ge(),vin:sl(S4),vout:sl(w4),size:Ge(),weight:Ge(),status:x4}).loose(),Ch=sl(th),Lu=sl(Su),Nv=da({in_best_chain:zh(),next_best:Lt().optional(),height:Ge().optional()}),Ov=da({address:Lt(),chain_stats:da({funded_txo_count:Ge().optional(),funded_txo_sum:Ge().optional(),spent_txo_count:Ge().optional(),spent_txo_sum:Ge().optional(),tx_count:Ge().optional()}),mempool_stats:da({funded_txo_count:Ge().optional(),funded_txo_sum:Ge().optional(),spent_txo_count:Ge().optional(),spent_txo_sum:Ge().optional(),tx_count:Ge().optional()})});async function Xt(e,a,i){const l=a.startsWith("/")?a:`/${a}`,s=await fetch(`${e}${l}`);if(!s.ok)throw new Ah(`Request to ${a} failed with status ${String(s.status)}`,s.status);const u=await s.json();return i.parse(u)}async function Mv(e,a,i){if(i<=0)return[];const l=[];let s=a;for(;s&&l.lengthu.scriptpubkey_address===e?s+u.value:s,0),l=a.vin.reduce((s,u)=>{const c=u.prevout;return c?.scriptpubkey_address===e&&typeof c.value=="number"?s+c.value:s},0);return i-l}async function wd(e,a){if(a==="latest"||a==="tip"){const i=await Xt(e,"/blocks",Ch);if(i.length===0)throw new Error("No blocks returned from API");return i[0].id}if(/^\d+$/.test(a)){const i=await fetch(`${e}/block-height/${a}`);if(!i.ok)throw new Ah("Unable to resolve block height",i.status);return(await i.text()).trim()}return a}async function Dv(e,a,i){if(i.lastKnownHeight==null||a>=i.lastKnownHeight)return null;const l=a+1;try{const s=await fetch(`${e}/block-height/${String(l)}`);return s.ok&&(await s.text()).trim()||null}catch(s){return console.warn(`Failed to resolve hash for height ${String(l)}`,s),null}}function lo(e){return{hash:e.id,height:e.height,timestamp:e.timestamp??e.mediantime??0,txCount:e.tx_count??0,size:e.size??0,weight:e.weight??0,difficulty:e.difficulty,previousBlockHash:e.previousblockhash??null}}function _d(e,a){const i=e.status.confirmed?"confirmed":"unconfirmed",l=e.vin.map((m,p)=>{const b=m.is_coinbase||m.txid==null?void 0:typeof m.vout=="number"&&m.vout!==4294967295?m.vout:void 0;return{index:p,prevTxId:m.txid??void 0,prevOutputIndex:b,address:m.prevout?.scriptpubkey_address??void 0,valueSats:m.prevout?.value,scriptType:m.prevout?.scriptpubkey_type,isCoinbase:m.is_coinbase??!1,script:m.scriptsig||m.scriptsig_asm?{hex:m.scriptsig??void 0,mnemonic:m.scriptsig_asm??void 0}:void 0,witness:m.witness??void 0,sequence:m.sequence}}),s=e.vout.map((m,p)=>({index:p,address:m.scriptpubkey_address??void 0,valueSats:m.value,scriptType:m.scriptpubkey_type,spent:void 0,script:m.scriptpubkey||m.scriptpubkey_asm?{hex:m.scriptpubkey??void 0,mnemonic:m.scriptpubkey_asm??v)DELIM" +R"DELIM(oid 0}:void 0})),u=s.reduce((m,p)=>m+p.valueSats,0),c=a.lastKnownHeight;let d=0;return e.status.block_height&&i==="confirmed"&&(d=c&&c>=e.status.block_height?c-e.status.block_height+1:1),{txid:e.txid,hash:e.hash??e.txid,status:i,confirmations:d,blockHeight:e.status.block_height,blockHash:e.status.block_hash,receivedTime:e.status.block_time,feeSats:e.fee??null,feeRate:e.fee?e.fee/e.weight*4:null,size:e.size,weight:e.weight,version:e.version,locktime:e.locktime,totalInput:null,totalOutput:u,inputs:l,outputs:s}}function E4(e,a){const i=e.chain_stats,l=e.mempool_stats,s=(i.funded_txo_sum??0)-(i.spent_txo_sum??0),u=bb(e.address,a.slice(0,25));return{address:e.address,addressType:li(e.address),balance:s,totalReceived:(i.funded_txo_sum??0)+(l.funded_txo_sum??0),totalSent:(i.spent_txo_sum??0)+(l.spent_txo_sum??0),txCount:(i.tx_count??0)+(l.tx_count??0),utxoCount:(i.funded_txo_count??0)-(i.spent_txo_count??0),transactions:u}}function T4(e){const a=e.chain_stats,i=e.mempool_stats,l=(a.funded_txo_sum??0)-(a.spent_txo_sum??0);return{address:e.address,addressType:li(e.address),balance:l,totalReceived:(a.funded_txo_sum??0)+(i.funded_txo_sum??0),totalSent:(a.spent_txo_sum??0)+(i.spent_txo_sum??0),txCount:(a.tx_count??0)+(i.tx_count??0),utxoCount:(a.funded_txo_count??0)-(a.spent_txo_count??0)}}function bb(e,a){return a.map(i=>({txid:i.txid,timestamp:i.status.block_time,valueChange:_4(e,i),blockHeight:i.status.block_height}))}async function Lv(e,a,i=0){const l=i>0?`/block/${a}/txs/${String(i)}`:`/block/${a}/txs`;return Xt(e,l,Lu)}async function R4(e,a,i){return i?Xt(e,`/address/${a}/txs/chain/${i}`,Lu):Xt(e,`/address/${a}/txs`,Lu)}function xb({baseUrl:e}){const a=new Set;let i=null;const l={lastBlockHash:null,lastKnownHeight:null};async function s(d){const m=await Xt(e,`/tx/${d}`,Su);return await(m.status.block_height?Ki(e,l,m.status.block_height):Ki(e,l)),_d(m,l)}function u(){i||a.size===0||(i=setInterval(async()=>{try{const d=await Xt(e,"/blocks",Ch);if(d.length===0)return;const m=d[0];if(m.id!==l.lastBlockHash){l.lastBlockHash=m.id,l.lastKnownHeight=Math.max(m.height,l.lastKnownHeight??0);const p=lo(m);for(const b of a)b({type:"block.new",payload:p})}}catch(d){console.warn("Block polling failed",d)}},15e3))}function c(){i&&(clearInterval(i),i=null)}return{metadata:{id:"blockstream",label:"Blockstream.info",type:"external",connectionState:"connected",supportsWebsocket:!1,endpoint:e,description:"Read-only adapter using Blockstream public REST API."},getConfiguration(){return Promise.resolve({address:!0,filter:!1,turbo:!1,witness:!0,retarget:!1,difficult:!1})},async getLatestBlocks(d=10){const m=await Mv(e,"/blocks",d);return m.length>0&&(l.lastBlockHash=m[0].id,l.lastKnownHeight=Math.max(m[0].height,l.lastKnownHeight??0)),m.map(p=>lo(p))},async getBlocksBefore(d,m=10){const p=Math.max(d,0),b=await Mv(e,`/blocks/${String(p)}`,m);return b.length>0&&(l.lastKnownHeight=Math.max(b[0].height,l.lastKnownHeight??0)),b.map(g=>lo(g))},async getBlockHeader(d){const m=await wd(e,d);await Ki(e,l);const[p,b]=await Promise.all([Xt(e,`/block/${m}`,th),Xt(e,`/block/${m}/status`,Nv).catch(()=>null)]),g=lo(p);l.lastBlockHash=g.hash,l.lastKnownHeight=Math.max(g.height,l.lastKnownHeight??g.height);let x=b?.next_best??null;return x||(x=await Dv(e,g.height,l)),{...g,merkleRoot:p.merkle_root,nonce:p.nonce,bits:p.bits,version:p.version,nextBlockHash:x}},getBlockStats(d){return Promise.resolve({})},async getBlock(d){const m=await wd(e,d);await Ki(e,l);const p=await Xt(e,`/block/${m}`,th),[b,g]=await Promise.allSettled([Lv(e,m),Xt(e,`/block/${m}/status`,Nv)]);b.status==="rejected"&&console.warn("Failed to load block transactions, defaulting to empty set",b.reason),g.status==="rejected"&&console.warn("Failed to load block status, defaulting to unknown",g.reason);const x=lo(p);l.lastBlockHash=x.hash,l.lastKnownHeight=Math.max(x.height,l.lastKnownHeight??x.height);const _=b.status==="fulfilled"?b.value:[];let T=(g.status==="fulfilled"?g.value:null)?.next_best??null;return T||(T=await Dv(e,x.height,l)),{...x,merkleRoot:p.merkle_root,nonce:p.nonce,bits:p.bits,version:p.version,nextBlockHash:T,transactions:_.map(Z=>_d(Z,l))}},async getBlockTransactions(d,m=0){const p=await wd(e,d),b=await Lv(e,p,m),g=b.reduce((x,_)=>_.status.block_height?x===null?_.status.block_height:Math.max(x,_.status.block_height):x,null);return await(typeof g=="number"?Ki(e,l,g):Ki(e,l)),b.map(x=>_d(x,l))},async getTransactionHeader(d){return s(d)},async getTransaction(d){return s(d)},async getTransactionInputScriptHex(d,m){const p=await Xt(e,`/tx/${d}`,Su);if(m<0||m>=p.vin.length)throw new RangeError(`Input index ${String(m)} not found`);const g=p.vin[m].scriptsig;return typeof g=="string"?g:""},async getTransactionOutputScriptHex(d,m){const p=await Xt(e,`/tx/${d}`,Su);if(m<0||m>=p.vout.length)throw new RangeError(`Output index ${String(m)} not found`);const g=p.vout[m].scriptpubkey;if(typeof g!="string")throw new TypeError("Output script missing in provider response");return g},asy)DELIM" +R"DELIM(nc getAddressSummary(d){const m=await Xt(e,`/address/${d}`,Ov);return T4(m)},async getAddress(d){const m=await Xt(e,`/address/${d}`,Ov),p=await Xt(e,`/address/${d}/txs`,Lu);return E4(m,p)},async getAddressTransactions(d,m){const p=await R4(e,d,m);return bb(d,p)},subscribeToEvents(d){return a.add(d),u(),()=>{a.delete(d),a.size===0&&c()}}}}function z4({baseUrl:e}){const a=xb({baseUrl:e});return{...a,metadata:{...a.metadata,id:"mempool",label:"mempool.space",endpoint:e,description:"Adapter backed by mempool.space REST API."}}}function zo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Sb(e,a){return Array.isArray(a)?a.length===0?!0:e?a.every(i=>typeof i=="string"):a.every(i=>Number.isSafeInteger(i)):!1}function jh(e){if(typeof e!="function")throw new TypeError("function expected");return!0}function Ao(e,a){if(typeof a!="string")throw new TypeError(`${e}: string expected`);return!0}function Bo(e){if(typeof e!="number")throw new TypeError(`number expected, got ${typeof e}`);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function Bu(e){if(!Array.isArray(e))throw new TypeError("array expected")}function wb(e,a){if(!Sb(!0,a))throw new TypeError(`${e}: array of strings expected`)}function Nh(e,a){if(!Sb(!1,a))throw new TypeError(`${e}: array of numbers expected`)}function Oh(...e){const a=u=>u,i=(u,c)=>d=>u(c(d)),l=e.map(u=>u.encode).reduceRight(i,a),s=e.map(u=>u.decode).reduce(i,a);return{encode:l,decode:s}}function _b(e){const a=typeof e=="string"?e.split(""):e,i=a.length;wb("alphabet",a);const l=new Map(a.map((s,u)=>[s,u]));return{encode:s=>(Bu(s),s.map(u=>{if(!Number.isSafeInteger(u)||u<0||u>=i)throw new Error(`alphabet.encode: digit index outside alphabet "${u}". Allowed: ${e}`);return a[u]})),decode:s=>(Bu(s),s.map(u=>{Ao("alphabet.decode",u);const c=l.get(u);if(c===void 0)throw new Error(`Unknown letter: "${u}". Allowed: ${e}`);return c}))}}function Eb(e=""){return Ao("join",e),{encode:a=>(wb("join.decode",a),a.join(e)),decode:a=>(Ao("join.decode",a),a.split(e))}}function Bv(e,a,i){if(a<2)throw new RangeError(`convertRadix: invalid from=${a}, base cannot be less than 2`);if(i<2)throw new RangeError(`convertRadix: invalid to=${i}, base cannot be less than 2`);if(Bu(e),!e.length)return[];let l=0;const s=[],u=Array.from(e,d=>{if(Bo(d),d<0||d>=a)throw new Error(`invalid integer: ${d}`);return d}),c=u.length;for(;;){let d=0,m=!0;for(let p=l;pa===0?e:Tb(a,e%a),Uu=(e,a)=>e+(a-Tb(e,a)),wu=(()=>{let e=[];for(let a=0;a<40;a++)e.push(2**a);return e})();function nh(e,a,i,l){if(Bu(e),a<=0||a>32)throw new RangeError(`convertRadix2: wrong from=${a}`);if(i<=0||i>32)throw new RangeError(`convertRadix2: wrong to=${i}`);if(Uu(a,i)>32)throw new Error(`convertRadix2: carry overflow from=${a} to=${i} carryBits=${Uu(a,i)}`);let s=0,u=0;const c=wu[a],d=wu[i]-1,m=[];for(const p of e){if(Bo(p),p>=c)throw new Error(`convertRadix2: invalid data word=${p} from=${a}`);if(s=s<32)throw new Error(`convertRadix2: carry overflow pos=${u} from=${a}`);for(u+=a;u>=i;u-=i)m.push((s>>u-i&d)>>>0);const b=wu[u];if(b===void 0)throw new Error("invalid carry");s&=b-1}if(s=s<=a)throw new Error("Excess padding");if(!l&&s>0)throw new Error(`Non-zero padding: ${s}`);return l&&u>0&&m.push(s>>>0),m}function A4(e){Bo(e);const a=2**8;return{encode:i=>{if(!zo(i))throw new TypeError("radix.encode input should be Uint8Array");return Bv(Array.from(i),a,e)},decode:i=>(Nh("radix.decode",i),Uint8Array.from(Bv(i,e,a)))}}function C4(e,a=!1){if(Bo(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(Uu(8,e)>32||Uu(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:i=>{if(!zo(i))throw new TypeError("radix2.encode input should be Uint8Array");return nh(Array.from(i),8,e,!a)},decode:i=>(Nh("radix2.decode",i),Uint8Array.from(nh(i,e,8,a)))}}function Uv(e){return jh(e),function(...a){try{return e.apply(null,a)}catch{}}}function j4(e,a){if(Bo(e),e<=0)throw new RangeError(`checksum length must be positive: ${e}`);jh(a);const i=a;return{encode(l){if(!zo(l))throw new TypeError("checksum.encode: input should be Uint8Array");const s=i(l).slice(0,e),u=new Uint8Array(l.length+e);return u.set(l),u.set(s,l.length),u},decode(l){if(!zo(l))throw new TypeError("checksum.decode: input should be Uint8Array");const s=l.slice(0,-e),u=l.slice(-e),c=i(s).slice(0,e);for(let d=0;dOh(A4(58),_b(e),Eb("")),O4=Object.freeze(N4("123456789ABCDEFGHJ)DELIM" +R"DELIM(KLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),M4=e=>{jh(e);const a=e;return Oh(j4(4,i=>a(a(i))),O4)},ah=Oh(_b("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Eb("")),Hv=[996825010,642813549,513874426,1027748829,705979059];function oo(e){const a=e>>25;let i=(e&33554431)<<5;for(let l=0;l>l&1)===1&&(i^=Hv[l]);return i}function $v(e,a,i=1){const l=e.length;let s=1;for(let u=0;u126)throw new Error(`Invalid prefix (${e})`);s=oo(s)^c>>5}s=oo(s);for(let u=0;u_)throw new TypeError(`Length ${T} exceeds limit ${_}`);const k=g.toLowerCase(),Z=$v(k,x,a);return`${k}1${ah.encode(x)}${Z}`}function d(g,x=90){Ao("bech32.decode input",g);const _=g.length;if(_<8||x!==!1&&_>x)throw new TypeError(`invalid string length: ${_} (${g}). Expected (8..${x})`);const z=g.toLowerCase();if(g!==z&&g!==g.toUpperCase())throw new Error("String must be lowercase or uppercase");const T=z.lastIndexOf("1");if(T===0||T===-1)throw new Error('Letter "1" must be present between prefix and data only');const k=z.slice(0,T),Z=z.slice(T+1);if(Z.length<6)throw new Error("Data must be at least 6 characters long");const X=ah.decode(Z).slice(0,-6),ne=$v(k,X,a);if(!Z.endsWith(ne))throw new Error(`Invalid checksum in ${g}: expected "${ne}"`);return{prefix:k,words:X}}const m=Uv(d);function p(g){const{prefix:x,words:_}=d(g,!1);return{prefix:x,words:_,bytes:l(_)}}function b(g,x){return c(g,s(x))}return{encode:c,decode:d,encodeFromBytes:b,decodeToBytes:p,decodeUnsafe:m,fromWords:l,fromWordsUnsafe:u,toWords:s}}const Hu=Object.freeze(Rb("bech32")),rh=Object.freeze(Rb("bech32m"));function k4(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Mh(e,a,i=""){const l=k4(e),s=e?.length;if(!l||a!==void 0){const c=i&&`"${i}" `,d="",m=l?`length=${s}`:`type=${typeof e}`,p=c+"expected Uint8Array"+d+", got "+m;throw l?new RangeError(p):new TypeError(p)}return e}function Zv(e,a=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(a&&e.finished)throw new Error("Hash#digest() has already been called")}function D4(e,a){Mh(e,void 0,"digestInto() output");const i=a.outputLen;if(e.length='+i)}function ih(...e){for(let a=0;a>>a}const L4=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",B4=Array.from({length:256},(e,a)=>a.toString(16).padStart(2,"0"));function _u(e){if(Mh(e),L4)return e.toHex();let a="";for(let i=0;ie(u).update(s).digest(),l=e(void 0);return i.outputLen=l.outputLen,i.blockLen=l.blockLen,i.canXOF=l.canXOF,i.create=s=>e(s),Object.assign(i,a),Object.freeze(i)}const H4=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function $4(e,a,i){return e&a^~e&i}function Z4(e,a,i){return e&a^e&i^a&i}class q4{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(a,i,l,s){this.blockLen=a,this.outputLen=i,this.padOffset=l,this.isLE=s,this.buffer=new Uint8Array(a),this.view=Ed(this.buffer)}update(a){Zv(this),Mh(a);const{view:i,buffer:l,blockLen:s}=this,u=a.length;for(let c=0;cs-c&&(this.process(l,0),c=0);for(let g=c;gb.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g>>3,T=sa(_,17)^sa(_,19)^_>>>10;xr[g]=T+xr[g-7]+z+xr[g-16]|0}let{A:l,B:s,C:u,D:c,E:d,F:m,G:p,H:b}=this;for(let g=0;g<64;g++){const x=sa(d,6)^sa(d,11)^sa(d,25),_=b+x+$4(d,m,p)+P4[g]+xr[g]|0,T=(sa(l,2)^sa(l,13)^sa(l,22))+Z4(l,s,u)|0;b=p,p=m,m=d,d=c+_|0,c=u,u=s,s=l,l=_+T|0}l=l+this.A|0,s=s+this.B|0,u=u+this.C|0,c=c+this.D|0,d=d+this.E|0,m=m+this.F|0,p=p+this.G|0,b=b+this.H|0,this.set(l,s,u,c,d,m,p,b)}roundClean(){ih(xr)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ih(this.buffer)}}class F4 extends Q4{A=br[0]|0;B=br[1]|0;C=br[2]|0;D=br[3]|0;E=br[4]|0;F=br[5]|0;G=br[6]|0;H=br[7]|0;constructor(){super(32)}}const zb=U4(()=>new F4,H4(1)),Ab=M4(zb),Y4=0x00000000ffff0000000000000000000000000000000000000000000000000000n;function kh(e){if(e.length%2!==0)throw new Error("Invalid hex string");const a=new Uint8Array(e.length/2);for(let i=0;i>>24,i=e&8388607;if(i===0||a<3)return;const l=BigInt(i)*(1n<i[1]).filter(Boolean);return a.length>0?a:[e]}function Dh(e){const a=e.toLowerCase();if(a.includes("dup hash160")&&a.includes("equalverify checksig"))return"p2pkh";if(a.startsWith("hash160")&&a.includes("equal"))return"p2sh";if(a.startsWith("zero [")){const l=a.match(/zero \[([0-9a-f]+)\]/)?.[1]??"";return l.length===40?"p2wpkh":l.length===64?"p2wsh":"segwit"}if(a.startsWith("1 ["))return"p2tr"}function Uo(){return"mainnet"}function Ho(e){return e==="testnet"||e==="regtest"?{p2pkh:111,p2sh:196,hrp:e==="regtest"?"bcrt":"tb"}:{p2pkh:0,p2sh:5,hrp:"bc"}}function qv(e,a){const i=new Uint8Array(a.length/2+1);return i[0]=e,i.set(kh(a),1),Ab.encode(i)}function Td(e,a,i){const l=kh(i),s=Hu.toWords(l);return s.unshift(a),(a===0?Hu:rh).encode(e,s)}function Cb(e,a){const i=e.toLowerCase(),l=i.match(/dup hash160 \[([0-9a-f]{40})\] equalverify checksig/);if(l)return{address:qv(a.p2pkh,l[1]),type:"p2pkh"};const s=i.match(/^hash160 \[([0-9a-f]{40})\] equal$/);if(s)return{address:qv(a.p2sh,s[1]),type:"p2sh"};const u=i.match(/^zero \[([0-9a-f]{40})\]/);if(u)return{address:Td(a.hrp,0,u[1]),type:"p2wpkh"};const c=i.match(/^zero \[([0-9a-f]{64})\]/);if(c)return{address:Td(a.hrp,0,c[1]),type:"p2wsh"};const d=i.match(/^1 \[([0-9a-f]{64})\]/);return d?{address:Td(a.hrp,1,d[1]),type:"p2tr"}:{type:Dh(e)}}function V4(e,a){try{const s=Ab.decode(e),u=s[0],c=_u(s.slice(1));if(c.length===40&&u===a.p2pkh)return{scriptHex:`76a914${c}88ac`,type:"p2pkh"};if(c.length===40&&u===a.p2sh)return{scriptHex:`a914${c}87`,type:"p2sh"}}catch{}const i=e.toLowerCase();if(i.indexOf("1")>0&&i.startsWith(`${a.hrp}1`)){const s=i,u=m=>{try{return m.decode(s,90)}catch{return null}},c=u(Hu);if(c&&c.prefix===a.hrp){const m=c.words[0],p=Hu.fromWords(c.words.slice(1)),b=_u(p),g=p.length.toString(16).padStart(2,"0");if(m===0&&(p.length===20||p.length===32))return{scriptHex:`00${g}${b}`,type:p.length===20?"p2wpkh":"p2wsh"}}const d=u(rh);if(d&&d.prefix===a.hrp){const m=d.words[0],p=rh.fromWords(d.words.slice(1)),b=_u(p),g=p.length.toString(16).padStart(2,"0");if(m===1&&p.length===32)return{scriptHex:`51${g}${b}`,type:"p2tr"}}}return null}function jr(e,a){const i=e.toLowerCase();if(/^[0-9a-f]{64}$/.test(i))return{hash:i,type:"script-hash"};const l=V4(e,a);if(!l)return null;const s=zb(kh(l.scriptHex)),u=Uint8Array.from(s).reverse();return{hash:_u(u),type:l.type}}function so(e,a){return{hash:e.hash,height:e.height,timestamp:e.timestamp,txCount:a,size:void 0,weight:void 0,difficulty:G4(e.bits),previousBlockHash:e.previous}}function X4(e){const a=K4(e);return a&&a.length>0?a:void 0}function I4(e,a,i,l){const s=/^0{64}$/u.test(e.point.hash),u=a?Cb(a.script,i):{address:void)DELIM" +R"DELIM( 0,type:void 0},c=a?a.value:void 0,d=a?a.script:void 0;return{index:l,prevTxId:s?void 0:e.point.hash,prevOutputIndex:s?void 0:e.point.index,address:u.address,valueSats:c,scriptType:u.type??Dh(d??e.script),isCoinbase:s,script:e.script?{mnemonic:e.script}:void 0,witness:X4(e.witness),sequence:e.sequence}}function J4(e,a,i){const l=Cb(e.script,i);return{index:a,address:l.address,valueSats:e.value,scriptType:l.type??Dh(e.script),spent:void 0,script:e.script?{mnemonic:e.script}:void 0}}function W4(e,a){return typeof e!="number"||typeof a!="number"?0:Math.max(0,e-a+1)}function fu(e,a,i,l,s){const u=e.outputs.map((b,g)=>J4(b,g,i)),c=u.reduce((b,g)=>b+g.valueSats,0),d=a.reduce((b,g)=>g?(b??0)+g.value:b,null),m=W4(l.tipHeight,l.blockHeight),p=typeof l.blockHeight=="number"?"confirmed":"unconfirmed";return{txid:e.hash,hash:e.hash,status:p,confirmations:m,blockHeight:l.blockHeight,blockHash:l.blockHash,receivedTime:l.timestamp,feeSats:Number.isFinite(s)?s:void 0,feeRate:null,size:void 0,weight:void 0,version:e.version,locktime:e.locktime,totalInput:d,totalOutput:c,inputs:e.inputs.map((b,g)=>I4(b,a[g],i,g)),outputs:u}}const du=25,eR="/v1/top/subscribe?format=json",tR="/v1/top/subscribe?format=json&stop=true",nR=5e3,aR=2500,Pv=5e3,Rd=new Map,zd=new Map,$u={address:!0,filter:!1,turbo:!0,witness:!0,retarget:!1,difficult:!1};function rR(e){if(!e||typeof e!="object"||Array.isArray(e))return $u;const a=e,i=l=>typeof a[l]=="boolean"?a[l]:$u[l];return{address:i("address"),filter:i("filter"),turbo:i("turbo"),witness:i("witness"),retarget:i("retarget"),difficult:i("difficult")}}function Vi(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const i=e.state;if(!i||typeof i!="object"||Array.isArray(i))return null;const l=i,s=typeof l.count=="number"?l.count:void 0,u=typeof l.size=="number"?l.size:void 0,c=typeof l.weight=="number"?l.weight:void 0;return s===void 0&&u===void 0&&c===void 0?null:{count:s,size:u,weight:c}}function uo(e){return e?.weight??e?.size}function iR(e,a){return!Number.isFinite(e)||!Number.isFinite(a)||a<=0?null:e/a*4}function hu(e,a){if(!a)return e;const i=typeof a.fee=="number"?a.fee:void 0,l=typeof a.weight=="number"?a.weight:void 0,s=typeof i=="number"&&typeof l=="number"?iR(i,l):e.feeRate;return{...e,wtxid:a.wtxid||e.wtxid,feeSats:typeof a.fee=="number"?a.fee:e.feeSats,feeRate:s,size:typeof a.maximal=="number"?a.maximal:e.size,weight:typeof a.weight=="number"?a.weight:e.weight,sigops:typeof a.confirmed?.sigops=="number"?a.confirmed.sigops:e.sigops,totalInput:typeof a.value=="number"?a.value:e.totalInput,totalOutput:typeof a.spend=="number"?a.spend:e.totalOutput}}async function rn(e,a,i){const l=a.startsWith("/")?a:`/${a}`;let s=l.includes("?")?`${e}${l}`:`${e}${l}?format=json`;i&&(s+=s.includes("?")?"&turbo=true":"?turbo=true");const u=zd.get(s);if(u)return u;const c=(async()=>{const d=await fetch(s,{headers:{Accept:"application/json"}});if(!d.ok){const p=await d.text().catch(()=>"");throw new Error(`Request failed ${String(d.status)}: ${p||d.statusText}`)}const m=await d.text();try{return JSON.parse(m)}catch{return m}})();zd.set(s,c);try{return await c}finally{zd.delete(s)}}async function zt(e,a,i){try{return await rn(e,a,i)}catch{return null}}async function jb(e,a){const i=await rn(e,"/v1/top?format=json",a),l=typeof i=="number"?i:Number(i);if(!Number.isFinite(l))throw new Error("Invalid top height");return l}function lR(e){return/^[0-9a-f]{64}$/iu.test(e)}function oR(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e.trim()):null}function lh(e){const a=oR(e);if(a!==null)return a;if(typeof e=="string"){const s=e.trim();return lR(s)?s:null}if(!e||typeof e!="object"||Array.isArray(e))return null;const i=e,l=[i.payload,i.top,i.block,i.header,i.hash,i.height];for(const s of l){if(s===e)continue;const u=lh(s);if(u!==null)return u}return null}function sR(e){return typeof e=="string"?Promise.resolve(e):e instanceof ArrayBuffer?Promise.resolve(new TextDecoder().decode(e)):e instanceof Blob?e.text():Promise.resolve(null)}function uR(e){const a=e.trim();if(!a)return null;try{return lh(JSON.parse(a))}catch{return lh(a)}}function cR(e){const a=e.trim();if(!a)return null;const l=/^[a-z][a-z\d+\-.]*:\/\//iu.test(a)?a:`http://${a}`,s=globalThis.window;try{const u=new URL(l,s?.location.href??"http://localhost");if(u.protocol==="http:")u.protocol="ws:";else if(u.protocol==="https:")u.protocol="wss:";else if(u.protocol!=="ws:"&&u.protocol!=="wss:")return null;return u.hash="",u.search="",u.toString()}catch{return null}}async function Jr(e,a){const i=Date.now(),l=`${e}|0`,s=Rd.get(l);if(s&&s.expiresAt>i)return s.promise;const u=jb(e,a).then(c=>(Rd.set(l,{promise:u,value:c,expiresAt:Date.now()+Pv}),c));return Rd.set(l,{promise:u,value:s?.value??null,expiresAt:i+Pv}),u}async function mu(e,a,i){if(a==="latest"||a==="tip"){const l=await Jr(e,i);return{path:`/v1/block/height/${String(l)}`,height:l}}return/^\d+$/u.test(a)?{path:`/v1/block/height/${a}`}:{path:`/v1)DELIM" +R"DELIM(/block/hash/${a}`}}function fR(e,a){const i=new Map;return(l,s)=>{const u=`${l}:${String(s)}`,c=i.get(u);if(c)return c;const d=rn(e,`/v1/output/${l}/${String(s)}?format=json`,a).catch(()=>null);return i.set(u,d),d}}async function Qv(e,a,i,l){return rn(e,`${a}/tx/${String(i)}?format=json`,l)}async function Fv(e,a,i){const l=await zt(e,`/v1/address/${a}/confirmed?format=json`,i);return Array.isArray(l)?l:[]}async function dR(e,a,i){const l=await zt(e,`/v1/address/${a}?format=json`,i);return Array.isArray(l)?l:[]}const Yv=25,hR=8,mR=3e4;function pR(e){if(e===void 0)return 0;const a=Number(e);return Number.isInteger(a)&&a>0?a:0}async function yR(e,a,i){const l=await zt(e,`/v1/output/${a}/${String(i)}/spender?format=json`);return l&&typeof l.hash=="string"?l:null}async function gR(e,a,i){const l=new Array(e.length);let s=0;async function u(){for(;su())),l}async function vR(e,a,i){const l=await gR(a,hR,u=>yR(e,u.point.hash,u.point.index)),s=[];for(const[u,c]of a.entries()){const{hash:d,index:m}=c.point,p=l[u];s.push({id:`in:${d}:${String(m)}`,txid:d,outputIndex:m,valueChange:c.value,direction:"received",spent:p!==null,...i!==null?{cursor:i}:{}}),p&&s.push({id:`out:${d}:${String(m)}`,txid:p.hash,valueChange:-c.value,direction:"sent",...i!==null?{cursor:i}:{}})}return s}function Gv(e,a){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const l=Number(e);if(Number.isFinite(l))return l}let i=0;for(const l of a)i+=l.value;return i}function Ad({baseUrl:e,pollIntervalMs:a=15e3,turbo:i=!1}){const l=new Set,s=new Set;let u=null,c=null,d=null,m=null,p=!1,b=!1,g="idle",x=null,_=null;const z=Ho(Uo());let T=null,k=null;const Z=cR(e),X=!!(Z&&globalThis.WebSocket),ne=new Map;async function se(C,$){const G=Date.now(),ie=ne.get(C);if(ie&&ie.expiresAt>G)return ie.outputs;const fe=await dR(e,C,$);return ne.set(C,{outputs:fe,expiresAt:G+mR}),fe}async function te(C,$,G){const ie=await se(C,$),fe=pR(G),I=ie.slice(fe,fe+Yv),ge=fe+Yv,be=ge{const $=rR(C);return T=$,$}).catch(C=>(console.warn("Libbitcoin configuration fetch failed",C),T=$u,$u)),k)}function O(C){return C.address}function w(C){return O(C)&&C.turbo}function L(){return{transport:g,websocketAvailable:X&&!p}}function H(C){if(g===C)return;g=C;const $=L();for(const G of s)G($)}async function F(C){const $=typeof C=="number"?`/v1/block/height/${String(C)}`:`/v1/block/hash/${C}`,[G,ie]=await Promise.all([rn(e,`${$}/header?format=json`),zt(e,`${$}/header/context?format=json`)]);if(_===G.hash||x!==null&&G.heightx&&await F(C)}catch(C){console.warn("Libbitcoin poller failed",C)}}function he(){u||l.size===0||(u=setInterval(()=>{K()},a),H("polling"))}function me(){u&&(clearInterval(u),u=null)}function W(){d&&(clearTimeout(d),d=null)}function N(){m&&(clearTimeout(m),m=null)}function B(C){if(W(),!!c){b=!0;try{C&&c.readyState===1&&c.send(tR),c.close()}catch{}finally{c=null}}}function ue(){if(N(),c)return!0;if(!X||!Z||p||l.size===0)return!1;try{b=!1,c=new WebSocket(Z),H("connecting")}catch($){return console.warn("Libbitcoin websocket unavailable, falling back to polling",$),p=!0,!1}const C=c;return d=setTimeout(()=>{c===C&&(p=!0,B(!1),he())},nR),C.addEventListener("open",()=>{if(c===C){W();try{C.send(eR),me(),H("websocket")}catch($){console.warn("Libbitcoin websocket subscribe failed, falling back to polling",$),p=!0,B(!1),he()}}}),C.addEventListener("message",$=>{(async()=>{try{const G=await sR($.data);if(G===null)return;const ie=uR(G);if(ie===null)return;await F(ie)}catch(G){console.warn("Libbitcoin websocket event handling failed",G)}})()}),C.addEventListener("error",$=>{b||c!==C||(console.warn("Libbitcoin websocket failed, falling back to polling",$),p=!0,B(!1),he())}),C.addEventListener("close",()=>{if(W(),c===C&&(c=null),b){b=!1;return}l.size!==0&&(p=!0,he())}),!0}function de(){ue()||he()}function ce(){N(),me(),B(!0),H("idle")}function R(){l.size>0||m||(m=setTimeout(()=>{m=null,l.size===0&&ce()},aR))}return{metadata:{id:"libbitcoin",label:"Server",type:"local",connectionState:"connected",supportsWebsocket:X,endpoint:e,description:"Adapter for the libbitcoin embedded REST API."},getConfiguration(){return xe()},async getLatestBlocks(C=10){const $=await Jr(e);x=$;const G=Array.from({length:C},(I,ge)=>$-ge).filter(I=>I>=0),[ie,fe]=await Promise.all([Promise.all(G.map(I=>rn(e,`/v1/block/height/${String(I)}/header?format=json`))),Promise.all(G.map(I=>zt(e,`/v1/block/height/${String(I)}/header/context?format=json`)))]);return ie.map((I,ge)=>{const be=Vi(fe[ge]),tt=so(I)DELIM" +R"DELIM(,be?.count);return ge===0&&(_=I.hash),{...tt,size:uo(be)}})},async getBlocksBefore(C,$=10){const G=Array.from({length:$},(I,ge)=>C-ge).filter(I=>I>=0),[ie,fe]=await Promise.all([Promise.all(G.map(I=>rn(e,`/v1/block/height/${String(I)}/header?format=json`))),Promise.all(G.map(I=>zt(e,`/v1/block/height/${String(I)}/header/context?format=json`)))]);return ie.map((I,ge)=>{const be=Vi(fe[ge]);return{...so(I,be?.count),size:uo(be)}})},async getBlockHeader(C){const{path:$,height:G}=await mu(e,C),ie=G===void 0?Jr(e):Promise.resolve(G),[fe,I,ge]=await Promise.all([rn(e,`${$}/header?format=json`),ie,zt(e,`${$}/header/context?format=json`)]);x=Math.max(x??0,I);let be=null;fe.heightga),Qe=(await Promise.all(Je.map(Ut=>Qv(e,$,Ut).catch(()=>null)))).filter(Ut=>Ut!==null),An=await Promise.all(Qe.map(Ut=>zt(e,`/v1/tx/${Ut.hash}/details?format=json`))),ya=Qe.map((Ut,ga)=>{const Mr=An[ga],hl=fu(Ut,[],z,{blockHeight:fe.height,blockHash:fe.hash,tipHeight:I,timestamp:fe.timestamp},typeof Mr?.fee=="number"?Mr.fee:void 0);return hu(hl,Mr)});return{...ut,size:be?.maximal??uo(dt),weight:be?.weight,merkleRoot:fe.merkle_root,nonce:fe.nonce,bits:fe.bits,version:fe.version,nextBlockHash:tt,feesSats:be?.fees,subsidySats:be?.subsidy,sigops:be?.sigops,transactions:ya}},async getBlockTransactions(C,$=0){const{path:G}=await mu(e,C),[ie,fe,I]=await Promise.all([rn(e,`${G}/header?format=json`),Jr(e),zt(e,`${G}/header/context?format=json`)]);x=Math.max(x??0,fe);const ge=Vi(I)?.count;if(typeof ge=="number"&&$>=ge)return[];const be=typeof ge=="number"?Math.min($+du,ge):$+du,tt=Array.from({length:Math.max(0,be-$)},(je,Je)=>$+Je),xt=(await Promise.all(tt.map(je=>Qv(e,G,je).catch(()=>null)))).filter(je=>je!==null);if(xt.length===0)return[];const ut=await Promise.all(xt.map(je=>zt(e,`/v1/tx/${je.hash}/details?format=json`)));return xt.map((je,Je)=>{const Ue=ut[Je],Qe=fu(je,[],z,{blockHeight:ie.height,blockHash:ie.hash,tipHeight:fe,timestamp:ie.timestamp},typeof Ue?.fee=="number"?Ue.fee:void 0);return hu(Qe,Ue)})},async getTransaction(C){const $=await rn(e,`/v1/tx/${C}?format=json`),G=fR(e),ie=Promise.all($.inputs.map(dt=>/^0{64}$/u.test(dt.point.hash)?Promise.resolve(null):G(dt.point.hash,dt.point.index))),[fe,I,ge,be]=await Promise.all([zt(e,`/v1/tx/${C}/header?format=json`),Jr(e).catch(()=>null),zt(e,`/v1/tx/${C}/details?format=json`),ie]);typeof I=="number"&&(x=Math.max(x??0,I));const tt=fu($,be,z,{blockHeight:fe?.height,blockHash:fe?.hash,tipHeight:typeof I=="number"?I:void 0,timestamp:fe?.timestamp},typeof ge?.fee=="number"?ge.fee:void 0);return hu(tt,ge)},async getTransactionHeader(C){const $=await rn(e,`/v1/tx/${C}?format=json`),[G,ie,fe]=await Promise.all([zt(e,`/v1/tx/${C}/header?format=json`),Jr(e).catch(()=>null),zt(e,`/v1/tx/${C}/details?format=json`)]);typeof ie=="number"&&(x=Math.max(x??0,ie));const I=fu($,[],z,{blockHeight:G?.height,blockHash:G?.hash,tipHeight:typeof ie=="number"?ie:void 0,timestamp:G?.timestamp},typeof fe?.fee=="number"?fe.fee:void 0);return hu(I,fe)},async getTransactionInputScriptHex(C,$){return(await rn(e,`/v1/input/${C}/${String($)}/script?format=text`)).trim()},async getTransactionOutputScriptHex(C,$){return(await rn(e,`/v1/output/${C}/${String($)}/script?format=text`)).trim()},async getAddress(C){const $=jr(C,z);if(!$)throw new Error("Unsupported address format for libbitcoin adapter");const G=T??await xe();if(!O(G))throw new Error("Address endpoints are disabled by server configuration");const ie=i&&w(G),[fe,I]=await Promise.all([zt(e,`/v1/address/${$.hash}/balance?format=json`,ie),Fv(e,$.hash,ie)]),ge=Gv(fe,I),be=await te($.hash,ie);return{address:C,addressType:$.type,balance:ge,totalReceived:void 0,totalSent:void 0,txCount:void 0,utxoCount:I.length,transactions:be}},async getAddressSummary(C){const $=jr(C,z);if(!$)throw new Error("Unsupported address format for libbitcoin adapter");const G=T??await xe();if(!O(G))throw new Error("Address endpoints are disabled by server configuration");const ie=i&&w(G),[fe,I]=await Promise.all([zt(e,`/v1/address/${$.hash}/balance?format=js)DELIM" +R"DELIM(on`,ie),Fv(e,$.hash,ie)]),ge=Gv(fe,I);return{address:C,addressType:$.type,balance:ge,totalReceived:void 0,totalSent:void 0,txCount:void 0,utxoCount:I.length}},async getAddressTransactions(C,$){const G=jr(C,z);if(!G)return[];const ie=T??await xe();if(!O(ie))return[];const fe=i&&w(ie);return te(G.hash,fe,$)},subscribeToEvents(C){return N(),l.add(C),de(),()=>{l.delete(C),R()}},getEventStatus:L,subscribeToEventStatus(C){return s.add(C),C(L()),()=>{s.delete(C)}}}}const Nb=E.createContext(null),Ob=E.createContext(null),Mb=E.createContext(null);function bR({children:e,client:a}){return v.jsx(Nb.Provider,{value:a,children:e})}function xR({children:e,provider:a,setProvider:i,availableProviders:l}){return v.jsx(Ob.Provider,{value:{provider:a,setProvider:i,availableProviders:l},children:e})}function SR({children:e,turbo:a,setTurbo:i}){return v.jsx(Mb.Provider,{value:{turbo:a,setTurbo:i},children:e})}function Qa(){const e=E.useContext(Nb);if(!e)throw new Error("BlockchainClientProvider missing in component tree");return e}function $o(){return Qa().metadata}function kb(){const e=E.useContext(Ob);if(!e)throw new Error("ProviderSwitcherProvider missing in component tree");return e}function Db(){const e=E.useContext(Mb);if(!e)throw new Error("TurboProvider missing in component tree");return e}function Cd(){const e=globalThis.window;return e?.location.origin?e.location.origin:"http://localhost:8080"}function wR(e,a){if(e==="blockstream")return xb({baseUrl:"https://blockstream.info/api"});if(e==="mempool")return z4({baseUrl:"https://mempool.space/api"});if(e==="libbitcoin"){const l=Cd();return Ad({baseUrl:l,turbo:a?.turboEnabled})}if(e==="external"){console.warn("No external API URL provided, falling back to libbitcoin provider");const l=Cd();return Ad({baseUrl:l,turbo:a?.turboEnabled})}console.warn(`Unknown provider "${e}", falling back to libbitcoin provider`);const i=Cd();return Ad({baseUrl:i,turbo:a?.turboEnabled})}function _R(){return[...new Set(["libbitcoin","blockstream","mempool"])]}const jd=10,ER=20;function Lb(e){return e.metadata.endpoint?{providerId:e.metadata.id,endpoint:e.metadata.endpoint}:{providerId:e.metadata.id}}function TR(e,a){if(!e||typeof e!="object"||Array.isArray(e))return!1;const i=e;return i.providerId===a.providerId&&i.endpoint===a.endpoint}function RR(e,a){if(!e||typeof e!="object"||Array.isArray(e))return a;const i=e.limit;return typeof i=="number"&&Number.isFinite(i)&&i>0?i:a}function zR(e,a,i){const l=e.getQueryCache().findAll({predicate:s=>{const u=s.queryKey;return u.length>=4&&TR(u[0],a)&&u[1]==="blocks"&&u[2]==="latest"}});for(const s of l){const u=RR(s.queryKey[3],jd);e.setQueryData(s.queryKey,c=>[i,...(c??[]).filter(p=>p.hash!==i.hash)].slice(0,u))}e.setQueryData([a,"blocks","latest",{limit:jd}],s=>[i,...(s??[]).filter(d=>d.hash!==i.hash)].slice(0,jd))}function AR(e,a,i){e.setQueryData([a,"transactions","recent"],l=>[i,...(l??[]).filter(c=>c.txid!==i.txid)].slice(0,ER))}function CR(e,a,i){i.type==="block.new"&&zR(e,a,i.payload),i.type==="tx.new"&&AR(e,a,i.payload)}function Qn({queryKey:e,queryFn:a,enabled:i,staleTime:l,initialData:s}){const u=Qa();return Hw({queryKey:[Lb(u),...e],queryFn:()=>a(u),enabled:i,staleTime:l,initialData:s})}function Bb(e=10){return Qn({queryKey:["blocks","latest",{limit:e}],queryFn:a=>a.getLatestBlocks(e)})}function Ub(){return Qn({queryKey:["configuration"],queryFn:e=>e.getConfiguration(),staleTime:6e4})}function Hb(e){return Qn({queryKey:["block",e,"header"],queryFn:a=>a.getBlockHeader(e)})}function $b(e,a){return Qn({queryKey:["block",e,"stats"],queryFn:i=>i.getBlockStats(e),enabled:(a?.enabled??!0)&&!!e.trim(),staleTime:1/0})}function jR(e,a=0){return Qn({queryKey:["block",e,"transactions",{startIndex:a}],queryFn:i=>i.getBlockTransactions(e,a)})}function NR(e){return Qn({queryKey:["transaction",e,"header"],queryFn:a=>a.getTransactionHeader(e),enabled:!!e.trim()})}function OR(e,a){return Qn({queryKey:["transaction",e],queryFn:i=>i.getTransaction(e),enabled:a?.enabled??!!e.trim()})}function MR(e,a,i){return Qn({queryKey:["transaction",e,"input",a,"scriptHex"],queryFn:l=>l.getTransactionInputScriptHex(e,a),enabled:(i?.enabled??!0)&&!!e.trim()})}function kR(e,a,i){return Qn({queryKey:["transaction",e,"output",a,"scriptHex"],queryFn:l=>l.getTransactionOutputScriptHex(e,a),enabled:(i?.enabled??!0)&&!!e.trim()})}function DR(e){return Qn({queryKey:["address",e,"summary"],queryFn:a=>a.getAddressSummary(e),enabled:!!e.trim()})}function LR(e,a){return Qn({queryKey:["address",e,"transactions",{lastSeenTxid:null}],queryFn:i=>i.getAddressTransactions(e,a),enabled:!!e.trim()})}function BR(e){const a=Qa(),i=E.useRef(e);E.useEffect(()=>{i.current=e},[e]),E.useEffect(()=>{const l=a.subscribeToEvents(s=>{i.current(s)});return()=>{l()}},[a])}function UR(){const e=Qa(),a=E.useMemo(()=>({transport:e.metadata.supportsWebsocket?"websocket":"polling",websocketAvailable:e.metadata.supportsWebsocket}),[e.metadata.supportsWebsocket]),[i,l]=E.useState(()=>e.getEventStatus?e.getEventSta)DELIM" +R"DELIM(tus():a);return E.useEffect(()=>{const s=e.getEventStatus?e.getEventStatus():a;return l(s),e.subscribeToEventStatus?.(l)},[e,a]),i}function HR(){const e=Qa(),a=E.useMemo(()=>Lb(e),[e]),i=Yu(),l=E.useCallback(s=>{CR(i,a,s)},[i,a]);return BR(l),null}function $R(e=10){const{data:a,...i}=Bb(e),{data:l=[]}=Qn({queryKey:["transactions","recent"],queryFn:()=>Promise.resolve([]),enabled:!1,initialData:[]});return{data:a,recentTransactions:l,...i}}function ZR({children:e}){const a="libbitcoin",i=_R(),l=(()=>{const g=globalThis.window;return g?g.localStorage.getItem("turboEnabled")==="true":!1})(),s=(()=>{const g=globalThis.window;if(!g)return a;const x=g.localStorage.getItem("blockchainProvider");return x&&i.includes(x)?x:a})(),[u,c]=E.useState(l),[d,m]=E.useState(s),[p]=E.useState(()=>new Rw({defaultOptions:{queries:{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}}})),b=E.useMemo(()=>wR(d,{turboEnabled:u}),[d,u]);return E.useEffect(()=>{const g=globalThis.window;g&&g.localStorage.setItem("turboEnabled",u?"true":"false")},[u]),E.useEffect(()=>{const g=globalThis.window;g&&g.localStorage.setItem("blockchainProvider",d)},[d]),v.jsx(xR,{provider:d,setProvider:m,availableProviders:i,children:v.jsx(SR,{turbo:u,setTurbo:c,children:v.jsx(bR,{client:b,children:v.jsxs(zw,{client:p,children:[v.jsx(HR,{}),e,null]})})})})}var Zb=e=>{throw TypeError(e)},qb=(e,a,i)=>a.has(e)||Zb("Cannot "+i),Hn=(e,a,i)=>(qb(e,a,"read from private field"),i?i.call(e):a.get(e)),yo=(e,a,i)=>a.has(e)?Zb("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(e):a.set(e,i),ua=(e,a,i,l)=>(qb(e,a,"write to private field"),a.set(e,i),i),Iu=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Lh=/^[\\/]{2}/;function Pb(e,a){return a+e.replace(/\\/g,"/")}var Kv="popstate";function Vv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function qR(e={}){function a(l,s){let u=s.state?.masked,{pathname:c,search:d,hash:m}=u||l.location;return Co("",{pathname:c,search:d,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function i(l,s){return typeof s=="string"?s:ha(s)}return QR(a,i,null,e)}function Me(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function _t(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function PR(){return Math.random().toString(36).substring(2,10)}function Xv(e,a){return{usr:e.state,key:e.key,idx:a,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Co(e,a,i=null,l,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?ma(a):a,state:i,key:a&&a.key||l||PR(),mask:s}}function ha({pathname:e="/",search:a="",hash:i=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function ma(e){let a={};if(e){let i=e.indexOf("#");i>=0&&(a.hash=e.substring(i),e=e.substring(0,i));let l=e.indexOf("?");l>=0&&(a.search=e.substring(l),e=e.substring(0,l)),e&&(a.pathname=e)}return a}function QR(e,a,i,l={}){let{window:s=document.defaultView,v5Compat:u=!1}=l,c=s.history,d="POP",m=null,p=b();p==null&&(p=0,c.replaceState({...c.state,idx:p},""));function b(){return(c.state||{idx:null}).idx}function g(){d="POP";let k=b(),Z=k==null?null:k-p;p=k,m&&m({action:d,location:T.location,delta:Z})}function x(k,Z){d="PUSH";let X=Vv(k)?k:Co(T.location,k,Z);p=b()+1;let ne=Xv(X,p),se=T.createHref(X.mask||X);try{c.pushState(ne,"",se)}catch(te){if(te instanceof DOMException&&te.name==="DataCloneError")throw te;s.location.assign(se)}u&&m&&m({action:d,location:T.location,delta:1})}function _(k,Z){d="REPLACE";let X=Vv(k)?k:Co(T.location,k,Z);p=b();let ne=Xv(X,p),se=T.createHref(X.mask||X);c.replaceState(ne,"",se),u&&m&&m({action:d,location:T.location,delta:0})}function z(k){return Qb(s,k)}let T={get action(){return d},get location(){return e(s,c)},listen(k){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(Kv,g),m=k,()=>{s.removeEventListener(Kv,g),m=null}},createHref(k){return a(s,k)},createURL:z,encodeLocation(k){let Z=z(k);return{pathname:Z.pathname,search:Z.search,hash:Z.hash}},push:x,replace:_,go(k){return c.go(k)}};return T}function Qb(e,a,i=!1){let l="http://localhost";e&&(l=e.location.origin!=="null"?e.location.origin:e.location.href),Me(l,"No window.location.(origin|href) available to create URL");let s=typeof a=="string"?a:ha(a);return s=s.replace(/ $/,"%20"),!i&&Lh.test(s)&&(s=l+s),new URL(s,l)}var go,Iv=class{constructor(e){if(yo(this,go,new Map),e)for(let[a,i]of e)this.set(a,i)}get(e){if(Hn(this,go).has(e))return Hn(this,go).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,a){Hn(this,go).set(e,a)}};go=new WeakMap;var FR=new Set(["lazy","caseSensitive","path","id","index","children"]);function YR(e){return FR.has(e)}var GR=new Set(["lazy","caseSensitive","path","id",)DELIM" +R"DELIM("index","middleware","children"]);function KR(e){return GR.has(e)}function VR(e){return e.index===!0}function jo(e,a,i=[],l={},s=!1){return e.map((u,c)=>{let d=[...i,String(c)],m=typeof u.id=="string"?u.id:d.join("-");if(Me(u.index!==!0||!u.children,"Cannot specify children on an index route"),Me(s||!l[m],`Found a route id collision on id "${m}". Route id's must be globally unique within Data Router usages`),VR(u)){let p={...u,id:m};return l[m]=Jv(p,a(p)),p}else{let p={...u,id:m,children:void 0};return l[m]=Jv(p,a(p)),u.children&&(p.children=jo(u.children,a,d,l,s)),p}})}function Jv(e,a){return Object.assign(e,{...a,...typeof a.lazy=="object"&&a.lazy!=null?{lazy:{...e.lazy,...a.lazy}}:{}})}function Fb(e,a,i="/"){return ta(e,a,i,!1)}function ta(e,a,i,l,s){let u=typeof a=="string"?ma(a):a,c=qn(u.pathname||"/",i);if(c==null)return null;let d=s??Eu(e),m=null,p=o3(c);for(let b=0;m==null&&b{let b={relativePath:p===void 0?c.path||"":p,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(l)&&m)return;Me(b.relativePath.startsWith(l),`Absolute route path "${b.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(l.length)}let g=Zn([l,b.relativePath]),x=i.concat(b);c.children&&c.children.length>0&&(Me(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Yb(c.children,a,x,g,m)),!(c.path==null&&!c.index)&&a.push({path:g,score:r3(g,c.index),routesMeta:x.map((_,z)=>{let[T,k]=Vb(_.relativePath,_.caseSensitive,z===x.length-1);return{..._,matcher:T,compiledParams:k}})})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))u(c,d);else for(let m of Gb(c.path))u(c,d,!0,m)}),a}function Gb(e){let a=e.split("/");if(a.length===0)return[];let[i,...l]=a,s=i.endsWith("?"),u=i.replace(/\?$/,"");if(l.length===0)return s?[u,""]:[u];let c=Gb(l.join("/")),d=[];return d.push(...c.map(m=>m===""?u:[u,m].join("/"))),s&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function IR(e){e.sort((a,i)=>a.score!==i.score?i.score-a.score:i3(a.routesMeta.map(l=>l.childrenIndex),i.routesMeta.map(l=>l.childrenIndex)))}var JR=/^:[\w-]+$/,WR=3,e3=2,t3=1,n3=10,a3=-2,Wv=e=>e==="*";function r3(e,a){let i=e.split("/"),l=i.length;return i.some(Wv)&&(l+=a3),a&&(l+=e3),i.filter(s=>!Wv(s)).reduce((s,u)=>s+(JR.test(u)?WR:u===""?t3:n3),l)}function i3(e,a){return e.length===a.length&&e.slice(0,-1).every((l,s)=>l===a[s])?e[e.length-1]-a[a.length-1]:0}function l3(e,a,i=!1){let{routesMeta:l}=e,s={},u="/",c=[];for(let d=0;d{if(b==="*"){let z=d[x]||"";c=u.slice(0,u.length-z.length).replace(/(.)\/+$/,"$1")}const _=d[x];return g&&!_?p[b]=void 0:p[b]=(_||"").replace(/%2F/g,"/"),p},{}),pathname:u,pathnameBase:c,pattern:e}}function Vb(e,a=!1,i=!0){_t(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let l=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,m,p,b)=>{if(l.push({paramName:d,isOptional:m!=null}),m){let g=b.charAt(p+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,a?void 0:"i"),l]}function o3(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return _t(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probab)DELIM" +R"DELIM(ly due to a bad percent encoding (${a}).`),e}}function qn(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let i=a.endsWith("/")?a.length-1:a.length,l=e.charAt(i);return l&&l!=="/"?null:e.slice(i)||"/"}function s3({basename:e,pathname:a}){return a==="/"?e:Zn([e,a])}var Bh=e=>Iu.test(e);function u3(e,a="/"){let{pathname:i,search:l="",hash:s=""}=typeof e=="string"?ma(e):e,u;return i?(i=Uh(i),i.startsWith("/")?u=e0(i.substring(1),"/"):u=e0(i,a)):u=a,{pathname:u,search:f3(l),hash:d3(s)}}function e0(e,a){let i=qu(a).split("/");return e.split("/").forEach(s=>{s===".."?i.length>1&&i.pop():s!=="."&&i.push(s)}),i.length>1?i.join("/"):"/"}function Nd(e,a,i,l){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in and the router will parse it for you.`}function Xb(e){return e.filter((a,i)=>i===0||a.route.path&&a.route.path.length>0)}function Ju(e){let a=Xb(e);return a.map((i,l)=>l===a.length-1?i.pathname:i.pathnameBase)}function Zo(e,a,i,l=!1){let s;typeof e=="string"?s=ma(e):(s={...e},Me(!s.pathname||!s.pathname.includes("?"),Nd("?","pathname","search",s)),Me(!s.pathname||!s.pathname.includes("#"),Nd("#","pathname","hash",s)),Me(!s.search||!s.search.includes("#"),Nd("#","search","hash",s)));let u=e===""||s.pathname==="",c=u?"/":s.pathname,d;if(c==null)d=i;else{let g=a.length-1;if(!l&&c.startsWith("..")){let x=c.split("/");for(;x[0]==="..";)x.shift(),g-=1;s.pathname=x.join("/")}d=g>=0?a[g]:"/"}let m=u3(s,d),p=c&&c!=="/"&&c.endsWith("/"),b=(u||c===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(p||b)&&(m.pathname+="/"),m}var Uh=e=>e.replace(/[\\/]{2,}/g,"/"),Zn=e=>Uh(e.join("/")),qu=e=>e.replace(/\/+$/,""),c3=e=>qu(e).replace(/^\/*/,"/"),f3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,d3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,h3=["EvalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],qo=class{constructor(e,a,i,l=!1){this.status=e,this.statusText=a||"",this.internal=l,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function No(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Po(e){let a=e.map(i=>i.route.path).filter(Boolean);return Zn(a)||"/"}var Ib=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jb(e,a){let i=e;if(typeof i!="string"||!Iu.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let l=i,s=!1;if(Ib)try{let u=new URL(window.location.href),c=Lh.test(i)?new URL(Pb(i,u.protocol)):new URL(i),d=qn(c.pathname,a);c.origin===u.origin&&d!=null?i=d+c.search+c.hash:s=!0}catch{_t(!1,` contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:s,to:i}}var Ar=Symbol("Uninstrumented");function m3(e,a){let i={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(s=>s({id:a.id,index:a.index,path:a.path,instrument(u){let c=Object.keys(i);for(let d of c)u[d]&&i[d].push(u[d])}}));let l={};if(typeof a.lazy=="function"&&i.lazy.length>0){let s=al(i.lazy,a.lazy,()=>{});s&&(l.lazy=s)}if(typeof a.lazy=="object"){let s=a.lazy;["middleware","loader","action"].forEach(u=>{let c=s[u],d=i[`lazy.${u}`];if(typeof c=="function"&&d.length>0){let m=al(d,c,()=>{});m&&(l.lazy=Object.assign(l.lazy||{},{[u]:m}))}})}return["loader","action"].forEach(s=>{let u=a[s];if(typeof u=="function"&&i[s].length>0){let c=u[Ar]??u,d=al(i[s],c,(...m)=>t0(m[0]));d&&(s==="loader"&&c.hydrate===!0&&(d.hydrate=!0),d[Ar]=c,l[s]=d)}}),a.middleware&&a.middleware.length>0&&i.middleware.length>0&&(l.middleware=a.middleware.map(s=>{let u=s[Ar]??s,c=al(i.middleware,u,(...d)=>t0(d[0]));return c?(c[Ar]=u,c):s})),l}function p3(e,a){let i={navigate:[],fetch:[]};if(a.forEach(l=>l({instrument(s){let u=Object.keys(s);for(let c of u)s[c]&&i[c].push(s[c])}})),i.navigate.length>0){let l=e.navigate[Ar]??e.navigate,s=al(i.navigate,l,(...u)=>{let[c,d]=u;return{to:typeof c=="number"||typeof c=="string"?c:c?ha(c):".",...n0(e,d??{})}});s&&(s[Ar]=l,e.navigate=s)}if(i.fetch.length>0){let l=e.fetch[Ar]??e.fetch,s=al(i.fetch,l,(...u)=>{let[c,,d,m]=u;return{href:d??".",fetcherKey:c,...n0(e,m??{})}});s&&(s[Ar]=l,e.fetch=s)}return e}function al(e,a,i){return e.length===0?null:async(...l)=>{let s=await Wb(e,i(...l),()=>a(...l),e.length-1);if(s.type==="error")throw s.value;return s.value}}async function Wb(e,a,i,l){let s=e[l],u;if(s){let c,d=async()=>(c?console.error("You cannot call instrumented handlers more than once"):c=Wb(e,a,i,l-1),u=await c,Me(u,"Expected a result"),u.type==="error"&&u.value instanceof Error?{status:"error",error:u.value}:{status:"success",error:void 0});try{await s(d,a)}catch(m){console.error("An instrumentation function threw an error:",m))DELIM" +R"DELIM(}c||await d(),await c}else try{u={type:"success",value:await i()}}catch(c){u={type:"error",value:c}}return u||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function t0(e){let{request:a,context:i,params:l,pattern:s}=e;return{request:y3(a),params:{...l},pattern:s,context:g3(i)}}function n0(e,a){return{currentUrl:ha(e.state.location),..."formMethod"in a?{formMethod:a.formMethod}:{},..."formEncType"in a?{formEncType:a.formEncType}:{},..."formData"in a?{formData:a.formData}:{},..."body"in a?{body:a.body}:{}}}function y3(e){return{method:e.method,url:e.url,headers:{get:(...a)=>e.headers.get(...a)}}}function g3(e){if(b3(e)){let a={...e};return Object.freeze(a),a}else return{get:a=>e.get(a)}}var v3=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function b3(e){if(e===null||typeof e!="object")return!1;const a=Object.getPrototypeOf(e);return a===Object.prototype||a===null||Object.getOwnPropertyNames(a).sort().join("\0")===v3}var ex=["POST","PUT","PATCH","DELETE"],x3=new Set(ex),S3=["GET",...ex],w3=new Set(S3),tx=new Set([301,302,303,307,308]),_3=new Set([307,308]),Od={state:"idle",location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},E3={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},co={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},T3=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),nx="remix-router-transitions",ax=Symbol("ResetLoaderData"),Wr,Wi,Er,el,R3=class{constructor(e){yo(this,Wr),yo(this,Wi),yo(this,Er),yo(this,el),ua(this,Wr,e),ua(this,Wi,Eu(e))}get stableRoutes(){return Hn(this,Wr)}get activeRoutes(){return Hn(this,Er)??Hn(this,Wr)}get branches(){return Hn(this,el)??Hn(this,Wi)}get hasHMRRoutes(){return Hn(this,Er)!=null}setRoutes(e){ua(this,Wr,e),ua(this,Wi,Eu(e))}setHmrRoutes(e){ua(this,Er,e),ua(this,el,Eu(e))}commitHmrRoutes(){Hn(this,Er)&&(ua(this,Wr,Hn(this,Er)),ua(this,Wi,Hn(this,el)),ua(this,Er,void 0),ua(this,el,void 0))}};Wr=new WeakMap;Wi=new WeakMap;Er=new WeakMap;el=new WeakMap;function z3(e){const a=e.window?e.window:typeof window<"u"?window:void 0,i=typeof a<"u"&&typeof a.document<"u"&&typeof a.document.createElement<"u";Me(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let l=e.hydrationRouteProperties||[],s=e.mapRouteProperties||T3,u=s;if(e.instrumentations){let j=e.instrumentations;u=D=>({...s(D),...m3(j.map(Q=>Q.route).filter(Boolean),D)})}let c={},d=new R3(jo(e.routes,u,void 0,c)),m=e.basename||"/";m.startsWith("/")||(m=`/${m}`);let p=e.dataStrategy||O3,b={...e.future},g=null,x=new Set,_=null,z=null,T=null,k=null,Z=e.hydrationData!=null,X=ta(d.activeRoutes,e.history.location,m,!1,d.branches),ne=!1,se=null,te,xe;if(X==null&&!e.patchRoutesOnNavigation){let j=$n(404,{pathname:e.history.location.pathname}),{matches:D,route:Q}=pu(d.activeRoutes);te=!0,xe=!te,X=D,se={[Q.id]:j}}else if(X&&!e.hydrationData&&Ka(X,d.activeRoutes,e.history.location.pathname).active&&(X=null),X)if(X.some(j=>j.route.lazy))te=!1,xe=!te;else if(!X.some(j=>Hh(j.route)))te=!0,xe=!te;else{let j=e.hydrationData?e.hydrationData.loaderData:null,D=e.hydrationData?e.hydrationData.errors:null,Q=X;if(D){let le=X.findIndex(oe=>D[oe.route.id]!==void 0);Q=Q.slice(0,le+1)}xe=!1,te=!0,Q.forEach(le=>{let oe=rx(le.route,j,D);xe=xe||oe.renderFallback,te=te&&!oe.shouldLoad})}else{te=!1,xe=!te,X=[];let j=Ka(null,d.activeRoutes,e.history.location.pathname);j.active&&j.matches&&(ne=!0,X=j.matches)}let O,w={historyAction:e.history.action,location:e.history.location,matches:X,initialized:te,renderFallback:xe,navigation:Od,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||se,fetchers:new Map,blockers:new Map},L="POP",H=null,F=!1,K,he=!1,me=new Map,W=null,N=!1,B=!1,ue=new Set,de=new Map,ce=0,R=-1,C=new Map,$=new Set,G=new Map,ie=new Map,fe=new Set,I=new Map,ge,be=null;function tt(){if(g=e.history.listen(({action:j,location:D,delta:Q})=>{if(ge){ge(),ge=void 0;return}_t(I.size===0||Q!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let le=Dr({currentLocation:w.location,nextLocation:D,historyAction:j});if(le&&Q!=null){let oe=new Promise(Se=>{ge=Se});e.history.go(Q*-1),xa(le,{state:"blocked",location:D,proceed(){xa(le,{state:"proceeding",proceed:void 0,reset:void 0,location:D}),oe.then(()=>e.history.go(Q))},reset(){let Se=new Map(w.block)DELIM" +R"DELIM(ers);Se.set(le,co),ut({blockers:Se})}}),H?.resolve(),H=null;return}return Qe(j,D)}),i){I3(a,me);let j=()=>J3(a,me);a.addEventListener("pagehide",j),W=()=>a.removeEventListener("pagehide",j)}return w.initialized||Qe("POP",w.location,{initialHydration:!0}),O}function dt(){g&&g(),W&&W(),x.clear(),K&&K.abort(),w.fetchers.forEach((j,D)=>ba(w.fetchers,D)),w.blockers.forEach((j,D)=>kr(D))}function xt(j){if(x.add(j),_){let{newErrors:D}=_;_=null,j(w,{deletedFetchers:[],newErrors:D,viewTransitionOpts:void 0,flushSync:!1})}return()=>x.delete(j)}function ut(j,D={}){j.matches&&(j.matches=j.matches.map(oe=>{let Se=c[oe.route.id],pe=oe.route;return pe.element!==Se.element||pe.errorElement!==Se.errorElement||pe.hydrateFallbackElement!==Se.hydrateFallbackElement?{...oe,route:Se}:oe})),w={...w,...j};let Q=[],le=[];w.fetchers.forEach((oe,Se)=>{oe.state==="idle"&&(fe.has(Se)?Q.push(Se):le.push(Se))}),fe.forEach(oe=>{!w.fetchers.has(oe)&&!de.has(oe)&&Q.push(oe)}),x.size===0&&(_={newErrors:j.errors??null}),[...x].forEach(oe=>oe(w,{deletedFetchers:Q,newErrors:j.errors??null,viewTransitionOpts:D.viewTransitionOpts,flushSync:D.flushSync===!0})),Q.forEach(oe=>ba(w.fetchers,oe)),le.forEach(oe=>w.fetchers.delete(oe))}function je(j,D,{flushSync:Q}={}){let le=w.actionData!=null&&w.navigation.formMethod!=null&&It(w.navigation.formMethod)&&w.navigation.state==="loading"&&j.state?._isRedirect!==!0,oe;D.actionData?Object.keys(D.actionData).length>0?oe=D.actionData:oe=null:le?oe=w.actionData:oe=null;let Se=D.loaderData?d0(w.loaderData,D.loaderData,D.matches||[],D.errors):w.loaderData,pe=w.blockers;pe.size>0&&(pe=new Map(pe),pe.forEach((Re,ke)=>pe.set(ke,co)));let ve=N?!1:pl(j,D.matches||w.matches),ye=F===!0||w.navigation.formMethod!=null&&It(w.navigation.formMethod)&&j.state?._isRedirect!==!0;d.commitHmrRoutes(),N||L==="POP"||(L==="PUSH"?e.history.push(j,j.state):L==="REPLACE"&&e.history.replace(j,j.state));let Te;if(L==="POP"){let Re=me.get(w.location.pathname);Re&&Re.has(j.pathname)?Te={currentLocation:w.location,nextLocation:j}:me.has(j.pathname)&&(Te={currentLocation:j,nextLocation:w.location})}else if(he){let Re=me.get(w.location.pathname);Re?Re.add(j.pathname):(Re=new Set([j.pathname]),me.set(w.location.pathname,Re)),Te={currentLocation:w.location,nextLocation:j}}ut({...D,actionData:oe,loaderData:Se,historyAction:L,location:j,initialized:!0,renderFallback:!1,navigation:Od,revalidation:"idle",restoreScrollPosition:ve,preventScrollReset:ye,blockers:pe},{viewTransitionOpts:Te,flushSync:Q===!0}),L="POP",F=!1,he=!1,N=!1,B=!1,H?.resolve(),H=null,be?.resolve(),be=null}async function Je(j,D){if(H?.resolve(),H=null,typeof j=="number"){H||(H=y0());let Ve=H.promise;return e.history.go(j),Ve}let Q=oh(w.location,w.matches,m,j,D?.fromRouteId,D?.relative),{path:le,submission:oe,error:Se}=a0(!1,Q,D),pe;D?.mask&&(pe={pathname:"",search:"",hash:"",...typeof D.mask=="string"?ma(D.mask):{...w.location.mask,...D.mask}});let ve=w.location,ye=Co(ve,le,D&&D.state,void 0,pe);ye={...ye,...e.history.encodeLocation(ye)};let Te=D&&D.replace!=null?D.replace:void 0,Re="PUSH";Te===!0?Re="REPLACE":Te===!1||oe!=null&&It(oe.formMethod)&&oe.formAction===w.location.pathname+w.location.search&&(Re="REPLACE");let ke=D&&"preventScrollReset"in D?D.preventScrollReset===!0:void 0,Ce=(D&&D.flushSync)===!0,Be=Dr({currentLocation:ve,nextLocation:ye,historyAction:Re});if(Be){xa(Be,{state:"blocked",location:ye,proceed(){xa(Be,{state:"proceeding",proceed:void 0,reset:void 0,location:ye}),Je(j,D)},reset(){let Ve=new Map(w.blockers);Ve.set(Be,co),ut({blockers:Ve})}});return}await Qe(Re,ye,{submission:oe,pendingError:Se,preventScrollReset:ke,replace:D&&D.replace,enableViewTransition:D&&D.viewTransition,flushSync:Ce,callSiteDefaultShouldRevalidate:D&&D.defaultShouldRevalidate})}function Ue(){be||(be=y0()),Ya(),ut({revalidation:"loading"});let j=be.promise;return w.navigation.state==="submitting"?j:w.navigation.state==="idle"?(Qe(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),j):(Qe(L||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:he===!0}),j)}async function Qe(j,D,Q){K&&K.abort(),K=null,L=j,N=(Q&&Q.startUninterruptedRevalidation)===!0,oc(w.location,w.matches),F=(Q&&Q.preventScrollReset)===!0,he=(Q&&Q.enableViewTransition)===!0;let le=d.activeRoutes,oe=Q?.initialHydration&&w.matches&&w.matches.length>0&&!ne?w.matches:ta(le,D,m,!1,d.branches),Se=(Q&&Q.flushSync)===!0;if(oe&&w.initialized&&!B&&Z3(w.location,D)&&!(Q&&Q.submission&&It(Q.submission.formMethod))){je(D,{matches:oe},{flushSync:Se});return}let pe=Ka(oe,le,D.pathname);if(pe.active&&pe.matches&&(oe=pe.matches),!oe){let{error:et,notFoundMatches:Fe,route:Et}=Gn(D.pathname);je(D,{matches:Fe,loaderData:{},errors:{[Et.id]:et}},{flushSync:Se});return}let ve=Q&&Q.overrideNavigation?{...Q.overrideNavigation,matches:oe,historyAction:j}:void 0;K=new AbortController;let ye=tl(e.history,D,K.signal,Q&&Q.submission),Te=e.getContext?await e.getContext():new Iv,Re;if(Q&&Q.pendingError)R)DELIM" +R"DELIM(e=[zr(oe).route.id,{type:"error",error:Q.pendingError}];else if(Q&&Q.submission&&It(Q.submission.formMethod)){let et=await An(ye,D,Q.submission,oe,j,Te,pe.active,Q&&Q.initialHydration===!0,{replace:Q.replace,flushSync:Se});if(et.shortCircuited)return;if(et.pendingActionResult){let[Fe,Et]=et.pendingActionResult;if(Tn(Et)&&No(Et.error)&&Et.error.status===404){K=null,je(D,{matches:et.matches,loaderData:{},errors:{[Fe]:Et.error}});return}}oe=et.matches||oe,Re=et.pendingActionResult,ve=Md(D,oe,j,Q.submission),Se=!1,pe.active=!1,ye=tl(e.history,ye.url,ye.signal)}let{shortCircuited:ke,matches:Ce,loaderData:Be,errors:Ve,workingFetchers:ht}=await ya(ye,D,oe,j,Te,pe.active,ve,Q&&Q.submission,Q&&Q.fetcherSubmission,Q&&Q.replace,Q&&Q.initialHydration===!0,Se,Re,Q&&Q.callSiteDefaultShouldRevalidate);ke||(K=null,je(D,{matches:Ce||oe,...h0(Re),loaderData:Be,errors:Ve,...ht?{fetchers:ht}:{}}))}async function An(j,D,Q,le,oe,Se,pe,ve,ye={}){Ya();let Te=V3(D,le,oe,Q);if(ut({navigation:Te},{flushSync:ye.flushSync===!0}),pe){let Ce=await aa(le,D.pathname,j.signal);if(Ce.type==="aborted")return{shortCircuited:!0};if(Ce.type==="error"){if(Ce.partialMatches.length===0){let{matches:Ve,route:ht}=pu(d.activeRoutes);return{matches:Ve,pendingActionResult:[ht.id,{type:"error",error:Ce.error}]}}let Be=zr(Ce.partialMatches).route.id;return{matches:Ce.partialMatches,pendingActionResult:[Be,{type:"error",error:Ce.error}]}}else if(Ce.matches)le=Ce.matches;else{let{notFoundMatches:Be,error:Ve,route:ht}=Gn(D.pathname);return{matches:Be,pendingActionResult:[ht.id,{type:"error",error:Ve}]}}}let Re,ke=Tu(le,D);if(!ke.route.action&&!ke.route.lazy)Re={type:"error",error:$n(405,{method:j.method,pathname:D.pathname,routeId:ke.route.id})};else{let Ce=il(u,c,j,D,le,ke,ve?[]:l,Se),Be=await Fa(j,D,Ce,Se,null);if(Re=Be[ke.route.id],!Re){for(let Ve of le)if(Be[Ve.route.id]){Re=Be[Ve.route.id];break}}if(j.signal.aborted)return{shortCircuited:!0}}if(ni(Re)){let Ce;return ye&&ye.replace!=null?Ce=ye.replace:Ce=u0(Re.response.headers.get("Location"),new URL(j.url),m,e.history)===w.location.pathname+w.location.search,await va(j,Re,!0,{submission:Q,replace:Ce}),{shortCircuited:!0}}if(Tn(Re)){let Ce=zr(le,ke.route.id);return(ye&&ye.replace)!==!0&&(L="PUSH"),{matches:le,pendingActionResult:[Ce.route.id,Re,ke.route.id]}}return{matches:le,pendingActionResult:[ke.route.id,Re]}}async function ya(j,D,Q,le,oe,Se,pe,ve,ye,Te,Re,ke,Ce,Be){let Ve=pe||Md(D,Q,le,ve),ht=ve||ye||p0(Ve),et=!N&&!Re;if(Se){if(et){let ct=Ut(Ce);ut({navigation:Ve,...ct!==void 0?{actionData:ct}:{}},{flushSync:ke})}let Ne=await aa(Q,D.pathname,j.signal);if(Ne.type==="aborted")return{shortCircuited:!0};if(Ne.type==="error"){if(Ne.partialMatches.length===0){let{matches:yn,route:Xn}=pu(d.activeRoutes);return{matches:yn,loaderData:{},errors:{[Xn.id]:Ne.error}}}let ct=zr(Ne.partialMatches).route.id;return{matches:Ne.partialMatches,loaderData:{},errors:{[ct]:Ne.error}}}else if(Ne.matches)Q=Ne.matches;else{let{error:ct,notFoundMatches:yn,route:Xn}=Gn(D.pathname);return{matches:yn,loaderData:{},errors:{[Xn.id]:ct}}}}let Fe=d.activeRoutes,{dsMatches:Et,revalidatingFetchers:Ye}=r0(j,oe,u,c,e.history,w,Q,ht,D,Re?[]:l,Re===!0,B,ue,fe,G,$,Fe,m,e.patchRoutesOnNavigation!=null,d.branches,Ce,Be);if(R=++ce,!e.dataStrategy&&!Et.some(Ne=>Ne.shouldLoad)&&!Et.some(Ne=>Ne.route.middleware&&Ne.route.middleware.length>0)&&Ye.length===0){let Ne=new Map(w.fetchers),ct=Go(Ne);return je(D,{matches:Q,loaderData:{},errors:Ce&&Tn(Ce[1])?{[Ce[0]]:Ce[1].error}:null,...h0(Ce),...ct?{fetchers:Ne}:{}},{flushSync:ke}),{shortCircuited:!0}}if(et){let Ne={};if(!Se){Ne.navigation=Ve;let ct=Ut(Ce);ct!==void 0&&(Ne.actionData=ct)}Ye.length>0&&(Ne.fetchers=ga(Ye)),ut(Ne,{flushSync:ke})}Ye.forEach(Ne=>{Ht(Ne.key),Ne.controller&&de.set(Ne.key,Ne.controller)});let Va=()=>Ye.forEach(Ne=>Ht(Ne.key));K&&K.signal.addEventListener("abort",Va);let{loaderResults:Kn,fetcherResults:on}=await ml(Et,Ye,j,D,oe);if(j.signal.aborted)return{shortCircuited:!0};K&&K.signal.removeEventListener("abort",Va),Ye.forEach(Ne=>de.delete(Ne.key));let en=yu(Kn);if(en)return await va(j,en.result,!0,{replace:Te}),{shortCircuited:!0};if(en=yu(on),en)return $.add(en.key),await va(j,en.result,!0,{replace:Te}),{shortCircuited:!0};let jn=new Map(w.fetchers),{loaderData:fi,errors:Vn}=f0(w,Q,Kn,Ce,Ye,on,jn);Re&&w.errors&&(Vn={...w.errors,...Vn});let di=Go(jn),Sa=Ko(R,jn),wa=di||Sa||Ye.length>0;return{matches:Q,loaderData:fi,errors:Vn,...wa?{workingFetchers:jn}:{}}}function Ut(j){if(j&&!Tn(j[1]))return{[j[0]]:j[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function ga(j){let D=new Map(w.fetchers);return j.forEach(Q=>{let le=D.get(Q.key),oe=fo(void 0,le?le.data:void 0);D.set(Q.key,oe)}),D}async function Mr(j,D,Q,le){Ht(j);let oe=(le&&le.flushSync)===!0,Se=d.activeRoutes,pe=oh(w.location,w.matches,m,Q,D,le?.relative),ve=ta(Se,pe,m,!1,d.branches),ye=Ka(ve,Se,pe);if(ye.active&&ye.matches&&(ve=ye.matches),!ve){Cn(j,D,$n(404,{pathname:pe}),{flushSyn)DELIM" +R"DELIM(c:oe});return}let{path:Te,submission:Re,error:ke}=a0(!0,pe,le);if(ke){Cn(j,D,ke,{flushSync:oe});return}let Ce=e.getContext?await e.getContext():new Iv,Be=(le&&le.preventScrollReset)===!0;if(Re&&It(Re.formMethod)){await hl(j,D,Te,ve,Ce,ye.active,oe,Be,Re,le&&le.defaultShouldRevalidate);return}G.set(j,{routeId:D,path:Te}),await Jt(j,D,Te,ve,Ce,ye.active,oe,Be,Re)}async function hl(j,D,Q,le,oe,Se,pe,ve,ye,Te){Ya(),G.delete(j);let Re=w.fetchers.get(j);Yn(j,X3(ye,Re),{flushSync:pe});let ke=new AbortController,Ce=tl(e.history,Q,ke.signal,ye);if(Se){let nt=await aa(le,new URL(Ce.url).pathname,Ce.signal,j);if(nt.type==="aborted")return;if(nt.type==="error"){Cn(j,D,nt.error,{flushSync:pe});return}else if(nt.matches)le=nt.matches;else{Cn(j,D,$n(404,{pathname:Q}),{flushSync:pe});return}}let Be=Tu(le,Q);if(!Be.route.action&&!Be.route.lazy){let nt=$n(405,{method:ye.formMethod,pathname:Q,routeId:D});Cn(j,D,nt,{flushSync:pe});return}de.set(j,ke);let Ve=ce,ht=il(u,c,Ce,Q,le,Be,l,oe),et=await Fa(Ce,Q,ht,oe,j),Fe=et[Be.route.id];if(!Fe){for(let nt of ht)if(et[nt.route.id]){Fe=et[nt.route.id];break}}if(Ce.signal.aborted){de.get(j)===ke&&de.delete(j);return}if(fe.has(j)){if(ni(Fe)||Tn(Fe)){Yn(j,fa(void 0));return}}else{if(ni(Fe))if(de.delete(j),R>Ve){Yn(j,fa(void 0));return}else return $.add(j),Yn(j,fo(ye)),va(Ce,Fe,!1,{fetcherSubmission:ye,preventScrollReset:ve});if(Tn(Fe)){Cn(j,D,Fe.error);return}}let Et=w.navigation.location||w.location,Ye=tl(e.history,Et,ke.signal),Va=d.activeRoutes,Kn=w.navigation.state!=="idle"?ta(Va,w.navigation.location,m,!1,d.branches):w.matches;Me(Kn,"Didn't find any matches after fetcher action");let on=++ce;C.set(j,on);let{dsMatches:en,revalidatingFetchers:jn}=r0(Ye,oe,u,c,e.history,w,Kn,ye,Et,l,!1,B,ue,fe,G,$,Va,m,e.patchRoutesOnNavigation!=null,d.branches,[Be.route.id,Fe],Te),fi=fo(ye,Fe.data),Vn=new Map(w.fetchers);Vn.set(j,fi),jn.filter(nt=>nt.key!==j).forEach(nt=>{let _a=nt.key,tn=Vn.get(_a),yl=fo(void 0,tn?tn.data:void 0);Vn.set(_a,yl),Ht(_a),nt.controller&&de.set(_a,nt.controller)}),ut({fetchers:Vn});let di=()=>jn.forEach(nt=>Ht(nt.key));ke.signal.addEventListener("abort",di);let{loaderResults:Sa,fetcherResults:wa}=await ml(en,jn,Ye,Et,oe);if(ke.signal.aborted)return;ke.signal.removeEventListener("abort",di),C.delete(j),de.delete(j),jn.forEach(nt=>de.delete(nt.key));let Ne=w.fetchers.has(j),ct=nt=>{if(!Ne)return nt;let _a=new Map(nt.fetchers);return _a.set(j,fa(Fe.data)),{...nt,fetchers:_a}},yn=yu(Sa);if(yn)return w=ct(w),va(Ye,yn.result,!1,{preventScrollReset:ve});if(yn=yu(wa),yn)return $.add(yn.key),w=ct(w),va(Ye,yn.result,!1,{preventScrollReset:ve});let Xn=new Map(w.fetchers);Ne&&Xn.set(j,fa(Fe.data));let{loaderData:hi,errors:mi}=f0(w,Kn,Sa,void 0,jn,wa,Xn);Ko(on,Xn),w.navigation.state==="loading"&&on>R?(Me(L,"Expected pending action"),K&&K.abort(),je(w.navigation.location,{matches:Kn,loaderData:hi,errors:mi,fetchers:Xn})):(ut({errors:mi,loaderData:d0(w.loaderData,hi,Kn,mi),fetchers:Xn}),B=!1)}async function Jt(j,D,Q,le,oe,Se,pe,ve,ye){let Te=w.fetchers.get(j);Yn(j,fo(ye,Te?Te.data:void 0),{flushSync:pe});let Re=new AbortController,ke=tl(e.history,Q,Re.signal);if(Se){let Fe=await aa(le,new URL(ke.url).pathname,ke.signal,j);if(Fe.type==="aborted")return;if(Fe.type==="error"){Cn(j,D,Fe.error,{flushSync:pe});return}else if(Fe.matches)le=Fe.matches;else{Cn(j,D,$n(404,{pathname:Q}),{flushSync:pe});return}}let Ce=Tu(le,Q);de.set(j,Re);let Be=ce,Ve=il(u,c,ke,Q,le,Ce,l,oe),ht=await Fa(ke,Q,Ve,oe,j),et=ht[Ce.route.id];if(!et){for(let Fe of le)if(ht[Fe.route.id]){et=ht[Fe.route.id];break}}if(de.get(j)===Re&&de.delete(j),!ke.signal.aborted){if(fe.has(j)){Yn(j,fa(void 0));return}if(ni(et))if(R>Be){Yn(j,fa(void 0));return}else{$.add(j),await va(ke,et,!1,{preventScrollReset:ve});return}if(Tn(et)){Cn(j,D,et.error);return}Yn(j,fa(et.data))}}async function va(j,D,Q,{submission:le,fetcherSubmission:oe,preventScrollReset:Se,replace:pe}={}){Q||(H?.resolve(),H=null),D.response.headers.has("X-Remix-Revalidate")&&(B=!0);let ve=D.response.headers.get("Location");Me(ve,"Expected a Location header on the redirect Response"),ve=u0(ve,new URL(j.url),m,e.history);let ye=Co(w.location,ve,{_isRedirect:!0});if(i){let Ve=!1;if(D.response.headers.has("X-Remix-Reload-Document"))Ve=!0;else if(Bh(ve)){const ht=Qb(a,ve,!0);Ve=ht.origin!==a.location.origin||qn(ht.pathname,m)==null}if(Ve){pe?a.location.replace(ve):a.location.assign(ve);return}}K=null;let Te=pe===!0||D.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Re,formAction:ke,formEncType:Ce}=w.navigation;!le&&!oe&&Re&&ke&&Ce&&(le=p0(w.navigation));let Be=le||oe;if(_3.has(D.response.status)&&Be&&It(Be.formMethod))await Qe(Te,ye,{submission:{...Be,formAction:ve},preventScrollReset:Se||F,enableViewTransition:Q?he:void 0});else{let Ve=Md(ye,[],Te,le);await Qe(Te,ye,{overrideNavigation:Ve,fetcherSubmission:oe,preventScrollReset:Se||F,enableViewTransition:Q?he:void 0})}}async function Fa(j,D,Q,le,oe){let Se,pe={};try{Se=await k3(p,j,D,Q,oe,le,!1)}catch(ve){)DELIM" +R"DELIM(return Q.filter(ye=>ye.shouldLoad).forEach(ye=>{pe[ye.route.id]={type:"error",error:ve}}),pe}if(j.signal.aborted)return pe;if(!It(j.method))for(let ve of Q){if(Se[ve.route.id]?.type==="error")break;!Se.hasOwnProperty(ve.route.id)&&!w.loaderData.hasOwnProperty(ve.route.id)&&(!w.errors||!w.errors.hasOwnProperty(ve.route.id))&&ve.shouldCallHandler()&&(Se[ve.route.id]={type:"error",result:new Error(`No result returned from dataStrategy for route ${ve.route.id}`)})}for(let[ve,ye]of Object.entries(Se))if(F3(ye)){let Te=ye.result;pe[ve]={type:"redirect",response:U3(Te,j,ve,Q,m)}}else pe[ve]=await B3(ye);return pe}async function ml(j,D,Q,le,oe){let Se=Fa(Q,le,j,oe,null),pe=Promise.all(D.map(async Te=>{if(Te.matches&&Te.match&&Te.request&&Te.controller){let ke=(await Fa(Te.request,Te.path,Te.matches,oe,Te.key))[Te.match.route.id];return{[Te.key]:ke}}else return Promise.resolve({[Te.key]:{type:"error",error:$n(404,{pathname:Te.path})}})})),ve=await Se,ye=(await pe).reduce((Te,Re)=>Object.assign(Te,Re),{});return{loaderResults:ve,fetcherResults:ye}}function Ya(){B=!0,G.forEach((j,D)=>{de.has(D)&&ue.add(D),Ht(D)})}function Yn(j,D,Q={}){let le=new Map(w.fetchers);le.set(j,D),ut({fetchers:le},{flushSync:(Q&&Q.flushSync)===!0})}function Cn(j,D,Q,le={}){let oe=zr(w.matches,D),Se=new Map(w.fetchers);ba(Se,j),ut({errors:{[oe.route.id]:Q},fetchers:Se},{flushSync:(le&&le.flushSync)===!0})}function rc(j){return ie.set(j,(ie.get(j)||0)+1),fe.has(j)&&fe.delete(j),w.fetchers.get(j)||E3}function ic(j,D){Ht(j,D?.reason),Yn(j,fa(null))}function ba(j,D){let Q=w.fetchers.get(D);de.has(D)&&!(Q&&Q.state==="loading"&&C.has(D))&&Ht(D),G.delete(D),C.delete(D),$.delete(D),fe.delete(D),ue.delete(D),j.delete(D)}function Wt(j){let D=(ie.get(j)||0)-1;D<=0?(ie.delete(j),fe.add(j)):ie.set(j,D),ut({fetchers:new Map(w.fetchers)})}function Ht(j,D){let Q=de.get(j);Q&&(Q.abort(D),de.delete(j))}function Gt(j,D){for(let Q of j){let le=D.get(Q);Me(le,`Expected fetcher: ${Q}`);let oe=fa(le.data);D.set(Q,oe)}}function Go(j){let D=[],Q=!1;for(let le of $){let oe=j.get(le);Me(oe,`Expected fetcher: ${le}`),oe.state==="loading"&&($.delete(le),D.push(le),Q=!0)}return Gt(D,j),Q}function Ko(j,D){let Q=[];for(let[le,oe]of C)if(oe0}function lc(j,D){let Q=w.blockers.get(j)||co;return I.get(j)!==D&&I.set(j,D),Q}function kr(j){w.blockers.delete(j),I.delete(j)}function xa(j,D){let Q=w.blockers.get(j)||co;Me(Q.state==="unblocked"&&D.state==="blocked"||Q.state==="blocked"&&D.state==="blocked"||Q.state==="blocked"&&D.state==="proceeding"||Q.state==="blocked"&&D.state==="unblocked"||Q.state==="proceeding"&&D.state==="unblocked",`Invalid blocker state transition: ${Q.state} -> ${D.state}`);let le=new Map(w.blockers);le.set(j,D),ut({blockers:le})}function Dr({currentLocation:j,nextLocation:D,historyAction:Q}){if(I.size===0)return;I.size>1&&_t(!1,"A router only supports one blocker at a time");let le=Array.from(I.entries()),[oe,Se]=le[le.length-1],pe=w.blockers.get(oe);if(!(pe&&pe.state==="proceeding")&&Se({currentLocation:j,nextLocation:D,historyAction:Q}))return oe}function Gn(j){let D=$n(404,{pathname:j}),Q=d.activeRoutes,{matches:le,route:oe}=pu(Q);return{notFoundMatches:le,route:oe,error:D}}function ci(j,D,Q){if(z=j,k=D,T=Q||null,!Z&&w.navigation===Od){Z=!0;let le=pl(w.location,w.matches);le!=null&&ut({restoreScrollPosition:le})}return()=>{z=null,k=null,T=null}}function Ga(j,D){return T&&T(j,D.map(le=>XR(le,w.loaderData)))||j.key}function oc(j,D){if(z&&k){let Q=Ga(j,D);z[Q]=k()}}function pl(j,D){if(z){let Q=Ga(j,D),le=z[Q];if(typeof le=="number")return le}return null}function Ka(j,D,Q){if(e.patchRoutesOnNavigation){let le=d.branches;if(j){if(Object.keys(j[0].params).length>0)return{active:!0,matches:ta(D,Q,m,!0,le)}}else return{active:!0,matches:ta(D,Q,m,!0,le)||[]}}return{active:!1,matches:null}}async function aa(j,D,Q,le){if(!e.patchRoutesOnNavigation)return{type:"success",matches:j};let oe=j;for(;;){let Se=c;try{await e.patchRoutesOnNavigation({signal:Q,path:D,matches:oe,fetcherKey:le,patch:(Te,Re)=>{Q.aborted||i0(Te,Re,d,Se,u,!1)}})}catch(Te){return{type:"error",error:Te,partialMatches:oe}}if(Q.aborted)return{type:"aborted"};let pe=d.branches,ve=ta(d.activeRoutes,D,m,!1,pe),ye=null;if(ve){if(Object.keys(ve[0].params).length===0)return{type:"success",matches:ve};if(ye=ta(d.activeRoutes,D,m,!0,pe),!(ye&&oe.lengthQ.route.id===D[le].route.id)}function Xo(j){c={},d.setHmrRoutes(jo(j,u,void 0,c))}function Io(j,D,Q=!1){i0(j,D,d,c,u,Q),d.hasHMRRoutes||ut({})}return O={get basename(){return m},get future(){return b},get state(){return w},get routes(){return d.stableRoutes},get branches(){return d.branches},get mani)DELIM" +R"DELIM(fest(){return c},get window(){return a},initialize:tt,subscribe:xt,enableScrollRestoration:ci,navigate:Je,fetch:Mr,revalidate:Ue,createHref:j=>e.history.createHref(j),encodeLocation:j=>e.history.encodeLocation(j),getFetcher:rc,resetFetcher:ic,deleteFetcher:Wt,dispose:dt,getBlocker:lc,deleteBlocker:kr,patchRoutes:Io,_internalFetchControllers:de,_internalSetRoutes:Xo,_internalSetStateDoNotUseOrYouWillBreakYourApp(j){ut(j)}},e.instrumentations&&(O=p3(O,e.instrumentations.map(j=>j.router).filter(Boolean))),O}function A3(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function oh(e,a,i,l,s,u){let c,d;if(s){c=[];for(let p of a)if(c.push(p),p.route.id===s){d=p;break}}else c=a,d=a[a.length-1];let m=Zo(l||".",Ju(c),qn(e.pathname,i)||e.pathname,u==="path");if(l==null&&(m.search=e.search,m.hash=e.hash),(l==null||l===""||l===".")&&d){let p=Zh(m.search);if(d.route.index&&!p)m.search=m.search?m.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&p){let b=new URLSearchParams(m.search),g=b.getAll("index");b.delete("index"),g.filter(_=>_).forEach(_=>b.append("index",_));let x=b.toString();m.search=x?`?${x}`:""}}return i!=="/"&&(m.pathname=s3({basename:i,pathname:m.pathname})),ha(m)}function a0(e,a,i){if(!i||!A3(i))return{path:a};if(i.formMethod&&!K3(i.formMethod))return{path:a,error:$n(405,{method:i.formMethod})};let l=()=>({path:a,error:$n(400,{type:"invalid-body"})}),u=(i.formMethod||"get").toUpperCase(),c=fx(a);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!It(u))return l();let g=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((x,[_,z])=>`${x}${_}=${z} +`,""):String(i.body);return{path:a,submission:{formMethod:u,formAction:c,formEncType:i.formEncType,formData:void 0,json:void 0,text:g}}}else if(i.formEncType==="application/json"){if(!It(u))return l();try{let g=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:a,submission:{formMethod:u,formAction:c,formEncType:i.formEncType,formData:void 0,json:g,text:void 0}}}catch{return l()}}}Me(typeof FormData=="function","FormData is not available in this environment");let d,m;if(i.formData)d=ch(i.formData),m=i.formData;else if(i.body instanceof FormData)d=ch(i.body),m=i.body;else if(i.body instanceof URLSearchParams)d=i.body,m=c0(d);else if(i.body==null)d=new URLSearchParams,m=new FormData;else try{d=new URLSearchParams(i.body),m=c0(d)}catch{return l()}let p={formMethod:u,formAction:c,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(It(p.formMethod))return{path:a,submission:p};let b=ma(a);return e&&b.search&&Zh(b.search)&&d.append("index",""),b.search=`?${d}`,{path:ha(b),submission:p}}function r0(e,a,i,l,s,u,c,d,m,p,b,g,x,_,z,T,k,Z,X,ne,se,te){let xe=se?Tn(se[1])?se[1].error:se[1].data:void 0,O=s.createURL(u.location),w=s.createURL(m),L;if(b&&u.errors){let N=Object.keys(u.errors)[0];L=c.findIndex(B=>B.route.id===N)}else if(se&&Tn(se[1])){let N=se[0];L=c.findIndex(B=>B.route.id===N)-1}let H=se?se[1].statusCode:void 0,F=H&&H>=400,K={currentUrl:O,currentParams:u.matches[0]?.params||{},nextUrl:w,nextParams:c[0].params,...d,actionResult:xe,actionStatus:H},he=Po(c),me=c.map((N,B)=>{let{route:ue}=N,de=null;if(L!=null&&B>L)de=!1;else if(ue.lazy)de=!0;else if(!Hh(ue))de=!1;else if(b){let{shouldLoad:$}=rx(ue,u.loaderData,u.errors);de=$}else C3(u.loaderData,u.matches[B],N)&&(de=!0);if(de!==null)return sh(i,l,e,m,he,N,p,a,de);let ce=!1;typeof te=="boolean"?ce=te:F?ce=!1:(g||O.pathname+O.search===w.pathname+w.search||O.search!==w.search||j3(u.matches[B],N))&&(ce=!0);let R={...K,defaultShouldRevalidate:ce},C=bo(N,R);return sh(i,l,e,m,he,N,p,a,C,R,te)}),W=[];return z.forEach((N,B)=>{if(b||!c.some(ie=>ie.route.id===N.routeId)||_.has(B))return;let ue=u.fetchers.get(B),de=ue&&ue.state!=="idle"&&ue.data===void 0,ce=ta(k,N.path,Z??"/",!1,ne);if(!ce){if(X&&de)return;W.push({key:B,routeId:N.routeId,path:N.path,matches:null,match:null,request:null,controller:null});return}if(T.has(B))return;let R=Tu(ce,N.path),C=new AbortController,$=tl(s,N.path,C.signal),G=null;if(x.has(B))x.delete(B),G=il(i,l,$,N.path,ce,R,p,a);else if(de)g&&(G=il(i,l,$,N.path,ce,R,p,a));else{let ie;typeof te=="boolean"?ie=te:F?ie=!1:ie=g;let fe={...K,defaultShouldRevalidate:ie};bo(R,fe)&&(G=il(i,l,$,N.path,ce,R,p,a,fe))}G&&W.push({key:B,routeId:N.routeId,path:N.path,matches:G,match:R,request:$,controller:C})}),{dsMatches:me,revalidatingFetchers:W}}function Hh(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function rx(e,a,i){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!Hh(e))return{shouldLoad:!1,renderFallback:!1};let l=a!=null&&e.id in a,s=i!=null&&i[e.id]!==void 0;if(!l&&s)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader=="function"&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!l};let u=!l&&!s;return{shouldLoad:u,renderFallback:u}}function C3(e,a,i){let l=!a||i.route.id!==a.rout)DELIM" +R"DELIM(e.id,s=!e.hasOwnProperty(i.route.id);return l||s}function j3(e,a){let i=e.route.path;return e.pathname!==a.pathname||i!=null&&i.endsWith("*")&&e.params["*"]!==a.params["*"]}function bo(e,a){if(e.route.shouldRevalidate){let i=e.route.shouldRevalidate(a);if(typeof i=="boolean")return i}return a.defaultShouldRevalidate}function i0(e,a,i,l,s,u){let c;if(e){let p=l[e];Me(p,`No route found to patch children into: routeId = ${e}`),p.children||(p.children=[]),c=p.children}else c=i.activeRoutes;let d=[],m=[];if(a.forEach(p=>{let b=c.find(g=>ix(p,g));b?m.push({existingRoute:b,newRoute:p}):d.push(p)}),d.length>0){let p=jo(d,s,[e||"_","patch",String(c?.length||"0")],l);c.push(...p)}if(u&&m.length>0)for(let p=0;pa.children?.some(s=>ix(i,s)))??!1:!1}var l0=new WeakMap,lx=({key:e,route:a,manifest:i,mapRouteProperties:l})=>{let s=i[a.id];if(Me(s,"No route found in manifest"),!s.lazy||typeof s.lazy!="object")return;let u=s.lazy[e];if(!u)return;let c=l0.get(s);c||(c={},l0.set(s,c));let d=c[e];if(d)return d;let m=(async()=>{let p=YR(e),g=s[e]!==void 0&&e!=="hasErrorBoundary";if(p)_t(!p,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),c[e]=Promise.resolve();else if(g)_t(!1,`Route "${s.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let x=await u();x!=null&&(Object.assign(s,{[e]:x}),Object.assign(s,l(s)))}typeof s.lazy=="object"&&(s.lazy[e]=void 0,Object.values(s.lazy).every(x=>x===void 0)&&(s.lazy=void 0))})();return c[e]=m,m},o0=new WeakMap;function N3(e,a,i,l,s){let u=i[e.id];if(Me(u,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let b=o0.get(u);if(b)return{lazyRoutePromise:b,lazyHandlerPromise:b};let g=(async()=>{Me(typeof e.lazy=="function","No lazy route function found");let x=await e.lazy(),_={};for(let z in x){let T=x[z];if(T===void 0)continue;let k=KR(z),X=u[z]!==void 0&&z!=="hasErrorBoundary";k?_t(!k,"Route property "+z+" is not a supported property to be returned from a lazy route function. This property will be ignored."):X?_t(!X,`Route "${u.id}" has a static property "${z}" defined but its lazy function is also returning a value for this property. The lazy route property "${z}" will be ignored.`):_[z]=T}Object.assign(u,_),Object.assign(u,{...l(u),lazy:void 0})})();return o0.set(u,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let c=Object.keys(e.lazy),d=[],m;for(let b of c){if(s&&s.includes(b))continue;let g=lx({key:b,route:e,manifest:i,mapRouteProperties:l});g&&(d.push(g),b===a&&(m=g))}let p=d.length>0?Promise.all(d).then(()=>{}):void 0;return p?.catch(()=>{}),m?.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:m}}async function s0(e){let a=e.matches.filter(s=>s.shouldLoad),i={};return(await Promise.all(a.map(s=>s.resolve()))).forEach((s,u)=>{i[a[u].route.id]=s}),i}async function O3(e){return e.matches.some(a=>a.route.middleware)?ox(e,()=>s0(e)):s0(e)}function ox(e,a){return M3(e,a,l=>{if(G3(l))throw l;return l},P3,i);function i(l,s,u){if(u)return Promise.resolve(Object.assign(u.value,{[s]:{type:"error",result:l}}));{let{matches:c}=e,d=Math.min(Math.max(c.findIndex(p=>p.route.id===s),0),Math.max(c.findIndex(p=>p.shouldCallHandler()),0)),m=zr(c,c[d].route.id).route.id;return Promise.resolve({[m]:{type:"error",result:l}})}}}async function M3(e,a,i,l,s){let{matches:u,...c}=e,d=u.flatMap(p=>p.route.middleware?p.route.middleware.map(b=>[p.route.id,b]):[]);return await sx(c,d,a,i,l,s)}async function sx(e,a,i,l,s,u,c=0){let{request:d}=e;if(d.signal.aborted)throw d.signal.reason??new Error(`Request aborted: ${d.method} ${d.url}`);let m=a[c];if(!m)return await i();let[p,b]=m,g,x=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await sx(e,a,i,l,s,u,c+1)},g.value}catch(_){return g={value:await u(_,p,g)},g.value}};try{let _=await b(e,x),z=_!=null?l(_):void 0;return s(z)?z:g?z??g.value:(g={value:await x()},g.value)}catch(_){return await u(_,p,g)}}function ux(e,a,i,l,s){let u=lx({key:"middleware",route:l.route,manifest:a,mapRouteProperties:e}),c=N3(l.route,It(i.method)?"action":"loader",a,e,s);return{middleware:u,route:c.lazyRoutePromise,handler:c.lazyHandlerPromise}}function sh(e,a,i,l,s,u,c,d,m,p=null,b){let g=!1,x=ux(e,a,i,u,c);return{...u,_lazyPromises:x,shouldLoad:m,shouldRevalidateArgs:p,shouldCallHandler(_){return g=!0,p?typeof b==")DELIM" +R"DELIM(boolean"?bo(u,{...p,defaultShouldRevalidate:b}):typeof _=="boolean"?bo(u,{...p,defaultShouldRevalidate:_}):bo(u,p):m},resolve(_){let{lazy:z,loader:T,middleware:k}=u.route,Z=g||m||_&&!It(i.method)&&(z||T),X=k&&k.length>0&&!T&&!z;return Z&&(It(i.method)||!X)?D3({request:i,path:l,pattern:s,match:u,lazyHandlerPromise:x?.handler,lazyRoutePromise:x?.route,handlerOverride:_,scopedContext:d}):Promise.resolve({type:"data",result:void 0})}}}function il(e,a,i,l,s,u,c,d,m=null){return s.map(p=>p.route.id!==u.route.id?{...p,shouldLoad:!1,shouldRevalidateArgs:m,shouldCallHandler:()=>!1,_lazyPromises:ux(e,a,i,p,c),resolve:()=>Promise.resolve({type:"data",result:void 0})}:sh(e,a,i,l,Po(s),p,c,d,!0,m))}async function k3(e,a,i,l,s,u,c){l.some(b=>b._lazyPromises?.middleware)&&await Promise.all(l.map(b=>b._lazyPromises?.middleware));let d={request:a,url:cx(a,i),pattern:Po(l),params:l[0].params,context:u,matches:l},p=await e({...d,fetcherKey:s,runClientMiddleware:b=>{let g=d;return ox(g,()=>b({...g,fetcherKey:s,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(l.flatMap(b=>[b._lazyPromises?.handler,b._lazyPromises?.route]))}catch{}return p}async function D3({request:e,path:a,pattern:i,match:l,lazyHandlerPromise:s,lazyRoutePromise:u,handlerOverride:c,scopedContext:d}){let m,p,b=It(e.method),g=b?"action":"loader",x=_=>{let z,T=new Promise((X,ne)=>z=ne);p=()=>z(),e.signal.addEventListener("abort",p);let k=X=>typeof _!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${g}" [routeId: ${l.route.id}]`)):_({request:e,url:cx(e,a),pattern:i,params:l.params,context:d},...X!==void 0?[X]:[]),Z=(async()=>{try{return{type:"data",result:await(c?c(ne=>k(ne)):k())}}catch(X){return{type:"error",result:X}}})();return Promise.race([Z,T])};try{let _=b?l.route.action:l.route.loader;if(s||u)if(_){let z,[T]=await Promise.all([x(_).catch(k=>{z=k}),s,u]);if(z!==void 0)throw z;m=T}else{await s;let z=b?l.route.action:l.route.loader;if(z)[m]=await Promise.all([x(z),u]);else if(g==="action"){let T=new URL(e.url),k=T.pathname+T.search;throw $n(405,{method:e.method,pathname:k,routeId:l.route.id})}else return{type:"data",result:void 0}}else if(_)m=await x(_);else{let z=new URL(e.url),T=z.pathname+z.search;throw $n(404,{pathname:T})}}catch(_){return{type:"error",result:_}}finally{p&&e.signal.removeEventListener("abort",p)}return m}async function L3(e){let a=e.headers.get("Content-Type");return a&&/\bapplication\/json\b/.test(a)?e.body==null?null:e.json():e.text()}async function B3(e){let{result:a,type:i}=e;if($h(a)){let l;try{l=await L3(a)}catch(s){return{type:"error",error:s}}return i==="error"?{type:"error",error:new qo(a.status,a.statusText,l),statusCode:a.status,headers:a.headers}:{type:"data",data:l,statusCode:a.status,headers:a.headers}}return i==="error"?m0(a)?a.data instanceof Error?{type:"error",error:a.data,statusCode:a.init?.status,headers:a.init?.headers?new Headers(a.init.headers):void 0}:{type:"error",error:q3(a),statusCode:No(a)?a.status:void 0,headers:a.init?.headers?new Headers(a.init.headers):void 0}:{type:"error",error:a,statusCode:No(a)?a.status:void 0}:m0(a)?{type:"data",data:a.data,statusCode:a.init?.status,headers:a.init?.headers?new Headers(a.init.headers):void 0}:{type:"data",data:a}}function U3(e,a,i,l,s){let u=e.headers.get("Location");if(Me(u,"Redirects returned/thrown from loaders/actions must have a Location header"),!Bh(u)){let c=l.slice(0,l.findIndex(d=>d.route.id===i)+1);u=oh(new URL(a.url),c,s,u),e.headers.set("Location",u)}return e}var H3=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function uh(e){try{return H3.includes(new URL(e).protocol)}catch{return!1}}function u0(e,a,i,l){if(Bh(e)){let s=e,u=Lh.test(s)?new URL(Pb(s,a.protocol)):new URL(s);if(uh(u.toString()))throw new Error("Invalid redirect location");let c=qn(u.pathname,i)!=null;if(u.origin===a.origin&&c)return Uh(u.pathname)+u.search+u.hash}try{let s=l.createURL(e);if(uh(s.toString()))throw new Error("Invalid redirect location")}catch{}return e}function tl(e,a,i,l){let s=e.createURL(fx(a)).toString(),u={signal:i};if(l&&It(l.formMethod)){let{formMethod:c,formEncType:d}=l;u.method=c.toUpperCase(),d==="application/json"?(u.headers=new Headers({"Content-Type":d}),u.body=JSON.stringify(l.json)):d==="text/plain"?u.body=l.text:d==="application/x-www-form-urlencoded"&&l.formData?u.body=ch(l.formData):u.body=l.formData}return new Request(s,u)}function cx(e,a){let i=new URL(e.url),l=typeof a=="string"?ma(a):a;if(i.pathname=l.pathname||"/",l.search){let s=new URLSearchParams(l.search),u=s.getAll("index");s.delete("index");for(let c of u.filter(Boolean))s.append("index",c);i.search=s.size?`?${s.toString()}`:""}else i.search="";return i.hash=l.hash||"",i}function ch(e){let a=new URLSearchParams;for(let[i,l]of e.entries())a.append(i,typeof l=="string"?l:l.name)DELIM" +R"DELIM();return a}function c0(e){let a=new FormData;for(let[i,l]of e.entries())a.append(i,l);return a}function $3(e,a,i,l=!1,s=!1){let u={},c=null,d,m=!1,p={},b=i&&Tn(i[1])?i[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in a))return;let x=g.route.id,_=a[x];if(Me(!ni(_),"Cannot handle redirect results in processLoaderData"),Tn(_)){let z=_.error;if(b!==void 0&&(z=b,b=void 0),c=c||{},s)c[x]=z;else{let T=zr(e,x);c[T.route.id]==null&&(c[T.route.id]=z)}l||(u[x]=ax),m||(m=!0,d=No(_.error)?_.error.status:500),_.headers&&(p[x]=_.headers)}else u[x]=_.data,_.statusCode&&_.statusCode!==200&&!m&&(d=_.statusCode),_.headers&&(p[x]=_.headers)}),b!==void 0&&i&&(c={[i[0]]:b},i[2]&&(u[i[2]]=void 0)),{loaderData:u,errors:c,statusCode:d||200,loaderHeaders:p}}function f0(e,a,i,l,s,u,c){let{loaderData:d,errors:m}=$3(a,i,l);return s.filter(p=>!p.matches||p.matches.some(b=>b.shouldLoad)).forEach(p=>{let{key:b,match:g,controller:x}=p;if(x&&x.signal.aborted)return;let _=u[b];if(Me(_,"Did not find corresponding fetcher result"),Tn(_)){let z=zr(e.matches,g?.route.id);m&&m[z.route.id]||(m={...m,[z.route.id]:_.error}),c.delete(b)}else if(ni(_))Me(!1,"Unhandled fetcher revalidation redirect");else{let z=fa(_.data);c.set(b,z)}}),{loaderData:d,errors:m}}function d0(e,a,i,l){let s=Object.entries(a).filter(([,u])=>u!==ax).reduce((u,[c,d])=>(u[c]=d,u),{});for(let u of i){let c=u.route.id;if(!a.hasOwnProperty(c)&&e.hasOwnProperty(c)&&u.route.loader&&(s[c]=e[c]),l&&l.hasOwnProperty(c))break}return s}function h0(e){return e?Tn(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function zr(e,a){return(a?e.slice(0,e.findIndex(l=>l.route.id===a)+1):[...e]).reverse().find(l=>l.route.hasErrorBoundary===!0)||e[0]}function pu(e){let a=e.length===1?e[0]:e.find(i=>i.index||!i.path||i.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:a}],route:a}}function $n(e,{pathname:a,routeId:i,method:l,type:s,message:u}={}){let c="Unknown Server Error",d="Unknown @remix-run/router error";return e===400?(c="Bad Request",l&&a&&i?d=`You made a ${l} request to "${a}" but did not provide a \`loader\` for route "${i}", so there is no way to handle the request.`:s==="invalid-body"&&(d="Unable to encode submission body")):e===403?(c="Forbidden",d=`Route "${i}" does not match URL "${a}"`):e===404?(c="Not Found",d=`No route matches URL "${a}"`):e===405&&(c="Method Not Allowed",l&&a&&i?d=`You made a ${l.toUpperCase()} request to "${a}" but did not provide an \`action\` for route "${i}", so there is no way to handle the request.`:l&&(d=`Invalid request method "${l.toUpperCase()}"`)),new qo(e||500,c,new Error(d),!0)}function yu(e){let a=Object.entries(e);for(let i=a.length-1;i>=0;i--){let[l,s]=a[i];if(ni(s))return{key:l,result:s}}}function fx(e){let a=typeof e=="string"?ma(e):e;return ha({...a,hash:""})}function Z3(e,a){return e.pathname!==a.pathname||e.search!==a.search?!1:e.hash===""?a.hash!=="":e.hash===a.hash?!0:a.hash!==""}function q3(e){return new qo(e.init?.status??500,e.init?.statusText??"Internal Server Error",e.data)}function P3(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([a,i])=>typeof a=="string"&&Q3(i))}function Q3(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function F3(e){return $h(e.result)&&tx.has(e.result.status)}function Tn(e){return e.type==="error"}function ni(e){return(e&&e.type)==="redirect"}function m0(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function $h(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Y3(e){return tx.has(e)}function G3(e){return $h(e)&&Y3(e.status)&&e.headers.has("Location")}function K3(e){return w3.has(e.toUpperCase())}function It(e){return x3.has(e.toUpperCase())}function Zh(e){return new URLSearchParams(e).getAll("index").some(a=>a==="")}function Tu(e,a){let i=typeof a=="string"?ma(a).search:a.search;if(e[e.length-1].route.index&&Zh(i||""))return e[e.length-1];let l=Xb(e);return l[l.length-1]}function p0(e){let{formMethod:a,formAction:i,formEncType:l,text:s,formData:u,json:c}=e;if(!(!a||!i||!l)){if(s!=null)return{formMethod:a,formAction:i,formEncType:l,formData:void 0,json:void 0,text:s};if(u!=null)return{formMethod:a,formAction:i,formEncType:l,formData:u,json:void 0,text:void 0};if(c!==void 0)return{formMethod:a,formAction:i,formEncType:l,formData:void 0,json:c,text:void 0}}}function Md(e,a,i,l){return l?{state:"loading",location:e,matches:a,historyAction:i,formMethod:l.formMethod,formAction:l.formAction,formEncType:l.formEncType,formData:l.formData,json:l.json,text:l.text}:{state:"loading",location:e,matches:a,historyAction:i,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function V3(e,a,i,l){return{state:"submitting",location:e,matches:a,historyAction:i,formMethod:l.formMethod,formAction:l.formAction,formEn)DELIM" +R"DELIM(cType:l.formEncType,formData:l.formData,json:l.json,text:l.text}}function fo(e,a){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:a}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:a}}function X3(e,a){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:a?a.data:void 0}}function fa(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function I3(e,a){try{let i=e.sessionStorage.getItem(nx);if(i){let l=JSON.parse(i);for(let[s,u]of Object.entries(l||{}))u&&Array.isArray(u)&&a.set(s,new Set(u||[]))}}catch{}}function J3(e,a){if(a.size>0){let i={};for(let[l,s]of a)i[l]=[...s];try{e.sessionStorage.setItem(nx,JSON.stringify(i))}catch(l){_t(!1,`Failed to save applied view transitions in sessionStorage (${l}).`)}}}function y0(){let e,a,i=new Promise((l,s)=>{e=async u=>{l(u);try{await i}catch{}},a=async u=>{s(u);try{await i}catch{}}});return{promise:i,resolve:e,reject:a}}var si=E.createContext(null);si.displayName="DataRouter";var Qo=E.createContext(null);Qo.displayName="DataRouterState";var dx=E.createContext(!1);function hx(){return E.useContext(dx)}var qh=E.createContext({isTransitioning:!1});qh.displayName="ViewTransition";var mx=E.createContext(new Map);mx.displayName="Fetchers";var W3=E.createContext(null);W3.displayName="Await";var Rn=E.createContext(null);Rn.displayName="Navigation";var Wu=E.createContext(null);Wu.displayName="Location";var Fn=E.createContext({outlet:null,matches:[],isDataRoute:!1});Fn.displayName="Route";var Ph=E.createContext(null);Ph.displayName="RouteError";var px="REACT_ROUTER_ERROR",ez="REDIRECT",tz="ROUTE_ERROR_RESPONSE";function nz(e){if(e.startsWith(`${px}:${ez}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function az(e){if(e.startsWith(`${px}:${tz}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new qo(a.status,a.statusText,a.data)}catch{}}function rz(e,{relative:a}={}){Me(fl(),"useHref() may be used only in the context of a component.");let{basename:i,navigator:l}=E.useContext(Rn),{hash:s,pathname:u,search:c}=Fo(e,{relative:a}),d=u;return i!=="/"&&(d=u==="/"?i:Zn([i,u])),l.createHref({pathname:d,search:c,hash:s})}function fl(){return E.useContext(Wu)!=null}function zn(){return Me(fl(),"useLocation() may be used only in the context of a component."),E.useContext(Wu).location}var yx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function gx(e){E.useContext(Rn).static||E.useLayoutEffect(e)}function pa(){let{isDataRoute:e}=E.useContext(Fn);return e?vz():iz()}function iz(){Me(fl(),"useNavigate() may be used only in the context of a component.");let e=E.useContext(si),{basename:a,navigator:i}=E.useContext(Rn),{matches:l}=E.useContext(Fn),{pathname:s}=zn(),u=JSON.stringify(Ju(l)),c=E.useRef(!1);return gx(()=>{c.current=!0}),E.useCallback((m,p={})=>{if(_t(c.current,yx),!c.current)return;if(typeof m=="number"){i.go(m);return}let b=Zo(m,JSON.parse(u),s,p.relative==="path");e==null&&a!=="/"&&(b.pathname=b.pathname==="/"?a:Zn([a,b.pathname])),(p.replace?i.replace:i.push)(b,p.state,p)},[a,i,u,s,e])}var lz=E.createContext(null);function oz(e){let a=E.useContext(Fn).outlet;return E.useMemo(()=>a&&E.createElement(lz.Provider,{value:e},a),[a,e])}function Qh(){let{matches:e}=E.useContext(Fn);return e[e.length-1]?.params??{}}function Fo(e,{relative:a}={}){let{matches:i}=E.useContext(Fn),{pathname:l}=zn(),s=JSON.stringify(Ju(i));return E.useMemo(()=>Zo(e,JSON.parse(s),l,a==="path"),[e,s,l,a])}function sz(e,a,i){Me(fl(),"useRoutes() may be used only in the context of a component.");let{navigator:l}=E.useContext(Rn),{matches:s}=E.useContext(Fn),u=s[s.length-1],c=u?u.params:{},d=u?u.pathname:"/",m=u?u.pathnameBase:"/",p=u&&u.route;{let k=p&&p.path||"";xx(d,!p||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant (or called \`useRoutes()\`) at "${d}" (under ) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. -Please change the parent to .`)}let b=zn(),g;g=b;let x=g.pathname||"/",_=x;if(m!=="/"){let k=m.replace(/^\//,"").split("/");_="/"+x.replace(/^\//,"").split("/").slice(k.length).join("/")}let R=i&&i.state.matches.length?i.state.matches.map(k=>Object.assign(k,{route:i.manifest[k.route.id]||k.route})):Qb(e,{pathname:_});return _t(p||R!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),_t(R==null||R[R.length-1].route.element!==void 0||R[R.length-1].route.Component!==void 0||R[R.length-1].route.lazy!==void 0,`Matche)DELIM" -R"DELIM(d leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an with a null value by default resulting in an "empty" page.`),dz(R&&R.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:Zn([m,l.encodeLocation?l.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?m:Zn([m,l.encodeLocation?l.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,i)}function sz(){let e=vx(),a=No(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=E.createElement(E.Fragment,null,E.createElement("p",null,"💿 Hey developer 👋"),E.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",E.createElement("code",{style:u},"ErrorBoundary")," or"," ",E.createElement("code",{style:u},"errorElement")," prop on your route.")),E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},a),i?E.createElement("pre",{style:s},i):null,c)}var uz=E.createElement(sz,null),gx=class extends E.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const i=nz(e.digest);i&&(e=i)}let a=e!==void 0?E.createElement(Fn.Provider,{value:this.props.routeContext},E.createElement(Ph.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?E.createElement(cz,{error:e},a):a}};gx.contextType=fx;var Dd=new WeakMap;function cz({children:e,error:a}){let{basename:i}=E.useContext(Rn);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=tz(a.digest);if(l){let s=Dd.get(a);if(s)throw s;let u=Ib(l.location,i),c=u.absoluteURL||u.to;if(ch(c))throw new Error("Invalid redirect location");if(Xb&&!Dd.get(a))if(u.isExternal||l.reloadDocument)window.location.href=c;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw Dd.set(a,d),d}return E.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c}`})}}return e}function fz({routeContext:e,match:a,children:i}){let l=E.useContext(si);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),E.createElement(Fn.Provider,{value:e},i)}function dz(e,a=[],i){let l=i?.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(a.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let s=e,u=l?.errors;if(u!=null){let b=s.findIndex(g=>g.route.id&&u?.[g.route.id]!==void 0);Me(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),s=s.slice(0,Math.min(s.length,b+1))}let c=!1,d=-1;if(i&&l){c=l.renderFallback;for(let b=0;b=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let m=i?.onError,p=l&&m?(b,g)=>{m(b,{location:l.location,params:l.matches?.[0]?.params??{},pattern:Po(l.matches),errorInfo:g})}:void 0;return s.reduceRight((b,g,x)=>{let _,R=!1,T=null,k=null;l&&(_=u&&g.route.id?u[g.route.id]:void 0,T=g.route.errorElement||uz,c&&(d<0&&x===0?(bx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),R=!0,k=null):d===x&&(R=!0,k=g.route.hydrateFallbackElement||null)));let Y=a.concat(s.slice(0,x+1)),X=()=>{let ne;return _?ne=T:R?ne=k:g.route.Component?ne=E.createElement(g.route.Component,null):g.route.element?ne=g.route.element:ne=b,E.createElement(fz,{match:g,routeContext:{outlet:b,matches:Y,isDataRoute:l!=null},children:ne})};return l&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?E.createElement(gx,{location:l.location,revalidation:l.revalidation,component:T,error:_,children:X(),routeContext:{outlet:null,matches:Y,isDataRoute:!0},onE)DELIM" -R"DELIM(rror:p}):X()},null)}function Fh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hz(e){let a=E.useContext(si);return Me(a,Fh(e)),a}function mz(e){let a=E.useContext(Qo);return Me(a,Fh(e)),a}function pz(e){let a=E.useContext(Fn);return Me(a,Fh(e)),a}function Yh(e){let a=pz(e),i=a.matches[a.matches.length-1];return Me(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function yz(){return Yh("useRouteId")}function vx(){let e=E.useContext(Ph),a=mz("useRouteError"),i=Yh("useRouteError");return e!==void 0?e:a.errors?.[i]}function gz(){let{router:e}=hz("useNavigate"),a=Yh("useNavigate"),i=E.useRef(!1);return yx(()=>{i.current=!0}),E.useCallback(async(s,u={})=>{_t(i.current,px),i.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:a,...u}))},[e,a])}var y0={};function bx(e,a,i){!a&&!y0[e]&&(y0[e]=!0,_t(!1,i))}var g0={};function v0(e,a){!e&&!g0[a]&&(g0[a]=!0,console.warn(a))}var vz="useOptimistic",b0=YS[vz],bz=()=>{};function xz(e){return b0?b0(e):[e,bz]}function Sz(e){let a={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&_t(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(a,{element:E.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&_t(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(a,{hydrateFallbackElement:E.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&_t(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(a,{errorElement:E.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),a}var wz=["HydrateFallback","hydrateFallbackElement"],_z=class{constructor(){this.status="pending",this.promise=new Promise((e,a)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",e(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",a(i))}})}};function Ez({router:e,flushSync:a,onError:i,useTransitions:l}){l=dx()||l;let[u,c]=E.useState(e.state),[d,m]=xz(u),[p,b]=E.useState(),[g,x]=E.useState({isTransitioning:!1}),[_,R]=E.useState(),[T,k]=E.useState(),[Y,X]=E.useState(),ne=E.useRef(new Map),se=E.useCallback((w,{deletedFetchers:L,newErrors:H,flushSync:Q,viewTransitionOpts:K})=>{H&&i&&Object.values(H).forEach(me=>i(me,{location:w.location,params:w.matches[0]?.params??{},pattern:Po(w.matches)})),w.fetchers.forEach((me,W)=>{me.data!==void 0&&ne.current.set(W,me.data)}),L.forEach(me=>ne.current.delete(me)),v0(Q===!1||a!=null,'You provided the `flushSync` option to a router update, but you are not using the `` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let he=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(v0(K==null||he,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!K||!he){a&&Q?a(()=>c(w)):l===!1?c(w):E.startTransition(()=>{l===!0&&m(me=>x0(me,w)),c(w)});return}if(a&&Q){a(()=>{T&&(_?.resolve(),T.skipTransition()),x({isTransitioning:!0,flushSync:!0,currentLocation:K.currentLocation,nextLocation:K.nextLocation})});let me=e.window.document.startViewTransition(()=>{a(()=>c(w))});me.finished.finally(()=>{a(()=>{R(void 0),k(void 0),b(void 0),x({isTransitioning:!1})})}),a(()=>k(me));return}T?(_?.resolve(),T.skipTransition(),X({state:w,currentLocation:K.currentLocation,nextLocation:K.nextLocation})):(b(w),x({isTransitioning:!0,flushSync:!1,currentLocation:K.currentLocation,nextLocation:K.nextLocation}))},[e.window,a,T,_,l,m,i]);E.useLayoutEffect(()=>e.subscribe(se),[e,se]),E.useEffect(()=>{g.isTransitioning&&!g.flushSync&&R(new _z)},[g]),E.useEffect(()=>{if(_&&p&&e.window){let w=p,L=_.promise,H=e.window.document.startViewTransition(async()=>{l===!1?c(w):E.startTransition(()=>{l===!0&&m(Q=>x0(Q,w)),c(w)}),await L});H.finished.finally(()=>{R(void 0),k(void 0),b(void 0),x({isTransitioning:!1})}),k(H)}},[p,_,e.window,l,m]),E.useEffect(()=>{_&&p&&d.location.key===p.location.key&&_.resolve()},[_,T,d.location,p]),E.useEffect(()=>{!g.isTransitioning&&Y&&(b(Y.state),x({isTransitioning:!0,flushSync:!1,currentLocation:Y.currentLocation,nextLocation:Y.nextLocation}),X(void 0))},[g.isTransitioning,Y]);let te=E.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:w=>e.navigate(w),push:(w,L,H)=>e.navigate(w,{state:L,preventScrollReset:H?.preventScrollReset}),replace:(w,L,H)=>e.navigate(w,{replace:!0,state:L,p)DELIM" -R"DELIM(reventScrollReset:H?.preventScrollReset})}),[e]),xe=e.basename||"/",O=E.useMemo(()=>({router:e,navigator:te,static:!1,basename:xe,onError:i}),[e,te,xe,i]);return E.createElement(E.Fragment,null,E.createElement(si.Provider,{value:O},E.createElement(Qo.Provider,{value:d},E.createElement(hx.Provider,{value:ne.current},E.createElement(qh.Provider,{value:g},E.createElement(Cz,{basename:xe,location:d.location,navigationType:d.historyAction,navigator:te,useTransitions:l},E.createElement(Tz,{routes:e.routes,manifest:e.manifest,future:e.future,state:d,isStatic:!1,onError:i})))))),null)}function x0(e,a){return{...e,navigation:a.navigation.state!=="idle"?a.navigation:e.navigation,revalidation:a.revalidation!=="idle"?a.revalidation:e.revalidation,actionData:a.navigation.state!=="submitting"?a.actionData:e.actionData,fetchers:a.fetchers}}var Tz=E.memo(Rz);function Rz({routes:e,manifest:a,future:i,state:l,isStatic:s,onError:u}){return oz(e,void 0,{manifest:a,state:l,isStatic:s,onError:u})}function zz({to:e,replace:a,state:i,relative:l}){Me(fl()," may be used only in the context of a component.");let{static:s}=E.useContext(Rn);_t(!s," must not be used on the initial render in a . This is a no-op, but you should modify your code so the is only ever rendered in response to some user interaction or state change.");let{matches:u}=E.useContext(Fn),{pathname:c}=zn(),d=pa(),m=Zo(e,Wu(u),c,l==="path"),p=JSON.stringify(m);return E.useEffect(()=>{d(JSON.parse(p),{replace:a,state:i,relative:l})},[d,p,l,a,i]),null}function Az(e){return lz(e.context)}function Dt(e){Me(!1,"A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .")}function Cz({basename:e="/",children:a=null,location:i,navigationType:l="POP",navigator:s,static:u=!1,useTransitions:c}){Me(!fl(),"You cannot render a inside another . You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),m=E.useMemo(()=>({basename:d,navigator:s,static:u,useTransitions:c,future:{}}),[d,s,u,c]);typeof i=="string"&&(i=ma(i));let{pathname:p="/",search:b="",hash:g="",state:x=null,key:_="default",mask:R}=i,T=E.useMemo(()=>{let k=qn(p,d);return k==null?null:{location:{pathname:k,search:b,hash:g,state:x,key:_,mask:R},navigationType:l}},[d,p,b,g,x,_,l,R]);return _t(T!=null,` is not able to match the URL "${p}${b}${g}" because it does not start with the basename, so the won't render anything.`),T==null?null:E.createElement(Rn.Provider,{value:m},E.createElement(ec.Provider,{children:a,value:T}))}function dh(e,a=[]){let i=[];return E.Children.forEach(e,(l,s)=>{if(!E.isValidElement(l))return;let u=[...a,s];if(l.type===E.Fragment){i.push.apply(i,dh(l.props.children,u));return}Me(l.type===Dt,`[${typeof l.type=="string"?l.type:l.type.name}] is not a component. All component children of must be a or `),Me(!l.props.index||!l.props.children,"An index route cannot have child routes.");let c={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(c.children=dh(l.props.children,u)),i.push(c)}),i}var jz=dh,zu="get",Au="application/x-www-form-urlencoded";function tc(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Nz(e){return tc(e)&&e.tagName.toLowerCase()==="button"}function Oz(e){return tc(e)&&e.tagName.toLowerCase()==="form"}function Mz(e){return tc(e)&&e.tagName.toLowerCase()==="input"}function kz(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Dz(e,a){return e.button===0&&(!a||a==="_self")&&!kz(e)}function hh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((a,i)=>{let l=e[i];return a.concat(Array.isArray(l)?l.map(s=>[i,s]):[[i,l]])},[]))}function Lz(e,a){let i=hh(e);return a&&a.forEach((l,s)=>{i.has(s)||a.getAll(s).forEach(u=>{i.append(s,u)})}),i}var gu=null;function Bz(){if(gu===null)try{new FormData(document.createElement("form"),0),gu=!1}catch{gu=!0}return gu}var Uz=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ld(e){return e!=null&&!Uz.has(e)?(_t(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${Au}"`),null):e}function Hz(e,a){let i,l,s,u,c;if(Oz(e)){let d=e.getAttribute("action");l=d?qn(d,a):null,i=e.getAttribute("method")||zu,s=Ld(e)DELIM" -R"DELIM(.getAttribute("enctype"))||Au,u=new FormData(e)}else if(Nz(e)||Mz(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a