export function termsReturnPath(value, origin) { if (typeof value !== 'string' || !value.startsWith('/')) return '/'; try { const url = new URL(value, origin); return url.origin === origin ? url.pathname + url.search + url.hash : '/'; } catch { return '/'; } } // Presentation hint only. The API independently validates the signed cookie. export function hasCurrentTermsCookie(value = '', now = Date.now()) { const match = value.match( /^(\d{4}-\d{2}-\d{2}\.\d+)\.(\d{10})\.[a-f0-9]{64}$/, ); if (!match || match[1] !== terms.version) return false; const issuedAt = Number(match[2]) * 1000; return issuedAt <= now && now < issuedAt + 365 * 24 * 60 * 60 * 1000; } export const terms = { version: '2026-10-04.2', author: 'Juan V. Navarro Leal', introduction: 'Juegoland es un servicio desarrollado para uso personal por Juan V. Navarro Leal. Está en desarrollo y puede contener errores.', notice: 'Su autor no se responsabiliza de la información compartida, pérdidas de datos ni daños o trastornos derivados del uso del servicio.', };