"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const fs_1=__importDefault(require("fs")),path_1=__importDefault(require("path")),path_2=require("@b/utils/path");exports.metadata={summary:"Debug path resolution for production troubleshooting",operationId:"debugPaths",tags:["Admin","Debug"],responses:{200:{description:"Path information retrieved successfully",content:{"application/json":{schema:{type:"object",properties:{environment:{type:"string"},currentWorkingDirectory:{type:"string"},pathInfo:{type:"object"}}}}}}},permission:"access.system",requiresAuth:!0,logModule:"ADMIN_SYSTEM",logTitle:"Debug Paths"};exports.default=async t=>{const{ctx:e}=t;null==e||e.step("Gathering path information");const o="production"===process.env.NODE_ENV,a=process.cwd(),r={logo:{pattern1:path_1.default.join(a,"frontend","public","img","logo"),pattern2:path_1.default.join(a,"public","img","logo"),pattern3:path_1.default.join(a,"..","frontend","public","img","logo"),pattern4:path_1.default.join(a,"..","public","img","logo"),resolved:(0,path_2.resolveUploadPath)("img/logo")},uploads:{pattern1:path_1.default.join(a,"frontend","public","uploads"),pattern2:path_1.default.join(a,"public","uploads"),pattern3:path_1.default.join(a,"..","frontend","public","uploads"),pattern4:path_1.default.join(a,"..","public","uploads"),resolved:(0,path_2.resolveUploadPath)("uploads")}},n={};for(const[t,e]of Object.entries(r)){n[t]={};for(const[o,a]of Object.entries(e)){const e=fs_1.default.existsSync(a),r=fs_1.default.existsSync(path_1.default.dirname(a));n[t][o]={path:a,exists:e,parentExists:r,canCreate:r&&!e}}}const s={nodeVersion:process.version,platform:process.platform,arch:process.arch,environment:o?"production":"development",currentWorkingDirectory:a,__dirname:__dirname,processArgv:process.argv},i=[path_1.default.join(a,"frontend"),path_1.default.join(a,"public"),path_1.default.join(a,"..","frontend"),path_1.default.join(a,"..","public"),path_1.default.join(a,"backend"),path_1.default.join(a,"src")],p={};for(const t of i)p[t]=fs_1.default.existsSync(t);null==e||e.success("Path debugging information retrieved");return{systemInfo:s,pathStatus:n,directoryStatus:p,message:"Path debugging information retrieved successfully"}};