Files
suaveplan/apps/testbed/storybook-static/assets/chunk-BAXFHI7N-BfS2osAj.js
2026-05-27 23:29:53 +01:00

4 lines
28 KiB
JavaScript

import{r as i}from"./index-DhY--VwN.js";function Ce(e={}){let{initialEntries:t=["/"],initialIndex:n,v5Compat:l=!1}=e,r;r=t.map((h,m)=>f(h,typeof h=="string"?null:h.state,m===0?"default":void 0));let a=o(n??r.length-1),s="POP",c=null;function o(h){return Math.min(Math.max(h,0),r.length-1)}function u(){return r[a]}function f(h,m=null,y){let w=Re(r?u().pathname:"/",h,m,y);return R(w.pathname.charAt(0)==="/",`relative pathnames are not supported in memory history: ${JSON.stringify(h)}`),w}function d(h){return typeof h=="string"?h:V(h)}return{get index(){return a},get action(){return s},get location(){return u()},createHref:d,createURL(h){return new URL(d(h),"http://localhost")},encodeLocation(h){let m=typeof h=="string"?I(h):h;return{pathname:m.pathname||"",search:m.search||"",hash:m.hash||""}},push(h,m){s="PUSH";let y=f(h,m);a+=1,r.splice(a,r.length,y),l&&c&&c({action:s,location:y,delta:1})},replace(h,m){s="REPLACE";let y=f(h,m);r[a]=y,l&&c&&c({action:s,location:y,delta:0})},go(h){s="POP";let m=o(a+h),y=r[m];a=m,c&&c({action:s,location:y,delta:h})},listen(h){return c=h,()=>{c=null}}}}function C(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function R(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ee(){return Math.random().toString(36).substring(2,10)}function Re(e,t,n=null,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?I(t):t,state:n,key:t&&t.key||l||Ee()}}function V({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function I(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let l=e.indexOf("?");l>=0&&(t.search=e.substring(l),e=e.substring(0,l)),e&&(t.pathname=e)}return t}function le(e,t,n="/"){return be(e,t,n,!1)}function be(e,t,n,l){let r=typeof t=="string"?I(t):t,a=S(r.pathname||"/",n);if(a==null)return null;let s=oe(e);Pe(s);let c=null;for(let o=0;c==null&&o<s.length;++o){let u=Ae(a);c=Te(s[o],u,l)}return c}function oe(e,t=[],n=[],l=""){let r=(a,s,c)=>{let o={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:s,route:a};o.relativePath.startsWith("/")&&(C(o.relativePath.startsWith(l),`Absolute route path "${o.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(l.length));let u=L([l,o.relativePath]),f=n.concat(o);a.children&&a.children.length>0&&(C(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${u}".`),oe(a.children,t,f,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:Ie(u,a.index),routesMeta:f})};return e.forEach((a,s)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))r(a,s);else for(let o of ie(a.path))r(a,s,o)}),t}function ie(e){let t=e.split("/");if(t.length===0)return[];let[n,...l]=t,r=n.endsWith("?"),a=n.replace(/\?$/,"");if(l.length===0)return r?[a,""]:[a];let s=ie(l.join("/")),c=[];return c.push(...s.map(o=>o===""?a:[a,o].join("/"))),r&&c.push(...s),c.map(o=>e.startsWith("/")&&o===""?"/":o)}function Pe(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ne(t.routesMeta.map(l=>l.childrenIndex),n.routesMeta.map(l=>l.childrenIndex)))}var Le=/^:[\w-]+$/,Se=3,ke=2,$e=1,Me=10,Fe=-2,ne=e=>e==="*";function Ie(e,t){let n=e.split("/"),l=n.length;return n.some(ne)&&(l+=Fe),t&&(l+=ke),n.filter(r=>!ne(r)).reduce((r,a)=>r+(Le.test(a)?Se:a===""?$e:Me),l)}function Ne(e,t){return e.length===t.length&&e.slice(0,-1).every((l,r)=>l===t[r])?e[e.length-1]-t[t.length-1]:0}function Te(e,t,n=!1){let{routesMeta:l}=e,r={},a="/",s=[];for(let c=0;c<l.length;++c){let o=l[c],u=c===l.length-1,f=a==="/"?t:t.slice(a.length)||"/",d=z({path:o.relativePath,caseSensitive:o.caseSensitive,end:u},f),p=o.route;if(!d&&u&&n&&!l[l.length-1].route.index&&(d=z({path:o.relativePath,caseSensitive:o.caseSensitive,end:!1},f)),!d)return null;Object.assign(r,d.params),s.push({params:r,pathname:L([a,d.pathname]),pathnameBase:We(L([a,d.pathnameBase])),route:p}),d.pathnameBase!=="/"&&(a=L([a,d.pathnameBase]))}return s}function z(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,l]=De(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let a=r[0],s=a.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:l.reduce((u,{paramName:f,isOptional:d},p)=>{if(f==="*"){let m=c[p]||"";s=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const h=c[p];return d&&!h?u[f]=void 0:u[f]=(h||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:s,pattern:e}}function De(e,t=!1,n=!0){R(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=[],r="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,c,o)=>(l.push({paramName:c,isOptional:o!=null}),o?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(l.push({paramName:"*"}),r+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":e!==""&&e!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),l]}function Ae(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return R(!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 (${t}).`),e}}function S(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,l=e.charAt(n);return l&&l!=="/"?null:e.slice(n)||"/"}function Oe(e,t="/"){let{pathname:n,search:l="",hash:r=""}=typeof e=="string"?I(e):e;return{pathname:n?n.startsWith("/")?n:Be(n,t):t,search:He(l),hash:_e(r)}}function Be(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function j(e,t,n,l){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ue(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ue(e){let t=Ue(e);return t.map((n,l)=>l===t.length-1?n.pathname:n.pathnameBase)}function se(e,t,n,l=!1){let r;typeof e=="string"?r=I(e):(r={...e},C(!r.pathname||!r.pathname.includes("?"),j("?","pathname","search",r)),C(!r.pathname||!r.pathname.includes("#"),j("#","pathname","hash",r)),C(!r.search||!r.search.includes("#"),j("#","search","hash",r)));let a=e===""||r.pathname==="",s=a?"/":r.pathname,c;if(s==null)c=n;else{let d=t.length-1;if(!l&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),d-=1;r.pathname=p.join("/")}c=d>=0?t[d]:"/"}let o=Oe(r,c),u=s&&s!=="/"&&s.endsWith("/"),f=(a||s===".")&&n.endsWith("/");return!o.pathname.endsWith("/")&&(u||f)&&(o.pathname+="/"),o}var L=e=>e.join("/").replace(/\/\/+/g,"/"),We=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),He=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_e=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Ve(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var ce=["POST","PUT","PATCH","DELETE"];new Set(ce);var ze=["GET",...ce];new Set(ze);var N=i.createContext(null);N.displayName="DataRouter";var J=i.createContext(null);J.displayName="DataRouterState";var fe=i.createContext({isTransitioning:!1});fe.displayName="ViewTransition";var Je=i.createContext(new Map);Je.displayName="Fetchers";var Ke=i.createContext(null);Ke.displayName="Await";var P=i.createContext(null);P.displayName="Navigation";var K=i.createContext(null);K.displayName="Location";var k=i.createContext({outlet:null,matches:[],isDataRoute:!1});k.displayName="Route";var G=i.createContext(null);G.displayName="RouteError";function Ye(e,{relative:t}={}){C(A(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:l}=i.useContext(P),{hash:r,pathname:a,search:s}=O(e,{relative:t}),c=a;return n!=="/"&&(c=a==="/"?n:L([n,a])),l.createHref({pathname:c,search:s,hash:r})}function A(){return i.useContext(K)!=null}function M(){return C(A(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(K).location}var he="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function de(e){i.useContext(P).static||i.useLayoutEffect(e)}function je(){let{isDataRoute:e}=i.useContext(k);return e?it():qe()}function qe(){C(A(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(N),{basename:t,navigator:n}=i.useContext(P),{matches:l}=i.useContext(k),{pathname:r}=M(),a=JSON.stringify(ue(l)),s=i.useRef(!1);return de(()=>{s.current=!0}),i.useCallback((o,u={})=>{if(R(s.current,he),!s.current)return;if(typeof o=="number"){n.go(o);return}let f=se(o,JSON.parse(a),r,u.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:L([t,f.pathname])),(u.replace?n.replace:n.push)(f,u.state,u)},[t,n,a,r,e])}i.createContext(null);function O(e,{relative:t}={}){let{matches:n}=i.useContext(k),{pathname:l}=M(),r=JSON.stringify(ue(n));return i.useMemo(()=>se(e,JSON.parse(r),l,t==="path"),[e,r,l,t])}function Ge(e,t,n,l){C(A(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r,static:a}=i.useContext(P),{matches:s}=i.useContext(k),c=s[s.length-1],o=c?c.params:{},u=c?c.pathname:"/",f=c?c.pathnameBase:"/",d=c&&c.route;{let v=d&&d.path||"";me(u,!d||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${v}">) 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 <Route path="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let p=M(),h;h=p;let m=h.pathname||"/",y=m;if(f!=="/"){let v=f.replace(/^\//,"").split("/");y="/"+m.replace(/^\//,"").split("/").slice(v.length).join("/")}let w=!a&&n&&n.matches&&n.matches.length>0?n.matches:le(e,{pathname:y});return R(d||w!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),R(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.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.`),tt(w&&w.map(v=>Object.assign({},v,{params:Object.assign({},o,v.params),pathname:L([f,r.encodeLocation?r.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?f:L([f,r.encodeLocation?r.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),s,n,l)}function Xe(){let e=ot(),t=Ve(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:l},a={padding:"2px 4px",backgroundColor:l},s=null;return console.error("Error handled by React Router default ErrorBoundary:",e),s=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:a},"ErrorBoundary")," or"," ",i.createElement("code",{style:a},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),n?i.createElement("pre",{style:r},n):null,s)}var Qe=i.createElement(Xe,null),Ze=class extends i.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){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?i.createElement(k.Provider,{value:this.props.routeContext},i.createElement(G.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function et({routeContext:e,match:t,children:n}){let l=i.useContext(N);return l&&l.static&&l.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(k.Provider,{value:e},n)}function tt(e,t=[],n=null,l=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let r=e,a=n==null?void 0:n.errors;if(a!=null){let o=r.findIndex(u=>u.route.id&&(a==null?void 0:a[u.route.id])!==void 0);C(o>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),r=r.slice(0,Math.min(r.length,o+1))}let s=!1,c=-1;if(n)for(let o=0;o<r.length;o++){let u=r[o];if((u.route.HydrateFallback||u.route.hydrateFallbackElement)&&(c=o),u.route.id){let{loaderData:f,errors:d}=n,p=u.route.loader&&!f.hasOwnProperty(u.route.id)&&(!d||d[u.route.id]===void 0);if(u.route.lazy||p){s=!0,c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}return r.reduceRight((o,u,f)=>{let d,p=!1,h=null,m=null;n&&(d=a&&u.route.id?a[u.route.id]:void 0,h=u.route.errorElement||Qe,s&&(c<0&&f===0?(me("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),p=!0,m=null):c===f&&(p=!0,m=u.route.hydrateFallbackElement||null)));let y=t.concat(r.slice(0,f+1)),w=()=>{let g;return d?g=h:p?g=m:u.route.Component?g=i.createElement(u.route.Component,null):u.route.element?g=u.route.element:g=o,i.createElement(et,{match:u,routeContext:{outlet:o,matches:y,isDataRoute:n!=null},children:g})};return n&&(u.route.ErrorBoundary||u.route.errorElement||f===0)?i.createElement(Ze,{location:n.location,revalidation:n.revalidation,component:h,error:d,children:w(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):w()},null)}function X(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nt(e){let t=i.useContext(N);return C(t,X(e)),t}function rt(e){let t=i.useContext(J);return C(t,X(e)),t}function at(e){let t=i.useContext(k);return C(t,X(e)),t}function Q(e){let t=at(e),n=t.matches[t.matches.length-1];return C(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lt(){return Q("useRouteId")}function ot(){var l;let e=i.useContext(G),t=rt("useRouteError"),n=Q("useRouteError");return e!==void 0?e:(l=t.errors)==null?void 0:l[n]}function it(){let{router:e}=nt("useNavigate"),t=Q("useNavigate"),n=i.useRef(!1);return de(()=>{n.current=!0}),i.useCallback(async(r,a={})=>{R(n.current,he),n.current&&(typeof r=="number"?e.navigate(r):await e.navigate(r,{fromRouteId:t,...a}))},[e,t])}var re={};function me(e,t,n){!t&&!re[e]&&(re[e]=!0,R(!1,n))}i.memo(ut);function ut({routes:e,future:t,state:n}){return Ge(e,void 0,n,t)}function Vt({basename:e,children:t,initialEntries:n,initialIndex:l}){let r=i.useRef();r.current==null&&(r.current=Ce({initialEntries:n,initialIndex:l,v5Compat:!0}));let a=r.current,[s,c]=i.useState({action:a.action,location:a.location}),o=i.useCallback(u=>{i.startTransition(()=>c(u))},[c]);return i.useLayoutEffect(()=>a.listen(o),[a,o]),i.createElement(st,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:a})}function st({basename:e="/",children:t=null,location:n,navigationType:l="POP",navigator:r,static:a=!1}){C(!A(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let s=e.replace(/^\/*/,"/"),c=i.useMemo(()=>({basename:s,navigator:r,static:a,future:{}}),[s,r,a]);typeof n=="string"&&(n=I(n));let{pathname:o="/",search:u="",hash:f="",state:d=null,key:p="default"}=n,h=i.useMemo(()=>{let m=S(o,s);return m==null?null:{location:{pathname:m,search:u,hash:f,state:d,key:p},navigationType:l}},[s,o,u,f,d,p,l]);return R(h!=null,`<Router basename="${s}"> is not able to match the URL "${o}${u}${f}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:i.createElement(P.Provider,{value:c},i.createElement(K.Provider,{children:t,value:h}))}var H="get",_="application/x-www-form-urlencoded";function Y(e){return e!=null&&typeof e.tagName=="string"}function ct(e){return Y(e)&&e.tagName.toLowerCase()==="button"}function ft(e){return Y(e)&&e.tagName.toLowerCase()==="form"}function ht(e){return Y(e)&&e.tagName.toLowerCase()==="input"}function dt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mt(e,t){return e.button===0&&(!t||t==="_self")&&!dt(e)}var W=null;function pt(){if(W===null)try{new FormData(document.createElement("form"),0),W=!1}catch{W=!0}return W}var gt=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function q(e){return e!=null&&!gt.has(e)?(R(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_}"`),null):e}function yt(e,t){let n,l,r,a,s;if(ft(e)){let c=e.getAttribute("action");l=c?S(c,t):null,n=e.getAttribute("method")||H,r=q(e.getAttribute("enctype"))||_,a=new FormData(e)}else if(ct(e)||ht(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let o=e.getAttribute("formaction")||c.getAttribute("action");if(l=o?S(o,t):null,n=e.getAttribute("formmethod")||c.getAttribute("method")||H,r=q(e.getAttribute("formenctype"))||q(c.getAttribute("enctype"))||_,a=new FormData(c,e),!pt()){let{name:u,type:f,value:d}=e;if(f==="image"){let p=u?`${u}.`:"";a.append(`${p}x`,"0"),a.append(`${p}y`,"0")}else u&&a.append(u,d)}}else{if(Y(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=H,l=null,r=_,s=e}return a&&r==="text/plain"&&(s=a,a=void 0),{action:l,method:n.toLowerCase(),encType:r,formData:a,body:s}}function Z(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}async function vt(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function wt(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 xt(e,t,n){let l=await Promise.all(e.map(async r=>{let a=t.routes[r.route.id];if(a){let s=await vt(a,n);return s.links?s.links():[]}return[]}));return bt(l.flat(1).filter(wt).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function ae(e,t,n,l,r,a){let s=(o,u)=>n[u]?o.route.id!==n[u].route.id:!0,c=(o,u)=>{var f;return n[u].pathname!==o.pathname||((f=n[u].route.path)==null?void 0:f.endsWith("*"))&&n[u].params["*"]!==o.params["*"]};return a==="assets"?t.filter((o,u)=>s(o,u)||c(o,u)):a==="data"?t.filter((o,u)=>{var d;let f=l.routes[o.route.id];if(!f||!f.hasLoader)return!1;if(s(o,u)||c(o,u))return!0;if(o.route.shouldRevalidate){let p=o.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:((d=n[0])==null?void 0:d.params)||{},nextUrl:new URL(e,window.origin),nextParams:o.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function Ct(e,t,{includeHydrateFallback:n}={}){return Et(e.map(l=>{let r=t.routes[l.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1))}function Et(e){return[...new Set(e)]}function Rt(e){let t={},n=Object.keys(e).sort();for(let l of n)t[l]=e[l];return t}function bt(e,t){let n=new Set;return new Set(t),e.reduce((l,r)=>{let a=JSON.stringify(Rt(r));return n.has(a)||(n.add(a),l.push({key:a,link:r})),l},[])}var Pt=new Set([100,101,204,205]);function Lt(e,t){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname="_root.data":t&&S(n.pathname,t)==="/"?n.pathname=`${t.replace(/\/$/,"")}/_root.data`:n.pathname=`${n.pathname.replace(/\/$/,"")}.data`,n}function pe(){let e=i.useContext(N);return Z(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function St(){let e=i.useContext(J);return Z(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ee=i.createContext(void 0);ee.displayName="FrameworkContext";function ge(){let e=i.useContext(ee);return Z(e,"You must render this element inside a <HydratedRouter> element"),e}function kt(e,t){let n=i.useContext(ee),[l,r]=i.useState(!1),[a,s]=i.useState(!1),{onFocus:c,onBlur:o,onMouseEnter:u,onMouseLeave:f,onTouchStart:d}=t,p=i.useRef(null);i.useEffect(()=>{if(e==="render"&&s(!0),e==="viewport"){let y=g=>{g.forEach(v=>{s(v.isIntersecting)})},w=new IntersectionObserver(y,{threshold:.5});return p.current&&w.observe(p.current),()=>{w.disconnect()}}},[e]),i.useEffect(()=>{if(l){let y=setTimeout(()=>{s(!0)},100);return()=>{clearTimeout(y)}}},[l]);let h=()=>{r(!0)},m=()=>{r(!1),s(!1)};return n?e!=="intent"?[a,p,{}]:[a,p,{onFocus:D(c,h),onBlur:D(o,m),onMouseEnter:D(u,h),onMouseLeave:D(f,m),onTouchStart:D(d,h)}]:[!1,p,{}]}function D(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $t({page:e,...t}){let{router:n}=pe(),l=i.useMemo(()=>le(n.routes,e,n.basename),[n.routes,e,n.basename]);return l?i.createElement(Ft,{page:e,matches:l,...t}):null}function Mt(e){let{manifest:t,routeModules:n}=ge(),[l,r]=i.useState([]);return i.useEffect(()=>{let a=!1;return xt(e,t,n).then(s=>{a||r(s)}),()=>{a=!0}},[e,t,n]),l}function Ft({page:e,matches:t,...n}){let l=M(),{manifest:r,routeModules:a}=ge(),{basename:s}=pe(),{loaderData:c,matches:o}=St(),u=i.useMemo(()=>ae(e,t,o,r,l,"data"),[e,t,o,r,l]),f=i.useMemo(()=>ae(e,t,o,r,l,"assets"),[e,t,o,r,l]),d=i.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let m=new Set,y=!1;if(t.forEach(g=>{var x;let v=r.routes[g.route.id];!v||!v.hasLoader||(!u.some(b=>b.route.id===g.route.id)&&g.route.id in c&&((x=a[g.route.id])!=null&&x.shouldRevalidate)||v.hasClientLoader?y=!0:m.add(g.route.id))}),m.size===0)return[];let w=Lt(e,s);return y&&m.size>0&&w.searchParams.set("_routes",t.filter(g=>m.has(g.route.id)).map(g=>g.route.id).join(",")),[w.pathname+w.search]},[s,c,l,r,u,t,e,a]),p=i.useMemo(()=>Ct(f,r),[f,r]),h=Mt(f);return i.createElement(i.Fragment,null,d.map(m=>i.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...n})),p.map(m=>i.createElement("link",{key:m,rel:"modulepreload",href:m,...n})),h.map(({key:m,link:y})=>i.createElement("link",{key:m,...y})))}function It(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var ye=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ye&&(window.__reactRouterVersion="7.5.2")}catch{}var ve=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,we=i.forwardRef(function({onClick:t,discover:n="render",prefetch:l="none",relative:r,reloadDocument:a,replace:s,state:c,target:o,to:u,preventScrollReset:f,viewTransition:d,...p},h){let{basename:m}=i.useContext(P),y=typeof u=="string"&&ve.test(u),w,g=!1;if(typeof u=="string"&&y&&(w=u,ye))try{let E=new URL(window.location.href),F=u.startsWith("//")?new URL(E.protocol+u):new URL(u),te=S(F.pathname,m);F.origin===E.origin&&te!=null?u=te+F.search+F.hash:g=!0}catch{R(!1,`<Link to="${u}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=Ye(u,{relative:r}),[x,b,$]=kt(l,p),B=At(u,{replace:s,state:c,target:o,preventScrollReset:f,relative:r,viewTransition:d});function T(E){t&&t(E),E.defaultPrevented||B(E)}let U=i.createElement("a",{...p,...$,href:w||v,onClick:g||a?t:T,ref:It(h,b),target:o,"data-discover":!y&&n==="render"?"true":void 0});return x&&!y?i.createElement(i.Fragment,null,U,i.createElement($t,{page:v})):U});we.displayName="Link";var Nt=i.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:l="",end:r=!1,style:a,to:s,viewTransition:c,children:o,...u},f){let d=O(s,{relative:u.relative}),p=M(),h=i.useContext(J),{navigator:m,basename:y}=i.useContext(P),w=h!=null&&Ht(d)&&c===!0,g=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,v=p.pathname,x=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;n||(v=v.toLowerCase(),x=x?x.toLowerCase():null,g=g.toLowerCase()),x&&y&&(x=S(x,y)||x);const b=g!=="/"&&g.endsWith("/")?g.length-1:g.length;let $=v===g||!r&&v.startsWith(g)&&v.charAt(b)==="/",B=x!=null&&(x===g||!r&&x.startsWith(g)&&x.charAt(g.length)==="/"),T={isActive:$,isPending:B,isTransitioning:w},U=$?t:void 0,E;typeof l=="function"?E=l(T):E=[l,$?"active":null,B?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let F=typeof a=="function"?a(T):a;return i.createElement(we,{...u,"aria-current":U,className:E,ref:f,style:F,to:s,viewTransition:c},typeof o=="function"?o(T):o)});Nt.displayName="NavLink";var Tt=i.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:l,replace:r,state:a,method:s=H,action:c,onSubmit:o,relative:u,preventScrollReset:f,viewTransition:d,...p},h)=>{let m=Ut(),y=Wt(c,{relative:u}),w=s.toLowerCase()==="get"?"get":"post",g=typeof c=="string"&&ve.test(c),v=x=>{if(o&&o(x),x.defaultPrevented)return;x.preventDefault();let b=x.nativeEvent.submitter,$=(b==null?void 0:b.getAttribute("formmethod"))||s;m(b||x.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:r,state:a,relative:u,preventScrollReset:f,viewTransition:d})};return i.createElement("form",{ref:h,method:w,action:y,onSubmit:l?o:v,...p,"data-discover":!g&&e==="render"?"true":void 0})});Tt.displayName="Form";function Dt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xe(e){let t=i.useContext(N);return C(t,Dt(e)),t}function At(e,{target:t,replace:n,state:l,preventScrollReset:r,relative:a,viewTransition:s}={}){let c=je(),o=M(),u=O(e,{relative:a});return i.useCallback(f=>{if(mt(f,t)){f.preventDefault();let d=n!==void 0?n:V(o)===V(u);c(e,{replace:d,state:l,preventScrollReset:r,relative:a,viewTransition:s})}},[o,c,u,n,l,t,e,r,a,s])}var Ot=0,Bt=()=>`__${String(++Ot)}__`;function Ut(){let{router:e}=xe("useSubmit"),{basename:t}=i.useContext(P),n=lt();return i.useCallback(async(l,r={})=>{let{action:a,method:s,encType:c,formData:o,body:u}=yt(l,t);if(r.navigate===!1){let f=r.fetcherKey||Bt();await e.fetch(f,n,r.action||a,{preventScrollReset:r.preventScrollReset,formData:o,body:u,formMethod:r.method||s,formEncType:r.encType||c,flushSync:r.flushSync})}else await e.navigate(r.action||a,{preventScrollReset:r.preventScrollReset,formData:o,body:u,formMethod:r.method||s,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:n,flushSync:r.flushSync,viewTransition:r.viewTransition})},[e,t,n])}function Wt(e,{relative:t}={}){let{basename:n}=i.useContext(P),l=i.useContext(k);C(l,"useFormAction must be used inside a RouteContext");let[r]=l.matches.slice(-1),a={...O(e||".",{relative:t})},s=M();if(e==null){a.search=s.search;let c=new URLSearchParams(a.search),o=c.getAll("index");if(o.some(f=>f==="")){c.delete("index"),o.filter(d=>d).forEach(d=>c.append("index",d));let f=c.toString();a.search=f?`?${f}`:""}}return(!e||e===".")&&r.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:L([n,a.pathname])),V(a)}function Ht(e,t={}){let n=i.useContext(fe);C(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=xe("useViewTransitionState"),r=O(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=S(n.currentLocation.pathname,l)||n.currentLocation.pathname,s=S(n.nextLocation.pathname,l)||n.nextLocation.pathname;return z(r.pathname,s)!=null||z(r.pathname,a)!=null}new TextEncoder;[...Pt];export{Vt as M,Nt as N};