@package-broker/ui 0.15.0 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,7 +10,7 @@ Error generating stack: `+c.message+`
|
|
|
10
10
|
|
|
11
11
|
Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}/*`}">.`)}let b=er(),x;if(t){let O=typeof t=="string"?Qa(t):t;ct(p==="/"||O.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${O.pathname}" was given in the \`location\` prop.`),x=O}else x=b;let S=x.pathname||"/",k=S;if(p!=="/"){let O=p.replace(/^\//,"").split("/");k="/"+S.replace(/^\//,"").split("/").slice(O.length).join("/")}let j=mS(e,{pathname:k});Tn(v||j!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Tn(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let $=gT(j&&j.map(O=>Object.assign({},O,{params:Object.assign({},m,O.params),pathname:jr([p,o.encodeLocation?o.encodeLocation(O.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathname]),pathnameBase:O.pathnameBase==="/"?p:jr([p,o.encodeLocation?o.encodeLocation(O.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:O.pathnameBase])})),u,i,l,n);return t&&$?C.createElement(So.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...x},navigationType:"POP"}},$):$}function dT(){let e=_T(),t=WO(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)",n={padding:"0.5rem",backgroundColor:l},o={padding:"2px 4px",backgroundColor:l},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:o},"ErrorBoundary")," or"," ",C.createElement("code",{style:o},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},t),i?C.createElement("pre",{style:n},i):null,u)}var mT=C.createElement(dT,null),zS=class extends C.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,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):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=sT(e.digest);i&&(e=i)}let t=e!==void 0?C.createElement(Wn.Provider,{value:this.props.routeContext},C.createElement(mp.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?C.createElement(hT,{error:e},t):t}};zS.contextType=nT;var wm=new WeakMap;function hT({children:e,error:t}){let{basename:i}=C.useContext(An);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let l=oT(t.digest);if(l){let n=wm.get(t);if(n)throw n;let o=xS(l.location,i);if(bS&&!wm.get(t))if(o.isExternal||l.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:l.replace}));throw wm.set(t,u),u}return C.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function pT({routeContext:e,match:t,children:i}){let l=C.useContext(Ka);return l&&l.static&&l.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(Wn.Provider,{value:e},i)}function gT(e,t=[],i=null,l=null,n=null){if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let o=e,u=i?.errors;if(u!=null){let p=o.findIndex(v=>v.route.id&&u?.[v.route.id]!==void 0);ct(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let f=!1,m=-1;if(i)for(let p=0;p<o.length;p++){let v=o[p];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(m=p),v.route.id){let{loaderData:b,errors:x}=i,S=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!x||x[v.route.id]===void 0);if(v.route.lazy||S){f=!0,m>=0?o=o.slice(0,m+1):o=[o[0]];break}}}let d=i&&l?(p,v)=>{l(p,{location:i.location,params:i.matches?.[0]?.params??{},unstable_pattern:eT(i.matches),errorInfo:v})}:void 0;return o.reduceRight((p,v,b)=>{let x,S=!1,k=null,j=null;i&&(x=u&&v.route.id?u[v.route.id]:void 0,k=v.route.errorElement||mT,f&&(m<0&&b===0?(NS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,j=null):m===b&&(S=!0,j=v.route.hydrateFallbackElement||null)));let $=t.concat(o.slice(0,b+1)),O=()=>{let N;return x?N=k:S?N=j:v.route.Component?N=C.createElement(v.route.Component,null):v.route.element?N=v.route.element:N=p,C.createElement(pT,{match:v,routeContext:{outlet:p,matches:$,isDataRoute:i!=null},children:N})};return i&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?C.createElement(zS,{location:i.location,revalidation:i.revalidation,component:k,error:x,children:O(),routeContext:{outlet:null,matches:$,isDataRoute:!0},onError:d}):O()},null)}function hp(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vT(e){let t=C.useContext(Ka);return ct(t,hp(e)),t}function yT(e){let t=C.useContext(Ju);return ct(t,hp(e)),t}function bT(e){let t=C.useContext(Wn);return ct(t,hp(e)),t}function pp(e){let t=bT(e),i=t.matches[t.matches.length-1];return ct(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function xT(){return pp("useRouteId")}function _T(){let e=C.useContext(mp),t=yT("useRouteError"),i=pp("useRouteError");return e!==void 0?e:t.errors?.[i]}function ST(){let{router:e}=vT("useNavigate"),t=pp("useNavigate"),i=C.useRef(!1);return $S(()=>{i.current=!0}),C.useCallback(async(n,o={})=>{Tn(i.current,wS),i.current&&(typeof n=="number"?await e.navigate(n):await e.navigate(n,{fromRouteId:t,...o}))},[e,t])}var Jx={};function NS(e,t,i){!t&&!Jx[e]&&(Jx[e]=!0,Tn(!1,i))}C.memo(kT);function kT({routes:e,future:t,state:i,onError:l}){return jS(e,void 0,i,l,t)}function $r(e){ct(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function wT({basename:e="/",children:t=null,location:i,navigationType:l="POP",navigator:n,static:o=!1,unstable_useTransitions:u}){ct(!ko(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=C.useMemo(()=>({basename:f,navigator:n,static:o,unstable_useTransitions:u,future:{}}),[f,n,o,u]);typeof i=="string"&&(i=Qa(i));let{pathname:d="/",search:p="",hash:v="",state:b=null,key:x="default"}=i,S=C.useMemo(()=>{let k=Nr(d,f);return k==null?null:{location:{pathname:k,search:p,hash:v,state:b,key:x},navigationType:l}},[f,d,p,v,b,x,l]);return Tn(S!=null,`<Router basename="${f}"> is not able to match the URL "${d}${p}${v}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:C.createElement(An.Provider,{value:m},C.createElement(So.Provider,{children:t,value:S}))}function Xx({children:e,location:t}){return fT(Lh(e),t)}function Lh(e,t=[]){let i=[];return C.Children.forEach(e,(l,n)=>{if(!C.isValidElement(l))return;let o=[...t,n];if(l.type===C.Fragment){i.push.apply(i,Lh(l.props.children,o));return}ct(l.type===$r,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ct(!l.props.index||!l.props.children,"An index route cannot have child routes.");let u={id:l.props.id||o.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&&(u.children=Lh(l.props.children,o)),i.push(u)}),i}var Ou="get",Tu="application/x-www-form-urlencoded";function Xu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $T(e){return Xu(e)&&e.tagName.toLowerCase()==="button"}function ET(e){return Xu(e)&&e.tagName.toLowerCase()==="form"}function jT(e){return Xu(e)&&e.tagName.toLowerCase()==="input"}function zT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function NT(e,t){return e.button===0&&(!t||t==="_self")&&!zT(e)}function Mh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,i)=>{let l=e[i];return t.concat(Array.isArray(l)?l.map(n=>[i,n]):[[i,l]])},[]))}function OT(e,t){let i=Mh(e);return t&&t.forEach((l,n)=>{i.has(n)||t.getAll(n).forEach(o=>{i.append(n,o)})}),i}var bu=null;function TT(){if(bu===null)try{new FormData(document.createElement("form"),0),bu=!1}catch{bu=!0}return bu}var CT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function $m(e){return e!=null&&!CT.has(e)?(Tn(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tu}"`),null):e}function DT(e,t){let i,l,n,o,u;if(ET(e)){let f=e.getAttribute("action");l=f?Nr(f,t):null,i=e.getAttribute("method")||Ou,n=$m(e.getAttribute("enctype"))||Tu,o=new FormData(e)}else if($T(e)||jT(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(l=m?Nr(m,t):null,i=e.getAttribute("formmethod")||f.getAttribute("method")||Ou,n=$m(e.getAttribute("formenctype"))||$m(f.getAttribute("enctype"))||Tu,o=new FormData(f,e),!TT()){let{name:d,type:p,value:v}=e;if(p==="image"){let b=d?`${d}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else d&&o.append(d,v)}}else{if(Xu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Ou,l=null,n=Tu,u=e}return o&&n==="text/plain"&&(u=o,o=void 0),{action:l,method:i.toLowerCase(),encType:n,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gp(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function AT(e,t,i){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return l.pathname==="/"?l.pathname=`_root.${i}`:t&&Nr(l.pathname,t)==="/"?l.pathname=`${t.replace(/\/$/,"")}/_root.${i}`:l.pathname=`${l.pathname.replace(/\/$/,"")}.${i}`,l}async function RT(e,t){if(e.id in t)return t[e.id];try{let i=await import(e.module);return t[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function IT(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function UT(e,t,i){let l=await Promise.all(e.map(async n=>{let o=t.routes[n.route.id];if(o){let u=await RT(o,i);return u.links?u.links():[]}return[]}));return ZT(l.flat(1).filter(IT).filter(n=>n.rel==="stylesheet"||n.rel==="preload").map(n=>n.rel==="stylesheet"?{...n,rel:"prefetch",as:"style"}:{...n,rel:"prefetch"}))}function Qx(e,t,i,l,n,o){let u=(m,d)=>i[d]?m.route.id!==i[d].route.id:!0,f=(m,d)=>i[d].pathname!==m.pathname||i[d].route.path?.endsWith("*")&&i[d].params["*"]!==m.params["*"];return o==="assets"?t.filter((m,d)=>u(m,d)||f(m,d)):o==="data"?t.filter((m,d)=>{let p=l.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(u(m,d)||f(m,d))return!0;if(m.route.shouldRevalidate){let v=m.route.shouldRevalidate({currentUrl:new URL(n.pathname+n.search+n.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function LT(e,t,{includeHydrateFallback:i}={}){return MT(e.map(l=>{let n=t.routes[l.route.id];if(!n)return[];let o=[n.module];return n.clientActionModule&&(o=o.concat(n.clientActionModule)),n.clientLoaderModule&&(o=o.concat(n.clientLoaderModule)),i&&n.hydrateFallbackModule&&(o=o.concat(n.hydrateFallbackModule)),n.imports&&(o=o.concat(n.imports)),o}).flat(1))}function MT(e){return[...new Set(e)]}function PT(e){let t={},i=Object.keys(e).sort();for(let l of i)t[l]=e[l];return t}function ZT(e,t){let i=new Set;return new Set(t),e.reduce((l,n)=>{let o=JSON.stringify(PT(n));return i.has(o)||(i.add(o),l.push({key:o,link:n})),l},[])}function OS(){let e=C.useContext(Ka);return gp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function qT(){let e=C.useContext(Ju);return gp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var vp=C.createContext(void 0);vp.displayName="FrameworkContext";function TS(){let e=C.useContext(vp);return gp(e,"You must render this element inside a <HydratedRouter> element"),e}function FT(e,t){let i=C.useContext(vp),[l,n]=C.useState(!1),[o,u]=C.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:d,onMouseLeave:p,onTouchStart:v}=t,b=C.useRef(null);C.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let k=$=>{$.forEach(O=>{u(O.isIntersecting)})},j=new IntersectionObserver(k,{threshold:.5});return b.current&&j.observe(b.current),()=>{j.disconnect()}}},[e]),C.useEffect(()=>{if(l){let k=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(k)}}},[l]);let x=()=>{n(!0)},S=()=>{n(!1),u(!1)};return i?e!=="intent"?[o,b,{}]:[o,b,{onFocus:to(f,x),onBlur:to(m,S),onMouseEnter:to(d,x),onMouseLeave:to(p,S),onTouchStart:to(v,x)}]:[!1,b,{}]}function to(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function BT({page:e,...t}){let{router:i}=OS(),l=C.useMemo(()=>mS(i.routes,e,i.basename),[i.routes,e,i.basename]);return l?C.createElement(GT,{page:e,matches:l,...t}):null}function HT(e){let{manifest:t,routeModules:i}=TS(),[l,n]=C.useState([]);return C.useEffect(()=>{let o=!1;return UT(e,t,i).then(u=>{o||n(u)}),()=>{o=!0}},[e,t,i]),l}function GT({page:e,matches:t,...i}){let l=er(),{manifest:n,routeModules:o}=TS(),{basename:u}=OS(),{loaderData:f,matches:m}=qT(),d=C.useMemo(()=>Qx(e,t,m,n,l,"data"),[e,t,m,n,l]),p=C.useMemo(()=>Qx(e,t,m,n,l,"assets"),[e,t,m,n,l]),v=C.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let S=new Set,k=!1;if(t.forEach($=>{let O=n.routes[$.route.id];!O||!O.hasLoader||(!d.some(N=>N.route.id===$.route.id)&&$.route.id in f&&o[$.route.id]?.shouldRevalidate||O.hasClientLoader?k=!0:S.add($.route.id))}),S.size===0)return[];let j=AT(e,u,"data");return k&&S.size>0&&j.searchParams.set("_routes",t.filter($=>S.has($.route.id)).map($=>$.route.id).join(",")),[j.pathname+j.search]},[u,f,l,n,d,t,e,o]),b=C.useMemo(()=>LT(p,n),[p,n]),x=HT(p);return C.createElement(C.Fragment,null,v.map(S=>C.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...i})),b.map(S=>C.createElement("link",{key:S,rel:"modulepreload",href:S,...i})),x.map(({key:S,link:k})=>C.createElement("link",{key:S,nonce:i.nonce,...k})))}function VT(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var YT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{YT&&(window.__reactRouterVersion="7.11.0")}catch{}function JT({basename:e,children:t,unstable_useTransitions:i,window:l}){let n=C.useRef();n.current==null&&(n.current=NO({window:l,v5Compat:!0}));let o=n.current,[u,f]=C.useState({action:o.action,location:o.location}),m=C.useCallback(d=>{i===!1?f(d):C.startTransition(()=>f(d))},[i]);return C.useLayoutEffect(()=>o.listen(m),[o,m]),C.createElement(wT,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,unstable_useTransitions:i})}var CS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Za=C.forwardRef(function({onClick:t,discover:i="render",prefetch:l="none",relative:n,reloadDocument:o,replace:u,state:f,target:m,to:d,preventScrollReset:p,viewTransition:v,unstable_defaultShouldRevalidate:b,...x},S){let{basename:k,unstable_useTransitions:j}=C.useContext(An),$=typeof d=="string"&&CS.test(d),O=xS(d,k);d=O.to;let N=uT(d,{relative:n}),[V,Q,I]=FT(l,x),B=KT(d,{replace:u,state:f,target:m,preventScrollReset:p,relative:n,viewTransition:v,unstable_defaultShouldRevalidate:b,unstable_useTransitions:j});function X(H){t&&t(H),H.defaultPrevented||B(H)}let le=C.createElement("a",{...x,...I,href:O.absoluteURL||N,onClick:O.isExternal||o?t:X,ref:VT(S,Q),target:m,"data-discover":!$&&i==="render"?"true":void 0});return V&&!$?C.createElement(C.Fragment,null,le,C.createElement(BT,{page:N})):le});Za.displayName="Link";var Ph=C.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:l="",end:n=!1,style:o,to:u,viewTransition:f,children:m,...d},p){let v=$o(u,{relative:d.relative}),b=er(),x=C.useContext(Ju),{navigator:S,basename:k}=C.useContext(An),j=x!=null&&i6(v)&&f===!0,$=S.encodeLocation?S.encodeLocation(v).pathname:v.pathname,O=b.pathname,N=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;i||(O=O.toLowerCase(),N=N?N.toLowerCase():null,$=$.toLowerCase()),N&&k&&(N=Nr(N,k)||N);const V=$!=="/"&&$.endsWith("/")?$.length-1:$.length;let Q=O===$||!n&&O.startsWith($)&&O.charAt(V)==="/",I=N!=null&&(N===$||!n&&N.startsWith($)&&N.charAt($.length)==="/"),B={isActive:Q,isPending:I,isTransitioning:j},X=Q?t:void 0,le;typeof l=="function"?le=l(B):le=[l,Q?"active":null,I?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let H=typeof o=="function"?o(B):o;return C.createElement(Za,{...d,"aria-current":X,className:le,ref:p,style:H,to:u,viewTransition:f},typeof m=="function"?m(B):m)});Ph.displayName="NavLink";var XT=C.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:l,replace:n,state:o,method:u=Ou,action:f,onSubmit:m,relative:d,preventScrollReset:p,viewTransition:v,unstable_defaultShouldRevalidate:b,...x},S)=>{let{unstable_useTransitions:k}=C.useContext(An),j=n6(),$=r6(f,{relative:d}),O=u.toLowerCase()==="get"?"get":"post",N=typeof f=="string"&&CS.test(f),V=Q=>{if(m&&m(Q),Q.defaultPrevented)return;Q.preventDefault();let I=Q.nativeEvent.submitter,B=I?.getAttribute("formmethod")||u,X=()=>j(I||Q.currentTarget,{fetcherKey:t,method:B,navigate:i,replace:n,state:o,relative:d,preventScrollReset:p,viewTransition:v,unstable_defaultShouldRevalidate:b});k&&i!==!1?C.startTransition(()=>X()):X()};return C.createElement("form",{ref:S,method:O,action:$,onSubmit:l?m:V,...x,"data-discover":!N&&e==="render"?"true":void 0})});XT.displayName="Form";function QT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function DS(e){let t=C.useContext(Ka);return ct(t,QT(e)),t}function KT(e,{target:t,replace:i,state:l,preventScrollReset:n,relative:o,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:m}={}){let d=wo(),p=er(),v=$o(e,{relative:o});return C.useCallback(b=>{if(NT(b,t)){b.preventDefault();let x=i!==void 0?i:fo(p)===fo(v),S=()=>d(e,{replace:x,state:l,preventScrollReset:n,relative:o,viewTransition:u,unstable_defaultShouldRevalidate:f});m?C.startTransition(()=>S()):S()}},[p,d,v,i,l,t,e,n,o,u,f,m])}function WT(e){Tn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=C.useRef(Mh(e)),i=C.useRef(!1),l=er(),n=C.useMemo(()=>OT(l.search,i.current?null:t.current),[l.search]),o=wo(),u=C.useCallback((f,m)=>{const d=Mh(typeof f=="function"?f(new URLSearchParams(n)):f);i.current=!0,o("?"+d,m)},[o,n]);return[n,u]}var e6=0,t6=()=>`__${String(++e6)}__`;function n6(){let{router:e}=DS("useSubmit"),{basename:t}=C.useContext(An),i=xT(),l=e.fetch,n=e.navigate;return C.useCallback(async(o,u={})=>{let{action:f,method:m,encType:d,formData:p,body:v}=DT(o,t);if(u.navigate===!1){let b=u.fetcherKey||t6();await l(b,i,u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:p,body:v,formMethod:u.method||m,formEncType:u.encType||d,flushSync:u.flushSync})}else await n(u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:p,body:v,formMethod:u.method||m,formEncType:u.encType||d,replace:u.replace,state:u.state,fromRouteId:i,flushSync:u.flushSync,viewTransition:u.viewTransition})},[l,n,t,i])}function r6(e,{relative:t}={}){let{basename:i}=C.useContext(An),l=C.useContext(Wn);ct(l,"useFormAction must be used inside a RouteContext");let[n]=l.matches.slice(-1),o={...$o(e||".",{relative:t})},u=er();if(e==null){o.search=u.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(p=>p==="")){f.delete("index"),m.filter(v=>v).forEach(v=>f.append("index",v));let p=f.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&n.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(o.pathname=o.pathname==="/"?i:jr([i,o.pathname])),fo(o)}function i6(e,{relative:t}={}){let i=C.useContext(SS);ct(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=DS("useViewTransitionState"),n=$o(e,{relative:t});if(!i.isTransitioning)return!1;let o=Nr(i.currentLocation.pathname,l)||i.currentLocation.pathname,u=Nr(i.nextLocation.pathname,l)||i.nextLocation.pathname;return Du(n.pathname,u)!=null||Du(n.pathname,o)!=null}var Wa=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(){}},a6={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l6=class{#e=a6;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Ci=new l6;function o6(e){setTimeout(e,0)}var Ri=typeof window>"u"||"Deno"in globalThis;function qt(){}function s6(e,t){return typeof e=="function"?e(t):e}function Zh(e){return typeof e=="number"&&e>=0&&e!==1/0}function AS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function li(e,t){return typeof e=="function"?e(t):e}function jn(e,t){return typeof e=="function"?e(t):e}function Kx(e,t){const{type:i="all",exact:l,fetchStatus:n,predicate:o,queryKey:u,stale:f}=e;if(u){if(l){if(t.queryHash!==yp(u,t.options))return!1}else if(!mo(t.queryKey,u))return!1}if(i!=="all"){const m=t.isActive();if(i==="active"&&!m||i==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||n&&n!==t.state.fetchStatus||o&&!o(t))}function Wx(e,t){const{exact:i,status:l,predicate:n,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(i){if(Ii(t.options.mutationKey)!==Ii(o))return!1}else if(!mo(t.options.mutationKey,o))return!1}return!(l&&t.state.status!==l||n&&!n(t))}function yp(e,t){return(t?.queryKeyHashFn||Ii)(e)}function Ii(e){return JSON.stringify(e,(t,i)=>qh(i)?Object.keys(i).sort().reduce((l,n)=>(l[n]=i[n],l),{}):i)}function mo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(i=>mo(e[i],t[i])):!1}var u6=Object.prototype.hasOwnProperty;function RS(e,t){if(e===t)return e;const i=e_(e)&&e_(t);if(!i&&!(qh(e)&&qh(t)))return t;const n=(i?e:Object.keys(e)).length,o=i?t:Object.keys(t),u=o.length,f=i?new Array(u):{};let m=0;for(let d=0;d<u;d++){const p=i?d:o[d],v=e[p],b=t[p];if(v===b){f[p]=v,(i?d<n:u6.call(e,p))&&m++;continue}if(v===null||b===null||typeof v!="object"||typeof b!="object"){f[p]=b;continue}const x=RS(v,b);f[p]=x,x===v&&m++}return n===u&&m===n?e:f}function Au(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(e[i]!==t[i])return!1;return!0}function e_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function qh(e){if(!t_(e))return!1;const t=e.constructor;if(t===void 0)return!0;const i=t.prototype;return!(!t_(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function t_(e){return Object.prototype.toString.call(e)==="[object Object]"}function c6(e){return new Promise(t=>{Ci.setTimeout(t,e)})}function Fh(e,t,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,t):i.structuralSharing!==!1?RS(e,t):t}function f6(e,t,i=0){const l=[...e,t];return i&&l.length>i?l.slice(1):l}function d6(e,t,i=0){const l=[t,...e];return i&&l.length>i?l.slice(0,-1):l}var bp=Symbol();function IS(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===bp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function xp(e,t){return typeof e=="function"?e(...t):!!e}function m6(e,t,i){let l=!1,n;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(n??=t(),l||(l=!0,n.aborted?i():n.addEventListener("abort",i,{once:!0})),n)}),e}var h6=class extends Wa{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Ri&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}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(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},_p=new h6;function Bh(){let e,t;const i=new Promise((n,o)=>{e=n,t=o});i.status="pending",i.catch(()=>{});function l(n){Object.assign(i,n),delete i.resolve,delete i.reject}return i.resolve=n=>{l({status:"fulfilled",value:n}),e(n)},i.reject=n=>{l({status:"rejected",reason:n}),t(n)},i}var p6=o6;function g6(){let e=[],t=0,i=f=>{f()},l=f=>{f()},n=p6;const o=f=>{t?e.push(f):n(()=>{i(f)})},u=()=>{const f=e;e=[],f.length&&n(()=>{l(()=>{f.forEach(m=>{i(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||u()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{i=f},setBatchNotifyFunction:f=>{l=f},setScheduler:f=>{n=f}}}var $t=g6(),v6=class extends Wa{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Ri&&window.addEventListener){const t=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",t),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&&(this.#e=e,this.listeners.forEach(i=>{i(e)}))}isOnline(){return this.#e}},Ru=new v6;function y6(e){return Math.min(1e3*2**e,3e4)}function US(e){return(e??"online")==="online"?Ru.isOnline():!0}var Hh=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function LS(e){let t=!1,i=0,l;const n=Bh(),o=()=>n.status!=="pending",u=k=>{if(!o()){const j=new Hh(k);b(j),e.onCancel?.(j)}},f=()=>{t=!0},m=()=>{t=!1},d=()=>_p.isFocused()&&(e.networkMode==="always"||Ru.isOnline())&&e.canRun(),p=()=>US(e.networkMode)&&e.canRun(),v=k=>{o()||(l?.(),n.resolve(k))},b=k=>{o()||(l?.(),n.reject(k))},x=()=>new Promise(k=>{l=j=>{(o()||d())&&k(j)},e.onPause?.()}).then(()=>{l=void 0,o()||e.onContinue?.()}),S=()=>{if(o())return;let k;const j=i===0?e.initialPromise:void 0;try{k=j??e.fn()}catch($){k=Promise.reject($)}Promise.resolve(k).then(v).catch($=>{if(o())return;const O=e.retry??(Ri?0:3),N=e.retryDelay??y6,V=typeof N=="function"?N(i,$):N,Q=O===!0||typeof O=="number"&&i<O||typeof O=="function"&&O(i,$);if(t||!Q){b($);return}i++,e.onFail?.(i,$),c6(V).then(()=>d()?void 0:x()).then(()=>{t?b($):S()})})};return{promise:n,status:()=>n.status,cancel:u,continue:()=>(l?.(),n),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?S():x().then(S),n)}}var MS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Zh(this.gcTime)&&(this.#e=Ci.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ri?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Ci.clearTimeout(this.#e),this.#e=void 0)}},b6=class extends MS{#e;#t;#n;#i;#r;#l;#o;constructor(e){super(),this.#o=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=r_(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#l,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=r_(this.options);t.data!==void 0&&(this.setState(n_(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const i=Fh(this.state.data,e,this.options);return this.#a({data:i,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),i}setState(e,t){this.#a({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(qt).catch(qt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>jn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===bp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>li(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:!AS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#o?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.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 f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const i=new AbortController,l=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#o=!0,i.signal)})},n=()=>{const f=IS(this.options,t),d=(()=>{const p={client:this.#i,queryKey:this.queryKey,meta:this.meta};return l(p),p})();return this.#o=!1,this.options.persister?this.options.persister(f,d,this):f(d)},u=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:n};return l(f),f})();this.options.behavior?.onFetch(u,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#a({type:"fetch",meta:u.fetchOptions?.meta}),this.#r=LS({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:f=>{f instanceof Hh&&f.revert&&this.setState({...this.#t,fetchStatus:"idle"}),i.abort()},onFail:(f,m)=>{this.#a({type:"failed",failureCount:f,error:m})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const f=await this.#r.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#n.config.onSuccess?.(f,this),this.#n.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof Hh){if(f.silent)return this.#r.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#a({type:"error",error:f}),this.#n.config.onError?.(f,this),this.#n.config.onSettled?.(this.state.data,f,this),f}finally{this.scheduleGc()}}#a(e){const t=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,...PS(i.data,this.options),fetchMeta:e.meta??null};case"success":const l={...i,...n_(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?l:void 0,l;case"error":const n=e.error;return{...i,error:n,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=t(this.state),$t.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function PS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:US(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function n_(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function r_(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,i=t!==void 0,l=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,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 x6=class extends Wa{constructor(e,t){super(),this.options=t,this.#e=e,this.#a=null,this.#o=Bh(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#i=void 0;#r;#l;#o;#a;#p;#d;#m;#u;#c;#s;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),i_(this.#t,this.options)?this.#f():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Gh(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Gh(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#_(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,i=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof jn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Au(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const l=this.hasListeners();l&&a_(this.#t,i,this.options,t)&&this.#f(),this.updateResult(),l&&(this.#t!==i||jn(this.options.enabled,this.#t)!==jn(t.enabled,this.#t)||li(this.options.staleTime,this.#t)!==li(t.staleTime,this.#t))&&this.#g();const n=this.#v();l&&(this.#t!==i||jn(this.options.enabled,this.#t)!==jn(t.enabled,this.#t)||n!==this.#s)&&this.#y(n)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(t,e);return S6(this,i)&&(this.#i=i,this.#l=this.options,this.#r=this.#t.state),i}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(i,l)=>(this.trackProp(l),t?.(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.#h.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),i=this.#e.getQueryCache().build(this.#e,t);return i.fetch().then(()=>this.createResult(i,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#f(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(qt)),t}#g(){this.#x();const e=li(this.options.staleTime,this.#t);if(Ri||this.#i.isStale||!Zh(e))return;const i=AS(this.#i.dataUpdatedAt,e)+1;this.#u=Ci.setTimeout(()=>{this.#i.isStale||this.updateResult()},i)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#_(),this.#s=e,!(Ri||jn(this.options.enabled,this.#t)===!1||!Zh(this.#s)||this.#s===0)&&(this.#c=Ci.setInterval(()=>{(this.options.refetchIntervalInBackground||_p.isFocused())&&this.#f()},this.#s))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#u&&(Ci.clearTimeout(this.#u),this.#u=void 0)}#_(){this.#c&&(Ci.clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const i=this.#t,l=this.options,n=this.#i,o=this.#r,u=this.#l,m=e!==i?e.state:this.#n,{state:d}=e;let p={...d},v=!1,b;if(t._optimisticResults){const X=this.hasListeners(),le=!X&&i_(e,t),H=X&&a_(e,i,t,l);(le||H)&&(p={...p,...PS(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:k}=p;b=p.data;let j=!1;if(t.placeholderData!==void 0&&b===void 0&&k==="pending"){let X;n?.isPlaceholderData&&t.placeholderData===u?.placeholderData?(X=n.data,j=!0):X=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,X!==void 0&&(k="success",b=Fh(n?.data,X,t),v=!0)}if(t.select&&b!==void 0&&!j)if(n&&b===o?.data&&t.select===this.#p)b=this.#d;else try{this.#p=t.select,b=t.select(b),b=Fh(n?.data,b,t),this.#d=b,this.#a=null}catch(X){this.#a=X}this.#a&&(x=this.#a,b=this.#d,S=Date.now(),k="error");const $=p.fetchStatus==="fetching",O=k==="pending",N=k==="error",V=O&&$,Q=b!==void 0,B={status:k,fetchStatus:p.fetchStatus,isPending:O,isSuccess:k==="success",isError:N,isInitialLoading:V,isLoading:V,data:b,dataUpdatedAt:p.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>m.dataUpdateCount||p.errorUpdateCount>m.errorUpdateCount,isFetching:$,isRefetching:$&&!O,isLoadingError:N&&!Q,isPaused:p.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:N&&Q,isStale:Sp(e,t),refetch:this.refetch,promise:this.#o,isEnabled:jn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const X=ue=>{B.status==="error"?ue.reject(B.error):B.data!==void 0&&ue.resolve(B.data)},le=()=>{const ue=this.#o=B.promise=Bh();X(ue)},H=this.#o;switch(H.status){case"pending":e.queryHash===i.queryHash&&X(H);break;case"fulfilled":(B.status==="error"||B.data!==H.value)&&le();break;case"rejected":(B.status!=="error"||B.error!==H.reason)&&le();break}}return B}updateResult(){const e=this.#i,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#l=this.options,this.#r.data!==void 0&&(this.#m=this.#t),Au(t,e))return;this.#i=t;const i=()=>{if(!e)return!0;const{notifyOnChangeProps:l}=this.options,n=typeof l=="function"?l():l;if(n==="all"||!n&&!this.#h.size)return!0;const o=new Set(n??this.#h);return this.options.throwOnError&&o.add("error"),Object.keys(this.#i).some(u=>{const f=u;return this.#i[f]!==e[f]&&o.has(f)})};this.#k({listeners:i()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){$t.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function _6(e,t){return jn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function i_(e,t){return _6(e,t)||e.state.data!==void 0&&Gh(e,t,t.refetchOnMount)}function Gh(e,t,i){if(jn(t.enabled,e)!==!1&&li(t.staleTime,e)!=="static"){const l=typeof i=="function"?i(e):i;return l==="always"||l!==!1&&Sp(e,t)}return!1}function a_(e,t,i,l){return(e!==t||jn(l.enabled,e)===!1)&&(!i.suspense||e.state.status!=="error")&&Sp(e,i)}function Sp(e,t){return jn(t.enabled,e)!==!1&&e.isStaleByTime(li(t.staleTime,e))}function S6(e,t){return!Au(e.getCurrentResult(),t)}function l_(e){return{onFetch:(t,i)=>{const l=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let f={pages:[],pageParams:[]},m=0;const d=async()=>{let p=!1;const v=S=>{m6(S,()=>t.signal,()=>p=!0)},b=IS(t.options,t.fetchOptions),x=async(S,k,j)=>{if(p)return Promise.reject();if(k==null&&S.pages.length)return Promise.resolve(S);const O=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:k,direction:j?"backward":"forward",meta:t.options.meta};return v(I),I})(),N=await b(O),{maxPages:V}=t.options,Q=j?d6:f6;return{pages:Q(S.pages,N,V),pageParams:Q(S.pageParams,k,V)}};if(n&&o.length){const S=n==="backward",k=S?k6:o_,j={pages:o,pageParams:u},$=k(l,j);f=await x(j,$,S)}else{const S=e??o.length;do{const k=m===0?u[0]??l.initialPageParam:o_(l,f);if(m>0&&k==null)break;f=await x(f,k),m++}while(m<S)}return f};t.options.persister?t.fetchFn=()=>t.options.persister?.(d,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},i):t.fetchFn=d}}}function o_(e,{pages:t,pageParams:i}){const l=t.length-1;return t.length>0?e.getNextPageParam(t[l],t,i[l],i):void 0}function k6(e,{pages:t,pageParams:i}){return t.length>0?e.getPreviousPageParam?.(t[0],t,i[0],i):void 0}var w6=class extends MS{#e;#t;#n;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ZS(),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(t=>t!==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.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=LS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(o,u)=>{this.#r({type:"failed",failureCount:o,error:u})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const l=this.state.status==="pending",n=!this.#i.canStart();try{if(l)t();else{this.#r({type:"pending",variables:e,isPaused:n}),await this.#n.config.onMutate?.(e,this,i);const u=await this.options.onMutate?.(e,i);u!==this.state.context&&this.#r({type:"pending",context:u,variables:e,isPaused:n})}const o=await this.#i.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,i),await this.options.onSuccess?.(o,e,this.state.context,i),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,i),await this.options.onSettled?.(o,null,e,this.state.context,i),this.#r({type:"success",data:o}),o}catch(o){try{await this.#n.config.onError?.(o,e,this.state.context,this,i)}catch(u){Promise.reject(u)}try{await this.options.onError?.(o,e,this.state.context,i)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,o,this.state.variables,this.state.context,this,i)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,o,e,this.state.context,i)}catch(u){Promise.reject(u)}throw this.#r({type:"error",error:o}),o}finally{this.#n.runNext(this)}}#r(e){const t=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=t(this.state),$t.batch(()=>{this.#t.forEach(i=>{i.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function ZS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var $6=class extends Wa{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,i){const l=new w6({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:i});return this.add(l),l}add(e){this.#e.add(e);const t=xu(e);if(typeof t=="string"){const i=this.#t.get(t);i?i.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=xu(e);if(typeof t=="string"){const i=this.#t.get(t);if(i)if(i.length>1){const l=i.indexOf(e);l!==-1&&i.splice(l,1)}else i[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=xu(e);if(typeof t=="string"){const l=this.#t.get(t)?.find(n=>n.state.status==="pending");return!l||l===e}else return!0}runNext(e){const t=xu(e);return typeof t=="string"?this.#t.get(t)?.find(l=>l!==e&&l.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){$t.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 t={exact:!0,...e};return this.getAll().find(i=>Wx(t,i))}findAll(e={}){return this.getAll().filter(t=>Wx(e,t))}notify(e){$t.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return $t.batch(()=>Promise.all(e.map(t=>t.continue().catch(qt))))}};function xu(e){return e.options.scope?.id}var E6=class extends Wa{#e;#t=void 0;#n;#i;constructor(t,i){super(),this.#e=t,this.setOptions(i),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const i=this.options;this.options=this.#e.defaultMutationOptions(t),Au(this.options,i)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),i?.mutationKey&&this.options.mutationKey&&Ii(i.mutationKey)!==Ii(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#l(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#l()}mutate(t,i){return this.#i=i,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??ZS();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#l(t){$t.batch(()=>{if(this.#i&&this.hasListeners()){const i=this.#t.variables,l=this.#t.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#i.onSuccess?.(t.data,i,l,n)}catch(o){Promise.reject(o)}try{this.#i.onSettled?.(t.data,null,i,l,n)}catch(o){Promise.reject(o)}}else if(t?.type==="error"){try{this.#i.onError?.(t.error,i,l,n)}catch(o){Promise.reject(o)}try{this.#i.onSettled?.(void 0,t.error,i,l,n)}catch(o){Promise.reject(o)}}}this.listeners.forEach(i=>{i(this.#t)})})}},j6=class extends Wa{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,i){const l=t.queryKey,n=t.queryHash??yp(l,t);let o=this.get(n);return o||(o=new b6({client:e,queryKey:l,queryHash:n,options:e.defaultQueryOptions(t),state:i,defaultOptions:e.getQueryDefaults(l)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){$t.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(i=>Kx(t,i))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(i=>Kx(e,i)):t}notify(e){$t.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){$t.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){$t.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},z6=class{#e;#t;#n;#i;#r;#l;#o;#a;constructor(e={}){this.#e=e.queryCache||new j6,this.#t=e.mutationCache||new $6,this.#n=e.defaultOptions||{},this.#i=new Map,this.#r=new Map,this.#l=0}mount(){this.#l++,this.#l===1&&(this.#o=_p.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Ru.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#l--,this.#l===0&&(this.#o?.(),this.#o=void 0,this.#a?.(),this.#a=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 t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),i=this.#e.build(this,t),l=i.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(li(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(l))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:i})=>{const l=i.data;return[t,l]})}setQueryData(e,t,i){const l=this.defaultQueryOptions({queryKey:e}),o=this.#e.get(l.queryHash)?.state.data,u=s6(t,o);if(u!==void 0)return this.#e.build(this,l).setData(u,{...i,manual:!0})}setQueriesData(e,t,i){return $t.batch(()=>this.#e.findAll(e).map(({queryKey:l})=>[l,this.setQueryData(l,t,i)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;$t.batch(()=>{t.findAll(e).forEach(i=>{t.remove(i)})})}resetQueries(e,t){const i=this.#e;return $t.batch(()=>(i.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const i={revert:!0,...t},l=$t.batch(()=>this.#e.findAll(e).map(n=>n.cancel(i)));return Promise.all(l).then(qt).catch(qt)}invalidateQueries(e,t={}){return $t.batch(()=>(this.#e.findAll(e).forEach(i=>{i.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const i={...t,cancelRefetch:t.cancelRefetch??!0},l=$t.batch(()=>this.#e.findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let o=n.fetch(void 0,i);return i.throwOnError||(o=o.catch(qt)),n.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(l).then(qt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const i=this.#e.build(this,t);return i.isStaleByTime(li(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(qt).catch(qt)}fetchInfiniteQuery(e){return e.behavior=l_(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qt).catch(qt)}ensureInfiniteQueryData(e){return e.behavior=l_(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ru.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,t){this.#i.set(Ii(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],i={};return t.forEach(l=>{mo(e,l.queryKey)&&Object.assign(i,l.defaultOptions)}),i}setMutationDefaults(e,t){this.#r.set(Ii(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],i={};return t.forEach(l=>{mo(e,l.mutationKey)&&Object.assign(i,l.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=yp(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===bp&&(t.enabled=!1),t}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()}},qS=C.createContext(void 0),qn=e=>{const t=C.useContext(qS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},N6=({client:e,children:t})=>(C.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(qS.Provider,{value:e,children:t})),FS=C.createContext(!1),O6=()=>C.useContext(FS);FS.Provider;function T6(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var C6=C.createContext(T6()),D6=()=>C.useContext(C6),A6=(e,t,i)=>{const l=i?.state.error&&typeof e.throwOnError=="function"?xp(e.throwOnError,[i.state.error,i]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||l)&&(t.isReset()||(e.retryOnMount=!1))},R6=e=>{C.useEffect(()=>{e.clearReset()},[e])},I6=({result:e,errorResetBoundary:t,throwOnError:i,query:l,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&l&&(n&&e.data===void 0||xp(i,[e.error,l])),U6=e=>{if(e.suspense){const i=n=>n==="static"?n:Math.max(n??1e3,1e3),l=e.staleTime;e.staleTime=typeof l=="function"?(...n)=>i(l(...n)):i(l),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},L6=(e,t)=>e.isLoading&&e.isFetching&&!t,M6=(e,t)=>e?.suspense&&t.isPending,s_=(e,t,i)=>t.fetchOptimistic(e).catch(()=>{i.clearReset()});function P6(e,t,i){const l=O6(),n=D6(),o=qn(),u=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const f=o.getQueryCache().get(u.queryHash);u._optimisticResults=l?"isRestoring":"optimistic",U6(u),A6(u,n,f),R6(n);const m=!o.getQueryCache().get(u.queryHash),[d]=C.useState(()=>new t(o,u)),p=d.getOptimisticResult(u),v=!l&&e.subscribed!==!1;if(C.useSyncExternalStore(C.useCallback(b=>{const x=v?d.subscribe($t.batchCalls(b)):qt;return d.updateResult(),x},[d,v]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),C.useEffect(()=>{d.setOptions(u)},[u,d]),M6(u,p))throw s_(u,d,n);if(I6({result:p,errorResetBoundary:n,throwOnError:u.throwOnError,query:f,suspense:u.suspense}))throw p.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(u,p),u.experimental_prefetchInRender&&!Ri&&L6(p,l)&&(m?s_(u,d,n):f?.promise)?.catch(qt).finally(()=>{d.updateResult()}),u.notifyOnChangeProps?p:d.trackResult(p)}function dn(e,t){return P6(e,x6)}function Cn(e,t){const i=qn(),[l]=C.useState(()=>new E6(i,e));C.useEffect(()=>{l.setOptions(e)},[l,e]);const n=C.useSyncExternalStore(C.useCallback(u=>l.subscribe($t.batchCalls(u)),[l]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),o=C.useCallback((u,f)=>{l.mutate(u,f).catch(qt)},[l]);if(n.error&&xp(l.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:o,mutateAsync:n.mutate}}const Z6=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q6=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,i,l)=>l?l.toUpperCase():i.toLowerCase()),u_=e=>{const t=q6(e);return t.charAt(0).toUpperCase()+t.slice(1)},BS=(...e)=>e.filter((t,i,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===i).join(" ").trim(),F6=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var B6={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const H6=C.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:n="",children:o,iconNode:u,...f},m)=>C.createElement("svg",{ref:m,...B6,width:t,height:t,stroke:e,strokeWidth:l?Number(i)*24/Number(t):i,className:BS("lucide",n),...!o&&!F6(f)&&{"aria-hidden":"true"},...f},[...u.map(([d,p])=>C.createElement(d,p)),...Array.isArray(o)?o:[o]]));const dt=(e,t)=>{const i=C.forwardRef(({className:l,...n},o)=>C.createElement(H6,{ref:o,iconNode:t,className:BS(`lucide-${Z6(u_(e))}`,`lucide-${e}`,l),...n}));return i.displayName=u_(e),i};const G6=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],V6=dt("chart-column",G6);const Y6=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],HS=dt("check",Y6);const J6=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],X6=dt("chevron-left",J6);const Q6=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],K6=dt("chevron-right",Q6);const W6=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],GS=dt("clipboard-list",W6);const eC=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],tC=dt("download",eC);const nC=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Vh=dt("heart",nC);const rC=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],iC=dt("info",rC);const aC=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],kp=dt("key",aC);const lC=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],oC=dt("log-out",lC);const sC=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],uC=dt("mail",sC);const cC=[["path",{d:"M12 3v6",key:"1holv5"}],["path",{d:"M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z",key:"187q7i"}],["path",{d:"M3.054 9.013h17.893",key:"grwhos"}]],fC=dt("package-2",cC);const dC=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Ui=dt("package",dC);const mC=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],hC=dt("pen",mC);const pC=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],gC=dt("save",pC);const vC=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Qu=dt("shield",vC);const yC=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],bC=dt("smartphone",yC);const xC=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],_C=dt("trash-2",xC);const SC=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],kC=dt("triangle-alert",SC);const wC=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],c_=dt("upload",wC);const $C=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],EC=dt("user-plus",$C);const jC=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Yh=dt("user",jC);const zC=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Li=dt("x",zC),Eo="/api",NC="composer_proxy_admin_token";function jo(){return typeof window<"u"?localStorage.getItem(NC):null}async function lt(e,t={}){const i=jo(),l={"Content-Type":"application/json",...t.headers};i&&(l.Authorization=`Bearer ${i}`);const n=await fetch(`${Eo}${e}`,{...t,headers:l});if(!n.ok){const o=await n.json().catch(()=>({message:"Unknown error"}));throw new Error(o.message||`HTTP ${n.status}`)}return n.json()}async function OC(){try{const t=await(await fetch(`${Eo}/auth/check`,{headers:{"Content-Type":"application/json"}})).json();return{authRequired:t.authRequired??!0,setupRequired:t.setupRequired??!1}}catch{return{authRequired:!0,setupRequired:!1}}}async function TC(e){return lt("/setup",{method:"POST",body:JSON.stringify(e)})}async function CC(){return lt("/stats")}async function VS(){return lt("/repositories")}async function DC(e){return lt("/repositories",{method:"POST",body:JSON.stringify(e)})}async function AC(e,t){return lt(`/repositories/${e}`,{method:"PUT",body:JSON.stringify(t)})}async function RC(e){return lt(`/repositories/${e}`,{method:"DELETE"})}async function IC(e){return lt(`/repositories/${e}/sync`,{method:"POST"})}async function UC(){return lt("/tokens")}async function LC(e){return lt("/tokens",{method:"POST",body:JSON.stringify(e)})}async function MC(e,t){return lt(`/tokens/${e}`,{method:"PATCH",body:JSON.stringify(t)})}async function PC(e){return lt(`/tokens/${e}`,{method:"DELETE"})}async function ZC(e){const t=new URLSearchParams;e?.search&&t.set("search",e.search),e?.page&&t.set("page",e.page.toString()),e?.limit&&t.set("limit",e.limit.toString());const i=t.toString();return lt(`/packages${i?`?${i}`:""}`)}async function qC(e){return lt(`/packages/${encodeURIComponent(e)}`)}async function FC(e){const t=jo(),i=new FormData;i.append("file",e);const l={};t&&(l.Authorization=`Bearer ${t}`);const n=await fetch(`${Eo}/packages/upload`,{method:"POST",headers:l,body:i});if(!n.ok){const o=await n.json().catch(()=>({message:"Upload failed"}));throw o.details&&o.details.length>0?new Error(`${o.message||"Upload failed"}
|
|
12
12
|
${o.details.join(`
|
|
13
|
-
`)}`):new Error(o.message||`HTTP ${n.status}`)}return n.json()}async function BC(e,t){const i=jo(),l={"Content-Type":"text/markdown"};i&&(l.Authorization=`Bearer ${i}`);const n=await fetch(`${Eo}/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}/readme`,{headers:l});if(!n.ok){if(n.status===404)return null;throw new Error(`HTTP ${n.status}`)}return n.text()}async function HC(e,t){const i=jo(),l={"Content-Type":"text/markdown"};i&&(l.Authorization=`Bearer ${i}`);const n=await fetch(`${Eo}/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog`,{headers:l});if(!n.ok){if(n.status===404)return null;throw new Error(`HTTP ${n.status}`)}return n.text()}async function GC(e,t){return lt(`/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}/stats`)}async function YS(e,t){return lt(`/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Ku(){return lt("/settings")}async function VC(e){return lt("/settings/packagist-mirroring",{method:"PUT",body:JSON.stringify({enabled:e})})}async function YC(e,t){return lt("/packages/add-from-mirror",{method:"POST",body:JSON.stringify({repository_id:e,package_names:t})})}async function JC(){return lt("/users").then(e=>e.users)}async function XC(e){return lt("/users",{method:"POST",body:JSON.stringify(e)})}async function QC(e){return lt(`/users/${e}`,{method:"DELETE"})}async function KC(){return lt("/auth/2fa/setup",{method:"POST"})}async function WC(e,t){return lt("/auth/2fa/enable",{method:"POST",body:JSON.stringify({secret:e,code:t})})}async function eD(){return lt("/auth/2fa/disable",{method:"POST"})}async function tD(e,t){return lt("/auth/invite/accept",{method:"POST",body:JSON.stringify({token:e,password:t})})}const f_="composer_proxy_sponsor_banner_dismissed";function nD(){const[e,t]=C.useState(!1);C.useEffect(()=>{if(typeof window<"u"){const l=localStorage.getItem(f_);t(l==="true")}},[]);const i=()=>{t(!0),typeof window<"u"&&localStorage.setItem(f_,"true")};return e?null:y.jsxs("div",{className:"relative bg-gradient-to-r from-pink-500/10 via-purple-500/10 to-pink-500/10 border border-pink-500/20 rounded-lg p-4 mb-6",children:[y.jsx("button",{onClick:i,className:"absolute top-2 right-2 text-slate-400 hover:text-slate-200 transition","aria-label":"Dismiss",children:y.jsx(Li,{className:"w-4 h-4"})}),y.jsx("div",{className:"pr-8",children:y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx(Vh,{className:"w-6 h-6 text-pink-400 fill-pink-400"}),y.jsxs("div",{className:"flex-1",children:[y.jsx("p",{className:"text-slate-200 font-medium mb-1",children:"Enjoying this project? Consider sponsoring!"}),y.jsx("p",{className:"text-slate-400 text-sm mb-3",children:"Built during evenings and weekends. Your support helps keep it going and funds new features, better docs, and faster bug fixes."}),y.jsxs("a",{href:"https://github.com/sponsors/lbajsarowicz",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700 text-white text-sm font-semibold rounded-lg shadow-lg shadow-pink-500/25 transition",children:[y.jsx(Vh,{className:"w-4 h-4 fill-current"}),y.jsx("span",{children:"Sponsor on GitHub"})]})]})]})})]})}function rD(){const{data:e,isLoading:t,error:i}=dn({queryKey:["stats"],queryFn:CC
|
|
13
|
+
`)}`):new Error(o.message||`HTTP ${n.status}`)}return n.json()}async function BC(e,t){const i=jo(),l={"Content-Type":"text/markdown"};i&&(l.Authorization=`Bearer ${i}`);const n=await fetch(`${Eo}/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}/readme`,{headers:l});if(!n.ok){if(n.status===404)return null;throw new Error(`HTTP ${n.status}`)}return n.text()}async function HC(e,t){const i=jo(),l={"Content-Type":"text/markdown"};i&&(l.Authorization=`Bearer ${i}`);const n=await fetch(`${Eo}/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}/changelog`,{headers:l});if(!n.ok){if(n.status===404)return null;throw new Error(`HTTP ${n.status}`)}return n.text()}async function GC(e,t){return lt(`/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}/stats`)}async function YS(e,t){return lt(`/packages/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:"DELETE"})}async function Ku(){return lt("/settings")}async function VC(e){return lt("/settings/packagist-mirroring",{method:"PUT",body:JSON.stringify({enabled:e})})}async function YC(e,t){return lt("/packages/add-from-mirror",{method:"POST",body:JSON.stringify({repository_id:e,package_names:t})})}async function JC(){return lt("/users").then(e=>e.users)}async function XC(e){return lt("/users",{method:"POST",body:JSON.stringify(e)})}async function QC(e){return lt(`/users/${e}`,{method:"DELETE"})}async function KC(){return lt("/auth/2fa/setup",{method:"POST"})}async function WC(e,t){return lt("/auth/2fa/enable",{method:"POST",body:JSON.stringify({secret:e,code:t})})}async function eD(){return lt("/auth/2fa/disable",{method:"POST"})}async function tD(e,t){return lt("/auth/invite/accept",{method:"POST",body:JSON.stringify({token:e,password:t})})}const f_="composer_proxy_sponsor_banner_dismissed";function nD(){const[e,t]=C.useState(!1);C.useEffect(()=>{if(typeof window<"u"){const l=localStorage.getItem(f_);t(l==="true")}},[]);const i=()=>{t(!0),typeof window<"u"&&localStorage.setItem(f_,"true")};return e?null:y.jsxs("div",{className:"relative bg-gradient-to-r from-pink-500/10 via-purple-500/10 to-pink-500/10 border border-pink-500/20 rounded-lg p-4 mb-6",children:[y.jsx("button",{onClick:i,className:"absolute top-2 right-2 text-slate-400 hover:text-slate-200 transition","aria-label":"Dismiss",children:y.jsx(Li,{className:"w-4 h-4"})}),y.jsx("div",{className:"pr-8",children:y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx(Vh,{className:"w-6 h-6 text-pink-400 fill-pink-400"}),y.jsxs("div",{className:"flex-1",children:[y.jsx("p",{className:"text-slate-200 font-medium mb-1",children:"Enjoying this project? Consider sponsoring!"}),y.jsx("p",{className:"text-slate-400 text-sm mb-3",children:"Built during evenings and weekends. Your support helps keep it going and funds new features, better docs, and faster bug fixes."}),y.jsxs("a",{href:"https://github.com/sponsors/lbajsarowicz",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-pink-500 to-purple-600 hover:from-pink-600 hover:to-purple-700 text-white text-sm font-semibold rounded-lg shadow-lg shadow-pink-500/25 transition",children:[y.jsx(Vh,{className:"w-4 h-4 fill-current"}),y.jsx("span",{children:"Sponsor on GitHub"})]})]})]})})]})}function rD(){const{data:e,isLoading:t,error:i}=dn({queryKey:["stats"],queryFn:CC}),l=[{title:"Active Repositories",value:e?.active_repos??0,icon:Ui,color:"from-primary-500 to-primary-700"},{title:"Cached Packages",value:e?.cached_packages??0,icon:GS,color:"from-accent-500 to-accent-700"},{title:"Total Downloads",value:e?.total_downloads??0,icon:tC,color:"from-emerald-500 to-emerald-700"}];return i?(console.error("Dashboard Error:",i),y.jsx("div",{className:"card p-6","data-testid":"dashboard-error",children:y.jsxs("p",{className:"text-red-400",children:["Error loading stats: ",i.message]})})):y.jsxs("div",{className:"space-y-8","data-testid":"dashboard-page",children:[y.jsxs("div",{children:[y.jsx("h2",{className:"font-display text-2xl font-bold text-slate-100 mb-2","data-testid":"dashboard-heading",children:"Dashboard"}),y.jsx("p",{className:"text-slate-400",children:"Overview of your Composer proxy"})]}),y.jsx(nD,{}),y.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6","data-testid":"stats-cards",children:l.map(n=>y.jsxs("div",{className:"card p-6","data-testid":`stat-card-${n.title.toLowerCase().replace(/\s+/g,"-")}`,children:[y.jsxs("div",{className:"flex items-center justify-between mb-4",children:[y.jsx("div",{className:`w-12 h-12 rounded-xl bg-gradient-to-br ${n.color} flex items-center justify-center shadow-lg`,children:y.jsx(n.icon,{className:"w-6 h-6 text-white"})}),t&&y.jsx("div",{className:"w-6 h-6 border-2 border-slate-600 border-t-primary-500 rounded-full animate-spin","aria-label":"Loading"})]}),y.jsx("p",{className:"text-slate-400 text-sm mb-1",children:n.title}),y.jsx("p",{className:"font-display text-3xl font-bold text-slate-100",children:t?"...":n.value.toLocaleString()})]},n.title))}),y.jsxs("div",{className:"card p-6","data-testid":"quick-start-section",children:[y.jsx("h3",{className:"font-display text-lg font-semibold text-slate-100 mb-4",children:"Quick Start"}),y.jsxs("div",{className:"space-y-4 text-slate-300",children:[y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"text-primary-400 font-bold",children:"1."}),y.jsxs("p",{children:["Add a ",y.jsx("strong",{children:"repository source"})," in the Repositories tab"]})]}),y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"text-primary-400 font-bold",children:"2."}),y.jsxs("p",{children:["Generate an ",y.jsx("strong",{children:"access token"})," in the Access Tokens tab"]})]}),y.jsxs("div",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"text-primary-400 font-bold",children:"3."}),y.jsxs("div",{className:"flex-1",children:[y.jsx("p",{className:"mb-3",children:"Configure your project to use this proxy:"}),y.jsxs("div",{className:"mb-4","data-testid":"composer-cli-config",children:[y.jsx("p",{className:"text-sm text-slate-400 mb-2",children:"Using Composer CLI:"}),y.jsx("pre",{className:"bg-slate-950 rounded-lg p-4 overflow-x-auto text-sm text-slate-300",children:y.jsxs("code",{"data-testid":"composer-cli-command",children:["composer config repositories.proxy composer ",window.location.origin]})})]}),y.jsxs("div",{"data-testid":"composer-json-config",children:[y.jsx("p",{className:"text-sm text-slate-400 mb-2",children:"Or manually edit composer.json:"}),y.jsx("pre",{className:"bg-slate-950 rounded-lg p-4 overflow-x-auto text-sm text-slate-300",children:y.jsx("code",{"data-testid":"composer-json-code",children:`{
|
|
14
14
|
"repositories": [
|
|
15
15
|
{
|
|
16
16
|
"type": "composer",
|
package/dist/index.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap"
|
|
12
12
|
rel="stylesheet" />
|
|
13
13
|
<script src="/config.js"></script>
|
|
14
|
-
<script type="module" crossorigin src="/assets/main-
|
|
14
|
+
<script type="module" crossorigin src="/assets/main-BKR79etI.js"></script>
|
|
15
15
|
<link rel="stylesheet" crossorigin href="/assets/main-BpU3tvCV.css">
|
|
16
16
|
</head>
|
|
17
17
|
|