{"version":3,"sources":["jsdelivr-header.js","/npm/prerender-memory-cache-api@1.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,aAAe,QAAQ,iBAE3B,OAAO,QAAU,CAChB,KAAM,WACL,KAAK,MAAQ,aAAa,QAAQ,CACjC,MAAO,SAAU,IAAK,QAAQ,IAAI,eAAiB,GAAI,IAAK,QAAQ,IAAI,WAAa,IAEvF,EAEA,gBAAiB,SAAS,EAAK,EAAK,GACnC,KAAK,MAAM,IAAI,EAAI,UAAU,KAAK,SAAU,EAAK,IAC3C,GAAO,GACX,EAAI,UAAU,UAAW,EACzB,EAAI,KAAK,IAAK,IAEd,GAEF,GACD,EAEA,WAAY,SAAS,EAAK,EAAK,GACzB,EAAI,UAAU,UAAwC,KAA5B,EAAI,UAAU,YAC5C,KAAK,MAAM,IAAI,EAAI,UAAU,IAAK,EAAI,UAAU,SAEjD,GACD","file":"/npm/prerender-memory-cache-api@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/prerender-memory-cache-api@1.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var cacheManager = require('cache-manager');\n\nmodule.exports = {\n\tinit: function() {\n\t\tthis.cache = cacheManager.caching({\n\t\t\tstore: 'memory', max: process.env.CACHE_MAXSIZE || 50, ttl: process.env.CACHE_TTL || 60/*seconds*/\n\t\t});\n\t},\n\n\trequestReceived: function(req, res, next) {\n\t\tthis.cache.get(req.prerender.url, function (err, result) {\n\t\t\tif (!err && result) {\n\t\t\t\treq.prerender.cacheHit = true;\n\t\t\t\tres.send(200, result);\n\t\t\t} else {\n\t\t\t\tnext();\n\t\t\t}\n\t\t});\n\t},\n\n\tbeforeSend: function(req, res, next) {\n\t\tif (!req.prerender.cacheHit && req.prerender.statusCode == 200) {\n\t\t\tthis.cache.set(req.prerender.url, req.prerender.content);\n\t\t}\n\t\tnext();\n\t}\n};"]}