"use strict";(()=>{var e={};e.id=800,e.ids=[800],e.modules={399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},7561:e=>{e.exports=require("node:fs")},9411:e=>{e.exports=require("node:path")},5071:(e,t,n)=>{n.r(t),n.d(t,{originalPathname:()=>h,patchFetch:()=>x,requestAsyncStorage:()=>y,routeModule:()=>p,serverHooks:()=>g,staticGenerationAsyncStorage:()=>j});var r={};n.r(r),n.d(r,{PATCH:()=>f});var i=n(3277),s=n(5265),o=n(5356),u=n(7076),a=n(1760);let l=new Set(["title","severity","description","recommendation","resolution","update_from_client","notes"]),d=new Set(["Critical","High","Medium","Low","Info"]),c=new Set(["Fixed","Mitigated","Acknowledged","Not Fixed","Unresolved"]);async function f(e,{params:t}){let n=t.id,r=await e.json(),i={};for(let[e,t]of Object.entries(r))if(l.has(e)){if("severity"===e&&"string"==typeof t&&!d.has(t))return u.NextResponse.json({error:`Invalid severity: ${t}`},{status:400});if("resolution"===e&&null!=t&&"string"==typeof t&&!c.has(t))return u.NextResponse.json({error:`Invalid resolution: ${t}`},{status:400});i[e]=t}if(0===Object.keys(i).length)return u.NextResponse.json({error:"No editable fields supplied"},{status:400});let s=(0,a.gn)("findings.json")??{findings:[]},o=(0,a.gn)("tracking.json")??{findings:[]},f=!1;for(let e of s.findings)if(e.id===n){for(let[t,n]of Object.entries(i))"notes"!==t&&(e[t]=n);f=!0;break}let p=!1;for(let e of o.findings)if(e.id===n){"title"in i&&(e.title=i.title),"severity"in i&&(e.severity=i.severity),"notes"in i&&(e.notes=i.notes),p=!0;break}return f||p?(f&&(0,a.au)("findings.json",s),p&&(0,a.au)("tracking.json",o),u.NextResponse.json({ok:!0,id:n,updates:i})):u.NextResponse.json({error:`Issue ${n} not found`},{status:404})}let p=new i.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/issues/[id]/route",pathname:"/api/issues/[id]",filename:"route",bundlePath:"app/api/issues/[id]/route"},resolvedPagePath:"/home/dx/Work/hex/dashboard/app/api/issues/[id]/route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:y,staticGenerationAsyncStorage:j,serverHooks:g}=p,h="/api/issues/[id]/route";function x(){return(0,o.patchFetch)({serverHooks:g,staticGenerationAsyncStorage:j})}},1760:(e,t,n)=>{n.d(t,{J1:()=>p,V9:()=>y,ZN:()=>f,au:()=>d,gn:()=>a,ki:()=>c,ws:()=>l});var r=n(7561),i=n.n(r),s=n(9411),o=n.n(s);function u(){let e=process.env.HEX_PROJECT_DIR??process.env.SOLAUDIT_PROJECT_DIR??process.cwd();try{let t=o().join(e,".hex","config.json");if(i().existsSync(t))return o().join(e,".hex");let n=o().join(e,".solaudit","config.json");if(i().existsSync(n))return o().join(e,".solaudit")}catch{}return o().join(e,".hex")}function a(e){try{let t=o().join(u(),e),n=i().readFileSync(t,"utf-8");return JSON.parse(n)}catch{return null}}function l(e){try{let t=o().join(u(),e);return i().readFileSync(t,"utf-8")}catch{return null}}function d(e,t){let n=o().join(u(),e);i().writeFileSync(n,JSON.stringify(t,null,2),"utf-8")}function c(e){try{let t=o().join(u(),e);return i().existsSync(t)}catch{return!1}}function f(){return u()}function p(e){try{let t=o().join(u(),e);if(!i().existsSync(t))return[];return i().readdirSync(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name)}catch{return[]}}function y(e){try{let t=o().join(u(),e),n=i().readFileSync(t,"utf-8");return JSON.parse(n)}catch{return null}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),r=t.X(0,[916,786],()=>n(5071));module.exports=r})();