xiaomianao666

邀您一起看:一拳超人 S01-S02+OVA(合集)

Nov 23rd, 2024
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥一拳超人 S01-S02+OVA(合集)@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuWkuOWFi+WIl+ihqEFQSVwiLFwicGF0aFwiOlwiUXVhcmtTaGFyZUFwaVwiLFwicnVsZVwiOlwianM6XFxuLy9AYXV0aG9yIExveURnSWtcXG5sZXQgaHR0cFJlcXVlc3QgPSAkLnJlcXVpcmUoXFxcImh0dHBSZXF1ZXN0XFxcIik7XFxubGV0IENvb2tpZU1hbmFnZT0kLnJlcXVpcmUoXFxcIkNvb2tpZU1hbmFnZVxcXCIpO1xcbmxldCBmcm9tRHJpdmUgPSBtb2R1bGUuaW1wb3J0UGFyYW07XFxubGV0IHByLCBiYXNlVXJsLCBjb29raWU7XFxuaWYgKGZyb21Ecml2ZSA9PT0gXFxcInVjXFxcIikge1xcbiAgICBiYXNlVXJsID0gXFxcImh0dHBzOi8vcGMtYXBpLnVjLmNuXFxcIjtcXG4gICAgcHIgPSBcXFwiVUNCcm93c2VyXFxcIjtcXG4gICAgY29va2llID0gZ2V0SXRlbShcXFwidWNDb29raW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AgICAgIGxldCBib2R5ID0gcmVzLmJvZHk7XFxuICAgICAgICAgICAgICAgIGlmICh0b0pzb24pIHtcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzL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A+IDMyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruS4jeWQiOazlVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFN0cmluZyhzcGVlZFRocmVhZCkpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGlmIChmcm9tRHJpdmUgPT09IFxcXCJ1Y1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9kcml2ZS51Yy5jbi9zL1xcXCIgKyBzaGFyZUlkICsgXFxcIj9wdWJsaWM9MSMvbGlzdC9zaGFyZVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGJ1aWxkVXJsKFxcXCJodHRwczovL3Bhbi5xdWFyay5jbi9zL1xcXCIgKyBzaGFyZUlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFzc2NvZGU6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHNoYXJlSWQsIHNoYXJlUHdkLCBmcm9tRHJpdmUpLFxcbiAgICAg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ICAgICAgIHZhciBsaXN0ID0gcmVzLmRhdGEubGlzdCB8fCBbXTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBsZXQgbmNvb2tpZT1xdWFya1NoYXJlQXBpLmdldFBpY0Nvb2tpZSgpO1xcbiAgICBsb2cobmNvb2tpZSlcXG4gICAgbGlzdC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgLy/liKTmlq3mmK/lkKbmlofku7blpLlcXG4gICAgICAgIGlmIChpdGVtLmRpcikge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi8J+TglxcXCIgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBpdGVtLmluY2x1ZGVfaXRlbXMgKyAn6aG5ICAnLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFwiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8yNy5zdmdcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvcXVhcmtMaXN0P3BhZ2U9ZnlwYWdlXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBmcm9tRHJpdmVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZ2V0SGVhZChpdGVtLm9ial9jYXRlZ29yeSkgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBmb3JtYXRTaXplKGl0ZW0uc2l6ZSksXFxuICAgICAgICAgICAgICAgIHBpY191cmw6ICQoaXRlbS50aHVtYm5haWwsIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZTogbmNvb2tpZVxcbiAgICAgICAgICAgICAgICB9KS5pbWFnZSgpLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoKS5sYXp5UnVsZSgoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSwgZnJvbURyaXZlKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHt9KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFwicGxheVxcXCIsIGZyb21Ecml2ZSkuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsQ2FjaGVbZmlkXSA9IHVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwgcGxheVVybENhY2hlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnksIGZyb21Ecml2ZSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIC8vaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlsaXN0ICcgKyBpdGVtLm9ial9jYXRlZ29yeVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG5cXG4gICAgfSk7XFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IGUubWVzc2FnZSxcXG4gICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcbiAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBpZiAoZS5tZXNzYWdlLmluY2x1ZGVzKFxcXCLmj5Dlj5bnoIFcXFwiKSkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIui+k+WFpeaPkOWPlueggVxcXCIsXFxuICAgICAgICAgICAgdXJ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SA8IDk7IGkrKykge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgcmVzID0gdGFzayh0YXNrX2lkLCBpICsgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIGlmIChyZXMuZGF0YS5zdGF0dXMgPT09IDIpIHtcXG4gICAgICAgICAgICAgICAgd2FpdFNsZWVwKDEwMDApO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzLmRhdGEuc2F2ZV9hcy5zYXZlX2FzX3RvcF9maWRzWzBdO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB3YWl0U2xlZXAoMzAwICogKGkgKyAxKSk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICB9XFxuICAgIHJldHVybiB2b2lkKDApO1xcbn1cXG5cXG5mdW5jdGlvbiBxdWVyeVRhc2tTdGF0dXModGFza19pZCkge1xcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IDY7IGkrKykge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgcmVzID0gdGFzayh0YXNrX2lkLCBpICsgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIGlmIChyZXMuZGF0YS5zdGF0dXMgPT09IDIpIHtcXG4gICAgICAgICAgICAgICAgd2FpdFNsZWVwKDEwMDApO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgd2FpdFNsZWVwKDMwMCk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICB9XFxuICAgIHJldHVybiBmYWxzZTtcXG59XFxuXFxuZnVuY3Rpb24gZ2V0UHJldmlld1ZpZGVvKGZpZCkge1xcbiAgICByZXR1cm4gcmVxdWVzdEh0dHAoYXBpICsgXFxcIi8xL2Nsb3VkZHJpdmUvZmlsZS92Mi9wbGF5P3ByPVxcXCIgKyBwciArIFxcXCImZnI9cGNcXFwiKS5ib2R5KHtcXG4gICAgICAgIFxc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uICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/ojrflj5blpLHotKVcXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgYXNmaWQgPSBmaWQ7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgcGxheUNvb2tpZSA9IGNvb2tpZU1hbmFnZS5nZXQoKTtcXG4gICAgICAgIC8qaWYgKHByID09PSBcXFwiVUNCcm93c2VyXFxcIikge1xcbiAgICAgICAgICAgIHBsYXlDb29raWUgPSBjb29raWU7XFxuICAgICAgICB9Ki9cXG4gICAgICAgIGxldCBwbGF5SGVhZGVyID0ge1xcbiAgICAgICAgICAgIFJlZmVyZXI6IGhvbWVVcmwsXFxuICAgICAgICAgICAgY29va2llOiBwbGF5Q29va2llLFxcbiAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogXFxcIk1vemlsbGEvNS4wIChNYWNpbnRvc2g7IEludGVsIE1hYyBPUyBYIDEwXzE1XzcpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIFZlcnNpb24vNC4wIENocm9tZS8xMDAuMC40ODk2LjU4IFVDQnJvd3Nlci8xNi41LjguMTMwOSBNb2JpbGUgU2FmYXJpLzUzNy4zNlxcXCJcXG4gICAgICAgIH07XFxuICAgICAgICBsZXQgcGxheUhlYWRlcnMgPSBPYmplY3QuYXNzaWduKHt9LCBwbGF5SGVhZGVyLCB7XFxuICAgICAgICAgICAgXFxcIlVzZXItQWdlbnRcXFwiOiBcXFwiTG9nU3RhdGlzdGljXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBpZiAoY2F0ZWdvcnkgPT0gXFxcInZpZGVvXFxcIikge1xcbiAgICAgICAgICAgIGxldCBwbGF5TW9kZSA9IGdldEl0ZW0oXFxcInF1YXJrX3BsYXlNb2RlXFxcIiwgXFxcIui9rOeggVxcXCIpO1xcbiAgICAgICAgICAgIGlmIChwbGF5TW9kZSA9PT0gXFxcIui9rOeggVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvUmVzID0gZ2V0UHJldmlld1ZpZGVvKGFzZmlkKTtcXG5cXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvTGlzdCA9IHZpZGVvUmVzLmRhdGEudmlkZW9fbGlzdDtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW10sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbXVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB2aWRlb0xpc3QuZmlsdGVyKHYgPT4gdi5hY2Nlc3NhYmxlKS5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QubmFtZXMucHVzaCh2LnJlc29sdXRpb24pO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QudXJscy5wdXNoKHYudmlkZW9faW5mby51cmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LmhlYWRlcnMucHVzaChwbGF5SGVhZGVycyk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBpc1NoYXJlICYmIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuXFxuICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsID0gZ2V0RG93bmxvYWRVcmwoYXNmaWQpLmRhdGFbMF0uZG93bmxvYWRfdXJsO1xcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVycy5jb29raWUgPSBjb29raWVNYW5hZ2UuZ2V0KCk7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbcGxheU1vZGVdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiICsgKHBsYXlNb2RlID09PSBcXFwi5Y6f55S7XFxcIiA/IFxcXCIjZmFzdFBsYXlNb2RlIyN0aHJlYWRzPVxcXCIgKyBnZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFxcXCIxMFxcXCIpICsgXFxcIiNcXFwiIDogXFxcIlxcXCIpXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyc11cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpc1NoYXJlICYmY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXG5cXG4gICAgICAgICAgICBpc1NoYXJlICYmIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgIGlmIChjYXRlZ29yeSA9PT0gJ2F1ZGlvJykge1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXCLpn7PpopFcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcIiNpc1ZpZGVvPXRydWUjXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcl0sXFxuICAgICAgICAgICAgICAgICAgICBseXJpYzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2F0ZWdvcnkgPT09ICdpbWFnZScpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQocGxheVVybCwgcGxheUhlYWRlcikuaW1hZ2UoKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVyID0gT2JqZWN0LmtleXMocGxheUhlYWRlcikubWFwKGtleSA9PiBrZXkgKyBcXFwiQFxcXCIgKyBTdHJpbmcocGxheUhlYWRlcltrZXldKS5yZXBsYWNlKC87L2csIFxcXCLvvJvvvJtcXFwiKSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiZG93bmxvYWQ6Ly9cXFwiICsgcGxheVVybCArIFxcXCI7e1xcXCIgKyBwbGF5SGVhZGVyLmpvaW4oXFxcIiYmXFxcIikgKyBcXFwifVxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICBpZiAoZS5tZXNzYWdlLmluY2x1ZGVzKFxcXCJyZXF1aXJlIGxvZ2luXFxcIikpIHtcXG4gICAgICAgICAgICB0b2FzdChcXFwi5pyq55m75b2V5oiW55m75b2V6L+H5pyf77yM6K+36YeN5paw55m75b2VXFxcIik7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvbG9naW4jbm9SZWNvcmRIaXN0b3J5IyNub0hpc3RvcnkjP2Zyb209XFxcIiArIGZyb21Ecml2ZTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9cXFwiICsgZS50b1N0cmluZygpO1xcbiAgICB9XFxufVxcblxcbiQuZXhwb3J0cyA9IHtcXG4gICAgZ2V0U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AgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYmFjaygpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/nmbvlvZXmiJDlip9cXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+acqueZu+W9lVxcXCI7XFxuICAgIH0sIGZyb20pLFxcbiAgICBkZXNjOiBcXFwi4oCc4oCc4oCd4oCdPHNtYWxsPueCueWHu+WktOWDj+WPr+S7pemAgOWHuui0puWPt+mHjeaWsOeZu+W9lTwvc21hbGw+XFxcIixcXG4gICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIlxcbn0pO1xcbmQucHVzaCh7XFxuICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG59KTtcXG5sZXQgZHVybD1mcm9tPT09XFxcInVjXFxcIj9cXFwiaHR0cHM6Ly9kcml2ZS51Yy5jblxcXCI6XFxcImh0dHBzOi8vcGFuLnF1YXJrLmNuXFxcIjtcXG5kLnB1c2goe1xcbiAgICBjb2xfdHlwZTogXFxcIng1X3dlYnZpZXdfc2luZ2xlXFxcIixcXG4gICAgdXJsOiBkdXJsLFxcbiAgICBkZXNjOiBcXFwibGlzdCYmc2NyZWVuLTE1MFxcXCIsXFxuICAgIGV4dHJhOiB7XFxuICAgICAgICB1YTogUENfVUEsXFxuICAgICAgICBqczogJC50b1N0cmluZygodGl0bGUsIGR1cmwpID0+IHtcXG4gICAgICAgICAgICBsZXQgY29va2llID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgc2V0SW50ZXJ2YWwoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjb29raWUgPSBmYmEuZ2V0Q29va2llKGR1cmwpO1xcbiAgICAgICAgICAgICAgICBmYmEucHV0VmFyKHRpdG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ZBcXFxcbua1t+mYlOiuvue9ri0+5pu05aSa5Yqf6IO9LT7lhoXpg6jmlofku7bnrqHnkIYtPuWPs+S4iuinklxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoZmV0Y2goXFxcImZpbGU6Ly9cXFwiICsgcGF0aCkpO1xcbiAgICAgICAgICAgICAgICBsZXQgY29va2llID0ganNvbi5jb29raWU7XFxuICAgICAgICAgICAgICAgIGlmICgkLnJlcXVpcmUoXFxcInRvb2xcXFwiKS5pc0xvZ2luQ29va2llKGNvb2tpZSkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0peWFseS6q+aWh+S7tuaNn+Wdj1xcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gJChcXFwi5pyq5qOA5rWL5YiwVFZCT1jnmoRDb29raWXmlofku7ZcXFxcbuivt+S9v+eUqOi/h+WQjuWGjeWwneivlVxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcbiAgICAgICAgfVxcbiAgICB9IGVsc2Uga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h0LmRnd2h0LnRvcC90ZXh0LzNkZTg4ZDEwZDAxOTI5YmUvJ1xcbiAgICAgICAgbGV0IHhjZGF0YSA9IFsnYzk5ZDc0MTFjY2MyOWJjMSddXFxuICAgICAgICBsZXQgZHhjID0gW11cXG4gICAgICAgIGxldCB5c2Nvb2tpZSA9ICcnXFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHhjZGF0YS5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGxldCBkYXRhID0gZmV0Y2goZHhjdXJsICsgeGNkYXRhW2ldLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhoZFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGlmICgkLnJlcXVpcmUoXFxcInRvb2xcXFwiKS5pc0xvZ2luQ29va2llKGRhdGEpKSB7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICB5c2Nvb2tpZSA9IGRhdGEuc3BsaXQoXFxcIuKRoFxcXCIpWzFdO1xcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoeXNjb29raWUpIHtcXG4gICAgICAgICAgICBzZXRJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIsIHlzY29va2llKTtcXG4gICAgICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0pVxcXCI7XFxuICAgICAgICB9XFxuICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpLjlhYvkuoznu7TnoIHnmbvlvZVcXFwiKSB7XFxuICAgICAgICBmdW5jdGl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lKTtcXG4gICAgICAgICAgICBsZXQgc2VydmljZV90aWNrZXQ9XFxcIlxcXCI7XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDAsIGVjID0gMDsgaSA8IDMwOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgyMDAwKTtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0aWNrZXQgPSBKU09OLnBhcnNlKGZldGNoKGJ1aWxkVXJsKFxcXCJodHRwczovL3VvcC5xdWFyay5jbi9jYXMvYWpheC9nZXRTZXJ2aWNlVGlja2V0QnlRcmNvZGVUb2tlblxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0X2lkOmdlbmVyYXRlUmFuZG9tVVVJRCgpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudF9pZDogXFxcIjUzMlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdjogXFxcIjEuMlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9rZW46IHFjVG9rZW5cXG4gICAgICAgICAgICAgICAgICAgIH0pKSk7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyh0aWNrZXQpXFxuICAgICAgICAgICAgICAgICAgICBpZih0aWNrZXQuc3RhdHVzID09IDIwMDAwMDApe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VfdGlja2V0PXRpY2tldC5kYXRhLm1lbWJlcnMuc2VydmljZV90aWNrZXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBpZiAodGlja2V0LnN0YXR1cyA9PSA1MDAwNDAwMSkgY29udGludWU7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodGlja2V0LnN0YXR1cyA9PSA1MDAwNDAwMiB8fCBpID09PSAyOSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kuoznu7TnoIHov4fmnJ9cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICBlYysrO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVjID49IDUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5p+l6K+i5LqM57u056CB5Ye66ZSZXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZighc2VydmljZV90aWNrZXQpIHJldHVybiBcXFwidG9hc3Q6Ly90aWNrZXTojrflj5blpLHotKVcXFwiO1xcbiAgICAgICAgICAgIGxldCByZXM9SlNPTi5wYXJzZShmZXRjaChcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY24vYWNjb3VudC9pbmZvP3N0PVxcXCIrc2VydmljZV90aWNrZXQrXFxcIiZsdz1zY2FuXFxcIiwge1xcbiAgICAgICAgICAgICAgICB3aXRoSGVhZGVyczp0cnVlXFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgIC8vbG9nKHJlcylcXG4gICAgICAgICAgICBpZighSlNPTi5wYXJzZShyZXMuYm9keSkuc3VjY2VzcykgcmV0dXJuIFxcXCJ0b2FzdDovL3RpY2tldOmqjOivgeWksei0pVxcXCI7XFxuICAgICAgICAgICAgbGV0IGNvb2tpZT1cXFwiXFxcIjtcXG4gICAgICAgICAgICBsZXQgaGVhZGVycz1yZXMuaGVhZGVycztcXG4gICAgICAgICAgICBmb3IgKGxldCBjIG9mIGhlYWRlcnNbXFxcInNldC1jb29raWVcXFwiXSl7XFxuICAgICAgICAgICAgICAgIGNvb2tpZSs9Yy5zcGxpdChcXFwiO1xcXCIpWzBdK1xcXCI7XFxcI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FyZUlkO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLkuKrkurrotKblj7fnrqHnkIZcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiAkLnJlcXVpcmUoXFxcImFjY291bnRcXFwiKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5Y6f55S75LiL6L2957q/56iLXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChnZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFxcXCIxMFxcXCIpLCBcXFwi6K+36L6T5YWlMy0zMuS5i+mXtOeahOaVtOaVsFxcXCIpLmlucHV0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzcGVlZFRocmVhZCA9IHBhcnNlSW50KGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChzcGVlZFRocmVhZCA8IDMgfHwgc3BlZWRUaHJlYWQgPiAzMikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7kuI3lkIjms5VcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwic3BlZWRUaHJlYWRcXFwiLCBTdHJpbmcoc3BlZWRUaHJlYWQpKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5aSN5Yi25YiG5Lqr6ZO+5o6lXFxcIikge1xcbiAgICAgICAgICAgICAgICBpZiAoZnJvbURyaXZlID09PSBcXFwidWNcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgYnVpbGRVcmwoXFxcImh0dHBzOi8vZHJpdmUudWMuY24vcy9cXFwiICsgc2hhcmVJZCArIFxcXCI/cHVibGljPTEjL2xpc3Qvc2hhcmVcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY24vcy9cXFwiICsgc2hhcmVJZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhc3Njb2RlOiBzaGFyZVB3ZFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LCBzaGFyZUlkLCBzaGFyZVB3ZCwgZnJvbURyaXZlKSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwiaWNvbl81XFxcIixcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9maWxlaW50by5zdmdcXFwiLFxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXG4gICAgfSk7XFxufVxcblxcblxcbmxldCBRdWFya1NoYXJlQXBpID0gJC5yZXF1aXJlKFxcXCJRdWFya1NoYXJlQXBpXFxcIiwgZnJvbURyaXZlKTtcXG5sZXQgcXVhcmtTaGFyZUFwaSA9IG5ldyBRdWFya1NoYXJlQXBpKHNoYXJlSWQsIHNoYXJlUHdkKS5zZXRUb2tlbihzaGFyZVRva2VuKS5zZXRSZWZyZXNoKChzaGFyZVRva2VuKSA9PiB7XFxuICAgIE1ZX1BBUkFNUy5zaGFyZVRva2VuID0gc2hhcmVUb2tlbjtcXG4gICAgc2V0UGFnZVBhcmFtcyhNWV9QQVJBTVMpO1xcbn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Vzc3kvMjcuc3ZnXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL3F1YXJrTGlzdD9wYWdlPWZ5cGFnZVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbURyaXZlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGdldEhlYWQoaXRlbS5vYmpfY2F0ZWdvcnkpICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgZm9ybWF0U2l6ZShpdGVtLnNpemUpLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiAkKGl0ZW0udGh1bWJuYWlsLCB7XFxuICAgICAgICAgICAgICAgICAgICBjb29raWU6IG5jb29raWVcXG4gICAgICAgICAgICAgICAgfSkuaW1hZ2UoKSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnksIGZyb21Ecml2ZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBsYXlVcmxDYWNoZSA9IHN0b3JhZ2UwLmdldE15VmFyKFxcXCJwbGF5VXJsQ2FjaGVcXFwiLCB7fSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAocGxheVVybENhY2hlW2ZpZF0pIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGxheVVybENhY2hlW2ZpZF07XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSAkLnJlcXVpcmUoXFxcInBsYXlcXFwiLCBmcm9tRHJpdmUpLmdldFBsYXlVcmwoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxheVVybENhY2hlW2ZpZF0gPSB1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHBsYXlVcmxDYWNoZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybDtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaXRlbS5maWQsIGl0ZW0uc2hhcmVfZmlkX3Rva2VuLCBzaGFyZUlkLCBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksIGl0ZW0ub2JqX2NhdGVnb3J5LCBmcm9tRHJpdmUpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICAvL2luaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBjbHM6ICdwbGF5bGlzdCAnICsgaXRlbS5vYmpfY2F0ZWdvcnlcXG4gICAgICAgICAgICAgIC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gJiYgdGhpcy5fYm9keVRvU3RyaW5nKSB7XFxcXG4gICAgICAgICAgICBvcHRpb25zLmJvZHkgPSBKU09OLnN0cmluZ2lmeShvcHRpb25zLmJvZHkpO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHZhciByZXMgPSBKU09OLnBhcnNlKHRoaXMuc3RhcnRSZXF1ZXN0KHRoaXMuYnVpbGRQYXJhbT9idWlsZFVybCh0aGlzLnVybCwgdGhpcy5idWlsZFBhcmFtKTp0aGlzLnVybCwgb3B0aW9ucykpO1xcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgaWYgKHJlcy5zdGF0dXNDb2RlID49IDIwMCAmJiByZXMuc3RhdHVzQ29kZSA8PSAzMDApIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgYm9keSA9IHJlcy5ib2R5O1xcXFxuICAgICAgICAgICAgICAgIGlmICh0b0pzb24pIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgYm9keSA9IEpTT04ucGFyc2UoYm9keSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoU3RyaW5nKHJlcy5zdGF0dXNDb2RlKSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xcXFxuICAgICAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXFxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcblxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKHRoaXMucmV0cnlDb3VudCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCB0cnlSZXN1bHQgPSB0aGlzLmVycm9yQ2FsbGJhY2tXaXRoUmV0cnkoZXJyLCByZXMsIHRoaXMpO1xcXFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXRyeUNvdW50LS07XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN0YXJ0KHRvSnNvbik7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXRyeUNvdW50ID0gMDtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXJyb3JDYWxsYmFjayhlcnIsIHJlcyk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfVxcXFxuICAgIH0sXFxcXG4gICAgc2V0T3B0aW9ucyhvcHRpb25zKSB7XFxcXG4gICAgICAgIHRoaXMub3B0aW9ucyA9IE9iamVjdC5hc3NpZ24oe30sIG9wdGlvbnMsIHtcXFxcbiAgICAgICAgICAgIHdpdGhIZWFkZXJzOiB0cnVlXFxcXG4gICAgICAgIH0pO1xcXFxuICAgICAgICByZXR1cm4gdGhpcztcXFxcbiAgICB9LFxcXFxuICAgIG1lcmdlSGVhZEFuZEJvZHkob3B0aW9ucykge1xcXFxuICAgICAgICBvcHRpb25zID0gb3B0aW9ucyB8fCB7fTtcXFxcbiAgICAgICAgT2JqZWN0LmFzc2lnbih0aGlzLm9wdGlvbnMuaGVhZGVyc3x8e30sIG9wdGlvbnMuaGVhZGVycyk7XFxcXG4gICAgICAgIGlmICh0eXBlb2YgdGhpcy5vcHRpb25zLmJvZHkgPT09IFxcXFxcXFwib2JqZWN0XFxcXFxcXC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zaGFyZUlkO1xcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLkuKrkurrotKblj7fnrqHnkIZcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiAkLnJlcXVpcmUoXFxcXFxcXCJhY2NvdW50XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLljp/nlLvkuIvovb3nur/nqItcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiAkKGdldEl0ZW0oXFxcXFxcXCJzcGVlZFRocmVhZFxcXFxcXFwiLCBcXFxcXFxcIjEwXFxcXFxcXCIpLCBcXFxcXFxcIuivt+i+k+WFpTMtMzLkuYvpl7TnmoTmlbTmlbBcXFxcXFxcIikuaW5wdXQoKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgc3BlZWRUaHJlYWQgPSBwYXJzZUludChpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChzcGVlZFRocmVhZCA8IDMgfHwgc3BlZWRUaHJlYWQgPiAzMikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/orr7nva7kuI3lkIjms5VcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXFxcXFwic3BlZWRUaHJlYWRcXFxcXFxcIiwgU3RyaW5nKHNwZWVkVGhyZWFkKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFxcXFxcIuWkjeWItuWIhuS6q+mTvuaOpVxcXFxcXFwiKSB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xcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBpdGVtLmZpZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbURyaXZlXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgZm9ybWF0U2l6ZShpdGVtLnNpemUpLFxcXFxuICAgICAgICAgICAgICAgIHBpY191cmw6ICQoaXRlbS50aHVtYm5haWwsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29va2llOiBuY29va2llXFxcXG4gICAgICAgICAgICAgICAgfSkuaW1hZ2UoKSxcXFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoKS5sYXp5UnVsZSgoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSwgZnJvbURyaXZlKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFxcXFxcInBsYXlVcmxDYWNoZVxcXFxcXFwiLCB7fSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFxcXFxcInBsYXlcXFxcXFxcIiwgZnJvbURyaXZlKS5nZXRQbGF5VXJsKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnkpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxheVVybENhY2hlW2ZpZF0gPSB1cmw7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFxcXFxcInBsYXlVcmxDYWNoZVxcXFxcXFwiLCBwbGF5VXJsQ2FjaGUpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybDtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0uZmlkLCBpdGVtLnNoYXJlX2ZpZF90b2tlbiwgc2hhcmVJZCwgcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLCBpdGVtLm9ial9jYXRlZ29yeSwgZnJvbURyaXZlKSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uZmlkLFxcXFxuICAgICAgICAgICAgICAgICAgICAvL2luaGVyaXRUaXRsZTogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlsaXN0ICcgKyBpdGVtLm9ial9jYXRlZ29yeVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcblxcXFxuICAgIH0pO1xcXFxufSBjYXRjaCAoZSkge1xcXFxuICAgIGQucHVzaCh7XFxcXG4gICAgICAgIHRpdGxlOiBlLm1lc3NhZ2UsXFxcXG4gICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcXFxuICAgICAgICBjb2xfdHl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iaWxlIFNhZmFyaS81MzcuMzZcXFxcXFxcIlxcXFxuICAgICAgICB9O1xcXFxuICAgICAgICBsZXQgcGxheUhlYWRlcnMgPSBPYmplY3QuYXNzaWduKHt9LCBwbGF5SGVhZGVyLCB7XFxcXG4gICAgICAgICAgICBcXFxcXFxcIlVzZXItQWdlbnRcXFxcXFxcIjogXFxcXFxcXCJMb2dTdGF0aXN0aWNcXFxcXFxcIlxcXFxuICAgICAgICB9KTtcXFxcbiAgICAgICAgaWYgKGNhdGVnb3J5ID09IFxcXFxcXFwidmlkZW9cXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgbGV0IHBsYXlNb2RlID0gZ2V0SXRlbShcXFxcXFxcInF1YXJrX3BsYXlNb2RlXFxcXFxcXCIsIFxcXFxcXFwi6L2s56CBXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgaWYgKHBsYXlNb2RlID09PSBcXFxcXFxcIui9rOeggVxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvUmVzID0gZ2V0UHJldmlld1ZpZGVvKGFzZmlkKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb0xpc3QgPSB2aWRlb1Jlcy5kYXRhLnZpZGVvX2xpc3Q7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW10sXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtdLFxcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbXVxcXFxuICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgdmlkZW9MaXN0LmZpbHRlcih2ID0+IHYuYWNjZXNzYWJsZSkuZm9yRWFjaCh2ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QubmFtZXMucHVzaCh2LnJlc29sdXRpb24pO1xcXFxuICAgICAgICAgICAgICAgICAgICBwbGF5T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AgICAgICAgICAgICAgaXNTaGFyZSAmJmNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXFxcblxcXFxuICAgICAgICAgICAgaXNTaGFyZSAmJiBjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXFxcbiAgICAgICAgICAgIGlmIChjYXRlZ29yeSA9PT0gJ2F1ZGlvJykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtcXFxcXFxcIumfs+mikVxcXFxcXFwiXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFxcXFxcIiNpc1ZpZGVvPXRydWUjXFxcXFxcXCJdLFxcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcl0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGx5cmljOiBcXFxcXFxcIlxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNhdGVnb3J5ID09PSAnaW1hZ2UnKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQocGxheVVybCwgcGxheUhlYWRlcikuaW1hZ2UoKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcGxheUhlYWRlciA9IE9iamVjdC5rZXlzKHBsYXlIZWFkZXIpLm1hcChrZXkgPT4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k7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly9Db29raWXmoLzlvI/plJnor69cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwgaXNyKTtcXFxcbiAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFxcXFxcIuS7jlRWQk9Y6I635Y+WQ29va2llXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgbGV0IHBhdGggPSBcXFxcXFxcIi9zdG9yYWdlL2VtdWxhdGVkLzAvVFYvLnF1YXJrX3VzZXJcXFxcXFxcIjtcXFxcbiAgICAgICAgaWYgKGZpbGVFeGlzdChcXFxcXFxcImZpbGU6Ly9cXFxcXFxcIiArIHBhdGgpKSB7XFxcXG4gICAgICAgICAgICBpZiAoIW5ldyBqYXZhLmlvLkZpbGUocGF0aCkuY2FuUmVhZCgpKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcXFxcXCLmsqHmnInmnYPpmZDor7vlj5ZDb29raWXmlofku7bvvIzor7fmiZPlvIDmiYDmnInmlofku7bmnYPpmZBcXFxcXFxcXG7mtbfpmJTorr7nva4tPuabtOWkmuWKn+iDvS0+5YaF6YOo5paH5Lu2566h55CGLT7lj7PkuIrop5JcXFxcXFxcIikuY29uZmlybSgoKSA9PiB7fSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShmZXRjaChcXFxcXFxcImZpbGU6Ly9cXFxcXFxcIiArIHBhdGgpKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgY29va2llID0ganNvbi5jb29raWU7XFxcXG4gICAgICAgICAgICAgICAgaW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XCIpIHtcXFxcbiAgICAgICAgbGV0IGhoZCA9IHtcXFxcbiAgICAgICAgICAgICdVc2VyLUFnZW50JzogJ0FwYWNoZS1IdHRwQ2xpZW50L1VOQVZBSUxBQkxFIChqYXZhIDEuNCknXFxcXG4gICAgICAgIH3CoFxcXFxuICAgICAgICBsZXQgZHhjdXJsID0gJ2h0dHA6Ly9hcGkudjZ4LndodC5kZ3dodC50b3AvdGV4dC8zZGU4OGQxMGQwMTkyOWJlLydcXFxcbiAgICAgICAgbGV0IHhjZGF0YSA9IFsnYzk5ZDc0MTFjY2MyOWJjMSddXFxcXG4gICAgICAgIGxldCBkeGMgPSBbXVxcXFxuICAgICAgICBsZXQgeXNjb29raWUgPSAnJ1xcXFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHhjZGF0YS5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgbGV0IGRhdGEgPSBmZXRjaChkeGN1cmwgKyB4Y2RhdGFbaV0sIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiBoaGRcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgaWYgKCQucmVxdWlyZShcXFxcXFxcInRvb2xcXFxcXFxcIikuaXNMb2dpbkNvb2tpZShkYXRhKSkge1xcXFxuICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHlzY29va2llID0gZGF0YS5zcGxpdChcXFxcXFxcIuKRoFxcXFxcXFwiKVsxXTtcXFxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGlmICh5c2Nvb2tpZSkge1xcXFxuICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInF1YXJrQ29va2llXFxcXFxcXCIsIHlzY29va2llKTtcXFxcbiAgICAgICAgICAgIGlzciAmJiByZWZyZXNo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ICAgICB0b2tlbjogcWNUb2tlblxcXFxuICAgICAgICAgICAgICAgICAgICB9KSkpO1xcXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyh0aWNrZXQpXFxcXG4gICAgICAgICAgICAgICAgICAgIGlmKHRpY2tldC5zdGF0dXMgPT0gMjAwMDAwMCl7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXJ2aWNlX3RpY2tldD10aWNrZXQuZGF0YS5tZW1iZXJzLnNlcnZpY2VfdGlja2V0O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHRpY2tldC5zdGF0dXMgPT0gNTAwMDQwMDEpIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAodGlja2V0LnN0YXR1cyA9PSA1MDAwNDAwMiB8fCBpID09PSAyOSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/kuoznu7TnoIHov4fmnJ9cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZWMrKztcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVjID49IDUpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5p+l6K+i5LqM57u056CB5Ye66ZSZXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmKCFzZXJ2aWNlX3RpY2tldCkgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly90aWNrZXTojrflj5blpLHotKVcXFxcXFxcIjtcXFxcbiAgIC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FYWNoKHYgPT4ge1xcXFxuICAgICAgICAgICAgdiA9IHYuc3BsaXQoXFxcXFxcXCI9XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgaWYgKHYubGVuZ3RoIDwgMikgcmV0dXJuO1xcXFxuICAgICAgICAgICAgbGV0IGtleSA9IHYuc2hpZnQoKS50cmltKCk7XFxcXG4gICAgICAgICAgICB0aGlzLmNvb2tpZVtrZXldID0gdi5qb2luKFxcXFxcXFwiPVxcXFxcXFwiKS50cmltKCk7XFxcXG4gICAgICAgIH0pO1xcXFxuICAgIH0sXFxcXG4gICAgZ2V0KCkge1xcXFxuICAgICAgICByZXR1cm4gT2JqZWN0LmVudHJpZXModGhpcy5jb29raWUpLm1hcCh2ID0+IHZbMF0gKyBcXFxcXFxcIj1cXFxcXFxcIiArIHZbMV0pLmpvaW4oXFxcXFxcXCI7XFxcXFxcXCIpO1xcXFxuICAgIH1cXFxcbn0pO1xcXFxuLy9jb25zdCBjb29raWVNYW5hZ2UgPSBuZXcgQ29va2llTWFuYWdlKGNvb2tpZSk7XFxcXG4kLmV4cG9ydHM9Q29va2llTWFuYWdlO1xcXCJ9XVwiLFwicHJveHlcIjpcIlwifSIsInBpY1VybCI6Imh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbWVzc3kvMjcuc3ZnIiwidGl0bGUiOiLkuIDmi7PotoXkurogUzAxLVMwMitPVkHvvIjlkIjpm4bvvIkifQ==
Add Comment
Please, Sign In to add comment