import{deleteCookie as m,getCookie as d,setCookie as o}from"hono/cookie";const f=(r,u)=>{const i=r.req.routePath,a=r.req.param(),l=Object.fromEntries(Object.entries(a).map(([e,t])=>{if(t&&(i.includes(`/:${e}{.*}`)||i.includes(`/:${e}{.+}`))){const c=t.split("/").filter(Boolean);return[e,c.length?c:void 0]}return[e,t]})),s={...r.res,status:e=>(r.status(e),s),json:e=>r.json(e),text:(e,t)=>(t&&r.status(t),r.text(e)),redirect:(e,t=302)=>r.redirect(e,t),setCookie:(e,t,n)=>(o(r,e,t,n),s),deleteCookie:e=>(m(r,e),s)};return{...u,...s,params:l,query:r.req.query()||{},cookies:d(r)}};export{f as enhanceContext};
