{"version":3,"sources":["jsdelivr-header.js","/npm/electrode-auto-ssr@1.0.4/lib/autossr.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aAEA,MAAM,qBAAuB,QAAQ,6BAC/B,oBAAsB,QAAQ,4BAC9B,sBAAwB,QAAQ,8BAEhC,iBAAmB,CAEzB,SAA4B,SAAU,EAAQ,EAAS,GACrD,MAAM,EAAQ,OAAO,OAAO,CAC1B,SAAU,CAAC,GACV,GAEH,IAAK,EAAM,SAAS,oBAAqB,CAEvC,MAAM,EAAoB,oBAAoB,GAC9C,EAAO,IAAI,eAAgB,EAE7B,CAEA,IAAK,EAAM,SAAS,qBAAsB,CAExC,MAAM,EAAqB,qBAAqB,GAChD,EAAO,IAAI,eAAgB,EAE7B,CAEA,IAAK,EAAM,SAAS,sBAAuB,MAER,IAA7B,EAAO,IAAI,gBACb,EAAO,IAAI,cAAgB,GAG7B,MAAM,EAAuB,sBAAsB,SAAS,GAC5D,EAAO,GAAG,WAAY,GAEtB,MAAM,EAAoB,sBAAsB,MAChD,EAAO,IAAI,eAAgB,EAE7B,CAEA,GAEF,GAEA,iBAAiB,SAAS,WAAa,CACrC,KAAM,mBACN,QAAS,SAGX,OAAO,QAAU","file":"/npm/electrode-auto-ssr@1.0.4/lib/autossr.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/electrode-auto-ssr@1.0.4/lib/autossr.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n\nconst machineLoadCondition = require(\"./conditions/machine-load\");\nconst serverLoadCondition = require(\"./conditions/server-load\");\nconst responseTimeCondition = require(\"./conditions/response-time\");\n\nconst ElectrodeAutoSSR = {};\n\nElectrodeAutoSSR.register = function (server, options, next) {\n  const _opts = Object.assign({\n    disabled: {}\n  }, options);\n\n  if (!_opts.disabled.serverLoadCondition) {\n\n    const serverLoadHandler = serverLoadCondition(_opts);\n    server.ext(\"onPreHandler\", serverLoadHandler);\n\n  }\n\n  if (!_opts.disabled.machineLoadCondition) {\n\n    const machineLoadHandler = machineLoadCondition(_opts);\n    server.ext(\"onPreHandler\", machineLoadHandler);\n\n  }\n\n  if (!_opts.disabled.responseTimeCondition) {\n\n    if (server.app.longResponses === undefined) {\n      server.app.longResponses = 0;\n    }\n\n    const responseTimeDetector = responseTimeCondition.detector(_opts);\n    server.on(\"response\", responseTimeDetector);\n\n    const responseTimeActor = responseTimeCondition.actor;\n    server.ext(\"onPreHandler\", responseTimeActor);\n\n  }\n\n  next();\n\n};\n\nElectrodeAutoSSR.register.attributes = {\n  name: \"ElectrodeAutoSSR\",\n  version: \"1.0.0\"\n};\n\nmodule.exports = ElectrodeAutoSSR;\n"]}