import{aC as h,A as g,aD as C,aE as x,aF as d,H as y,ae as A}from"./CSGWN0Ke.js";import{u as v}from"./CQUIIwxN.js";const R=h(async(u,F)=>{let e,s;const{API_CMS:f}=g().public,p=C(f),m=x(p),{data:_}=([e,s]=d(()=>y(()=>m.getSingle("redirects"),"$7gdPxTAnv1")),e=await e,s(),e),t=_.value.data;let c;if("redirects_file"in t&&"url"in t.redirects_file&&t.redirects_file.url){const{data:a}=([e,s]=d(()=>v(t.redirects_file.url,"$WScuMI1RbV")),e=await e,s(),e);c=[...a.value,...t.redirect]}else c=t.redirect;const[i,o]=u.fullPath.split(/\?(.*)/s);let l=i;i!=="/"&&i.split("").pop()!=="/"&&(l=`${i}`);const r=c.find(a=>a.from===l);if(r&&"to"in r){const a=r.status?302:301;let n=r.to;return o&&(n=r.to+`?${o}`),A(n,{redirectCode:a,external:!0})}});export{R as default};