"use strict";exports.id=8390,exports.ids=[8390],exports.modules={3421:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(71237),e=c(55088),f=c(17679);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},25403:(a,b,c)=>{c.a(a,async(a,b)=>{try{var d=c(19151),e=c(1623),f=c(511),g=c(60105),h=c(9001),i=c(65451),j=a([d,e,f,g,h,i]);[d,e,f,g,h,i]=j.then?(await j)():j,b()}catch(a){b(a)}})},95736:(a,b,c)=>{a.exports=c(44870)},96313:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{EI:()=>l,HQ:()=>k,Sn:()=>m,fi:()=>j});var e=c(34255),f=c(60105),g=c(9001),h=c(25403);c(64143);var i=a([e,f,g,h]);function j(){return(0,e.getDb)().prepare("SELECT id, chat_id, kind, label, created_at FROM whatsapp_allowlist ORDER BY created_at DESC").all()}function k({chat_id:a,kind:b="dm",label:c=null}){if(!a)throw Error("chat_id is required");let d=(0,e.newId)("waal");return(0,e.getDb)().prepare(`
    INSERT INTO whatsapp_allowlist (id, chat_id, kind, label, created_at)
    VALUES (?, ?, ?, ?, ?)
    ON CONFLICT(chat_id) DO UPDATE SET kind = excluded.kind, label = excluded.label
  `).run(d,String(a),String(b),c?String(c):null,(0,e.nowIso)()),(0,e.getDb)().prepare("SELECT id, chat_id, kind, label, created_at FROM whatsapp_allowlist WHERE chat_id = ?").get(String(a))}function l(a){return a?(0,e.getDb)().prepare("DELETE FROM whatsapp_allowlist WHERE chat_id = ?").run(String(a)).changes:0}function m(a=50){return(0,e.getDb)().prepare(`
    SELECT id, direction, chat_id, sender, message_id, text, run_id, created_at
    FROM whatsapp_messages
    ORDER BY created_at DESC
    LIMIT ?
  `).all(Math.max(1,Math.min(200,Number(a))))}[e,f,g,h]=i.then?(await i)():i,d()}catch(a){d(a)}})}};