From 70a64aefe060fdd105819618de64a922e3824b51 Mon Sep 17 00:00:00 2001 From: Sune Simonsen Date: Tue, 3 Apr 2018 14:10:48 +0200 Subject: [PATCH] 4.5.0 --- package.json | 2 +- unexpected-dom.js | 14 ++++++++++---- unexpected-dom.min.js | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 30ce60f4..066c9b28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unexpected-dom", - "version": "4.4.2", + "version": "4.5.0", "description": "DOM plugin for the unexpected assertion libary", "main": "lib/index.js", "files": [ diff --git a/unexpected-dom.js b/unexpected-dom.js index b586b77c..1df7bf0c 100644 --- a/unexpected-dom.js +++ b/unexpected-dom.js @@ -746,9 +746,15 @@ module.exports = { return { name: node.nodeName }; } else if (node.nodeType === 1) { // DOMElement - var result = { - name: isHtml ? node.nodeName.toLowerCase() : node.nodeName - }; + var name = isHtml ? node.nodeName.toLowerCase() : node.nodeName; + + if (name === 'ignore') { + // Ignore subtree + return {}; + } + + var result = { name: name }; + if (node.attributes) { result.attributes = {}; for (var i = 0; i < node.attributes.length; i += 1) { @@ -2544,4 +2550,4 @@ Prism.languages.js = Prism.languages.javascript; },{}]},{},[1])(1) }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvaW5kZXguanMiLCJsaWIvbWF0Y2hlc1NlbGVjdG9yLmpzIiwibm9kZV9tb2R1bGVzL21hZ2ljcGVuLXByaXNtL2xpYi9tYWdpY1BlblByaXNtLmpzIiwibm9kZV9tb2R1bGVzL21hZ2ljcGVuLXByaXNtL3BhY2thZ2UuanNvbiIsIm5vZGVfbW9kdWxlcy9wcmlzbWpzL2NvbXBvbmVudHMvcHJpc20tY3NwLmpzIiwibm9kZV9tb2R1bGVzL3ByaXNtanMvY29tcG9uZW50cy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uICAgICAgICAgIHR5cGVvZiBvYmoubm9kZVR5cGUgPT09ICdudW1iZXInICYmXG4gICAgICAgICAgb2JqLm5vZGVUeXBlID09PSAxMCAmJlxuICAgICAgICAgICdwdWJsaWNJZCcgaW4gb2JqXG4gICAgICAgICk7XG4gICAgICB9LFxuICAgICAgaW5zcGVjdDogZnVuY3Rpb24oZG9jdHlwZSwgZGVwdGgsIG91dHB1dCwgaW5zcGVjdCkge1xuICAgICAgICByZXR1cm4gb3V0cHV0LmNvZGUoJzwhRE9DVFlQRSAnICsgZG9jdHlwZS5uYW1lICsgJz4nLCAnaHRtbCcpO1xuICAgICAgfSxcbiAgICAgIGVxdWFsOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgIHJldHVybiBhLnRvU3RyaW5nKCkgPT09IGIudG9TdHJpbmcoKTtcbiAgICAgIH0sXG4gICAgICBkaWZmOiBmdW5jdGlvbihhY3R1YWwsIGV4cGVjdGVkLCBvdXRwdXQsIGRpZmYpIHtcbiAgICAgICAgdmFyIGQgPSBkaWZmKFxuICAgICAgICAgICc8IURPQ1RZUEUgJyArIGFjdHVhbC5uYW1lICsgJz4nLFxuICAgICAgICAgICc8IURPQ1RZUEUgJyArIGV4cGVjdGVkLm5hbWUgKyAnPidcbiAgICAgICAgKTtcbiAgICAgICAgZC5pbmxpbmUgPSB0cnVlO1xuICAgICAgICByZXR1cm4gZDtcbiAgICAgIH1cbiAgICB9KTtcblxuICAgIGV4cGVjdC5leHBvcnRUeXBlKHtcbiAgICAgIG5hbWU6ICdET01Eb2N1bWVudCcsXG4gICAgICBiYXNlOiAnRE9NTm9kZScsXG4gICAgICBpZGVudGlmeTogZnVuY3Rpb24ob2JqKSB7XG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgb2JqICYmXG4gICAgICAgICAgdHlwZW9mIG9iai5ub2RlVHlwZSA9PT0gJ251bWJlcicgJiZcbiAgICAgICAgICBvYmoubm9kZVR5cGUgPT09IDkgJiZcbiAgICAgICAgICBvY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aW5zcGVjdGVkQ2hpbGRyZW4gPSBbXTtcbiAgICAgICAgICAgIGlmIChlbGVtZW50TmFtZSA9PT0gJ3NjcmlwdCcpIHtcbiAgICAgICAgICAgICAgdmFyIHR5cGUgPSBlbGVtZW50LmdldEF0dHJpYnV0ZSgndHlwZScpO1xuICAgICAgICAgICAgICBpZiAoIXR5cGUgfHwgL2phdmFzY3JpcHQvLnRlc3QodHlwZSkpIHtcbiAgICAgICAgICAgICAgICB0eXBlID0gJ2phdmFzY3JpcHQnO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGluc3BlY3RlZENoaWxkcmVuLnB1c2goXG4gICAgICAgICAgICAgICAgb3V0cHV0LmNsb25lKCkuY29kZShlbGVtZW50LnRleHRDb250ZW50LCB0eXBlKVxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChlbGVtZW50TmFtZSA9PT0gJ3N0eWxlJykge1xuICAgICAgICAgICAgICBpbnNwZWN0ZWRDaGlsZHJlbi5wdXNoKFxuICAgICAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAgICAgLmNsb25lKClcbiAgICAgICAgICAgICAgICAgIC5jb2RlKFxuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnRleHRDb250ZW50LFxuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmdldEF0dHJpYnV0ZSgndHlwZScpIHx8ICd0ZXh0L2NzcydcbiAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZWxlbWVudC5jaGlsZE5vZGVzLmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgaW5zcGVjdGVkQ2hpbGRyZW4ucHVzaChpbnNwZWN0KGVsZW1lbnQuY2hpbGROb2Rlc1tpXSkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciB3aWR0aCA9IHN0YXJ0VGFnLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciBtdWx0aXBsZUxpbmVzID0gaW5zcGVjdGVkQ2hpbGRyZW4uc29tZShmdW5jdGlvbihvKSB7XG4gICAgICAgICAgICAgIHZhciBzaXplID0gby5zaXplKCk7XG4gICAgICAgICAgICAgIHdpZHRoICs9IHNpemUud2lkdGg7XG4gICAgICAgICAgICAgIHJldHVybiB3aWR0aCA+IDYwIHx8IG8uaGVpZ2h0ID4gMTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBpZiAobXVsdGlwbGVMaW5lcykge1xuICAgICAgICAgICAgICBvdXRwdXQubmwoKS5pbmRlbnRMaW5lcygpO1xuXG4gICAgICAgICAgICAgIGluc3BlY3RlZENoaWxkcmVuLmZvckVhY2goZnVuY3Rpb24oaW5zcGVjdGVkQ2hpbGQsIGluZGV4KSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgICAuaSgpXG4gICAgICAgICAgICAgICAgICAuYmxvY2soaW5zcGVjdGVkQ2hpbGQpXG4gICAgICAgICAgICAgICAgICAubmwoKTtcbiAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgb3V0cHV0Lm91dGRlbnRMaW5lcygpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgaW5zcGVjdGVkQ2hpbGRyZW4uZm9yRWFjaChmdW5jdGlvbihpbnNwZWN0ZWRDaGlsZCwgaW5kZXgpIHtcbiAgICAgICAgICAgICAgICBvdXRwdXQuYXBwZW5kKGluc3BlY3RlZENoaWxkKTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIG91dHB1dC5jb2RlKHN0cmluZ2lmeUVuZFRhZyhlbGVtZW50KSwgJ2h0bWwnKTtcbiAgICAgICAgcmV0dXJuIG91dHB1dDt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XG4gICAgICAgICAgaWYgKFxuICAgICAgICAgICAgYWN0dWFsLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgIT09IGV4cGVjdGVkLm5vZGVOYW1lLnRvTG93ZXJDYXNlKClcbiAgICAgICAgICApIHtcbiAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IoJ3Nob3VsZCBiZScpXG4gICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgLnByaXNtVGFnKGV4cGVjdGVkLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkpO1xuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAubmwoKTtcbiAgICAgICAgICAgIGNhbkNvbnRpbnVlTGluZSA9IGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgYWN0dWFsQXR0cmlidXRlcyA9IGdldEF0dHJpYnV0ZXMoYWN0dWFsKTtcbiAgICAgICAgICB2YXIgZXhwZWN0ZWRBdHRyaWJ1dGVzID0gZ2V0QXR0cmlidXRlcyhleHBlY3RlZCk7XG4gICAgICAgICAgT2JqZWN0LmtleXMoYWN0dWFsQXR0cmlidXRlcykuZm9yRWFjaChmdW5jdGlvbihhdHRyaWJ1dGVOYW1lKSB7XG4gICAgICAgICAgICBvdXRwdXQuc3AoY2FuQ29udGludWVMaW5lID8gMSA6IDIgKyBhY3R1YWwubm9kZU5hbWUubGVuZ3RoKTtcbiAgICAgICAgICAgIHdyaXRlQXR0cmlidXRlVG9NYWdpY1BlbihcbiAgICAgICAgICAgICAgb3V0cHV0LFxuICAgICAgICAgICAgICBhdHRyaWJ1dGVOYW1lLFxuICAgICAgICAgICAgICBhY3R1YWxBdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdLFxuICAgICAgICAgICAgICBpc0h0bWxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgICBpZiAoYXR0cmlidXRlTmFtZSBpbiBleHBlY3RlZEF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgIGFjdHVhbEF0dHJpYnV0ZXNbYXR0cmlidXRlTmFtZV0gPT09XG4gICAgICAgICAgICAgICAgZXhwZWN0ZWRBdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdXG4gICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIGNhbkNvbnRpbnVlTGluZSA9IHRydWU7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgLmFubm90YXRpb25CbG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lcnJvcignc2hvdWxkIGVxdWFsJylcbiAgICAgICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoXG4gICAgICAgICAgICAgICAgICAgICAgICBpbnNwZWN0KGVudGl0aWZ5KGV4cGVjdGVkQXR0cmlidXRlc1thdHRyaWJ1dGVOYW1lXSkpXG4gICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAubmwoKTtcbiAgICAgICAgICAgICAgICBjYW5Db250aW51ZUxpbmUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBkZWxldGUgZXhwZWN0ZWRBdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgLnNwKClcbiAgICAgICAgICAgICAgICAuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgdGhpcy5lcnJvcignc2hvdWxkIGJlIHJlbW92ZWQnKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5ubCgpO1xuICAgICAgICAgICAgICBjYW5Db250aW51ZUxpbmUgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgICBPYmplY3Qua2V5cyhleHBlY3RlZEF0dHJpYnV0ZXMpLmZvckVhY2goZnVuY3Rpb24oYXR0cmlidXRlTmFtZSkge1xuICAgICAgICAgICAgb3V0cHV0LnNwKGNhbkNvbnRpbnVlTGluZSA/IDEgOiAyICsgYWN0dWFsLm5vZGVOYW1lLmxlbmd0aCk7XG4gICAgICAgICAgICBvdXRwdXRcbiAgICAgICAgICAgICAgLmFubm90YXRpb25CbG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmVycm9yKCdtaXNzaW5nJykuc3AoKTtcbiAgICAgICAgICAgICAgICB3cml0ZUF0dHJpYnV0ZVRvTWFnaWNQZW4oXG4gICAgICAgICAgICAgICAgICB0aGlzLFxuICAgICAgICAgICAgICAgICAgYXR0cmlidXRlTmFtZSxcbiAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlc1thdHRyaWJ1dGVOYW1lXSxcbiAgICAgICAgICAgICAgICAgIGlzSHRtbFxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgIC5ubCgpO1xuICAgICAgICAgICAgY2FuQ29udGludWVMaW5lID0gZmFsc2U7XG4gICAgICAgICAgfSk7XG4gICAgICAgICAgb3V0cHV0LnByaXNtUHVuY3R1YXRpb24oJz4nKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBvdXRwdXQuY29kZShzdHJpbmdpZnlTdGFydFRhZyhhY3R1YWwpLCAnaHRtbCcpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFlbXB0eUVsZW1lbnRzKSB7XG4gICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAubmwoKVxuICAgICAgICAgICAgLmluZGVudExpbmVzKClcbiAgICAgICAgICAgIC5pKClcbiAgICAgICAgICAgIC5ibG9jayhcbiAgICAgICAgICAgICAgZGlmZihcbiAgICAgICAgICAgICAgICBtYWtlQXR0YWNoZWRET01Ob2RlTGlzdChhY3R1YWwuY2hpbGROb2RlcyksXG4gICAgICAgICAgICAgICAgbWFrZUF0dGFjaGVkRE9NTm9kZUxpc3QoZXhwZWN0ZWQuY2hpbGROb2RlcylcbiAgICAgICAgICAgICAgKS5kaWZmXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAubmwoKVxuICAgICAgICAgICAgLm91dGRlbnRMaW5lcygpO1xuICAgICAgICB9XG5cbiAgICAgICAgb3V0cHV0LmNvZGUoc3RyaW5naWZ5RW5kVGFnKGFjdHVhbCksICdodG1sJyk7XG4gICAgICAgIHJldHVybiBvdXRwdXQ7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICBleHBlY3QuZXhwb3J0QXNzZXJ0aW9uKFxuICAgICAgJzxET01FbGVtZW50PiB0byBoYXZlIChjbGFzc3xjbGFzc2VzKSA8YXJyYXl8c3RyaW5nPicsXG4gICAgICBmdW5jdGlvbihleHBlY3QsIHN1YmplY3QsIHZhbHVlKSB7XG4gICAgICAgIHJldHVybiBleHBlY3Qoc3ViamVjdCwgJ3RvIGhhdmUgYXR0cmlidXRlcycsIHsgY2xhc3M6IHZhbHVlIH0pO1xuICAgICAgfVxuICAgICk7XG5cbiAgICBleHBlY3QuZXhwb3J0QXNzZXJ0aW9uKFxuICAgICAgJzxET01FbGVtZW50PiB0byBvbmx5IGhhdmUgKGNsYXNzfGNsYXNzZXMpIDxhcnJheXxzdHJpbmc+JyxcbiAgICAgIGZ1bmN0aW9uKGV4cGVjdCwgc3ViamVjdCwgdmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIGV4cGVjdChzdWJqZWN0LCAndG8gaGF2Z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ucy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgJ1Vuc3VwcG9ydGVkIG9wdGlvbicgK1xuICAgICAgICAgICAgICAodW5zdXBwb3J0ZWRPcHRpb25zLmxlbmd0aCA9PT0gMSA/ICcnIDogJ3MnKSArXG4gICAgICAgICAgICAgICc6ICcgK1xuICAgICAgICAgICAgICB1bnN1cHBvcnRlZE9wdGlvbnMuam9pbignLCAnKVxuICAgICAgICAgICk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcHJvbWlzZUJ5S2V5ID0ge1xuICAgICAgICAgIG5hbWU6IGV4cGVjdC5wcm9taXNlKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHZhbHVlICYmIHR5cGVvZiB2YWx1ZS5uYW1lICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICByZXR1cm4gdG9wTGV2ZWxFeHBlY3QoXG4gICAgICAgICAgICAgICAgaXNIdG1sID8gc3ViamVjdC5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpIDogc3ViamVjdC5ub2RlTmFtZSxcbiAgICAgICAgICAgICAgICAndG8gc2F0aXNmeScsXG4gICAgICAgICAgICAgICAgdmFsdWUubmFtZVxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pLFxuICAgICAgICAgIGNoaWxkcmVuOiBleHBlY3QucHJvbWlzZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUuY2hpbGRyZW4gIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUudGV4dENvbnRlbnQgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgICAgICAgJ1RoZSBjaGlsZHJlbiBhbmQgdGV4dENvbnRlbnQgcHJvcGVydGllcyBhcmUgbm90IHN1cHBvcnRlZCB0b2dldGhlcidcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiB0b3BMZXZlbEV4cGVjdChcbiAgICAgICAgICAgICAgICBtYWtlQXR0YWNoZWRET01Ob2RlTGlzdChcbiAgICAgICAgICAgICAgICAgIHN1YmplY3QuY2hpbGROb2RlcyxcbiAgICAgICAgICAgICAgICAgIHN1YmplY3Qub3duZXJEb2N1bWVudC5jb250ZW50VHlwZVxuICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgJ3RvIHNhdGlzZnknLFxuICAgICAgICAgICAgICAgIHZhbHVlLmNoaWxkcmVuXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWx1ZS50ZXh0Q29udGVudCAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHRvcExldmVsRXhwZWN0KFxuICAgICAgICAgICAgICAgIHN1YmplY3QudGV4dENvbnRlbnQsXG4gICAgICAgICAgICAgICAgJ3RvIHNhdGlzZnknLFxuICAgICAgICAgICAgICAgIHZhbHVlLnRleHRDb250ZW50XG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSksXG4gICAgICAgICAgYXR0cmlidXRlczoge31cbiAgICAgICAgfTtcblxuICAgICAgICB2YXIgb25seUF0dHJpYnV0ZXMgPVxuICAgICAgICAgICh2YWx1ZSAmJiB2YWx1ZS5vbmx5QXR0cmlidXRlcykgfHwgZXhwZWN0LmZsYWdzLmV4aGF1c3RpdmVseTtcbiAgICAgICAgdmFyIGF0dHJzID0gZ2V0QXR0cmlidXRlcyhzdWJqZWN0KTtcbiAgICAgICAgdmFyIGV4cGVjdGVkQXR0cmlidXRlcyA9IHZhbHVlICYmIHZhbHVlLmF0dHJpYnV0ZXM7XG4gICAgICAgIHZhciBleHBlY3RlZEF0dHJpYnV0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gICAgICAgICAgfSk7XG5cbiAgICAgICAgICBleHBlY3RlZEF0dHJpYnV0ZU5hbWVzLmZvckVhY2goZnVuY3Rpb24oYXR0cmlidXRlTmFtZSkge1xuICAgICAgICAgICAgdmFyIGF0dHJpYnV0ZVZhbHVlID0gc3ViamVjdC5nZXRBdHRyaWJ1dGUoYXR0cmlidXRlTmFtZSk7XG4gICAgICAgICAgICB2YXIgZXhwZWN0ZWRBdHRyaWJ1dGVWYWx1ZSA9XG4gICAgICAgICAgICAgIGV4cGVjdGVkVmFsdWVCeUF0dHJpYnV0ZU5hbWVbYXR0cmlidXRlTmFtZV07XG4gICAgICAgICAgICBwcm9taXNlQnlLZXkuYXR0cmlidXRlc1thdHRyaWJ1dGVOYW1lXSA9IGV4cGVjdC5wcm9taXNlKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICBpZiAoZXhwZWN0ZWRBdHRyaWJ1dGVWYWx1ZSA9PT0gdHJ1ZSkge1xuICAgICAgICAgICAgICAgIHRvcExldmVsRXhwZWN0KFxuICAgICAgICAgICAgICAgICAgc3ViamVjdC5oYXNBdHRyaWJ1dGUoYXR0cmlidXRlTmFtZSksXG4gICAgICAgICAgICAgICAgICAndG8gYmUgdHJ1ZSdcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlID09PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICAgIHRvcExldmVsRXhwZWN0KFxuICAgICAgICAgICAgICAgICAgc3ViamVjdC5oYXNBdHRyaWJ1dGUoYXR0cmlidXRlTmFtZSksXG4gICAgICAgICAgICAgICAgICAndG8gYmUgZmFsc2UnXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGVOYW1lID09PSAnY2xhc3MnICYmXG4gICAgICAgICAgICAgICAgKHR5cGVvZiBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlID09PSAnc3RyaW5nJyB8fFxuICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShleHBlY3RlZEF0dHJpYnV0ZVZhbHVlKSlcbiAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgdmFyIGFjdHVhbENsYXNzZXMgPSBnZXRDbGFzc05hbWVzRnJvbUF0dHJpYnV0ZVZhbHVlKFxuICAgICAgICAgICAgICAgICAgYXR0cmlidXRlVmFsdWVcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIHZhciBleHBlY3RlZENsYXNzZXMgPSBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlO1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXhwZWN0ZWRDbGFzc2VzID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRDbGFzc2VzID0gZ2V0Q2xhc3NOYW1lc0Zyb21BdHRyaWJ1dGVWYWx1ZShcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRBdHRyaWJ1dGVWYWx1ZVxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG9ubHlBdHRyaWJ1dGVzKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gdG9wTGV2ZWxFeHBlY3QoXG4gICAgICAgICAgICAgICAgICAgIGFjdHVhbENsYXNzZXMuc29ydCgpLFxuICAgICAgICAgICAgICAgICAgICAndG8gZXF1YWwnLFxuICAgICAgICAgICAgICAgICAgICBleHBlY3RlZENsYXNzZXMuc29ydCgpXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gdG9wTGV2ZWxFeHBlY3QuYXBwbHkoXG4gICAgICAgICAgICAgICAgICAgIHRvcExldmVsRXhwZWN0LFxuICAgICAgICAgICAgICAgICAgICBbYWN0dWFsQ2xhc3NlcywgJ3RvIGNvbnRhaW4nXS5jb25jYXQoZXhwZWN0ZWRDbGFzc2VzKVxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAoYXR0cmlidXRlTmFtZSA9PT0gJ3N0eWxlJykge1xuICAgICAgICAgICAgICAgIHZhciBleHBlY3RlZFN0eWxlT2JqO1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZS5zdHlsZSA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICAgIGV4cGVjdGVkU3R5bGVPYmogPSBzdHlsZVN0cmluZ1RvT2JqZWN0KFxuICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFZhbHVlQnlBdHRyaWJ1dGVOYW1lLnN0eWxlXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICBleHBlY3RlZFN0eWxlT2JqID0gZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZS5zdHlsZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAob25seUF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiB0b3BMZXZlbEV4cGVjdChcbiAgICAgICAgICAgICAgICAgICAgYXR0cnMuc3R5bGUsXG4gICAgICAgICAgICAgICAgICAgICd0byBleGhhdXN0aXZlbHkgc2F0aXNmeScsXG4gICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkU3R5bGVPYmpcbiAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiB0b3BMZXZlbEV4cGVjdChcbiAgICAgICAgICAgICAgICAgICAgYXR0cnMuc3R5bGUsXG4gICAgICAgICAgICAgICAgICAgICd0byBzYXRpc2Z5JyxcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRTdHlsZU9ialxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRvcExldmVsRXhwZWN0KFxuICAgICAgICAgICAgICAgICAgYXR0cmlidXRlVmFsdWUsXG4gICAgICAgICAgICAgICAgICAndG8gc2F0aXNmeScsXG4gICAgICAgICAgICAgICAgICBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgICBwcm9taXNlQnlLZXkuYXR0cmlidXRlUHJlc2VuY2UgPSBleHBlY3QucHJvbWlzZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBhdHRyaWJ1dGVOYW1lc0V4cGVjdGVkVG9CZURlZmluZWQgPSBbXTtcbiAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlTmFtZXMuZm9yRWFjaChmdW5jdGlvbihhdHRyaWJ1dGVOYW1lKSB7XG4gICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICB0eXBlb2YgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZVthdHRyaWJ1dGVOYW1lXSA9PT1cbiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJ1xuICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBleHBlY3QoYXR0cnMsICdub3QgdG8gaGF2ZSBrZXknLCBhdHRyaWJ1dGVOYW1lKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGVOYW1lc0V4cGVjdGVkVG9CZURlZmluZWQucHVzaChhdHRyaWJ1dGVOYW1lKTtcbiAgICAgICAgICAgICAgICBleHBlY3QoYXR0cnMsICd0byBoYXZlIGtleScsIGF0dHJpYnV0ZU5hbWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChvbmx5QXR0cmlidXRlcykge1xuICAgICAgICAgICAgICBleHBlY3QoXG4gICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoYXR0cnMpLnNvcnQoKSxcbiAgICAgICAgICAgICAgICAndG8gZXF1YWwnLFxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZU5hbWVzRXhwZWN0ZWRUb0JlRGVmaW5lZC5zb3J0KClcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHBlY3QucHJvbWlzZS5hbGwocHJvbWlzZUJ5S2V5KS5jYXVnaHQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgcmV0dXJuIGV4cGVjdC5wcm9taXNlLnNldHRsZShwcm9taXNlQnlLZXkpLnRoZW4oZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBleHBlY3QuZmFpbCh7XG4gICAgICAgICAgICAgIGRpZmY6IGZ1bmN0aW9uKG91dHB1dCwgZGlmZiwgaW5zcGVjdCwgZXF1YWwpIHtcbiAgICAgICAgICAgICAgICBvdXRwdXQuYmxvY2soZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICB2YXIgb3V0cHV0ID0gdGhpcztcbiAgICAgICAgICAgICAgICAgIHZhciBzZWVuRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAgICAgICAucHJpc21QdW5jdHVhdGlvbignPCcpXG4gICAgICAgICAgICAgICAgICAgIC5wcmlzbVRhZyhcbiAgICAgICAgICAgICAgICAgICAgICBpc0h0bWwgPyBzdWJqZWN0Lm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgOiBzdWJqZWN0Lm5vZGVOYW1lXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICBpZiAocHJvbWlzZUJ5S2V5Lm5hbWUuaXNSZWplY3RlZCgpKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlZW5FcnJvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHZhciBuYW1lRXJyb3IgPSBwcm9taXNlQnlLZXkubmFtZS5yZWFzb24oKTtcbiAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNwKCkuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAobmFtZUVycm9yICYmIG5hbWVFcnJvci5nZXRMYWJlbCgpKSB8fCAnc2hvdWxkIHNhdGlzZnknXG4gICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnNwKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoaW5zcGVjdCh2YWx1ZS5uYW1lKSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgdmFyIGluc3BlY3RlZEF0dHJpYnV0ZXMgPSBbXTtcbiAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGF0dHJzKS5mb3JFYWNoKGZ1bmN0aW9uKGF0dHJpYnV0ZU5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGF0dHJpYnV0ZU91dHB1dCA9IG91dHB1dC5jbG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZSA9IHByb21pc2VCeUtleS5hdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdO1xuICAgICAgICAgICAgICAgICAgICB3cml0ZUF0dHJpYnV0ZVRvTWFnaWNQZW4oXG4gICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlT3V0cHV0LFxuICAgICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZU5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgYXR0cnNbYXR0cmlidXRlTmFtZV0sXG4gICAgICAgICAgICAgICAgICAgICAgaXNIdG1sXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgICAgICAocHJvbWlzZSAmJiBwcm9taXNlLmlzRnVsZmlsbGVkKCkpIHx8XG4gICAgICAgICAgICAgICAgICAgICAgKCFwcm9taXNlICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAoIW9ubHlBdHRyaWJ1dGVzIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlTmFtZXMuaW5kZXhPZihhdHRyaWJ1dGVOYW1lKSAhPT0gLTEpKVxuICAgICAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBzZWVuRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZU91dHB1dC5zcCgpLmFubm90YXRpb25CbG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZSAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlb2YgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZVthdHRyaWJ1dGVOYW1lXSAhPT1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJ1xuICAgICAgICAgICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKHByb21pc2UucmVhc29uKCkuZ2V0RXJyb3JNZXNzYWdlKHRoaXMpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHlBdHRyaWJ1dGVzID09PSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IoJ3Nob3VsZCBiZSByZW1vdmVkJyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaW5zcGVjdGVkQXR0cmlidXRlcy5wdXNoKGF0dHJpYnV0ZU91dHB1dCk7XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlTmFtZXMuZm9yRWFjaChmdW5jdGlvbihhdHRyaWJ1dGVOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghc3ViamVjdC5oYXNBdHRyaWJ1dGUoYXR0cmlidXRlTmFtZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZSA9IHByb21pc2VCeUtleS5hdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgIGlmICghcHJvbWlzZSB8fCBwcm9taXNlLmlzUmVqZWN0ZWQoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2VlbkVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlcnIgPSBwcm9taXNlICYmIHByb21pc2UucmVhc29uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgYXR0cmlidXRlT3V0cHV0ID0gb3V0cHV0XG4gICAgICAgICAgICAgICAgICAgICAgICAgIC5jbG9uZSgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgIC5hbm5vdGF0aW9uQmxvY2soZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lcnJvcignbWlzc2luZycpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnByaXNtQXR0ck5hbWUoYXR0cmlidXRlTmFtZSwgJ2h0bWwnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFZhbHVlQnlBdHRyaWJ1dGVOYW1lW2F0dHJpYnV0ZU5hbWVdICE9PVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zcCgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5lcnJvcihcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZXJyICYmIGVyci5nZXRMYWJlbCgpKSB8fCAnc2hvdWxkIHNhdGlzZnknXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNwKClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmFwcGVuZChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnNwZWN0KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZVthdHRyaWJ1dGVOYW1lXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5zcGVjdGVkQXR0cmlidXRlcy5wdXNoKGF0dHJpYnV0ZU91dHB1dCk7XG4gICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgIGlmIChpbnNwZWN0ZWRBdHRyaWJ1dGVzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlZW5FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAgICAgICAgICAgLm5sKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pbmRlbnRMaW5lcygpXG4gICAgICAgICAgICAgICAgICAgICAgICAuaW5kZW50KClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ibG9jayhmdW5jdGlvbihvdXRwdXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zcGVjdGVkQXR0cmlidXRlcy5mb3JFYWNoKGZ1bmN0aW9uKGl0ZW0sIGkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5ubCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQuYXBwZW5kKGl0ZW0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAub3V0ZGVudExpbmVzKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ubCgpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5zcCgpO1xuICAgICAgICAgICAgICAgICAgICAgIGluc3BlY3RlZEF0dHJpYnV0ZXMuZm9yRWFjaChmdW5jdGlvbihpdGVtLCBpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNwKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQuYXBwZW5kKGl0ZW0pO1xuICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNlZW5FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAvLyBUaGUgdGFnIG5hbWUgbWlzbWF0Y2hlZFxuICAgICAgICAgICAgICAgICAgICBvdXRwdXQubmwoKTtcbiAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgb3V0cHV0LnByaXNtUHVuY3R1YXRpb24oJz4nKTtcbiAgICAgICAgICAgICAgICAgIHZhciBjaGlsZHJlbkVycm9yID1cbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZUJ5S2V5LmNoaWxkcmVuLmlzUmVqZWN0ZWQoKSAmJlxuICAgICAgICAgICAgICAgICAgICBwcm9taXNlQnlLZXkuY2hpbGRyZW4ucmVhc29uKCk7XG4gICAgICAgICAgICAgICAgICBpZiAoY2hpbGRyZW5FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRyZW5EaWZmID0gY2hpbGRyZW5FcnJvci5nZXREaWZmKG91dHB1dCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZHJlbkRpZmYgJiYgY2hpbGRyZW5EaWZmLmlubGluZSkge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMubmwoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmluZGVudExpbmVzKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ibG9jayhjaGlsZHJlbkRpZmYuZGlmZilcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ubCgpXG4gICAgICAgICAgICAgICAgICAgICAgICAub3V0ZGVudExpbmVzKCk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgICAgICAgICAubmwoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmluZGVudExpbmVzKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ibG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA8IHN1YmplY3QuY2hpbGROb2Rlcy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaSArPSAxXG4gICAgICAgICAgICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKGluc3BlY3Qoc3ViamVjdC5jaGlsZE5vZGVzW2ldKSkubmwoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNwKCkuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hcHBlbmQoY2hpbGRyZW5FcnJvci5nZXRFcnJvck1lc3NhZ2UodGhpcykpO1xuICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5ubCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN1YmplY3QuY2hpbGROb2Rlcy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKGluc3BlY3Qoc3ViamVjdC5jaGlsZE5vZGVzW2ldKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIG91dHB1dC5jb2RlKHN0cmluZ2lmeUVuZFRhZyhzdWJqZWN0KSwgJ2h0bWwnKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBvdXRwdXQuaW5saW5lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICByZXR1cm4gb3V0cHV0O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgKTtcblxuICAgIGV4cGVjdC5leHBvcnRBc3NlcnRpb24oXG4gICAgICAnPERPTUVsZW1lbnQ+IHRvIFtvbmx5XSBoYXZlIChhdHRyaWJ1dGV8YXR0cmlidXRlcykgPHN0cmluZys+JyxcbiAgICAgIGZ1bmN0aW9uKGV4cGVjdCwgc3ViamVjdCwgdmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIGV4cGVjdChcbiAgICAgICAgICBzdWJqZWN0LFxuICAgICAgICAgICd0byBbb25seV0gaGF2ZSBhdHRyaWJ1dGVzJyxcbiAgICAgICAgICBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDIpXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgKTtcblxuICAgIGV4cGVjdC5leHBvcnRBc3NlcnRpb24oXG4gICAgICAnPERPTUVsZW1lbnQ+IG5vdCB0byBoYXZlIChhdHRyaWJ1dGV8YXR0cmlidXRlcykgPGFycmF5PicsXG4gICAgICBmdW5jdGlvbihleHBlY3QsIHN1YmplY3QsIHZhbHVlKSB7XG4gICAgICAgIHZhciBhdHRyaWJ1dGVzID0gZ2V0QXR0cmlidXRlcyhzdWJqZWN0KTtcblxuICAgICAgICB2YWx1ZS5mb3JFYWNoKGZ1bmN0aW9uKG5hbWUpIHtcbiAgICAgICAgICBkZWxldGUgYXR0cml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wb3J0cyA9IHtcbiAgICBuYW1lOiAnbWFnaWNwZW4tcHJpc20nLFxuICAgIHZlcnNpb246IHJlcXVpcmUoJy4uL3BhY2thZ2UuanNvbicpLnZlcnNpb24sXG4gICAgaW5zdGFsbEludG86IGZ1bmN0aW9uIChtYWdpY1Blbikge1xuICAgICAgICBtYWdpY1Blbi5pbnN0YWxsVGhlbWUoZGVmYXVsdFRoZW1lKTtcblxuICAgICAgICBtYWdpY1Blbi5hZGRTdHlsZSgnY29kZScsIGZ1bmN0aW9uIChzb3VyY2VUZXh0LCBsYW5ndWFnZSkge1xuICAgICAgICAgICAgaWYgKGxhbmd1YWdlIGluIGxhbmd1YWdlTWFwcGluZykge1xuICAgICAgICAgICAgICAgIGxhbmd1YWdlID0gbGFuZ3VhZ2VNYXBwaW5nW2xhbmd1YWdlXTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoL1xcK3htbFxcYi8udGVzdChsYW5ndWFnZSkpIHtcbiAgICAgICAgICAgICAgICBsYW5ndWFnZSA9ICdtYXJrdXAnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCEobGFuZ3VhZ2UgaW4gcHJpc20ubGFuZ3VhZ2VzKSkge1xuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnRleHQoc291cmNlVGV4dCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciB0aGF0ID0gdGhpcztcbiAgICAgICAgICAgIHZhciBjYXBpdGFsaXplZExhbmd1YWdlID0gdXBwZXJDYW1lbENhc2UobGFuZ3VhZ2UpO1xuICAgICAgICAgICAgdmFyIGxhbmd1YWdlRGVmaW5pdGlvbiA9IHByaXNtLmxhbmd1YWdlc1tsYW5ndWFnZV07XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHByaW50VG9rZW5zKHRva2VuLCBwYXJlbnRTdHlsZSkge1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHRva2VuKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2tlbi5mb3JFYWNoKGZ1bmN0aW9uIChzdWJUb2tlbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRUb2tlbnMoc3ViVG9rZW4sIHBhcmVudFN0eWxlKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdG9rZW4gPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciB1cHBlckNhbWVsQ2FzZWRQYXJlbnRTdHlsZSA9IHVwcGVyQ2FtZWxDYXNlKHBhcmVudFN0eWxlKTtcbiAgICAgICAgICAgICAgICAgICAgdG9rZW4gPSB0b2tlbi5yZXBsYWNlKC8mbHQ7L2csICc8Jyk7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGF0WydwcmlzbScgKyBjYXBpdGFsaXplZExhbmd1YWdlICsgdXBwZXJDYW1lbENhc2VkUGFyZW50U3R5bGVdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGF0WydwcmlzbScgKyBjYXBpdGFsaXplZExhbmd1YWdlICsgdXBwZXJDYW1lbENhc2VkUGFyZW50U3R5bGVdKHRva2VuKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0aGF0WydwcmlzbScgKyB1cHBlckNhbWVsQ2FzZWRQYXJlbnRTdHlsZV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoYXRbJ3ByaXNtJyArIHVwcGVyQ2FtZWxDYXNlZFBhcmVudFN0eWxlXSh0b2tlbik7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGFuZ3VhZ2VEZWZpbml0aW9uW3BhcmVudFN0eWxlXSAmJiBsYW5ndWFnZURlZmluaXRpb25bcGFyZW50U3R5bGVdLmFsaWFzKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwcmludFRva2Vucyh0b2tlbiwgbGFuZ3VhZ2VEZWZpbml0aW9uW3BhcmVudF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cm4gKFxuICAgICAgICAgIG9iaiAmJlxuICAgICAgICAgIHR5cGVvZiBvYmoubm9kZVR5cGUgPT09ICdudW1iZXInICYmXG4gICAgICAgICAgb2JqLm5vZGVUeXBlID09PSAxMCAmJlxuICAgICAgICAgICdwdWJsaWNJZCcgaW4gb2JqXG4gICAgICAgICk7XG4gICAgICB9LFxuICAgICAgaW5zcGVjdDogZnVuY3Rpb24oZG9jdHlwZSwgZGVwdGgsIG91dHB1dCwgaW5zcGVjdCkge1xuICAgICAgICByZXR1cm4gb3V0cHV0LmNvZGUoJzwhRE9DVFlQRSAnICsgZG9jdHlwZS5uYW1lICsgJz4nLCAnaHRtbCcpO1xuICAgICAgfSxcbiAgICAgIGVxdWFsOiBmdW5jdGlvbihhLCBiKSB7XG4gICAgICAgIHJldHVybiBhLnRvU3RyaW5nKCkgPT09IGIudG9TdHJpbmcoKTtcbiAgICAgIH0sXG4gICAgICBkaWZmOiBmdW5jdGlvbihhY3R1YWwsIGV4cGVjdGVkLCBvdXRwdXQsIGRpZmYpIHtcbiAgICAgICAgdmFyIGQgPSBkaWZmKFxuICAgICAgICAgICc8IURPQ1RZUEUgJyArIGFjdHVhbC5uYW1lICsgJz4nLFxuICAgICAgICAgICc8IURPQ1RZUEUgJyArIGV4cGVjdGVkLm5hbWUgKyAnPidcbiAgICAgICAgKTtcbiAgICAgICAgZC5pbmxpbmUgPSB0cnVlO1xuICAgICAgICByZXR1cm4gZDtcbiAgICAgIH1cbiAgICB9KTtcblxuICAgIGV4cGVjdC5leHBvcnRUeXBlKHtcbiAgICAgIG5hbWU6ICdET01Eb2N1bWVudCcsXG4gICAgICBiYXNlOiAnRE9NTm9kZScsXG4gICAgICBpZGVudGlmeTogZnVuY3Rpb24ob2JqKSB7XG4gICAgICAgIHJldHVybiAoXG4gICAgICAgICAgb2JqICYmXG4gICAgICAgICAgdHlwZW9mIG9iai5ub2RlVHlwZSA9PT0gJ251bWJlcicgJiZcbiAgICAgICAgICBvYmoubm9kZVR5c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ZWxzZSB7XG4gICAgICAgICAgICB2YXIgaW5zcGVjdGVkQ2hpbGRyZW4gPSBbXTtcbiAgICAgICAgICAgIGlmIChlbGVtZW50TmFtZSA9PT0gJ3NjcmlwdCcpIHtcbiAgICAgICAgICAgICAgdmFyIHR5cGUgPSBlbGVtZW50LmdldEF0dHJpYnV0ZSgndHlwZScpO1xuICAgICAgICAgICAgICBpZiAoIXR5cGUgfHwgL2phdmFzY3JpcHQvLnRlc3QodHlwZSkpIHtcbiAgICAgICAgICAgICAgICB0eXBlID0gJ2phdmFzY3JpcHQnO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGluc3BlY3RlZENoaWxkcmVuLnB1c2goXG4gICAgICAgICAgICAgICAgb3V0cHV0LmNsb25lKCkuY29kZShlbGVtZW50LnRleHRDb250ZW50LCB0eXBlKVxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfSBlbHNlIGlmIChlbGVtZW50TmFtZSA9PT0gJ3N0eWxlJykge1xuICAgICAgICAgICAgICBpbnNwZWN0ZWRDaGlsZHJlbi5wdXNoKFxuICAgICAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAgICAgLmNsb25lKClcbiAgICAgICAgICAgICAgICAgIC5jb2RlKFxuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnRleHRDb250ZW50LFxuICAgICAgICAgICAgICAgICAgICBlbGVtZW50LmdldEF0dHJpYnV0ZSgndHlwZScpIHx8ICd0ZXh0L2NzcydcbiAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZWxlbWVudC5jaGlsZE5vZGVzLmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgaW5zcGVjdGVkQ2hpbGRyZW4ucHVzaChpbnNwZWN0KGVsZW1lbnQuY2hpbGROb2Rlc1tpXSkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHZhciB3aWR0aCA9IHN0YXJ0VGFnLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciBtdWx0aXBsZUxpbmVzID0gaW5zcGVjdGVkQ2hpbGRyZW4uc29tZShmdW5jdGlvbihvKSB7XG4gICAgICAgICAgICAgIHZhciBzaXplID0gby5zaXplKCk7XG4gICAgICAgICAgICAgIHdpZHRoICs9IHNpemUud2lkdGg7XG4gICAgICAgICAgICAgIHJldHVybiB3aWR0aCA+IDYwIHx8IG8uaGVpZ2h0ID4gMTtcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICBpZiAobXVsdGlwbGVMaW5lcykge1xuICAgICAgICAgICAgICBvdXRwdXQubmwoKS5pbmRlbnRMaW5lcygpO1xuXG4gICAgICAgICAgICAgIGluc3BlY3RlZENoaWxkcmVuLmZvckVhY2goZnVuY3Rpb24oaW5zcGVjdGVkQ2hpbGQsIGluZGV4KSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgICAuaSgpXG4gICAgICAgICAgICAgICAgICAuYmxvY2soaW5zcGVjdGVkQ2hpbGQpXG4gICAgICAgICAgICAgICAgICAubmwoKTtcbiAgICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgICAgb3V0cHV0Lm91dGRlbnRMaW5lcygpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgaW5zcGVjdGVkQ2hpbGRyZW4uZm9yRWFjaChmdW5jdGlvbihpbnNwZWN0ZWRDaGlsZCwgaW5kZXgpIHtcbiAgICAgICAgICAgICAgICBvdXRwdXQuYXBwZW5kKGluc3BlY3RlZENoaWxkKTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIG91dHB1dC5jb2RlKHN0cmluZ2lmeUVuZFRhZyhlbGVtZW50KSwgJ2h0bWwnKTtc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kZU5hbWUudG9Mb3dlckNhc2UoKSk7XG4gICAgICAgICAgaWYgKFxuICAgICAgICAgICAgYWN0dWFsLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgIT09IGV4cGVjdGVkLm5vZGVOYW1lLnRvTG93ZXJDYXNlKClcbiAgICAgICAgICApIHtcbiAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IoJ3Nob3VsZCBiZScpXG4gICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgLnByaXNtVGFnKGV4cGVjdGVkLm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkpO1xuICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAubmwoKTtcbiAgICAgICAgICAgIGNhbkNvbnRpbnVlTGluZSA9IGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgYWN0dWFsQXR0cmlidXRlcyA9IGdldEF0dHJpYnV0ZXMoYWN0dWFsKTtcbiAgICAgICAgICB2YXIgZXhwZWN0ZWRBdHRyaWJ1dGVzID0gZ2V0QXR0cmlidXRlcyhleHBlY3RlZCk7XG4gICAgICAgICAgT2JqZWN0LmtleXMoYWN0dWFsQXR0cmlidXRlcykuZm9yRWFjaChmdW5jdGlvbihhdHRyaWJ1dGVOYW1lKSB7XG4gICAgICAgICAgICBvdXRwdXQuc3AoY2FuQ29udGludWVMaW5lID8gMSA6IDIgKyBhY3R1YWwubm9kZU5hbWUubGVuZ3RoKTtcbiAgICAgICAgICAgIHdyaXRlQXR0cmlidXRlVG9NYWdpY1BlbihcbiAgICAgICAgICAgICAgb3V0cHV0LFxuICAgICAgICAgICAgICBhdHRyaWJ1dGVOYW1lLFxuICAgICAgICAgICAgICBhY3R1YWxBdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdLFxuICAgICAgICAgICAgICBpc0h0bWxcbiAgICAgICAgICAgICk7XG4gICAgICAgICAgICBpZiAoYXR0cmlidXRlTmFtZSBpbiBleHBlY3RlZEF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgaWYgKFxuICAgICAgICAgICAgICAgIGFjdHVhbEF0dHJpYnV0ZXNbYXR0cmlidXRlTmFtZV0gPT09XG4gICAgICAgICAgICAgICAgZXhwZWN0ZWRBdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdXG4gICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgIGNhbkNvbnRpbnVlTGluZSA9IHRydWU7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgLmFubm90YXRpb25CbG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5lcnJvcignc2hvdWxkIGVxdWFsJylcbiAgICAgICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoXG4gICAgICAgICAgICAgICAgICAgICAgICBpbnNwZWN0KGVudGl0aWZ5KGV4cGVjdGVkQXR0cmlidXRlc1thdHRyaWJ1dGVOYW1lXSkpXG4gICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAubmwoKTtcbiAgICAgICAgICAgICAgICBjYW5Db250aW51ZUxpbmUgPSBmYWxzZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBkZWxldGUgZXhwZWN0ZWRBdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgLnNwKClcbiAgICAgICAgICAgICAgICAuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgdGhpcy5lcnJvcignc2hvdWxkIGJlIHJlbW92ZWQnKTtcbiAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5ubCgpO1xuICAgICAgICAgICAgICBjYW5Db250aW51ZUxpbmUgPSBmYWxzZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgICBPYmplY3Qua2V5cyhleHBlY3RlZEF0dHJpYnV0ZXMpLmZvckVhY2goZnVuY3Rpb24oYXR0cmlidXRlTmFtZSkge1xuICAgICAgICAgICAgb3V0cHV0LnNwKGNhbkNvbnRpbnVlTGluZSA/IDEgOiAyICsgYWN0dWFsLm5vZGVOYW1lLmxlbmd0aCk7XG4gICAgICAgICAgICBvdXRwdXRcbiAgICAgICAgICAgICAgLmFubm90YXRpb25CbG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICB0aGlzLmVycm9yKCdtaXNzaW5nJykuc3AoKTtcbiAgICAgICAgICAgICAgICB3cml0ZUF0dHJpYnV0ZVRvTWFnaWNQZW4oXG4gICAgICAgICAgICAgICAgICB0aGlzLFxuICAgICAgICAgICAgICAgICAgYXR0cmlidXRlTmFtZSxcbiAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlc1thdHRyaWJ1dGVOYW1lXSxcbiAgICAgICAgICAgICAgICAgIGlzSHRtbFxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgIC5ubCgpO1xuICAgICAgICAgICAgY2FuQ29udGludWVMaW5lID0gZmFsc2U7XG4gICAgICAgICAgfSk7XG4gICAgICAgICAgb3V0cHV0LnByaXNtUHVuY3R1YXRpb24oJz4nKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBvdXRwdXQuY29kZShzdHJpbmdpZnlTdGFydFRhZyhhY3R1YWwpLCAnaHRtbCcpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCFlbXB0eUVsZW1lbnRzKSB7XG4gICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAubmwoKVxuICAgICAgICAgICAgLmluZGVudExpbmVzKClcbiAgICAgICAgICAgIC5pKClcbiAgICAgICAgICAgIC5ibG9jayhcbiAgICAgICAgICAgICAgZGlmZihcbiAgICAgICAgICAgICAgICBtYWtlQXR0YWNoZWRET01Ob2RlTGlzdChhY3R1YWwuY2hpbGROb2RlcyksXG4gICAgICAgICAgICAgICAgbWFrZUF0dGFjaGVkRE9NTm9kZUxpc3QoZXhwZWN0ZWQuY2hpbGROb2RlcylcbiAgICAgICAgICAgICAgKS5kaWZmXG4gICAgICAgICAgICApXG4gICAgICAgICAgICAubmwoKVxuICAgICAgICAgICAgLm91dGRlbnRMaW5lcygpO1xuICAgICAgICB9XG5cbiAgICAgICAgb3V0cHV0LmNvZGUoc3RyaW5naWZ5RW5kVGFnKGFjdHVhbCksICdodG1sJyk7XG4gICAgICAgIHJldHVybiBvdXRwdXQ7XG4gICAgICB9XG4gICAgfSk7XG5cbiAgICBleHBlY3QuZXhwb3J0QXNzZXJ0aW9uKFxuICAgICAgJzxET01FbGVtZW50PiB0byBoYXZlIChjbGFzc3xjbGFzc2VzKSA8YXJyYXl8c3RyaW5nPicsXG4gICAgICBmdW5jdGlvbihleHBlY3QsIHN1YmplY3QsIHZhbHVlKSB7XG4gICAgICAgIHJldHVybiBleHBlY3Qoc3ViamVjdCwgJ3RvIGhhdmUgYXR0cmlidXRlcycsIHsgY2xhc3M6IHZhbHVlIH0pO1xuICAgICAgfVxuICAgICk7XG5cbiAgICBleHBlY3QuZXhwb3J0QXNzZXJ0aW9uKFxuICAgICAgJzxET01FbGVtZW50PiB0byBvbmx5IGhhdmUgKGNsYXNzfGNsYXNzZXMpIDxhcnJheXxzdHJpbmc+JyxcbiAgICAgIGZ1bmN0aW9uKGV4cGVjdCwgc3ViamVjdCwgdmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIGV4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mJlxuICAgICAgICAgICAga2V5ICE9PSAnb25seUF0dHJpYnV0ZXMnICYmXG4gICAgICAgICAgICBrZXkgIT09ICd0ZXh0Q29udGVudCdcbiAgICAgICAgICApO1xuICAgICAgICB9KTtcbiAgICAgICAgaWYgKHVuc3VwcG9ydGVkT3B0aW9ucy5sZW5ndGggPiAwKSB7XG4gICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgJ1Vuc3VwcG9ydGVkIG9wdGlvbicgK1xuICAgICAgICAgICAgICAodW5zdXBwb3J0ZWRPcHRpb25zLmxlbmd0aCA9PT0gMSA/ICcnIDogJ3MnKSArXG4gICAgICAgICAgICAgICc6ICcgK1xuICAgICAgICAgICAgICB1bnN1cHBvcnRlZE9wdGlvbnMuam9pbignLCAnKVxuICAgICAgICAgICk7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgcHJvbWlzZUJ5S2V5ID0ge1xuICAgICAgICAgIG5hbWU6IGV4cGVjdC5wcm9taXNlKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgaWYgKHZhbHVlICYmIHR5cGVvZiB2YWx1ZS5uYW1lICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgICAgICAgICByZXR1cm4gdG9wTGV2ZWxFeHBlY3QoXG4gICAgICAgICAgICAgICAgaXNIdG1sID8gc3ViamVjdC5ub2RlTmFtZS50b0xvd2VyQ2FzZSgpIDogc3ViamVjdC5ub2RlTmFtZSxcbiAgICAgICAgICAgICAgICAndG8gc2F0aXNmeScsXG4gICAgICAgICAgICAgICAgdmFsdWUubmFtZVxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pLFxuICAgICAgICAgIGNoaWxkcmVuOiBleHBlY3QucHJvbWlzZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUuY2hpbGRyZW4gIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUudGV4dENvbnRlbnQgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgICAgICAgICAgICAgJ1RoZSBjaGlsZHJlbiBhbmQgdGV4dENvbnRlbnQgcHJvcGVydGllcyBhcmUgbm90IHN1cHBvcnRlZCB0b2dldGhlcidcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiB0b3BMZXZlbEV4cGVjdChcbiAgICAgICAgICAgICAgICBtYWtlQXR0YWNoZWRET01Ob2RlTGlzdChcbiAgICAgICAgICAgICAgICAgIHN1YmplY3QuY2hpbGROb2RlcyxcbiAgICAgICAgICAgICAgICAgIHN1YmplY3Qub3duZXJEb2N1bWVudC5jb250ZW50VHlwZVxuICAgICAgICAgICAgICAgICksXG4gICAgICAgICAgICAgICAgJ3RvIHNhdGlzZnknLFxuICAgICAgICAgICAgICAgIHZhbHVlLmNoaWxkcmVuXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiB2YWx1ZS50ZXh0Q29udGVudCAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIHRvcExldmVsRXhwZWN0KFxuICAgICAgICAgICAgICAgIHN1YmplY3QudGV4dENvbnRlbnQsXG4gICAgICAgICAgICAgICAgJ3RvIHNhdGlzZnknLFxuICAgICAgICAgICAgICAgIHZhbHVlLnRleHRDb250ZW50XG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSksXG4gICAgICAgICAgYXR0cmlidXRlczoge31cbiAgICAgICAgfTtcblxuICAgICAgICB2YXIgb25seUF0dHJpYnV0ZXMgPVxuICAgICAgICAgICh2YWx1ZSAmJiB2YWx1ZS5vbmx5QXR0cmlidXRlcykgfHwgZXhwZWN0LmZsYWdzLmV4aGF1c3RpdmVseTtcbiAgICAgICAgdm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AgICAndG8gYmUgZmFsc2UnXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGVOYW1lID09PSAnY2xhc3MnICYmXG4gICAgICAgICAgICAgICAgKHR5cGVvZiBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlID09PSAnc3RyaW5nJyB8fFxuICAgICAgICAgICAgICAgICAgQXJyYXkuaXNBcnJheShleHBlY3RlZEF0dHJpYnV0ZVZhbHVlKSlcbiAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgdmFyIGFjdHVhbENsYXNzZXMgPSBnZXRDbGFzc05hbWVzRnJvbUF0dHJpYnV0ZVZhbHVlKFxuICAgICAgICAgICAgICAgICAgYXR0cmlidXRlVmFsdWVcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIHZhciBleHBlY3RlZENsYXNzZXMgPSBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlO1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXhwZWN0ZWRDbGFzc2VzID09PSAnc3RyaW5nJykge1xuICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRDbGFzc2VzID0gZ2V0Q2xhc3NOYW1lc0Zyb21BdHRyaWJ1dGVWYWx1ZShcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRBdHRyaWJ1dGVWYWx1ZVxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKG9ubHlBdHRyaWJ1dGVzKSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gdG9wTGV2ZWxFeHBlY3QoXG4gICAgICAgICAgICAgICAgICAgIGFjdHVhbENsYXNzZXMuc29ydCgpLFxuICAgICAgICAgICAgICAgICAgICAndG8gZXF1YWwnLFxuICAgICAgICAgICAgICAgICAgICBleHBlY3RlZENsYXNzZXMuc29ydCgpXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gdG9wTGV2ZWxFeHBlY3QuYXBwbHkoXG4gICAgICAgICAgICAgICAgICAgIHRvcExldmVsRXhwZWN0LFxuICAgICAgICAgICAgICAgICAgICBbYWN0dWFsQ2xhc3NlcywgJ3RvIGNvbnRhaW4nXS5jb25jYXQoZXhwZWN0ZWRDbGFzc2VzKVxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAoYXR0cmlidXRlTmFtZSA9PT0gJ3N0eWxlJykge1xuICAgICAgICAgICAgICAgIHZhciBleHBlY3RlZFN0eWxlT2JqO1xuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZS5zdHlsZSA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICAgIGV4cGVjdGVkU3R5bGVPYmogPSBzdHlsZVN0cmluZ1RvT2JqZWN0KFxuICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFZhbHVlQnlBdHRyaWJ1dGVOYW1lLnN0eWxlXG4gICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICBleHBlY3RlZFN0eWxlT2JqID0gZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZS5zdHlsZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAob25seUF0dHJpYnV0ZXMpIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiB0b3BMZXZlbEV4cGVjdChcbiAgICAgICAgICAgICAgICAgICAgYXR0cnMuc3R5bGUsXG4gICAgICAgICAgICAgICAgICAgICd0byBleGhhdXN0aXZlbHkgc2F0aXNmeScsXG4gICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkU3R5bGVPYmpcbiAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIHJldHVybiB0b3BMZXZlbEV4cGVjdChcbiAgICAgICAgICAgICAgICAgICAgYXR0cnMuc3R5bGUsXG4gICAgICAgICAgICAgICAgICAgICd0byBzYXRpc2Z5JyxcbiAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRTdHlsZU9ialxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRvcExldmVsRXhwZWN0KFxuICAgICAgICAgICAgICAgICAgYXR0cmlidXRlVmFsdWUsXG4gICAgICAgICAgICAgICAgICAndG8gc2F0aXNmeScsXG4gICAgICAgICAgICAgICAgICBleHBlY3RlZEF0dHJpYnV0ZVZhbHVlXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSk7XG5cbiAgICAgICAgICBwcm9taXNlQnlLZXkuYXR0cmlidXRlUHJlc2VuY2UgPSBleHBlY3QucHJvbWlzZShmdW5jdGlvbigpIHtcbiAgICAgICAgICAgIHZhciBhdHRyaWJ1dGVOYW1lc0V4cGVjdGVkVG9CZURlZmluZWQgPSBbXTtcbiAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlTmFtZXMuZm9yRWFjaChmdW5jdGlvbihhdHRyaWJ1dGVOYW1lKSB7XG4gICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICB0eXBlb2YgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZVthdHRyaWJ1dGVOYW1lXSA9PT1cbiAgICAgICAgICAgICAgICAndW5kZWZpbmVkJ1xuICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICBleHBlY3QoYXR0cnMsICdub3QgdG8gaGF2ZSBrZXknLCBhdHRyaWJ1dGVOYW1lKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBhdHRyaWJ1dGVOYW1lc0V4cGVjdGVkVG9CZURlZmluZWQucHVzaChhdHRyaWJ1dGVOYW1lKTtcbiAgICAgICAgICAgICAgICBleHBlY3QoYXR0cnMsICd0byBoYXZlIGtleScsIGF0dHJpYnV0ZU5hbWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIGlmIChvbmx5QXR0cmlidXRlcykge1xuICAgICAgICAgICAgICBleHBlY3QoXG4gICAgICAgICAgICAgICAgT2JqZWN0LmtleXMoYXR0cnMpLnNvcnQoKSxcbiAgICAgICAgICAgICAgICAndG8gZXF1YWwnLFxuICAgICAgICAgICAgICAgIGF0dHJpYnV0ZU5hbWVzRXhwZWN0ZWRUb0JlRGVmaW5lZC5zb3J0KClcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBleHBlY3QucHJvbWlzZS5hbGwocHJvbWlzZUJ5S2V5KS5jYXVnaHQoZnVuY3Rpb24oKSB7XG4gICAgICAgICAgcmV0dXJuIGV4cGVjdC5wcm9taXNlLnNldHRsZShwcm9taXNlQnlLZXkpLnRoZW4oZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICBleHBlY3QuZmFpbCh7XG4gICAgICAgICAgICAgIGRpZmY6IGZ1bmN0aW9uKG91dHB1dCwgZGlmZiwgaW5zcGVjdCwgZXF1YWwpIHtcbiAgICAgICAgICAgICAgICBvdXRwdXQuYmxvY2soZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICB2YXIgb3V0cHV0ID0gdGhpcztcbiAgICAgICAgICAgICAgICAgIHZhciBzZWVuRXJyb3IgPSBmYWxzZTtcbiAgICAgICAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAgICAgICAucHJpc21QdW5jdHVhdGlvbignPCcpXG4gICAgICAgICAgICAgICAgICAgIC5wcmlzbVRhZyhcbiAgICAgICAgICAgICAgICAgICAgICBpc0h0bWwgPyBzdWJqZWN0Lm5vZGVOYW1lLnRvTG93ZXJDYXNlKCkgOiBzdWJqZWN0Lm5vZGVOYW1lXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICBpZiAocHJvbWlzZUJ5S2V5Lm5hbWUuaXNSZWplY3RlZCgpKSB7XG4gICAgICAgICAgICAgICAgICAgIHNlZW5FcnJvciA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIHZhciBuYW1lRXJyb3IgPSBwcm9taXNlQnlLZXkubmFtZS5yZWFzb24oKTtcbiAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNwKCkuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IoXG4gICAgICAgICAgICAgICAgICAgICAgICAobmFtZUVycm9yICYmIG5hbWVFcnJvci5nZXRMYWJlbCgpKSB8fCAnc2hvdWxkIHNhdGlzZnknXG4gICAgICAgICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgICAgICAgICAgICAgLnNwKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5hcHBlbmQoaW5zcGVjdCh2YWx1ZS5uYW1lKSk7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgdmFyIGluc3BlY3RlZEF0dHJpYnV0ZXMgPSBbXTtcbiAgICAgICAgICAgICAgICAgIE9iamVjdC5rZXlzKGF0dHJzKS5mb3JFYWNoKGZ1bmN0aW9uKGF0dHJpYnV0ZU5hbWUpIHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIGF0dHJpYnV0ZU91dHB1dCA9IG91dHB1dC5jbG9uZSgpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZSA9IHByb21pc2VCeUtleS5hdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdO1xuICAgICAgICAgICAgICAgICAgICB3cml0ZUF0dHJpYnV0ZVRvTWFnaWNQZW4oXG4gICAgICAgICAgICAgICAgICAgICAgYXR0cmlidXRlT3V0cHV0LFxuICAgICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZU5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgYXR0cnNbYXR0cmlidXRlTmFtZV0sXG4gICAgICAgICAgICAgICAgICAgICAgaXNIdG1sXG4gICAgICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgICAgICAocHJvbWlzZSAmJiBwcm9taXNlLmlzRnVsZmlsbGVkKCkpIHx8XG4gICAgICAgICAgICAgICAgICAgICAgKCFwcm9taXNlICYmXG4gICAgICAgICAgICAgICAgICAgICAgICAoIW9ubHlBdHRyaWJ1dGVzIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlTmFtZXMuaW5kZXhPZihhdHRyaWJ1dGVOYW1lKSAhPT0gLTEpKVxuICAgICAgICAgICAgICAgICAgICApIHtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBzZWVuRXJyb3IgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgICAgIGF0dHJpYnV0ZU91dHB1dC5zcCgpLmFubm90YXRpb25CbG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvbWlzZSAmJlxuICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlb2YgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZVthdHRyaWJ1dGVOYW1lXSAhPT1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAndW5kZWZpbmVkJ1xuICAgICAgICAgICAgICAgICAgICAgICAgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKHByb21pc2UucmVhc29uKCkuZ2V0RXJyb3JNZXNzYWdlKHRoaXMpKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG9ubHlBdHRyaWJ1dGVzID09PSB0cnVlXG4gICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZXJyb3IoJ3Nob3VsZCBiZSByZW1vdmVkJyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgaW5zcGVjdGVkQXR0cmlidXRlcy5wdXNoKGF0dHJpYnV0ZU91dHB1dCk7XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgIGV4cGVjdGVkQXR0cmlidXRlTmFtZXMuZm9yRWFjaChmdW5jdGlvbihhdHRyaWJ1dGVOYW1lKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICghc3ViamVjdC5oYXNBdHRyaWJ1dGUoYXR0cmlidXRlTmFtZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICB2YXIgcHJvbWlzZSA9IHByb21pc2VCeUtleS5hdHRyaWJ1dGVzW2F0dHJpYnV0ZU5hbWVdO1xuICAgICAgICAgICAgICAgICAgICAgIGlmICghcHJvbWlzZSB8fCBwcm9taXNlLmlzUmVqZWN0ZWQoKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2VlbkVycm9yID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBlcnIgPSBwcm9taXNlICYmIHByb21pc2UucmVhc29uKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgYXR0cmlidXRlT3V0cHV0ID0gb3V0cHV0XG4gICAgICAgICAgICAgICAgICAgICAgICAgIC5jbG9uZSgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgIC5hbm5vdGF0aW9uQmxvY2soZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5lcnJvcignbWlzc2luZycpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc3AoKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnByaXNtQXR0ck5hbWUoYXR0cmlidXRlTmFtZSwgJ2h0bWwnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHBlY3RlZFZhbHVlQnlBdHRyaWJ1dGVOYW1lW2F0dHJpYnV0ZU5hbWVdICE9PVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHJ1ZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zcCgpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5lcnJvcihcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZXJyICYmIGVyci5nZXRMYWJlbCgpKSB8fCAnc2hvdWxkIHNhdGlzZnknXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnNwKClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLmFwcGVuZChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbnNwZWN0KFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwZWN0ZWRWYWx1ZUJ5QXR0cmlidXRlTmFtZVthdHRyaWJ1dGVOYW1lXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgaW5zcGVjdGVkQXR0cmlidXRlcy5wdXNoKGF0dHJpYnV0ZU91dHB1dCk7XG4gICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgIGlmIChpbnNwZWN0ZWRBdHRyaWJ1dGVzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlZW5FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAgIG91dHB1dFxuICAgICAgICAgICAgICAgICAgICAgICAgLm5sKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pbmRlbnRMaW5lcygpXG4gICAgICAgICAgICAgICAgICAgICAgICAuaW5kZW50KClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ibG9jayhmdW5jdGlvbihvdXRwdXQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgaW5zcGVjdGVkQXR0cmlidXRlcy5mb3JFYWNoKGZ1bmN0aW9uKGl0ZW0sIGkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5ubCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQuYXBwZW5kKGl0ZW0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgICAgICAgICAub3V0ZGVudExpbmVzKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ubCgpO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5zcCgpO1xuICAgICAgICAgICAgICAgICAgICAgIGluc3BlY3RlZEF0dHJpYnV0ZXMuZm9yRWFjaChmdW5jdGlvbihpdGVtLCBpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoaSA+IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNwKCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBvdXRwdXQuYXBwZW5kKGl0ZW0pO1xuICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNlZW5FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICAvLyBUaGUgdGFnIG5hbWUgbWlzbWF0Y2hlZFxuICAgICAgICAgICAgICAgICAgICBvdXRwdXQubmwoKTtcbiAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgb3V0cHV0LnByaXNtUHVuY3R1YXRpb24oJz4nKTtcbiAgICAgICAgICAgICAgICAgIHZhciBjaGlsZHJlbkVycm9yID1cbiAgICAgICAgICAgICAgICAgICAgcHJvbWlzZUJ5S2V5LmNoaWxkcmVuLmlzUmVqZWN0ZWQoKSAmJlxuICAgICAgICAgICAgICAgICAgICBwcm9taXNlQnlLZXkuY2hpbGRyZW4ucmVhc29uKCk7XG4gICAgICAgICAgICAgICAgICBpZiAoY2hpbGRyZW5FcnJvcikge1xuICAgICAgICAgICAgICAgICAgICB2YXIgY2hpbGRyZW5EaWZmID0gY2hpbGRyZW5FcnJvci5nZXREaWZmKG91dHB1dCk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjaGlsZHJlbkRpZmYgJiYgY2hpbGRyZW5EaWZmLmlubGluZSkge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMubmwoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmluZGVudExpbmVzKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ibG9jayhjaGlsZHJlbkRpZmYuZGlmZilcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ubCgpXG4gICAgICAgICAgICAgICAgICAgICAgICAub3V0ZGVudExpbmVzKCk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgb3V0cHV0XG4gICAgICAgICAgICAgICAgICAgICAgICAubmwoKVxuICAgICAgICAgICAgICAgICAgICAgICAgLmluZGVudExpbmVzKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5pKClcbiAgICAgICAgICAgICAgICAgICAgICAgIC5ibG9jayhmdW5jdGlvbigpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaSA8IHN1YmplY3QuY2hpbGROb2Rlcy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaSArPSAxXG4gICAgICAgICAgICAgICAgICAgICAgICAgICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKGluc3BlY3Qoc3ViamVjdC5jaGlsZE5vZGVzW2ldKSkubmwoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgb3V0cHV0LnNwKCkuYW5ub3RhdGlvbkJsb2NrKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5hcHBlbmQoY2hpbGRyZW5FcnJvci5nZXRFcnJvck1lc3NhZ2UodGhpcykpO1xuICAgICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgICAgIG91dHB1dC5ubCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHN1YmplY3QuY2hpbGROb2Rlcy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuYXBwZW5kKGluc3BlY3Qoc3ViamVjdC5jaGlsZE5vZGVzW2ldKSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIG91dHB1dC5jb2RlKHN0cmluZ2lmeUVuZFRhZyhzdWJqZWN0KSwgJ2h0bWwnKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBvdXRwdXQuaW5saW5lID0gdHJ1ZTtcbiAgICAgICAgICAgICAgICByZXR1cm4gb3V0cHV0O1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICB9XG4gICAgKTtcblxuICAgIGV4cGVjdC5leHBvcnRBc3NlcnRpb24oXG4gICAgICAnPERPTUVsZW1lbnQ+IHRvIFtvbmx5XSBoYXZlIChhdHRyaWJ1dGV8YXR0cmlidXRlcykgPHN0cmluZys+JyxcbiAgICAgIGZ1bmN0aW9uKGV4cGVjdCwgc3ViamVjdCwgdmFsdWUpIHtcbiAgICAgICAgcmV0dXJuIGV4cGVjdChcbiAgICAgICAgICBzdWJqZWN0LFxuICAgICAgICAgICd0byBbb25seV0gaGF2ZSBhdHRyaWJ1dGVzJyxcbiAgICAgICAgICBBcnJheS5wcm90b3R5cGUuc2xpY2UuY2FsbChhcmd1bWVudHMsIDIpXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgKTtcblxuICAgIGV4cGVjdC5leHBvcnRBc3NlcnRpb24oXG4gICAgICAnPERPTUVsZW1lbnQ+IG5vdCB0byBoYXZlIChhdHRyaWJ1dGV8YXR0cmlidXRlcykgPGFycmF5PicsXG4gICAgICBmdW5jdGlvbihleHBlY3QsIHN1YmplY3Qs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d1YWdlc1tsYW5ndWFnZV07XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHByaW50VG9rZW5zKHRva2VuLCBwYXJlbnRTdHlsZSkge1xuICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KHRva2VuKSkge1xuICAgICAgICAgICAgICAgICAgICB0b2tlbi5mb3JFYWNoKGZ1bmN0aW9uIChzdWJUb2tlbikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRUb2tlbnMoc3ViVG9rZW4sIHBhcmVudFN0eWxlKTtcbiAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlb2YgdG9rZW4gPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciB1cHBlckNhbWVsQ2FzZWRQYXJlbnRTdHlsZSA9IHVwcGVyQ2FtZWxDYXNlKHBhcmVudFN0eWxlKTtcbiAgICAgICAgICAgICAgICAgICAgdG9rZW4gPSB0b2tlbi5yZXBsYWNlKC8mbHQ7L2csICc8Jyk7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0aGF0WydwcmlzbScgKyBjYXBpdGFsaXplZExhbmd1YWdlICsgdXBwZXJDYW1lbENhc2VkUGFyZW50U3R5bGVdKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGF0WydwcmlzbScgKyBjYXBpdGFsaXplZExhbmd1YWdlICsgdXBwZXJDYW1lbENhc2VkUGFyZW50U3R5bGVdKHRva2VuKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0aGF0WydwcmlzbScgKyB1cHBlckNhbWVsQ2FzZWRQYXJlbnRTdHlsZV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoYXRbJ3ByaXNtJyArIHVwcGVyQ2FtZWxDYXNlZFBhcmVudFN0eWxlXSh0b2tlbik7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAobGFuZ3VhZ2VEZWZpbml0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Fx0XHRpZiAoeGhyLnJlYWR5U3RhdGUgPT0gNCkge1xuXG5cdFx0XHRcdFx0aWYgKHhoci5zdGF0dXMgPCA0MDAgJiYgeGhyLnJlc3BvbnNlVGV4dCkge1xuXHRcdFx0XHRcdFx0Y29kZS50ZXh0Q29udGVudCA9IHhoci5yZXNwb25zZVRleHQ7XG5cblx0XHRcdFx0XHRcdFByaXNtLmhpZ2hsaWdodEVsZW1lbnQoY29kZSk7XG5cdFx0XHRcdFx0fVxuXHRcdFx0XHRcdGVsc2UgaWYgKHhoci5zdGF0dXMgPj0gNDAwKSB7XG5cdFx0XHRcdFx0XHRjb2RlLnRleHRDb250ZW50ID0gJ+KcliBFcnJvciAnICsgeGhyLnN0YXR1cyArICcgd2hpbGUgZmV0Y2hpbmcgZmlsZTogJyArIHhoci5zdGF0dXNUZXh0O1xuXHRcdFx0XHRcdH1cblx0XHRcdFx0XHRlbHNlIHtcblx0XHRcdFx0XHRcdGNvZGUudGV4dENvbnRlbnQgPSAn4pyWIEVycm9yOiBGaWxlIGRvZXMgbm90IGV4aXN0IG9yIGlzIGVtcHR5Jztcblx0XHRcdFx0XHR9XG5cdFx0XHRcdH1cblx0XHRcdH07XG5cblx0XHRcdHhoci5zZW5kKG51bGwpO1xuXHRcdH0pO1xuXG5cdH07XG5cblx0ZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcignRE9NQ29udGVudExvYWRlZCcsIHNlbGYuUHJpc20uZmlsZUhpZ2hsaWdodCk7XG5cbn0pKCk7XG4iXX0= diff --git a/unexpected-dom.min.js b/unexpected-dom.min.js index 6725da24..f9259804 100644 --- a/unexpected-dom.min.js +++ b/unexpected-dom.min.js @@ -1,2 +1,2 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.unexpected||(g.unexpected={})).dom=f()}})(function(){var define,module,exports;return function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o"}var htmlDocument;if(typeof DOMParser!=="undefined"){htmlDocument=(new DOMParser).parseFromString(str,"text/html")}else if(typeof document!=="undefined"&&document.implementation&&document.implementation.createHTMLDocument){htmlDocument=document.implementation.createHTMLDocument("");htmlDocument.open();htmlDocument.write(str);htmlDocument.close()}else{var jsdom;try{jsdom=require(""+"jsdom")}catch(err){throw new Error("unexpected-dom"+(assertionNameForErrorMessage?" ("+assertionNameForErrorMessage+")":"")+": Running outside a browser, but could not find the `jsdom` module. Please npm install jsdom to make this work.")}if(jsdom.JSDOM){htmlDocument=new jsdom.JSDOM(str).window.document}else{htmlDocument=jsdom.jsdom(str)}}if(isFragment){var body=htmlDocument.body;var documentFragment=htmlDocument.createDocumentFragment();if(body){for(var i=0;i"}}module.exports={name:"unexpected-dom",installInto:function(expect){expect=expect.child();expect.use(require("magicpen-prism"));var topLevelExpect=expect;expect.exportType({name:"DOMNode",base:"object",identify:function(obj){return obj&&obj.nodeName&&[2,3,4,5,6,7,10,11,12].indexOf(obj.nodeType)>-1},equal:function(a,b){return a.nodeValue===b.nodeValue},inspect:function(element,depth,output){return output.code(element.nodeName+' "'+element.nodeValue+'"',"prism-string")}});expect.exportType({name:"DOMComment",base:"DOMNode",identify:function(obj){return obj&&typeof obj.nodeType==="number"&&obj.nodeType===8},equal:function(a,b){return a.nodeValue===b.nodeValue},inspect:function(element,depth,output){return output.code("\x3c!--"+element.nodeValue+"--\x3e","html")},diff:function(actual,expected,output,diff,inspect,equal){var d=diff("\x3c!--"+actual.nodeValue+"--\x3e","\x3c!--"+expected.nodeValue+"--\x3e");d.inline=true;return d}});expect.exportType({name:"DOMTextNode",base:"DOMNode",identify:function(obj){return obj&&typeof obj.nodeType==="number"&&obj.nodeType===3},equal:function(a,b){return a.nodeValue===b.nodeValue},inspect:function(element,depth,output){return output.code(entitify(element.nodeValue.trim()),"html")},diff:function(actual,expected,output,diff,inspect,equal){var d=diff(actual.nodeValue,expected.nodeValue);d.inline=true;return d}});expect.exportType({name:"DOMNodeList",base:"array-like",prefix:function(output){return output.text("NodeList[")},suffix:function(output){return output.text("]")},similar:function(a,b){return a.nodeType===1&&b.nodeType===1&&a.nodeName===b.nodeName},identify:function(obj){return obj&&typeof obj.length==="number"&&typeof obj.toString==="function"&&typeof obj.item==="function"&&(obj.toString().indexOf("NodeList")!==-1||obj.constructor&&obj.constructor.name==="NodeList")}});expect.exportType({name:"attachedDOMNodeList",base:"DOMNodeList",indent:false,prefix:function(output){return output},suffix:function(output){return output},delimiter:function(output){return output},identify:function(obj){return obj&&obj._isAttachedDOMNodeList}});function makeAttachedDOMNodeList(domNodeList,contentType){var attachedDOMNodeList=[];for(var i=0;i","html")},equal:function(a,b){return a.toString()===b.toString()},diff:function(actual,expected,output,diff){var d=diff("","");d.inline=true;return d}});expect.exportType({name:"DOMDocument",base:"DOMNode",identify:function(obj){return obj&&typeof obj.nodeType==="number"&&obj.nodeType===9&&obj.documentElement&&obj.implementation},inspect:function(document,depth,output,inspect){for(var i=0;i',"xml");for(var i=0;i0){if(depth===1){output.text("...")}else{var inspectedChildren=[];if(elementName==="script"){var type=element.getAttribute("type");if(!type||/javascript/.test(type)){type="javascript"}inspectedChildren.push(output.clone().code(element.textContent,type))}else if(elementName==="style"){inspectedChildren.push(output.clone().code(element.textContent,element.getAttribute("type")||"text/css"))}else{for(var i=0;i60||o.height>1});if(multipleLines){output.nl().indentLines();inspectedChildren.forEach(function(inspectedChild,index){output.i().block(inspectedChild).nl()});output.outdentLines()}else{inspectedChildren.forEach(function(inspectedChild,index){output.append(inspectedChild)})}}}output.code(stringifyEndTag(element),"html");return output},diffLimit:512,diff:function(actual,expected,output,diff,inspect,equal){var isHtml=isInsideHtmlDocument(actual);output.inline=true;if(Math.max(actual.length,expected.length)>this.diffLimit){output.jsComment("Diff suppressed due to size > "+this.diffLimit);return output}var emptyElements=actual.childNodes.length===0&&expected.childNodes.length===0;var conflictingElement=actual.nodeName.toLowerCase()!==expected.nodeName.toLowerCase()||!equal(getAttributes(actual),getAttributes(expected));if(conflictingElement){var canContinueLine=true;output.prismPunctuation("<").prismTag(actual.nodeName.toLowerCase());if(actual.nodeName.toLowerCase()!==expected.nodeName.toLowerCase()){output.sp().annotationBlock(function(){this.error("should be").sp().prismTag(expected.nodeName.toLowerCase())}).nl();canContinueLine=false}var actualAttributes=getAttributes(actual);var expectedAttributes=getAttributes(expected);Object.keys(actualAttributes).forEach(function(attributeName){output.sp(canContinueLine?1:2+actual.nodeName.length);writeAttributeToMagicPen(output,attributeName,actualAttributes[attributeName],isHtml);if(attributeName in expectedAttributes){if(actualAttributes[attributeName]===expectedAttributes[attributeName]){canContinueLine=true}else{output.sp().annotationBlock(function(){this.error("should equal").sp().append(inspect(entitify(expectedAttributes[attributeName])))}).nl();canContinueLine=false}delete expectedAttributes[attributeName]}else{output.sp().annotationBlock(function(){this.error("should be removed")}).nl();canContinueLine=false}});Object.keys(expectedAttributes).forEach(function(attributeName){output.sp(canContinueLine?1:2+actual.nodeName.length);output.annotationBlock(function(){this.error("missing").sp();writeAttributeToMagicPen(this,attributeName,expectedAttributes[attributeName],isHtml)}).nl();canContinueLine=false});output.prismPunctuation(">")}else{output.code(stringifyStartTag(actual),"html")}if(!emptyElements){output.nl().indentLines().i().block(diff(makeAttachedDOMNodeList(actual.childNodes),makeAttachedDOMNodeList(expected.childNodes)).diff).nl().outdentLines()}output.code(stringifyEndTag(actual),"html");return output}});expect.exportAssertion(" to have (class|classes) ",function(expect,subject,value){return expect(subject,"to have attributes",{class:value})});expect.exportAssertion(" to only have (class|classes) ",function(expect,subject,value){return expect(subject,"to have attributes",{class:function(className){var actualClasses=getClassNamesFromAttributeValue(className);if(typeof value==="string"){value=getClassNamesFromAttributeValue(value)}return topLevelExpect(actualClasses.sort(),"to equal",value.sort())}})});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.nodeValue,"to equal",value.nodeValue)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){expect.fail()});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.nodeValue,"to satisfy",value)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.nodeValue,"to satisfy",value)});function convertDOMNodeToSatisfySpec(node,isHtml){if(node.nodeType===8&&node.nodeValue.trim()==="ignore"){return{}}else if(node.nodeType===10){return{name:node.nodeName}}else if(node.nodeType===1){var result={name:isHtml?node.nodeName.toLowerCase():node.nodeName};if(node.attributes){result.attributes={};for(var i=0;i to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=subject.ownerDocument.contentType==="text/html";expect.argsOutput=function(output){return output.code(value,isHtml?"html":"xml")};return expect(subject,"to [exhaustively] satisfy",(isHtml?parseHtml(value,true,expect.testDescription):parseXml(value,expect.testDescription)).childNodes)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=subject.ownerDocument.contentType==="text/html";var satisfySpecs=[];for(var i=0;i to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);expect.argsOutput=function(output){return output.code(value,isHtml?"html":"xml")};return expect(subject,"to [exhaustively] satisfy",isHtml?parseHtml(value,true,expect.testDescription):parseXml(value,expect.testDescription))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=subject.ownerDocument.contentType==="text/html";return expect(subject,"to [exhaustively] satisfy",Array.prototype.map.call(value.childNodes,function(childNode){return convertDOMNodeToSatisfySpec(childNode,isHtml)}))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.childNodes,"to [exhaustively] satisfy",value)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);var documentFragment=isHtml?parseHtml(value,true,this.testDescription):parseXml(value,this.testDescription);if(documentFragment.childNodes.length!==1){throw new Error("HTMLElement to satisfy string: Only a single node is supported")}expect.argsOutput=function(output){return output.code(value,isHtml?"html":"xml")};return expect(subject,"to [exhaustively] satisfy",documentFragment.childNodes[0])});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);var valueDocument=isHtml?parseHtml(value,false,this.testDescription):parseXml(value,this.testDescription);return expect(makeAttachedDOMNodeList(subject.childNodes),"to [exhaustively] satisfy",Array.prototype.map.call(valueDocument.childNodes,function(childNode){return convertDOMNodeToSatisfySpec(childNode,isHtml)}))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);return expect(makeAttachedDOMNodeList(subject.childNodes),"to [exhaustively] satisfy",Array.prototype.map.call(value.childNodes,function(childNode){return convertDOMNodeToSatisfySpec(childNode,isHtml)}))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject,"to [exhaustively] satisfy",convertDOMNodeToSatisfySpec(value,isInsideHtmlDocument(subject)))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){expect.fail()});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){expect.fail()});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);var unsupportedOptions=Object.keys(value).filter(function(key){return key!=="attributes"&&key!=="name"&&key!=="children"&&key!=="onlyAttributes"&&key!=="textContent"});if(unsupportedOptions.length>0){throw new Error("Unsupported option"+(unsupportedOptions.length===1?"":"s")+": "+unsupportedOptions.join(", "))}var promiseByKey={name:expect.promise(function(){if(value&&typeof value.name!=="undefined"){return topLevelExpect(isHtml?subject.nodeName.toLowerCase():subject.nodeName,"to satisfy",value.name)}}),children:expect.promise(function(){if(typeof value.children!=="undefined"){if(typeof value.textContent!=="undefined"){throw new Error("The children and textContent properties are not supported together")}return topLevelExpect(makeAttachedDOMNodeList(subject.childNodes,subject.ownerDocument.contentType),"to satisfy",value.children)}else if(typeof value.textContent!=="undefined"){return topLevelExpect(subject.textContent,"to satisfy",value.textContent)}}),attributes:{}};var onlyAttributes=value&&value.onlyAttributes||expect.flags.exhaustively;var attrs=getAttributes(subject);var expectedAttributes=value&&value.attributes;var expectedAttributeNames=[];if(typeof expectedAttributes!=="undefined"){if(typeof expectedAttributes==="string"){expectedAttributes=[expectedAttributes]}var expectedValueByAttributeName={};if(Array.isArray(expectedAttributes)){expectedAttributes.forEach(function(attributeName){expectedValueByAttributeName[attributeName]=true})}else if(expectedAttributes&&typeof expectedAttributes==="object"){expectedValueByAttributeName=expectedAttributes}Object.keys(expectedValueByAttributeName).forEach(function(attributeName){expectedAttributeNames.push(attributeName)});expectedAttributeNames.forEach(function(attributeName){var attributeValue=subject.getAttribute(attributeName);var expectedAttributeValue=expectedValueByAttributeName[attributeName];promiseByKey.attributes[attributeName]=expect.promise(function(){if(expectedAttributeValue===true){topLevelExpect(subject.hasAttribute(attributeName),"to be true")}else if(typeof expectedAttributeValue==="undefined"){topLevelExpect(subject.hasAttribute(attributeName),"to be false")}else if(attributeName==="class"&&(typeof expectedAttributeValue==="string"||Array.isArray(expectedAttributeValue))){var actualClasses=getClassNamesFromAttributeValue(attributeValue);var expectedClasses=expectedAttributeValue;if(typeof expectedClasses==="string"){expectedClasses=getClassNamesFromAttributeValue(expectedAttributeValue)}if(onlyAttributes){return topLevelExpect(actualClasses.sort(),"to equal",expectedClasses.sort())}else{return topLevelExpect.apply(topLevelExpect,[actualClasses,"to contain"].concat(expectedClasses))}}else if(attributeName==="style"){var expectedStyleObj;if(typeof expectedValueByAttributeName.style==="string"){expectedStyleObj=styleStringToObject(expectedValueByAttributeName.style)}else{expectedStyleObj=expectedValueByAttributeName.style}if(onlyAttributes){return topLevelExpect(attrs.style,"to exhaustively satisfy",expectedStyleObj)}else{return topLevelExpect(attrs.style,"to satisfy",expectedStyleObj)}}else{return topLevelExpect(attributeValue,"to satisfy",expectedAttributeValue)}})});promiseByKey.attributePresence=expect.promise(function(){var attributeNamesExpectedToBeDefined=[];expectedAttributeNames.forEach(function(attributeName){if(typeof expectedValueByAttributeName[attributeName]==="undefined"){expect(attrs,"not to have key",attributeName)}else{attributeNamesExpectedToBeDefined.push(attributeName);expect(attrs,"to have key",attributeName)}});if(onlyAttributes){expect(Object.keys(attrs).sort(),"to equal",attributeNamesExpectedToBeDefined.sort())}})}return expect.promise.all(promiseByKey).caught(function(){return expect.promise.settle(promiseByKey).then(function(){expect.fail({diff:function(output,diff,inspect,equal){output.block(function(){var output=this;var seenError=false;output.prismPunctuation("<").prismTag(isHtml?subject.nodeName.toLowerCase():subject.nodeName);if(promiseByKey.name.isRejected()){seenError=true;var nameError=promiseByKey.name.reason();output.sp().annotationBlock(function(){this.error(nameError&&nameError.getLabel()||"should satisfy").sp().append(inspect(value.name))})}var inspectedAttributes=[];Object.keys(attrs).forEach(function(attributeName){var attributeOutput=output.clone();var promise=promiseByKey.attributes[attributeName];writeAttributeToMagicPen(attributeOutput,attributeName,attrs[attributeName],isHtml);if(promise&&promise.isFulfilled()||!promise&&(!onlyAttributes||expectedAttributeNames.indexOf(attributeName)!==-1)){}else{seenError=true;attributeOutput.sp().annotationBlock(function(){if(promise&&typeof expectedValueByAttributeName[attributeName]!=="undefined"){this.append(promise.reason().getErrorMessage(this))}else{this.error("should be removed")}})}inspectedAttributes.push(attributeOutput)});expectedAttributeNames.forEach(function(attributeName){if(!subject.hasAttribute(attributeName)){var promise=promiseByKey.attributes[attributeName];if(!promise||promise.isRejected()){seenError=true;var err=promise&&promise.reason();var attributeOutput=output.clone().annotationBlock(function(){this.error("missing").sp().prismAttrName(attributeName,"html");if(expectedValueByAttributeName[attributeName]!==true){this.sp().error(err&&err.getLabel()||"should satisfy").sp().append(inspect(expectedValueByAttributeName[attributeName]))}});inspectedAttributes.push(attributeOutput)}}});if(inspectedAttributes.length>0){if(seenError){output.nl().indentLines().indent().block(function(output){inspectedAttributes.forEach(function(item,i){if(i>0){output.nl()}output.append(item)})}).outdentLines().nl()}else{output.sp();inspectedAttributes.forEach(function(item,i){if(i>0){output.sp()}output.append(item)})}}else if(seenError){output.nl()}output.prismPunctuation(">");var childrenError=promiseByKey.children.isRejected()&&promiseByKey.children.reason();if(childrenError){var childrenDiff=childrenError.getDiff(output);if(childrenDiff&&childrenDiff.inline){this.nl().indentLines().i().block(childrenDiff.diff).nl().outdentLines()}else{output.nl().indentLines().i().block(function(){for(var i=0;i to [only] have (attribute|attributes) ",function(expect,subject,value){return expect(subject,"to [only] have attributes",Array.prototype.slice.call(arguments,2))});expect.exportAssertion(" not to have (attribute|attributes) ",function(expect,subject,value){var attributes=getAttributes(subject);value.forEach(function(name){delete attributes[name]});return expect(subject,"to only have attributes",attributes)});expect.exportAssertion(" not to have (attribute|attributes) ",function(expect,subject,value){return expect(subject,"not to have attributes",Array.prototype.slice.call(arguments,2))});expect.exportAssertion(" to [only] have (attribute|attributes) ",function(expect,subject,value){return expect(subject,"to satisfy",{attributes:value,onlyAttributes:expect.flags.only})});expect.exportAssertion(" to have no (child|children)",function(expect,subject){expect.errorMode="nested";return expect(Array.prototype.slice.call(subject.childNodes),"to be an empty array")});expect.exportAssertion(" to have (child|children)",function(expect,subject){return expect(subject.childNodes,"not to be empty")});expect.exportAssertion(" to have (child|children) ",function(expect,subject,query){expect.errorMode="nested";expect(subject.querySelectorAll(query),"not to be empty")});expect.exportAssertion(" to have text ",function(expect,subject,value){return expect(subject.textContent,"to satisfy",value)});expect.exportAssertion(" [when] queried for [first] ",function(expect,subject,query){var queryResult;expect.argsOutput[0]=function(output){return output.green(query)};expect.errorMode="nested";if(expect.flags.first){queryResult=subject.querySelector(query);if(!queryResult){expect.fail(function(output){return output.error("The selector").sp().jsString(query).sp().error("yielded no results")})}}else{queryResult=subject.querySelectorAll(query);if(queryResult.length===0){expect.fail(function(output){return output.error("The selector").sp().jsString(query).sp().error("yielded no results")})}}return expect.shift(queryResult)});expect.exportAssertion(" to contain [no] elements matching ",function(expect,subject,query){if(expect.flags.no){return expect(subject.querySelectorAll(query),"to satisfy",[])}expect.subjectOutput=function(output){expect.inspect(subject,Infinity,output)};return expect(subject.querySelectorAll(query),"not to satisfy",[])});expect.exportAssertion(" [not] to match ",function(expect,subject,query){return expect(matchesSelector(subject,query),"to be",!expect.flags.not)});expect.exportAssertion(" [when] parsed as (html|HTML) [fragment] ",function(expect,subject){expect.errorMode="nested";return expect.shift(parseHtml(subject,expect.flags.fragment,expect.testDescription))});expect.exportAssertion(" [when] parsed as (xml|XML) ",function(expect,subject){expect.errorMode="nested";return expect.shift(parseXml(subject,expect.testDescription))})}}},{"./matchesSelector":2,"magicpen-prism":3}],2:[function(require,module,exports){module.exports=function(elm,selector){var matchFuntion=elm.matchesSelector||elm.mozMatchesSelector||elm.msMatchesSelector||elm.oMatchesSelector||elm.webkitMatchesSelector||function(selector){var node=this;var nodes=(node.parentNode||node.document).querySelectorAll(selector);var i=0;while(nodes[i]&&nodes[i]!==node){i+=1}return!!nodes[i]};return matchFuntion.call(elm,selector)}},{}],3:[function(require,module,exports){(function(global){var oldPrismGlobal=global.Prism;var prism=global.Prism=require("prismjs");require("prismjs/components/prism-graphql.js");require("prismjs/components/prism-csp.js");global.Prism=oldPrismGlobal;var defaultTheme={prismComment:"#708090",prismProlog:"prismComment",prismDoctype:"prismComment",prismCdata:"prismComment",prismPunctuation:"#999",prismSymbol:"#905",prismProperty:"prismSymbol",prismTag:"prismSymbol",prismBoolean:"prismSymbol",prismNumber:"prismSymbol",prismConstant:"prismSymbol",prismDeleted:"prismSymbol",prismString:"#690",prismSelector:"prismString",prismAttrName:"prismString",prismChar:"prismString",prismBuiltin:"prismString",prismInserted:"prismString",prismOperator:"#a67f59",prismVariable:"prismOperator",prismEntity:"prismOperator",prismUrl:"prismOperator",prismCssString:"prismOperator",prismKeyword:"#07a",prismAtrule:"prismKeyword",prismAttrValue:"prismKeyword",prismFunction:"#DD4A68",prismRegex:"#e90",prismImportant:["#e90","bold"]};var languageMapping={"text/html":"markup","application/xml":"markup","text/xml":"markup","application/json":"javascript","text/javascript":"javascript","application/javascript":"javascript","text/css":"css",html:"markup",xml:"markup",c:"clike","c++":"clike",cpp:"clike","c#":"clike",java:"clike","application/graphql":"graphql"};function upperCamelCase(str){return str.replace(/(?:^|-)([a-z])/g,function($0,ch){return ch.toUpperCase()})}module.exports={name:"magicpen-prism", -version:require("../package.json").version,installInto:function(magicPen){magicPen.installTheme(defaultTheme);magicPen.addStyle("code",function(sourceText,language){if(language in languageMapping){language=languageMapping[language]}else if(/\+xml\b/.test(language)){language="markup"}if(!(language in prism.languages)){return this.text(sourceText)}var that=this;var capitalizedLanguage=upperCamelCase(language);var languageDefinition=prism.languages[language];function printTokens(token,parentStyle){if(Array.isArray(token)){token.forEach(function(subToken){printTokens(subToken,parentStyle)})}else if(typeof token==="string"){var upperCamelCasedParentStyle=upperCamelCase(parentStyle);token=token.replace(/</g,"<");if(that["prism"+capitalizedLanguage+upperCamelCasedParentStyle]){that["prism"+capitalizedLanguage+upperCamelCasedParentStyle](token)}else if(that["prism"+upperCamelCasedParentStyle]){that["prism"+upperCamelCasedParentStyle](token)}else if(languageDefinition[parentStyle]&&languageDefinition[parentStyle].alias){printTokens(token,languageDefinition[parentStyle].alias)}else{that.text(token)}}else{printTokens(token.content,token.type)}}printTokens(prism.tokenize(sourceText,prism.languages[language]),"text")},true)}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../package.json":4,prismjs:7,"prismjs/components/prism-csp.js":5,"prismjs/components/prism-graphql.js":6}],4:[function(require,module,exports){module.exports={_from:"magicpen-prism@^2.3.0",_id:"magicpen-prism@2.4.0",_inBundle:false,_integrity:"sha512-OEFZ+xksJtYgwnU5jJqDXhjvgnSFfMsSgXpJ2WWPaBJUXNKuQB0FBAiQxjRKsV5gntpg/tazH8L3apJx5eMdJg==",_location:"/magicpen-prism",_phantomChildren:{},_requested:{type:"range",registry:true,raw:"magicpen-prism@^2.3.0",name:"magicpen-prism",escapedName:"magicpen-prism",rawSpec:"^2.3.0",saveSpec:null,fetchSpec:"^2.3.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/magicpen-prism/-/magicpen-prism-2.4.0.tgz",_shasum:"aa79ca9b656f35069ad0aea8b102f1ac8642cbb0",_spec:"magicpen-prism@^2.3.0",_where:"/Users/ssimonsen/Code/unexpected-dom",author:{name:"Andreas Lind",email:"andreas@one.com"},bugs:{url:"https://github.com/unexpectedjs/magicpen-prism/issues"},bundleDependencies:false,dependencies:{prismjs:"1.11.0"},deprecated:false,description:"Add syntax highlighting support to magicpen via prism.js",devDependencies:{browserify:"13.0.0","bundle-collapser":"1.2.1",eslint:"2.13.1","eslint-config-onelint":"1.2.0",magicpen:"5.9.0",mocha:"2.4.5",unexpected:"10.10.5"},files:["lib","magicPenPrism.min.js"],homepage:"https://github.com/unexpectedjs/magicpen-prism#readme",main:"lib/magicPenPrism.js",name:"magicpen-prism",repository:{type:"git",url:"git+https://github.com/unexpectedjs/magicpen-prism.git"},scripts:{lint:"eslint .",prepublish:"browserify -p bundle-collapser/plugin -e lib/magicPenPrism -s magicPenPrism > magicPenPrism.min.js",test:"mocha",travis:"npm run lint && npm test"},version:"2.4.0"}},{}],5:[function(require,module,exports){Prism.languages.csp={directive:{pattern:/\b(?:(?:base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src )/i,alias:"keyword"},safe:{pattern:/'(?:self|none|strict-dynamic|(?:nonce-|sha(?:256|384|512)-)[a-zA-Z0-9+=\/]+)'/,alias:"selector"},unsafe:{pattern:/(?:'unsafe-inline'|'unsafe-eval'|'unsafe-hashed-attributes'|\*)/,alias:"function"}}},{}],6:[function(require,module,exports){Prism.languages.graphql={comment:/#.*/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:true},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,boolean:/\b(?:true|false)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":/[a-z_]\w*(?=\s*:)/i,keyword:[{pattern:/(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/,lookbehind:true},/\b(?:query|fragment|mutation)\b/],operator:/!|=|\.{3}/,punctuation:/[!(){}\[\]:=,]/}},{}],7:[function(require,module,exports){(function(global){var _self=typeof window!=="undefined"?window:typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var lang=/\blang(?:uage)?-(\w+)\b/i;var uniqueId=0;var _=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(tokens){if(tokens instanceof Token){return new Token(tokens.type,_.util.encode(tokens.content),tokens.alias)}else if(_.util.type(tokens)==="Array"){return tokens.map(_.util.encode)}else{return tokens.replace(/&/g,"&").replace(/text.length){return}if(str instanceof Token){continue}pattern.lastIndex=0;var match=pattern.exec(str),delNum=1;if(!match&&greedy&&i!=strarr.length-1){pattern.lastIndex=pos;match=pattern.exec(text);if(!match){break}var from=match.index+(lookbehind?match[1].length:0),to=match.index+match[0].length,k=i,p=pos;for(var len=strarr.length;k=p){++i;pos=p}}if(strarr[i]instanceof Token||strarr[k-1].greedy){continue}delNum=k-i;str=text.slice(pos,p);match.index-=pos}if(!match){if(oneshot){break}continue}if(lookbehind){lookbehindLength=match[1].length}var from=match.index+lookbehindLength,match=match[0].slice(lookbehindLength),to=from+match.length,before=str.slice(0,from),after=str.slice(to);var args=[i,delNum];if(before){++i;pos+=before.length;args.push(before)}var wrapped=new Token(token,inside?_.tokenize(match,inside):match,alias,match,greedy);args.push(wrapped);if(after){args.push(after)}Array.prototype.splice.apply(strarr,args);if(delNum!=1)_.matchGrammar(text,strarr,grammar,i,pos,true,token);if(oneshot)break}}}},tokenize:function(text,grammar,language){var strarr=[text];var rest=grammar.rest;if(rest){for(var token in rest){grammar[token]=rest[token]}delete grammar.rest}_.matchGrammar(text,strarr,grammar,0,0,false);return strarr},hooks:{all:{},add:function(name,callback){var hooks=_.hooks.all;hooks[name]=hooks[name]||[];hooks[name].push(callback)},run:function(name,env){var callbacks=_.hooks.all[name];if(!callbacks||!callbacks.length){return}for(var i=0,callback;callback=callbacks[i++];){callback(env)}}}};var Token=_.Token=function(type,content,alias,matchedStr,greedy){this.type=type;this.content=content;this.alias=alias;this.length=(matchedStr||"").length|0;this.greedy=!!greedy};Token.stringify=function(o,language,parent){if(typeof o=="string"){return o}if(_.util.type(o)==="Array"){return o.map(function(element){return Token.stringify(element,language,o)}).join("")}var env={type:o.type,content:Token.stringify(o.content,language,parent),tag:"span",classes:["token",o.type],attributes:{},language:language,parent:parent};if(o.alias){var aliases=_.util.type(o.alias)==="Array"?o.alias:[o.alias];Array.prototype.push.apply(env.classes,aliases)}_.hooks.run("wrap",env);var attributes=Object.keys(env.attributes).map(function(name){return name+'="'+(env.attributes[name]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+env.tag+' class="'+env.classes.join(" ")+'"'+(attributes?" "+attributes:"")+">"+env.content+""};if(!_self.document){if(!_self.addEventListener){return _self.Prism}if(!_.disableWorkerMessageHandler){_self.addEventListener("message",function(evt){var message=JSON.parse(evt.data),lang=message.language,code=message.code,immediateClose=message.immediateClose;_self.postMessage(_.highlight(code,_.languages[lang],lang));if(immediateClose){_self.close()}},false)}return _self.Prism}var script=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();if(script){_.filename=script.src;if(!_.manual&&!script.hasAttribute("data-manual")){if(document.readyState!=="loading"){if(window.requestAnimationFrame){window.requestAnimationFrame(_.highlightAll)}else{window.setTimeout(_.highlightAll,16)}}else{document.addEventListener("DOMContentLoaded",_.highlightAll)}}}return _self.Prism}();if(typeof module!=="undefined"&&module.exports){module.exports=Prism}if(typeof global!=="undefined"){global.Prism=Prism}Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:true}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i};Prism.languages.markup["tag"].inside["attr-value"].inside["entity"]=Prism.languages.markup["entity"];Prism.hooks.add("wrap",function(env){if(env.type==="entity"){env.attributes["title"]=env.content.replace(/&/,"&")}});Prism.languages.xml=Prism.languages.markup;Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:true},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/};Prism.languages.css["atrule"].inside.rest=Prism.util.clone(Prism.languages.css);if(Prism.languages.markup){Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:true,inside:Prism.languages.css,alias:"language-css",greedy:true}});Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)}Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:true},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:true}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:true},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:true,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:true,greedy:true},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"}});Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,greedy:true,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}});if(Prism.languages.markup){Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:true,inside:Prism.languages.javascript,alias:"language-javascript",greedy:true}})}Prism.languages.js=Prism.languages.javascript;(function(){if(typeof self==="undefined"||!self.Prism||!self.document||!document.querySelector){return}self.Prism.fileHighlight=function(){var Extensions={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(pre){var src=pre.getAttribute("data-src");var language,parent=pre;var lang=/\blang(?:uage)?-(?!\*)(\w+)\b/i;while(parent&&!lang.test(parent.className)){parent=parent.parentNode}if(parent){language=(pre.className.match(lang)||[,""])[1]}if(!language){var extension=(src.match(/\.(\w+)$/)||[,""])[1];language=Extensions[extension]||extension}var code=document.createElement("code");code.className="language-"+language;pre.textContent="";code.textContent="Loading…";pre.appendChild(code);var xhr=new XMLHttpRequest;xhr.open("GET",src,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status<400&&xhr.responseText){code.textContent=xhr.responseText;Prism.highlightElement(code)}else if(xhr.status>=400){code.textContent="✖ Error "+xhr.status+" while fetching file: "+xhr.statusText}else{code.textContent="✖ Error: File does not exist or is empty"}}};xhr.send(null)})};document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight)})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1])(1)}); +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.unexpected||(g.unexpected={})).dom=f()}})(function(){var define,module,exports;return function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o"}var htmlDocument;if(typeof DOMParser!=="undefined"){htmlDocument=(new DOMParser).parseFromString(str,"text/html")}else if(typeof document!=="undefined"&&document.implementation&&document.implementation.createHTMLDocument){htmlDocument=document.implementation.createHTMLDocument("");htmlDocument.open();htmlDocument.write(str);htmlDocument.close()}else{var jsdom;try{jsdom=require(""+"jsdom")}catch(err){throw new Error("unexpected-dom"+(assertionNameForErrorMessage?" ("+assertionNameForErrorMessage+")":"")+": Running outside a browser, but could not find the `jsdom` module. Please npm install jsdom to make this work.")}if(jsdom.JSDOM){htmlDocument=new jsdom.JSDOM(str).window.document}else{htmlDocument=jsdom.jsdom(str)}}if(isFragment){var body=htmlDocument.body;var documentFragment=htmlDocument.createDocumentFragment();if(body){for(var i=0;i"}}module.exports={name:"unexpected-dom",installInto:function(expect){expect=expect.child();expect.use(require("magicpen-prism"));var topLevelExpect=expect;expect.exportType({name:"DOMNode",base:"object",identify:function(obj){return obj&&obj.nodeName&&[2,3,4,5,6,7,10,11,12].indexOf(obj.nodeType)>-1},equal:function(a,b){return a.nodeValue===b.nodeValue},inspect:function(element,depth,output){return output.code(element.nodeName+' "'+element.nodeValue+'"',"prism-string")}});expect.exportType({name:"DOMComment",base:"DOMNode",identify:function(obj){return obj&&typeof obj.nodeType==="number"&&obj.nodeType===8},equal:function(a,b){return a.nodeValue===b.nodeValue},inspect:function(element,depth,output){return output.code("\x3c!--"+element.nodeValue+"--\x3e","html")},diff:function(actual,expected,output,diff,inspect,equal){var d=diff("\x3c!--"+actual.nodeValue+"--\x3e","\x3c!--"+expected.nodeValue+"--\x3e");d.inline=true;return d}});expect.exportType({name:"DOMTextNode",base:"DOMNode",identify:function(obj){return obj&&typeof obj.nodeType==="number"&&obj.nodeType===3},equal:function(a,b){return a.nodeValue===b.nodeValue},inspect:function(element,depth,output){return output.code(entitify(element.nodeValue.trim()),"html")},diff:function(actual,expected,output,diff,inspect,equal){var d=diff(actual.nodeValue,expected.nodeValue);d.inline=true;return d}});expect.exportType({name:"DOMNodeList",base:"array-like",prefix:function(output){return output.text("NodeList[")},suffix:function(output){return output.text("]")},similar:function(a,b){return a.nodeType===1&&b.nodeType===1&&a.nodeName===b.nodeName},identify:function(obj){return obj&&typeof obj.length==="number"&&typeof obj.toString==="function"&&typeof obj.item==="function"&&(obj.toString().indexOf("NodeList")!==-1||obj.constructor&&obj.constructor.name==="NodeList")}});expect.exportType({name:"attachedDOMNodeList",base:"DOMNodeList",indent:false,prefix:function(output){return output},suffix:function(output){return output},delimiter:function(output){return output},identify:function(obj){return obj&&obj._isAttachedDOMNodeList}});function makeAttachedDOMNodeList(domNodeList,contentType){var attachedDOMNodeList=[];for(var i=0;i","html")},equal:function(a,b){return a.toString()===b.toString()},diff:function(actual,expected,output,diff){var d=diff("","");d.inline=true;return d}});expect.exportType({name:"DOMDocument",base:"DOMNode",identify:function(obj){return obj&&typeof obj.nodeType==="number"&&obj.nodeType===9&&obj.documentElement&&obj.implementation},inspect:function(document,depth,output,inspect){for(var i=0;i',"xml");for(var i=0;i0){if(depth===1){output.text("...")}else{var inspectedChildren=[];if(elementName==="script"){var type=element.getAttribute("type");if(!type||/javascript/.test(type)){type="javascript"}inspectedChildren.push(output.clone().code(element.textContent,type))}else if(elementName==="style"){inspectedChildren.push(output.clone().code(element.textContent,element.getAttribute("type")||"text/css"))}else{for(var i=0;i60||o.height>1});if(multipleLines){output.nl().indentLines();inspectedChildren.forEach(function(inspectedChild,index){output.i().block(inspectedChild).nl()});output.outdentLines()}else{inspectedChildren.forEach(function(inspectedChild,index){output.append(inspectedChild)})}}}output.code(stringifyEndTag(element),"html");return output},diffLimit:512,diff:function(actual,expected,output,diff,inspect,equal){var isHtml=isInsideHtmlDocument(actual);output.inline=true;if(Math.max(actual.length,expected.length)>this.diffLimit){output.jsComment("Diff suppressed due to size > "+this.diffLimit);return output}var emptyElements=actual.childNodes.length===0&&expected.childNodes.length===0;var conflictingElement=actual.nodeName.toLowerCase()!==expected.nodeName.toLowerCase()||!equal(getAttributes(actual),getAttributes(expected));if(conflictingElement){var canContinueLine=true;output.prismPunctuation("<").prismTag(actual.nodeName.toLowerCase());if(actual.nodeName.toLowerCase()!==expected.nodeName.toLowerCase()){output.sp().annotationBlock(function(){this.error("should be").sp().prismTag(expected.nodeName.toLowerCase())}).nl();canContinueLine=false}var actualAttributes=getAttributes(actual);var expectedAttributes=getAttributes(expected);Object.keys(actualAttributes).forEach(function(attributeName){output.sp(canContinueLine?1:2+actual.nodeName.length);writeAttributeToMagicPen(output,attributeName,actualAttributes[attributeName],isHtml);if(attributeName in expectedAttributes){if(actualAttributes[attributeName]===expectedAttributes[attributeName]){canContinueLine=true}else{output.sp().annotationBlock(function(){this.error("should equal").sp().append(inspect(entitify(expectedAttributes[attributeName])))}).nl();canContinueLine=false}delete expectedAttributes[attributeName]}else{output.sp().annotationBlock(function(){this.error("should be removed")}).nl();canContinueLine=false}});Object.keys(expectedAttributes).forEach(function(attributeName){output.sp(canContinueLine?1:2+actual.nodeName.length);output.annotationBlock(function(){this.error("missing").sp();writeAttributeToMagicPen(this,attributeName,expectedAttributes[attributeName],isHtml)}).nl();canContinueLine=false});output.prismPunctuation(">")}else{output.code(stringifyStartTag(actual),"html")}if(!emptyElements){output.nl().indentLines().i().block(diff(makeAttachedDOMNodeList(actual.childNodes),makeAttachedDOMNodeList(expected.childNodes)).diff).nl().outdentLines()}output.code(stringifyEndTag(actual),"html");return output}});expect.exportAssertion(" to have (class|classes) ",function(expect,subject,value){return expect(subject,"to have attributes",{class:value})});expect.exportAssertion(" to only have (class|classes) ",function(expect,subject,value){return expect(subject,"to have attributes",{class:function(className){var actualClasses=getClassNamesFromAttributeValue(className);if(typeof value==="string"){value=getClassNamesFromAttributeValue(value)}return topLevelExpect(actualClasses.sort(),"to equal",value.sort())}})});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.nodeValue,"to equal",value.nodeValue)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){expect.fail()});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.nodeValue,"to satisfy",value)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.nodeValue,"to satisfy",value)});function convertDOMNodeToSatisfySpec(node,isHtml){if(node.nodeType===8&&node.nodeValue.trim()==="ignore"){return{}}else if(node.nodeType===10){return{name:node.nodeName}}else if(node.nodeType===1){var name=isHtml?node.nodeName.toLowerCase():node.nodeName;if(name==="ignore"){return{}}var result={name:name};if(node.attributes){result.attributes={};for(var i=0;i to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=subject.ownerDocument.contentType==="text/html";expect.argsOutput=function(output){return output.code(value,isHtml?"html":"xml")};return expect(subject,"to [exhaustively] satisfy",(isHtml?parseHtml(value,true,expect.testDescription):parseXml(value,expect.testDescription)).childNodes)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=subject.ownerDocument.contentType==="text/html";var satisfySpecs=[];for(var i=0;i to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);expect.argsOutput=function(output){return output.code(value,isHtml?"html":"xml")};return expect(subject,"to [exhaustively] satisfy",isHtml?parseHtml(value,true,expect.testDescription):parseXml(value,expect.testDescription))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=subject.ownerDocument.contentType==="text/html";return expect(subject,"to [exhaustively] satisfy",Array.prototype.map.call(value.childNodes,function(childNode){return convertDOMNodeToSatisfySpec(childNode,isHtml)}))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject.childNodes,"to [exhaustively] satisfy",value)});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);var documentFragment=isHtml?parseHtml(value,true,this.testDescription):parseXml(value,this.testDescription);if(documentFragment.childNodes.length!==1){throw new Error("HTMLElement to satisfy string: Only a single node is supported")}expect.argsOutput=function(output){return output.code(value,isHtml?"html":"xml")};return expect(subject,"to [exhaustively] satisfy",documentFragment.childNodes[0])});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);var valueDocument=isHtml?parseHtml(value,false,this.testDescription):parseXml(value,this.testDescription);return expect(makeAttachedDOMNodeList(subject.childNodes),"to [exhaustively] satisfy",Array.prototype.map.call(valueDocument.childNodes,function(childNode){return convertDOMNodeToSatisfySpec(childNode,isHtml)}))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);return expect(makeAttachedDOMNodeList(subject.childNodes),"to [exhaustively] satisfy",Array.prototype.map.call(value.childNodes,function(childNode){return convertDOMNodeToSatisfySpec(childNode,isHtml)}))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){return expect(subject,"to [exhaustively] satisfy",convertDOMNodeToSatisfySpec(value,isInsideHtmlDocument(subject)))});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){expect.fail()});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){expect.fail()});expect.exportAssertion(" to [exhaustively] satisfy ",function(expect,subject,value){var isHtml=isInsideHtmlDocument(subject);var unsupportedOptions=Object.keys(value).filter(function(key){return key!=="attributes"&&key!=="name"&&key!=="children"&&key!=="onlyAttributes"&&key!=="textContent"});if(unsupportedOptions.length>0){throw new Error("Unsupported option"+(unsupportedOptions.length===1?"":"s")+": "+unsupportedOptions.join(", "))}var promiseByKey={name:expect.promise(function(){if(value&&typeof value.name!=="undefined"){return topLevelExpect(isHtml?subject.nodeName.toLowerCase():subject.nodeName,"to satisfy",value.name)}}),children:expect.promise(function(){if(typeof value.children!=="undefined"){if(typeof value.textContent!=="undefined"){throw new Error("The children and textContent properties are not supported together")}return topLevelExpect(makeAttachedDOMNodeList(subject.childNodes,subject.ownerDocument.contentType),"to satisfy",value.children)}else if(typeof value.textContent!=="undefined"){return topLevelExpect(subject.textContent,"to satisfy",value.textContent)}}),attributes:{}};var onlyAttributes=value&&value.onlyAttributes||expect.flags.exhaustively;var attrs=getAttributes(subject);var expectedAttributes=value&&value.attributes;var expectedAttributeNames=[];if(typeof expectedAttributes!=="undefined"){if(typeof expectedAttributes==="string"){expectedAttributes=[expectedAttributes]}var expectedValueByAttributeName={};if(Array.isArray(expectedAttributes)){expectedAttributes.forEach(function(attributeName){expectedValueByAttributeName[attributeName]=true})}else if(expectedAttributes&&typeof expectedAttributes==="object"){expectedValueByAttributeName=expectedAttributes}Object.keys(expectedValueByAttributeName).forEach(function(attributeName){expectedAttributeNames.push(attributeName)});expectedAttributeNames.forEach(function(attributeName){var attributeValue=subject.getAttribute(attributeName);var expectedAttributeValue=expectedValueByAttributeName[attributeName];promiseByKey.attributes[attributeName]=expect.promise(function(){if(expectedAttributeValue===true){topLevelExpect(subject.hasAttribute(attributeName),"to be true")}else if(typeof expectedAttributeValue==="undefined"){topLevelExpect(subject.hasAttribute(attributeName),"to be false")}else if(attributeName==="class"&&(typeof expectedAttributeValue==="string"||Array.isArray(expectedAttributeValue))){var actualClasses=getClassNamesFromAttributeValue(attributeValue);var expectedClasses=expectedAttributeValue;if(typeof expectedClasses==="string"){expectedClasses=getClassNamesFromAttributeValue(expectedAttributeValue)}if(onlyAttributes){return topLevelExpect(actualClasses.sort(),"to equal",expectedClasses.sort())}else{return topLevelExpect.apply(topLevelExpect,[actualClasses,"to contain"].concat(expectedClasses))}}else if(attributeName==="style"){var expectedStyleObj;if(typeof expectedValueByAttributeName.style==="string"){expectedStyleObj=styleStringToObject(expectedValueByAttributeName.style)}else{expectedStyleObj=expectedValueByAttributeName.style}if(onlyAttributes){return topLevelExpect(attrs.style,"to exhaustively satisfy",expectedStyleObj)}else{return topLevelExpect(attrs.style,"to satisfy",expectedStyleObj)}}else{return topLevelExpect(attributeValue,"to satisfy",expectedAttributeValue)}})});promiseByKey.attributePresence=expect.promise(function(){var attributeNamesExpectedToBeDefined=[];expectedAttributeNames.forEach(function(attributeName){if(typeof expectedValueByAttributeName[attributeName]==="undefined"){expect(attrs,"not to have key",attributeName)}else{attributeNamesExpectedToBeDefined.push(attributeName);expect(attrs,"to have key",attributeName)}});if(onlyAttributes){expect(Object.keys(attrs).sort(),"to equal",attributeNamesExpectedToBeDefined.sort())}})}return expect.promise.all(promiseByKey).caught(function(){return expect.promise.settle(promiseByKey).then(function(){expect.fail({diff:function(output,diff,inspect,equal){output.block(function(){var output=this;var seenError=false;output.prismPunctuation("<").prismTag(isHtml?subject.nodeName.toLowerCase():subject.nodeName);if(promiseByKey.name.isRejected()){seenError=true;var nameError=promiseByKey.name.reason();output.sp().annotationBlock(function(){this.error(nameError&&nameError.getLabel()||"should satisfy").sp().append(inspect(value.name))})}var inspectedAttributes=[];Object.keys(attrs).forEach(function(attributeName){var attributeOutput=output.clone();var promise=promiseByKey.attributes[attributeName];writeAttributeToMagicPen(attributeOutput,attributeName,attrs[attributeName],isHtml);if(promise&&promise.isFulfilled()||!promise&&(!onlyAttributes||expectedAttributeNames.indexOf(attributeName)!==-1)){}else{seenError=true;attributeOutput.sp().annotationBlock(function(){if(promise&&typeof expectedValueByAttributeName[attributeName]!=="undefined"){this.append(promise.reason().getErrorMessage(this))}else{this.error("should be removed")}})}inspectedAttributes.push(attributeOutput)});expectedAttributeNames.forEach(function(attributeName){if(!subject.hasAttribute(attributeName)){var promise=promiseByKey.attributes[attributeName];if(!promise||promise.isRejected()){seenError=true;var err=promise&&promise.reason();var attributeOutput=output.clone().annotationBlock(function(){this.error("missing").sp().prismAttrName(attributeName,"html");if(expectedValueByAttributeName[attributeName]!==true){this.sp().error(err&&err.getLabel()||"should satisfy").sp().append(inspect(expectedValueByAttributeName[attributeName]))}});inspectedAttributes.push(attributeOutput)}}});if(inspectedAttributes.length>0){if(seenError){output.nl().indentLines().indent().block(function(output){inspectedAttributes.forEach(function(item,i){if(i>0){output.nl()}output.append(item)})}).outdentLines().nl()}else{output.sp();inspectedAttributes.forEach(function(item,i){if(i>0){output.sp()}output.append(item)})}}else if(seenError){output.nl()}output.prismPunctuation(">");var childrenError=promiseByKey.children.isRejected()&&promiseByKey.children.reason();if(childrenError){var childrenDiff=childrenError.getDiff(output);if(childrenDiff&&childrenDiff.inline){this.nl().indentLines().i().block(childrenDiff.diff).nl().outdentLines()}else{output.nl().indentLines().i().block(function(){for(var i=0;i to [only] have (attribute|attributes) ",function(expect,subject,value){return expect(subject,"to [only] have attributes",Array.prototype.slice.call(arguments,2))});expect.exportAssertion(" not to have (attribute|attributes) ",function(expect,subject,value){var attributes=getAttributes(subject);value.forEach(function(name){delete attributes[name]});return expect(subject,"to only have attributes",attributes)});expect.exportAssertion(" not to have (attribute|attributes) ",function(expect,subject,value){return expect(subject,"not to have attributes",Array.prototype.slice.call(arguments,2))});expect.exportAssertion(" to [only] have (attribute|attributes) ",function(expect,subject,value){return expect(subject,"to satisfy",{attributes:value,onlyAttributes:expect.flags.only})});expect.exportAssertion(" to have no (child|children)",function(expect,subject){expect.errorMode="nested";return expect(Array.prototype.slice.call(subject.childNodes),"to be an empty array")});expect.exportAssertion(" to have (child|children)",function(expect,subject){return expect(subject.childNodes,"not to be empty")});expect.exportAssertion(" to have (child|children) ",function(expect,subject,query){expect.errorMode="nested";expect(subject.querySelectorAll(query),"not to be empty")});expect.exportAssertion(" to have text ",function(expect,subject,value){return expect(subject.textContent,"to satisfy",value)});expect.exportAssertion(" [when] queried for [first] ",function(expect,subject,query){var queryResult;expect.argsOutput[0]=function(output){return output.green(query)};expect.errorMode="nested";if(expect.flags.first){queryResult=subject.querySelector(query);if(!queryResult){expect.fail(function(output){return output.error("The selector").sp().jsString(query).sp().error("yielded no results")})}}else{queryResult=subject.querySelectorAll(query);if(queryResult.length===0){expect.fail(function(output){return output.error("The selector").sp().jsString(query).sp().error("yielded no results")})}}return expect.shift(queryResult)});expect.exportAssertion(" to contain [no] elements matching ",function(expect,subject,query){if(expect.flags.no){return expect(subject.querySelectorAll(query),"to satisfy",[])}expect.subjectOutput=function(output){expect.inspect(subject,Infinity,output)};return expect(subject.querySelectorAll(query),"not to satisfy",[])});expect.exportAssertion(" [not] to match ",function(expect,subject,query){return expect(matchesSelector(subject,query),"to be",!expect.flags.not)});expect.exportAssertion(" [when] parsed as (html|HTML) [fragment] ",function(expect,subject){expect.errorMode="nested";return expect.shift(parseHtml(subject,expect.flags.fragment,expect.testDescription))});expect.exportAssertion(" [when] parsed as (xml|XML) ",function(expect,subject){expect.errorMode="nested";return expect.shift(parseXml(subject,expect.testDescription))})}}},{"./matchesSelector":2,"magicpen-prism":3}],2:[function(require,module,exports){module.exports=function(elm,selector){var matchFuntion=elm.matchesSelector||elm.mozMatchesSelector||elm.msMatchesSelector||elm.oMatchesSelector||elm.webkitMatchesSelector||function(selector){var node=this;var nodes=(node.parentNode||node.document).querySelectorAll(selector);var i=0;while(nodes[i]&&nodes[i]!==node){i+=1}return!!nodes[i]};return matchFuntion.call(elm,selector)}},{}],3:[function(require,module,exports){(function(global){var oldPrismGlobal=global.Prism;var prism=global.Prism=require("prismjs");require("prismjs/components/prism-graphql.js");require("prismjs/components/prism-csp.js");global.Prism=oldPrismGlobal;var defaultTheme={prismComment:"#708090",prismProlog:"prismComment",prismDoctype:"prismComment",prismCdata:"prismComment",prismPunctuation:"#999",prismSymbol:"#905",prismProperty:"prismSymbol",prismTag:"prismSymbol",prismBoolean:"prismSymbol",prismNumber:"prismSymbol",prismConstant:"prismSymbol",prismDeleted:"prismSymbol",prismString:"#690",prismSelector:"prismString",prismAttrName:"prismString",prismChar:"prismString",prismBuiltin:"prismString",prismInserted:"prismString",prismOperator:"#a67f59",prismVariable:"prismOperator",prismEntity:"prismOperator",prismUrl:"prismOperator",prismCssString:"prismOperator",prismKeyword:"#07a",prismAtrule:"prismKeyword",prismAttrValue:"prismKeyword",prismFunction:"#DD4A68",prismRegex:"#e90",prismImportant:["#e90","bold"]};var languageMapping={"text/html":"markup","application/xml":"markup","text/xml":"markup","application/json":"javascript","text/javascript":"javascript","application/javascript":"javascript","text/css":"css",html:"markup",xml:"markup",c:"clike","c++":"clike",cpp:"clike","c#":"clike",java:"clike","application/graphql":"graphql"};function upperCamelCase(str){return str.replace(/(?:^|-)([a-z])/g,function($0,ch){return ch.toUpperCase()})}module.exports={ +name:"magicpen-prism",version:require("../package.json").version,installInto:function(magicPen){magicPen.installTheme(defaultTheme);magicPen.addStyle("code",function(sourceText,language){if(language in languageMapping){language=languageMapping[language]}else if(/\+xml\b/.test(language)){language="markup"}if(!(language in prism.languages)){return this.text(sourceText)}var that=this;var capitalizedLanguage=upperCamelCase(language);var languageDefinition=prism.languages[language];function printTokens(token,parentStyle){if(Array.isArray(token)){token.forEach(function(subToken){printTokens(subToken,parentStyle)})}else if(typeof token==="string"){var upperCamelCasedParentStyle=upperCamelCase(parentStyle);token=token.replace(/</g,"<");if(that["prism"+capitalizedLanguage+upperCamelCasedParentStyle]){that["prism"+capitalizedLanguage+upperCamelCasedParentStyle](token)}else if(that["prism"+upperCamelCasedParentStyle]){that["prism"+upperCamelCasedParentStyle](token)}else if(languageDefinition[parentStyle]&&languageDefinition[parentStyle].alias){printTokens(token,languageDefinition[parentStyle].alias)}else{that.text(token)}}else{printTokens(token.content,token.type)}}printTokens(prism.tokenize(sourceText,prism.languages[language]),"text")},true)}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../package.json":4,prismjs:7,"prismjs/components/prism-csp.js":5,"prismjs/components/prism-graphql.js":6}],4:[function(require,module,exports){module.exports={_from:"magicpen-prism@^2.3.0",_id:"magicpen-prism@2.4.0",_inBundle:false,_integrity:"sha512-OEFZ+xksJtYgwnU5jJqDXhjvgnSFfMsSgXpJ2WWPaBJUXNKuQB0FBAiQxjRKsV5gntpg/tazH8L3apJx5eMdJg==",_location:"/magicpen-prism",_phantomChildren:{},_requested:{type:"range",registry:true,raw:"magicpen-prism@^2.3.0",name:"magicpen-prism",escapedName:"magicpen-prism",rawSpec:"^2.3.0",saveSpec:null,fetchSpec:"^2.3.0"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/magicpen-prism/-/magicpen-prism-2.4.0.tgz",_shasum:"aa79ca9b656f35069ad0aea8b102f1ac8642cbb0",_spec:"magicpen-prism@^2.3.0",_where:"/Users/ssimonsen/Code/unexpected-dom",author:{name:"Andreas Lind",email:"andreas@one.com"},bugs:{url:"https://github.com/unexpectedjs/magicpen-prism/issues"},bundleDependencies:false,dependencies:{prismjs:"1.11.0"},deprecated:false,description:"Add syntax highlighting support to magicpen via prism.js",devDependencies:{browserify:"13.0.0","bundle-collapser":"1.2.1",eslint:"2.13.1","eslint-config-onelint":"1.2.0",magicpen:"5.9.0",mocha:"2.4.5",unexpected:"10.10.5"},files:["lib","magicPenPrism.min.js"],homepage:"https://github.com/unexpectedjs/magicpen-prism#readme",main:"lib/magicPenPrism.js",name:"magicpen-prism",repository:{type:"git",url:"git+https://github.com/unexpectedjs/magicpen-prism.git"},scripts:{lint:"eslint .",prepublish:"browserify -p bundle-collapser/plugin -e lib/magicPenPrism -s magicPenPrism > magicPenPrism.min.js",test:"mocha",travis:"npm run lint && npm test"},version:"2.4.0"}},{}],5:[function(require,module,exports){Prism.languages.csp={directive:{pattern:/\b(?:(?:base-uri|form-action|frame-ancestors|plugin-types|referrer|reflected-xss|report-to|report-uri|require-sri-for|sandbox) |(?:block-all-mixed-content|disown-opener|upgrade-insecure-requests)(?: |;)|(?:child|connect|default|font|frame|img|manifest|media|object|script|style|worker)-src )/i,alias:"keyword"},safe:{pattern:/'(?:self|none|strict-dynamic|(?:nonce-|sha(?:256|384|512)-)[a-zA-Z0-9+=\/]+)'/,alias:"selector"},unsafe:{pattern:/(?:'unsafe-inline'|'unsafe-eval'|'unsafe-hashed-attributes'|\*)/,alias:"function"}}},{}],6:[function(require,module,exports){Prism.languages.graphql={comment:/#.*/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:true},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b/,boolean:/\b(?:true|false)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":/[a-z_]\w*(?=\s*:)/i,keyword:[{pattern:/(fragment\s+(?!on)[a-z_]\w*\s+|\.{3}\s*)on\b/,lookbehind:true},/\b(?:query|fragment|mutation)\b/],operator:/!|=|\.{3}/,punctuation:/[!(){}\[\]:=,]/}},{}],7:[function(require,module,exports){(function(global){var _self=typeof window!=="undefined"?window:typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope?self:{};var Prism=function(){var lang=/\blang(?:uage)?-(\w+)\b/i;var uniqueId=0;var _=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(tokens){if(tokens instanceof Token){return new Token(tokens.type,_.util.encode(tokens.content),tokens.alias)}else if(_.util.type(tokens)==="Array"){return tokens.map(_.util.encode)}else{return tokens.replace(/&/g,"&").replace(/text.length){return}if(str instanceof Token){continue}pattern.lastIndex=0;var match=pattern.exec(str),delNum=1;if(!match&&greedy&&i!=strarr.length-1){pattern.lastIndex=pos;match=pattern.exec(text);if(!match){break}var from=match.index+(lookbehind?match[1].length:0),to=match.index+match[0].length,k=i,p=pos;for(var len=strarr.length;k=p){++i;pos=p}}if(strarr[i]instanceof Token||strarr[k-1].greedy){continue}delNum=k-i;str=text.slice(pos,p);match.index-=pos}if(!match){if(oneshot){break}continue}if(lookbehind){lookbehindLength=match[1].length}var from=match.index+lookbehindLength,match=match[0].slice(lookbehindLength),to=from+match.length,before=str.slice(0,from),after=str.slice(to);var args=[i,delNum];if(before){++i;pos+=before.length;args.push(before)}var wrapped=new Token(token,inside?_.tokenize(match,inside):match,alias,match,greedy);args.push(wrapped);if(after){args.push(after)}Array.prototype.splice.apply(strarr,args);if(delNum!=1)_.matchGrammar(text,strarr,grammar,i,pos,true,token);if(oneshot)break}}}},tokenize:function(text,grammar,language){var strarr=[text];var rest=grammar.rest;if(rest){for(var token in rest){grammar[token]=rest[token]}delete grammar.rest}_.matchGrammar(text,strarr,grammar,0,0,false);return strarr},hooks:{all:{},add:function(name,callback){var hooks=_.hooks.all;hooks[name]=hooks[name]||[];hooks[name].push(callback)},run:function(name,env){var callbacks=_.hooks.all[name];if(!callbacks||!callbacks.length){return}for(var i=0,callback;callback=callbacks[i++];){callback(env)}}}};var Token=_.Token=function(type,content,alias,matchedStr,greedy){this.type=type;this.content=content;this.alias=alias;this.length=(matchedStr||"").length|0;this.greedy=!!greedy};Token.stringify=function(o,language,parent){if(typeof o=="string"){return o}if(_.util.type(o)==="Array"){return o.map(function(element){return Token.stringify(element,language,o)}).join("")}var env={type:o.type,content:Token.stringify(o.content,language,parent),tag:"span",classes:["token",o.type],attributes:{},language:language,parent:parent};if(o.alias){var aliases=_.util.type(o.alias)==="Array"?o.alias:[o.alias];Array.prototype.push.apply(env.classes,aliases)}_.hooks.run("wrap",env);var attributes=Object.keys(env.attributes).map(function(name){return name+'="'+(env.attributes[name]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+env.tag+' class="'+env.classes.join(" ")+'"'+(attributes?" "+attributes:"")+">"+env.content+""};if(!_self.document){if(!_self.addEventListener){return _self.Prism}if(!_.disableWorkerMessageHandler){_self.addEventListener("message",function(evt){var message=JSON.parse(evt.data),lang=message.language,code=message.code,immediateClose=message.immediateClose;_self.postMessage(_.highlight(code,_.languages[lang],lang));if(immediateClose){_self.close()}},false)}return _self.Prism}var script=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();if(script){_.filename=script.src;if(!_.manual&&!script.hasAttribute("data-manual")){if(document.readyState!=="loading"){if(window.requestAnimationFrame){window.requestAnimationFrame(_.highlightAll)}else{window.setTimeout(_.highlightAll,16)}}else{document.addEventListener("DOMContentLoaded",_.highlightAll)}}}return _self.Prism}();if(typeof module!=="undefined"&&module.exports){module.exports=Prism}if(typeof global!=="undefined"){global.Prism=Prism}Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:true}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i};Prism.languages.markup["tag"].inside["attr-value"].inside["entity"]=Prism.languages.markup["entity"];Prism.hooks.add("wrap",function(env){if(env.type==="entity"){env.attributes["title"]=env.content.replace(/&/,"&")}});Prism.languages.xml=Prism.languages.markup;Prism.languages.html=Prism.languages.markup;Prism.languages.mathml=Prism.languages.markup;Prism.languages.svg=Prism.languages.markup;Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:true},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/};Prism.languages.css["atrule"].inside.rest=Prism.util.clone(Prism.languages.css);if(Prism.languages.markup){Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:true,inside:Prism.languages.css,alias:"language-css",greedy:true}});Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)}Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:true},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:true}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:true},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:true,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:true,greedy:true},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"}});Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,greedy:true,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}});if(Prism.languages.markup){Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:true,inside:Prism.languages.javascript,alias:"language-javascript",greedy:true}})}Prism.languages.js=Prism.languages.javascript;(function(){if(typeof self==="undefined"||!self.Prism||!self.document||!document.querySelector){return}self.Prism.fileHighlight=function(){var Extensions={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(pre){var src=pre.getAttribute("data-src");var language,parent=pre;var lang=/\blang(?:uage)?-(?!\*)(\w+)\b/i;while(parent&&!lang.test(parent.className)){parent=parent.parentNode}if(parent){language=(pre.className.match(lang)||[,""])[1]}if(!language){var extension=(src.match(/\.(\w+)$/)||[,""])[1];language=Extensions[extension]||extension}var code=document.createElement("code");code.className="language-"+language;pre.textContent="";code.textContent="Loading…";pre.appendChild(code);var xhr=new XMLHttpRequest;xhr.open("GET",src,true);xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status<400&&xhr.responseText){code.textContent=xhr.responseText;Prism.highlightElement(code)}else if(xhr.status>=400){code.textContent="✖ Error "+xhr.status+" while fetching file: "+xhr.statusText}else{code.textContent="✖ Error: File does not exist or is empty"}}};xhr.send(null)})};document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight)})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1])(1)});