Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@Quark.简@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiUXVhcmsu566AIiwiYXV0aG9yIjoiQExveURnSWsiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyMiLCJ2ZXJzaW9uIjoyNywiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxubGV0IGQgPSBbXTtcblxubGV0IGNvb2tpZSA9IGdldEl0ZW0oXCJxdWFya0Nvb2tpZVwiLCBcIlwiKTtcblxuaWYgKCEkLnJlcXVpcmUoXCJ0b29sXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xuICAgIGNsZWFySXRlbShcInF1YXJrQ29va2llXCIpO1xuICAgIGQucHVzaCh7XG4gICAgICAgIHRpdGxlOiAnPGZvbnQgY29sb3I9XCIjMTNCNjFCXCI+4paQIDwvZm9udD48Yj7muKnppqjmj5DnpLo8Yj4nLFxuICAgICAgICBjb2xfdHlwZTogXCJyaWNoX3RleHRcIixcbiAgICB9KTtcbiAgICBkLnB1c2goe1xuICAgICAgICB1cmw6ICQucmVxdWlyZShcImFjY291bnRcIiwgdHJ1ZSksXG4gICAgICAgIGNvbF90eXBlOiBcInRleHRfMVwiLFxuICAgICAgICB0aXRsZTogXCLmnKrmo4DmtYvliLDnmbvlvZXkv6Hmga/vvIzngrnmiJHot7PovaznmbvlvZXotKblj7fpobXpnaLvvIzojrflj5ZRdWFyayBDb29raWXlkI7mlrnlj6/kvb/nlKhcIixcbiAgICAgICAgZXh0cmE6IHtc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51cmwsIG9wdGlvbnMpKTtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgaWYgKHJlcy5zdGF0dXNDb2RlID49IDIwMCAmJiByZXMuc3RhdHVzQ29kZSA8PSAzMDApIHtcXG4gICAgICAgICAgICAgICAgbGV0IGJvZHkgPSByZXMuYm9keTtcXG4gICAgICAgICAgICAgICAgaWYgKHRvSnNvbikge1xcbiAgICAgICAgICAgICAgICAgICAgYm9keSA9IEpTT04ucGFyc2UoYm9keSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3VjY2Vzc0NhbGxiYWNrKGJvZHksIHJlcyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFN0cmluZyhyZXMuc3RhdHVzQ29kZSkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGVycikge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGVyciA9IHRoaXMuZXJyb3JUeXBlQ2FsbGJhY2soZXJyLCByZXMpO1xcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRoaXMucmV0cnlDb3VudCkge1xcbiAgICAgICAgICAgICAgICBsZXQgdHJ5UmVzdWx0ID0gdGhpcy5lcnJvckNhbGxiYWNrV2l0aFJldHJ5KGVyciwgcmVzLCB0aGlzKTtcXG4gICAgICAgICAgICAgICAgaWYgKHRyeVJlc3VsdCkge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXRyeUNvdW50LS07XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdGFydCh0b0pzb24pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXRyeUNvdW50ID0gMDtcXG4gICAgICA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gIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9pY29uLnN2Z1xcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZ2V0SXRlbShcXFwic29ydEtleVxcXCIsIFxcXCLlkI3np7DmraPluo9cXFwiKSxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhzb3J0KSwgMSwgJ+ivt+mAieaLqScpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgc2V0SXRlbShcXFwic29ydEtleVxcXCIsIGlucHV0KVxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9zb3J0LnN2Z1xcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZ2V0SXRlbShcXFwicXVhcmtfcGxheU1vZGVcXFwiLCBcXFwi6L2s56CBXFxcIiksXFxuICAgICAgICB1cmw6ICQoW1xcXCLovaznoIFcXFwiLCBcXFwi5Y6f55S7XFxcIiwgXFxcIuaZrumAmuWOn+eUu1xcXCJdLCAyLCBcXFwi5pKt5pS+5qih5byPXFxcIikuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICBzZXRJdGVtKFxcXCJxdWFya19wbGF5TW9kZVxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liIfmjaLmiJDlip9cXFwiO1xcbiAgICAgICAgfSksXFxuICAgICAgICBjb2xfdHlwZTogXF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gICAgICAgICBsZXQgc3BlZWRUaHJlYWQgPSBwYXJzZUludChpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoc3BlZWRUaHJlYWQgPCAzIHx8IHNwZWVkVGhyZWFkID4gMzIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5LiN5ZCI5rOVXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInNwZWVkVGhyZWFkXFxcIiwgU3RyaW5nKHNwZWVkVGhyZWFkKSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWkjeWItuWIhuS6q+mTvuaOpVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGZyb21Ecml2ZSA9PT0gXFxcInVjXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGJ1aWxkVXJsKFxcXCJodHRwczovL2RyaXZlLnVjLmNuL3MvXFxcIiArIHNoYXJlSWQgKyBcXFwiP3B1YmxpYz0xIy9saXN0L3NoYXJlXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBzaGFyZVB3ZFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImNvcHk6Ly9cXFwiICsgYnVpbGRVcmwoXFxcImh0dHBzOi8vcGFuLnF1YXJrLmNuL3MvXFxcIiArIHNoYXJlSWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXNzY29kZTogc2hhcmVQd2RcXG4gICAgICAgICAg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dGEuc2hhcmUuZmlyc3RfZmlkLCBNWV9QQUdFLCBzb3J0VmFsdWUpO1xcbiAgICAgICAgICAgIHNldFBhZ2VUaXRsZShyZXMuZGF0YS5zaGFyZS50aXRsZSk7XFxuICAgICAgICAgICAgdmFyIGxpc3QgPSByZXMuZGF0YS5saXN0IHx8IFtdO1xcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGxldCBuY29va2llPXF1YXJrU2hhcmVBcGkuZ2V0UGljQ29va2llKCk7XFxuICAgIGxvZyhuY29va2llKVxcbiAgICBsaXN0LmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAvL+WIpOaWreaYr+WQpuaWh+S7tuWkuVxcbiAgICAgICAgaWYgKGl0ZW0uZGlyKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLwn5OCXFxcIiArIGl0ZW0uZmlsZV9uYW1lLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGl0ZW0uaW5jbHVkZV9pdGVtcyArICfpobkgICcsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21lc3N5LzI3LnN2Z1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9xdWFya0xpc3Q/cGFnZT1meXBhZ2VcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVRva2VuOiBxdWFya1NoYXJlQXBpLmdldFRva2VuKCksXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgaW5oZXJpdFRpdGxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgIGZyb21Ecml2ZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKGl0ZW0ub2JqX2NhdGVnb3J5KSArIGl0ZW0uZmlsZV9uYW1lLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAkLmRhdGVGb3JtYXQoaXRlbS51cGRhdGVkX2F0LCAneXl5eS1NTS1kZCcpICsgJyAgJyArIGZvcm1hdFNpemUoaXRlbS5zaXplKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogJChpdGVtLnRodW1ibmFpbCwge1xcbiAgICAgICAgICAgICAgICAgICAgY29va2llOiBuY29va2llXFxuICAgICAgICAgICAgICAgIH0pLmltYWdlKCksXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmxhenlSdWxlKChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5LCBmcm9tRHJpdmUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsQ2FjaGUgPSBzdG9yYWdlMC5nZXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwge30pO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBsYXlVcmxDYWNoZVtmaWRdKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsYXlVcmxDYWNoZVtmaWRdO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gJC5yZXF1aXJlKFxcXCJwbGF5XFxcIiwgZnJvbURyaXZlKS5nZXRQbGF5VXJsKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlVcmxDYWNoZVtmaWRdID0gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJwbGF5VXJsQ2FjaGVcXFwiLCBwbGF5VXJsQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmw7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0uZmlkLCBpdGVtLnNoYXJlX2ZpZF90b2tlbiwgc2hhcmVJZCwgcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLCBpdGVtLm9ial9jYXRlZ29yeSwgZnJvbURyaXZlKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uZmlkLFxcbiAgICAgICAgICAgICAgICAgICAgLy9pbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheWxpc3QgJyArIGl0ZW0ub2JqX2NhdGVnb3J5XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcblxcbiAgICB9KTtcXG59IGNhdGNoIChlKSB7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZS5tZXNzYWdlLFxcbiAgICAgICAgdXJsOiAnaGlrZXI6Ly9lbXB0eScsXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGlmIChlLm1lc3NhZ2UuaW5jbHVkZXMoXFxcIuaPkOWPlueggVxc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gICAgICAgICAgbGV0IHBsYXlNb2RlID0gZ2V0SXRlbShcXFwicXVhcmtfcGxheU1vZGVcXFwiLCBcXFwi6L2s56CBXFxcIik7XFxuICAgICAgICAgICAgaWYgKHBsYXlNb2RlID09PSBcXFwi6L2s56CBXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9SZXMgPSBnZXRQcmV2aWV3VmlkZW8oYXNmaWQpO1xcblxcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9MaXN0ID0gdmlkZW9SZXMuZGF0YS52aWRlb19saXN0O1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW10sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtdXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHZpZGVvTGlzdC5maWx0ZXIodiA9PiB2LmFjY2Vzc2FibGUpLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC5uYW1lcy5wdXNoKHYucmVzb2x1dGlvbik7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC51cmxzLnB1c2godi52aWRlb19pbmZvLnVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QuaGVhZGVycy5wdXNoKHBsYXlIZWFkZXJzKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGlzU2hhcmUgJiYgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG5cXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxuICAgICAgICAgICAgICAgIHBsYXlIZWFkZXJzLmNvb2tpZSA9IGNvb2tpZU1hbmFnZS5nZXQoKTtcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtwbGF5TW9kZV0sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCIgKyAocGxheU1vZGUgPT09IFxcXCLljp/nlLtcXFwiID8gXFxcIiNmYXN0UGxheU1vZGUjI3RocmVhZHM9XFxcIiArIGdldEl0ZW0oXFxcInNwZWVkVGhyZWFkXFxcIiwgXFxcIjEwXFxcIikgKyBcXFwiI1xcXCIgOiBcXFwiXFxcIildLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJzXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlzU2hhcmUgJiZjcmVhdGVEZWxldGVUYXNrKGFzZmlkKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxldCBwbGF5VXJsID0gZ2V0RG93bmxvYWRVcmwoYXNmaWQpLmRhdGFbMF0uZG93bmxvYWRfdXJsO1xcblxcbiAgICAgICAgICAgIGlzU2hhcmUgJiYgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5ID09PSAnYXVkaW8nKSB7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcIumfs+mikVxcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwi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gICAgICBpZihmcm9tPT09XFxcInVjXFxcIil7XFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInVjQ29va2llXFxcIiwgY29va2llKTtcXG4gICAgICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwicXVhcmtDb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+eZu+W9leaIkOWKn1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pyq55m75b2VXFxcIjtcXG4gICAgfSwgZnJvbSksXFxuICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ08c21hbGw+54K55Ye75aS05YOP5Y+v5Lul6YCA5Ye66LSm5Y+36YeN5paw55m75b2VPC9zbWFsbD5cXFwiLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiXFxufSk7XFxuZC5wdXNoKHtcXG4gICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIlxcbn0pO1xcbmxldCBkdXJsPWZyb209PT1cXFwidWNcXFwiP1xcXCJodHRwczovL2RyaXZlLnVjLmNuXFxcIjpcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY25cXFwiO1xcbmQucHVzaCh7XFxuICAgIGNvbF90eXBlOiBcXFwieDVfd2Vidmlld19zaW5nbGVcXFwiLFxcbiAgICB1cmw6IGR1cmwsXFxuICAgIGRlc2M6IFxcXCJsaXN0JiZzY3JlZW4tMTUwXFxcIixcXG4gICAgZXh0cmE6IHtcXG4gICAgICAgIHVhOiBQQ19VQSxcXG4gICAgICAgIGpzOiAkLnRvU3RyaW5nKCh0aXRsZSwgZHVybCkgPT4ge1xcbiAgICAgICAgICAgIGxldCBjb29raWUgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICBzZXRJbnRlcnZhbCg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b2tpZVxcXCJdKS5zZWxlY3QoKGlzcikgPT4ge1xcbiAgICBpZiAoaW5wdXQgPT09IFxcXCLnvZHpobXnmbvlvZVcXFwiKSB7XFxuICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9sb2dpbiNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiO1xcbiAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwiQ29va2ll55m75b2VXFxcIikge1xcbiAgICAgICAgcmV0dXJuICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaVDb29raWVcXFwiKS5pbnB1dCgoaXNyKSA9PiB7XFxuICAgICAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoaW5wdXQpKSB7XFxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgaW5wdXQucmVwbGFjZSgvXFxcXHMvZywgXFxcIlxcXCIpKTtcXG4gICAgICAgICAgICAgICAgaXNyICYmIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9Db29raWXmoLzlvI/plJnor69cXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGlzcik7XFxuICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLku45UVkJPWOiOt+WPlkNvb2tpZVxcXCIpIHtcXG4gICAgICAgIGxldCBwYXRoID0gXFxcIi9zdG9yYWdlL2VtdWxhdGVkLzAvVFYvLnF1YXJrX3VzZXJcXFwiO1xcbiAgICAgICAgaWYgKGZpbGVFeGlzdChcXFwiZmlsZTovL1xcXCIgKyBwYXRoKSkge1xcbiAgICAgICAgICAgIGlmICghbmV3IGphdmEuaW8uRmlsZShwYXRoKS5jYW5SZWFkKCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuayoeacieadg+mZkOivu+WPlkNvb2tpZeaWh+S7tu+8jOivt+aJk+W8gOaJgOacieaWh+S7tuadg+mZkFxcXFxu5rW36ZiU6K6+572uLT7mm7TlpJrlip/og70tPuWGhemDqOaWh+S7tueuoeeQhi0+5Y+z5LiK6KeSXFxcIikuY29uZmlybSgoKSA9PiB7fSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShmZXRjaChcXFwiZmlsZTovL1xcXCIgKyBwYXRoKSk7XFxuICAgICAgICAgICAgICAgIGxldCBjb29raWUgPSBqc29uLmNvb2tpZTtcXG4gICAgICAgICAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwicXVhcmtDb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgICAgICAgICAgaXNyICYmIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9Db29raWXmoLzlvI/plJnor69cXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiAkKFxcXCLmnKrmo4DmtYvliLBUVkJPWOe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lbnQnOiAnQXBhY2hlLUh0dHBDbGllbnQvVU5BVkFJTEFCTEUgKGphdmEgMS40KSdcXG4gICAgICAgIH3CoFxcbiAgICAgICAgbGV0IGR4Y3VybCA9ICdodHRwOi8vYXBpLnY2eC53aHQuZGd3aHQudG9wL3RleHQvM2RlODhkMTBkMDE5MjliZS8nXFxuICAgICAgICBsZXQgeGNkYXRhID0gWydjOTlkNzQxMWNjYzI5YmMxJ11cXG4gICAgICAgIGxldCBkeGMgPSBbXVxcbiAgICAgICAgbGV0IHlzY29va2llID0gJydcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgeGNkYXRhLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgbGV0IGRhdGEgPSBmZXRjaChkeGN1cmwgKyB4Y2RhdGFbaV0sIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczogaGhkXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoZGF0YSkpIHtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIHlzY29va2llID0gZGF0YS5zcGxpdChcXFwi4pGgXFxcIilbMV07XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGlmICh5c2Nvb2tpZSkge1xcbiAgICAgICAgICAgIHNldEl0ZW0oXFxcInF1YXJrQ29va2llXFxcIiwgeXNjb29raWUpO1xcbiAgICAgICAgICAgIGlzciAmJiByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/orr7nva7miJDlip9cXFwiO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSlXFx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RyPVMlM0FjdXN0b20lN0NPUFQlM0FTQVJFQSU0MDAlN0NPUFQlM0FJTU1FUlNJVkUlNDAxJTdDT1BUJTNBQkFDS19CVE5fU1RZTEUlNDAwYCwgZmFsc2UpO1xcbiAgICAgICAgICAgIGxldCBzZXJ2aWNlX3RpY2tldD1cXFwiXFxcIjtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMCwgZWMgPSAwOyBpIDwgMzA7IGkrKykge1xcbiAgICAgICAgICAgICAgICBqYXZhLmxhbmcuVGhyZWFkLnNsZWVwKDIwMDApO1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRpY2tldCA9IEpTT04ucGFyc2UoZmV0Y2goYnVpbGRVcmwoXFxcImh0dHBzOi8vdW9wLnF1YXJrLmNuL2Nhcy9hamF4L2dldFNlcnZpY2VUaWNrZXRCeVFyY29kZVRva2VuXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3RfaWQ6Z2VuZXJhdGVSYW5kb21VVUlEKCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xpZW50X2lkOiBcXFwiNTMyXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICB2OiBcXFwiMS4yXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICB0b2tlbjogcWNUb2tlblxcbiAgICAgICAgICAgICAgICAgICAgfSkpKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHRpY2tldClcXG4gICAgICAgICAgICAgICAgICAgIGlmKHRpY2tldC5zdGF0dXMgPT0gMjAwMDAwMCl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2VydmljZV90aWNrZXQ9dGlja2V0LmRhdGEubWVtYmVycy5zZXJ2aWNlX3RpY2tldDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aWNrZXQuc3RhdHVzID09IDUwMDA0MDAxKSBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh0aWNrZXQuc3RhdHVzID09IDUwMDA0MDAyIHx8IGkgPT09IDI5KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S6jOe7tOeggei/h+acn1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGVjKys7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoZWMgPj0gNSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mn6Xor6Lkuoznu7TnoIHlh7rplJlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmKCFzZXJ2aWNlX3RpY2tldCkgcmV0dXJuIFxcXCJ0b2FzdDovL3RpY2tldOiOt+WPluWksei0pVxcXCI7XFxuICAgICAgICAgICAgbGV0IHJlcz1KU09OLnBhcnNlKGZldGNoKFxcXCJodHRwczovL3Bhbi5xdWFyay5jbi9hY2NvdW50L2luZm8/c3Q9XFxcIitzZXJ2aWNlX3RpY2tldCtcXFwiJmx3PXNjYW5cXFwiLCB7XFxuICAgICAgICAgICAgICAgIHdpdGhIZWFkZXJzOnRydWVcXG4gICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgLy9sb2cocmVzKVxcbiAgICAgICAgICAgIGlmKCFKU09OLnBhcnNlKHJlcy5ib2R5KS5zdWNjZXNzKSByZXR1cm4gXFxcInRvYXN0Oi8vdGlja2V06aqM6K+B5aSx6LSlXFxcIjtcXG4gICAgICAgICAgICBsZXQgY29va2llPVxcXCJcXFwiO1xcbiAgICAgICAgICAgIGxldCBoZWFkZXJzPXJlcy5oZWFkZXJzO1xcbiAg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2lnbihDb29raWVNYW5hZ2UucHJvdG90eXBlLCB7XFxuICAgIGFkZChjb29raWUpIHtcXG4gICAgICAgIGxldCBjb29raWVzID0gW107XFxuICAgICAgICBpZiAodHlwZW9mIGNvb2tpZSA9PT0gXFxcInN0cmluZ1xcXCIpIHtcXG4gICAgICAgICAgICBjb29raWVzID0gY29va2llLnNwbGl0KFxcXCI7XFxcIik7XFxuICAgICAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoY29va2llKSkge1xcbiAgICAgICAgICAgIGNvb2tpZXMgPSBjb29raWU7XFxuICAgICAgICB9XFxuICAgICAgICBjb29raWVzLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgdiA9IHYuc3BsaXQoXFxcIj1cXFwiKTtcXG4gICAgICAgICAgICBpZiAodi5sZW5ndGggPCAyKSByZXR1cm47XFxuICAgICAgICAgICAgbGV0IGtleSA9IHYuc2hpZnQoKS50cmltKCk7XFxuICAgICAgICAgICAgdGhpcy5jb29raWVba2V5XSA9IHYuam9pbihcXFwiPVxcXCIpLnRyaW0oKTtcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbiAgICBnZXQoKSB7XFxuICAgICAgICByZXR1cm4gT2JqZWN0LmVudHJpZXModGhpcy5jb29raWUpLm1hcCh2ID0+IHZbMF0gKyBcXFwiPVxcXCIgKyB2WzFdKS5qb2luKFxcXCI7XFxcIik7XFxuICAgIH1cXG59KTtcXG4vL2NvbnN0IGNvb2tpZU1hbmFnZSA9IG5ldyBDb29raWVNYW5hZ2UoY29va2llKTtcXG4kLmV4cG9ydHM9Q29va2llTWFuYWdlO1wifV0iLCJpY29uIjoiaGlrZXI6Ly9pbWFnZXMvaWNvbl9rdWFrZSIsInByb3h5IjoiIn0=
Add Comment
Please, Sign In to add comment