import{ErrorHandler as e}from"./errors/ErrorHandler.mjs";const t=e=>e?e.startsWith(`::ffff:`)?e.substring(7):e:`unknown`,n={max:500,timeWindow:60*1e3,enableDraftSpec:!0,keyGenerator:e=>{let n=e.ip??e.socket?.remoteAddress??e.headers[`x-forwarded-for`]??`unknown`;return t(typeof n==`string`?n:n[0])},errorResponseBuilder:(t,n)=>{let r=Math.ceil(n.ttl/1e3),i=e.formatGenericErrorResponse(`RATE_LIMIT_EXCEEDED`,{limit:`${n.max} per minute`,retryAfter:r});return{statusCode:i.status,...i}}},r={max:3,timeWindow:3600*1e3,enableDraftSpec:!0,allowList:e=>!!e.locals?.user,keyGenerator:e=>{let n=e.ip??e.socket?.remoteAddress??e.headers[`x-forwarded-for`]??`unknown`;return t(typeof n==`string`?n:n[0])},errorResponseBuilder:(t,n)=>{let r=Math.ceil(n.ttl/1e3),i=e.formatGenericErrorResponse(`RATE_LIMIT_EXCEEDED_UNAUTHENTICATED`,{limit:`${n.max} per hour`,retryAfter:r});return{statusCode:i.status,...i}}};export{n as ipLimiter,r as unauthenticatedChatBotLimiter};
//# sourceMappingURL=rateLimiter.mjs.map