const{writeFile:writeFile,formatContents:formatContents,getComponentModuleName:getComponentModuleName}=require("./wm-utils"),{getHandlebarTemplate:getHandlebarTemplate}=require("./handlebar-helpers"),getLazyModulesInfo=(e=[],a,n)=>{const o=e.reduce((e,a)=>"PAGE"===a.type?e:`${e?`${e},`:""}\n            ${a.name}: {\n                loadChildren: () => import('src/app/partials/${a.name}/${a.name}.module').then(m => m.${getComponentModuleName(a.name)}),\n            }`,""),t=Array.from(a.keys()),[r,l]=t.reduce((e,a)=>{const[o,t]=e;return[`${o?`${o},`:""}\n            ${a}: {\n                loadChildren: () => import('src/app/prefabs/${a}/${a}.module').then(m => m.${getComponentModuleName(a)}),\n            }`,n[a].reduce((e,n)=>`${e?`${e},`:""}\n            ${a}_${n.name}: {\n                loadChildren: () => (\n                    import(\n                        'src/app/prefabs/${a}/partials/${n.name}/${n.name}.module'\n                    ).then(m => m.${getComponentModuleName(n.name)})\n                )\n            }`,t)]},["",""]);return{partialModulesInfo:o,prefabModulesInfo:r,prefabPartialInfo:l}},generateLazyModuleRoutes=async(e,a,n,o)=>{const t=getHandlebarTemplate("lazy-module-routes"),{partialModulesInfo:r,prefabModulesInfo:l,prefabPartialInfo:m}=getLazyModulesInfo(e,a,n),u=t({partialModulesInfo:r,prefabModulesInfo:l,prefabPartialInfo:m});await writeFile(`${o}/src/framework/util/lazy-module-routes.ts`,formatContents(u))};module.exports={generateLazyModuleRoutes:generateLazyModuleRoutes};