import{N as m,j as h,m as p,s as E,E as y}from"./chunk-EPOLDU6W-BCLmut3y.js";import{R as n}from"./index-CqIc3cxq.js";[...m];function _(e,...r){let o=r[0],a=w(e).replace(/\/:([\w-]+)(\?)?/g,(t,l,i)=>{const u=i===void 0,s=o?.[l];if(u&&s===void 0)throw new Error(`Path '${e}' requires param '${l}' but it was not provided`);return s===void 0?"":"/"+s});if(e.endsWith("*")){const t=o?.["*"];t!==void 0&&(a+="/"+t)}return a||"/"}function w(e){let r=e.length-1,o=e[r];if(o!=="*"&&o!=="/")return e;for(r--;r>=0&&e[r]==="/";r--);return e.slice(0,r+1)}new TextEncoder;(class extends n.Component{constructor(e){super(e),this.state={error:null,location:e.location}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location?{error:null,location:e.location}:{error:r.error,location:r.location}}render(){return this.state.error?n.createElement(g,{error:this.state.error,renderAppShell:!0}):this.props.children}});function f({renderAppShell:e,title:r,children:o}){return e?n.createElement("html",{lang:"en"},n.createElement("head",null,n.createElement("meta",{charSet:"utf-8"}),n.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),n.createElement("title",null,r)),n.createElement("body",null,n.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},o))):o}function g({error:e,renderAppShell:r}){console.error(e);let o=n.createElement("script",{dangerouslySetInnerHTML:{__html:`
        console.log(
          "💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
        );
      `}});if(h(e))return n.createElement(f,{renderAppShell:r,title:"Unhandled Thrown Response!"},n.createElement("h1",{style:{fontSize:"24px"}},e.status," ",e.statusText),o);let a;if(e instanceof Error)a=e;else{let t=e==null?"Unknown Error":typeof e=="object"&&"toString"in e?e.toString():JSON.stringify(e);a=new Error(t)}return n.createElement(f,{renderAppShell:r,title:"Application Error!"},n.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),n.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},a.stack),o)}function R(e){if(!e)return null;let r=Object.entries(e),o={};for(let[a,t]of r)if(t&&t.__type==="RouteErrorResponse")o[a]=new y(t.status,t.statusText,t.data,t.internal===!0);else if(t&&t.__type==="Error"){if(t.__subType){let l=window[t.__subType];if(typeof l=="function")try{let i=new l(t.message);i.stack=t.stack,o[a]=i}catch{}}if(o[a]==null){let l=new Error(t.message);l.stack=t.stack,o[a]=l}}else o[a]=t;return o}function D({state:e,routes:r,getRouteInfo:o,location:a,basename:t,isSpaMode:l}){let i={...e,loaderData:{...e.loaderData}},u=p(r,a,t);if(u)for(let s of u){let d=s.route.id,c=o(d);E(d,c.clientLoader,c.hasLoader,l)&&(c.hasHydrateFallback||!c.hasLoader)?delete i.loaderData[d]:c.hasLoader||(i.loaderData[d]=null)}return i}export{R as d,D as g,_ as h};
//# sourceMappingURL=chunk-FNSCYPCZ-BHgC5cdx.js.map
