Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@𝐅𝐚𝐧•仓@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi8J2QhfCdkJrwnZCn4oCi5LuTIiwiYXV0aG9yIjoiUiIsInVybCI6Imhpa2VyOi8vZW1wdHkjI2Z5cGFnZSIsInZlcnNpb24iOjIwMjQwNTA3LCJjb2xfdHlwZSI6Im1vdmllXzIiLCJjbGFzc19uYW1lIjoiIiwidHlwZSI6InZpZGVvIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6XG52YXIgZCA9IFtdO1xuXG5hZGRMaXN0ZW5lcihcIm9uQ2xvc2VcIiwgJC50b1N0cmluZygoKSA9PiB7XG4gICAgbGV0IGtleXMgPSBsaXN0TXlWYXJLZXlzKCk7XG4gICAgZm9yIChsZXQgaXQgb2Yga2V5cykge1xuICAgICAgICBjbGVhck15VmFyKGl0KTtcbiAgICB9XG4gICAgY2xlYXJJdGVtKCdub3cnKVxufSkpO1xuXG52YXIgaG9zdCA9IGNvbmZpZy5ob3N0O1xuLypcbmlmIChNWV9QQUdFID09IDEpIHtcbiAgICBkLnB1c2goe1xuICAgIHRpdGxlOiAn55Wqwrfku5NfX19fX19fX+mjjuWQueiKsea1t+i9u+iInu+8jOmGieWNp+eVquS7k+aipuS5oeOAgicsXG4gICAgdXJsOiAnaGlrZXI6Ly9wYWdlL3Nob3U/dXJsPScgKyBob3N0LFxuICAgIHBpY191cmw6IFwiaHR0cHM6Ly9pbWcudmludWEuY24vaW1hZ2VzL0l2NjNWLnBuZ1wiLFxuICAgIGNvbF90eXBlOiAnYXZhdGFyJ1xufSk7XG59XG4qL1xudmFyIGd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F+JyArIGsgKyAn55qE5pWw5a2XJ1xyXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgIGlmKC9mb3J1bVxcLVxcZCtcXC1cXGQrLy50ZXN0KHRydWVfdXJsKSl7XG52YXIgdXJsID0gdHJ1ZV91cmwucmVwbGFjZSgvXFxkK1xcLmh0bS8sIHRvUGFnZSArICcuaHRtJyk7XG4gICAgICAgICAgICAgIH1lbHNle1xudmFyIHVybCA9IHRydWVfdXJsLnJlcGxhY2UoL1xcLmh0bS8sICctJyArIHRvUGFnZSArICcuaHRtJyk7XG4gICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIHNldEl0ZW0oXCJub3dcIiwgbmFtZXNbal0pO1xuICAgICAgICAgICAgICAgIHB1dFZhcihNWV9SVUxFLnVybCwgdXJsKTtcbiAgICAgICAgICAgICAgICBwdXRNeVZhcigneWlfZmlyc3RwYWdlJywgdXJsKTtcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcclxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/ot7PotorliLDkuobnrKwnICsgdG9QYWdlICsgJ+mhtSdcclxuICAgICAgICAgICAgfSx0cnVlX3VybCwgayxuYW1lcyxqKSxcclxuICAgICAgICB9KTtcblxufWVsc2V7XG5cbmlmKGFycltqXT09J+maj+acuicpe1xuICAgICAgICAgICAgICBhcnJbal0gPSBNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBrKSArMSAgIFxufWVsc2UgaWYoYXJyW2pdPT0n5bC+6aG1JytrKXtcbiAgICAgICAgICAgICAgYXJyW2pdID0ga1xufWVsc2UgaWYoYXJyW2pdPT0xKXtcbiAgICAgICAgICAgICAgbmFtZXNbal0gPSBcIummlumhtVwiXG59ZWxzZSBpZihhcnJbal09PSfot7PpobUnKXtcbiAgICAgICAgICAgICBhcnJbal0gPSAyMjNcbn1cblxuICAgICAgICAgIGlmKC9mb3J1bVxcLVxcZCtcXC1cXGQrLy50ZXN0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0gaW5wdXQ7XFxuICAgICAgcmV0dXJuIHRoaXM7XFxuICAgIH0sXFxuICAgIHNldFRpdGxlKGssIGksIHQpIHtcXG4gICAgICByZXR1cm4gayA9PSBpID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyB0LmZvbnRjb2xvcih0aGlzLuWIhuexu+minOiJsikgOiB0O1xcbiAgICB9LFxcbiAgICBhY3Rpb24ob2JqKSB7XFxuICAgICAgcmV0dXJuIFtcXG4gICAgICAgIHtcXG4gICAgICAgICAgdGl0bGU6IFxcXCLmuIXpmaTnirbmgIFcXFwiLFxcbiAgICAgICAgICBqczogJC50b1N0cmluZygob2JqKSA9PiB7XFxuICAgICAgICAgICAgbG9nKG9iaik7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihvYmouc3RhdGUpO1xcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIpO1xcbiAgICAgICAgICAgIG9iai5hbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBvYmouY2wuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICB9LCBvYmopLFxcbiAgICAgICAgfSxcXG4gICAgICBdO1xcbiAgICB9LFxcbiAgICBjaGVja1BhcmFtKCkge1xcbiAgICAgIHZhciBvYmogPSB7fTtcXG4gICAgICBpZiAodGhpcy5wYWdlID09IDAgJiYgdHlwZW9mIHBhZ2UgPT0gXFxcInVuZGVmaW5lZFxcXCIpIHtcXG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi6K+35Lyg5YWl6aG156CBXFxcIik7XFxuICAgICAgfSBlbHNlIHtcXG4gICAgICAgIGlmICh0e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ZXR1cm4gSlNPTi5zdHJpbmdpZnkob2JqKTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICAgIHJldHVybiDlrprkvY07XFxuICAgICAgICB9KTtcXG4gICAgICAgIC8vbG9nKOS4gOe6pylcXG4gICAgICAgIC8vbG9nKOS4gOe6py5sZW5ndGgpXFxuICAgICAgICBpZiAo5LiA57qnLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgIGNhdGVnb3JpZXMucHVzaCjkuIDnuqcuam9pbihcXFwiXFxcXG5cXFwiKSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICDkuIDnuqcuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChpdGVtLmpvaW4oXFxcIixcXFwiKSk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy9sb2coY2F0ZWdvcmllcylcXG4gICAgICB9KTtcXG4gICAgICBpZiAo5oqY5Y+g54q25oCBKSB7XFxuICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT09IFxcXCIxXFxcIiA/IOaKmOWPoCA6IOWxleW8gCxcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoXFxuICAgICAgICAgICAgICAoZm9sZCwgdSwgYWxsKSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKE1ZX1JVTEUuZ3JvdXAsIGZvbGQgPT09IFxcXCIxXFxcIiA/IFxcXCIwXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgICAgIC8qYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTsqL1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgZm9sZCxcXG4gICAgICAgICAgICAgIOeKtuaAgSxcXG4gICAgICAgICAgICAgIOWFqOa4hVxcbiAgICAgICAgICAgICksXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgbG9uZ0NsaWNrOiB0aGlzLmFjdGlvbih7XFxuICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgIGFsbDog5YWo5riFLFxcbiAgICAgICAgICAgICAgICBjbDog5riF6ZmkLFxcbiAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgfVxcbiAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICBjYXRlZ29yaWVzLmZvckVhY2goKGNhdGVnb3J5LCBpbmRleCkgPT4ge1xcbiAgICAgICAgLy9sb2coY2F0ZWdvcmllcylcXG4gICAgICAgIGxldCBzdWJfY2F0ZWdvcmllcyA9IFtdO1xcbiAgICAgICAgLyppZiAo5bCP57G75a6a5L2NLmluY2x1ZGVzKFxcXCI7XFxcIikpIHtcXG4gICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0uc3BsaXQoXFxcIjtcXFwiKVswXSk7XFxuICAgICAgICAgIGlmIChzdWJfY2F0ZWdvcmllcy5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXCI7XFxcIilbMV0pO1xcbiAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2UgeyovXFxuICAgICAgICAvL2xvZyhpbmRleClcXG4gICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gSlNPTi5wYXJzZShgWyR7Y2F0ZWdvcnl9XWApO1xcbiAgICAgICAgLy8gc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0pO1xcbiAgICAgICAgLy99XFxuICAgICAgICBpZiAoaW5kZXggPT09IDApIHtcXG4gICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuXFxuICAgICAgICAgICAgLy9sZXQgdGl0bGUgPSBwZGZoKGl0ZW0sIF/lpKfnsbvmoIfpopgpO1xcbiAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0ZW0udGl0bGU7XFxuICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3UmVnRXhwKOaOkumZpCwgXFxcImdcXFwiKSwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQganNvbj0nJ1xcbiAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICBcXG4gICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICBjbGVhcnM6IOa4hemZpCxcXG4gICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgfTtcXG5cXG4gICAgICAgICAgICAvL2xldCB1cmwgPSBwZChpdGVtLCBf5aSn57G76ZO+5o6lKTtcXG4gICAgICAgICAgICBsZXQgdXJsID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgLyppZiAo5aSn57G75aSE55CGKSB7XFxuICAgICAgICAgICAgICB1cmwgPSDkuIDnuqfliIbnsbvlpITnkIYodXJsKTtcXG4gICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAvL2xvZyh1cmwpXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5I25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBuZXdfY2F0ZSA9IFtdO1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICBuZXdfY2F0ZS5wdXNoKGluZGV4ID09PSAwID8gcGFyYW1zLmtleS50b1N0cmluZygpIDogXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpO1xcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkdF9cXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSwgcGFyYW1zKSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIGlmIChmb2xkID09PSBcXFwiMVxcXCIgfHwg5oqY5Y+g54q25oCBID09IGZhbHNlKSB7XFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcbiAgICAgICAgICAgIHZhciBleHRyYXBvcyA9IGZhbHNlO1xcbiAgICAgICAgICAgIC8qaWYgKGl0ZW0uaW5jbHVkZXMoJ3R5cGU9XFxcIkBleHRyYVxcXCInKSkge1xcbiAgICAgICAgICAgICAgZXh0cmFwb3MgPSB0cnVlO1xcbiAgICAgICAgICAgICAgLy9sb2coJ+mZhOWKoOWumuS9jScpXFxuICAgICAgICAgICAgfSovXFxuXFxuICAgICAgICAgICAgaWYgKGV4dHJhcG9zKSB7XFxuICAgICAgICAgICAgICB2YXIgdGl0bGUgPSBwZGZoKGl0ZW0sIFxcXCJhJiZUZXh0XFxcIik7XFxuICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICB2YXIganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgdHlwZTogcGRmaChpdGVtLCBcXFwiYSYmc3RhdGVcXFwiKSxcXG4gICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwgXFxcImEmJnZhbHVlXFxcIiksXFxuICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAvL3ZhciB0aXRsZSA9IHBkZmgoaXRlbSwg5YiG57G75qCH6aKYKTtcXG4gICAgICAgICAgICAgIHZhciB0aXRsZSA9IGl0ZW0udGl0bGU7XFxuICAgICAgICAgICAgICBpZiAodHlwZW9mIOaOkumZpCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDmjpLpmaQgIT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICB2YXIganNvbiA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgLypzd2l0Y2ggKHRydWUpIHtcXG4gICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMF0pLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXCJAQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgY2FzZSDliIbnsbvpk77mjqUuaW5jbHVkZXMoXFxcIkBAXFxcIik6XFxuICAgICAgICAgICAgICAgICAganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVswXSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBcXFwiKVsxXSksXFxuICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcXG4gICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgLy8ganNvbiA9IHBkKGl0ZW0sIOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgIGpzb24gPSBpdGVtLnVybDtcXG4gICAgICAgICAgICAgIC8qdmFyIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzFdKSxcXG4gICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOuWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVswXSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMV0pLFxcbiAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTsqL1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxuICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICBqc29uOiBqc29uLFxcbiAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcbiAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcImhpa2VyOi8vZW1wdHlcXFwiICsgXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcbiAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkocGFyYW1zLmNhdGVfdGVtcCkpO1xcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkdF9cXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHBhcmFtcy5zdGF0ZSwgcGFyYW1zLmpzb24pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICB9LCBwYXJhbXMpLFxcbiAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgfSk7XFxuICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgIH0pO1xcbiAgICB9XFxuICAgIH0sXFxuICB9O1xcbiAgb2JqLumihOiuvihvcHRpb25zKTtcXG4gIHJldHVybiBvYmo7XFxufVxcblxcbiAgLy8u54q25oCBKFxcXCJ1cmxcXFwiKVxcbiAgL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ydWxlKSB7XFxuICAgIGlmIChqc29uLmNvbnN0cnVjdG9yICE9IE9iamVjdCkge1xcbiAgICAgIHRyeSB7XFxuICAgICAgICBqc29uID0gSlNPTi5wYXJzZShqc29uKTtcXG4gICAgICB9IGNhdGNoIHt9XFxuICAgIH1cXG4gICAganNvbltydWxlLmxpc3RdLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICB2YXIgaW1nID0gZXZhbChydWxlLmltZykgKyBydWxlLnJlZjtcXG4gICAgICB2YXIgaHJlZiA9IGV2YWwocnVsZS51cmwpO1xcbiAgICAgIGhyZWYgPSBydWxlLmltdCA/IGhyZWYgKyBcXFwiI2ltbWVyc2l2ZVRoZW1lI1xcXCIgOiBocmVmO1xcbiAgICAgIHZhciBsYXp5ID0gcnVsZS5sYXp5ID8gcnVsZS5sYXp5IDogXFxcIlxcXCI7XFxuICAgICAgdmFyIGRkID0ge1xcbiAgICAgICAgdGl0bGU6IGV2YWwocnVsZS50aXRsZSksXFxuICAgICAgICBkZXNjOiBldmFsKHJ1bGUuZGVzYyksXFxuICAgICAgICBjb250ZW50OiBldmFsKHJ1bGUuY29udGVudCksXFxuICAgICAgICBwaWNfdXJsOiBpbWcsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5IyNcXFwiICsgaHJlZixcXG4gICAgICAgIGNvbF90eXBlOiBydWxlLmNvbF90eXBlLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgcGFnZVRpdGxlOiBldmFsKHJ1bGUudGl0bGUpLFxcbiAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgIH0sXFxuICAgICAgfTtcXG4gICAgICBpZiAobGF6eSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgZGRbXFxcInVybFxcXCJdID0gaHJlZiArIGxhenk7XFxuICAgICAgfVxcbiAgICAgIGFyci5wdXNoKGRkKTtcXG4gICAgfSk7XFxuICB9LFxcbiAgcnVsZUxpc3Q6IGZ1bmN0aW9uIChh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VtLCBydWxlLmNvbnRlbnQpO1xcbiAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgIGlkID0gXFxcImxhc3RpZF9cXFwiICsgcGFnZTtcXG4gICAgICAgICAgY2xzID0gXFxcImxhc3RtYXJrXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgcGljX3VybDogaW1nLnJlcGxhY2UoaG9zdCxnZXRNeVZhcignb3BpYycpKSxcXG4gICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL2VyP3VybD1cXFwiICsgdXJsLFxcbiAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcbiAgICAgICAgICBjb2xfdHlwZTogcnVsZS5jb2xfdHlwZSxcXG4gICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBwYWdlVGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgIGlkOiBpZCxcXG4gICAgICAgICAgICBjbHM6IGNscyxcXG4gICAgICAgICAgfSxcXG4gICAgICAgIH0pO1xcbiAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxICYmIHNob3cpIHtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICBpZDogXFxcInBhZ2VsaW5lXFxcIixcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbnVtXFxcIixcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgfSBlbHNlIHtcXG4gICAgICB1cGRhdGVJdGVtKFxcXCJwYWdlbnVtXFxcIiwge1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuWIsOW6leS6hjwvc21hbGw+PC9mb250PicsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBpZDogXFxcImxhc3RcXFwiLFxcbiAgICAgICAgfSxcXG4gICAgICB9KTtcXG4gICAgfVxcbiAgICBpZiAobGlzdC5sZW5ndGggPT0gMCAmJiBwYWdlID09IDEpIHtcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICB9KTtcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuaXoOWGheWuuTwvc21hbGw+PC9mb250PicsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge30sXFxuICAgICAgfSk7ICAgICAgXFxuICAgIH1cXG4gICAgaWYodGhpcy5uZXh0UGFnZSgpKX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AgICB1cmw6IGJhc2U2NERlY29kZShwZGZoKGNpbGlbal0sJ2EmJlRleHQnKSksXFxuICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgIGV4dHJhOiB7bGluZVZpc2libGU6IGZhbHNlfVxcbn0pO1xcbn1cXG59XFxuXFxuLy/pooTop4jlm75cXG50cnl7XFxuICAgIHZhciBsaXN0ID0gcGRmYShodG1sLFxcXCIueXVsYW50dSYmaW1nXFxcIilcXG5pZihsaXN0Lmxlbmd0aD4wKXtcXG4gICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08bWlkZGxlPjxmb250IGNvbG9yPSNmZjY4Nzc+5qC35ZOB5Zu+5YOPPC9mb250PjwvbWlkZGxlPicsXFxuICAgICAgICB1cmw6IE1ZX1VSTCArICQoJycpLmxhenlSdWxlKChob3N0KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgaHRtbCA9IGZldGNoKGlucHV0LHtoZWFkZXJzOkpTT04ucGFyc2UoZ2V0TXlWYXIoJ2hlYWRlcnMnKSl9KTtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwaWNzID0gcGRmYShodG1sLFxcXCIueXVsYW50dSYmaW1nXFxcIikubWFwKGl0ZW09PnBkKGl0ZW0sXFxcImltZyYmc3JjXFxcIikucmVwbGFjZShob3N0LGdldE15VmFyKCdvcGljJykpKVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJwaWNzOi8vXFxcIitwaWNzLmpvaW4oXFxcIiYmXFxcIilcXG4gICAgICAgICAgICAgICAgfSxob3N0KSxcXG4gICAgICAgIGNvbF90eXBlOiAndGV4dF8xJyxcXG4gICAgICAgIGV4dHJhOiB7bGluZVZpc2libGU6IGZhbHNlfVxcbiAgICB9KVxcbn1cXG5saXN0LmZvckVhY2goeD0+e1xcbiAgICAgZC5wdXNoKHsgICAgICAgICAgICAgXFxuICAgICAgICAgaW1nOiBwZCh4LFxcX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gICAgICB2YXIga2V5ID0geC5zdWJzdHJpbmcoMCwgaW5kZXgpLnRyaW0oKTtcXG4gICAgICAgICAgICB2YXIgdmFsdWUgPSB4LnN1YnN0cmluZyhpbmRleCArIDEpO1xcbiAgICAgICAgICAgIGNvb2tpZXNba2V5XSA9IHZhbHVlO1xcbiAgICAgICAgfSlcXG4gICAgfVxcbn0pO1xcblxcbmZ1bmN0aW9uIGd1YXJkKHVybCwgaGVhZG9iaikge1xcbiAgICB2YXIgaGVhZCA9IGhlYWRvYmogPyBoZWFkb2JqOntcXG4gICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICBDb29raWU6IGdldENvb2tpZSh1cmwpLFxcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIHZhciBodG1sID0gZmV0Y2godXJsLCBoZWFkKTtcXG4gICAgaWYgKGh0bWwuaW5jbHVkZXMoJ19ndWFyZC9hdXRvLmpzJykpIHtcXG4gICAgICAgIGRvY3VtZW50W1xcXCJjb29raWVcXFwiXSA9IGdldENvb2tpZSh1cmwpO1xcbiAgICAgICAgZXZhbChmZXRjaChnZXRIb21lKHVybCkgKyAnL19ndWFyZC9hdXRvLmpzJykpXFxuICAgICAgICBodG1sID0gZmV0Y2godXJsLCB7XFxuICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICBDb29raWU6IGRvY3VtZW50W1xcXCJjb29raWVcXFwiXSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICAvL2xvZyhkb2N1bWVudFtcXFwiY29va2llXFxcIl0pXFxuICAgIHJldHVybiBodG1sXFxufVxcblxcbmZ1bmN0aW9uIGNzcGxpdChhLCBiLCBjKSB7XFxuICAgIGIgPSBwYXJzZUludChiLCAxMCkgfHwgNzY7XFxuICAgIGMgPSBjIHx8ICdcXFxcclxcXFxuJztcXG4gICAgaWYgKGIgPCAxKSB7XFxuICAgICAgICByZXR1cm4gZmFsc2VcXG4gICAgfVxcbiAg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AgICAgICB0aXRsZTon55Wqwrfku5MnLCBcXG4gICAgICAgIGNvbnRlbnQ6J+W3suabtOaWsOe9keWdgOS4ulxcXFxuJytsaW5rLCBcXG4gICAgICAgIGNvbmZpcm06JC50b1N0cmluZygoKT0+e3JlZnJlc2hQYWdlKCl9KSwgXFxuICAgICAgICBjYW5jZWw6JC50b1N0cmluZygoKT0+e30pXFxuICAgIH0pXCJ9XSIsImljb24iOiJodHRwczovL2ltZy52aW51YS5jbi9pbWFnZXMvSXY2M1YucG5nIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment