Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_🔥🔥🔥文本选中复制🔥🔥🔥@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgIPCflKXwn5Sl8J+UpeaWh+acrOmAieS4reWkjeWItvCflKXwn5Sl8J+UpQovLyBAZGVzY3JpcHRpb24g6Kej6Zmk572R56uZ5LiN5YWB6K645aSN5Yi255qE6ZmQ5Yi277yM5paH5pys6YCJ5Lit5ZCO54K55Ye75aSN5Yi25oyJ6ZKu5Y2z5Y+v5aSN5Yi277yM5Li76KaB55So5LqOIOeZvuW6puaWh+W6kyDpgZPlrqLlt7Tlt7Qg6IW+6K6v5paH5qGjIOixhuS4gee9kSDml6Dlv6fogIPnvZEg5a2m5Lmg5ZWmIOiTrOWLg+iMg+aWhyDmgJ3lkKbnpL7ljLog5Yqb5omjIOefpeS5jiDor63pm4Ag562JCi8vIEBuYW1lc3BhY2UgICBodHRwczovL2dpdGh1Yi5jb20vV2luZHJ1bm5lck1heC9US1NjcmlwdAovLyBAdmVyc2lvbiAgICAgNi4xLjIwCi8vIEBhdXRob3IgICAgICBDenkKLy8gQG1hdGNoICAgICAgICo6Ly93ZW5rdS5iYWlkdS5jb20vdmlldy8qCi8vIEBtYXRjaCAgICAgICAqOi8vd2Vua3UuYmFpZHUuY29tL3NoYXJlLyoKLy8gQG1hdGNoICAgICAgICo6Ly93ZW5rdS5iYWlkdS5jb20vbGluayoKLy8gQG1hdGNoICAgICAgICo6Ly93ZW5rdS5iYWlkdS5jb20vYWdncy8qCi8vIEBtYXRjaCAgICAgICAqOi8vd2Vua3UuYmFpZHUuY29tL25kUHVyZVZpZXcvKgovLyBAbWF0Y2ggICAgICAgKjovL3d3dy41MXRlc3QubmV0L3Nob3cvKgovLyBAbWF0Y2ggICAgICAgKjovL3d3dy54dWV4aS5sYS8qCi8vIEBtYXRjaCAgICAgICAqOi8vd3d3Lnh1ZX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I2xlZnQtbWVudXtkaXNwbGF5OiBub25lICFpbXBvcnRhbnQ7fTwvc3R5bGU+YAogICAgICAgICk7CiAgICAgICAgR01feG1saHR0cFJlcXVlc3QoewogICAgICAgICAgbWV0aG9kOiAiR0VUIiwKICAgICAgICAgIHVybDogImh0dHBzOi8vcmVzMy5kb2M4OC5jb20vcmVzb3VyY2VzL2pzL21vZHVsZXMvbWFpbi12Mi5taW4uanM/dj0yLjU2IiwKICAgICAgICAgIG9ubG9hZDogZnVuY3Rpb24ocmVzcG9uc2UpIHsKICAgICAgICAgICAgY29uc3QgcmVzdWx0ID0gL1woIiNjcF90ZXh0YXJlYSJcKS52YWxcKChbXFNdKj8pXCk7Ly5leGVjKHJlc3BvbnNlLnJlc3BvbnNlVGV4dCk7CiAgICAgICAgICAgIGlmIChyZXN1bHQpCiAgICAgICAgICAgICAgcGF0aCA9IHJlc3VsdFsxXTsKICAgICAgICAgIH0KICAgICAgICB9KTsKICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigibG9hZCIsICgpID0+IHsKICAgICAgICAgIGNvbnN0IGNwRm4gPSB1bnNhZmVXaW5kb3cuY29weVRleHQudG9TdHJpbmcoKTsKICAgICAgICAgIGNvbnN0IGZuUmVzdWx0ID0gLzx0ZXh0YXJlYVtcc1xTXSo/PidcKyhbXFNdKj8pXCsiPFwvdGV4dGFyZWE+Ly5leGVjKGNwRm4pOwogICAgICAgICAgaWYgKGZuUmVzdWx0KQogICAgICAgICAgICBwYXRoID0gZm5SZXN1bHRbMV07CiAgICAgICAgfSk7CiAgICAgIH0sCiAgICAgIGdldFNlbGVjdGVkVGV4dDogKCkgPT4gewogICAgICAgIGxldCBzZWxlY3QgPSB1bnNhZmVXaW5kb3c7CiAgICAgICAgcGF0aC5zcGxpdCgiLiIpLmZvckVhY2goKHYpID0+IHsKICAgICAgICAgIHNlbGVjdCA9IHNlbGVjdFt2XTsKICAgICAgICB9KTsKICAgICAgICBpZiAoIXNlbGVjdCkgewogICAgICAgICAgdW5zYWZlV2luZG93LkNvbmZpZy52aXAgPSAxOwogICAgICAgICAgdW5zYWZlV2luZG93LkNvbmZpZy5sb2dpbmVkID0gMTsKICAgICAgICAgIGRvbSQxLnJlbW92ZSgiI2NvcHktZWxlbWVudC1oaWRlIik7CiAgICAgICAgfQogICAgICAgIHJldHVybiBzZWxlY3Q7CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRzID0gewogICAgICByZWdleHA6IC8uKnNlZ21lbnRmYXVsdFwuY29tXC8uKy8sCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIGNvbnN0IGJvZHkgPSBkb20kMS5xdWVyeSgiYm9keSIpOwogICAgICAgIGJvZHkuY2xhc3NMaXN0LmFkZCgiX3NmX2FkanVzdF9ib2R5Iik7CiAgICAgICAgYm9keS5vbmNsaWNrID0gKCkgPT4gewogICAgICAgICAgYm9keS5zdHlsZS5wYWRkaW5nUmlnaHQgPSAiMCI7CiAgICAgICAgfTsKICAgICAgfQogICAgfTsKCiAgICBjb25zdCBURVhUX1BMQUlOID0gInRleHQvcGxhaW4iOwogICAgY29uc3QgVEVYVF9IVE1MID0gInRleHQvaHRtbCI7CiAgICBjb25zdCBkb3duZ3JhZGVDb3B5ID0gKGRhdGEpID0+IHsKICAgICAgY29uc3QgdGV4dGFyZWEgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJ0ZXh0YXJlYSIpOwogICAgICB0ZXh0YXJlYS5hZGRFdmVudExpc3RlbmVyKAogICAgICAgIENPUFksCiAgICAgICAgKGV2ZW50KSA9PiB7CiAgICAgICAgICBmb3IgKGNvbnN0IFtrZXksIHZhbHVlXSBvZiBPYmplY3QuZW50cmllcyhkYXRhKSkgewogICAgICAgICAgICBldmVudC5jbGlwYm9hcmREYXRhLnNldERhdGEoa2V5LCB2YWx1ZSk7CiAgICAgICAgICB9CiAgICAgICAgICBldmVudC5zdG9wUHJvcGFnYXRpb24oKTsKICAgICA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yBCbG9iKFt2YWx1ZV0sIHsgdHlwZToga2V5IH0pOwogICAgICAgICAgZGF0YUl0ZW1zW2tleV0gPSBibG9iOwogICAgICAgIH0KICAgICAgICBuYXZpZ2F0b3IuY2xpcGJvYXJkLndyaXRlKFtuZXcgQ2xpcGJvYXJkSXRlbShkYXRhSXRlbXMpXSkuY2F0Y2goKCkgPT4gewogICAgICAgICAgZG93bmdyYWRlQ29weShwYXJhbXMpOwogICAgICAgIH0pOwogICAgICB9IGVsc2UgewogICAgICAgIGRvd25ncmFkZUNvcHkocGFyYW1zKTsKICAgICAgfQogICAgICByZXR1cm4gdHJ1ZTsKICAgIH07CgogICAgbGV0IGRvbSA9IG51bGw7CiAgICBsZXQgaXNSZWFkeVRvSGlkZGVuID0gZmFsc2U7CiAgICBjb25zdCBpbnN0YW5jZSA9IHsKICAgICAgaWQ6ICJfX2NvcHkiLAogICAgICBjbGFzc05hbWU6ICJfX2NvcHktYnV0dG9uIiwKICAgICAgZ2V0SW5zdGFuY2U6IGZ1bmN0aW9uKCkgewogICAgICAgIGlmIChkb20gPT09IG51bGwpIHsKICAgICAgICAgIGNvbnN0IGNvbnRhaW5lciA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImRpdiIpOwogICAgICAgICAgY29udGFpbmVyLmlkID0gdGhpcy5pZDsKICAgICAgICAgIGNvbnRhaW5lci5jbGFzc05hbWUgPSB0aGlzLmNsYXNzTmFtZTsKICAgICAgICAgIGNvbnRhaW5lci5pbm5lclRleHQgPSAi5aSN5Yi2IjsKICAgICAgICAgIGNvbnRhaW5lci5hZGRFdmVudExpc3RlbmVyKCJtb3VzZXVwIiwgKGUpID0+IGUuc3RvcFByb3BhZ2F0aW9uKCksIHRydWUpOwogICAgICAgICAgY29udGFpbmVyLmFkZEV2ZW50TGlzdGVuZXIoIm1vdXNlZG93biIsIChlKSA9PiBlLnN0b3BQcm9wYWdhdGlvbigpLCB0cnVlKTsKICAgICAgICAgIGRvbSA9IGNvbnRhaW5lcjsKICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZG9tKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGRvbTsKICAgICAgfSwKICAgICAgc2hvdzogZnVuY3Rpb24oZXZlbnQpIHsKICAgICAgICBpZiAoaXNSZWFkeVRvSGlkZGVuKQogICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICBjb25zdCBkb20yID0gdGhpcy5nZXRJbnN0YW5jZSgpOwogICAgICAgIGRvbTIuc3R5bGUubGVmdCA9IGAke2V2ZW50LnBhZ2VYICsgMzB9cHhgOwogICAgICAgIGRvbTIuc3R5bGUudG9wID0gYCR7ZXZlbnQucGFnZVl9cHhgOwogICAgICAgIGRvbTIuc3R5bGUub3BhY2l0eSA9ICIxIjsKICAgICAgICBkb20yLnN0eWxlLnpJbmRleCA9ICIxMDAwIjsKICAgICAgfSwKICAgICAgaGlkZTogZnVuY3Rpb24oKSB7CiAgICAgICAgY29uc3QgZG9tMiA9IHRoaXMuZ2V0SW5zdGFuY2UoKTsKICAgICAgICBkb20yLnN0eWxlLm9wYWNpdHkgPSAiMCI7CiAgICAgICAgaXNSZWFkeVRvSGlkZGVuID0gdHJ1ZTsKICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHsKICAgICAgICAgIGRvbTIuc3R5bGUuekluZGV4ID0gIi0xMDAwMCI7CiAgICAgICAgICBpc1JlYWR5VG9IaWRkZW4gPSBmYWxzZTsKICAgICAgICB9LCAzNTApOwogICAgICB9LAogICAgICBvbkNvcHk6IGZ1bmN0aW9uKGNvbnRlbnQsIGV2ZW50KSB7CiAgICAgICAgY29uc3QgZG9tMiA9IHRoaXMuZ2V0SW5zdGFuY2UoKTsKICAgICAgICB0aGlzLnNob3coZXZlbnQpOwogICAgICAgIGRvbTIub25jbGljayA9ICgpID0+IHsKICAgICAgICAgIGNvcHkoY29udGVudCk7CiAgICAgICAgICB0aGlzLmhpZGUoKTsKICAgICAgICB9OwogICAgICB9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udC5jcmVhdGVFbGVtZW50KCJzdHlsZSIpOwogICAgICAgIHN0eWxlLmlubmVyVGV4dCA9IGNzczsKICAgICAgICBjb25zdCBoZWFkID0gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImhlYWQiKVswXTsKICAgICAgICBpZiAoaGVhZCkgewogICAgICAgICAgaGVhZC5hcHBlbmRDaGlsZChzdHlsZSk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKAogICAgICAgICAgICBQQUdFX0xPQURFRCwKICAgICAgICAgICAgKCkgPT4gZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImhlYWQiKVswXS5hcHBlbmRDaGlsZChzdHlsZSkKICAgICAgICAgICk7CiAgICAgICAgfQogICAgICB9LAogICAgICBlbmFibGVPblNlbGVjdFN0YXJ0OiAoc2VsZWN0b3IpID0+IHsKICAgICAgICBjb25zdCBkb20gPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHNlbGVjdG9yKTsKICAgICAgICBkb20gJiYgZG9tLmFkZEV2ZW50TGlzdGVuZXIoU0VMRUNUX1NUQVJULCBzdG9wTmF0aXZlUHJvcGFnYXRpb24pOwogICAgICB9LAogICAgICBlbmFibGVPbkNvbnRleHRNZW51OiAoc2VsZWN0b3IpID0+IHsKICAgICAgICBjb25zdCBkb20gPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKHNlbGVjdG9yKTsKICAgICAgICBkb20gJiYgZG9tLmFkZEV2ZW50TGlzdGVuZXIoQ09OVEVYVF9NRU5VLCBzdG9wTmF0aXZlUHJvcGFnYXRpb24pOwogICAgICB9LAogICAgICBlbmFibGVPbkNvcHk6IChzZWxlY3RvcikgPT4gewogICAgICAgIGNvbnN0IGRvbSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3Ioc2VsZWN0b3IpOwogICAgICAgIGRvbSAmJiBkb20uYWRkRXZlbnRMaXN0ZW5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AgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcihDT1BZLCBzdG9wTmF0aXZlUHJvcGFnYXRpb24sIHRydWUpOwogICAgICB9LAogICAgICBlbmFibGVPbktleURvd25CeUNhcHR1cmU6ICgpID0+IHsKICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKAogICAgICAgICAgS0VZX0RPV04sCiAgICAgICAgICAoZSkgPT4gZS5jdHJsS2V5ICYmIGUua2V5LnRvTG9jYWxlVXBwZXJDYXNlKCkgPT09ICJDIiAmJiBlLnN0b3BQcm9wYWdhdGlvbigpLAogICAgICAgICAgdHJ1ZQogICAgICAgICk7CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRyID0gewogICAgICByZWdleHA6IC8uKndrXC5iYWlkdVwuY29tXC92aWV3XC8uKy8sCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIHV0aWxzLmhpZGVCdXR0b24oKTsKICAgICAgICB1dGlscy5lbmFibGVPblNlbGVjdFN0YXJ0QnlDYXB0dXJlKCk7CiAgICAgICAgd2luZG93Lm9ubG9hZCA9ICgpID0+IHsKICAgICAgICAgIGRvbSQxLmF0dHIoIi5zZi1lZHUtd2Vua3UtdnctY29udGFpbmVyIiwgInN0eWxlIiwgIiIpOwogICAgICAgIH07CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRxID0gewogICAgICByZWdleHA6IC8uKnpoaWh1XC5jb21cLy4qLywKICAgICAgaW5pdDogZnVuY3Rpb24oKSB7CiAgICAgICAgdXRpbHMuaGlkZUJ1dHRvbigpOwogICAgICAgIHV0aWxzLmVuYWJsZVVzZXJTZWxlY3RCeUNTUygpOwogICAgICAgIHV0aWxzLmVuYWJsZU9uQ29weUJ5Q2FwdHVyZSgpOwogICAgICAgIGlmIChsb2NhdGlvbi5ob3N0bmFtZSA9PT0gInpodWFubGFuLnpoaWh1LmNvbSIpIHsKICAgICAgICAgIGNvbnN0IHJlbW92ZUZvY2FsUG9pbnRNb2RhbCA9IChtdXRhdGlvbnNMaXN0KSA9PiB7CiAgICAgICAgICAgIGZvciAoY29uc3QgbXV0YXRpb24gb2YgbXV0YXRpb25zTGlzdCkgewogICAgICAgICAgICAgIGNvbnN0IGFkZGVkTm9kZXMgPSBtdXRhdGlvbi5hZGRlZE5vZGVzOwogICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYWRkZWROb2Rlcy5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgY29uc3QgdGFyZ2V0ID0gYWRkZWROb2Rlc1tpXTsKICAgICAgICAgICAgICAgIGlmICh0YXJnZXQubm9kZVR5cGUgIT0gMSkKICAgICAgICAgICAgICAgICAgcmV0dXJuIHZvaWQgMDsKICAgICAgICAgICAgICAgIGlmICh0YXJnZXQgaW5zdGFuY2VvZiBIVE1MRGl2RWxlbWVudCAmJiB0YXJnZXQucXVlcnlTZWxlY3RvcigiW2RhdGEtZm9jdXMtc2NvcGUtc3RhcnRdIikpIHsKICAgICAgICAgICAgICAgICAgY29uc3QgZWxlbWVudCA9IHRhcmdldC5xdWVyeVNlbGVjdG9yKCJbZGF0YS1mb2N1cy1zY29wZS1zdGFydF0iKTsKICAgICAgICAgICAgICAgICAgZWxlbWVudCAmJiBlbGVtZW50LnBhcmVudEVsZW1lbnQgJiYgZWxlbWVudC5wYXJlbnRFbGVtZW50LnRleHRDb250ZW50LmluZGV4T2YoIueri+WNs+eZu+W9lS/ms6jlhowiKSA+IC0xICYmIGVsZW1lbnQucGFyZW50RWxlbWVudC5wYXJlbnRFbGVtZW50ICYmIGVsZW1lbnQucGFyZW50RWxlbWVudC5wYXJlbnRFbGVtZW50LnJlbW92ZUNoaWxkKAogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQucGFyZW50RWxlbWVudAogICAgICAgICAgICAgICAgICApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfTsKICAgICAgICAgIGNvbnN0IG9ic2VydmVyID0gbmV3IE11dGF0aW9uT2JzZXJ2ZXIocmVtb3ZlRm9jYWxQb2ludE1vZGFsKTsKICAgICAgICAgIG9ic2VydmVyLm9ic2VydmUoZG9jdW1lbnQsIHsgY2hpbGRMaXN0OiB0cnVlLCBzdWJ0cmVlOiB0cnVlIH0pOwogICAgICAgIH0KICAgICAgfQogICAgfTsKCiAgICBjb25zdCB3ZWJzaXRlJHAgPSB7CiAgICAgIHJlZ2V4cDogLy4qMzBlZHVcLmNvbVwuY25cLy4rLywKICAgICAgaW5pdDogZnVuY3Rpb24oKSB7CiAgICAgICAgd2luZG93Lm9ubG9hZCA9ICgpID0+IHsKICAgICAgICAgIGNvbnN0IGlmcmFtZXMgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiaWZyYW1lIik7CiAgICAgICAgICBpZiAoaWZyYW1lcy5sZW5ndGggPT09IDIpIHsKICAgICAgICAgICAgY29uc3QgYm9keSA9IGlmcmFtZXNbMV0uY29udGVudFdpbmRvdy5kb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJib2R5Iik7CiAgICAgICAgICAgIHV0aWxzLnJlbW92ZUF0dHJpYnV0ZXMoYm9keSwgWyJvbmNvcHkiLCAib25jb250ZXh0bWVudSIsICJvbnNlbGVjdHN0YXJ0Il0pOwogICAgICAgICAgfQogICAgICAgIH07CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRvID0gewogICAgICByZWdleHA6IC8uKmRvY3NcLnFxXC5jb21cLy4rLywKICAgICAgY29uZmlnOiB7CiAgICAgICAgaW5pdENvcHlFdmVudDogZmFsc2UsCiAgICAgICAgY2FwdHVyZUluc3RhbmNlOiB0cnVlLAogICAgICAgIGRlbGF5OiAxMDAKICAgICAgfSwKICAgICAgaW5pdDogZnVuY3Rpb24oKSB7CiAgICAgICAgd2luZG93Lm9ubG9hZCA9ICgpID0+IHsKICAgICAgICAgIHV0aWxzLmhpZGVCdXR0b24oKTsKICAgICAgICB9OwogICAgICB9LAogICAgICBnZXRTZWxlY3RlZFRleHQ6IGZ1bmN0aW9uKCkgewogICAgICAgIGlmICh1bnNhZmVXaW5kb3cucGFkICYmIHVuc2FmZVdpbmRvdy5wYWQuZWRpdG9yICYmICF1bnNhZmVXaW5kb3cucGFkLmVkaXRvci5pc0NvcHlhYmxlKCkpIHsKICAgICAgICAgIHV0aWxzLnNob3dCdXR0b24oKTsKICAgICAgICAgIGNvbnN0IGVkaXRvciA9IHVuc2FmZVdpbmRvdy5wYWQuZWRpdG9yOwogICAgICAgICAgaWYgKGVkaXRvci5nZXRDb3B5Q29udGVudCkgewogICAgICAgICAgICBjb25zdCBjb250ZW50ID0gZWRpdG9yLmdldENvcHlDb250ZW50KCkgfHwge307CiAgICAgICAgICAgIGNvbnN0IHBsYWluVGV4dCA9IGNvbnRlbnQucGxhaW47CiAgICAgICAgICAgIGNvbnN0IGh0bWxUZXh0ID0gY29udGVudC5odG1sOwogICAgICAgICAgICByZXR1cm4gewogICAgICAgICAgICAgIFtURVhUX1BMQUlOXTogcGxhaW5UZXh0LAogICAgICAgICAgICAgIFtURVhUX0hUTUxdOiBodG1sVGV4dAogICAgICAgICAgICB9OwogICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgZWRpdG9yLl9kb2NFbnYuY29weWFibGUgPSB0cnVlOwogICAgICAgICAgICBlZGl0b3IuY2xpcGJvYXJkTWFuYWdlci5jb3B5KCk7CiAgICAgICAgICAgIGNvbnN0IHBsYWluVGV4dCA9IGVkaXRvci5jbGlwYm9hcmRNYW5hZ2VyLmN1c3RvbUNsaXBib2FyZC5wbGFpbjsKICAgICAgICAgICAgY29uc3QgaHRtbFRleHQgPSBlZGl0b3IuY2xpcGJvYXJkTWFuYWdlci5jdXN0b21DbGlwYm9hcmQuaHRtbDsKICAgICAgICAgICAgZWRpdG9yLl9kb2NFbnYuY29weWFibGUgPSBmYWxzZTsKICAgICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgICBbVEVYVF9QTEFJTl06IHBsYWluVGV4dCwKICAgICAgICAgICAgICBbVEVYVF9IVE1MXTogaHRtbFRleHQKICAgICAgICAgICAgfTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgcmV0dXJuICIiOwogICAgICB9CiAgICB9OwoKICAgIGNvbnN0IHdlYnNpdGUkbiA9IHsKICAgICAgcmVnZXhwOiBuZXcgUmVnRXhwKCIuKzovL2Jva2UxMTIuY29tL3Bvc3QvLisiKSwKICAgICAgaW5pdDogZnVuY3Rpb24oKSB7CiAgICAgICAgdXRpbHMuZW5hYmxlT25Db3B5QnlDYXB0dXJlKCk7CiAgICAgICAgY29uc3QgdGVtcGxhdGUgPSBgCiAgICAgICAgICAgIDxzdHlsZT4KICAgICAgICAgICAgICAgIDpub3QoaW5wdXQpOm5vdCh0ZXh0YXJlYSk6OnNlbGVjdGlvbiB7CiAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogIzI0NDBCMyAhaW1wb3J0YW50OwogICAgICAgICAgICAgICAgICAgIGNvbG9yOiAjZmZmICFpbXBvcnRhbnQ7CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgOm5vdChpbnB1dCk6bm90KHRleHRhcmVhKTo6LW1vei1zZWxlY3Rpb24gewogICAgICAgICAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICMyNDQwQjMgIWltcG9ydGFudDsKICAgICAgICAgICAgICAgICAgICBjb2xvcjogI2ZmZiAhaW1wb3J0YW50OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICA8L3N0eWxlPgogICAgICAgIGA7CiAgICAgICAgZG9tJDEuYXBwZW5kKCJoZWFkIiwgdGVtcGxhdGUpOwogICAgICB9CiAgICB9OwoKICAgIGNvbnN0IHdlYnNpdGUkbSA9IHsKICAgICAgcmVnZXhwOiAvZGl5aWZhbndlbi8sCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIHV0aWxzLmhpZGVCdXR0b24oKTsKICAgICAgICB1dGlscy5lbmFibGVPbkNvcHlCeUNhcHR1cmUoKTsKICAgICAgICB1dGlscy5lbmFibGVPbktleURvd25CeUNhcHR1cmUoKTsKICAgICAgfQogICAgfTsKCiAgICBjb25zdCB3ZWJzaXRlJGwgPSB7CiAgICAgIHJlZ2V4cDogL21iYWxpYi8sCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIHdpbmRvdy5vbmxvYWQgPSAoKSA9PiB7CiAgICAgICAgICB1dGlscy5yZW1vdmVBdHRyaWJ1dGVzKCJmdWxsU2NyZWVuQ29udGFpbmVyIiwgWwogICAgICAgICAgICAib25jb3B5IiwKICAgICAgICAgICAgIm9uY29udGV4dG1lbnUiLAogICAgICAgICAgICAib25zZWxlY3RzdGFydCIKICAgICAgICAgIF0pOwogICAgICAgIH07CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRrID0gewogICAgICByZWdleHA6IC9jbml0cG0vLAogICAgICBpbml0OiBmdW5jdGlvbigpIHsKICAgICAgICB1dGlscy5oaWRlQnV0dG9uKCk7CiAgICAgICAgd2luZG93Lm9ubG9hZCA9ICgpID0+IHsKICAgICAgICAgIHV0aWxzLnJlbW92ZUF0dHJpYnV0ZXMoImJvZHkiLCBbIm9uY29weSIsICJvbmNvbnRleHRtZW51IiwgIm9uc2VsZWN0c3RhcnQiXSk7CiAgICAgICAgfTsKICAgICAgfQogICAgfTsKCiAgICBjb25zdCB3ZWJzaXRlJGogPSB7CiAgICAgIHJlZ2V4cDogbmV3IFJlZ0V4cCgiLitiYnMubWlob3lvLmNvbS8uKyIpLAogICAgICBpbml0OiBmdW5jdGlvbigpIHsKICAgICAgICB1dGlscy5oaWRlQnV0dG9uKCk7CiAgICAgICAgdXRpbHMuZW5hYmxlT25Db3B5QnlDYXB0dXJlKCk7CiAgICAgICAgdXRpbHMuZW5hYmxlT25TZWxlY3RTdGFydEJ5Q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iwgWyJzdHlsZSIsICJ1bnNlbGVjdGFibGUiLCAib25zZWxlY3RzdGFydCJdKTsKICAgICAgICB1dGlscy5yZW1vdmVBdHRyaWJ1dGVzKCIucmVhZGVyX21haW4iLCBbInN0eWxlIiwgInVuc2VsZWN0YWJsZSIsICJvbnNlbGVjdHN0YXJ0Il0pOwogICAgICAgIHV0aWxzLmhpZGVCdXR0b24oKTsKICAgICAgICB1dGlscy5lbmFibGVPbktleURvd24oImJvZHkiKTsKICAgICAgICB1dGlscy5lbmFibGVVc2VyU2VsZWN0QnlDU1MoKTsKICAgICAgICB1dGlscy5lbmFibGVPbkNvcHkoIi5jb250ZW50Iik7CiAgICAgICAgdXRpbHMuZW5hYmxlT25Db250ZXh0TWVudSgiYm9keSIpOwogICAgICAgIHV0aWxzLmVuYWJsZU9uU2VsZWN0U3RhcnQoIi5jb250ZW50Iik7CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRlID0gewogICAgICByZWdleHA6IG5ldyBSZWdFeHAoIjE3ayIpLAogICAgICBpbml0OiAoKSA9PiB7CiAgICAgICAgdXRpbHMuaGlkZUJ1dHRvbigpOwogICAgICAgIHV0aWxzLmVuYWJsZU9uQ29weSgiLnJlYWRBcmVhQm94IC5wIik7CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSRkID0gewogICAgICByZWdleHA6IG5ldyBSZWdFeHAoImNpd2VpbWFvIiksCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIHV0aWxzLmhpZGVCdXR0b24oKTsKICAgICAgICB1dGlscy5lbmFibGVVc2VyU2VsZWN0QnlDU1MoKTsKICAgICAgICB1dGlscy5lbmFibGVPbkNvcHkoIiNKX0Jvb2tDbnQiKTsKICAgICAgICB1dGlscy5lbmFibGVPbkNvbnRleHRNZW51KCJib2R5Iik7CiAgICAgICAgdXRpbHMuZW5hYmxlT25TZWxlY3RTdGFydCgiI0pfQm9va0NudCIpOwogICAgICB9C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gewogICAgICAgICAgY29udGV4dDJEUHJvdG90eXBlOiB1bnNhZmVXaW5kb3cuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiY2FudmFzIikuZ2V0Q29udGV4dCgiMmQiKS5fX3Byb3RvX18KICAgICAgICB9OwogICAgICAgIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQgPSBuZXcgUHJveHkoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCwgewogICAgICAgICAgYXBwbHk6IGZ1bmN0aW9uKHRhcmdldCwgdGhpc0FyZywgYXJndW1lbnRzTGlzdCkgewogICAgICAgICAgICBjb25zdCBlbGVtZW50ID0gUmVmbGVjdC5hcHBseSh0YXJnZXQsIHRoaXNBcmcsIGFyZ3VtZW50c0xpc3QpOwogICAgICAgICAgICBpZiAoYXJndW1lbnRzTGlzdFswXSA9PT0gImNhbnZhcyIpIHsKICAgICAgICAgICAgICBjb25zdCB0bXBEYXRhID0gewogICAgICAgICAgICAgICAgY2FudmFzOiBlbGVtZW50LAogICAgICAgICAgICAgICAgZGF0YTogW10KICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgIGVsZW1lbnQuZ2V0Q29udGV4dCgiMmQiKS5maWxsVGV4dCA9IGZ1bmN0aW9uKC4uLmFyZ3MpIHsKICAgICAgICAgICAgICAgIHRtcERhdGEuZGF0YS5wdXNoKGFyZ3MpOwogICAgICAgICAgICAgICAgb3JpZ2luT2JqZWN0LmNvbnRleHQyRFByb3RvdHlwZS5maWxsVGV4dC5hcHBseSh0aGlzLCBhcmdzKTsKICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgIGNhbnZhc0RhdGFHcm91cC5wdXNoKHRtcERhdGEpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHJldHVybiBlbGVtZW50OwogICAgICAgICAgfQogICAgICAgIH0pOwogICAgICAgIGxldCBwYWdlRGF0YSA9IHt9OwogICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh1bnNhZmVXaW5kb3csICJwYW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d2Vic2l0ZSQ1ID0gewogICAgICByZWdleHA6IG5ldyBSZWdFeHAoImNua2kiKSwKICAgICAgaW5pdDogZnVuY3Rpb24oKSB7CiAgICAgICAgdXRpbHMuaGlkZUJ1dHRvbigpOwogICAgICAgIHV0aWxzLmVuYWJsZU9uQ29udGV4dE1lbnVCeUNhcHR1cmUoKTsKICAgICAgICB1dGlscy5lbmFibGVPbktleURvd25CeUNhcHR1cmUoKTsKICAgICAgICB1dGlscy5lbmFibGVPbkNvcHlCeUNhcHR1cmUoKTsKICAgICAgfQogICAgfTsKCiAgICBjb25zdCB3ZWJzaXRlJDQgPSB7CiAgICAgIHJlZ2V4cDogbmV3IFJlZ0V4cCgiZG9jaW4uY29tLy4qIiksCiAgICAgIGNvbmZpZzogewogICAgICAgIGluaXRDb3B5RXZlbnQ6IGZhbHNlLAogICAgICAgIGNhcHR1cmVJbnN0YW5jZTogdHJ1ZSwKICAgICAgICBkZWxheTogMTAwCiAgICAgIH0sCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKFBBR0VfTE9BREVELCAoKSA9PiB7CiAgICAgICAgICB2YXIgX2E7CiAgICAgICAgICByZXR1cm4gKF9hID0gZG9tJDEucXVlcnkoIiNqX3NlbGVjdCIpKSA9PSBudWxsID8gdm9pZCAwIDogX2EuY2xpY2soKTsKICAgICAgICB9KTsKICAgICAgICBkb20kMS5hcHBlbmQoImhlYWQiLCAiPHN0eWxlPiNyZWFkZXItY29weS1lbHtkaXNwbGF5OiBub25lO308L3N0eWxlPiIpOwogICAgICB9LAogICAgICBnZXRTZWxlY3RlZFRleHQ6IGZ1bmN0aW9uKCkgewogICAgICAgIGlmICh1bnNhZmVXaW5kb3cuZG9jaW5SZWFkZXIgJiYgdW5zYWZlV2luZG93LmRvY2luUmVhZGVyLnN0KSB7CiAgICAgICAgICByZXR1cm4gdW5zYWZlV2luZG93LmRvY2luUmVhZGVyLnN0OwogICAgICAgIH0KICAgICAgICByZXR1cm4gIiI7CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSQzID0gewogICAgICByZWdleHA6IC9ub3RlXC55b3VkYW9cLmNvbVwvbmV3RWRpdG9yVjFcL2J1bGJcLmh0bWwuKi8sCiAgICAgIGluaXQ6IGZ1bmN0aW9uKCkgewogICAgICAgIHV0aWxzLmhpZGVCdXR0b24oKTsKICAgICAgICB1dGlscy5lbmFibGVVc2VyU2VsZWN0QnlDU1MoKTsKICAgICAgICBkb2N1bWVudC5hZGRFdmVudExpc3RlbmVyKE1PVVNFX0RPV04sIHN0b3BOYXRpdmVQcm9wYWdhdGlvbiwgdHJ1ZSk7CiAgICAgICAgZG9jdW1lbnQuYWRkRXZlbnRMaXN0ZW5lcihNT1VTRV9NT1ZFLCBzdG9wTmF0aXZlUHJvcGFnYXRpb24sIHRydWUpOwogICAgICB9CiAgICB9OwoKICAgIGNvbnN0IHdlYnNpdGUkMiA9IHsKICAgICAgcmVnZXhwOiBuZXcgUmVnRXhwKAogICAgICAgIFsKICAgICAgICAgICJjb21tYW5kbGludXgiLAogICAgICAgICAgImNua2kiLAogICAgICAgICAgInJ1aXdlbiIsCiAgICAgICAgICAib2gxMDAiLAogICAgICAgICAgImZ3c2lyIiwKICAgICAgICAgICJ3ZW54bSIsCiAgICAgICAgICAidW5qcyIsCiAgICAgICAgICAiYWhzcnN0IiwKICAgICAgICAgICJ5amJ5cyIsCiAgICAgICAgICAiMzYwZG9jIiwKICAgICAgICAgICI4NTA1MDAiLAogICAgICAgICAgImppYW5iaWFva3UiLAogICAgICAgICAgImt0MjUwIiwKICAgICAgICAgICJrZWp1ZGF0aSIsCiAgICAgICAgICAiYmFpYmVpa2UiLAogICAgICAgICAgInl1cXVlIiwKICAgICAgICAgICJjbnJlbmNhaSIsCiAgICAgICAgICAia29kaXBsYXllciIsCiAgICAgICAgICAidG9uZ3hpZWh1aSIsCiAgICAgICAgICAibmRQdXJlVmlldyIsCiAgICAgICAgICAiamlhbnNodSIsCiAgICAgICAgICAibGlub3ZlbGliIiwKICAgICAgICAgICJjaGF6aWRpYW4iLAogICAgICAgICAgImp1ZWppbiIsCiAgICAgICAgICAiemdiayIsCiAgICAgICAgICAid2VubWkiLAogICAgICAgICAgInl1ZWR1XFwuYmFpZHUiLAogICAgICAgICAgImlucnJwIiwKICAgICAgICAgICJzaHViYW9jIiwKICAgICAgICAgICI1MWN0byIsCiAgICAgICAgICAieGltYWxheWEiLAogICAgICAgICAgInhpZXhpZWJhbmciLAogICAgICAgICAgImRkd2s4IiwKICAgICAgICAgICJwaHBcXC5jbiIsCiAgICAgICAgICAiZmFucWllbm92ZWxcXC5jb20vcmVhZGVyIiwKICAgICAgICAgICJjb29jb1xcLm5ldFxcLmNuIiwKICAgICAgICAgICJtb2JpbGV0cmFpbiIsCiAgICAgICAgICAieGlhbmdxaXFpcHUiLAogICAgICAgICAgIm1cXC4xNjNcXC5jb20iLAogICAgICAgICAgImFpcGlheGkiLAogICAgICAgICAgIndlbmt1XFwuY3NkblxcLm5ldCIKICAgICAgICBdLmpvaW4oInwiKQogICAgICApLAogICAgICBpbml0OiBmdW5jdGlvbigpIHsKICAgICAgICB1dGlscy5oaWRlQnV0dG9uKCk7CiAgICAgICAgdXRpbHMuZW5hYmxlVXNlclNlbGVjdEJ5Q1NTKCk7CiAgICAgICAgdXRpbHMuZW5hYmxlT25Db3B5QnlDYXB0dXJlKCk7CiAgICAgIH0KICAgIH07CgogICAgY29uc3Qgd2Vic2l0ZSQxID0gewogICAgICByZWdleHA6IG5ldyBSZWdFeHAoWyJ3angiLCAiZmFueWlcXC5iYWlkdSIsICJ0aWFucWkiLCAicnJkeW5iIiwgImZ1d3U3Il0uam9pbigifCIpKSwKICAgICAgaW5pdDogZnVuY3Rpb24oKSB7CiAgICAgICAgdXRpbHMuaGlkZUJ1dHRvbigpOwogICAgICAgIHV0aWxzLmVuYWJsZVVzZXJTZWxlY3RCeUNTUygpOwogICAgICAgIHV0a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Rvdy5hZGRFdmVudExpc3RlbmVyKAogICAgICAgIE1PVVNFX1VQLAogICAgICAgIChlKSA9PiB7CiAgICAgICAgICBjb25zdCBoYW5kbGVyID0gKCkgPT4gewogICAgICAgICAgICBjb25zdCBjb250ZW50ID0gZ2V0U2VsZWN0ZWRUZXh0KCk7CiAgICAgICAgICAgIGlmIChpc0VtcHR5Q29udGVudChjb250ZW50KSkgewogICAgICAgICAgICAgIGluc3RhbmNlLmhpZGUoKTsKICAgICAgICAgICAgICByZXR1cm4gIiI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW5zdGFuY2Uub25Db3B5KGNvbnRlbnQsIGUpOwogICAgICAgICAgfTsKICAgICAgICAgIHdlYnNpdGVDb25maWcuZGVsYXkgPyBzZXRUaW1lb3V0KGhhbmRsZXIsIHdlYnNpdGVDb25maWcuZGVsYXkpIDogaGFuZGxlcigpOwogICAgICAgIH0sCiAgICAgICAgd2Vic2l0ZUNvbmZpZy5jYXB0dXJlSW5zdGFuY2UKICAgICAgKTsKICAgIH0pKCk7Cgp9KSgpOwo=
Add Comment
Please, Sign In to add comment