Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥J 九重紫@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuWkuOWFi+WIl+ihqEFQSVwiLFwicGF0aFwiOlwiUXVhcmtTaGFyZUFwaVwiLFwicnVsZVwiOlwianM6XFxuLy9AYXV0aG9yIExveURnSWtcXG5sZXQgaHR0cFJlcXVlc3QgPSAkLnJlcXVpcmUoXFxcImh0dHBSZXF1ZXN0XFxcIik7XFxubGV0IENvb2tpZU1hbmFnZT0kLnJlcXVpcmUoXFxcIkNvb2tpZU1hbmFnZVxcXCIpO1xcbmxldCBmcm9tRHJpdmUgPSBtb2R1bGUuaW1wb3J0UGFyYW07XFxubGV0IHByLCBiYXNlVXJsLCBjb29raWU7XFxuaWYgKGZyb21Ecml2ZSA9PT0gXFxcInVjXFxcIikge1xcbiAgICBiYXNlVXJsID0gXFxcImh0dHBzOi8vcGMtYXBpLnVjLmNuXFxcIjtcXG4gICAgcHIgPSBcXFwiVUNCcm93c2VyXFxcIjtcXG4gICAgY29va2llID0gZ2V0SXRlbShcXFwidWNDb29raWVcXFwiLCBcXFwiXFxcIik7XFxufSBlbHNlIHtcXG4gICAgYmFzZVVybCA9IFxcXCJ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b24pIHtcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgI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2FzdDovL+iuvue9ruS4jeWQiOazlVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFN0cmluZyhzcGVlZFRocmVhZCkpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGlmIChmcm9tRHJpdmUgPT09IFxcXCJ1Y1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9kcml2ZS51Yy5jbi9zL1xcXCIgKyBzaGFyZUlkICsgXFxcIj9wdWJsaWM9MSMvbGlzdC9zaGFyZVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGJ1aWxkVXJsKFxcXCJodHRwczovL3Bhbi5xdWFyay5jbi9zL1xcXCIgKyBzaGFyZUlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFzc2NvZGU6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHNoYXJlSWQsIHNoYXJlUHdkLCBmcm9tRHJpdmUpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiLFxcbiAgICAgICAgcGljX3VybDog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ICAgIH1cXG4gICAgfVxcbiAgICBsZXQgbmNvb2tpZT1xdWFya1NoYXJlQXBpLmdldFBpY0Nvb2tpZSgpO1xcbiAgICBsb2cobmNvb2tpZSlcXG4gICAgbGlzdC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgLy/liKTmlq3mmK/lkKbmlofku7blpLlcXG4gICAgICAgIGlmIChpdGVtLmRpcikge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi8J+TglxcXCIgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBpdGVtLmluY2x1ZGVfaXRlbXMgKyAn6aG5ICAnLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFwiaHR0cDovLzEyMy41Ni4xMDUuMTQ1L3R1Ymlhby9tZXNzeS8yNy5zdmdcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvcXVhcmtMaXN0P3BhZ2U9ZnlwYWdlXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBmcm9tRHJpdmVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZ2V0SGVhZChpdGVtLm9ial9jYXRlZ29yeSkgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBmb3JtYXRTaXplKGl0ZW0uc2l6ZSksXFxuICAgICAgICAgICAgICAgIHBpY191cmw6ICQoaXRlbS50aHVtYm5haWwsIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZTogbmNvb2tpZVxcbiAgICAgICAgICAgICAgICB9KS5pbWFnZSgpLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoKS5sYXp5UnVsZSgoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSwgZnJvbURyaXZlKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHt9KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFwicGxheVxcXCIsIGZyb21Ecml2ZSkuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsQ2FjaGVbZmlkXSA9IHVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwgcGxheVVybENhY2hlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnksIGZyb21Ecml2ZSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIC8vaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlsaXN0ICcgKyBpdGVtLm9ial9jYXRlZ29yeVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG5cXG4gICAgfSk7XFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IGUubWVzc2FnZSxcXG4gICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcbiAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBpZiAoZS5tZXNzYWdlLmluY2x1ZGVzKFxcXCLmj5Dlj5bnoIFcXFwiKSkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIui+k+WFpeaPkOWPlueggVxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKCkuaW5wdXQoKE1ZX1BBUkFNUykgPT4ge1xcbiAgICAgICAgICAgIC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cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgYXNmaWQgPSBmaWQ7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgcGxheUNvb2tpZSA9IGNvb2tpZU1hbmFnZS5nZXQoKTtcXG4gICAgICAgIC8qaWYgKHByID09PSBcXFwiVUNCcm93c2VyXFxcIikge1xcbiAgICAgICAgICAgIHBsYXlDb29raWUgPSBjb29raWU7XFxuICAgICAgICB9Ki9cXG4gICAgICAgIGxldCBwbGF5SGVhZGVyID0ge1xcbiAgICAgICAgICAgIFJlZmVyZXI6IGhvbWVVcmwsXFxuICAgICAgICAgICAgY29va2llOiBwbGF5Q29va2llLFxcbiAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogXFxcIk1vemlsbGEvNS4wIChNYWNpbnRvc2g7IEludGVsIE1hYyBPUyBYIDEwXzE1XzcpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIFZlcnNpb24vNC4wIENocm9tZS8xMDAuMC40ODk2LjU4IFVDQnJvd3Nlci8xNi41LjguMTMwOSBNb2JpbGUgU2FmYXJpLzUzNy4zNlxcXCJcXG4gICAgICAgIH07XFxuICAgICAgICBsZXQgcGxheUhlYWRlcnMgPSBPYmplY3QuYXNzaWduKHt9LCBwbGF5SGVhZGVyLCB7XFxuICAgICAgICAgICAgXFxcIlVzZXItQWdlbnRcXFwiOiBcXFwiTG9nU3RhdGlzdGljXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBpZiAoY2F0ZWdvcnkgPT0gXFxcInZpZGVvXFxcIikge1xcbiAgICAgICAgICAgIGxldCBwbGF5TW9kZSA9IGdldEl0ZW0oXFxcInF1YXJrX3BsYXlNb2RlXFxcIiwgXFxcIui9rOeggVxcXCIpO1xcbiAgICAgICAgICAgIGlmIChwbGF5TW9kZSA9PT0gXFxcIui9rOeggVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvUmVzID0gZ2V0UHJldmlld1ZpZGVvKGFzZmlkKTtcXG5cXG4gICAgICAgICAgICAgICAgbGV0IHZpZGVvTGlzdCA9IHZpZGVvUmVzLmRhdGEudmlkZW9fbGlzdDtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW10sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbXVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB2aWRlb0xpc3QuZmlsdGVyKHYgPT4gdi5hY2Nlc3NhYmxlKS5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QubmFtZXMucHVzaCh2LnJlc29sdXRpb24pO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QudXJscy5wdXNoKHYudmlkZW9faW5mby51cmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0LmhlYWRlcnMucHVzaChwbGF5SGVhZGVycyk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBpc1NoYXJlICYmIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuXFxuICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsID0gZ2V0RG93bmxvYWRVcmwoYXNmaWQpLmRhdGFbMF0uZG93bmxvYWRfdXJsO1xcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVycy5jb29raWUgPSBjb29raWVNYW5hZ2UuZ2V0KCk7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbcGxheU1vZGVdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiICsgKHBsYXlNb2RlID09PSBcXFwi5Y6f55S7XFxcIiA/IFxcXCIjZmFzdFBsYXlNb2RlIyN0aHJlYWRzPVxcXCIgKyBnZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFxcXCIxMFxcXCIpICsgXFxcIiNcXFwiIDogXFxcIlxcXCIpXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyc11cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpc1NoYXJlICYmY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQgcGxheVVybCA9IGdldERvd25sb2FkVXJsKGFzZmlkKS5kYXRhWzBdLmRvd25sb2FkX3VybDtcXG5cXG4gICAgICAgICAgICBpc1NoYXJlICYmIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgIGlmIChjYXRlZ29yeSA9PT0gJ2F1ZGlvJykge1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXCLpn7PpopFcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcIiNpc011c2ljPXRydWUjXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBbcGxheUhlYWRlcl0sXFxuICAgICAgICAgICAgICAgICAgICBseXJpYzogXFxcIlxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgIC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biAgICAgICAgICAgICAgICBmYmEucHV0VmFyKHRpdGxlICsgXFxcIkBjb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgIH0sIDIwMCk7XFxuICAgICAgICB9LCBNWV9SVUxFLnRpdGxlLCBkdXJsKVxcbiAgICB9XFxufSk7XFxuc2V0UmVzdWx0KGQpXCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLlt6XlhbdcIixcInBhdGhcIjpcInRvb2xcIixcInJ1bGVcIjpcImpzOlxcblxcbiQuZXhwb3J0cz17XFxuICAgIGlzTG9naW5Db29raWUoY29va2llKXtcXG4gICAgICAgIC8vcmV0dXJuIHRydWU7XFxuICAgICAgICByZXR1cm4gISEoY29va2llICAmJiBjb29raWUuaW5jbHVkZXMoXFxcIl9fdWlkPVxcXCIpICYmIGNvb2tpZS5pbmNsdWRlcyhcXFwiX19wdXM9XFxcIikpO1xcbiAgICB9XFxufTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS4quS6uui0puWPt+iuvue9rlwiLFwicGF0aFwiOlwiYWNjb3VudFwiLFwicnVsZVwiOlwiJC5leHBvcnRzID0gJChbXFxcIuWkuOWFi+S6jOe7tOeggeeZu+W9lVxcXCIsIFxcXCJDb29raWXnmbvlvZVcXFwiLCBcXFwi572R6aG155m75b2VXFxcIiwgXFxcIuWkjeWItkNvb2tpZVxcXCIsIFxcXCLmuIXpmaRDb29raWVcXFwiLCBcXFwi6I635Y+W572R57uc5YWx5LqrS0tDb29raWVcXFwiLCBcXFwiVUPnvZHpobXnmbvlvZVcXFwiLCBcXFwiVUNDb29raWXnmbvlvZVcXFwiLCBcXFwi5aSN5Yi2VUNDb29raWVcXFwiLCBcXFwi5riF6ZmkVUNDb29raWVcXFwiXSkuc2VsZWN0KChpc3IpID0+IHtcXG4gICAgaWYgKGlucHV0ID09PSBcXFwi572R6aG155m75b2VXFxcIikge1xcbiAgICAgICA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7bvvIzor7fmiZPlvIDmiYDmnInmlofku7bmnYPpmZBcXFxcbua1t+mYlOiuvue9ri0+5pu05aSa5Yqf6IO9LT7lhoXpg6jmlofku7bnrqHnkIYtPuWPs+S4iuinklxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoZmV0Y2goXFxcImZpbGU6Ly9cXFwiICsgcGF0aCkpO1xcbiAgICAgICAgICAgICAgICBsZXQgY29va2llID0ganNvbi5jb29raWU7XFxuICAgICAgICAgICAgICAgIGlmICgkLnJlcXVpcmUoXFxcInRvb2xcXFwiKS5pc0xvZ2luQ29va2llKGNvb2tpZSkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0peWFseS6q+aWh+S7tuaNn+Wdj1xcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gJChcXFwi5pyq5qOA5rWL5YiwVFZCT1jnmoRDb29raWXmlofku7ZcXFxcbuivt+S9v+eUqOi/h+WQjuWGjeWwneivlVxcXCIpLmNvbmZpcm0oKCkgPT4ge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nLCBcXFwiXFxcIikpO1xcbiAgICAgICAgICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL0Nvb2tpZeagvOW8j+mUmeivr1xcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwgaXNyKTtcXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWkjeWItlVDQ29va2llXFxcIikge1xcbiAgICAgICAgbGV0IGNvb2tpZSA9IGdldEl0ZW0oXFxcInVjQ29va2llXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgaWYgKGNvb2tpZSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBjb29raWU7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mnKrnmbvlvZVcXFwiO1xcbiAgICAgICAgfVxcbiAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5riF6ZmkVUNDb29raWVcXFwiKSB7XFxuICAgICAgICBjbGVhckl0ZW0oXFxcInVjQ29va2llXFxcIik7XFxuICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pgIDlh7rnmbvlvZVcXFwiO1xcbiAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi6I635Y+W572R57uc5YWx5LqrS0tDb29raWVcXFwiKSB7XFxuICAgICAgICBsZXQgaGhkID0ge1xcbiAgICAgICAgICAgICdVc2VyLUFnZW50JzogJ0FwYWNoZS1IdHRwQ2xpZW50L1VOQVZBSUxBQkxFIChqYXZhIDEuNCknXFxuICAgICAgICB9wqBcXG4gICAgICAgIGxldCBkeGN1cmwgPSAnaHR0cDovL2FwaS52Nngud2h0LmRnd2h0LnRvcC90ZXh0LzNkZTg4ZDEwZDAxOTI5YmUvJ1xcbiAgICAgICAgbGV0IHhjZGF0YSA9IFsnYzk5ZDc0MTFjY2MyOWJjMSddXFxuICAgICAgICBsZXQgZHhjID0gW11cXG4gICAgICAgIGxldCB5c2Nvb2tpZSA9ICcnXFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHhjZGF0YS5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGxldCBkYXRhID0gZmV0Y2goZHhjdXJsICsgeGNkYXRhW2ldLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhoZFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGlmICgkLnJlcXVpcmUoXFxcInRvb2xcXFwiKS5pc0xvZ2luQ29va2llKGRhdGEpKSB7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICB5c2Nvb2tpZSA9IGRhdGEuc3BsaXQoXFxcIuKRoFxcXCIpWzFdO1xcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoeXNjb29raWUpIHtcXG4gICAgICAgICAgICBzZXRJdGVtKFxcXCJxdWFya0Nvb2tpZVxcXCIsIHlzY29va2llKTtcXG4gICAgICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0pVxcXCI7XFxuICAgICAgICB9XFxuICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpLjlhYvkuoznu7TnoIHn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zQUJBQ0tfQlROX1NUWUxFJTQwMGAsIGZhbHNlKTtcXG4gICAgICAgICAgICBsZXQgc2VydmljZV90aWNrZXQ9XFxcIlxcXCI7XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDAsIGVjID0gMDsgaSA8IDMwOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgamF2YS5sYW5nLlRocmVhZC5zbGVlcCgyMDAwKTtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0aWNrZXQgPSBKU09OLnBhcnNlKGZldGNoKGJ1aWxkVXJsKFxcXCJodHRwczovL3VvcC5xdWFyay5jbi9jYXMvYWpheC9nZXRTZXJ2aWNlVGlja2V0QnlRcmNvZGVUb2tlblxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0X2lkOmdlbmVyYXRlUmFuZG9tVVVJRCgpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsaWVudF9pZDogXFxcIjUzMlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdjogXFxcIjEuMlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9rZW46IHFjVG9rZW5cXG4gICAgICAgICAgICAgICAgICAgIH0pKSk7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyh0aWNrZXQpXFxuICAgICAgICAgICAgICAgICAgICBpZih0aWNrZXQuc3RhdHVzID09IDIwMDAwMDApe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VfdGlja2V0PXRpY2tldC5kYXRhLm1lbWJlcnMuc2VydmljZV90aWNrZXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBpZiAodGlja2V0LnN0YXR1cyA9PSA1MDAwNDAwMSkgY29udGludWU7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodGlja2V0LnN0YXR1cyA9PSA1MDAwNDAwMiB8fCBpID09PSAyOSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kuoznu7TnoIHov4fmnJ9cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICBlYysrO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVjID49IDUpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5p+l6K+i5LqM57u056CB5Ye66ZSZXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZighc2VydmljZV90aWNrZXQpIHJldHVybiBcXFwidG9hc3Q6Ly90aWNrZXTojrflj5blpLHotKVcXFwiO1xcbiAgICAgICAgICAgIGxldCByZXM9SlNPTi5wYXJzZShmZXRjaChcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY24vYWNjb3VudC9pbmZvP3N0PVxcXCIrc2VydmljZV90aWNrZXQrXFxcIiZsdz1zY2FuXFxcIiwge1xcbiAgICAgICAgICAgICAgICB3aXRoSGVhZGVyczp0cnVlXFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgIC8vbG9nKHJlcylcXG4gICAgICAgICAgICBpZighSlNPTi5wYXJzZShyZXMuYm9keSkuc3VjY2VzcykgcmV0dXJuIFxcXCJ0b2FzdDovL3RpY2tldOmqjOivgeWksei0pVxcXCI7XFxuICAgICAgICAgICAgbGV0IGNvb2tpZT1cXFwiXFxcIjtcXG4gICAgICAgICAgICBsZXQgaGVhZGVycz1yZXMuaGVhZGVycztcXG4gICAgICAgICAgICBmb3IgKGxldCBjIG9mIGhlYWRlcnNbXFxcInNldC1jb29raWVcXFwiXSl7XFxuICAgICAgICAgICAgICAgIGNvb2tpZSs9Yy5z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S8xNC5wbmdcXFwiIDogXFxcImhpa2VyOi8vaW1hZ2VzL2ljb25fa3Vha2VcXFwiLFxcbiAgICAgICAgdXJsOiAkKFxcXCLngrnlh7vlip/og73mjInpkq49PuS4quS6uui0puWPt+euoeeQhuWNs+WPr+eZu+W9lei0puWPt1xcXCIpLmNvbmZpcm0oKCkgPT4ge30pLFxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBzdHlsZSxcXG4gICAgICAgIHVybDogJChzdHlsZXMsIDEsICfor7fpgInmi6knKS5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgIHNldEl0ZW0oJ3N0eWxlJywgaW5wdXQpO1xcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9pY29uLnN2Z1xcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZ2V0SXRlbShcXFwic29ydEtleVxcXCIsIFxcXCLlkI3np7DmraPluo9cXFwiKSxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhzb3J0KSwgMSwgJ+ivt+mAieaLqScpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgc2V0SXRlbShcXFwic29ydEtleVxcXCIsIGlucHV0KVxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9zb3J0LnN2Z1xcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZ2V0SXRlbShcXFwicXVhcmtfcGxheU1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ICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi5Liq5Lq66LSm5Y+3566h55CGXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJC5yZXF1aXJlKFxcXCJhY2NvdW50XFxcIik7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWOn+eUu+S4i+i9vee6v+eoi1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoZ2V0SXRlbShcXFwic3BlZWRUaHJlYWRcXFwiLCBcXFwiMTBcXFwiKSwgXFxcIuivt+i+k+WFpTMtMzLkuYvpl7TnmoTmlbTmlbBcXFwiKS5pbnB1dCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgc3BlZWRUaHJlYWQgPSBwYXJzZUludChpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoc3BlZWRUaHJlYWQgPCAzIHx8IHNwZWVkVGhyZWFkID4gMzIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5LiN5ZCI5rOVXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInNwZWVkVGhyZWFkXFxcIiwgU3RyaW5nKHNwZWVkVGhyZWFkKSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWkjeWItuWIhuS6q+mTvuaOpVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGZyb21Ecml2ZSA9PT0gXFxcInVjXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGJ1aWxkVXJsKFxcXCJodHRwczovL2RyaXZlLn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czovL2hpa2VyZmFucy5jb20vdHViaWFvL21lc3N5LzI3LnN2Z1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9xdWFya0xpc3Q/cGFnZT1meXBhZ2VcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVRva2VuOiBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGZyb21Ecml2ZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGZvcm1hdFNpemUoaXRlbS5zaXplKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogJChpdGVtLnRodW1ibmFpbCwge1xcbiAgICAgICAgICAgICAgICAgICAgY29va2llOiBuY29va2llXFxuICAgICAgICAgICAgICAgIH0pLmltYWdlKCksXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5LCBmcm9tRHJpdmUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwge30pO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXlVcmxDYWNoZVtmaWRdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJC5yZXF1aXJlKFxcXCJwbGF5XFxcIiwgZnJvbURyaXZlKS5nZXRQbGF5VXJsKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlVcmxDYWNoZVtmaWRdID0gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJwbGF5VXJsQ2FjaGVcXFwiLCBwbGF5VXJsQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmw7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0uZmlkLCBpdGVtLnNoYXJlX2ZpZF90b2tlbiwgc2hhcmVJZCwgcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLCBpdGVtLm9ial9jYXRlZ29yeSwgZnJvbURyaXZlKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheWxpc3QgJyArIGl0ZW0ub2JqX2NhdGVnb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IH1cXFxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdHJ5UmVzdWx0ID0gdGhpcy5lcnJvckNhbGxiYWNrV2l0aFJldHJ5KGVyciwgcmVzLCB0aGlzKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAodHJ5UmVzdWx0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdGFydCh0b0pzb24pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuZXJyb3JDYWxsYmFjayhlcnIsIHJlcyk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHNldE9wdGlvbnMob3B0aW9ucykge1xcXFxuICAgICAgICB0aGlzLm9wdGlvbnMgPSBPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zLCB7XFxcXG4gICAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZVxcXFxuICAgICAgICB9KTtcXFxcbiAgICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgfSxcXFxcbiAgICBtZXJnZUhlYWRBbmRCb2R5KG9wdGlvbnMpIHtcXFxcbiAgICAgICAgb3B0aW9ucyA9IG9wdGlvbnMgfHwge307XFxcXG4gICAgICAgIE9iamVjdC5hc3NpZ24odGhpcy5vcHRpb25zLmhlYWRlcnN8fHt9LCBvcHRpb25zLmhlYWRlcnMpO1x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LbliIbkuqvpk77mjqVcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIGlmIChmcm9tRHJpdmUgPT09IFxcXFxcXFwidWNcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJjb3B5Oi8vXFxcXFxcXCIgKyBidWlsZFVybChcXFxcXFxcImh0dHBzOi8vZHJpdmUudWMuY24vcy9cXFxcXFxcIiArIHNoYXJlSWQgKyBcXFxcXFxcIj9wdWJsaWM9MSMvbGlzdC9zaGFyZVxcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiY29weTovL1xcXFxcXFwiICsgYnVpbGRVcmwoXFxcXFxcXCJodHRwczovL3Bhbi5xdWFyay5jbi9zL1xcXFxcXFwiICsgc2hhcmVJZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFzc2NvZGU6IHNoYXJlUHdkXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwgc2hhcmVJZCwgc2hhcmVQd2QsIGZyb21Ecml2ZSksXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImljb25fNVxcXFxcXFwiLFxcXFxuICAgICAgICBwaWNfdXJsOiBcXFxcXFxcImh0dHA6Ly8xMjMuNTYuMTA1LjE0NS9pbWcvYWxpX2ZpbGVpbnRvLnN2Z1xcXFxcXFwiLFxcXFxuICAgIH0pO1xcXFxuICAgIGQucHVzaCh7XFxcXG4gICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXFxcbiAgICB9KTtcXFxcbn1cXFxcblxcXFxuX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BhZ2VUaXRsZShyZXMuZGF0YS5zaGFyZS50aXRsZSk7XFxcXG4gICAgICAgICAgICB2YXIgbGlzdCA9IHJlcy5kYXRhLmxpc3QgfHwgW107XFxcXG4gICAgICAgIH1cXFxcbiAgICB9XFxcXG4gICAgbGV0IG5jb29raWU9cXVhcmtTaGFyZUFwaS5nZXRQaWNDb29raWUoKTtcXFxcbiAgICBsb2cobmNvb2tpZSlcXFxcbiAgICBsaXN0LmZvckVhY2goaXRlbSA9PiB7XFxcXG4gICAgICAgIC8v5Yik5pat5piv5ZCm5paH5Lu25aS5XFxcXG4gICAgICAgIGlmIChpdGVtLmRpcikge1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLwn5OCXFxcXFxcXCIgKyBpdGVtLmZpbGVfbmFtZSxcXFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGl0ZW0uaW5jbHVkZV9pdGVtcyArICfpobkgICcsXFxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogXFxcXFxcXCJodHRwOi8vMTIzLjU2LjEwNS4xNDUvdHViaWFvL21lc3N5LzI3LnN2Z1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL3BhZ2UvcXVhcmtMaXN0P3BhZ2U9ZnlwYWdlXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkLFxcXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVRva2VuOiBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogaXRlbS5maWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxcXG4gICAgICAgICAgICAgICAgICAgIGZyb21Ecml2ZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogZ2V0SGVhZChpdGVtLm9ial9jYXRlZ29yeSkgKyBpdGVtLmZpbGVfbmFtZSxcXFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGZvcm1hdFNpemUoaXRlbS5zaXplKSxcXFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiAkKGl0ZW0udGh1bWJuYWlsLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvb2tpZTogbmNvb2tpZVxcXFxuICAgICAgICAgICAgICAgIH0pLmltYWdlKCksXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnksIGZyb21Ecml2ZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcXFxcXCJwbGF5VXJsQ2FjaGVcXFxcXFxcIiwge30pO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAocGxheVVybENhY2hlW2ZpZF0pIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSAkL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mFzc2lnbih7fSwgcGxheUhlYWRlciwge1xcXFxuICAgICAgICAgICAgXFxcXFxcXCJVc2VyLUFnZW50XFxcXFxcXCI6IFxcXFxcXFwiTG9nU3RhdGlzdGljXFxcXFxcXCJcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIGlmIChjYXRlZ29yeSA9PSBcXFxcXFxcInZpZGVvXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgIGxldCBwbGF5TW9kZSA9IGdldEl0ZW0oXFxcXFxcXCJxdWFya19wbGF5TW9kZVxcXFxcXFwiLCBcXFxcXFxcIui9rOeggVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgIGlmIChwbGF5TW9kZSA9PT0gXFxcXFxcXCLovaznoIFcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIGxldCB2aWRlb1JlcyA9IGdldFByZXZpZXdWaWRlbyhhc2ZpZCk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9MaXN0ID0gdmlkZW9SZXMuZGF0YS52aWRlb19saXN0O1xcXFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtdLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW11cXFxcbiAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgICAgIHZpZGVvTGlzdC5maWx0ZXIodiA9PiB2LmFjY2Vzc2FibGUpLmZvckVhY2godiA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlMaXN0Lm5hbWVzLnB1c2godi5yZXNvbHV0aW9uKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QudXJscy5wdXNoKHYudmlkZW9faW5mby51cmwgKyBcXFxcXFxcIiNpc1ZpZGVvPXRydWUjXFxcXFxcXCIpO1xcXFxuICAgICAgICAgIC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pZnkocGxheUxpc3QpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxcXG5cXFxcbiAgICAgICAgICAgIGlzU2hhcmUgJiYgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxcXG4gICAgICAgICAgICBpZiAoY2F0ZWdvcnkgPT09ICdhdWRpbycpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcXFxcXCLpn7PpopFcXFxcXFxcIl0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcXFxcXCIjaXNNdXNpYz10cnVlI1xcXFxcXFwiXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJdLFxcXFxuICAgICAgICAgICAgICAgICAgICBseXJpYzogXFxcXFxcXCJcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChjYXRlZ29yeSA9PT0gJ2ltYWdlJykge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiAkKHBsYXlVcmwsIHBsYXlIZWFkZXIpLmltYWdlKCk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHBsYXlIZWFkZXIgPSBPYmplY3Qua2V5cyhwbGF5SGVhZGVyKS5tYXAoa2V5ID0+IGtleSArIFxcXFxcXFwiQFxcXFxcXFwiICsgU3RyaW5nKHBsYXlIZWFkZXJba2V5XSkucmVwbGFjZSgvOy9nLCBcXFxcXFxcIu+8m++8m1xc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ICBpZiAoJC5yZXF1aXJlKFxcXFxcXFwidG9vbFxcXFxcXFwiKS5pc0xvZ2luQ29va2llKGNvb2tpZSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInF1YXJrQ29va2llXFxcXFxcXCIsIGNvb2tpZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIuacquajgOa1i+WIsFRWQk9Y55qEQ29va2ll5paH5Lu2XFxcXFxcXFxu6K+35L2/55So6L+H5ZCO5YaN5bCd6K+VXFxcXFxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLlpI3liLZDb29raWVcXFxcXFxcIikge1xcXFxuICAgICAgICBsZXQgY29va2llID0gZ2V0SXRlbShcXFxcXFxcInF1YXJrQ29va2llXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICBpZiAoY29va2llKSB7XFxcXG4gICAgICAgICAgICBy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Y1Rva2VuXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHRpY2tldClcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYodGlja2V0LnN0YXR1cyA9PSAyMDAwMDAwKXtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlcnZpY2VfdGlja2V0PXRpY2tldC5kYXRhLm1lbWJlcnMuc2VydmljZV90aWNrZXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAodGlja2V0LnN0YXR1cyA9PSA1MDAwNDAwMSkgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aWNrZXQuc3RhdHVzID09IDUwMDA0MDAyIHx8IGkgPT09IDI5KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+S6jOe7tOeggei/h+acn1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBlYysrO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoZWMgPj0gNSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mn6Xor6Lkuoznu7TnoIHlh7rplJlcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYoIXNlcnZpY2VfdGlja2V0KSByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL3RpY2tldOiOt+WPluWksei0pVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgbGV0IHJlcz1KU09OLnBhcnNl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cXG4gICAgICAgICAgICB2ID0gdi5zcGxpdChcXFxcXFxcIj1cXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBpZiAodi5sZW5ndGggPCAyKSByZXR1cm47XFxcXG4gICAgICAgICAgICBsZXQga2V5ID0gdi5zaGlmdCgpLnRyaW0oKTtcXFxcbiAgICAgICAgICAgIHRoaXMuY29va2llW2tleV0gPSB2LmpvaW4oXFxcXFxcXCI9XFxcXFxcXCIpLnRyaW0oKTtcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfSxcXFxcbiAgICBnZXQoKSB7XFxcXG4gICAgICAgIHJldHVybiBPYmplY3QuZW50cmllcyh0aGlzLmNvb2tpZSkubWFwKHYgPT4gdlswXSArIFxcXFxcXFwiPVxcXFxcXFwiICsgdlsxXSkuam9pbihcXFxcXFxcIjtcXFxcXFxcIik7XFxcXG4gICAgfVxcXFxufSk7XFxcXG4vL2NvbnN0IGNvb2tpZU1hbmFnZSA9IG5ldyBDb29raWVNYW5hZ2UoY29va2llKTtcXFxcbiQuZXhwb3J0cz1Db29raWVNYW5hZ2U7XFxcIn1dXCIsXCJwcm94eVwiOlwiXCJ9IiwicGljVXJsIjoiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8yNy5zdmciLCJ0aXRsZSI6Ikog5Lmd6YeN57SrIn0=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement