{"version":3,"sources":["jsdelivr-header.js","/npm/koishi-plugin-cron@3.1.0/lib/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,aACA,OAAO,eAAe,QAAS,aAAc,CAAE,OAAO,IACtD,QAAQ,MAAQ,QAAQ,OAAS,QAAQ,UAAO,EAChD,MAAM,SAAW,QAAQ,UACnB,cAAgB,QAAQ,eAC9B,MAAM,KACF,WAAA,CAAY,EAAK,EAAM,GACnB,KAAK,IAAM,EACX,KAAK,KAAO,EACZ,KAAK,SAAW,EAChB,KAAK,OACT,CACA,KAAA,GACI,KAAK,MAAQ,YAAW,UACpB,KAAK,QACL,UACU,KAAK,UACf,CACA,MAAO,GACH,KAAK,IAAI,OAAO,QAAQ,KAAK,EACjC,IACD,KAAK,KAAK,OAAO,UAAY,KAAK,MACzC,CACA,IAAA,GACI,aAAa,KAAK,MACtB,EAIJ,SAAS,MAAM,GACX,EAAI,QAAQ,QACZ,EAAI,KAAO,SAAc,EAAO,GAC5B,MAAM,EAAO,IAAI,KAAK,MAAM,EAAI,cAAc,iBAAiB,GAAQ,GACvE,OAAO,KAAK,QAAQ,QAAQ,IAAM,EAAK,QAC3C,CACJ,CARA,QAAQ,KAAO,OACf,QAAQ,OAAS,SAAS,OAAO,OAAO,CAAC,GAQzC,QAAQ,MAAQ","file":"/npm/koishi-plugin-cron@3.1.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/koishi-plugin-cron@3.1.0/lib/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","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.apply = exports.Config = exports.name = void 0;\nconst koishi_1 = require(\"koishi\");\nconst cron_parser_1 = require(\"cron-parser\");\nclass Task {\n    constructor(ctx, expr, callback) {\n        this.ctx = ctx;\n        this.expr = expr;\n        this.callback = callback;\n        this.start();\n    }\n    start() {\n        this.timer = setTimeout(async () => {\n            this.start();\n            try {\n                await this.callback();\n            }\n            catch (error) {\n                this.ctx.logger('cron').warn(error);\n            }\n        }, this.expr.next().getTime() - Date.now());\n    }\n    stop() {\n        clearTimeout(this.timer);\n    }\n}\nexports.name = 'cron';\nexports.Config = koishi_1.Schema.object({});\nfunction apply(ctx) {\n    ctx.provide('cron');\n    ctx.cron = function cron(input, callback) {\n        const task = new Task(this, (0, cron_parser_1.parseExpression)(input), callback);\n        return this.collect('cron', () => task.stop());\n    };\n}\nexports.apply = apply;\n"]}