Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥阿里云盘分享@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuinhOWImeWkhOeQhlwiLFwicGF0aFwiOlwiZGF0YVwiLFwicnVsZVwiOlwianM6XFxuZnVuY3Rpb24gZG91YmxlVHJlYXRpbmcob3Blbk1vZGUsIGZpbmRBbGlVcmwsIHRpdGxlKSB7XFxuICAgIGxldCBhbGlVcmwgPSBpbnB1dDtcXG4gICAgbGV0IHNoYXJlUHdkO1xcbiAgICBpZiAoZmluZEFsaVVybCkge1xcbiAgICAgICAgbGV0IHJlc3VsdCA9IGZpbmRBbGlVcmwoYWxpVXJsKTtcXG4gICAgICAgIGlmICh0eXBlb2YgcmVzdWx0ID09PSBcXFwic3RyaW5nXFxcIilcXG4gICAgICAgICAgICBhbGlVcmwgPSByZXN1bHQ7XFxuICAgICAgICBlbHNlXFxuICAgICAgICAgICAgYWxpVXJsID0gcmVzdWx0LmFsaVVybCwgc2hhcmVQd2QgPSByZXN1bHQuc2hhcmVQd2Q7XFxuICAgIH1cXG4gICAgaWYgKGFsaVVybC5pbmNsdWRlcyhcXFwid3d3LmFsaXl1bmRyaXZlLmNvbS9zL1xcXCIpK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kSGlzdG9yeSMjbm9IaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKFxcXCLmlK/mjIHkvZzogIVcXFwiID09IGlucHV0KSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9Eb25hdGUudiNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChcXFwiVG9rZW7nmbvlvZVcXFwiID09IGlucHV0KSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIiwgXFxcIui+k+WFpVRva2VuXFxcIikuaW5wdXQoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhbGlUb2tlbnNGaWxlcGF0aCA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL3Rva2VuUGF0aFxcXCIpLmFsaVRva2Vuc0ZpbGVwYXRoO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhbGlUb2tlbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaF90b2tlbjogaW5wdXQudHJpbSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB3cml0ZUZpbGUoYWxpVG9rZW5zRmlsZXBhdGgsIEpTT04uc3RyaW5naWZ5KGFsaVRva2VuKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChcXFwi55m75b2V5L+h5oGvXFxcIiA9PSBpbnB1dCkge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFsaVRva2Vuc0ZpbGVwYXRoID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvdG9rZW5QYXRoXFxcIikuYWxpVG9rZW5zRmlsZXBhdGg7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIWZpbGVFeGlzdChhbGlUb2tlbnNGaWxlcGF0aCkpIHJldHVybiBcXFwidG9hc3Q6Ly/ov5jmnKrnmbvpmYZcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFsaSA9IHJlcXVlc3QoYWxpVG9rZW5zRmlsZXBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBhbGkgPSBKU09OLnBhcnNlKGFsaSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlRmlsZShhbGlUb2tlbnNGaWxlcGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0pVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+eZu+W9leS/oeaBrycsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIueUqOaItzpcXFwiICsgKGFsaS5uaWNrX25hbWUgfHwgYWxpLnVzZXJfbmFtZSB8fCBcXFwiVG9rZW7nmbvlvZVcXFwiKSArIFxcXCJcXFxcblRva2VuOlxcXCIgKyBhbGkucmVmcmVzaF90b2tlbiArIFxcXCJcXFxcbijlj5bmtojvvJrms6jplIDnmbvlvZXvvJvnoa7lrprvvJrlpI3liLZUb2tlbilcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm06ICQudG9TdHJpbmcoKHRva2VuKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyB0b2tlbjtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBhbGkucmVmcmVzaF90b2tlbiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsOiAkLnRvU3RyaW5nKChwYXRoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCLnoa7orqTms6jplIDnmbvlvZVcXFwiKS5jb25maXJtKChwYXRoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKHBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgYWxpVG9rZW5zRmlsZXBhdGgpXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnJlcGxhY2UoXFxcIuaooeW8j++8mlxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwib3Blbk1vZGVcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwi5a6Y5pa5QVBQXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S/ruaUueaIkOWKn++8jOivt+ehruS/neaJi+acuuacieWuieijhemYv+mHjOS6keebmOWumOaWuUFQUFxcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSksXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fMl9yb3VuZFxcXCIsXFxuICAgICAgICBkZXNjOiBcXFwiXFxcIixcXG4gICAgICAgIHBpY191cmw6IFxcXCJoaWtlcjovL2ltYWdlcy9pY29uX21lbnU2XFxcIlxcbiAgICB9KTtcXG5cXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAn5pCc57SiJyxcXG4gICAgICAgIGRlc2M6ICfor7fovpPlhaXlhbPplK7or40v6ZO+5o6lJyxcXG4gICAgICAgIGNvbF90eXBlOiAnaW5wdXQnLFxcbiAgICAgICAgdXJsOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICBpbnB1dCA9IGdldE15VmFyKFxcXCJzXFxcIiwgXFxcIlxcXCIpIHx8IGlucHV0O1xcbiAgICAgICAgICAgIGlucHV0ID0gaW5wdXQudHJpbSgpO1xcbiAgICAgICAgICAgIGlmIChpbnB1dC5zdGFydHNXaXRoKFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJzXFxcIik7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2FsaXl1bj9wYWdlVGl0bGU95omT5byA6ZO+5o6lJnBhZ2U9ZnlwYWdlJnJlYWx1cmw9XFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChpbnB1dCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHB1dE15VmFyKCdzJywgaW5wdXQpO1xcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgfSksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIG9uQ2hhbmdlOiBcXFwicHV0TXlWYXIoJ3MnLGlucHV0KVxcXCIsXFxuICAgICAgICAgICAgaWQ6IGlkICsgXFxcInNzXFxcIixcXG4gICAgICAgICAgICBkZWZhdWx0VmFsdWU6IHNcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGxldCBydWxlcyA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGFcXFwiKS5nZXREYXRhKCk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIvCfjJ9cXFwiLFxcbiAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9jb2xsZWN0aW9uP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICB9LCB7XFxuICAgICAgICB0aXRsZTogXFxcIlxcXCIgPT0gciA/IFxcXCLigJzigJzlhajpg6jigJ3igJ1cXFwiIDogXFxcIuWFqOmDqFxcXCIsXFxuICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHMsIGlkKSA9PiB7XFxuICAgICAgICAgICAgbGV0IHFyID0gZ2V0SXRlbShcXFwicnVsZVxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICBjbGVhckl0ZW0oXFxcInJ1bGVcXFwiKTtcXG4gICAgICAgICAgICBpZiAocykge1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcIuWFqOmDqFxcXCIgKyBpZCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzlhajpg6jigJ3igJ1cXFwiXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBpZiAocXIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQgKyBxciwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBxclxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgfSwgcywgaWQpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgaWQ6IFxcXCLlhajpg6hcXFwiICsgaWRcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGZvciAobGV0IGl0IG9mIHJ1bGVzKSB7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBpdCA9PSByID8gXFxcIuKAnOKAnFxcXCIgKyBpdCArIFxcXCLigJ3igJ1cXFwiIDogaXQsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChyLCBzLCBpZCkgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgcXIgPSBnZXRJdGVtKFxcXCJydWxlXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJydWxlXFxcIiwgcik7XFxuICAgICAgICAgICAgICAgIGlmIChzKSB7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShxciA/IChpZCArIHFyKSA6IChcXFwi5YWo6YOoXFxcIiArIGlkKSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBxciB8fCBcXFwi5YWo6YOoXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGlkICsgciwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCcXFxcIiArIHIgKyBcXFwi4oCd4oCdXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgIC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XFwieXBqLXBhZ2VcXFwiICsgcDtcXG4gICAgaWYgKGRhdGEubGVuZ3RoID4gMCkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuWKoOi9veesrFxcXCIgKyBwICsgXFxcIumhteS4re+8jOi/m+W6pu+8mjEvXFxcIiArIGRhdGEubGVuZ3RoLFxcbiAgICAgICAgICAgIHVybDogXFxcIlxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBkZXNjOiBcXFwiXFxcIixcXG4gICAgICAgICAgICBwaWNfdXJsOiBcXFwiXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogcGFnZWlkXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgc2V0UmVzdWx0KGQpO1xcbiAgICBpZiAoZGF0YS5sZW5ndGggPiAwKSB7XFxuICAgICAgICAvL+Wkmue6v+eoi+WKoOi9vSAgICAgICAgXFxuICAgICAgICBsZXQgcmVhbFBhZ2UgPSBcXFwiXFxcIiA9PSByID8gMSA6IHA7XFxuICAgICAgICBsZXQgdGFza3MgPSBkYXRhLm1hcChpdCA9PiB7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgZnVuYzogZnVuY3Rpb24ocnVsZSkge1xcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJC5yZXF1aXJlKFxcXCJkYXRhXFxcIikuY2FycnlSdWxlKHJ1bGUsIHMsIHJlYWxQYWdlLCBzZWFyY2hNb2RlLCBvcGVuTW9kZSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKHJ1bGUubmFtZSArIFxcXCI6XFxcIiArIGUudG9TdHJpbmcoKSlcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuIHJ1bGUuZmluZChzLCByZWFsUGFnZSk7XFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIHBhcmFtOiBpdCxcXG4gICAgICAgICAgICAgICAgaWQ6IFxcXCJydWxlQFxcXCIgKyBpdC5uYW1lXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuXFxuICAgICAgICBiYXRjaEV4ZWN1dGUodGFza3MsIHtcXG4gICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihwYXJhbSwgaWQsIGVycm9yLCByZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgcGFyYW0uaSArPSAxO1xcbiAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShyZXN1bHQpKSB7XFxuICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKFxcXCJfbm90aGF2ZVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUJlZm9yZShwYWdlaWQsIHJlc3VsdCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtLmkgPT09IHBhcmFtLmFsbCkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFyZXN1bHQgfHwgIXJlc3VsdC5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKFxcXCJfbm90aGF2ZVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1CZWZvcmUocGFnZWlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBcXFwifn5+5LuA5LmI6LWE5rqQ6YO95rKh5pyJ5ZOmfn5+XFxcIi5mb250Y29sb3IoXFxcIkdyYXlcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBcXFwiX25vdGhhdmVcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0ocGFnZWlkKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ocGFnZWlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLliqDovb3nrKxcXFwiICsgTVlfUEFHRSArIFxcXCLpobXkuK3vvIzov5vluqbvvJpcXFwiICsgKHBhcmFtLmkgKyAxKSArIFxcXCIvXFxcIiArIHBhcmFtLmFsbCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgcGFyYW06IHtcXG4gICAgICAgICAgICAgICAgYWxsOiBkYXRhLmxlbmd0aCxcXG4gICAgICAgICAgICAgICAgaTogMCxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmZ1bmN0aW9uIHNld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gKyBcXFwiOnNlYXJjaEhpc3RvcnlcXFwiXFxuICAgICAgICB9XFxuICAgIH0pO1xcblxcbiAgICBsZXQgaGlzdG9yeSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcInNlYXJjaEhpc3RvcnlcXFwiLCBbXSk7XFxuICAgIGxldCBpID0gMDtcXG4gICAgZm9yIChsZXQga2V5IG9mIGhpc3RvcnkpIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGtleSxcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGlkLCBrZXkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGV4dHJhID0gZmluZEl0ZW0oaWQgKyBcXFwic3NcXFwiKS5leHRyYTtcXG4gICAgICAgICAgICAgICAgZXh0cmEuZGVmYXVsdFZhbHVlID0ga2V5O1xcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHtcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiBleHRyYVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICB9LCBpZCwga2V5KSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImZsZXhfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogaWQgKyBcXFwiOmtleTpcXFwiICsga2V5LFxcbiAgICAgICAgICAgICAgICBjbHM6IGlkICsgXFxcIjprZXlcXFwiLFxcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWIoOmZpOWFs+mUruivjTpcXFwiICsga2V5LFxcbiAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGlkLCBrZXksIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaGlzdG9yeSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcInNlYXJjaEhpc3RvcnlcXFwiLCBbXSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGlzdG9yeS5zcGxpY2UoaSwgMSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwic2VhcmNoSGlzdG9yeVxcXCIsIGhpc3RvcnkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0oaWQgKyBcXFwiOmtleTpcXFwiICsga2V5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL3RvYXN0KCk7XFxuICAgICAgICAgICAgICAgICAgICB9LCBpZCwga2V5LCBpKVxcbiAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICAgICAgaSsrO1xcbiAgICB9XFxuICAgIGlmIChoaXN0b3J5Lmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCJ+fn7ku4DkuYjpg73msqHmnInlk6Z+fn5cXFwiLmZvbnRjb2xvcihcXFwiR3JheVxcXCIpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiOmtleVxcXCIsXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcblxcbmZ1bmN0aW9uIHNldFRyZW5kaW5nVGFiRW5kKCkge1xcbiAgICBsZXQgaG90Q2xhc3Mg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mkJxcXFwiKS5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgIHNldEl0ZW0oXFxcImhvdGtleVxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWIh+aNouS4ulxcXCIgKyBpbnB1dDtcXG4gICAgICAgIH0pLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiLFxcbiAgICAgICAgcGljX3VybDogXFxcImhpa2VyOi8vaW1hZ2VzL2ljb25fZmlyZVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLliIfmjaLmlbDmja7mupBcXFwiLFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoZGF0YVNvdXJjZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoZGF0YVNvdXJjZSwgMSwgXFxcIuWIh+aNouaVsOaNrua6kFxcXCIpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiZGF0YVNvdXJjZVxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGVhckl0ZW0oXFxcImhvdGtleVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey5YiH5o2i5Li6XFxcIiArIGlucHV0O1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH0sIGRhdGFTb3VyY2UpXFxuICAgICAgICAgICAgfV1cXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIuato+WcqOWKoOi9vS4uLlxcXCIsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBpZCArIFxcXCI6aG90a2V5XFxcIixcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIHNldFJlc3VsdChkKTtcXG4gICAgbGV0IHNkID0gW107XFxuICAgIGxldCBzZXRTZWFyY2hLZXkgPSBuYW1lID0+IHtcXG4gICAgICAgIHB1dE15VmFyKCdzJywgbmFtZSk7XFxuICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICB9O1xcblxcbiAgICBsZXQgZ2V0VGl0bGUgPSAoaSwgbmFtZSkgPT4ge1xcbiAgICAgICAgbGV0IGNvbG9yO1xcbiAgICAgICAgc3dpdGNoIChpKSB7XFxuICAgICAgICAgICAgY2FzZSAwOlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjZmYzMzAwXFxcIjtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSAxOlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjZmY2NjAwXFxcIjtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSAyOlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCIjZmY5OTAwXFxcIlxcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBkZWZhdWx0OlxcbiAgICAgICAgICAgICAgICBjb2xvciA9IFxcXCJibGFja1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBTdHJpbmcoaSArIDEpLmZvbnRjb2xvcihjb2xvcikgKyBcXFwiXFxcXHRcXFxcdFxcXFx0XFxcIiArIG5hbWU7XFxuICAgIH1cXG4gICAgdHJ5IHtcXG4gICAgICAgIHN3aXRjaCAoc2VsZWN0c291cmNlKSB7XFxuICAgICAgICAgICAgY2FzZSBcXFwi55m+5bqmXFxcIjpcXG4gICAgICAgICAgICAgICAgdmFyIGpzb24gPSByZXF1ZXN0KCdodHRwczovL3RvcC5iYWlkdS5jb20vYXBpL2JvYXJkP3BsYXRmb3JtPXdpc2UmdGFiPScgKyB0YWJrZXkgKyAnJnRhZz0lN0IlMjJjYXRlZ29yeSUyMjolMjIlRTUlODUlQTglRTklODMlQTglRTclQjElQkIlRTUlOUUlOEIlMjIlN0QnLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1VzZXItQWdlbnQnOiAnTW96aWxsYS81LjAgKExpbnV4OyBBbmRyb2lkIDYuMDsgTmV4dXMgNSBCdWlsZC9NUkE1OE4pIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS85OS4wLjQ4NDQuNTEgTW9iaWxlIFNhZmFyaS81MzcuMzYnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdIb3N0JzogJ3RvcC5iYWlkdS5jb20nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdBY2NlcHQnOiAnYXBwbGljYXRpb24vanNvbiwgdGV4dC9wbGFpbiwgKi8qJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQWNjZXB0LUxhbmd1YWdlJzogJ3poLUNOLHpoO3E9MC45LGVuLVVTO3E9MC44LGVuO3E9MC43JyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQWNjZXB0LUVuY29kaW5nJzogJ2d6aXAsIGRlZmxhdGUsIGJyJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3RvcC5iYWlkdS5jb20vYm9hcmQ/dGFiPW5vdmVsJyxcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIC8vdmFyIHMgPSBEYXRlLm5vdygpO1xcbiAgICAgICAgICAgICAgICB2YXIgbGlzdCA9IEpTT04ucGFyc2UoanNvbikuZGF0YS5jYXJkc1swXS5jb250ZW50O1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpdGVtID0gbGlzdFtpXTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBuYW1lID0gaXRlbS53b3JkICsgJyAoJyArIGl0ZW0uc2hvd1syXSArICcpJztcXG4gICAgICAgICAgICAgICAgICAgIGxldCBkZXMgPSBpdGVtLmRlc2M7XFxuICAgICAgICAgICAgICAgICAgICBzZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZ2V0VGl0bGUoaSwgbmFtZSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKHNldFNlYXJjaEtleSwgaXRlbS53b3JkKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBkZXMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nOiBpdGVtLmltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcIm1vdmllXzFfdmVydGljYWxfcGljXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSBcXFwi5aS45YWLXFxcIjpcXG4gICAgICAgICAgICAgICAgdmFyIGpzb24gPSByZXF1ZXN0KFxcXCJodHRwczovL25ld3MubXlxdWFyay5jb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zdCkgJiYgaW5wdXQuc3RhcnRzV2l0aChcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICBsb2coaW5wdXQpO1xcbiAgICAgICAgcmV0dXJuICQudG9TdHJpbmcoKHVybCwgcnVsZSkgPT4ge1xcbiAgICAgICAgICAgIGZ5X2JyaWRnZV9hcHAub3BlbihKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6K+m5oOFXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXCIrZW5jb2RlVVJJQ29tcG9uZW50KHVybCkrXFxcIiZydWxlPVxcXCIrcnVsZSxcXG4gICAgICAgICAgICB9KSlcXG4gICAgICAgIH0sIGlucHV0LCBydWxlKTtcXG4gICAgfSBlbHNlIGlmICghaW5wdXQuc3RhcnRzV2l0aChcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICBsb2coaW5wdXQpO1xcbiAgICAgICAgLy/og73llKTotbdBUFDnmoTnmb3lkI3ljZVcXG4gICAgICAgIGxldCB3aGl0ZSA9IFtcXG4gICAgICAgICAgICBcXFwicWtsaW5rXFxcIixcXG4gICAgICAgICAgICBcXFwiYmRuZXRkaXNrXFxcIixcXG4gICAgICAgICAgICBcXFwieHVubGVpYXBwXFxcIixcXG4gICAgICAgICAgICBcXFwic21hcnRkcml2ZVxcXCJcXG4gICAgICAgIF07XFxuICAgICAgICBsZXQgaW5XaGl0ZSA9IHdoaXRlLmZpbHRlcihpdCA9PiBpbnB1dC5zdGFydHNXaXRoKGl0KSkubGVuZ3RoID4gMDtcXG4gICAgICAgIGlmICghaW5XaGl0ZSkge1xcbiAgICAgICAgICAgIHJldHVybiBmYWxzZTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiAkLnRvU3RyaW5nKCh1cmwsIHJ1bGUpID0+IHtcXG4gICAgICAgICAgICBmeV9icmlkZ2VfYXBwLm9wZW5UaGl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NoIChlKSB7XFxuICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICAgICAgdGhyb3cgZTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBhbGl1cmw7XFxuICAgIH1cXG5cXG4gICAgZnVuY3Rpb24gZ2V0TTN1OENvbnRlbnQocGxheXVybCkge1xcblxcbiAgICAgICAgLy9sb2coXFxcIuaIkeWcqOS7o+eQhlxcXCIgKyBwbGF5dXJsKTtcXG4gICAgICAgIGxldCBob21lID0gcGxheXVybC5zcGxpdCgnbWVkaWEubTN1OCcpWzBdO1xcbiAgICAgICAgbGV0IGYgPSBmZXRjaChwbGF5dXJsLCB7XFxuICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgdGltZW91dDogMzAwMFxcbiAgICAgICAgfSkuc3BsaXQoXFxcIlxcXFxuXFxcIik7XFxuICAgICAgICBsZXQgZmYgPSBmLm1hcChpdCA9PiB7XFxuICAgICAgICAgICAgaWYgKGl0LnN0YXJ0c1dpdGgoXFxcIm1lZGlhLVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiL3Byb3h5P3VybD1cXFwiICsgYmFzZTY0RW5jb2RlKGhvbWUgKyBpdCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBpdDtcXG4gICAgICAgIH0pLmpvaW4oXFxcIlxcXFxuXFxcIik7XFxuICAgICAgICAvL2xvZygndWZpZC0nICsgZmlsZWlkKTtcXG4gICAgICAgIHdyaXRlRmlsZSgnaGlrZXI6Ly9maWxlcy9fY2FjaGUvJyArIGZpbGVJZCArICcubTN1OCcsIGZmKTtcXG4gICAgICAgIHJldHVybiBmZjtcXG4gICAgfVxcblxcbiAgICBmdW5jdGlvbiB1cGRhdGVUc1VybCh1cmwpIHtcXG4gICAgICAgIGxldCBmaWQgPSB1cmwuc3BsaXQoJyZmPScpWzFdLnNwbGl0KCcmJylbMF07XFxuICAgICAgICAvL2xvZygnc2ZpZC0nICsgZmlkKTtcXG4gICAgICAgIGxldCBmID0gZmV0Y2goJ2hpa2VyOi8vZmlsZXMvX2NhY2hlLycgKyBmaWQgKyAnLm0zdTgnKS5zcGxpdChcXFwiXFxcXG5cXFwiKTtcXG4gICAgICAgIGYuZm9yRWFjaChpdCA9PiB7XFxuICAgICAgICAgICAgaWYgKGl0ICYmIGl0LnN0YXJ0c1dpdGgoJy9wcm94eT91cmw9JykpIHtcXG4gICAgICAgICAgICAgICAgbGV0IGZ1cmwgPSBiYXNlNjREZWNvZGUoaXQucmVwbGFjZSgnL3Byb3h5P3VybD0nLCAnJykpO1xcbiAgICAgICAgICAgICAgICBpZiAodXJsLnN1YnN0cih1cmwuaW5kZXhPZignL21lZGlhLScpLCB1cmwuaW5kZXhPZignLnRzJykpID09IGZ1cmwuc3Vic3RyKGZ1cmwuaW5kZXhPZignL21lZGlhLScpLCBmdXJsLmluZGV4T2YoJy50cycpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gZnVybDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgICAgICBsZXQgZXhwaXJlcyA9IHVybC5zcGxpdCgneC1vc3MtZXhwaXJlcz0nKVsxXS5zcGxpdCgnJicpWzBdO1xcbiAgICAgICAgY29uc3QgbGFzdHRpbWUgPSBwYXJzZUludChleHBpcmVzKSAtIERhdGUubm93KCkgLyAxMDAwO1xcbiAgICAgICAgaWYgKGxhc3R0aW1lIDwgNjApIHtcXG4gICAgICAgICAgICAvL2xvZygn6L+H5pyf5pu05pawJylcXG4gICAgICAgICAgICBsZXQgbGluZSA9IHVybC5zcGxpdCgnL21lZGlhJylbMF07IC8v5Y+W5LmL5YmN5pKt5pS+55qEdHPmrrXnur/ot69cXG4gICAgICAgICAgICBsaW5lID0gbGluZS5zdWJzdHJpbmcobGluZS5sYXN0SW5kZXhPZignLycpICsgMSk7XFxuICAgICAgICAgICAgbGV0IGYgPSBnZXRNM3U4Q29udGVudChnZXRBbGlQbGF5VXJsKGZpZCwgbGluZSkpLnNwbGl0KFxcXCJcXFxcblxcXCIpO1xcbiAgICAgICAgICAgIGYuZm9yRWFjaChpdCA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChpdCAmJiBpdC5zdGFydHNXaXRoKCcvcHJveHk/dXJsPScpKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZnVybCA9IGJhc2U2NERlY29kZShpdC5yZXBsYWNlKCcvcHJveHk/dXJsPScsICcnKSk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodXJsLnN1YnN0cih1cmwuaW5kZXhPZignL21lZGlhLScpLCB1cmwuaW5kZXhPZignLnRzJykpID09IGZ1cmwuc3Vic3RyKGZ1cmwuaW5kZXhPZignL21lZGlhLScpLCBmdXJsLmluZGV4T2YoJy50cycpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IGZ1cmw7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcblxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHVybDtcXG4gICAgfVxcbiAgICB0cnkge1xcbiAgICAgICAgbGV0IHVybCA9IGJhc2U2NERlY29kZShNWV9QQVJBTVMudXJsKTtcXG4gICAgICAgIGlmICh1cmwuaW5jbHVkZXMoXFxcIi50c1xcXCIpKSB7XFxuICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICAgICAgc3RhdHVzQ29kZTogMzAyLFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiTG9jYXRpb25cXFwiOiB1cGRhdGVUc1VybCh1cmwpLFxcbiAgICA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or7fmuIXnkIbjgIJcXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pKt5pS+5aSx6LSl77yM6ZSZ6K+v5L+h5oGv5bey5omT5Y2w44CCXFxcXG7or7fmn6XnnIvml6Xlv5coTE9HKVxcXCI7XFxuICAgICAgICB9XFxuXFxuICAgICAgICBsZXQgbW91bnRzdWIgPSBzdG9yYWdlMC5nZXRNeVZhcignbW91bnR6aW11Jywge30pO1xcbiAgICAgICAgaWYgKE9iamVjdC5rZXlzKG1vdW50c3ViKS5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgemltdSA9IG1vdW50c3ViO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHN1YnRpdGxlO1xcbiAgICAgICAgaWYgKE9iamVjdC5rZXlzKHppbXUgfHwge30pLmxlbmd0aCA+IDAgJiYgcGxheUxpc3QgJiYgcGxheUxpc3QudXJscyAmJiBwbGF5TGlzdC51cmxzLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICBqYXZhLmxhbmcuVGhyZWFkLnNsZWVwKDEwMCk7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgdmFyIHptdXJsID0gYWxpQWNjZXNzQXBpLmdldEZpbGVUb0Rvd25VcmwoemltdS5maWxlX2lkKTtcXG4gICAgICAgICAgICAgICAgbGV0IHBhdGggPSAnaGlrZXI6Ly9maWxlcy9jYWNoZS/kupHnm5jlkJsvc3ViLicgKyB6aW11LmV4dDtcXG4gICAgICAgICAgICAgICAgZG93bmxvYWRGaWxlKHptdXJsLCBwYXRoLCB7XFxuICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgc3VidGl0bGUgPSBnZXRQYXRoKHBhdGgpO1xcbiAgICAgICAgICAgIH0gY2F0Y2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Im1vdW50emltdVxcXCIsIHt9KTtcXG4gICAgICAgICAgICBhZGRMaXN0ZW5lcihcXFwib25DbG9zZVxcXCIsICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJtb3VudHppbXVcXFwiKTtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiYWxpU2hhcmVUb2tlblxcXCIpO1xcbiAgICAgICAgICAgICAgICBjbGVhclZhcihcXFwiZG1fc2hhcmVcXFwiKTtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiZG1saXN0XFxcIik7XFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgc2V0TWFya2VyKCk7XFxuICAgICAgICBpZiAocmVhbHVybCAmJiAhaXNTZWFyY2gpIHtcXG4gICAgICAgICAgICBsZXQgc2hhcmVJbmZvID0gYWxpU2hhcmVBcGkuZ2V0U2hhcmVJbmZvKCk7XFxuXFxuICAgICAgICAgICAgbGV0IGZpbGVJbmZvID0gc2hhcmVJbmZvLmZpbGVfaW5mb3M7XFxuICAgICAgICAgICAgaWYgKGZpbGVJbmZvLmxlbmd0aCA9PT0gMSAmJiBmaWxlSW5mb1swXS50eXBlID09PSBcXFwiZm9sZGVyXFxcIiAmJiAhZmlsZUlkKSB7XFxuICAgICAgICAgICAgICAgIGZpbGVJZCA9IGZpbGVJbmZvWzBdLmZpbGVfaWQ7XFxuICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShmaWxlSW5mb1swXS5maWxlX25hbWUpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShzaGFyZUluZm8uc2hhcmVfbmFtZSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBkZWFkbGluZSA9IFxcXCLmsLjkuYXmnInmlYhcXFwiO1xcblxcbiAgICAgICAgICAgIGlmIChzaGFyZUluZm8uZXhwaXJhdGlvbikge1xcbiAgICAgICAgICAgICAgICBkZWFkbGluZSA9IFxcXCLmnInmlYjoh7PvvJpcXFwiICsgZm9ybWF0RGF0ZShzaGFyZUluZm8uZXhwaXJhdGlvbik7XFxuICAgICAgICAgICAgICAgIC8vc2hhcmVJbmZvLnVwZGF0ZWRfYXRcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiAoc2hhcmVJbmZvLmNyZWF0b3JfbmFtZSB8fCBzaGFyZUluZm8uY3JlYXRvcl9waG9uZSkgKyBcXFwiJm5ic3A7Jm5ic3A7XFxcIiArIGRlYWRsaW5lLnNtYWxsKCksXFxuICAgICAgICAgICAgICAgIHVybDogcmVhbHVybCArIFxcXCIjbm9IaXN0b3J5I1xcXCIsXFxuICAgICAgICAgICAgICAgIGltZzogc2hhcmVJbmZvLmF2YXRhcixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJhdmF0YXJcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoIWlzU2VhcmNoKSB7XFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5pCc57SiXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQudHJpbSgpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFpbnB1dCkgcmV0dXJuIFxcXCJ0b2FzdDovL+ivt+i+k+WFpeWFs+mUruivjVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9hbGl5dW4jbm9IaXN0b3J5IyNmdWxsVGhlbWUjP3BhZ2U9ZnlwYWdlJnNlYXJjaEtleT1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KGlucHV0KTtcXG4gICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZDogc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHNoYXJlVG9rZW5cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJxcXFwiICsgc2VhcmNoS2V5ICsgXFxcIuKAneKAneeahOaQnOe0oue7k+aenFxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBmdW5TdHlsZSA9IGlzU2VhcmNoID8gXFxcImljb25fc21hbGxfM1xcXCIgOiBcXFwiaWNvbl9yb3VuZF9zbWFsbF80XFxcIjtcXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBzdHlsZSxcXG4gICAgICAgICAgICB1cmw6ICQoc3R5bGVzLCAxLCBcXFwi5o6S5biD5qC35byPXFxcIikuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiYWxpeXVuX3N0eWxlXFxcIiwgaW5wdXQ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c2UgXFxcIueZu+mZhui0puWPt1xcXCI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL2xvZ2luI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5I1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFwi5aSN5Yi25YiG5Lqr6ZO+5o6lXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoW1xcXCLlpI3liLbpk77mjqVcXFwiLCBcXFwi5aSN5Yi25rW36ZiU5Y+j5LukXFxcIl0sIDEsIFxcXCLliIbkuqvmlrnlvI9cXFwiKS5zZWxlY3QoKHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0ID09PSBcXFwi5aSN5Yi26ZO+5o6lXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyB1cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL+mYv+mHjOS6keebmOWIhuS6q+WPo+S7pOOAjFxcXCIgKyBnZXRQYWdlVGl0bGUoKSArIFxcXCLjgI1cXFxcblxcXCIgKyB1cmwgKyBcXFwiIEBpbXBvcnQ9anM6YGhpa2VyOi8vcGFnZS9hbGl5dW4/cmVhbHVybD0ke2lucHV0LnRyaW0oKX0mcnVsZT3kupHnm5jlkJsu566AYDtcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBcXFwiaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvXFxcIiArIHNoYXJlSWQgKyAoZmlsZUlkID8gXFxcIi9mb2xkZXIvXFxcIiArIGZpbGVJZCA6IFxcXCJcXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFwi5om56YeP5oyC6L295pys5Zyw5by55bmVXFxcIjpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvZG1Nb3VudCNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSNcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcIuafpeeci+aJi+WKqOaMgui9veWtl+W5lVxcXCI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB6bSA9IHN0b3JhZ2UwLmdldE15VmFyKFxcXCJtb3VudHppbXVcXFwiLCB7fSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0aXAgPSB6bS5uYW1lID8gXFxcIuW9k+WJjeWtl+W5leaWh+S7tlxcXFxuXFxcIiArIHptLm5hbWUgKyBcXFwiLlxcXCIgKyB6bS5leHQgOiBcXFwi6L+Y5pyq5omL5Yqo5oyC6L295a2X5bmVXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aJi+WKqOaMgui9veWtl+W5lScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiB0aXAgKyBcXFwiXFxcXG4o54K55Ye75Y+W5raI5Y+v5Lul5riF6Zmk5oyC6L295a2X5bmVKVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYW5jZWw6ICgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJtb3VudHppbXVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey5riF6Zmk5omL5Yqo5oyC6L295a2X5bmVXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFxcXCLojrflj5blvLnluZXmkJzntKLop4TliJlcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJqc1xcXCI6IEpTT04uc3RyaW5naWZ5KFxcXCJoaWtlcjovL3BhZ2UvbG9hZERtP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFwiJnRpdGxlPVxcXCIpICsgXFxcIitlbmNvZGVVUklDb21wb25lbnQocGxheWRhdGEudGl0bGUuc3BsaXQoJy0nKVswXSk7XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJuYW1lXFxcIjogTVlfUlVMRS50aXRsZSArIFxcXCLlvLnluZXmkJzntKJcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwicnVsZTovL1xcXCIgKyBiYXNlNjRFbmNvZGUoXFxcIu+/pXByb2plY3Rpb25fc2NyZWVu77+lXFxcIiArIEpTT04uc3RyaW5naWZ5KHJ1bGUpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXNlIFxcXCLmjqjpgIHliLB0dkJveFxcXCI6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3R2Ym94UHVzaCNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSNcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBzaGFyZUlkLCBzaGFyZVB3ZCwgZml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bS5uYW1lO1xcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9hbGl5dW4/cGFnZT1meXBhZ2UnLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogZm9sZGVyU3R5bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGZvcm1hdERhdGUoZmlsZUl0ZW0udXBkYXRlZF9hdCksXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IHBpY191cmwsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkOiBzaGFyZUlkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogTVlfUEFSQU1TLnNoYXJlVG9rZW4sXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGZpbGVJdGVtLmZpbGVfaWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2QsXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGZpbGVJdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IHN1YnRpdGxlLCBsb25nYywgY2xzO1xcbiAgICAgICAgICAgIGxldCB0aXRsZSA9IChmaWxlU3R5bGUgPT09IFxcXCJ0ZXh0XzFcXFwiID8gKHRpdGxlSGVhZFtjYXRlXSB8fCBcXFwi4p2TXFxcIikgOiBcXFwiXFxcIikgKyBmaWxlSXRlbS5uYW1lO1xcbiAgICAgICAgICAgIGxldCBuYW1lTm90RXh0ID0gZmlsZUl0ZW0ubmFtZS5yZXBsYWNlKCcuJyArIGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLCAnJyk7XFxuICAgICAgICAgICAgaWYgKHN1YkV4dHMuaW5jbHVkZXMoZmlsZUl0ZW0uZmlsZV9leHRlbnNpb24pKSB7XFxuICAgICAgICAgICAgICAgIGxvbmdjID0gW3tcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5oyC6L295a2X5bmVXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKCh6bSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdtb3VudHppbXUnLCB6bSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+aMgui9veWujOaIkO+8jOW9k+WJjeWtl+W5leaWh+S7tjogJyArIHptLm5hbWUgKyAnLicgKyB6bS5leHQ7XFxuICAgICAgICAgICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiBmaWxlSXRlbS5maWxlX2V4dGVuc2lvbixcXG4gICAgICAgICAgICAgICAgICAgICAgICBmaWxlX2lkOiBmaWxlSXRlbS5maWxlX2lkLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG5hbWVOb3RFeHRcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICB9XTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGNhdGUgPT09IFxcXCJ2aWRlb1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHppbXVsaXN0Lmxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICAgICAgc3VidGl0bGUgPSB6aW11bGlzdC5maW5kKHYgPT4gdi5uYW1lLmluY2x1ZGVzKG5hbWVOb3RFeHQpKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBjbHMgPSBcXFwicGxheWxpc3QgdlxcXCIrcGFnZUlkO1xcbiAgICAgICAgICAgICAgICBwaWNfdXJsID0gZmlsZUl0ZW0udGh1bWJuYWlsIHx8IHBpY191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AgICAgICAgICAvL2luaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGZpbGVJdGVtLm5hbWVcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IGZpbGVTdHlsZVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGlmIChjb250cy5sZW5ndGggPT09IDApIHtcXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgXFxcIn5+fuS7gOS5iOmDveayoeacieS6huWTpn5+flxcXCIuZm9udGNvbG9yKFxcXCJHcmF5XFxcIiksXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcblxcbmxldCBpdGVtcyA9IFtdO1xcbnRyeSB7XFxuICAgIGlmIChNWV9QQUdFID4gMSAmJiAhTVlfUEFSQU1TLm1hcmtlcikge1xcbiAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBcXFwifn5+5LuA5LmI6YO95rKh5pyJ5LqG5ZOmfn5+XFxcIi5mb250Y29sb3IoXFxcIkdyYXlcXFwiKSxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgIH0gZWxzZSB7XFxuICAgICAgICBsb2FkKGl0ZW1zKTtcXG4gICAgfVxcbn0gY2F0Y2ggKGUpIHtcXG4gICAgaWYgKGUubmFtZSA9PT0gXFxcIkFsaUVycm9yXFxcIikge1xcbiAgICAgICAgaWYgKGUuY29kZSA9PT0gXFxcIkludmFsaWRSZXNvdXJjZS5TaGFyZVB3ZFxcXCIpIHtcXG4gICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLor7fovpPlhaXmj5Dlj5bnoIFcXFwiLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBzaGFyZVB3ZCA/IFxcXCLigJzigJzmj5Dlj5bnoIHplJnor6/igJ3igJ1cXFwiIDogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJCgpLmlucHV0KChNWV9QQVJBTVMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHNldFBhZ2VQYXJhbXMoT2JqZWN0LmFzc2lnbih7fSwgTVlfUEFSQU1TLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9LCBNWV9QQVJBTVMpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGlmIChlLnNpZ25pZmljYW5jZSA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIGUubWVzc2FnZS5iaWcoKS5iaWcoKS5mb250Y29sb3IoXFxcInJlZFxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGUuc2lnbmlmaWNhbmNlID09PSAzKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgZS5tZXNzYWdlLmJpZygpLmZvbnRjb2xvcihcXFwiZ3JlZW5cXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJ1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuXFxuICAgIH0gZWxzZSB7XFxuICAgICAgICBsb2coXFxcIuWIl+ihqOWKoOi9veWksei0pSNcXFxcbumUmeivr+S/oeaBrz5cXFwiICsgZS50b1N0cmluZygpICsgXFxcIlxcXFxu6ZSZ6K+v6KGMPlxcXCIgKyBlLmxpbmVOdW1iZXIpO1xcbiAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICfmrKfmrKfvvIzmiqXplJnkuobjgILlnKjliLfmlrDlh6DmrKHvvJ/miJbogIXmm7TmjaLmlofku7blpLnjgIInLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIGRlc2M6IGUudG9TdHJpbmcoKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnXFxuICAgICAgICB9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bHQuY29kZTtcXG4gICAgICAgICAgICBlcnJvci5qdWRnZU1zZyA9IG1zZ1xcbiAgICAgICAgICAgIHRocm93IGVycm9yO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHJib2R5ID0gcmVzdWx0ICYmIHJlc3VsdC5yZXNwb25zZXMgJiYgcmVzdWx0LnJlc3BvbnNlc1swXSAmJiByZXN1bHQucmVzcG9uc2VzWzBdLmJvZHkgfHwge307XFxuICAgICAgICBpZiAocmJvZHkuY29kZSkge1xcbiAgICAgICAgICAgIGxldCBtc2cgPSByYm9keS5kaXNwbGF5X21lc3NhZ2UgfHwgcmJvZHkubWVzc2FnZTtcXG4gICAgICAgICAgICBsZXQgZXJyb3IgPSBuZXcgRXJyb3IoYXBpICsgXFxcIj0+XFxcIiArIHJib2R5LmNvZGUgKyBcXFwiOlxcXCIgKyBtc2cpO1xcbiAgICAgICAgICAgIGVycm9yLmNvZGUgPSByYm9keS5jb2RlO1xcbiAgICAgICAgICAgIGVycm9yLmp1ZGdlTXNnID0gbXNnO1xcbiAgICAgICAgICAgIHRocm93IGVycm9yO1xcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICB0cnlGcmUgPSB0cnlGcmUgPT09IHVuZGVmaW5lZCA/IDEgOiB0cnlGcmU7XFxuICAgICAgICBpZiAoYWdhaW5UcnkgJiYgdHJ5RnJlID4gMCkge1xcbiAgICAgICAgICAgIGlmICh0eXBlb2YgYWdhaW5UcnkgPT09IFxcXCJmdW5jdGlvblxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbGV0IG5ld0RhdGEgPSBhZ2FpblRyeShlLCByZXN1bHQsIGJvZHksIGhlYWRlcnMsIHRyeUZyZSk7XFxuICAgICAgICAgICAgICAgIGlmIChuZXdEYXRhKSB7XFxuICAgICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKGJvZHksIG5ld0RhdGEuYm9keSk7XFxuICAgICAgICAgICAgICAgICAgICBPYmplY3QuYX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5nKCkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgdGhpcy5yZWZyZXNoQWNjZXNzQ2FsbEJhY2socmVzdWx0LCB0aGlzKTtcXG4gICAgICAgIHJldHVybiB0aGlzLmFsaVRva2VucztcXG4gICAgfSxcXG4gICAgZ2V0VXNlckluZm8oKSB7XFxuICAgICAgICBsZXQgaW5mbyA9IHBvc3RBcGkoXFxcImh0dHBzOi8vdXNlci5hbGl5dW5kcml2ZS5jb20vdjIvdXNlci9nZXRcXFwiLCB7fSwge1xcbiAgICAgICAgICAgIFxcXCJVc2VyLUFnZW50XFxcIjogUENfVUEsXFxuICAgICAgICAgICAgXFxcImF1dGhvcml6YXRpb25cXFwiOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL1xcXCJcXG4gICAgICAgIH0sIChlKSA9PiB7XFxuICAgICAgICAgICAgdGhpcy50cnlTb2x2ZShlKTtcXG4gICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUa1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gaW5mbztcXG4gICAgfSxcXG4gICAgX2dldE9wZW5Ub2tlbihjb2RlKSB7XFxuICAgICAgICBsZXQgYm9keSA9IHt9LFxcbiAgICAgICAgICAgIGhlYWRlcnMgPSB7XFxuICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxuICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS8nXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIGlmIChjb2RlKSB7XFxuICAgICAgICAgICAgYm9keSA9IHtcXG4gICAgICAgICAgICAgICAgY29kZTogY29kZSxcXG4gICAgICAgICAgICAgICAgZ3JhbnRfdHlwZTogXFxcImF1dGhvcml6YXRpb25fY29kZVxcXCJcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBib2R5ID0ge1xcbiAgICAgICAgICAgICAgICBncmFudF90eXBlOiBcXFwicmVmcmVzaF90b2tlblxcXCIsXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hfdG9rZW46IHRoaXMub3BlblRva2Vucy5SZWZyZXNoVG9rZW5PcGVuLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBqc29uID0gcG9zdCgnaHR0cHM6Ly9hcGkueGhvZmUudG9wL2FsaXN0L2FsaV9vcGVuL2NvZGUnLCB7XFxuICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShib2R5KSxcXG4gICAgICAgIH0pO1xcbiAgICAgICAgaWYgKCFqc29uKSB7XFxuICAgICAgICAgICAganNvbiA9IHBvc3QoJ2h0dHBzOi8vYXBpLWNmLm5uLmNpL2FsaXN0L2FsaV9vcGVuL2NvZGUnLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KGJvZHkpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGpzb24uaW5jbHVkZXMoJ1RvbyBNYW55IFJlcXVlc3RzJykgfHwganNvbi5pbmNsdWRlcyhcXFwiNTAyIEJhZCBHYXRld2F5XFxcIikpIHtcXG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIumikee5geivt+axguaaguaXtuiiq+WwgeemgVxcXFxuXFxcIiArIGpzb24pO1xcbiAgICAgICAgfSBlbHNlIHtcX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07XFxuICAgICAgICByZXR1cm4gdGhpcy5fZ2V0T3BlblRva2VuKGNvZGUpO1xcbiAgICB9LFxcbiAgICByZWZyZXNoT3BlblRva2VuKCkge1xcbiAgICAgICAgaWYgKHRoaXMub3BlblRva2Vucy5SZWZyZXNoVG9rZW5PcGVuICYmIHRoaXMub3BlblRva2Vucy5CaW5kUmVmcmVzaFRva2VuID09PSB0aGlzLmFsaVRva2Vucy5yZWZyZXNoX3Rva2VuKSB7XFxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuX2dldE9wZW5Ub2tlbigpO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcy5jYWNoZU9wZW5Ub2tlbigpO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICBfY2xvdWRGaWxlT3BlcmF0ZShib2R5LCBjbG91ZEZpbGVJZCwgb3BlcmF0ZVVybCkge1xcbiAgICAgICAgbGV0IHJlc3VsdCA9IHBvc3RBcGkoJ2h0dHBzOi8vYXBpLmFsaXl1bmRyaXZlLmNvbS9hZHJpdmUvdjIvYmF0Y2gnLCB7XFxuICAgICAgICAgICAgXFxcInJlcXVlc3RzXFxcIjogW3tcXG4gICAgICAgICAgICAgICAgXFxcImJvZHlcXFwiOiBib2R5LFxcbiAgICAgICAgICAgICAgICBcXFwiaGVhZGVyc1xcXCI6IHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJDb250ZW50LVR5cGVcXFwiOiBcXFwiYXBwbGljYXRpb24vanNvblxcXCJcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgXFxcImlkXFxcIjogY2xvdWRGaWxlSWQgfHwgXFxcIjBcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwibWV0aG9kXFxcIjogXFxcIlBPU1RcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwidXJsXFxcIjogb3BlcmF0ZVVybFxcbiAgICAgICAgICAgIH1dLFxcbiAgICAgICAgICAgIFxcXCJyZXNvdXJjZVxcXCI6IFxcXCJmaWxlXFxcIlxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxuICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tLycsXFxuICAgICAgICAgICAgJ2F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgLy9nZXRBY2Nlc3NUb2tlblxcbiAgICAgICAgICAgICd4LWNhbmFyeSc6ICdjbGllbnQ9d2ViLGFwcD1zaGFyZSx2ZXJzaW9uPXYyLjMuMScsXFxuICAgICAgICAgICAgJ3gtc2hhcmUtdG9rZW4nOiB0aGlzLnNoYXJlVG9rZW5cXG5cXG4gICAgICAgIH0sIChlLCByLCBiKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGUuY29kZSA9PT0gXFxcIlF1b3RhRXhoYXVzdGVkLkRyaXZlXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoIXRoaXMudHJ5U29sdmUoZSkpIHtcXG4gICAgICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMjApLnJlZnJlc2hBY2Nlc3NUb2tlbigpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgYm9keSA9IGIucmVxdWVzdHNbMF0uYm9keTtcXG4gICAgICAgICAgICBpZiAoYm9keS5kcml2ZV9pZCkge1xcbiAgICAgICAgICAgICAgICBib2R5LmRyaXZlX2lkID0gdGhpcy5kZWZEcml2ZUlkXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChib2R5LnRvX2RyaXZlX2lkKSB7XFxuICAgICAgICAgICAgICAgIGJvZHkudG9fZHJpdmVfaWQgPSB0aGlzLmRlZkRyaXZlSWRcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgYm9keTogYixcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgJ2F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgfSxcXG4gICAgY29weUZpbGVUb0Nsb3VkRmlsZShmaWxlSWQsIHJldHJ5KSB7XFxuICAgICAgICBsZXQgcmVzdWx0ID0gdGhpcy5fY2xvdWRGaWxlT3BlcmF0ZSh7XFxuICAgICAgICAgICAgXFxcImZpbGVfaWRcXFwiOiBmaWxlSWQsXFxuICAgICAgICAgICAgXFxcInNoYXJlX2lkXFxcIjogdGhpcy5zaGFyZUlkLFxcbiAgICAgICAgICAgIFxcXCJhdXRvX3JlbmFtZVxcXCI6IHRydWUsXFxuICAgICAgICAgICAgXFxcInRvX3BhcmVudF9maWxlX2lkXFxcIjogXFxcInJvb3RcXFwiLFxcbiAgICAgICAgICAgIFxcXCJ0b19kcml2ZV9pZFxcXCI6IHRoaXMuZGVmRHJpdmVJZFxcbiAgICAgICAgfSwgXFxcIjBcXFwiLCBcXFwiL2ZpbGUvY29weVxcXCIpO1xcbiAgICAgICAgbGV0IGJvZHkgPSByZXN1bHQgJiYgcmVzdWx0LnJlc3BvbnNlcyAmJiByZXN1bHQucmVzcG9uc2VzWzBdICYmIHJlc3VsdC5yZXNwb25zZXNbMF0uYm9keSB8fCB7fTtcXG4gICAgICAgIGlmICghYm9keS5maWxlX2lkICYmICFyZXRyeSkge1xcbiAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDIwKS5nZXRTaGFyZVRva2VuKCk7XFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMjApLnJl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UoZSk7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlgtU2hhcmUtVG9rZW5cXFwiOiB0aGlzLnNoYXJlVG9rZW4sXFxuICAgICAgICAgICAgICAgICAgICBcXFwiYXV0aG9yaXphdGlvblxcXCI6IHRoaXMuYWxpVG9rZW5zLmFjY2Vzc190b2tlblxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIGRvd25sb2FkSW5mby5kb3dubG9hZF91cmw7XFxuICAgIH0sXFxuICAgIGdldFNpZ24oKSB7XFxuICAgICAgICBpZiAoIXRoaXMuYWxpVG9rZW5zLmRldmljZV9pZCkge1xcbiAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDIwKS5yZWZyZXNoQWNjZXNzVG9rZW4oKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBjYWxjdWxhdGVOZXdTaWduID0gKCkgPT4ge1xcbiAgICAgICAgICAgIGxldCBzaWduID0ganVzdFRlc3RTaWduKFxcXCI1ZGRlNGUxYmRmOWU0OTY2YjM4N2JhNThmNGIzZmRjM1xcXCIsIHRoaXMuYWxpVG9rZW5zLmRldmljZV9pZCwgdGhpcy5hbGlUb2tlbnMudXNlcl9pZCkuc3BsaXQoXFxcIiMjXFxcIik7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgc2lnbmF0dXJlOiBzaWduLmF0KDApLFxcbiAgICAgICAgICAgICAgICBwdWJLZXk6IHNpZ24uYXQoLTEpXFxuICAgICAgICAgICAgfTtcXG4gICAgICAgIH07XFxuICAgICAgICBsZXQgbmV3U2lnbiA9IGNhbGN1bGF0ZU5ld1NpZ24oKTtcXG4gICAgICAgIGxldCByZXN1bHQgPSBwb3N0QXBpKCcvdXNlcnMvdjEvdXNlcnMvZGV2aWNlL2NyZWF0ZV9zZXNzaW9uJywge1xcbiAgICAgICAgICAgIFxcXCJkZXZpY2VOYW1lXFxcIjogXFxcIkVkZ2XmtY/op4jlmahcXFwiLFxcbiAgICAgICAgICAgIFxcXCJtb2RlbE5hbWVcXFwiOiBcXFwiV2luZG93c+e9kemhteeJiFxcXCIsXFxuICAgICAgICAgICAgXFxcInB1YktleVxcXCI6IG5ld1NpZ24ucHViS2V5LFxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxuICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tJyxcXG4gICAgICAgICAgICAnQXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUayxcXG4gICAgICAgICAgICAnWC1TaGFyZS1Ub2tlbic6IHRoaXMuc2hhcmVUb2tlbixcXG4gICAgICAgICAgICAneC1kZXZpY2UtaWQnOiB0aGlzLmFsaVRva2Vucy5kZXZpY2VfaWQsXFxuICAgICAgICAgICAgJ3gtc2lnbmF0dXJlJzogbmV3U2lnbi5zaWduYXR1cmVcXG4gICAgICAgIH0sIChlKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGUubWVzc2FnZSA9PT0gXFxcIngtZGV2aWNlLWlkIGVtcHR5XFxcIikge1xcbiAgICAgICAgICAgICAgICB0aGlzLndhaXRTbGVlcCgyMCkucmVmcmVzaEFjY2Vzc1Rva2VuKCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRoaXMudHJ5U29sdmUoZSk7XFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoNTApO1xcbiAgICAgICAgICAgIG5ld1NpZ24gPSBjYWxjdWxhdGVOZXdTaWduKCk7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcInB1YktleVxcXCI6IG5ld1NpZ24ucHViS2V5XFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICdBdXRob3JpemF0aW9uJzogdGhpcy5yZWFjY2Vzc1RrLFxcbiAgICAgICAgICAgICAgICAgICAgJ1gtU2hhcmUtVG9rZW4nOiB0aGlzLnNoYXJlVG9rZW4sXFxuICAgICAgICAgICAgICAgICAgICAneC1kZXZpY2UtaWQnOiB0aGlzLmFsaVRva2Vucy5kZXZpY2VfaWQsXFxuICAgICAgICAgICAgICAgICAgICAneC1zaWduYXR1cmUnOiBuZXdTaWduLnNpZ25hdHVyZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwgMyk7XFxuICAgICAgICBpZiAocmVzdWx0LnN1Y2Nlc3MpIHtcXG4gICAgICAgICAgICByZXR1cm4gbmV3U2lnbjtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCJTaWdu6I635Y+W5aSx6LSl77yM6K+36YeN6K+V44CCXFxcXG5jb2RlOlxcXCIgKyAocmVzdWx0LmNvZGUgfHwgXFxcIlxcXCIpICsgXFxcIlxcXFxubWVzc2FnZTpcXFwiICsgKHJlc3VsdC5tZXNzYWdlIHx8IFxcXCJcXFwiKSk7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIGdldFNoYXJlVmlkZW9QcmV2aWV3KGZpbGVJZCkge1xcbiAgICAgICAgbGV0IHNpZ24gPSB0aGlzLmdldFNpZ24oKTtcXG4gICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShyZXF1ZXN0KCdodHRwczovL2FwaS5hbGl5dW5kcml2ZS5jb20vdjIvZmlsZS9nZXRfc2hhcmVfbGlua192aWRlb19wcmV2aWV3X3BsYXlfaW5mbycsIHtcXG4gICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICdjb250ZW50LXR5cGUnOiAnYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04JyxcXG4gICAgICAgICAgICAgICAgXFxcIm9yaWdpblxcXCI6IFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb21cXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwicmVmZXJlclxcXCI6IFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcInVzZXItYWdlbnRcXFwiOiBcXFwiTW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzExMC4wLjAuMCBTYWZhcmkvNTM3LjM2IEVkZy8xMTAuMC4xNTg3LjQxXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcIngtY2FuYXJ5XFxcIjogXFxcImNsaWVudD13ZWIsYXBwPWFkcml2ZSx2ZXJzaW9uPXYzLjEuMFxcXCIsXFxuICAgICAgICAgICAgICAgIFxcXCJ4LXNoYXJlLXRva2VuXFxcIjogdGhpcy5zaGFyZVRva2VuLFxcbiAgICAgICAgICAgICAgICBcXFwiZmlsZWlkXFxcIjogdGhpcy5hbGlUb2tlbnMudXNlcl9pZCxcXG4gICAgICAgICAgICAgICAgJ0F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxuICAgICAgICAgICAgICAgICd4LWRldmljZS1pZCc6IHRoaXMuYWxpVG9rZW5zLmRldmljZV9pZCxcXG4gICAgICAgICAgICAgICAgJ3gtc2lnbmF0dXJlJzogc2lnbi5zaWduYXR1cmVcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIGJvZHk6IHtcXG4gICAgICAgICAgICAgICAgXFxcImNhdGVnb3J5XFxcIjogXFxcImxpdmVfdHJhbnNjb2RpbmdcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiZmlsZV9pZFxcXCI6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iR7Y29udGVudH08L2Q+XFxcXG5gO1xcbiAgICAgICAgbGV0IHBhcmFtVGV4dCA9IGNvbW1lbnQucDtcXG4gICAgICAgIGxldCBjb21tZW50VGV4dCA9IGNvbW1lbnQubTtcXG4gICAgICAgIGlmIChwYXJhbVRleHQgPT0gbnVsbCB8fCBjb21tZW50VGV4dCA9PSBudWxsKSBjb250aW51ZTtcXG4gICAgICAgIGxldCBwYXJhbXMgPSBwYXJhbVRleHQuc3BsaXQoXFxcIixcXFwiKTtcXG4gICAgICAgIGxldCBwYXJhbXNUID0gW107XFxuICAgICAgICBmb3IgKGxldCBpIGluIHBhcmFtcykge1xcbiAgICAgICAgICAgIGlmIChpID09IDMpIHtcXG4gICAgICAgICAgICAgICAgLy/popzoibLlgLzkuLow5pe277yM6buY6K6k6K6+572u5Li655m96ImyXFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXNbaV0gPT0gXFxcIjBcXFwiIHx8IHBhcmFtc1tpXSA9PSBcXFwiLTFcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBwYXJhbXNULnB1c2goXFxcIjE2Nzc3MjE1XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChpID09IDIpIHtcXG4gICAgICAgICAgICAgICAgcGFyYW1zVC5wdXNoKFxcXCIyNVxcXCIpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwYXJhbXNULnB1c2gocGFyYW1zW2ldKTtcXG5cXG4gICAgICAgIH1cXG4gICAgICAgIHBhcmFtc1QucHVzaChcXFwiMFxcXCIsIFxcXCIwXFxcIiwgXFxcIjBcXFwiKTtcXG4gICAgICAgIGRNY29udGV4dCArPSBgPGQgcD1cXFwiJHtwYXJhbXNULmpvaW4oJywnKX1cXFwiPiR7ZW5jb2RlSHRtbChjb21tZW50VGV4dCl9PC9kPlxcXFxuYDtcXG4gICA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GQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGFuaW1lLmFuaW1lVGl0bGUsXFxuICAgICAgICAgICAgZGVzYzogYW5pbWUudHlwZURlc2NyaXB0aW9uLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYXZhdGFyXFxcIixcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaXkuIvovb3ojIPlm7QoMSxcXFwiICsgYW5pbWUuZXBpc29kZXMubGVuZ3RoICsgXFxcIilcXFwiKS5pbnB1dCgoYW5pbWVUaXRsZSwgZXBpc29kZXMpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IFthLCBiXSA9IGlucHV0LnNwbGl0KC8sfO+8jC8pO1xcbiAgICAgICAgICAgICAgICBhID0gTnVtYmVyKGEpLCBiID0gTnVtYmVyKGIpO1xcbiAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKGEpIHx8IE51bWJlci5pc05hTihiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ivt+aMieagvOW8j+i+k+WFpeaVsOWtl1xcXCI7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKGEgPCAxIHx8IGIgPiBlcGlzb2Rlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/or7fovpPlhaXop4TlrprojIPlm7TlhoXnmoTmlbDlrZdcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGNvbnN0IGRhbm11ID0gJC5yZXF1aXJlKFxcXCJkYW5tdVxcXCIpO1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IGEgLSAxLCBqID0gMTsgaSA8IGI7IGkrKywgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGVwaXNvZGUgPSBlcGlzb2Rlc1tpXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZG1UaXRsZSA9IGFuaW1lVGl0bGUgKyBcXFwiX1xcXCIgKyBlcGlzb2RlLmVwaXNvZGVUaXRsZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaG93TG9hZGluZyhcXFwi5q2j5Zyo5LiL6L2977yaXFxcIiArIGVwaXNvZGUuZXBpc29kZVRpdGxlICsgXFxcIlxcXFx0KFxcXCIgKyBqICsgXFxcIi9cXFwiICsgKGIgLSBhICsgMSkgKyBcXFwiKVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhbm11LmRvd25sb2FkRGFuTXUoZXBpc29kZS5lcGlzb2RlSWQsIGRtVGl0bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2coZS50b1N0cmluZygpKTtcXG4gICAgICAgICAgICAgICAgICAgIGhpZGVMb2FkaW5nKCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5ZOm5ZOm5LiL6L295aSx6LSlLi4uXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBoaWRlTG9hZGluZygpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5LiL6L295a6M5oiQXFxcIjtcXG4gICAgICAgICAgICB9LCBhbmltZS5hbmltZVRpdGxlLCBhbmltZS5lcGlzb2RlcyksXFxuICAgICAgICAgICAgcGljX3VybDogXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbW92aWUvMTQuc3ZnXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgZm9yIChsZXQgZXBpc29kZSBvZiBhbmltZS5lcGlzb2Rlcykge1xcbiAgICAgICAgICAgIGxldCBkbVRpdGxlID0gYW5pbWUuYW5pbWVUaXRsZSArIFxcXCJfXFxcIiArIGVwaXNvZGUuZXBpc29kZVRpdGxlO1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBlcGlzb2RlLmVwaXNvZGVUaXRsZSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVwaXNvZGUuZXBpc29kZUlkKS5sYXp5UnVsZSgodXJsLCB0aXRsZSwgb25seURvd25sb2FkKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBjb25zdCBkYW5tdSA9ICQucmVxdWlyZShcXFwiZGFubXVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXRoID0gZGFubXUuZ2V0TG9jYWxEYW5NdShpbnB1dCwgdGl0bGUpIHx8IGRhbm11LmRvd25sb2FkRGFuTXUoaW5wdXQsIHRpdGxlKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChvbmx5RG93bmxvYWQpIHJldHVybiBcXFwidG9hc3Q6Ly/kuIvovb3lrozmiJBcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRhbm11VGV4dCA9IGZldGNoKHBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFkYW5tdVRleHQpIHJldHVybiBcXFwidG9hc3Q6Ly/ov5jmsqHmnInlvLnluZXlk59+XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hWaWRlb1VybCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGFubXU6IHBhdGhcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgYmFjayhmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yqg6L295a6M5oiQXFxcIjtcXG4gICAgICAgICAgICAgICAgfSwgTVlfUEFSQU1TLmR1cmwsIGRtVGl0bGUsIG9ubHlEb3dubG9hZCksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuW8uuWItuS4i+i9vVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGVwaXNvZGVUaXRsZSwgZXBpc29kZUlkKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dMb2FkaW5nKFxcXCLor7fnrYnlvoVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgZGFubXUgPSAkLnJlcXVpcmUoXFxcImRhbm11XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhbm11LmRvd25sb2FkRGFuTXUoZXBpc29kZUlkLCBlcGlzb2RlVGl0bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWRlTG9hZGluZygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6YeN5paw5LiL6L295a6M5oiQ77yM5Y2V5Ye75oyC6L2944CCXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBkbVRpdGxlLCBlcGlzb2RlLmVwaXNvZGVJZClcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIlxcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgaWYgKCFkbUxpc3QuYW5pbWVzLmxlbmd0aCkge1xcbiAgICAgICA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cIixcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgYmFzaWNVcmwgPSBcXFwiaHR0cHM6Ly93d3cueXVuc28ubmV0XFxcIjtcXG4gICAgICAgICAgICBsZXQgYXBpID0gXFxcIi9hcGkvdmFsaWRhdGUvc2VhcmNoP3dkPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQocykgKyBcXFwiJm1vZGU9OTAwMDEmc3R5cGU9MjAxMDAmdWs9JnBhZ2U9XFxcIiArIHBhZ2UgKyBcXFwiJmxpbWl0PTIwJnNjcmVlbl9maWxldHlwZT11bmRlZmluZWRcXFwiO1xcbiAgICAgICAgICAgIGxldCBqc29uID0gcG9zdChiYXNpY1VybCArIGFwaSwge1xcbiAgICAgICAgICAgICAgICBib2R5OiBcXFwiZGF0YT1cXFwiICsgYXBpLFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBSZWZlcmVyOiBcXFwiaHR0cHM6Ly93d3cueXVuc28ubmV0L2luZGV4L3VzZXIvcz93ZD1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KHMpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IEpTT04ucGFyc2UoanNvbikuZGF0YTtcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IHBkZmEoaHRtbCwgXFxcImJvZHkmJi5sYXl1aS1jYXJkOmhhcyhhKVxcXCIpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaXRlbSBvZiBsaXN0KSB7XFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IHBkZmgoaXRlbSwgXFxcImEmJlRleHRcXFwiKS5yZXBsYWNlKFxcXCIj5paH5Lu25aS5IFxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpbWUgPSAvXFxcXGR7NH0oLVxcXFxkezJ9KXsyfSBcXFxcZHsyfShcXFxcOlxcXFxkezJ9KXsyfS8uZXhlYyhwZGZoKGl0ZW0sIFxcXCIubGF5dWktY2FyZC1ib2R5JiZUZXh0XFxcIikpIHx8IFtdO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogdGltZVswXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYmFzZTY0RGVjb2RlKHBkZmgoaXRlbSwgXFxcImEmJnVybFxcXCIpKVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLmt7flkIjnm5hcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9hcGkuaHVuaGVwYW4uY29tL3YxL3NlYXJjaFxcXCI7XFxuICAgICAgICAgICAgbGV0IGpzb24gPSBwb3N0KHVybCwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBSZWZlcmVyOiBcXFwiaHR0cHM6Ly9odW5oZXBhbi5jb20vXFxcIlxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICBcXFwicVxcXCI6IHMsXFxuICAgICAgICAgICAgICAgICAgICBcXFwicGFnZVxcXCI6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICBcXFwic2l6ZVxcXCI6IDE1XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UoanNvbik7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBqc29uLmRhdGEubGlzdDtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBsaXN0W2ldO1xcbiAgICAgICAgICAgICAgICBpZiAoaXQuZGlza190eXBlICE9PSBcXFwiQUxZXFxcIiB8fCBpdC5zaGFyZV91c2VyID09PSBcXFwi5Li2Kioq5Li2XFxcIikgY29udGludWU7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXQuZGlza19uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogcGQoaXQsIFxcXCJpbWcmJnNyY1xcXCIsIHVybCksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGl0LmxpbmssXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBpdC51cGRhdGVfdGltZSArIFxcXCJcXFxcblxcXCIgKyBpdC5saW5rLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIG5hbWU6IFxcXCLotYTmupDluK5cXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQocywgcGFnZSkge1xcbiAgICAgICAgICAgIGZ1bmN0aW9uIHNlYXJjaCgpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ0bkxpc3QgPSBbXTtcXG4gICAgICAgICAgICAgICAgbGV0IHJlc3AgPSByZXF1ZXN0KFxcXCJodHRwczovL3p5Yi51cHl1bnNvLmNvbS92MTUvc2VhcmNoP2tleXdvcmQ9XFxcIiArIGVuX2FlcyhzKSArIFxcXCImc190eXBlPTImcGFnZT1cXFwiICsgcGFnZSArIFxcXCImYXRrPSZkaWQ9XFxcIiArIGdlbmVyYXRlUmFuZG9tSGV4U3RyaW5nKDY0KSwge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJ1c2VyLWFnZW50XFxcIjogXFxcIk1vemlsbGEvNS4wIChMaW51eDsgQW5kcm9pZCAxMDsgUmVkbWkgTm90ZSA3IEJ1aWxkL1FLUTEuMTkwOTEwLjAwMjsgd3YpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIFZlcnNpb24vNC4wIENocm9tZS84MS4wLjQwNDQuMTM4IE1vYmlsZSBTYWZhcmkvNTM3LjM2IHVuaS1hcHAgSHRtbDVQbHVzLzEuMCAoSW1tZXJzZWQvMjkuMDkwOTEpXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBsZXQgcmVzcERhdGEgPSBkZV9hZXMocmVzcCk7XFxuICAgICAgICAgICAgICAgIGxldCBqc29uRGF0YSA9IEpTT04ucGFyc2UocmVzcERhdGEpIHx8IHt9O1xcbiAgICAgICAgICAgICAgICBsZXQgcmVzdWx0ID0ganNvbkRhdGEucmVzdWx0IHx8IHt9O1xcbiAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSByZXN1bHQuaXRlbXMgfHwgW107XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGl0ZW1zLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgaXRlbSA9IGl0ZW1zW2ldO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvbnRlbnQgPSBpdGVtLmNvbnRlbnQgfHwgW107XFxuICAgICAgICAgICAgICAgICAgICBpZiAoY29udGVudC5sZW5ndGggPT0gMHx8IWl0ZW0ucGFnZV91cmwpIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9IGRlX2FlcyhpdGVtLnBhZ2VfdXJsKSB8fCBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghdXJsKSBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgICAgIHJ0bkxpc3QucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IChpdGVtLnRpdGxlLmxlbmd0aD4zMD9pdGVtLnRpdGxlLnNsaWNlKDAsMjcpK1xcXCIuLi5cXFwiOml0ZW0udGl0bGUpIHx8IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCLliIbkuqvml7bpl7TvvJpcXFwiK2l0ZW0uaW5zZXJ0X3RpbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIHJldHVybiBydG5MaXN0O1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBnZW5lcmF0ZVJhbmRvbUhleFN0cmluZyhsZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlc3VsdCA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICBjb25zdCBjaGFyYWN0ZXJzID0gXFxcIjAxMjM0NTY3ODlhYmNkZWZcXFwiO1xcbiAgICAgICAgICAgICAgICBjb25zdCBjaGFyYWN0ZXJzTGVuZ3RoID0gY2hhcmFjdGVycy5sZW5ndGg7XFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIHJlc3VsdCArPSBjaGFyYWN0ZXJzLmNoYXJBdChNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBjaGFyYWN0ZXJzTGVuZ3RoKSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGFsaVV0aWwgPSAkLnJlcXVpcmUoXFxcImFsaVV0aWxcXFwiKTtcXG4gICAgICAgICAgICBsZXQgQ3J5cHRvSlMgPSBhbGlVdGlsLmdldENyeXB0b0pTKCk7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gZW5fYWVzKGUpIHtcXG4gICAgICAgICAgICAgICAgbGV0IGkgPSBcXFwicXExOTIwNTIwNDYwcXF6elxcXCI7XFxuICAgICAgICAgICAgICAgIC8vIGVuX2Flc1xcbiAgICAgICAgICAgICAgICBsZXQga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoaSk7XFxuICAgICAgICAgICAgICAgIHZhciB0ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoZSksXFxuICAgICAgICAgICAgICAgICAgICByID0gQ3J5cHRvSlMuQUVTLmVuY3J5cHQodCwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXY6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gci5jaXBoZXJ0ZXh0LnRvU3RyaW5nKCk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGRlX2Flcyh2dikge1xcbiAgICAgICAgICAgICAgICBsZXQgaSA9IFxcXCJxcTE5MjA1MjA0NjBxcXp6XFxcIjtcXG4gICAgICAgICAgICAgICAgLy8gZGVfYWVzXFxuICAgICAgICAgICAgICAgIGxldCBrZXkgPSBDcnlwdG9KUy5lbmMuVXRmOC5wYXJzZShpKTtcXG4gICAgICAgICAgICAgICAgbGV0IGhleFZhbCA9IENyeXB0b0pTLmVuYy5IZXgucGFyc2UodnYpLFxcbiAgICAgICAgICAgICAgICAgICAgdmFsID0gQ3J5cHRvSlMuZW5jLkJhc2U2NC5zdHJpbmdpZnkoaGV4VmFsKSxcXG4gICAgICAgICAgICAgICAgICAgIGRlY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHZhbCwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaXY6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gZGVjcnlwdGVkLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHNlYXJjaCgpO1xcbiAgICAgICAgfVxcbiAgICB9LCB7XFxuICAgICAgICBuYW1lOiBcXFwi5LqR55uY6LWE5rqQXFxcIixcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXCJodHRwczovL3Jlcy55dW5wYW4ud2luLz9QYWdlSW5kZXg9XFxcIiArIHBhZ2UgKyBcXFwiJlBhZ2VTaXplPTEyJktleXdvcmQ9XFxcIiArIHMgKyBcXFwiJlR5cGU9JlRhZz1cXFwiO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly9yZXMueXVucGFuLndpbi9cXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFwibWFpbiYmLmNhcmRcXFwiKTtcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBkZmgoaXQsIFxcXCIuY2FyZC1saW5rLDEmJm9uY2xpY2tcXFwiKS5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICAgICAgdSA9IHUubGVuZ3RoID4gMCA/IHVbMF0gOiB1cmw7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdCwgXFxcIi5jYXJkLXRpdGxlJiZUZXh0XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBwZChpdCwgXFxcImltZyYmc3JjXFxcIiwgdXJsKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBkZmgoaXQsIFxcXCIuY2FyZC10ZXh0LC0xJiZUZXh0XFxcIikgKyBcXFwiXFxcXG5cXFwiICsgdSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiBcXFwiVVDkupHmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcImh0dHBzOi8vYXBpLnVweXVuc28yLmNvbS9zZWFyY2g/a2V5d29yZD1cXFwiICsgcyArIFxcXCImcGFnZT1cXFwiICsgcGFnZSArIFxcXCImc190eXBlPTFcXFwiO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cudXB5dW5zby5jb21cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IFxcXCJjb2RlPTE5MTlcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAvL2xvZyhiYXNlNjREZWNvZGUoaHRtbCkpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGJhc2U2NERlY29kZShodG1sKSkucmVzdWx0Lml0ZW1zO1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBpZiAoIWFycikgcmV0dXJuIFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC5wYWdlX3VybDtcXG4gICAgICAgICAgICAgICAgLy91ID0gdS5sZW5ndGggPiAwID8gdVswXSA6IHVybDtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIlxcXFxuXFxcIiArICh1KSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiBcXFwi54yr54u455uY5pCcXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbS9zZWFyY2g/az1cXFwiICsgcywge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3d3dy5hbGlwYW5zb3UuY29tL3NlYXJjaD9rPVxcXCIgKyBzXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFwiI2FwcCYmYVxcXCIpO1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBcXFwiPGRpdj5cXFwiICsgYXJyW2ldICsgXFxcIjwvZGl2PlxcXCI7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGRmaChpdCwgXFxcImEmJmhyZWZcXFwiKTtcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxuICAgICAgICAgICAgICAgIGlmICghdS5pbmNsdWRlcyhcXFwiL3MvXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHUgPSBcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbVxcXCIgKyB1LnJlcGxhY2UoXFxcIi9zL1xcXCIsIFxcXCIvY3YvXFxcIik7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdCwgXFxcInRlbXBsYXRlJiZUZXh0XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBwZGZoKGl0LCBcXFwidGVtcGxhdGUsMSYmVGV4dFxcXCIpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChpbnB1dCwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogXFxcIm5vX3Nob3dfZG9uYXRlPTFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBpbnB1dC5yZXBsYWNlKFxcXCIvY3YvXFxcIiwgXFxcIi9zL1xcXCIpXFxuICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIHJlZGlyZWN0OiBmYWxzZVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGh0bWwgPSBwYXJzZURvbUZvckh0bWwoaHRtbCwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICBpZiAoaHRtbC5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBodG1sO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBpbnB1dDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLmmJPmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgYWxpVXRpbCA9ICQucmVxdWlyZShcXFwiYWxpVXRpbFxcXCIpO1xcbiAgICAgICAgICAgIGxldCBDcnlwdG9KUyA9IGFsaVV0aWwuZ2V0Q3J5cHRvSlMoKTtcXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBrZXllbihzdHIpIHtcXG4gICAgICAgICAgICAgICAgdmFyIGtleSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXCI0T1RvU2NVRk9hZVZUckhFXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBpdiA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKFxcXCI5Q0xHYW8xdkhLcW0xN096XFxcIik7XFxuICAgICAgICAgICAgICAgIHZhciBlbmNyeXB0ZWQgPSBDcnlwdG9KUy5BRVMuZGVjcnlwdCh7XFxuICAgICAgICAgICAgICAgICAgICBjaXBoZXJ0ZXh0OiBDcnlwdG9KUy5lbmMuQmFzZTY0LnBhcnNlKHN0cilcXG4gICAgICAgICAgICAgICAgfSwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICBpdjogaXYsXFxuICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXG4gICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IENyeXB0b0pTLnBhZC5Qa2NzN1xcbiAgICAgICAgICAgICAgICB9KS50b1N0cmluZyhDcnlwdG9KUy5lbmMuVXRmOCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBlbmNyeXB0ZWQ7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChcXFwiaHR0cHM6Ly95aXNvLmZ1bi9hcGkvc2VhcmNoP25hbWU9XFxcIiArIHMgKyBcXFwiJnBhZ2VObz1cXFwiICsgcGFnZSwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3lpc28uZnVuL2luZm8/c2VhcmNoS2V5PVxcXCIgKyBzLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IGdldEl0ZW0oJ3lpc291Y29va2UnLCAnJylcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIC8vbG9nKGh0bWwpO1xcbiAgICAgICAgICAgIGlmIChodG1sLmluY2x1ZGVzKCfnmbvlvZXnlKjmiLfml6DpmZDliLYnKSkge1xcbiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XFxuICAgICAgICAgICAgICAgIGRvIHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0eWltZ2xpbiA9ICdodHRwczovL3lpc28uZnVuL2FwaS91c2VyL2xvZ2luL2NhcHRjaGE/dD0nICsgcGFyc2VJbnQobmV3IERhdGUoKS5nZXRUaW1lKCkpICsgJyc7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgaW1nID0gY29udmVydEJhc2U2NEltYWdlKHR5aW1nbGluKS5zcGxpdCgnLCcpWzFdO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNvZCA9IHJlcXVlc3QoJ2h0dHBzOi8vYXBpLnhob2ZlLnRvcC9vY3IvYjY0L3RleHQnLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29udGVudC1UeXBlJzogJ3RleHQvcGxhaW4nXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBpbWcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHZlciA9IEpTT04ucGFyc2UocmVxdWVzdCgnaHR0cHM6Ly95aXNvLmZ1bi9hcGkvdXNlci9sb2dpbicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LXR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdyZWZlcmVyJzogJ2h0dHBzOi8veWlzby5mdW4vbG9naW4nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29va2llJzogZ2V0Q29va2llKHR5aW1nbGluKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwidXNlck5hbWVcXFwiOiBcXFwidHZib3gyMDIzXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcInBhc3N3b3JkXFxcIjogXFxcIlR2Ym94MjAyM1xcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJjb2RlXFxcIjogY29kXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHZlci5jb2RlID09IDIwMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZygn5piT5pCc55m75YWl6aqM6K+B5oiQ5YqfJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbSgneWlzb3Vjb29rZScsIGdldENvb2tpZSgnaHR0cHM6Ly95aXNvLmZ1bicpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBodG1sID0gcmVxdWVzdChcXFwiaHR0cHM6Ly95aXNvLmZ1bi9hcGkvc2VhcmNoP25hbWU9XFxcIiArIHMgKyBcXFwiJnBhZ2VObz1cXFwiICsgcGFnZSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwiUmVmZXJlclxcXCI6IFxcXCJodHRwczovL3lpc28uZnVuL2luZm8/c2VhcmNoS2V5PVxcXCIgKyBzLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcIkNvb2tpZVxcXCI6IGdldEl0ZW0oJ3lpc291Y29va2UnLCAnJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaSsrO1xcbiAgICAgICAgICAgICAgICB9IHdoaWxlIChpIDwgNCk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmRhdGEubGlzdDtcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IGtleWVuKGl0LnVybCk7XFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcbiAgICAgICAgICAgICAgICBpZiAodSA9PSBudWxsIHx8ICF1LmluY2x1ZGVzKFxcXCJhbGl5dW5cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogKGl0LmdtdFNoYXJlIHx8IGl0LmdtdENyZWF0ZSkgKyBcXFwiXFxcXG5cXFwiICsgKHUpLFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLmib7otYTmupBcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBmdW5jdGlvbiBnZXRodG1sKCkge1xcbiAgICAgICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoXFxcImh0dHBzOi8vemhhb3ppeXVhbi5tZS9zbz9maWxlbmFtZT1cXFwiICsgcyArIFxcXCImcGFnZT1cXFwiICsgcGFnZSwge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vemhhb3ppeXVhbi5tZS9zdG9wLmh0bWxcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJvcmlnaW5cXFwiOiBcXFwiaHR0cHM6Ly96aGFveml5dWFuLm1lXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogZ2V0SXRlbShcXFwienp5Y29va2VcXFwiLCBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcInVwZ3JhZGUtaW5zZWN1cmUtcmVxdWVzdHNcXFwiOiBcXFwiMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcImNvbnRlbnQtdHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWRcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gaHRtbDtcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIHZhciBodG1sID0gZ2V0aHRtbCgpO1xcbiAgICAgICAgICAgIGlmICghaHRtbC5pbmNsdWRlcyhcXFwic2VhcmNoX2JveFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgIGxldCB1c2VyID0gJ2RYTmxjbTVoYldVOWVYQnFNakF5TXlad1lYTnpkMjl5WkQxNWNHb3lNREl6JztcXG4gICAgICAgICAgICAgICAgbGV0IGNvb2sgPSBKU09OLnBhcnNlKGZldGNoQ29va2llKCdodHRwczovL3poYW96aXl1YW4ubWUvbG9naXUuaHRtbCcsIHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAnVXNlci1BZ2VudCc6IE1PQklMRV9VQSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQ29udGVudC1UeXBlJzogJ2FwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCcsXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ09yaWdpbic6ICdodHRwczovL3poYW96aXl1YW4ubWUnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vemhhb3ppeXVhbi5tZS9sb2dpbi5odG1sJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwidXBncmFkZS1pbnNlY3VyZS1yZXF1ZXN0c1xcXCI6IFxcXCIxXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IGJhc2U2NERlY29kZSh1c2VyKSxcXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnLFxcbiAgICAgICAgICAgICAgICAgICAgb25seUhlYWRlcnM6IHRydWUsXFxuICAgICAgICAgICAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZVxcbiAgICAgICAgICAgICAgICB9KSkuam9pbignOycpO1xcbiAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJ6enljb29rZVxcXCIsIGNvb2spO1xcbiAgICAgICAgICAgICAgICBsb2coXFxcIuaJvui1hOa6kOeZu+WFpVxcXCIpO1xcbiAgICAgICAgICAgICAgICBodG1sID0gZ2V0aHRtbCgpO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFwiYm9keSYmLm5ld3NMaXN0JiZsaTpub3QoOmZpcnN0LWNoaWxkKVxcXCIpO1xcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGRmaChpdCwgXFxcImEmJmhyZWZcXFwiKTtcXG4gICAgICAgICAgICAgICAgaWYgKHUgPT0gbnVsbCkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdSA9IFxcXCJodHRwczovL3poYW96aXl1YW4ubWUvXFxcIiArIHU7XFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcbiAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBwZGZoKGl0LCBcXFwiLm5ld3NfdGV4dCYmaDMmJlRleHRcXFwiKTtcXG4gICAgICAgICAgICAgICAgaWYgKCF0aXRsZSkgY29udGludWU7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBwZGZoKGl0LCBcXFwiLm5ld3NfdGV4dCYmcCYmVGV4dFxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH0sXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0KTtcXG4gICAgICAgICAgICB2YXIgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG5cXG4gICAgICAgICAgICBpZiAoX2xpbmtzLmxlbmd0aCA+IDApIHtcXG5cXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9saW5rc1swXTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5wdXQ7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiBcXFwi5bCP57q45p2hXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCBhbGlVdGlsID0gJC5yZXF1aXJlKFxcXCJhbGlVdGlsXFxcIik7XFxuXFxuICAgICAgICAgICAgZnVuY3Rpb24gZ2V0dG9rZW4oKSB7XFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcigneHp5dG9rZW4nLCAnJykubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0b2tlbiA9IEpTT04ucGFyc2UocG9zdCgnaHR0cHM6Ly9naXRjYWZlLm5ldC90b29sL2FsaXBhcGVyLycsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vdS5naXRjYWZlLmluay8nXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFjdGlvbjogJ2dldF90b2tlbidcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9KSkuZGF0YTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCd4enR0b2tlbicsIHRva2VuKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gZ2V0TXlWYXIoJ3h6dHRva2VuJywgJycpO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBmdW5jdGlvbiBjYXRfY29kZShhKSB7XFxuICAgICAgICAgICAgICAgIHZhciBkLCBlLCBiID0gW1xcXCLljY7or63nlLXop4ZcXFwiLCBcXFwi5pel6Z+p55S16KeGXFxcIiwgXFxcIuasp+e+jueUteinhlxcXCIsIFxcXCLlhbbku5bnlLXop4ZcXFwiLCBcXFwi5Y2O6K+t55S15b2xXFxcIiwgXFxcIuaXpemfqeeUteW9sVxcXCIsIFxcXCLmrKfnvo7nlLXlvbFcXFwiLCBcXFwi5YW25LuW55S15b2xXFxcIiwgXFxcIuWNjuivreWKqOa8q1xcXC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tmcmpcXFwiLCBcXFwieHRyalxcXCIsIFxcXCJ3bHJqXFxcIiwgXFxcImJncmpcXFwiLCBcXFwicXRyalxcXCIsIFxcXCJtaFxcXCIsIFxcXCJ4c1xcXCIsIFxcXCJjYnNcXFwiLCBcXFwienNweFxcXCIsIFxcXCJxdHdkXFxcIiwgXFxcImJ6XFxcIiwgXFxcInJ3XFxcIiwgXFxcImZqXFxcIiwgXFxcInF0dHBcXFwiLCBcXFwicXRcXFwiXTtcXG4gICAgICAgICAgICAgICAgZm9yIChkID0gMCwgZSA9IGMubGVuZ3RoOyBlID4gZDsgZCsrKVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNbZF0gPT0gYSkgcmV0dXJuIGJbZF07XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBwb3N0KFxcXCJodHRwczovL2dpdGNhZmUubmV0L3Rvb2wvYWxpcGFwZXIvXFxcIiwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3UuZ2l0Y2FmZS5pbmsvJ1xcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICBhY3Rpb246IFxcXCJzZWFyY2hcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbTogXFxcIndlYlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB0b2tlbjogZ2V0dG9rZW4oKSxcXG4gICAgICAgICAgICAgICAgICAgIGtleXdvcmQ6IHNcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpO1xcbiAgICAgICAgICAgIGlmIChsaXN0LmRhdGEpIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGxpc3QuZGF0YTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGxpc3RbaV1cXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXQudGl0bGU7XFxuICAgICAgICAgICAgICAgIGxldCBtdXJsID0gJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zLycgKyBpdC5hbGlrZXlcXG4gICAgICAgICAgICAgICAgaWYgKCFhbGlVdGlsLmNoZWNrYWxpKG11cmwpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAodGl0bGUuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLiiJogXFxcIiArIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGNhdF9jb2RlKGl0LmNhdCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzOiBpdC5kZXNcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbXVybFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLnjqnlgbblk6Xlk6VcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcImh0dHA6Ly93b2dnLnh5ei9pbmRleC5waHAvdm9kc2VhcmNoL1xcXCIgKyBzICsgXFxcIi0tLS0tLS0tLS1cXFwiICsgcGFnZSArIFxcXCItLS0uaHRtbFxcXCI7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCwge30pO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcubW9kdWxlLWl0ZW1zJiYubW9kdWxlLXNlYXJjaC1pdGVtJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1dGl0bGUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdoMyYmYSYmVGV4dCcpO1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy52aWRlby1zZXJpYWwmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgbGV0IHVpbWFnZSA9IHBhcnNlRG9tKGl0LCAnLmxhenlsb2FkJiZkYXRhLXNyYycsICdodHRwOi8vd29nZy54eXovJyk7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGFyc2VEb20oaXQsICdoMyYmYSYmaHJlZicsICdodHRwOi8vd29nZy54eXovJyk7XFxuICAgICAgICAgICAgICAgIC8vbGV0IGRldCA9IHJlcXVlc3QodSwge30pO1xcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHVpbWFnZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHVzZXJpYWxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChiZXQubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICBsZXQgYmV0aCA9IGJhdGNoRmV0Y2goYmV0KTtcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBiZXRoLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IHBhcnNlRG9tRm9yQXJyYXkoYmV0aFtpXSwgJy5tb2R1bGUtcGxheWVyLWxpc3QmJnAnKVxcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ3AmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXUuaW5jbHVkZXMoXFxcIi9zL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYmV0W2ldLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBiZXRbaV0uaW1hZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogYmV0W2ldLmRlc2MgKyAnXFxcXG4nICsgdSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIumYv+mHjOS6keebmOe9kVxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly93d3cuYWx5cHcuY24vc2VhcmNoLnBocD9xPVxcXCIgKyBzICsgXFxcIiZwYWdlPVxcXCIgKyBwYWdlO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHt9KTtcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGFyc2VEb21Gb3JBcnJheShodG1sLCAnLmxpc3QmJmxpJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1dGl0bGUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhJiZ0aXRsZScpO1xcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5mYS1jbG9jay1vJiZUZXh0Jyk7XFxuICAgICAgICAgICAgICAgIGxldCB1aW1hZ2UgPSBwYXJzZURvbShpdCwgJ2ltZyYmc3JjJywgJ2h0dHBzOi8vd3d3LmFseXB3LmNuLycpO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tKGl0LCAnYSYmaHJlZicsICdodHRwczovL3d3dy5hbHlwdy5jbi8nKTtcXG4gICAgICAgICAgICAgICAgLy9sZXQgZGV0ID0gcmVxdWVzdCh1LCB7fSk7XFxuICAgICAgICAgICAgICAgIGlmICghdXRpdGxlLmluY2x1ZGVzKHMpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHVpbWFnZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHVzZXJpYWxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIC8vbG9nKGJldCk7XFxuICAgICAgICAgICAgaWYgKGJldC5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIGxldCBiZXRoID0gYmF0Y2hGZXRjaChiZXQpO1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJldGgubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShiZXRoW2ldLCAnYm9keSYmYVtocmVmXj1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9dJylcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGxpc3QpO1xcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYmV0W2ldLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBiZXRbaV0uaW1hZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogYmV0W2ldLmRlc2MgKyAnXFxcXG4nICsgdSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIuWcn+aLqOm8oFxcXCIsXFxuICAgICAgICBwYWdlOiBmYWxzZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IGZldGNoKCdodHRwczovL3d3dy50YnNkeS5jb20vc2VhcmNoLmh0bWw/a2V5d29yZD0nICsgcyArICcmY2F0ZWdvcnk9OTgzOTIwJmRhdGFfdHlwZT05ODc5MTAnLCB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUFcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuc2VhcmNoX3Jlc3VsdF9uZXRkaXNrX2xpc3QmJmEnKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgLy9sb2coaXQpO1xcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2EmJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5uZXRkaXNrX2l0ZW1fZGV0YWlsX25hbWUmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgaWYgKCF0aXQuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdCxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCJcXFxcblxcXCIgKyB1LFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLpmL/ph4zmkJxcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCgnaHR0cHM6Ly9hbGlzby5jYy9zLycgKyBzICsgJy0nICsgcGFnZSArICctMC5odG1sJywge30pO1xcblxcbiAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShodG1sLCAnLnNlYXJjaC1yZXN1bHQmJi5yZXNvdXJjZS1pdGVtJyk7XFxuICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgIGxldCB1ID0gbGlzdFtqXTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdCA9IHBhcnNlRG9tRm9ySHRtbCh1LCAnaDMmJlRleHQnKTtcXG4gICAgICAgICAgICAgICAgaWYgKCF0aXQuaW5jbHVkZXMocykpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBwYXJzZURvbSh1LCAnaDMmJmEmJmhyZWYnLCAnaHR0cHM6Ly9hbGlzby5jYy8nKSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBhcnNlRG9tRm9ySHRtbCh1LCAnLnRpbWUmJlRleHQnKSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGZpbmRBbGlVcmwoaW5wdXQpIHtcXG4gICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcblxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGRlY3J5KHN0cikge1xcbiAgICAgICAgICAgICAgICB2YXIga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoXFxcIjlFQjIwRERGRDZBRkJENjhcXFwiKTtcXG4gICAgICAgICAgICAgICAgdmFyIGVuY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHN0ciwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICBpdjoga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsXFxuICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiBDcnlwdG9KUy5wYWQuUGtjczdcXG4gICAgICAgICAgICAgICAgfSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xcbiAgICAgICAgICAgICA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AgICAgICAgICAgICAgICAgcGFkZGluZzogQ3J5cHRvSlMucGFkLlBrY3M3XFxuICAgICAgICAgICAgICAgIH0pLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVuY3J5cHRlZDtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KCdodHRwczovL3d3dy55dW5wYW5mZW54aWFuZy5jbi9hcGkvYmJzL2FwaS9nZXRkYXRhP2tleT0nICsgcyArICcmdHlwZT12aWRlbycsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly93d3cueXVucGFuZmVueGlhbmcuY24vXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IGpzb24gPSBkZWNyeShKU09OLnBhcnNlKGh0bWwpLmRhdGEpO1xcbiAgICAgICAgICAgIC8vbG9nKGpzb24pO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGpzb24pOyAvL1swXS5yZXN1bHQuaXRlbXM7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG5cXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBiZXQgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBpdC5waWQ7XFxuICAgICAgICAgICAgICAgIGJldC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL2FwaS9iYnMvYXBpL2dldGFydGljbGU/aWQ9JyArIHVybCxcXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAvL2xvZyh1KTtcXG4gICAgICAgICAgICBsZXQgYmV0aCA9IGJhdGNoRmV0Y2goYmV0KTtcXG5cXG4gICAgICAgICAgICAvL2xvZyhhcnRpY2xlKTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJldGgubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKGJldGhbaV0pLmRhdGE7XFxuICAgICAgICAgICAgICAgIC8vbG9nKGpzb24pO1xcbiAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IGpzb24uZG93bmxvYWQuc3BsaXQoJ0AnKTtcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaiA9IDA7IGogPCBsaXN0Lmxlbmd0aDsgaisrKSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgdSA9IGxpc3Rbal07XFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBqc29uLnRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJ2h0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zLycgKyB1LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGpzb24uY3JlYXRldGltZSArIFxcXCJcXFxcblxcXCIgKyAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvJyArIHUsXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAge1xcbiAgICAgICAgbmFtZTogXFxcIuebmOaQnFxcXCIsXFxuICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIHBhZ2UgPSAocGFnZSAtIDEpICogMTA7XFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXCJodHRwczovL3d3dy5wYW5zZWFyY2gubWUvc2VhcmNoP2tleXdvcmQ9XFxcIiArIHMgKyBcXFwiJm9mZnNldD1cXFwiICsgcGFnZSArIFxcXCImcGFuPWFsaXl1bmRyaXZlXFxcIjtcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7fSk7XFxuXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgJy5ncmlkJiYuc2hhZG93OmhhcyhhW2hyZWZePWh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL10pJyk7XFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhW2hyZWZePWh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9zL10mJmhyZWYnKTtcXG4gICAgICAgICAgICAgICAgbGV0IHBpY191cmwgPSBwYXJzZURvbUZvckh0bWwoaXQsICdpbWcmJnNyYycpO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5icmVhay1hbGwmJlRleHQnKS5zcGxpdCgnaHR0cCcpWzBdLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogcGljX3VybCA9PT0gXFxcIi9mYXZpY29uLnBuZ1xcXCIgPyBcXFwiaHR0cHM6Ly93d3cucGFuc2VhcmNoLm1lL1xcXCIgKyBwaWNfdXJsIDogcGljX3VybCxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBhcnNlRG9tRm9ySHRtbChpdCwgJ3AmJlRleHQnKSArIFxcXCJcXFxcblxcXCIgKyB1LFxcbiAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCJET1ZY5pCcXFxcIixcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFwiaHR0cHM6Ly9hcGkuZG92eC50ay9hbGkvc2VhcmNoP3dkPVxcXCIgKyBzO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwpO1xcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmxpc3Q7XFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXG4gICAgICAgICAgICBsZXQgYWxpVXRpbCA9ICQucmVxdWlyZShcXFwiYWxpVXRpbFxcXCIpO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC52b2RfY29udGVudDtcXG4gICAgICAgICAgICAgICAgaWYgKCF1LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpIHx8ICFhbGlVdGlsLmNoZWNrYWxpKHUpKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLiiJogXFxcIiArIGl0LnZvZF9uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaXQudm9kX3BpYyxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXCJcXFxcblxcXCIgKyB1LFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9XFxuICAgIH0sXFxuICAgIHtcXG4gICAgICAgIG5hbWU6IFxcXCLlv4XlupRcXFwiLFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcImh0dHBzOi8vY24uYmluZy5jb20vc2VhcmNoP3E9XFxcIiArIHMgKyBcXFwiK2FsaXl1bmRyaXZlJnFzPWRzJmZvcm09UUJSRVxcXCI7XFxuICAgICAgICAgICAgaWYgKHBhZ2UgIT0gMSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBnZXRNeVZhcihcXFwiYmluZ1xcXCIsIHVybCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICA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CJuZXh0IHBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHUyKTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJiaW5nXFxcIiwgdTIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwgfHwgdCA9PSBudWxsIHx8ICFpdC5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKCFpdC5pbmNsdWRlcyhcXFwi572R55uYXFxcIikgJiYgIWl0LmluY2x1ZGVzKFxcXCLkupHnm5hcXFwiKSAmJlxcbiAgICAgICAgICAgICAgICAgICAgIWl0LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpICYmICFpdC5pbmNsdWRlcyhcXFwieXVucGFuXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh1LnN0YXJ0c1dpdGgoXFxcImh0dHBzOi8vY24uYmluZy5jb20vXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxldCBkb20gPSBnZXRIb21lKHUpLnJlcGxhY2UoXFxcImh0dHA6Ly9cXFwiLCBcXFwiXFxcIikucmVwbGFjZShcXFwiaHR0cHM6Ly9cXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCBfbGlua3MgPSB0Lm1hdGNoKC9odHRwczpcXFxcL1xcXFwvKHd3d1xcXFwuYWxpeXVuZHJpdmVcXFxcLmNvbVxcXFwvc3xhbHl3cFxcXFwubmV0KVxcXFwvXFxcXHcqL2cpIHx8IFtdO1xcbiAgICAgICAgICAgICAgICBsZXQgYyA9IG51bGw7XFxuICAgICAgICAgICAgICAgIGlmIChfbGlua3MubGVuZ3RoID4gMSAmJiBfbGlua3NbMV0ucmVwbGFjZShfbGlua3NbMF0sIFxcXCJcXFwiKS5yZXBsYWNlKC9bYS16QS1aMC05XSsvZywgXFxcIlxcXCIpID09IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBjID0gX2xpbmtzWzFdO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgICAgICBjID0gX2xpbmtzWzBdO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdCxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGRvbSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYyAhPSBudWxsID8gYyA6IHUsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLov5vlhaXnvZHnq5lcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBqczogSlNPTi5zdHJpbmdpZnkoXFxcImhpa2VyOi8vcGFnZS95c2Z4P3dlYlVybD1cXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH0sXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxuICAgICAgICAgICAgaWYgKGlucHV0LmluY2x1ZGVzKFxcXCJhbGl5dW5kcml2ZVxcXCIpKSByZXR1cm4gaW5wdXQ7XFxuICAgICAgIC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AgICAgICBcXFwiY29udGVudC10eXBlXFxcIjogJ2FwcGxpY2F0aW9uL2pzb24nLFxcbiAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly9wYW4uY2NvZi5jYy9zZWFyY2g/a2V5d29yZD0nICsgc1xcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBib2R5OiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwicGFnZVNpemVcXFwiOiAyMCxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJwYWdlTnVtXFxcIjogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJrZXl3b3JkXFxcIjogcyxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJmcm9tTW9iaWxlXFxcIjogdHJ1ZVxcbiAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpXFxuICAgICAgICAgICAgICAgIC5kYXRhLnJvd3NcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gbGlzdFtpXTtcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXQuZmlsZU5hbWVcXG4gICAgICAgICAgICAgICAgbGV0IG11cmwgPSBpdC51cmxcXG4gICAgICAgICAgICAgICAgbGV0IHR5cGUgPSBpdC50eXBlLnJlcGxhY2UoL2ZvbGRlci8sICfmlofku7blpLknKS5yZXBsYWNlKC9maWxlLywgJ+aWh+S7ticpXFxuICAgICAgICAgICAgICAgIGlmICh0aXRsZS5pbmNsdWRlcyhzKSkge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+aWh+S7tuexu+Wei++8micgKyB0eXBlICsgJ++8jOaWh+S7tuWkp+Wwj++8micgKyBhbGlVdGlsLmJ5dGVzVG9TaXplKGl0LnNpemUpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbXVybFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZFxcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBuYW1lOiAn6Zi/6YeM5bCP56uZJyxcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxuICAgICAgICAgICAgbGV0IGhvbWUgPSBcXFwiaHR0cHM6Ly9wYW42NjYubmV0XFxcIjtcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChidWlsZFVybChob21lICsgXFxcIi9hcGkvZGlzY3Vzc2lvbnNcXFwiLCB7XFxuICAgICAgICAgICAgICAgIFxcXCJpbmNsdWRlXFxcIjogXFxcInVzZXIsbGFzdFBvc3RlZFVzZXIsbW9zdFJlbGV2YW50UG9zdCxtb3N0UmVsZXZhbnRQb3N0LnVzZXIsdGFncyx0YWdzLnBhcmVudCxmaXJzdFBvc3RcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiZmlsdGVyW3FdXFxcIjogcyAvKiArIFxcXCIgdGFnOnZpZGVvLGNvbWljXFxcIiovICxcXG4gICAgICAgICAgICAgICAgLy9cXFwiZmlsdGVyW3RhZ11cXFwiOiBcXFwidmlkZW8sY29taWNcXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwicGFnZVtvZmZzZXRdXFxcIjogMjAgKiAocGFnZSAtIDEpXFxuICAgICAgICAgICAgfSksIHtcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcImNvbnRlbnQtdHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vcGFuNjY2Lm5ldC8/cT1cXFwiICsgc1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBKU09OLnBhcnNlKGh0bWwpLmRhdGE7XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIGxldCBpdGVtID0gbGlzdFtpXS5hdHRyaWJ1dGVzO1xcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gaG9tZSArIFxcXCIvZC9cXFwiICsgaXRlbS5zbHVnO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiAn5Y+R5biD5pe26Ze077yaJyArICQuZGF0ZUZvcm1hdChuZXcgRGF0ZShpdGVtLmNyZWF0ZWRBdCksIFxcXCJ5eXl5LU1NLWRkIEhIOm1tOnNzXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIui/m+WFpeW4luWtkFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQodXJsKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcbiAgICAgICAgICAgIGxldCBodG1sID0gcGRmaChyZXF1ZXN0KGlucHV0KSwgXFxcIlRleHRcXFwiKTtcXG4gICAgICAgICAgICBsZXQgX2xpbmtzID0gaHRtbC5tYXRjaCgvaHR0cHM6XFxcXC9cXFxcLyh3d3dcXFxcLmFsaXl1bmRyaXZlXFxcXC5jb21cXFxcL3N8YWx5d3BcXFxcLm5ldClcXFxcL1xcXFx3Ki9nKSB8fCBbXTtcXG4gICAgICAgICAgICBsZXQgc2hhcmVQd2QgPSBodG1sLm1hdGNoKC/mj5Dlj5bnoIFbOu+8ml1cXFxccyo/KFxcXFx3ezR9KS8pO1xcbiAgICAgICAgICAgIHNoYXJlUHdkID0gQXJyYXkuaXNBcnJheShzaGFyZVB3ZCkgJiYgc2hhcmVQd2QubGVuZ3RoID4gMCA/IHNoYXJlUHdkWzFdIDogXFxcIlxcXCI7XFxuICAgICAgICAgICAgaWYgKF9saW5rcy5sZW5ndGggPiAxICYmIF9saW5rc1sxXS5yZXBsYWNlKF9saW5rc1swXSwgXFxcIlxcXCIpLnJlcGxhY2UoL1thLXpBLVowLTldKy9nLCBcXFwiXFxcIikgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgICAgIGFsaVVybDogX2xpbmtzWzFdLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChfbGlua3MubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge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AgICB9KSwge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiY29udGVudC10eXBlXFxcIjogXFxcImFwcGxpY2F0aW9uL2pzb25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcIlJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly9wYW42NjYubmV0Lz9xPVxcXCIgKyBzXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ZW0gPSBsaXN0W2ldLmF0dHJpYnV0ZXM7XFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBob21lICsgXFxcIi9kL1xcXCIgKyBpdGVtLnNsdWc7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6ICflj5HluIPml7bpl7TvvJonICsgJC5kYXRlRm9ybWF0KG5ldyBEYXRlKGl0ZW0uY3JlYXRlZEF0KSwgXFxcInl5eXktTU0tZGQgSEg6bW06c3NcXFwiKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6L+b5YWl5biW5a2QXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXCJoaWtlcjovL3BhZ2UveXNmeD93ZWJVcmw9XFxcIiArIGVuY29kZVVSSUNvbXBvbmVudCh1cmwpKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1dXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZDtcXG4gICAgICAgIH0sXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxuICAgICAgICAgICAgbGV0IGh0bWwgPSBwZGZoKHJlcXVlc3QoaW5wdXQpLCBcXFwiVGV4dFxcXCIpO1xcbiAgICAgICAgICAgIGxldCBfbGlua3MgPSBodG1sLm1hdGNoKC9odHRwczpcXFxcL1xcXFwvKHd3d1xcXFwuYWxpeXVuZHJpdmVcXFxcLmNvbVxcXFwvc3xhbHl3cFxcXFwubmV0KVxcXFwvXFxcXHcqL2cpIHx8IFtdO1xcbiAgICAgICAgICAgIGxldCBzaGFyZVB3ZCA9IGh0bWwubWF0Y2goL+aPkOWPlueggVs677yaXVxcXFxzKj8oXFxcXHd7NH0pLyk7XFxuICAgICAgICAgICAgc2hhcmVQd2QgPSBBcnJheS5pc0FycmF5KHNoYXJlUHdkKSAmJiBzaGFyZVB3ZC5sZW5ndGggPiAwID8gc2hhcmVQd2RbMV0gOiBcXFwiXFxcIjtcXG4gICAgICAgICAgICBpZiAoX2xpbmtzLmxlbmd0aCA+IDEgJiYgX2xpbmtzWzFdLnJlcGxhY2UoX2xpbmtzWzBdLCBcXFwiXFxcIikucmVwbGFjZSgvW2EtekEtWjAtOV0rL2csIFxcXCJcXFwiKSA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgYWxpVXJsOiBfbGlua3NbMV0sXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICBhbGlVcmw6IF9saW5rc1swXSxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBzaGFyZVB3ZFxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoaW5wdXQpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICAvKixcXG4gICAgICAgIHtcXG4gICAgICAgICAgICBuYW1lOiBcXFwi5aWH5aaZ5pCc57SiXFxcIixcXG4gICAgICAgICAgICBwYWdlOiB0cnVlLFxcbiAgICAgICAgICAgIGZpbmQocywgcGFnZSkge1xcbiAgICAgICAgICAgICAgICBsZXQgdXJsO1xcbiAgICAgICAgICAgICAgICBpZiAocGFnZSA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gYnVpbGRVcmwoXFxcImh0dHBzOi8vd3d3Lm1hZ2ljYWxzZWFyY2gudG9wL2FwaS9wc2hvdS9nZXREYXRhXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHdvcmQ6IHMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogXFxcIumYv+mHjOe9keebmFxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gYnVpbGRVcmwoXFxcImh0dHBzOi8vd3d3Lm1hZ2ljYWxzZWFyY2gudG9wL2FwaS9wc2hvdS9nZXROZXh0UGFnZVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJodHRwczovL2FwaS51cHl1bnNvMi5jb20vc2VhcmNoP3NfdHlwZT0yQHBhZ2U9XFxcIiArIHBhZ2UgKyBcXFwiQGtleXdvcmQ9XFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChzKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB3ZWJzaXRlOiBcXFwi6Zi/6YeM572R55uYXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IHJlc3VsdCA9IHJlcXVlc3QodXJsLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgUmVmZXJlcjogYnVpbGRVcmwoXFxcImh0dHBzOi8vd3d3Lm1hZ2ljYWxzZWFyY2gudG9wL3NlYXJjaFxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgd29yZDogcyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY3BhZ2U6IDBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gSlNPTi5wYXJzZShKU09OLnBhcnNlKHJlc3VsdCkpO1xcbiAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IHJlc3VsdC5yZXN1bHQuaXRlbXM7XFxuICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGxpc3QpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdC5pZCA9PSAtMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXQudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuaXpeacn++8mlxcXCIgKyBpdC5pbnNlcnRfdGltZSArIFxcXCJcXFxcbui3r+W+hO+8mlxcXCIgKyBpdC5wYXRoLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaXQucGFnZV91cmxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiBkO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0qL1xcbl07XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLlt6XlhbdcIixcInBhdGhcIjpcImFsaVV0aWxcIixcInJ1bGVcIjpcIiQuZXhwb3J0cyA9IHtcXG4gICAgY2hlY2thbGkocmVhbHVybCkge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBpZiAocmVhbHVybC5pbmNsdWRlcyhcXFwiY29tL3MvXFxcIikgJiYgcmVhbHVybCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgc2hhcmVJZCA9IHJlYWx1cmwuc3BsaXQoXFxcIj9cXFwiKVswXS5zcGxpdChcXFwiL1xcXCIpWzRdO1xcbiAgICAgICAgICAgICAgICBsZXQgc2hhcmUgPSBmZXRjaChcXFwiaHR0cHM6Ly9hcGkuYWxpeXVuZHJpdmUuY29tL2Fkcml2ZS92My9zaGFyZV9saW5rL2dldF9zaGFyZV9ieV9hbm9ueW1vdXNcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQtdHlwZSc6ICdhcHBsaWNhdGlvbi9qc29uJyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiVXNlci1BZ2VudFxcXCI6IFBDX1VBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogXFxcImh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9cXFwiXFxuICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgYm9keToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJzaGFyZV9pZFxcXCI6IHNoYXJlSWRcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgaWYgKHNoYXJlLmluY2x1ZGVzKFxcXCJzaGFyZV9saW5rIGlzXFxcIikgfHwgc2hhcmUuaW5jbHVkZXMoXFxcInNoYXJlX2xpbmsgY2Fubm90XFxcIikpIHJldHVybiBmYWxzZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgcmV0dXJuIHRydWU7XFxuICAgIH0sXFxuICAgIGJ5dGVzVG9TaXplKHNpemUpIHtcXG4gICAgICAgIGlmICghc2l6ZSkge1xcbiAgICAgICAgICAgIHJldHVybiAnMCc7XFxuICAgICAgICB9XFxuICAgICAgICBjb25zdCB1bml0cyA9IFsnQicsICdLQicsICdNQicsICdHQicsICdUQicsICdQQicsICdFQicsICdaQicsICdZQiddO1xcbiAgICAgICAgbGV0IGkgPSAwO1xcbiAgICAgICAgd2hpbGUgKHNpemUgPj0gMTAyNCkge1xcbiAgICAgICAgICAgIHNpemUgLz0gMTAyNDtcXG4gICAgICAgICAgICBpKys7XFxuICAgICAgICB9XFxuICAgICAgICBzaXplID0gaSA/IE51bWJlcihzaXplLnRvRml4ZWQoMikpIDogc2l6ZTtcXG4gICAgICAgIHJldHVybiBgJHtzaXplfSAke3VuaXRzW2ldfWA7XFxuICAgIH0sXFxuICAgIGdldENyeXB0b0pTKCkge1xcbiAgICAgICAgaWYgKHR5cGVvZiBDcnlwdG9KUyA9PT0gXFxcInVuZGVmaW5lZFxcXCIpIHtcXG4gICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcbiAgICAgICAgICAgIHJldHVybiBDcnlwdG9KUztcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBDcnlwdG9KUztcXG4gICAgfSxcXG4gICAgZ2V0TmFtZXNTb3J0KCkge1xcbiAgICAgICAgbGV0IGNobk51bUNoYXIgPSB7XFxuICAgICAgICAgICAg6Zu2OiAwLFxcbiAgICAgICAgICAgIOS4gDogMSxcXG4gICAgICAgICAgICDkuow6IDIsXFxuICAgICAgICAgICAg5LiJOiAzLFxcbiAgICAgICAgICAgIOWbmzogNCxcXG4gICAgICAgICAgICDkupQ6IDUsXFxuICAgICAgICAgICAg5YWtOiA2LFxcbiAgICAgICAgICAgIOS4gzogNyxcXG4gICAgICAgICAgICDlhas6IDgsXFxuICAgICAgICAgICAg5LmdOiA5XFxuICAgICAgICB9O1xcblxcbiAgICAgICAgbGV0IGNobk5hbWVWYWx1ZSA9IHtcXG4gICAgICAgICAgICDljYE6IHtcXG4gICAgICAgICAgICAgICAgdmFsdWU6IDEwLFxcbiAgICAgICAgICAgICAgICBzZWNVbml0OiBmYWxzZVxcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAg55m+OiB7XFxuICAgICAgICAgICAgICAgIHZhbHVlOiAxMDAsXFxuICAgICAgICAgICAgICAgIHNlY1VuaXQ6IGZhbHNlXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICDljYM6IHtcXG4gICAgICAgICAgICAgICAgdmFsdWU6IDEwMDAsXFxuICAgICAgICAgICAgICAgIHNlY1VuaXQ6IGZhbHNlXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICDkuIc6IHtcXG4gICAgICAgICAgICAgICAgdmFsdWU6IDEwMDAwLFxcbiAgICAgICAgICAgICAgICBzZWNVbml0OiB0cnVlXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICDkur86IHtcXG4gICAgICAgICAgICAgICAgdmFsdWU6IDEwMDAwMDAwMCxcXG4gICAgICAgICAgICAgICAgc2VjVW5pdDogdHJ1ZVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGZ1bmN0aW9uIENoaW5lc2VUb051bWJlcihjaG5TdHIpIHtcXG4gICAgICAgICAgICBsZXQgcnRuID0gMDtcXG4gICAgICAgICAgICBsZXQgc2VjdGlvbiA9IDA7XFxuICAgICAgICAgICAgbGV0IG51bWJlciA9IDA7XFxuICAgICAgICAgICAgbGV0IHNlY1VuaXQgPSBmYWxzZTtcXG4gICAgICAgICAgICBsZXQgc3RyID0gY2huU3RyLnNwbGl0KCcnKTtcXG5cXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICBsZXQgbnVtID0gY2huTnVtQ2hhcltzdHJbaV1dO1xcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG51bSAhPT0gJ3VuZGVmaW5lZCcpIHtcXG4gICAgICAgICAgICAgICAgICAgIG51bWJlciA9IG51bTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpID09PSBzdHIubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlY3Rpb24gKz0gbnVtYmVyO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHVuaXQgPSBjaG5OYW1lVmFsdWVbc3RyW2ldXS52YWx1ZTtcXG4gICAgICAgICAgICAgICAgICAgIHNlY1VuaXQgPSBjaG5OYW1lVmFsdWVbc3RyW2ldXS5zZWNVbml0O1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNlY1VuaXQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWN0aW9uID0gKHNlY3Rpb24gKyBudW1iZXIpICogdW5pdDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBydG4gKz0gc2VjdGlvbjtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWN0aW9uID0gMDtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2VjdGlvbiArPSAobnVtYmVyICogdW5pdCk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBudW1iZXIgPSAwO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBydG4gKyBzZWN0aW9uO1xcbiAgICAgICAgfVxcblxcbiAgICAgICAgZnVuY3Rpb24gbmFtZUNvbXBhcmUoYSwgYikge1xcbiAgICAgICAgICAgIGlmIChhID09IG51bGwgfHwgYiA9PSBudWxsKVxcbiAgICAgICAgICAgICAgICByZXR1cm4gYSA9PSBudWxsID8gYiA9PSBudWxsID8gMCA6IC0xIDogMTtcXG5cXG4gICAgICAgICAgICBhID0gYS5yZXBsYWNlKC8oW+mbtuS4gOS6jOS4ieWbm+S6lOWFreS4g+WFq+S5neWNgeeZvuWNg+S4h+S6v10pL2csIGZ1bmN0aW9uKG1hdGNoLCBwMSwgcDIsIHAzLCBvZmZzZXQsIHN0cmluZykge1xcbiAgICAgICAgICAgICAgICAvLyBwMSBpcyBub25kaWdpdHMsIHAyIGRpZ2l0cywgYW5kIHAzIG5vbi1hbHBoYW51bWVyaWNzXFxuICAgICAgICAgICAgICAgIHJldHVybiBDaGluZXNlVG9OdW1iZXIocDEpO1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgYiA9IGIucmVwbGFjZSgvKFvpm7bkuIDkuozkuInlm5vkupTlha3kuIPlhavkuZ3ljYHnmb7ljYPkuIfkur9dKS9nLCBmdW5jdGlvbihtYXRjaCwgcDEsIHAyLCBwMywgb2Zmc2V0LCBzdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgLy8gcDEgaXMgbm9uZGlnaXRzLCBwMiBkaWdpdHMsIGFuZCBwMyBub24tYWxwaGFudW1lcmljc1xcb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VUbyhuZXcgamF2YS5tYXRoLkJpZ0ludGVnZXIoc3BsaXQyW2ldKSk7XFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgaWYgKGNtcCA9PT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlZ2V4ID0gL1thLXpBLVowLTldL1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHMxID0gU3RyaW5nKHNwbGl0MVtpXSlcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzMiA9IFN0cmluZyhzcGxpdDJbaV0pXFxuICAgICAgICAgICAgICAgICAgICBpZiAocmVnZXgudGVzdChzMSkgfHwgcmVnZXgudGVzdChzMikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbXAgPSBuZXcgamF2YS5sYW5nLlN0cmluZyhzcGxpdDFbaV0pLmNvbXBhcmVUbyhuZXcgamF2YS5sYW5nLlN0cmluZyhzcGxpdDJbaV0pKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBjbXAgPSBzMS5sb2NhbGVDb21wYXJlKHMyLCAnZW4nKVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbXAgPSBzMS5sb2NhbGVDb21wYXJlKHMyLCAnemgnKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIGlmIChjbXAgIT09IDApIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjbXA7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGxlbmd0aENtcCA9IHNwbGl0MS5sZW5ndGggLSBzcGxpdDIubGVuZ3RoO1xcbiAgICAgICAgICAgIC8vIGlmIChsZW5ndGhDbXAgIT09IDApIGxlbmd0aENtcCA9IGxlbmd0aENtcCA+IDAgPyAtMSA6IDE7XFxuICAgICAgICAgICAgcmV0d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8k+WKseS9nOiAheeahOWPr+S7pTxhIGhyZWY9J2hpa2VyOi8vcGFnZS9Eb25hdGUudiNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSMnPuaUr+aMgeS4gOS4izwvYT4oPHNtYWxsPueCueWHu+WPr+i/m+WFpeaNkOi1oO+8jOWPr+WcqOS4u+mhteiPnOWNlei/m+WFpTwvc21hbGw+KeOAgjxicj4zLiDmnKzlsI/nqIvluo/mmK/lnKjljp/niYjjgIzkupHnm5jlkJvjgI3nmoTln7rnoYDov5vooYznmoTkuozmrKHkv67mlLnvvIzor7fmlK/mjIHljp/niYjjgII8YnI+PGJyPjxiPuW8gOWni+S9v+eUqOacrOinhOWImeWNs+S7o+ihqOmBteWuiOinhOWImTwvYj48YnI+5b2T5YmN54mI5pys77yaXFxcIitNWV9SVUxFLnZlcnNpb24sXFxuICAgICAgICBcXFwiY29sX3R5cGVcXFwiOiBcXFwicmljaF90ZXh0XFxcIlxcbiAgICB9LCB7XFxuICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiXFxuICAgIH0sIHtcXG4gICAgICAgIHRpdGxlOiB0aW1lICsgXFxcIuenkuWQjue7p+e7rVxcXCIsXFxuICAgICAgICB1cmw6IFxcXCJ0b2FzdDovL+ivt+iupOecn+mYheivu+S7peS4iuWGheWuuVxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBpZDogaWQgKyBcXFwidGltZXJcXFwiXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBzZXRSZXN1bHQoZCk7XFxuICAgIHdoaWxlICh0aW1lICE9IDApIHtcXG4gICAgICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAoMTAwMCk7XFxuICAgICAgICB0aW1lIC09IDE7XFxuICAgICAgICB1cGRhdGVJdGVtKGlkICsgXFxcInRpbWVyXFxcIiwge1xcbiAgICAgICAgICAg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ByZXR1cm4gJChcXFxcXFxcIlxcXFxcXFwiLCBcXFxcXFxcIui+k+WFpVRva2VuXFxcXFxcXCIpLmlucHV0KCgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhbGlUb2tlbnNGaWxlcGF0aCA9ICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS90b2tlblBhdGhcXFxcXFxcIikuYWxpVG9rZW5zRmlsZXBhdGg7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgYWxpVG9rZW4gPSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaF90b2tlbjogaW5wdXQudHJpbSgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgd3JpdGVGaWxlKGFsaVRva2Vuc0ZpbGVwYXRoLCBKU09OLnN0cmluZ2lmeShhbGlUb2tlbikpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmIChcXFxcXFxcIueZu+W9leS/oeaBr1xcXFxcXFwiID09IGlucHV0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBhbGlUb2tlbnNGaWxlcGF0aCA9ICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS90b2tlblBhdGhcXFxcXFxcIikuYWxpVG9rZW5zRmlsZXBhdGg7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICghZmlsZUV4aXN0KGFsaVRva2Vuc0ZpbGVwYXRoKSkgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/ov5jmnKrnmbvpmYZcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFsaSA9IHJlcXVlc3QoYWxpVG9rZW5zRmlsZXBhdGgpO1xcXFxuICAgICAgICAgICAgICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYWxpID0gSlNPTi5wYXJzZShhbGkpO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKGFsaVRva2Vuc0ZpbGVwYXRoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSlXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+eZu+W9leS/oeaBrycsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFxcXFxcIueUqOaItzpcXFxcXFxcIiArIChhbGkubmlja19uYW1lIHx8IGFsaS51c2VyX25hbWUgfHwgXFxcXFxcXCJUb2tlbueZu+W9lVxcXFxcXFwiKSArIFxcXFxcXFwiXFxcXFxcXFxuVG9rZW46XFxcXFxcXCIgKyBhbGkucmVmcmVzaF90b2tlbiArIFxcXFxcXFwiXFxcXFxcXFxuKOWPlua2iO+8muazqOmUgOeZu+W9le+8m+ehruWumu+8muWkjeWItlRva2VuKVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygodG9rZW4pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJjb3B5Oi8vXFxcXFxcXCIgKyB0b2tlbjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGFsaS5yZWZyZXNoX3Rva2VuKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbmNlbDogJC50b1N0cmluZygocGF0aCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXFxcXFwi56Gu6K6k5rOo6ZSA55m75b2VXFxcXFxcXCIpLmNvbmZpcm0oKHBhdGgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlRmlsZShwYXRoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBwYXRoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGFsaVRva2Vuc0ZpbGVwYXRoKVxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpbnB1dCA9IGlucHV0LnJlcGxhY2UoXFxcXFxcXCLmqKHlvI/vvJpcXFxcXFxcIiwgXFxcXFxcXCJcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcIm9wZW5Nb2RlXFxcXFxcXCIsIGlucHV0KTtcXFxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFxcXFxcIuWumOaWuUFQUFxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5L+u5pS55oiQ5Yqf77yM6K+356Gu5L+d5omL5py65pyJ5a6J6KOF6Zi/6YeM5LqR55uY5a6Y5pa5QVBQXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfSksXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImljb25fMl9yb3VuZFxcXFxcXFwiLFxcXFxuICAgICAgICBkZXNjOiBcXFxcXFxcIlx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XG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInJ1bGVcXFxcXFxcIiwgcik7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHMpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHFyID8gKGlkICsgcXIpIDogKFxcXFxcXFwi5YWo6YOoXFxcXFxcXCIgKyBpZCksIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBxciB8fCBcXFxcXFxcIuWFqOmDqFxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGlkICsgciwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oCc4oCcXFxcXFxcXCIgKyByICsgXFxcXFxcXCLigJ3igJ1cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiXFxcXG4gICAgICAgICAgICB9LCBpdCwgcywgaWQpLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwic2Nyb2xsX2J1dHRvblxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgZGVzYzogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIHBpY191cmw6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBpZCArIGl0XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pO1xcXFxuICAgIH1cXFxcblxcXFxufVxcXFxuXFxcXG5mdW5jdGl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XCIsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0X2NlbnRlcl8xXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBkZXNjOiBcXFxcXFxcIlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgcGljX3VybDogXFxcXFxcXCJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHBhZ2VpZFxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KTtcXFxcbiAgICB9XFxcXG4gICAgc2V0UmVzdWx0KGQpO1xcXFxuICAgIGlmIChkYXRhLmxlbmd0aCA+IDApIHtcXFxcbiAgICAgICAgLy/lpJrnur/nqIvliqDovb0gICAgICAgIFxcXFxuICAgICAgICBsZXQgcmVhbFBhZ2UgPSBcXFxcXFxcIlxcXFxcXFwiID09IHIgPyAxIDogcDtcXFxcbiAgICAgICAgbGV0IHRhc2tzID0gZGF0YS5tYXAoaXQgPT4ge1xcXFxuICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihydWxlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJC5yZXF1aXJlKFxcXFxcXFwiZGF0YVxcXFxcXFwiKS5jYXJyeVJ1bGUocnVsZSwgcywgcmVhbFBhZ2UsIHNlYXJjaE1vZGUsIG9wZW5Nb2RlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9nKHJ1bGUubmFtZSArIFxcXFxcXFwiOlxcXFxcXFwiICsgZS50b1N0cmluZygpKVxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIC8vcmV0dXJuIHJ1bGUuZmluZChzLCByZWFsUGFnZSk7XFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICBwYXJhbTogaXQsXFxcXG4gICAgICAgICAgICAgICAgaWQ6IFxcXFxcXFwicnVsZUBcXFxcXFxcIiArIGl0Lm5hbWVcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgYmF0Y2hFeGVjdXRlKHRhc2tzLCB7XFxcXG4gICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihwYXJhbSwgaWQsIGVycm9yLCByZXN1bHQpIHtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbS5pICs9IDE7XFxcXG4gICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkocmVzdWx0KSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKFxcXFxcXFwiX25vdGhhdmVcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1CZWZvcmUocGFnZWlkLCByZXN1bHQpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAocGFyYW0uaSA9PT0gcGFyYW0uYWxsKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICghcmVzdWx0IHx8ICFyZXN1bHQubGVuZ3RoKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKFxcXFxcXFwiX25vdGhhdmVcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQmVmb3JlKHBhZ2VpZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiICsgXFxcXFxcXCJ+fn7ku4DkuYjotYTmupDpg73msqHmnInlk6Z+fn5cXFxcXFxcIi5mb250Y29sb3IoXFxcXFxcXCJHcmF5XFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXFxcXFwiX25vdGhhdmVcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0ocGFnZWlkKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHBhZ2VpZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5Yqg6L2956ysXFxcXFxcXCIgKyBNWV9QQUdFICsgXFxcXFxcXCLpobXkuK3vvIzov5vluqbvvJpcXFxcXFxcIiArIChwYXJhbS5pICsgMSkgKyBcXFxcXFxcIi9cXFxcXFxcIiArIHBhcmFtLmFsbCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgIHBhcmFtO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mI6YO95rKh5pyJ5ZOmfn5+XFxcXFxcXCIuZm9udGNvbG9yKFxcXFxcXFwiR3JheVxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IGlkICsgXFxcXFxcXCI6a2V5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICB9LCBpZCksXFxcXG4gICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICBpZDogaWQgKyBcXFxcXFxcIjpzZWFyY2hIaXN0b3J5XFxcXFxcXCJcXFxcbiAgICAgICAgfVxcXFxuICAgIH0pO1xcXFxuXFxcXG4gICAgbGV0IGhpc3RvcnkgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXFxcXFwic2VhcmNoSGlzdG9yeVxcXFxcXFwiLCBbXSk7XFxcXG4gICAgbGV0IGkgPSAwO1xcXFxuICAgIGZvciAobGV0IGtleSBvZiBoaXN0b3J5KSB7XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICB0aXRsZToga2V5LFxcXFxuICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiI25vTG9hZGluZyNcXFxcXFxcIikubGF6eVJ1bGUoKGlkLCBrZXkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgZXh0cmEgPSBmaW5kSXRlbShpZCArIFxcXFxcXFwic3NcXFxcXFxcIikuZXh0cmE7XFxcXG4gICAgICAgICAgICAgICAgZXh0cmEuZGVmYXVsdFZhbHVlID0ga2V5O1xcXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oe1xcXFxuICAgICAgICAgICAgICAgICAgICBleHRyYTogZXh0cmFcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9LCBpZCwga2V5KSxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImZsZXhfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgIGlkOiBpZCArIFxcXFxcXFwiOmtleTpcXFxcXFxcIiArIGtleSxcXFxcbiAgICAgICAgICAgICAgICBjbHM6IGlkICsgXFxcXFxcXCI6a2V5XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLliKDpmaTlhbPplK7or406XFxcXFxcXCIgKyBrZXksXFxcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpZCwga2V5LCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgaGlzdG9yeSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcXFxcXCJzZWFyY2hIaXN0b3J5XFxcXFxcXCIsIFtdKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhpc3Rvcnkuc3BsaWNlKGksIDEpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFxcXFxcInNlYXJjaEhpc3RvcnlcXFxcXFxcIiwgaGlzdG9yeSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtKGlkICsgXFxcXFxcXCI6a2V5OlxcXFxcXFwiICsga2V5KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vdG9hc3QoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgaWQsIGtleSwgaSlcXFxcbiAgICAgICAgICAgICAgICB9XVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9KTtcXFxcbi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nZShmYWxzZSk7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+W3suWIh+aNouS4ulxcXFxcXFwiICsgaW5wdXQ7XFxcXG4gICAgICAgIH0pLFxcXFxuICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJhdmF0YXJcXFxcXFxcIixcXFxcbiAgICAgICAgcGljX3VybDogXFxcXFxcXCJoaWtlcjovL2ltYWdlcy9pY29uX2ZpcmVcXFxcXFxcIixcXFxcbiAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgIGxvbmdDbGljazogW3tcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLliIfmjaLmlbDmja7mupBcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoZGF0YVNvdXJjZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChkYXRhU291cmNlLCAxLCBcXFxcXFxcIuWIh+aNouaVsOaNrua6kFxcXFxcXFwiKS5zZWxlY3QoKCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcImRhdGFTb3VyY2VcXFxcXFxcIiwgaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJdGVtKFxcXFxcXFwiaG90a2V5XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/lt7LliIfmjaLkuLpcXFxcXFxcIiArIGlucHV0O1xcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICB9LCBkYXRhU291cmNlKVxcXFxuICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgfVxcXFxuICAgIH0pO1xcXFxuICAgIGQucHVzaCh7XFxcXG4gIC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VwdCc6ICdhcHBsaWNhdGlvbi9qc29uLCB0ZXh0L3BsYWluLCAqLyonLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ0FjY2VwdC1MYW5ndWFnZSc6ICd6aC1DTix6aDtxPTAuOSxlbi1VUztxPTAuOCxlbjtxPTAuNycsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAnQWNjZXB0LUVuY29kaW5nJzogJ2d6aXAsIGRlZmxhdGUsIGJyJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vdG9wLmJhaWR1LmNvbS9ib2FyZD90YWI9bm92ZWwnLFxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgLy92YXIgcyA9IERhdGUubm93KCk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGxpc3QgPSBKU09OLnBhcnNlKGpzb24pLmRhdGEuY2FyZHNbMF0uY29udGVudDtcXFxcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGl0ZW0gPSBsaXN0W2ldO1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgbmFtZSA9IGl0ZW0ud29yZCArICcgKCcgKyBpdGVtLnNob3dbMl0gKyAnKSc7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBkZXMgPSBpdGVtLmRlc2M7XFxcXG4gICAgICAgICAgICAgICAgICAgIHNkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGdldFRpdGxlKGksIG5hbWUpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKHNldFNlYXJjaEtleSwgaXRlbS53b3JkKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgI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XFxuICAgICAgICAgICAgZi5mb3JFYWNoKGl0ID0+IHtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaXQgJiYgaXQuc3RhcnRzV2l0aCgnL3Byb3h5P3VybD0nKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgZnVybCA9IGJhc2U2NERlY29kZShpdC5yZXBsYWNlKCcvcHJveHk/dXJsPScsICcnKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICh1cmwuc3Vic3RyKHVybC5pbmRleE9mKCcvbWVkaWEtJyksIHVybC5pbmRleE9mKCcudHMnKSkgPT0gZnVybC5zdWJzdHIoZnVybC5pbmRleE9mKCcvbWVkaWEtJyksIGZ1cmwuaW5kZXhPZignLnRzJykpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmwgPSBmdXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcblxcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHJldHVybiB1cmw7XFxcXG4gICAgfVxcXFxuICAgIHRyeSB7XFxcXG4gICAgICAgIGxldCB1cmwgPSBiYXNlNjREZWNvZGUoTVlfUEFSQU1TLnVybCk7XFxcXG4gICAgICAgIGlmICh1cmwuaW5jbHVkZXMoXFxcXFxcXCIudHNcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeSh7XFxcXG4gICAgICAgICAgICAgICAgc3RhdHVzQ29kZTogMzAyLFxcXFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJMb2NhdGlvblxcXFxcXFwiOiB1cGRhdGVUc1VybCh1cmwpLFxcXFxuICAgICAgICAgICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJ1xcXFxuICAgICAgICAgICAgICAgIH1cX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tlblxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgdG9hc3QoXFxcXFxcXCLnmbvpmYbov4fmnJ/vvIzor7fph43mlrDnmbvpmYZcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9wYWdlL2xvZ2luI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5Iz9ub1JlZnJlc2g9MVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChlLmNvZGUgPT09IFxcXFxcXFwiUXVvdGFFeGhhdXN0ZWQuRHJpdmVcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v572R55uY56m66Ze05LiN6Laz77yM5peg5rOV5pKt5pS+6K+35riF55CG44CCXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+aSreaUvuWksei0pe+8jOmUmeivr+S/oeaBr+W3suaJk+WNsOOAglxcXFxcXFxcbuivt+afpeeci+aXpeW/lyhMT0cpXFxcXFxcXCI7XFxcXG4gICAgICAgIH1cXFxcblxcXFxuICAgICAgICBsZXQgbW91bnRzdWIgPSBzdG9yYWdlMC5nZXRNeVZhcignbW91bnR6aW11Jywge30pO1xcXFxuICAgICAgICBpZiAoT2JqZWN0LmtleXMobW91bnRzdWIpLmxlbmd0aCA+IDApIHtcXFxcbiAgICAgICAgICAgIHppbXUgPSBtb3VudHN1YjtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBsZXQgc3VidGl0bGU7XFxcXG4gICAgICAgIGlmIChPYmplY3Qua2V5cyh6aW11IHx8IHt9KS5sZW5ndGggPiAwICYmIHBsYXlMaXN0ICYmIHBsYXlMaXN0LnVybHMgJiYgcGxheUxpc3QudXJscy5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICBqYXZhLmxhbm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cXG4gICAgICAgICAgICAgICAgdXJsOiByZWFsdXJsICsgXFxcXFxcXCIjbm9IaXN0b3J5I1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGltZzogc2hhcmVJbmZvLmF2YXRhcixcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJhdmF0YXJcXFxcXFxcIlxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKCFpc1NlYXJjaCkge1xcXFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5pCc57SiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkLnRvU3RyaW5nKCgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC50cmltKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICghaW5wdXQpIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6K+36L6T5YWl5YWz6ZSu6K+NXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS9hbGl5dW4jbm9IaXN0b3J5IyNmdWxsVGhlbWUjP3BhZ2U9ZnlwYWdlJnNlYXJjaEtleT1cXFxcXFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgfSksXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiaW5wdXRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2QsXFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQ6IHNoYXJlSWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHNoYXJlVG9rZW5cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnFxcXFxcXFwiICsgc2VhcmNoS2V5ICsgXFxcXFxcXCLigJ3igJ3nmoTmkJzntKLnu5PmnpxcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBsZXQgZnVuU3R5bGUgPSBpc1NlYXJjaCA/IFxcXFxcXFwiaWNvbl9zbWFsbF8zXFxcXFxcXCIgOiBcXFxcXFxcImljb25fcm91bmRfc21hbGxfNFxcXFxcXFwiO1xcXFxuICAgICAgICBpdGVtcy5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiBzdHlsZSxcXFxcbiAgICAgICAgICAgIHVybDogJChzdHlsZXMsIDEsIFxcXFxcXFwi5o6S5biD5qC35byPXFxcXFxcXCIpLnNlbGVjdCgoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcImFsaXl1bl9zdHlsZVxcXFxcXFwiLCBpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+W3suWIh+aNolxcXFxcXFwiO1xcX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XFxcIui9rOWtmOS6keebmFxcXFxcXFwiOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBgc21hcnRkcml2ZTovL3NoYXJlL2Jyb3dzZT9zaGFyZUlkPSR7c2hhcmVJZH0mc2hhcmVQd2Q9JHtzaGFyZVB3ZHx8XFxcXFxcXCJcXFxcXFxcIn1gO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFxcXFxcIueZu+mZhui0puWPt1xcXFxcXFwiOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS9sb2dpbiNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcXFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFxcXFxcIjpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChbXFxcXFxcXCLlpI3liLbpk77mjqVcXFxcXFxcIiwgXFxcXFxcXCLlpI3liLbmtbfpmJTlj6Pku6RcXFxcXFxcIl0sIDEsIFxcXFxcXFwi5YiG5Lqr5pa55byPXFxcXFxcXCIpLnNlbGVjdCgodXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLlpI3liLbpk77mjqVcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiY29weTovL1xcXFxcXFwiICsgdXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiY29weTovL+mYv+mHjOS6keebmOWIhuS6q+WPo+S7pOOAjFxcXFxcXFwiICsgZ2V0UGFnZVRpdGxlKCkgKyBcXFxcXFxcIuOAjVxcXFxcXFxcblxcXFxcXFwiICsgdXJsICsgXFxcXFxcXCIgQGltcG9ydD1qczpgaGlrZXI6Ly9wYWdlL2FsaXl1bj9yZWFsdXJsPSR7aW5wdXQudHJpbSgpfSZydWxlPeS6keebmOWQmy7nroBgO1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgXFxcXFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9cXFxcXFxcIiArIHNoYXJlSWQgKyAoZmlsZUlkID8gXFxcXFxcXCIvZm9sZGVyL1xcXFxcXFwiICsgZmlsZUlkIDogXFxcXFxcXCJcXFxcXFxcIikpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFxcXFxcIuaJuemHj+aMgui9veacrOWcsOW8ueW5lVxcXFxcXFwiOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS9kbU1vdW50I25vSGlzdG9yeSMjbm9SZWNvcmRIaXN0b3J5I1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSBcXFxcXFxcIuafpeeci+aJi+WKqOaMgui9veWtl+W5lVxcXFxcXFwiOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB6bSA9IHN0b3JhZ2UwLmdldE15VmFyKFxcXFxcXFwibW91bnR6aW11XFxcXFxcXCIsIHt9KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdGlwID0gem0ubmFtZSA/IFxcXFxcXFwi5b2T5YmN5a2X5bmV5paH5Lu2XFxcXFxcXFxuXFxcXFxcXCIgKyB6bS5uYW1lICsgXFxcXFxcXCIuXFxcXFxcXCIgKyB6bS5leHQgOiBcXFxcXFxcIui/mOacquaJi+WKqOaMgui9veWtl+W5lVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0oe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aJi+WKqOaMgui9veWtl+W5lScsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IHRpcCArIFxcXFxcXFwiXFxcXFxcXFxuKOeCueWHu+WPlua2iOWPr+S7pea4hemZpOaMgui9veWtl+W5lSlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsOiAoKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXFxcXFwibW91bnR6aW11XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/lt7LmuIXpmaTmiYvliqjmjILovb3lrZfluZVcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcXFxcXCLojrflj5blvLnluZXmkJzntKLop4TliJlcXFxcXFxcIjpcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJqc1xcXFxcXFwiOiBKU09OLnN0cmluZ2lmeShcXFxcXFxcImhpa2VyOi8vcGFnZS9sb2FkRG0/cnVsZT1cXFxcXFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFxcXFxcIiZ0aXRsZT1cXFxcXFxcIikgKyBcXFxcXFxcIitlbmNvZGVVUklDb21wb25lbnQocGxheWRhdGEudGl0bGUuc3BsaXQoJy0nKVswXSk7XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwibmFtZVxcXFxcXFwiOiBNWV9SVUxFLnRpdGxlICsgXFxcXFxcXCLlvLnluZXmkJzntKJcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwicnVsZTovL1xcXFxcXFwiICsgYmFzZTY0RW5jb2RlKFxcXFxcXFwi77+lcHJvamVjdGlvbl9zY3JlZW7vv6VcXFxcXFxcIiArIEpTT04uc3RyaW5naWZ5KHJ1bGUpKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgXFxcXFxcXCLmjqjpgIHliLB0dkJveFxcXFxcXFwiOlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS90dmJveFB1c2gjbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9LCBzaGFyZUlkLCBzaGFyZVB3ZCwgZmlsZUlkKSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJpY29uX3JvdW5kX3NtYWxsXzRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFxcXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS9pbWcvYWxpX2ZpbGVpbnRvLnN2Z1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOntcXFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZUlkOiBwYWdlSWQsXFxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogZmlsZUlkLFxcXFxuICAgICAgICAgIC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SB7XFxcXG4gICAgICAgICAgICBsZXQgdGl0bGUgPSAoZm9sZGVyU3R5bGUgPT09IFxcXFxcXFwidGV4dF8xXFxcXFxcXCIgPyB0aXRsZUhlYWQuZm9sZGVyIDogXFxcXFxcXCJcXFxcXFxcIikgKyBmaWxlSXRlbS5uYW1lO1xcXFxuICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9hbGl5dW4/cGFnZT1meXBhZ2UnLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBmb2xkZXJTdHlsZSxcXFxcbiAgICAgICAgICAgICAgICBkZXNjOiBmb3JtYXREYXRlKGZpbGVJdGVtLnVwZGF0ZWRfYXQpLFxcXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IHBpY191cmwsXFxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZDogc2hhcmVJZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogTVlfUEFSQU1TLnNoYXJlVG9rZW4sXFxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogZmlsZUl0ZW0uZmlsZV9pZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IHNoYXJlUHdkLFxcXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGZpbGVJdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBsZXQgc3VidGl0bGUsIGxvbmdjLCBjbHM7XFxcXG4gICAgICAgICAgICBsZXQgdGl0bGUgPSAoZmlsZVN0eWxlID09PSBcXFxcXFxcInRleHRfMVxcXFxcXFwiID8gKHRpdGxlSGVhZFtjYXRlXSB8fCBcXFxcXFxcIuKdk1xcXFxcXFwiKSA6IFxcXFxcXFwiXFxcXFxcXCIpICsgZmlsZUl0ZW0ubmFtZTtcXFxcbiAgICAgICAgICAgIGxldCBuYW1lTm90RXh0ID0gZmlsZUl0ZW0ubmFtZS5yZXBsYWNlKCcuJyArIGZpbGVJdGVtLmZpbGVfZXh0ZW5zaW9uLCAnJyk7XFxcXG4gICAgICAgICAgICBpZiAoc3ViRXh0cy5pbmNsdWRlcyhmaWxlSXRlbS5maWxlX2V4dGVuc2lvbikpIHtcXFxcbiAgICAgICAgICAgICAgICBsb25nYyA9IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuaMgui9veWtl+W5lVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoem0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdtb3VudHppbXUnLCB6bSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5oyC6L295a6M5oiQ77yM5b2T5YmN5a2X5bmV5paH5Lu2OiAnICsgem0ubmFtZSArICcuJyArIHptLmV4dDtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0OiBmaWxlSXRlbS5maWxlX2V4dGVuc2lvbixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVfaWQ6IGZpbGVJdGVtLmZpbGVfaWQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lOiBuYW1lTm90RXh0XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcXFxuICAgICAgICAgICAgICAgIH1dO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKGNhdGUgPT09IFxcXFxcXFwidmlkZW9cXFxcXFxcIikge1xcXFxuICAgICAgICA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l0bGUpO1xcXFxuICAgICAgICAgICAgICAgIH0sIHNoYXJlSWQsIHNoYXJlUHdkLCBNWV9QQVJBTVMuc2hhcmVUb2tlbiwgZmlsZUl0ZW0uZmlsZV9pZCwgY2F0ZSwgc3VidGl0bGUpLFxcXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogcGljX3VybCxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZDogZmlsZUl0ZW0uZmlsZV9pZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBsb25nYyxcXFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBjbHMsXFxcXG4gICAgICAgICAgICAgICAgICAgIC8vaW5oZXJpdFRpdGxlOiBmYWxzZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBmaWxlSXRlbS5uYW1lXFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogZmlsZVN0eWxlXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgIH1cXFxcbiAgICBpZiAoY29udHMubGVuZ3RoID09PSAwKSB7XFxcXG4gICAgICAgIGl0ZW1zLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiICsgXFxcXFxcXCJ+fn7ku4DkuYjpg73msqHmnInkuoblk6Z+fn5cXFxcXFxcIi5mb250Y29sb3IoXFxcXFxcXCJHcmF5XFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgZXh0cm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gIGRlc2M6IHNoYXJlUHdkID8gXFxcXFxcXCLigJzigJzmj5Dlj5bnoIHplJnor6/igJ3igJ1cXFxcXFxcIiA6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkuaW5wdXQoKE1ZX1BBUkFNUykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBzZXRQYWdlUGFyYW1zKE9iamVjdC5hc3NpZ24oe30sIE1ZX1BBUkFNUywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVQd2Q6IGlucHV0XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICB9LCBNWV9QQVJBTVMpLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIlxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBpZiAoZS5zaWduaWZpY2FuY2UgPT09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oCc4oCc4oCd4oCdXFxcXFxcXCIgKyBlLm1lc3NhZ2UuYmlnKCkuYmlnKCkuZm9udGNvbG9yKFxcXFxcXFwicmVkXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChlLnNpZ25pZmljYW5jZSA9PT0gMykge1xcXFxuICAgICAgICAgICAgICAg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mZXJlclxcXFxcXFwiOiBcXFxcXFxcImh0dHBzOi8vd3d3LmFsaXl1bmRyaXZlLmNvbS9cXFxcXFxcIlxcXFxuICAgICAgICB9LCAoZSkgPT4ge1xcXFxuICAgICAgICAgICAgdGhpcy50cnlTb2x2ZShlKTtcXFxcbiAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAnYXV0aG9yaXphdGlvbic6IHRoaXMucmVhY2Nlc3NUa1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIHJldHVybiBpbmZvO1xcXFxuICAgIH0sXFxcXG4gICAgX2dldE9wZW5Ub2tlbihjb2RlKSB7XFxcXG4gICAgICAgIGxldCBib2R5ID0ge30sXFxcXG4gICAgICAgICAgICBoZWFkZXJzID0ge1xcXFxuICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxcXG4gICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tLydcXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgIGlmIChjb2RlKSB7XFxcXG4gICAgICAgICAgICBib2R5ID0ge1xcXFxuICAgICAgICAgICAgICAgIGNvZGU6IGNvZGUsXFxcXG4gICAgICAgICAgICAgICAgZ3JhbnRfdHlwZTogXFxcXFxcXCJhdXRob3JpemF0aW9uX2NvZGVcXFxcXFxcIlxcXFxuICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIGJvZHkgPSB7XFxcXG4gICAgICAgICAgICAgICAgZ3JhbnRfdHlwZTogXFxcXFxcXCJyZWZyZXNoX3Rva2VuXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaF90b2tlbjogdGhpcy5vcGVuVG9rZW5zLlJlZnJlc2hUb2tlbk9wZW4sXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGV0IGpzb24gPSBwb3N0KCdodHRwczovL2FwaS54aG9mZS50b3AvYWxpc3QvYWxpX29wZW4vY29kZScsIHtcXFxcbiAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxcXG4gICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShib2R5KSxcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIGlmICghanNvbikge1xcXFxuICAgICAgICAgICAganNvbiA9IHBvc3QoJ2h0dHBzOi8vYXBpLWNmLm5uLmNpL2FsaXN0L2FsaV9vcGVuL2NvZGUnLCB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXFxcbiAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShib2R5KSxcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGlmIChqc29uLmluY2x1ZGVzKCdUb28gTWFueSBSZXF1ZXN0cycpIHx8IGpzb24uaW5jbHVkZXMoXFxcXFxcXCI1MDIgQmFkIEdhdGV3YXlcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFxcXFxcIumikee5geivt+axguaaguaXtuiiq+WwgeemgVxcXFxcXFxcblxcXFxcXFwiICsganNvbik7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICBsZXQgb3BlblJlc3VsdCA9IEpTT04ucGFyc2UoanNvbik7XFxcXG4gICAgICAgICAgICBpZiAob3BlblJlc3VsdC5yZWZyZXNoX3Rva2VuKSB7XFxcXG4gICAgICAgICAgICAgICAgdGhpcy5vcGVuVG9rZW5zLlJlZnJlc2hUb2tlbk9wZW4gPSBvcGVuUmVzdWx0LnJlZnJlc2hfdG9rZW47XFxcXG4gICAgICAgICAgICAgICAgdG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4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoYm9keS50b19kcml2ZV9pZCkge1xcXFxuICAgICAgICAgICAgICAgIGJvZHkudG9fZHJpdmVfaWQgPSB0aGlzLmRlZkRyaXZlSWRcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgYm9keTogYixcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICdhdXRob3JpemF0aW9uJzogdGhpcy5yZWFjY2Vzc1RrLFxcXFxuICAgICAgICAgICAgICAgICAgICAneC1zaGFyZS10b2tlbic6IHRoaXMuc2hhcmVUb2tlblxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgIH0pO1xcXFxuICAgICAgICByZXR1cm4gcmVzdWx0O1xcXFxuICAgIH0sXFxcXG4gICAgY29weUZpbGVUb0Nsb3VkRmlsZShmaWxlSWQsIHJldHJ5KSB7XFxcXG4gICAgICAgIGxldCByZXN1bHQgPSB0aGlzLl9jbG91ZEZpbGVPcGVyYXRlKHtcXFxcbiAgICAgICAgICAgIFxcXFxcXFwiZmlsZV9pZFxcXFxcXFwiOiBmaWxlSWQsXFxcXG4gICAgICAgICAgICBcXFxcXFxcInNoYXJlX2lkXFxcXFxcXCI6IHRoaXMuc2hhcmVJZCxcXFxcbiAgICAgICAgICAgIFxcXFxcXFwiYXV0b19yZW5hbWVcXFxcXFxcIjogdHJ1ZSxcXFxcbiAgICAgICAgICAgIFxcXFxcXFwidG9fcGFyZW50X2ZpbGVfaWRcXFxcXFxcIjogXFxcXFxcXCJyb290XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBcXFxcXFxcInRvX2RyaXZlX2lkXFxcXFxcXCI6IHRoaXMuZGVmRHJpdmVJZFxcXFxuICAgICAgICB9LCBcXFxcXFxcIjBcXFxcXFxcIiwgXFxcXFxcXC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6IGNsb3VkRmlsZUlkLFxcXFxuICAgICAgICAgICAgJ2RyaXZlX2lkJzogdGhpcy5kZWZEcml2ZUlkXFxcXG4gICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICdVc2VyLUFnZW50JzogUENfVUEsXFxcXG4gICAgICAgICAgICAnUmVmZXJlcic6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vJyxcXFxcbiAgICAgICAgICAgICdhdXRob3JpemF0aW9uJzogdGhpcy5vcGVuVG9rZW5zLkFjY2Vzc1Rva2VuT3BlblxcXFxuICAgICAgICB9LCAoZSkgPT4ge1xcXFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMzApLnRyeVNvbHZlKGUpO1xcXFxuICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMzApLnJlZnJlc2hPcGVuVG9rZW4oKTtcXFxcbiAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgYm9keToge1xcXFxuICAgICAgICAgICAgICAgICAgICAnZHJpdmVfaWQnOiB0aGlzLmRlZkRyaXZlSWQsXFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICdhdXRob3JpemF0aW9uJzogdGhpcy5vcGVuVG9rZW5zLkFjY2Vzc1Rva2VuT3BlblxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgIH0sIDIpO1xcXFxuICAgICAgICBpZiAoIWZpbGVJbmZvLnVybCB8fCBmaWxlSW5mby5jb2RlKSB0aHJvdyBuZXcgRXJyb3IoXFxcXFxcXCLkuIvovb3pk77mjqXojrflj5blpLHotKVcXFxcXFxcXG5cXFxcXFxcIiArIGZpbGVJbmZvLmNvZGUgKyBcXFxcXFxcIjpcXFxcXFxcIiArIGZpbGVJbmZvLm1lc3NhZ2UpO1xcXFxuICAgICAgICByZXR1cm4gZmlsZU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2V5LFxcXFxuICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAnVXNlci1BZ2VudCc6IFBDX1VBLFxcXFxuICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tJyxcXFxcbiAgICAgICAgICAgICdBdXRob3JpemF0aW9uJzogdGhpcy5yZWFjY2Vzc1RrLFxcXFxuICAgICAgICAgICAgJ1gtU2hhcmUtVG9rZW4nOiB0aGlzLnNoYXJlVG9rZW4sXFxcXG4gICAgICAgICAgICAneC1kZXZpY2UtaWQnOiB0aGlzLmFsaVRva2Vucy5kZXZpY2VfaWQsXFxcXG4gICAgICAgICAgICAneC1zaWduYXR1cmUnOiBuZXdTaWduLnNpZ25hdHVyZVxcXFxuICAgICAgICB9LCAoZSkgPT4ge1xcXFxuICAgICAgICAgICAgaWYgKGUubWVzc2FnZSA9PT0gXFxcXFxcXCJ4LWRldmljZS1pZCBlbXB0eVxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgdGhpcy53YWl0U2xlZXAoMjApLnJlZnJlc2hBY2Nlc3NUb2tlbigpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgdGhpcy50cnlTb2x2ZShlKTtcXFxcbiAgICAgICAgICAgIHRoaXMud2FpdFNsZWVwKDUwKTtcXFxcbiAgICAgICAgICAgIG5ld1NpZ24gPSBjYWxjdWxhdGVOZXdTaWduKCk7XFxcXG4gICAgICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJwdWJLZXlcXFxcXFxcIjogbmV3U2lnbi5wdWJLZXlcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgJ0F1dGhvcml6YXRpb24nOiB0aGlzLnJlYWNjZXNzVGssXFxcXG4g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JhbVRleHQuc3BsaXQoXFxcXFxcXCIsXFxcXFxcXCIpO1xcXFxuICAgICAgICBsZXQgcGFyYW1zVCA9IFtdO1xcXFxuICAgICAgICBmb3IgKGxldCBpIGluIHBhcmFtcykge1xcXFxuICAgICAgICAgICAgaWYgKGkgPT0gMykge1xcXFxuICAgICAgICAgICAgICAgIC8v6aKc6Imy5YC85Li6MOaXtu+8jOm7mOiupOiuvue9ruS4uueZveiJslxcXFxuICAgICAgICAgICAgICAgIGlmIChwYXJhbXNbaV0gPT0gXFxcXFxcXCIwXFxcXFxcXCIgfHwgcGFyYW1zW2ldID09IFxcXFxcXFwiLTFcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICBwYXJhbXNULnB1c2goXFxcXFxcXCIxNjc3NzIxNVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWVcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChpID09IDIpIHtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbXNULnB1c2goXFxcXFxcXCIyNVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHBhcmFtc1QucHVzaChwYXJhbXNbaV0pO1xcXFxuXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgcGFyYW1zVC5wdXNoKFxcXFxcXFwiMFxcXFxcXFwiLCBcXFxcXFxcIjBcXFxcXFxcIiwgXFxcXFxcXCIwXFxcXFxcXCIpO1xcXFxuICAgICAgICBkTWNvbnRleHQgKz0gYDxkIHA9XFxcXFxcXCIke3BhcmFtc1Quam9pbignLCcpfVxcXFxcXFwiPiR7ZW5jb2RlSHRtbChjb21tZW50VGV4dCl9PC9kPlxcXFxcXFxcbmA7XFxcXG4gICAgfVxcXFxuICAgIGlmICghZE1jb250ZXh0KSByZXR1cm47XFxcXG4gICAgZE1jb250ZXh0ID0gYDw/eG1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XFxcbiAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKGEpIHx8IE51bWJlci5pc05hTihiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+ivt+aMieagvOW8j+i+k+WFpeaVsOWtl1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAoYSA8IDEgfHwgYiA+IGVwaXNvZGVzLmxlbmd0aCkge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+ivt+i+k+WFpeinhOWumuiMg+WbtOWGheeahOaVsOWtl1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBjb25zdCBkYW5tdSA9ICQucmVxdWlyZShcXFxcXFxcImRhbm11XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGkgPSBhIC0gMSwgaiA9IDE7IGkgPCBiOyBpKyssIGorKykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGVwaXNvZGUgPSBlcGlzb2Rlc1tpXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkbVRpdGxlID0gYW5pbWVUaXRsZSArIFxcXFxcXFwiX1xcXFxcXFwiICsgZXBpc29kZS5lcGlzb2RlVGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaG93TG9hZGluZyhcXFxcXFxcIuato+WcqOS4i+i9ve+8mlxcXFxcXFwiICsgZXBpc29kZS5lcGlzb2RlVGl0bGUgKyBcXFxcXFxcIlxcXFxcXFxcdChcXFxcXFxcIiArIGogKyBcXFxcXFxcIi9cXFxcXFxcIiArIChiIC0gYSArIDEpICsgXFxcXFxcXCIpXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGFubXUuZG93bmxvYWREYW5NdShlcGlzb2RlLmVwaXNvZGVJZCwgZG1UaXRsZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcXFxuICAgICAgICAgICAgICAgICAgICBoaWRlTG9hZGluZygpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WTpuWTpuS4i+i9veWksei0pS4uLlxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBoaWRlTG9hZGluZygpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5LiL6L295a6M5oiQXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9LCBhbmltZS5hbmltZVRpdGxlLCBhbmltZS5lcGlzb2RlcyksXFxcXG4gICAgICAgICAgICBwaWNfdXJsOiBcXFxcXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbW92aWUvMTQuc3ZnXFxcXFxcXCJcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJsaW5lXFxcXFxcXCJcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgICAgIGZvciAobGV0IGVwaXNvZGUgb2YgYW5pbWUuZXBpc29kZXMpIHtcXFxcbiAgICAgICAgICAgIGxldCBkbVRpdGxlID0gYW5pbWUuYW5pbWVUaXRsZSArIFxcXFxcXFwiX1xcXFxcXFwiICsgZXBpc29kZS5lcGlzb2RlVGl0bGU7XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBlcGlzb2RlLmVwaXNvZGVUaXRsZSxcXFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoZXBpc29kZS5lcGlzb2RlSWQpLmxhenlSdWxlKCh1cmwsIHRpdGxlLCBvbmx5RG93bmxvYWQpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZGFubXUgPSAkLnJlcXVpcmUoXFxcXFxcXCJkYW5tdVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBhdGggPSBkYW5tdS5nZXRMb2NhbERhbk11KGlucHV0LCB0aXRsZSkgfHwgZGFubXUuZG93bmxvYWREYW5NdShpbnB1dCwgdGl0bGUpO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAob25seURvd25sb2FkKSByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+S4i+i9veWujOaIkFxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgZGFubXVUZXh0ID0gZmV0Y2gocGF0aCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICghZGFubXVUZXh0KSByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+i/mOayoeacieW8ueW5leWTn35cXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFZpZGVvVXJsKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhbm11OiBwYXRoXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICBiYWNrKGZhbHNlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/liqDovb3lrozmiJBcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICB9LCBNWV9QQVJBTVMuZHVybCwgZG1UaXRsZSwgb25seURvd25sb2FkKSxcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0XzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLlvLrliLbkuIvovb1cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChlcGlzb2RlVGl0bGUsIGVwaXNvZGVJZCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNob3dMb2FkaW5nKFxcXFxcXFwi6K+3562J5b6FXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGRhbm11ID0gJC5yZXF1aXJlKFxcXFxcXFwiZGFubXVcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGFubXUuZG93bmxvYWREYW5NdShlcGlzb2RlSWQsIGVwaXNvZGVUaXRsZSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGlkZUxvYWRpbmcoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+mHjeaWsOS4i+i9veWujOaIkO+8jOWNleWHu+aMgui9veOAglxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgZG1UaXRsZSwgZXBpc29kZS5lcGlzb2RlSWQpXFxcXG4gICAgICAgICAgICAgICAgICAgIH1dXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImxpbmVfYmxhbmtcXFxcXFxcIlxcXFxuICAgICAgICB9KTtcXFxcbiAgICB9XFxcXG4gICAgaWYgKCFkbUxpc3QuYW5pbWVzLmxlbmd0aCkge1xcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IFxcXF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BpLmh1bmhlcGFuLmNvbS92MS9zZWFyY2hcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIGxldCBqc29uID0gcG9zdCh1cmwsIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIFJlZmVyZXI6IFxcXFxcXFwiaHR0cHM6Ly9odW5oZXBhbi5jb20vXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJxXFxcXFxcXCI6IHMsXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGFnZVxcXFxcXFwiOiBwYWdlLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInNpemVcXFxcXFxcIjogMTVcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICBqc29uID0gSlNPTi5wYXJzZShqc29uKTtcXFxcbiAgICAgICAgICAgIGxldCBsaXN0ID0ganNvbi5kYXRhLmxpc3Q7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsaXN0Lmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gbGlzdFtpXTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaXQuZGlza190eXBlICE9PSBcXFxcXFxcIkFMWVxcXFxcXFwiIHx8IGl0LnNoYXJlX3VzZXIgPT09IFxcXFxcXFwi5Li2Kioq5Li2XFxcXFxcXCIpIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC5kaXNrX25hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBkKGl0LCBcXFxcXFxcImltZyYmc3JjXFxcXFxcXCIsIHVybCksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogaXQubGluayxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogaXQudXBkYXRlX3RpbWUgKyBcXFxcXFxcIlxcXFxcXFxcblxcXFxcXFwiICsgaXQubGluayxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSwge1xcXFxuICAgICAgICBuYW1lOiBcXFxcXFxcIui1hOa6kOW4rlxcXFxcXFwiLFxcXFxuICAgICAgICBwYWdlOiB0cnVlLFxcXFxuICAgICAgICBmaW5kKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGZ1bmN0aW9uIHNlYXJjaCgpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcnRuTGlzdCA9IFtdO1xcXFxuICAgICAgICAgICAgICAgIGxldCByZXNwID0gcmVxdWVzdChcXFxcXFxcImh0dHBzOi8venliLnVweXVuc28uY29tL3YxNS9zZWFyY2g/a2V5d29yZD1cXFxcXFxcIiArIGVuX2FlcyhzKSArIFxcXFxcXFwiJnNfdHlwZT0yJnBhZ2U9XFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCImYXRrPSZkaWQ9XFxcXFxcXCIgKyBnZW5lcmF0ZVJhbmRvbUhleFN0cmluZyg2NCksIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1c2VyLWFnZW50XFxcXFxcXCI6IFxcXFxcXFwiTW96aWxsYS81LjAgKExpbnV4OyBBbmRyb2lkIDEwOyBSZWRtaSBOb3RlIDcgQnVpbGQvUUtRMS4xOTA5MTAuMDAyOyB3dikgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgVmVyc2lvbi80LjAgQ2hyb21lLzgxLjAuNDA0NC4xMzggTW9iaWxlIFNhZmFyaS81MzcuMzYgdW5pLWFwcCBIdG1sNVBsdXMvMS4wIChJbW1lcnNlZC8yOS4wOTA5MSlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgcmVzcERhdGEgPSBkZV9hZXMocmVzcCk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGpzb25EYXRhID0gSlNPTi5wYXJzZShyZXNwRGF0YSkgfHwge307XFxcXG4gICAgICAgICAgICAgICAgbGV0IHJlc3VsdCA9IGpzb25EYXRhLnJlc3VsdCB8fCB7fTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSByZXN1bHQuaXRlbXMgfHwgW107XFxcXG4gICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBpdGVtcy5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgaXRlbSA9IGl0ZW1zW2ldO1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgY29udGVudCA9IGl0ZW0uY29udGVudCB8fCBbXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGNvbnRlbnQubGVuZ3RoID09IDB8fCFpdGVtLnBhZ2VfdXJsKSBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9IGRlX2FlcyhpdGVtLnBhZ2VfdXJsKSB8fCBcXFxcXFxcIlxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoIXVybCkgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJ0bkxpc3QucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogKGl0ZW0udGl0bGUubGVuZ3RoPjMwP2l0ZW0udGl0bGUuc2xpY2UoMCwyNykrXFxcXFxcXCIuLi5cXFxcXFxcIjppdGVtLnRpdGxlKSB8fCBcXFxcXFxcIlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCLliIbkuqvml7bpl7TvvJpcXFxcXFxcIitpdGVtLmluc2VydF90aW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJ0bkxpc3Q7XFxcXG4gICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGdlbmVyYXRlUmFuZG9tSGV4U3RyaW5nKGxlbmd0aCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCByZXN1bHQgPSBcXFxcXFxcIlxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIGNvbnN0IGNoYXJhY3RlcnMgPSBcXFxcXFxcIjAxMjM0NTY3ODlhYmNkZWZcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICBjb25zdCBjaGFyYWN0ZXJzTGVuZ3RoID0gY2hhcmFjdGVycy5sZW5ndGg7XFxcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXN1bHQgKz0gY2hhcmFjdGVycy5jaGFyQXQoTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogY2hhcmFjdGVyc0xlbmd0aCkpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGV0IGFsaVV0aWwgPSAkLnJlcXVpcmUoXFxcXFxcXCJhbGlVdGlsXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgbGV0IENyeXB0b0pTID0gYWxpVXRpbC5nZXRDcnlwdG9KUygpO1xcXFxuXFxcXG4gICAgICAgICAgICBmdW5jdGlvbiBlbl9hZXMoZSkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpID0gXFxcXFxcXCJxcTE5MjA1MjA0NjBxcXp6XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgLy8gZW5fYWVzXFxcXG4gICAgICAgICAgICAgICAgbGV0IGtleSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKGkpO1xcXFxuICAgICAgICAgICAgICAgIHZhciB0ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoZSksXFxcXG4gICAgICAgICAgICAgICAgICAgIHIgPSBDcnlwdG9KUy5BRVMuZW5jcnlwdCh0LCBrZXksIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGl2OiBrZXksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHIuY2lwaGVydGV4dC50b1N0cmluZygpO1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICBmdW5jdGlvbiBkZV9hZXModnYpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaSA9IFxcXFxcXFwicXExOTIwNTIwNDYwcXF6elxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIC8vIGRlX2Flc1xcXFxuICAgICAgICAgICAgICAgIGxldCBrZXkgPSBDcnlwdG9KUy5lbmMuVXRmOC5wYXJzZShpKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaGV4VmFsID0gQ3J5cHRvSlMuZW5jLkhleC5wYXJzZSh2diksXFxcXG4gICAgICAgICAgICAgICAgICAgIHZhbCA9IENyeXB0b0pTLmVuYy5CYXNlNjQuc3RyaW5naWZ5KGhleFZhbCksXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlY3J5cHRlZCA9IENyeXB0b0pTLkFFUy5kZWNyeXB0KHZhbCwga2V5LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpdjoga2V5LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbW9kZTogQ3J5cHRvSlMubW9kZS5DQkMsXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBkZWNyeXB0ZWQudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIHNlYXJjaCgpO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSwge1xcXFxuICAgICAgICBuYW1lOiBcXFxcXFxcIuS6keebmOi1hOa6kFxcXFxcXFwiLFxcXFxuICAgICAgICBwYWdlOiB0cnVlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcXFxcXCJodHRwczovL3Jlcy55dW5wYW4ud2luLz9QYWdlSW5kZXg9XFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCImUGFnZVNpemU9MTImS2V5d29yZD1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZUeXBlPSZUYWc9XFxcXFxcXCI7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3Jlcy55dW5wYW4ud2luL1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgIGxld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uICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwiVVDkupHmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXFxcXFwiaHR0cHM6Ly9hcGkudXB5dW5zbzIuY29tL3NlYXJjaD9rZXl3b3JkPVxcXFxcXFwiICsgcyArIFxcXFxcXFwiJnBhZ2U9XFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCImc190eXBlPTFcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdCh1cmwsIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiUmVmZXJlclxcXFxcXFwiOiBcXFxcXFxcImh0dHBzOi8vd3d3LnVweXVuc28uY29tXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiQ29va2llXFxcXFxcXCI6IFxcXFxcXFwiY29kZT0xOTE5XFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIC8vbG9nKGJhc2U2NERlY29kZShodG1sKSk7XFxcXG4gICAgICAgICAgICBsZXQgYXJyID0gSlNPTi5wYXJzZShiYXNlNjREZWNvZGUoaHRtbCkpLnJlc3VsdC5pdGVtcztcXFxcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgaWYgKCFhcnIpIHJldHVybiBbXTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gaXQucGFnZV91cmw7XFxcXG4gICAgICAgICAgICAgICAgLy91ID0gdS5sZW5ndGggPiAwID8gdVswXSA6IHVybDtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIXUuaW5jbHVkZXMoXFxcXFxcXCJhbGl5dW5kcml2ZVxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIgKyAodSksXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwi54yr54u455uY5pCcXFxcXFxcXCIsXFxcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoXFxcXFxcXCJodHRwczovL3d3dy5hbGlwYW5zb3UuY29tL3NlYXJjaD9rPVxcXFxcXFwiICsgcywge1xcXFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJSZWZlcmVyXFxcXFxcXCI6IFxcXFxcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbS9zZWFyY2g/az1cXFxcXFxcIiArIHNcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwZGZhKGh0bWwsIFxcXFxcXFwiI2FwcCYmYVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBcXFxcXFxcIjxkaXY+XFxcXFxcXCIgKyBhcnJbaV0gKyBcXFxcXFxcIjwvZGl2PlxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGRmaChpdCwgXFxcXFxcXCJhJiZocmVmXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIC8vbG9nKHUpO1xcXFxuICAgICAgICAgICAgICAgIGlmICghdS5pbmNsdWRlcyhcXFxcXFxcIi9zL1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgdSA9IFxcXFxcXFwiaHR0cHM6Ly93d3cuYWxpcGFuc291LmNvbVxcXFxcXFwiICsgdS5yZXBsYWNlKFxcXFxcXFwiL3MvXFxcXFxcXCIsIFxcXFxcXFwiL2N2L1xcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGRmaChpdCwgXFxcXFxcXCJ0ZW1wbGF0ZSYmVGV4dFxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBwZGZoKGl0LCBcXFxcXFxcInRlbXBsYXRlLDEmJlRleHRcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcXFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0LCB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIkNvb2tpZVxcXFxcXFwiOiBcXFxcXFxcIm5vX3Nob3dfZG9uYXRlPTFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJSZWZlcmVyXFxcXFxcXCI6IGlucHV0LnJlcGxhY2UoXFxcXFxcXCIvY3YvXFxcXFxcXCIsIFxcXFxcXFwiL3MvXFxcXFxcXCIpXFxcXG4gICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICByZWRpcmVjdDogZmFsc2VcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgaHRtbCA9IHBhcnNlRG9tRm9ySHRtbChodG1sLCAnYSYmaHJlZicpO1xcXFxuICAgICAgICAgICAgaWYgKGh0bWwubGVuZ3RoID4gMCkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBodG1sO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gaW5wdXQ7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLmmJPmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgbGV0IGFsaVV0aWwgPSAkLnJlcXVpcmUoXFxcXFxcXCJhbGlVdGlsXFxcXFxcXCIpO1xcXF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gICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3lpc28uZnVuL2luZm8/c2VhcmNoS2V5PVxcXFxcXFwiICsgcyxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJDb29raWVcXFxcXFxcIjogZ2V0SXRlbSgneWlzb3Vjb29rZScsICcnKVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgLy9sb2coaHRtbCk7XFxcXG4gICAgICAgICAgICBpZiAoaHRtbC5pbmNsdWRlcygn55m75b2V55So5oi35peg6ZmQ5Yi2JykpIHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XFxcXG4gICAgICAgICAgICAgICAgZG8ge1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgdHlpbWdsaW4gPSAnaHR0cHM6Ly95aXNvLmZ1bi9hcGkvdXNlci9sb2dpbi9jYXB0Y2hhP3Q9JyArIHBhcnNlSW50KG5ldyBEYXRlKCkuZ2V0VGltZSgpKSArICcnO1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgaW1nID0gY29udmVydEJhc2U2NEltYWdlKHR5aW1nbGluKS5zcGxpdCgnLCcpWzFdO1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgY29kID0gcmVxdWVzdCgnaHR0cHM6Ly9hcGkueGhvZmUudG9wL29jci9iNjQvdGV4dCcsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29udGVudC1UeXBlJzogJ3RleHQvcGxhaW4nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogaW1nLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciB2ZXIgPSBKU09OLnBhcnNlKHJlcXVlc3QoJ2h0dHBzOi8veWlzby5mdW4vYXBpL3VzZXIvbG9naW4nLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQtdHlwZSc6ICdhcHBsaWNhdGlvbi9qc29uJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAncmVmZXJlcic6ICdodHRwczovL3lpc28uZnVuL2xvZ2luJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAnQ29va2llJzogZ2V0Q29va2llKHR5aW1nbGluKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInVzZXJOYW1lXFxcXFxcXCI6IFxcXFxcXFwidHZib3gyMDIzXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJwYXNzd29yZFxcXFxcXFwiOiBcXFxcXFxcIlR2Ym94MjAyM1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiY29kZVxcXFxcXFwiOiBjb2RcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcXFxuICAgICAgICAgICAgICAgICAgICB9KSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmICh2ZXIuY29kZSA9PSAyMDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvZygn5piT5pCc55m75YWl6aqM6K+B5oiQ5YqfJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKCd5aXNvdWNvb2tlJywgZ2V0Q29va2llKCdodHRwczovL3lpc28uZnVuJykpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaHRtbCA9IHJlcXVlc3QoXFxcXFxcXCJodHRwczovL3lpc28uZnVuL2FwaS9zZWFyY2g/bmFtZT1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZwYWdlTm89XFxcXFxcXCIgKyBwYWdlLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3lpc28uZnVuL2luZm8/c2VhcmNoS2V5PVxcXFxcXFwiICsgcyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJDb29raWVcXFxcXFxcIjogZ2V0SXRlbSgneWlzb3Vjb29rZScsICcnKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgaSsrO1xcXFxuICAgICAgICAgICAgICAgIH0gd2hpbGUgKGkgPCA0KTtcXFxcblxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGV0IGFyciA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YS5saXN0O1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdSA9IGtleWVuKGl0LnVybCk7XFxcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHUgPT0gbnVsbCB8fCAhdS5pbmNsdWRlcyhcXFxcXFxcImFsaXl1blxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0Lm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogKGl0LmdtdFNoYXJlIHx8IGl0LmdtdENyZWF0ZSkgKyBcXFxcXFxcIlxcXFxcXFxcblxcXFxcXFwiICsgKHUpLFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sXFxcXG4gICAge1xcXFxuICAgICAgICBuYW1lOiBcXFxcXFxcIuaJvui1hOa6kFxcXFxcXFwiLFxcXFxuICAgICAgICBwYWdlOiB0cnVlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBmdW5jdGlvbiBnZXRodG1sKCkge1xcXFxuICAgICAgICAgICAgICAgIGxldCBodG1sID0gcmVxdWVzdChcXFxcXFxcImh0dHBzOi8vemhhb3ppeXVhbi5tZS9zbz9maWxlbmFtZT1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZwYWdlPVxcXFxcXFwiICsgcGFnZSwge1xcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3poYW96aXl1YW4ubWUvc3RvcC5odG1sXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIm9yaWdpblxcXFxcXFwiOiBcXFxcXFxcImh0dHBzOi8vemhhb3ppeXVhbi5tZVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJDb29raWVcXFxcXFxcIjogZ2V0SXRlbShcXFxcXFxcInp6eWNvb2tlXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1cGdyYWRlLWluc2VjdXJlLXJlcXVlc3RzXFxcXFxcXCI6IFxcXFxcXFwiMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJjb250ZW50LXR5cGVcXFxcXFxcIjogXFxcXFxcXCJhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWRcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGh0bWw7XFxcXG4gICAgICAgICAgICB9O1xcXFxuICAgICAgICAgICAgdmFyIGh0bWwgPSBnZXRodG1sKCk7XFxcXG4gICAgICAgICAgICBpZiAoIWh0bWwuaW5jbHVkZXMoXFxcXFxcXCJzZWFyY2hfYm94XFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVzZXIgPSAnZFhObGNtNWhiV1U5ZVhCcU1qQXlNeVp3WVhOemQyOXlaRDE1Y0dveU1ESXonO1xcXFxuICAgICAgICAgICAgICAgIGxldCBjb29rID0gSlNPTi5wYXJzZShmZXRjaENvb2tpZSgnaHR0cHM6Ly96aGFveml5dWFuLm1lL2xvZ2l1Lmh0bWwnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdVc2VyLUFnZW50JzogTU9CSUxFX1VBLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ0NvbnRlbnQtVHlwZSc6ICdhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ09yaWdpbic6ICdodHRwczovL3poYW96aXl1YW4ubWUnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJ1JlZmVyZXInOiAnaHR0cHM6Ly96aGFveml5dWFuLm1lL2xvZ2luLmh0bWwnLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJ1cGdyYWRlLWluc2VjdXJlLXJlcXVlc3RzXFxcXFxcXCI6IFxcXFxcXFwiMVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHk6IGJhc2U2NERlY29kZSh1c2VyKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCcsXFxcXG4gICAgICAgICAgICAgICAgICAgIG9ubHlIZWFkZXJzOiB0cnVlLFxcXFxuICAgICAgICAgICAgICAgICAgICB3aXRoSGVhZGVyczogdHJ1ZVxcXFxuICAgICAgICAgICAgICAgIH0pKS5qb2luKCc7Jyk7XFxcXG4gICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInp6eWNvb2tlXFxcXFxcXCIsIGNvb2spO1xcXFxuICAgICAgICAgICAgICAgIGxvZyhcXFxcXFxcIuaJvui1hOa6kOeZu+WFpVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBodG1sID0gZ2V0aHRtbCgpO1xcXFxuICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICBsZXQgYXJyID0gcGRmYShodG1sLCBcXFxcXFxcImJvZHkmJi5uZXdzTGlzdCYmbGk6bm90KDpmaXJzdC1jaGlsZClcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAvL2xvZyhhcnIpO1xcXFxuICAgICAgICAgICAgbGV0IGQgPSBbXTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gYXJyW2ldO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gcGRmaChpdCwgXFxcXFxcXCJhJiZocmVmXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIGlmICh1ID09IG51bGwpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHUgPSBcXFxcXFxcImh0dHBzOi8vemhhb3ppeXVhbi5tZS9cXFxcXFxcIiArIHU7XFxcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gcGRmaChpdCwgXFxcXFxcXCIubmV3c190ZXh0JiZoMyYmVGV4dFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIXRpdGxlKSBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBkZmgoaXQsIFxcXFxcXFwiLm5ld3NfdGV4dCYmcCYmVGV4dFxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfSxcXFxcbiAgICAgICAgZmluZEFsaVVybChpbnB1dCkge1xcXFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KGlucHV0KTtcXFxcbiAgICAgICAgICAgIHZhciBfbGlua3MgPSBodG1sLm1hdGNoKC9odHRwczpcXFxcXFxcXC9cXFxcXFxcXC8od3d3XFxcXFxcXFwuYWxpeXVuZHJpdmVcXFxcXFxcXC5jb21cXFxcXFxcXC9zfGFseXdwXFxcXFxcXFwubmV0KVxcXFxcXFxcL1xcXFxcXFxcdyovZykgfHwgW107XFxcXG5cXFxcbiAgICAgICAgICAgIGlmIChfbGlua3MubGVuZ3RoID4gMCkge1xcXFxuXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIF9saW5rc1swXTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGlucHV0O1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwi5bCP57q45p2hXFxcXFxcXCIsXFxcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBsZXQgYWxpVXRpbCA9ICQucmVxdWlyZShcXFxcXFxcImFsaVV0aWxcXFxcXFxcIik7XFxcXG5cXFxcbiAgICAgICAgICAgIGZ1bmN0aW9uIGdldHRva2VuKCkge1xcXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcigneHp5dG9rZW4nLCAnJykubGVuZ3RoID09IDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRva2VuID0gSlNPTi5wYXJzZShwb3N0KCdodHRwczovL2dpdGNhZmUubmV0L3Rvb2wvYWxpcGFwZXIvJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vdS5naXRjYWZlLmluay8nXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9ke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LFxcXFxuICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgYWN0aW9uOiBcXFxcXFxcInNlYXJjaFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBmcm9tOiBcXFxcXFxcIndlYlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICB0b2tlbjogZ2V0dG9rZW4oKSxcXFxcbiAgICAgICAgICAgICAgICAgICAga2V5d29yZDogc1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCk7XFxcXG4gICAgICAgICAgICBpZiAobGlzdC5kYXRhKSB7XFxcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGxpc3QuZGF0YTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGxpc3RbaV1cXFxcbiAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSBpdC50aXRsZTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgbXVybCA9ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgaXQuYWxpa2V5XFxcXG4gICAgICAgICAgICAgICAgaWYgKCFhbGlVdGlsLmNoZWNrYWxpKG11cmwpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAodGl0bGUuaW5jbHVkZXMocykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIuKImiBcXFxcXFxcIiArIHRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogY2F0X2NvZGUoaXQuY2F0KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzOiBpdC5kZXNcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IG11cmxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLnjqnlgbblk6Xlk6VcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXFxcXFwiaHR0cDovL3dvZ2cueHl6L2luZGV4LnBocC92b2RzZWFyY2gvXFxcXFxcXCIgKyBzICsgXFxcXFxcXCItLS0tLS0tLS0tXFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCItLS0uaHRtbFxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCwge30pO1xcXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgJy5tb2R1bGUtaXRlbXMmJi5tb2R1bGUtc2VhcmNoLWl0ZW0nKTtcXFxcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgbGV0IGJldCA9IFtdO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxcXG4gICAgICAgICAgICAgICAgbGV0IHV0aXRsZSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2gzJiZhJiZUZXh0Jyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVzZXJpYWwgPSBwYXJzZURvbUZvckh0bWwoaXQsICcudmlkZW8tc2VyaWFsJiZUZXh0Jyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVpbWFnZSA9IHBhcnNlRG9tKGl0LCAnLmxhenlsb2FkJiZkYXRhLXNyYycsICdodHRwOi8vd29nZy54eXovJyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbShpdCwgJ2gzJiZhJiZocmVmJywgJ2h0dHA6Ly93b2dnLnh5ei8nKTtcXFxcbiAgICAgICAgICAgICAgICAvL2xldCBkZXQgPSByZXF1ZXN0KHUsIHt9KTtcXFxcbiAgICAgICAgICAgICAgICBiZXQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB1dGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXFxcbiAgICAgICAgICAgICAgICAgICAgaW1hZ2U6IHVpbWFnZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogdXNlcmlhbFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKGJldC5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGJldGggPSBiYXRjaEZldGNoKGJldCk7XFxcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBiZXRoLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShiZXRoW2ldLCAnLm1vZHVsZS1wbGF5ZXItbGlzdCYmcCcpXFxcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ3AmJlRleHQnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghdS5pbmNsdWRlcyhcXFxcXFxcIi9zL1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYmV0W2ldLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGJldFtpXS5pbWFnZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogYmV0W2ldLmRlc2MgKyAnXFxcXFxcXFxuJyArIHUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLpmL/ph4zkupHnm5jnvZFcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgbGV0IHVybCA9IFxcXFxcXFwiaHR0cHM6Ly93d3cuYWx5cHcuY24vc2VhcmNoLnBocD9xPVxcXFxcXFwiICsgcyArIFxcXFxcXFwiJnBhZ2U9XFxcXFxcXCIgKyBwYWdlO1xcXFxuICAgICAgICAgICAgbGV0IGh0bWwgPSByZXF1ZXN0KHVybCwge30pO1xcXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBhcnNlRG9tRm9yQXJyYXkoaHRtbCwgJy5saXN0JiZsaScpO1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBsZXQgYmV0ID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdXRpdGxlID0gcGFyc2VEb21Gb3JIdG1sKGl0LCAnYSYmdGl0bGUnKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdXNlcmlhbCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5mYS1jbG9jay1vJiZUZXh0Jyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVpbWFnZSA9IHBhcnNlRG9tKGl0LCAnaW1nJiZzcmMnLCAnaHR0cHM6Ly93d3cuYWx5cHcuY24vJyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbShpdCwgJ2EmJmhyZWYnLCAnaHR0cHM6Ly93d3cuYWx5cHcuY24vJyk7XFxcXG4gICAgICAgICAgICAgICAgLy9sZXQgZGV0ID0gcmVxdWVzdCh1LCB7fSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKCF1dGl0bGUuaW5jbHVkZXMocykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGJldC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHV0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcXFxuICAgICAgICAgICAgICAgICAgICBpbWFnZTogdWltYWdlLFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiB1c2VyaWFsXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAvL2xvZyhiZXQpO1xcXFxuICAgICAgICAgICAgaWYgKGJldC5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGJldGggPSBiYXRjaEZldGNoKGJldCk7XFxcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBiZXRoLmxlbmd0aDsgaSsrKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gcGFyc2VEb21Gb3JBcnJheShiZXRoW2ldLCAnYm9keSYmYVtocmVmXj1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9dJylcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9sb2cobGlzdCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwgJ2EmJmhyZWYnKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGJldFtpXS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBiZXRbaV0uaW1hZ2UsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGJldFtpXS5kZXNjICsgJ1xcXFxcXFxcbicgKyB1LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwi5Zyf5ouo6bygXFxcXFxcXCIsXFxcXG4gICAgICAgIHBhZ2U6IGZhbHNlLFxcXFxuICAgICAgICBmaW5kOiBmdW5jdGlvbihzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IGZldGNoKCdodHRwczovL3d3dy50YnNkeS5jb20vc2VhcmNoLmh0bWw/a2V5d29yZD0nICsgcyArICcmY2F0ZWdvcnk9OTgzOTIwJmRhdGFfdHlwZT05ODc5MTAnLCB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICAnVXNlci1BZ2VudCc6IFBDX1VBXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuc2VhcmNoX3Jlc3VsdF9uZXRkaXNrX2xpc3QmJmEnKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICAvL2xvZyhpdCk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBwYXJzZURvbUZvckh0bWwoaXQsICdhJiZocmVmJyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHRpdCA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJy5uZXRkaXNrX2l0ZW1fZGV0YWlsX25hbWUmJlRleHQnKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIXRpdC5pbmNsdWRlcyhzKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgLy9sb2codSk7XFxcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdCxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1LFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFxcXFxcIlxcXFxcXFxcblxcXFxcXFwiICsgdSxcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICB7XFxcXG4gICAgICAgIG5hbWU6IFxcXFxcXFwi6Zi/6YeM5pCcXFxcXFxcXCIsXFxcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoJ2h0dHBzOi8vYWxpc28uY2Mvcy8nICsgcyArICctJyArIHBhZ2UgKyAnLTAuaHRtbCcsIHt9KTtcXFxcblxcXFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuc2VhcmNoLXJlc3VsdCYmLnJlc291cmNlLWl0ZW0nKTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgbGlzdC5sZW5ndGg7IGorKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCB1ID0gbGlzdFtqXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdGl0ID0gcGFyc2VEb21Gb3JIdG1sKHUsICdoMyYmVGV4dCcpO1xcXFxuICAgICAgICAgICAgICAgIGlmICghdGl0LmluY2x1ZGVzKHMpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0LFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHBhcnNlRG9tKHUsICdoMyYmYSYmaHJlZicsICdodHRwczovL2FsaXNvLmNjLycpLFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBwYXJzZURvbUZvckh0bWwodSwgJy50aW1lJiZUZXh0JyksXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkO1xcXFxuICAgICAgICB9LFxcXFxuICAgICAgICBmaW5kQWxpVXJsKGlucHV0KSB7XFxcXG4gICAgICAgICAgICBldmFsKGdldENyeXB0b0pTKCkpO1xcXFxuXFxcXG4gICAgICAgICAgICBmdW5jdGlvbiBkZWNyeShzdHIpIHtcXFxcbiAgICAgICAgICAgICAgICB2YXIga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoXFxcXFxcXCI5RUIyMERERkQ2QUZCRDY4XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBlbmNyeXB0ZWQgPSBDcnlwdG9KUy5BRVMuZGVjcnlwdChzdHIsIGtleSwge1xcXFxuICAgICAgICAgICAgICAgICAgICBpdjoga2V5LFxcXFxuICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkNCQyxcXFxcbiAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogQ3J5cHRvSlMucGFkLlBrY3M3XFxcXG4gICAgICAgICAgICAgICAgfSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xcXFx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wdG9KUy5BRVMuZGVjcnlwdChzdHIsIGtleSwge1xcXFxuICAgICAgICAgICAgICAgICAgICBtb2RlOiBDcnlwdG9KUy5tb2RlLkVDQixcXFxcbiAgICAgICAgICAgICAgICAgICAgcGFkZGluZzogQ3J5cHRvSlMucGFkLlBrY3M3XFxcXG4gICAgICAgICAgICAgICAgfSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBlbmNyeXB0ZWQ7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoJ2h0dHBzOi8vd3d3Lnl1bnBhbmZlbnhpYW5nLmNuL2FwaS9iYnMvYXBpL2dldGRhdGE/a2V5PScgKyBzICsgJyZ0eXBlPXZpZGVvJywge1xcXFxuICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJSZWZlcmVyXFxcXFxcXCI6IFxcXFxcXFwiaHR0cHM6Ly93d3cueXVucGFuZmVueGlhbmcuY24vXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIGxldCBqc29uID0gZGVjcnkoSlNPTi5wYXJzZShodG1sKS5kYXRhKTtcXFxcbiAgICAgICAgICAgIC8vbG9nKGpzb24pO1xcXFxuICAgICAgICAgICAgbGV0IGFyciA9IEpTT04ucGFyc2UoanNvbik7IC8vWzBdLnJlc3VsdC5pdGVtcztcXFxcbiAgICAgICAgICAgIC8vbG9nKGFycik7XFxcXG5cXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBsZXQgYmV0ID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gaXQucGlkO1xcXFxuICAgICAgICAgICAgICAgIGJldC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAnaHR0cHM6Ly93d3cueXVucGFuZmVueGlhbmcuY24vYXBpL2Jicy9hcGkvZ2V0YXJ0aWNsZT9pZD0nICsgdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICBvcHRpb25zOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJSZWZlcmVyXFxcXFxcXCI6IFxcXFxcXFwiaHR0cHM6Ly93d3cueXVucGFuZmVueGlhbmcuY24vXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgLy9sb2codSk7XFxcXG4gICAgICAgICAgICBsZXQgYmV0aCA9IGJhdGNoRmV0Y2goYmV0KTtcXFxcblxcXFxuICAgICAgICAgICAgLy9sb2coYXJ0aWNsZSk7XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGJldGgubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoYmV0aFtpXSkuZGF0YTtcXFxcbiAgICAgICAgICAgICAgICAvL2xvZyhqc29uKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IGpzb24uZG93bmxvYWQuc3BsaXQoJ0AnKTtcXFxcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBqID0gMDsgaiA8IGxpc3QubGVuZ3RoOyBqKyspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHUgPSBsaXN0W2pdO1xcXFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGpzb24udGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy8nICsgdSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGpzb24uY3JlYXRldGltZSArIFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIgKyAnaHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvJyArIHUsXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogXFxcXFxcXCLnm5jmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogdHJ1ZSxcXFxcbiAgICAgICAgZmluZDogZnVuY3Rpb24ocywgcGFnZSkge1xcXFxuICAgICAgICAgICAgcGFnZSA9IChwYWdlIC0gMSkgKiAxMDtcXFxcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFxcXFxcImh0dHBzOi8vd3d3LnBhbnNlYXJjaC5tZS9zZWFyY2g/a2V5d29yZD1cXFxcXFxcIiArIHMgKyBcXFxcXFxcIiZvZmZzZXQ9XFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCImcGFuPWFsaXl1bmRyaXZlXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsLCB7fSk7XFxcXG5cXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBwYXJzZURvbUZvckFycmF5KGh0bWwsICcuZ3JpZCYmLnNoYWRvdzpoYXMoYVtocmVmXj1odHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vcy9dKScpO1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBhcnNlRG9tRm9ySHRtbChpdCwgJ2FbaHJlZl49aHR0cHM6Ly93d3cuYWxpeXVuZHJpdmUuY29tL3MvXSYmaHJlZicpO1xcXFxuICAgICAgICAgICAgICAgIGxldCBwaWNfdXJsID0gcGFyc2VEb21Gb3JIdG1sKGl0LCAnaW1nJiZzcmMnKTtcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGFyc2VEb21Gb3JIdG1sKGl0LCAnLmJyZWFrLWFsbCYmVGV4dCcpLnNwbGl0KCdodHRwJylbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBpY191cmwgPT09IFxcXFxcXFwiL2Zhdmljb24ucG5nXFxcXFxcXCIgPyBcXFxcXFxcImh0dHBzOi8vd3d3LnBhbnNlYXJjaC5tZS9cXFxcXFxcIiArIHBpY191cmwgOiBwaWNfdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IHBhcnNlRG9tRm9ySHRtbChpdCwgJ3AmJlRleHQnKSArIFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIgKyB1LFxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICByZXR1cm4gZDtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sXFxcXG4gICAge1xcXFxuICAgICAgICBuYW1lOiBcXFxcXFxcIkRPVljmkJxcXFxcXFxcIixcXFxcbiAgICAgICAgcGFnZTogZmFsc2UsXFxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGxldCB1cmwgPSBcXFxcXFxcImh0dHBzOi8vYXBpLmRvdngudGsvYWxpL3NlYXJjaD93ZD1cXFxcXFxcIiArIHM7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QodXJsKTtcXFxcbiAgICAgICAgICAgIGxldCBhcnIgPSBKU09OLnBhcnNlKGh0bWwpLmxpc3Q7XFxcXG4gICAgICAgICAgICBsZXQgZCA9IFtdO1xcXFxuICAgICAgICAgICAgbGV0IGFsaVV0aWwgPSAkLnJlcXVpcmUoXFxcXFxcXCJhbGlVdGlsXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBhcnJbaV07XFxcXG4gICAgICAgICAgICAgICAgbGV0IHUgPSBpdC52b2RfY29udGVudDtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIXUuaW5jbHVkZXMoXFxcXFxcXCJhbGl5dW5kcml2ZVxcXFxcXFwiKSB8fCAhYWxpVXRpbC5jaGVja2FsaSh1KSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi4oiaIFxcXFxcXFwiICsgaXQudm9kX25hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGl0LnZvZF9waWMsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcXFxcXCJcXFxcXFxcXG5cXFxcXFxcIiArIHUsXFxcXG4gICA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ZywqLyo7cT0wLjgsYXBwbGljYXRpb24vc2lnbmVkLWV4Y2hhbmdlO3Y9YjM7cT0wLjlcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgbGV0IGFyciA9IHBkZmEoaHRtbCwgXFxcXFxcXCJib2R5JiZhXFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgLy9sb2coYXJyKTtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdCA9IGFycltpXTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdSA9IHBkKGl0LCBcXFxcXFxcImEmJmhyZWZcXFxcXFxcIiwgdXJsKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdCA9IHBkZmgoaXQsIFxcXFxcXFwiYSYmVGV4dFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoaXQuaW5jbHVkZXMoXFxcXFxcXCJOZXh0IHBhZ2VcXFxcXFxcIikgfHwgaXQuaW5jbHVkZXMoXFxcXFxcXCLkuIvkuIDpobVcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHUyID0gcGQoaXQsIFxcXFxcXFwiYSYmaHJlZlxcXFxcXFwiLCB1cmwpO1xcXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhcXFxcXFxcIm5leHQgcGFnZVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgLy9sb2codTIpO1xcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFxcXFxcImJpbmdcXFxcXFxcIiwgdTIpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZiAodSA9PSBudWxsIHx8IHQgPT0gbnVsbCB8fCAhaX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W5rcy5sZW5ndGggPiAxICYmIF9saW5rc1sxXS5yZXBsYWNlKF9saW5rc1swXSwgXFxcXFxcXCJcXFxcXFxcIikucmVwbGFjZSgvW2EtekEtWjAtOV0rL2csIFxcXFxcXFwiXFxcXFxcXCIpID09IFxcXFxcXFwiXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgYyA9IF9saW5rc1sxXTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGMgPSBfbGlua3NbMF07XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0LFxcXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBkb20sXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogYyAhPSBudWxsID8gYyA6IHUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi6L+b5YWl572R56uZXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXFxcXFwiaGlrZXI6Ly9wYWdlL3lzZng/d2ViVXJsPVxcXFxcXFwiICsgZW5jb2RlVVJJQ29tcG9uZW50KHUpKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIGZpbmRBbGlVcmwoaW5wdXQpIHtcXFxcbiAgICAg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XG4gICAgICAgICAgICBsZXQgZCA9IFtdXFxcXG4gICAgICAgICAgICBsZXQgYWxpVXRpbCA9ICQucmVxdWlyZShcXFxcXFxcImFsaVV0aWxcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IGZldGNoKCdodHRwczovL3Bhbi5jY29mLmNjL2FwaS9zZWFyY2gnLCB7XFxcXG4gICAgICAgICAgICAgICAgaGVhZGVyczoge1xcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImNvbnRlbnQtdHlwZVxcXFxcXFwiOiAnYXBwbGljYXRpb24vanNvbicsXFxcXG4gICAgICAgICAgICAgICAgICAgICdSZWZlcmVyJzogJ2h0dHBzOi8vcGFuLmNjb2YuY2Mvc2VhcmNoP2tleXdvcmQ9JyArIHNcXFxcbiAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgIGJvZHk6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJwYWdlU2l6ZVxcXFxcXFwiOiAyMCxcXFxcbiAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJwYWdlTnVtXFxcXFxcXCI6IHBhZ2UsXFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwia2V5d29yZFxcXFxcXFwiOiBzLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImZyb21Nb2JpbGVcXFxcXFxcIjogdHJ1ZVxcXFxuICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgbWV0aG9kOiAnUE9TVCdcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbClcXFxcbiAgICAgICAgICAgICAgICAuZGF0YS5yb3dzXFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGxpc3QubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgaXQgPSBsaXN0W2ldO1xcXFxuICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0LmZpbGVOYW1lXFxcXG4gICAgICAgICAgICAgICAgbGV0IG11cmwgPSBpdC51cmxcXFxcbiAgICAgICAgICAgICAgICBsZXQgdHlwZSA9IGl0LnR5cGUucmVwbGFjZSgvZm9sZGVyLywgJ+aWh+S7tuWkuScpLnJlcGxhY2UoL2ZpbGUvLCAn5paH5Lu2JylcXFxcbiAgICAgICAgICAgICAgICBpZiAodGl0bGUuaW5jbHVkZXMocykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6ICfmlofku7bnsbvlnovvvJonICsgdHlwZSArICfvvIzmlofku7blpKflsI/vvJonICsgYWxpVXRpbC5ieXRlc1RvU2l6ZShpdC5zaXplKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogbXVybFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBkXFxcXG4gICAgICAgIH1cXFxcbiAgICB9LFxcXFxuICAgIHtcXFxcbiAgICAgICAgbmFtZTogJ+mYv+mHjOWwj+ermScsXFxcXG4gICAgICAgIHBhZ2U6IHRydWUsXFxcXG4gICAgICAgIGZpbmQ6IGZ1bmN0aW9uKHMsIHBhZ2UpIHtcXFxcbiAgICAgICAgICAgIGxldCBob21lID0gXFxcXFxcXCJodHRwczovL3BhbjY2Ni5uZXRcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgIGxldCBkID0gW107XFxcXG4gICAgICAgICAgICBsZXQgaHRtbCA9IHJlcXVlc3QoYnVpbGRVcmwoaG9tZSArIFxcXFxcXFwiL2FwaS9kaXNjdXNzaW9uc1xcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgXFxcXFxcXCJpbmNsdWRlXFxcXFxcXCI6IFxcXFxcXFwidXNlcixsYXN0UG9zdGVkVXNlcixtb3N0UmVsZXZhbnRQb3N0LG1vc3RSZWxldmFudFBvc3QudXNlcix0YWdzLHRhZ3MucGFyZW50LGZpcnN0UG9zdFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwiZmlsdGVyW3FdXFxcXFxcXCI6IHMgLyogKyBcXFxcXFxcIiB0YWc6dmlkZW8sY29taWNcXFxcXFxcIiovICxcXFxcbiAgICAgICAgICAgICAgICAvL1xcXFxcXFwiZmlsdGVyW3RhZ11cXFxcXFxcIjogXFxcXFxcXCJ2aWRlbyxjb21pY1xcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwicGFnZVtvZmZzZXRdXFxcXFxcXCI6IDIwICogKHBhZ2UgLSAxKVxcXFxuICAgICAgICAgICAgfSksIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxcXFwiY29udGVudC10eXBlXFxcXFxcXCI6IFxcXFxcXFwiYXBwbGljYXRpb24vanNvblxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3BhbjY2Ni5uZXQvP3E9XFxcXFxcXCIgKyBzXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdGVtID0gbGlzdFtpXS5hdHRyaWJ1dGVzO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBob21lICsgXFxcXFxcXCIvZC9cXFxcXFxcIiArIGl0ZW0uc2x1ZztcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+WPkeW4g+aXtumXtO+8micgKyAkLmRhdGVGb3JtYXQobmV3IERhdGUoaXRlbS5jcmVhdGVkQXQpLCBcXFxcXFxcInl5eXktTU0tZGQgSEg6bW06c3NcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIui/m+WFpeW4luWtkFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFxcXFxcImhpa2VyOi8vcGFnZS95c2Z4P3dlYlVybD1cXFxcXFxcIiArIGVuY29kZVVSSUNvbXBvbmVudCh1cmwpKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfV1cXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgIH0sXFxcXG4gICAgICAgIGZpbmRBbGlVcmwoaW5wdXQpIHtcXFxcbiAgICAgICAgICAgIGxldCBodG1sID0gcGRmaChyZXF1ZXN0KGlucHV0KSwgXFxcXFxcXCJUZXh0XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgbGV0IF9saW5rcyA9IGh0bWwubWF0Y2goL2h0dHBzOlxcXFxcXFxcL1xcXFxcXFxcLyh3d3dcXFxcXFxcXC5hbGl5dW5kcml2ZV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C10eXBlXFxcXFxcXCI6IFxcXFxcXFwiYXBwbGljYXRpb24vanNvblxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3BhbjY2Ni5uZXQvP3E9XFxcXFxcXCIgKyBzXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICBsZXQgbGlzdCA9IEpTT04ucGFyc2UoaHRtbCkuZGF0YTtcXFxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGlzdC5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBpdGVtID0gbGlzdFtpXS5hdHRyaWJ1dGVzO1xcXFxuICAgICAgICAgICAgICAgIGxldCB1cmwgPSBob21lICsgXFxcXFxcXCIvZC9cXFxcXFxcIiArIGl0ZW0uc2x1ZztcXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogJ+WPkeW4g+aXtumXtO+8micgKyAkLmRhdGVGb3JtYXQobmV3IERhdGUoaXRlbS5jcmVhdGVkQXQpLCBcXFxcXFxcInl5eXktTU0tZGQgSEg6bW06c3NcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIui/m+WFpeW4luWtkFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFxcXFxcImhpa2VyOi8vcGFnZS95c2Z4P3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iAgICAgICAgICAgICAgICAgICAgYWxpVXJsOiBfbGlua3NbMV0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBzaGFyZVB3ZFxcXFxuICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKF9saW5rcy5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgYWxpVXJsOiBfbGlua3NbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkOiBzaGFyZVB3ZFxcXFxuICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS95c2Z4P3dlYlVybD1cXFxcXFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChpbnB1dCk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICB9XFxcXG4gICAgLyosXFxcXG4gICAgICAgIHtcXFxcbiAgICAgICAgICAgIG5hbWU6IFxcXFxcXFwi5aWH5aaZ5pCc57SiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBwYWdlOiB0cnVlLFxcXFxuICAgICAgICAgICAgZmluZChzLCBwYWdlKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHVybDtcXFxcbiAgICAgICAgICAgICAgICBpZiAocGFnZSA9PT0gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cmwgPSBidWlsZFVybChcXFxcXFxcImh0dHBzOi8vd3d3Lm1hZ2ljYWxzZWFyY2gudG9wL2FwaS9wc2hvdS9nZXREYXRhXFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHdvcmQ6IHMsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBcXFxcXFxcIumYv+mHjOe9keebmFxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVybCA9IGJ1aWxkVXJsKFxcXFxcXFwiaHR0cHM6Ly93d3cubWFnaWNhbHNlYXJjaC50b3AvYXBpL3BzaG91L2dldE5leHRQYWdlXFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcXFxcXCJodHRwczovL2FwaS51cHl1bnNvMi5jb20vc2VhcmNoP3NfdHlwZT0yQHBhZ2U9XFxcXFxcXCIgKyBwYWdlICsgXFxcXFxcXCJAa2V5d29yZD1cXFxcXFxcIiArIGVuY29kZVVSSUNvbXBvbmVudChzKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHdlYnNpdGU6IFxcXFxcXFwi6Zi/6YeM572R55uYXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGxldCByZXN1bHQgPSByZXF1ZXN0KHVybCwge1xcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBSZWZlcmVyOiBidWlsZFVybChcXFxcXFxcImh0dHBzOi8vd3d3Lm1hZ2ljYWxzZWFyY2gudG9wL3NlYXJjaFxcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgd29yZDogcyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcGFnZTogMFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IEpTT04ucGFyc2UoSlNPTi5wYXJzZShyZXN1bHQpKTtcXFxcbiAgICAgICAgICAgICAgICBsZXQgbGlzdCA9IHJlc3VsdC5yZXN1bHQuaXRlbXM7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGQgPSBbXTtcXFxcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpdCBvZiBsaXN0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdC5pZCA9PSAtMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC50aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IFxcXFxcXFwi5pel5pyf77yaXFxcXFxcXCIgKyBpdC5pbnNlcnRfdGltZSArIFxcXFxcXFwiXFxcXFxcXFxu6Lev5b6E77yaXFxcXFxcXCIgKyBpdC5wYXRoLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBpdC5wYWdlX3VybFxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGQ7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0qL1xcXFxuXTtcXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCLlt6XlhbdcXFwiLFxcXCJwYXRoXFxcIjpcXFwiYWxpVXRpbFxcXCIsXFxcInJ1bGVcXFwiOlxcXCIkLmV4cG9ydHMgPSB7XFxcXG4gICAgY2hlY2thbGkocmVhbHVybCkge1xcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgaWYgKHJlYWx1cmwuaW5jbHVkZXMoXFxcXFxcXCJjb20vcy9cXFxcXFxcIikgJiYgcmVhbHVybCAhPSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHNoYXJlSWQgPSByZWFsdXJsLnNwbGl0KFxcXFxcXFwiP1xcXFxcXFwiKVswXS5zcGxpdChcXFxcXFxcIi9cXFxcXFxcIilbNF07XFxcXG4gICAgICAgICAgICAgICAgbGV0IHNoYXJlID0gZmV0Y2goXFxcXFxcXCJodHRwczovL2FwaS5hbGl5dW5kcml2ZS5jb20vYWRyaXZlL3YzL3NoYXJlX2xpbmsvZ2V0X3NoYXJlX2J5X2Fub255bW91c1xcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LXR5cGUnOiAnYXBwbGljYXRpb24vanNvbicsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlVzZXItQWdlbnRcXFxcXFxcIjogUENfVUEsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcIlJlZmVyZXJcXFxcXFxcIjogXFxcXFxcXCJodHRwczovL3d3dy5hbGl5dW5kcml2ZS5jb20vXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgICAgICAgYm9keToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJzaGFyZV9pZFxcXFxcXFwiOiBzaGFyZUlkXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogJ1BPU1QnXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKHNoYXJlLmluY2x1ZGVzKFxcXFxcXFwic2hhcmVfbGluayBpc1xcXFxcXFwiKSB8fCBzaGFyZS5pbmNsdWRlcyhcXFxcXFxcInNoYXJlX2xpbmsgY2Fubm90XFxcXFxcXCIpKSByZXR1cm4gZmFsc2U7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAg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OiA0LFxcXFxuICAgICAgICAgICAg5LqUOiA1LFxcXFxuICAgICAgICAgICAg5YWtOiA2LFxcXFxuICAgICAgICAgICAg5LiDOiA3LFxcXFxuICAgICAgICAgICAg5YWrOiA4LFxcXFxuICAgICAgICAgICAg5LmdOiA5XFxcXG4gICAgICAgIH07XFxcXG5cXFxcbiAgICAgICAgbGV0IGNobk5hbWVWYWx1ZSA9IHtcXFxcbiAgICAgICAgICAgIOWNgToge1xcXFxuICAgICAgICAgICAgICAgIHZhbHVlOiAxMCxcXFxcbiAgICAgICAgICAgICAgICBzZWNVbml0OiBmYWxzZVxcXFxuICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgIOeZvjoge1xcXFxuICAgICAgICAgICAgICAgIHZhbHVlOiAxMDAsXFxcXG4gICAgICAgICAgICAgICAgc2VjVW5pdDogZmFsc2VcXFxcbiAgICAgICAgICAgIH0sXFxcXG4gICAgICAgICAgICDljYM6IHtcXFxcbiAgICAgICAgICAgICAgICB2YWx1ZTogMTAwMCxcXFxcbiAgICAgICAgICAgICAgICBzZWNVbml0OiBmYWxzZVxcXFxuICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgIOS4hzoge1xcXFxuICAgICAgICAgICAgICAgIHZhbHVlOiAxMDAwMCxcXFxcbiAgICAgICAgICAgICAgICBzZWNVbml0OiB0cnVlXFxcXG4gICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAg5Lq/OiB7XFxcXG4gICAgICAgICAgICAgICAgdmFsdWU6IDEwMDAwMDAwMCxcXFxcbiAgICAgICAgICAgICAgICBzZWNVbml0OiB0cnVlXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcblxcXFxuICAgICAgICBmdW5jdGlvbiBDaGluZXNlVG9OdW1iZXIoY2huU3RyKSB7XFxcXG4gICAgICAgICAgICBsZXQgcnRuID0gMDtcXFxcbiAgICAgICAgICAgIGxldCBzZWN0aW9uID0gMDtcXFxcbiAgICAgICAgICAgIGxldCBudW1iZXIgPSAwO1xcXFxuICAgICAgICAgICAgbGV0IHNlY1VuaXQgPSBmYWxzZTtcXFxcbiAgICAgICAgICAgIGxldCBzdHIgPSBjaG5TdHIuc3BsaXQoJycpO1xcXFxuXFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGxldCBudW0gPSBjaG5OdW1DaGFyW3N0cltpXV07XFxcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBudW0gIT09ICd1bmRlZmluZWQnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIG51bWJlciA9IG51bTtcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgPT09IHN0ci5sZW5ndGggLSAxKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZWN0aW9uICs9IG51bWJlcjtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGxldCB1bml0ID0gY2huTmFtZVZhbHVlW3N0cltpXV0udmFsdWU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHNlY1VuaXQgPSBjaG5OYW1lVmFsdWVbc3RyW2ldXS5zZWNVbml0O1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoc2VjVW5pdCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2VjdGlvbiA9IChzZWN0aW9uICsgbnVtYmVyKSAqIHVuaXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBydG4gKz0gc2VjdGlvbjtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHNlY3Rpb24gPSAwO1xcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2VjdGlvbiArPSAobnVtYmVyICogdW5pdCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1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b21wYXJlVG8obmV3IGphdmEubWF0aC5CaWdJbnRlZ2VyKHNwbGl0MltpXSkpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcblxcXFxuICAgICAgICAgICAgICAgIGlmIChjbXAgPT09IDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlZ2V4ID0gL1thLXpBLVowLTldL1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgczEgPSBTdHJpbmcoc3BsaXQxW2ldKVxcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgczIgPSBTdHJpbmcoc3BsaXQyW2ldKVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAocmVnZXgudGVzdChzMSkgfHwgcmVnZXgudGVzdChzMikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNtcCA9IG5ldyBqYXZhLmxhbmcuU3RyaW5nKHNwbGl0MVtpXSkuY29tcGFyZVRvKG5ldyBqYXZhLmxhbmcuU3RyaW5nKHNwbGl0MltpXSkpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gY21wID0gczEubG9jYWxlQ29tcGFyZShzMiwgJ2VuJylcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNtcCA9IHMxLmxvY2FsZUNvbXBhcmUoczIsICd6aCcpXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgICAgICBpZiAoY21wICE9PSAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBjbXA7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGV0IGxlbmd0aENtcCA9IHNwbGl0MS5sZW5ndGggLSBzcGxpdDIubGVuZ3RoO1xcXFxuICAgICAgICAgICAgLy8gaWYgKGxlbmd0aENtcCAhPT0gMCkgbGVuZ3RoQ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bHQoZCk7XFxcXG59KSgpO1xcXCJ9XVwiLFwicHJveHlcIjpcIlwifSIsInRpdGxlIjoi6Zi/6YeM5LqR55uY5YiG5LqrIn0=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement