import{logger as i}from"../../../server/utils/index.js";import{reporter as c}from"../../utils/reporter/reporter.js";import{enhanceRequest as f}from"../../plugins/api-functions/utils/enhance-request.js";import{enhanceContext as m}from"../../plugins/api-functions/utils/enhance-context.js";async function w({route:e,ctx:o,staticData:s,serverPropsGetters:a,serverPropsUser:n,actions:p}){try{if(!a[e.fsPath]||!o)return;const r=a[e.fsPath];r||c.panicOnBuild(`Invalid page props getter id: "${e.fsPath}" for route "${e.slug}"`);const t=m(o,{user:n,config:p.getConfig()}),g=await f(o);return await(await r()).default(s,g,t)}catch(r){const t=e.fsPath.replace(/\.(page\.tsx?|md)$/,".props.ts");return i.error(`Page prop getter error: ${r.message}`),{pagePropGetterError:{message:`${r.message||"An unknown error occurred"} in ${t}`,name:"ServerPropsGetterError",stack:r.stack}}}}export{w as getServerPropsFromUserHandler};
