{"version":3,"sources":["jsdelivr-header.js","/npm/temp-email@2.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,KAAO,QAAQ,aACf,MAAQ,QAAQ,SAEtB,OAAO,QAAU,MAAM,EACnB,eAAO,GACH,OAAO,KAAK,eAChB,CAEA,wBAAO,CAAkB,GAAO,QAAE,EAAU,EAAC,YAAE,GAAgB,CAAC,GAC5D,OAAO,EAAU,cAAc,EAAO,GAAS,MAAK,GAC3C,EAGE,EAAU,YAAY,EAAa,GAF/B,GAInB,CAEA,kBAAO,CAAY,EAAa,GAC5B,OAAO,IAAI,SAAQ,CAAC,EAAS,KACzB,MAAM,IACF,EAAM,IACN,SAAS,EAAQ,GACb,IACI,IAAI,EAAO,EAAO,SAAS,cAAc,GAAa,UACtD,EAAQ,EACZ,CAAE,MAAO,GACL,EAAO,EACX,CACI,GACA,EAAO,OAEf,GACH,GAET,CAEA,oBAAO,CAAc,EAAc,GAC/B,IAAI,EAAU,KAAK,MAAQ,EAC3B,OAAO,KAAK,SAAS,GAAc,MAAK,GAC7B,EAAM,QAAO,CAAC,EAAM,IACnB,EAAK,eAAiB,EAAK,eACpB,EAEJ,GACR,CAAE,eAAgB,IAAK,iBAC3B,OAAM,IACL,GAAI,GAAW,KAAK,MAChB,MAAM,EAEV,OAAO,IAAI,SAAQ,IACf,YAAW,KACP,EAAQ,EAAU,cAAc,EAAc,EAAU,KAAK,OAAO,GACrE,IAAK,GACV,GAEV","file":"/npm/temp-email@2.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/temp-email@2.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","const mail = require('temp-mail');\nconst jsdom = require('jsdom');\n\nmodule.exports = class TempEmail {\n    static generate() {\n        return mail.generateEmail();\n    }\n\n    static getLastLetterText(email, { timeout = 0, cssSelector } = {}) {\n        return TempEmail._getEmailText(email, timeout).then(text => {\n            if (!cssSelector) {\n                return text;\n            }\n            return TempEmail._selectText(cssSelector, text);\n        });\n    }\n\n    static _selectText(cssSelector, text) {\n        return new Promise((resolve, reject) => {\n            jsdom.env(\n                text, [],\n                function(errors, window) {\n                    try {\n                        var code = window.document.querySelector(cssSelector).innerHTML;\n                        resolve(code);\n                    } catch (e) {\n                        reject(e);\n                    }\n                    if (window) {\n                        window.close();\n                    }\n                }\n            );\n        });\n    }\n\n    static _getEmailText(emailAddress, timeout) {\n        var endDate = Date.now() + timeout;\n        return mail.getInbox(emailAddress).then(inbox => {\n            return inbox.reduce((memo, item) => {\n                if (memo.mail_timestamp < item.mail_timestamp) {\n                    return item\n                }\n                return memo;\n            }, { mail_timestamp: 0 }).mail_text_only;\n        }).catch(err => {\n            if (endDate <= Date.now()) {\n                throw err;\n            }\n            return new Promise(resolve => {\n                setTimeout(() => {\n                    resolve(TempEmail._getEmailText(emailAddress, endDate - Date.now()));\n                }, 1000);\n            });\n        });\n    }\n}\n"]}