import{normalizeRouteSlug as a}from"../../../utils/path/normalize-route-slug.js";import{removeLeadingSlash as f}from"../../../utils/url/remove-leading-slash.js";function m(i,r,c){const t=a(i.toLowerCase()),e=r[t];if(e&&e.to)return{to:e.to,type:e.type};const n=s(t,c);if(n){let o=r[n]?.to;if(o){if(o.endsWith("*")){const d=n.split("*")[0],l=i.substring(d.length);o=o.replace(/\*$/,l)}return{...r[n],to:o}}}return null}function s(i,r){const c=f(i).split("/");let t=r;for(const e of c){if(!t[e])break;t=t[e]}return t["*"]||null}export{m as findRedirect};
