{"version":3,"sources":["jsdelivr-header.js","/npm/hydrate-stream@1.1.0/src/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,OAAS,QAAQ,UACjB,SAAU,QAAQ,YAElB,QAAU,EAAG,QAAO,eACtB,MAAM,EAAa,SAAS,MAAM,EAAM,YA+BxC,OA9BA,OAAO,KAAK,GAAY,SAAQ,IAC5B,MAAM,EAAe,EAAW,GAAS,WACpC,MAAK,GAAK,EAAS,QAAO,GAAK,EAAE,MAAQ,EAAE,QAChD,GAAI,EAAc,CACd,MAAM,EAAU,EAAS,QAAO,GAAK,EAAE,KAAO,EAAa,QACvD,EAAQ,QAA6B,WAAnB,EAAQ,GAAG,IAC7B,EAAW,KAAK,CACZ,WAAY,GACZ,KAAM,UACN,QAAS,SACT,SAAU,CACN,CACI,KAAM,OACN,QAAS,EAAQ,GAAG,UAKhC,OAAO,OAAO,EAAW,GAAS,YAAY,SAAQ,IAC9C,EAAQ,GAAG,KAAO,EAAK,OACvB,EAAW,GAAS,WAAW,KAAK,CAChC,IAAK,EAAQ,GAAG,IAChB,MAAO,EAAQ,GAAG,OAE1B,GAGZ,KAGG,CAAC,SAAS,UAAU,GAAY,EAG3C,OAAO,QAAQ,cAAgB,GAC3B,IAAI,OAAO,UAAU,CACjB,UAAW,SAAuB,EAAO,EAAU,GAC/C,KAAK,KAAK,OAAO,KAAK,GAAG,QAAQ,CAAE,QAAO,iBAC1C,GACJ","file":"/npm/hydrate-stream@1.1.0/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/hydrate-stream@1.1.0/src/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 stream = require('stream');\nconst himalaya= require('himalaya');\n\nconst hydrate = ({ chunk, handlers }) => {\n    const htmlObject = himalaya.parse(chunk.toString());\n    Object.keys(htmlObject).forEach(element => {\n        const handlerMatch = htmlObject[element].attributes\n            .find(a => handlers.filter(h => h.key === a.key));\n        if (handlerMatch) {\n            const handler = handlers.filter(f => f.id === handlerMatch.value);\n            if (handler.length && handler[0].key === 'onload') {\n                htmlObject.push({\n                    attributes: [],\n                    type: 'element',\n                    tagName: 'script',\n                    children: [\n                        {\n                            type: 'text',\n                            content: handler[0].value\n                        }\n                    ]\n                })\n            } else {\n                Object.values(htmlObject[element].attributes).forEach(attr => {\n                    if (handler[0].id === attr.value) {\n                        htmlObject[element].attributes.push({\n                            key: handler[0].key,\n                            value: handler[0].value\n                        })\n                    }\n                })\n            }\n        }\n    });\n\n    return [himalaya.stringify(htmlObject)];\n};\n\nmodule.exports.hydrateStream = handlers =>\n    new stream.Transform({\n        transform: function hydrateChunks(chunk, encoding, callback) {\n            this.push(Buffer.from(`${hydrate({ chunk, handlers })}`));\n            callback();\n        }\n    });"]}