Advertisement
xiaomianao666

邀您一起看:逆天邪神

Aug 18th, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥逆天邪神@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcInRleHRfMVwiLFwibmFtZVwiOlwi5rqQ55uu5b2VXCIsXCJwYXRoXCI6XCJzb3VyY2VcIixcInJ1bGVcIjpcImpzOlxcbnZhciBkID0gW107XFxudmFyIG0gPSBNWV9QQVJBTVMucnVsZXNcXG52YXIgYmFzZXVybCA9IG0uYm9va1NvdXJjZVVybFxcbmlmIChtLnJ1bGVFeHBsb3JlLmJvb2tMaXN0KSB7XFxuICAgIHZhciBydWxlID0gbS5ydWxlRXhwbG9yZVxcbn0gZWxzZSB7XFxuICAgIHZhciBydWxlID0gbS5ydWxlU2VhcmNoXFxufVxcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi5pCc57SiXFxcIixcXG4gICAgZGVzYzogXFxcIuivt+i+k+WFpeaQnOe0ouWFs+mUruivjVxcXCIsXFxuICAgIHVybDogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICBwdXRNeVZhcihcXFwia3dcXFwiLCBpbnB1dCk7XFxuICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9zZWFyY2g/cD1meXBhZ2Uma3c9XFxcIiArIGlucHV0XFxuICAgIH0pLFxcbiAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgZXh0cmE6IHtcXG4gICAgICAgIFxcXCJ1XFxcIjogYmFzZXVybCArIG0uc2VhcmNoVXJsLFxcbiAgICAgICAgXFxcInJ1bGVzXFxcIjogbSxcXG4gICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoXFxcImt3XFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgYm9va1NvdXJjZU5hbWU6IG0uYm9va1NvdXJjZU5hbWVcXG4gICAgfVxcbn0pO1xcbnRyeSB7XFxuICAgIGlmIChtLmVuYWJsZWRFeHBsb3JlICYmIG0uZXhwbG9yZVVybCkge1xcbiAgICAgICAgSlNPTi5wYXJzZShtLmV4cGxvcmVVcmwpLmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBpdGVtLnN0eWxlLmxheW91dF9mbGV4QmFzaXNQZXJjZW50ID09IDEgPyBcXFwidGV4dF9jZW50ZXJfMVxcXCIgOiBcXFwidGV4dF8zXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBpdGVtLnVybCA9PSBcXFwiXFxcIiA/IFxcXCJoaWtlcjovL2VtcHR5XFxcIiA6IFxcXCJoaWtlcjovL3BhZ2UvYm9va3M/cD1meXBhZ2VcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgXFxcImFsbFxcXCI6IG0sXFxuICAgICAgICAgICAgICAgICAgICBcXFwicnVsZXNcXFwiOiBydWxlLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcInVcXFwiOiBiYXNldXJsICsgaXRlbS51cmxcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0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CIpLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogcGRmaDEoaXRlbSwgbmFtZSksXFxuICAgICAgICAgICAgICAgIGltZzogKGNvdmVyID8gcGQxKGl0ZW0sIGNvdmVyKSArIFxcXCJAUmVmZXJlcj1cXFwiIDogXFxcImhpa2VyOi8vZW1wdHlcXFwiKSxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL21lbnVcXFwiLFxcbiAgICAgICAgICAgICAgICBkZXNjOiAoYXV0aG9yID8gcGRmaDEoaXRlbSwgYXV0aG9yKSA6IFxcXCJcXFwiKSArIFxcXCJcXFxcblxcXCIgKyAoaW50cm8gPyBwZGZoMShpdGVtLCBpbnRybykgOiBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBcXFwiYm9va05hbWVcXFwiOiBwZGZoMShpdGVtLCBuYW1lKSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJjb3ZlclxcXCI6IChjb3ZlciA/IHBkMShpdGVtLCBjb3ZlcikgKyBcXFwiQFJlZmVyZXI9XFxcIiA6IFxcXCJoaWtlcjovL2VtcHR5XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBcXFwiVG9jXFxcIjogTVlfUEFSQU1TLmFsbC5ydWxlVG9jLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcImNvbnRlbnRcXFwiOiBNWV9QQVJBTVMuYWxsLnJ1bGVDb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBuZXh0dG9jID8gXFxcImhpa2VyOi8vZW1wdHkjXFxcIiArIHUxIDogdTEsXFxuICAgICAgICAgICAgICAgICAgICB1MTogbmV4dHRvYyA/IHUxIDogbnVsbCxcXG4gICAgICAgICAgICAgICAgICAgIGNoYXJzZXQ6IG0uY2hhcnNldCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuWIl+ihqOWKoOi9veWksei0pe+8mlxcXCIgKyBsaXN0cnVsZSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICB9KVxcbiAgICB9XFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IFxcXCLliqDovb3lpLHotKXvvJpcXFwiICsgZS5tZXNzYWdlLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgIH0pXFxufVxcbnNldFJlc3VsdChkKTtcIn0se1wiY29sX3R5cGVcIjpcInRleHRfY2VudGVyXzFcIixcIm5hbWVcIjpcIuiuvue9rlwiLFwicGF0aFwiOlwiY29uZmlnXCIsXCJydWxlXCI6XCJqczpcXG52YXIgZCA9IFtdO1xcbnRyeSB7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIua3u+WKoOiuoumYhVxcXCIsXFxuICAgICAgICB1cmw6ICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaXorqLpmIXlkI3np7DvvIzlj5bkuKrlkI3lkKfvvIjms6jmhI/kuI3opoHloavlnLDlnYDvvIlcXFwiKS5pbnB1dCgoKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGlucHV0ID09IG51bGwgfHwgaW5wdXQgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S4jeWhq+aAjuS5iOiDveihjOWRolxcXCJcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGlucHV0LmluY2x1ZGVzKFxcXCI6Ly9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5LiN6IO95aGr5Zyw5Z2A5ZOm77yM5YK75a6d6LSdXFxcIlxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIiwgXFxcIuivt+i+k+WFpeiuoumYheWcsOWdgFxcXCIpLmlucHV0KChuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICBhZGQsXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXG4gICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIik7XFxuICAgICAgICAgICAgICAgIGFkZChuYW1lLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGUobmFtZSwgaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXmiJDlip9cXFwiXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbnB1dClcXG4gICAgICAgIH0pLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiXFxuICAgIH0pXFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIua3u+WKoOacrOWcsFxcXCIsXFxuICAgICAgICB1cmw6ICQoXFxcIlxcXCIsIFxcXCLor7fovpPlhaXorqLpmIXlkI3np7DvvI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TtcXG4gICAgICAgICAgICAgICAgbGV0IGMgPSBmZXRjaChcXFwiZmlsZTovL1xcXCIgKyBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIGlmICghYy5pbmNsdWRlcyhcXFwiYm9va1NvdXJjZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5qC85byP5LiN5a+577yM5LuF5pSv5oyB5Lmm5rqQ5paH5Lu2XFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHdyaXRlRmlsZSh1cmwsIGMpO1xcbiAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgYWRkLFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlXFxuICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXCIpO1xcbiAgICAgICAgICAgICAgICBhZGQobmFtZSwgdXJsKTtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXmiJDlip9cXFwiXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lr7zlhaXlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbnB1dCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIlxcbiAgICB9KVxcbiAgICBsZXQgbGlzdCA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIikubG9hZCgpO1xcbiAgICBsaXN0LmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICBkZXNjOiBpdGVtLnVybCxcXG4gICAgICAgICAgICB1cmw6ICQoW1xcXCLliKDpmaTorqLpmIVcXFwiLCBcXFwi57yW6L6R5ZCN56ewXFxcIiwgXFxcIuWIhuS6q+iuoumYhVxcXCIsIFxcXCLmm7TmlrDmlbDmja5cXFwiXSkuc2VsZWN0KChuYW1lLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IFxcXCLliKDpmaTorqLpmIVcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu6K6k5Yig6Zmk77yfXFxcIikuY29uZmlybSgobmFtZSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXCJoaWtlcjovL2ZpbGVzL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUZpbGUodXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlRmlsZShcXFwiaGlrZXI6Ly9maWxlcy95dWVkdS9cXFwiICsgbWQ1KG5hbWUpICsgXFxcIi5qc29uXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXCIpLnJlbW92ZSh1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWIoOmZpFxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIHVybClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PSBcXFwi57yW6L6R5ZCN56ewXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIlxcXCIpLmlucHV0KChuYW1lLCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKFxcXCJoaWtlcjovL2ZpbGVzL3l1ZWR1L1xcXCIgKyBtZDUobmFtZSkgKyBcXFwiLmpzb25cXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlKGlucHV0LCB1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZSh1cmwsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIHVybClcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PSBcXFwi5YiG5Lqr6K6i6ZiFXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHVybC5zdGFydHNXaXRoKFxcXCJoaWtlcjovL2ZpbGVzL1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W9k+WJjeiuoumYheS4uuacrOWcsOaWh+S7tu+8jOaXoOazleWIhuS6q1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgobmFtZSwgdXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2hhcmUobmFtZSwgdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGUobmFtZSwgdXJsKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pu05paw5oiQ5YqfXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mm7TmlrDlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpdGVtLm5hbWUsIGl0ZW0udXJsKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCJcXG4gICAgICAgIH0pXFxuICAgIH0pXFxufSBjYXRjaCAoZSkge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IFxcXCLplJnor6/vvJpcXFwiICsgZS5tZXNzYWdlLF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0IGkgPSAwOyBpIDwgYy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGlmIChjW2ldLnVybCA9PSBjaGUudXJsKSB7XFxuICAgICAgICAgICAgICAgIGNbaV0gPSBjaGU7XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwiY2xlYXI6XFxcIiArIHVybClcXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoXFxcImNoYXB0ZXIuanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KGMpKVxcbiAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfSwgdXJsKSlcXG4gICAgZm9yIChsZXQgaXQgb2YgY2FjaGVzKSB7XFxuICAgICAgICBpZiAoaXQudXJsID09IHVybCkge1xcbiAgICAgICAgICAgIHJldHVybiBpdDtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICByZXR1cm4ge1xcbiAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICBuZXh0OiBcXFwiXFxcIixcXG4gICAgICAgIGNoYXB0ZXJzOiBbXVxcbiAgICB9XFxufVxcblxcbmZ1bmN0aW9uIHNhdmVDYWNoZShjaGUpIHtcXG4gICAgbGV0IGMgPSBjYWNoZXNcXG4gICAgaWYgKGMubGVuZ3RoID4gMTApIHtcXG4gICAgICAgIGMuc2hpZnQoKVxcbiAgICB9XFxuICAgIGxldCBleGlzdCA9IGZhbHNlXFxuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgaWYgKGNbaV0udXJsID09IGNoZS51cmwpIHtcXG4gICAgICAgICAgICBjW2ldID0gY2hlO1xcbiAgICAgICAgICAgIGV4aXN0ID0gdHJ1ZTtcXG4gICAgICAgICAgICBicmVha1xcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGlmICghZXhpc3QpIHtcXG4gICAgICAgIGMucHVzaChjaGUpXFxuICAgIH1cXG4gICAgc2F2ZUZpbGUoXF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XI6IFxcXCIgKyBhaWQpO1xcbiAgICAgICAgY2xlYXJNeVZhcihhaWQpO1xcbiAgICB9LCBhaWQpKTtcXG4gICAgbGV0IGFyciA9IGNhY2hlLmNoYXB0ZXJzIHx8IFtdO1xcbiAgICB2YXIgY2MgPSAoYSkgPT4ge1xcbiAgICAgICAgcmV0dXJuIGEubWFwKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGdldFRleHQoaXRlbSwgVG9jLmNoYXB0ZXJOYW1lKVxcbiAgICAgICAgICAgIGlmICh0aXRsZSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgdTEgPSBnZXRVcmwwKGl0ZW0sIFRvYy5jaGFwdGVyTGlzdCwgVG9jLmNoYXB0ZXJVcmwpICsgXFxcIiNhdXRvUGFnZSMjcmVhZFRoZW1lI1xcXCI7XFxuICAgICAgICAgICAgICAgIGlmIChNWV9QQVJBTVMuY2hhcnNldCkge1xcbiAgICAgICAgICAgICAgICAgICAgdTEgPSB1MSArIFxcXCI7Z2V0O1xcXCIgKyBNWV9QQVJBTVMuY2hhcnNldDtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL2NvbnRlbnRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogTVlfUEFSQU1TLmNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1MVxcbiAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIlxcbiAgICAgICAgICAgIC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2YXIgdXJscyA9IFtudXJsXTtcXG4gICAgd2hpbGUgKHRydWUpIHtcXG4gICAgICAgIGxldCBhID0gW107XFxuICAgICAgICBmb3IgKGxldCBpdCBvZiBhcnIpIHtcXG4gICAgICAgICAgICBhLnB1c2goaXQpO1xcbiAgICAgICAgfVxcbiAgICAgICAgY2FjaGUuY2hhcHRlcnMgPSBhO1xcbiAgICAgICAgbGV0IGFycjEgPSBnZXRBcnJheShyZXMsIFRvYy5jaGFwdGVyTGlzdCk7XFxuICAgICAgICAvL2xvZyhhcnIxKTtcXG4gICAgICAgIGlmIChhcnIxICYmIGFycjEubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGFycjEpIHtcXG4gICAgICAgICAgICAgICAgYXJyLnB1c2goaXQpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgYWRkSXRlbUJlZm9yZShpZCwgY2MoYXJyMSkpO1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoYWlkLCBcXFwiMFxcXCIpICE9IFxcXCIxXFxcIikge1xcbiAgICAgICAgICAgICAgICBsb2coXFxcImJyZWFrOiBcXFwiICsgYWlkKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAoNTApO1xcbiAgICAgICAgICAgIGxldCBudXJsMiA9IHBkKHJlcywgXFxcImJvZHkmJlxcXCIgKyBuZXh0KTtcXG4gICAgICAgICAgICBpZiAobnVybDIgJiYgbnVybDIgIT0gXFxcIlxcXCIgJiYgIXVybHMuaW5jbHVkZXMobnVybDIpKSB7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnNbXFxcIlJlZmVyZXJcXFwiXSA9IGNhY2hlLm5leHQuc3BsaXQoXFxcIiNcXFwiKVswXTtcXG4gICAgICAgICAgICAgICAgdXJscy5wdXNoKG51cmw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FSQU1TLmNoYXJzZXQ7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL2NvbnRlbnRcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogTVlfUEFSQU1TLmNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IHUxXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG5cXG4gICAgdmFyIGNwID0gZC5tYXAoZnVuY3Rpb24oaXRlbSkge1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICBcXFwidGl0bGVcXFwiOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgIFxcXCJ1cmxcXFwiOiBpdGVtLmV4dHJhLnVybC5yZXBsYWNlKFxcXCIjYXV0b1BhZ2UjI3JlYWRUaGVtZSNcXFwiLCBcXFwiXFxcIilcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGlmIChsaXN0Lmxlbmd0aCA+IDApIHtcXG4gICAgICAgIGQudW5zaGlmdCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLkuIvovb1cXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9kb3dubG9hZC52aWV3I25vUmVjb3JkSGlzdG9yeSMjbm9SZWZyZXNoIyNub0hpc3RvcnkjP3J1bGU95pys5Zyw6LWE5rqQ566h55CGXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGNoYXB0ZXJMaXN0OiBjcCxcXG4gICAgICAgICAgICAgICAgZGVmYXVsdFZpZXc6IFxcXCIxXFxcIixcXG4gICAgICAgICAgICAgICAgaW5mbzoge1xcbiAgICAgICAgICAgICAgICAgICAgYm9va05hbWU6IE1ZX1BBUkFNUy5ib29rTmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIGJvb2tUb3BQaWM6IE1ZX1BBUkFNUy5jb3ZlcixcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGVOYW1lOiBcXFwi5oKm6K+7XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHBhcnNlQ29kZTogJC50b1N0cmluZygoTVlfUEFSQU1TLCByMCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvY29udmVydGVyP3J1bGU9XFxcIiArIHIwKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzID0gcmVxdWVzdChpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJ1bGUgPSBNWV9QQVJBTVMuY29udGVudDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgciA9IGNvbnZlcnQocnVsZS5jb250ZW50KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcjEgPSByLnNwbGl0KFxcXCImJlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCByMiA9IHIxLnNsaWNlKDAsIHIxLmxlbmd0aCAtIDEpLmpvaW4oXFxcIiYmXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGFyciA9IHBkZmEocmVzLCBcXFwiYm9keSYmXFxcIiArIHIyKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhhcnIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0dCA9IFxcXCJcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgYXJyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0ID0gaXQucmVwbGFjZShuZXcgUmVnRXhwKFxcXCJcXFxcblxcXCIsIFxcXCJnXFxcIiksIFxcXCItLWJyLS1cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coaXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdCA9IHBkZmgoaXQsIFxcXCJUZXh0XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQgPSB0LnJlcGxhY2UobmV3IFJlZ0V4cChcXFwiLS1ici0tXFxcIiwgXFxcImdcXFwiKSwgXFxcIjxicj5cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHQyID0gdC5zcGxpdChcXFwiPGJyPlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdDIgb2YgdDIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdDIgPT0gXFxcIlxcXCIgfHwgaXQyLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWVcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICghaXQyLnN0YXJ0c1dpdGgoXFxcIuOAgFxcXCIpICYmICFpdDIuc3RhcnRzV2l0aChcXFwiJm5ic3A7Jm5ic3A7XFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdDIgPSBcXFwiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7XFxcIiArIGl0Mi50cmltKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocnVsZS5yZXBsYWNlUmVnZXgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdDIgPSBpdDIucmVwbGFjZShuZXcgUmVnRXhwKHJ1bGUucmVwbGFjZVJlZ2V4LnJlcGxhY2UoXFxcIiMjXFxcIiwgXFxcIlxcXCIpLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdDIgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHQgKz0gaXQyICsgXFxcIlxcXFxuXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB0dFxcbiAgICAgICAgICAgICAgICAgICAgfSwgTVlfUEFSQU1TLCBNWV9SVUxFLnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgIHR5cGU6IFxcXCJub3ZlbFxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC51bnNoaWZ0KHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuacquino+aekOWIsOebruW9leWIl+ihqFxcXCIsXFxuICAgICAg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IpWzBdLnNwbGl0KFxcXCJ8fFxcXCIpO1xcbiAgICBsZXQgYyA9IGNvbnZlcnQocjFbMF0pO1xcbiAgICBpZiAoYy5pbmNsdWRlcyhcXFwiJiZsaSYmYVxcXCIpICYmIGNbYy5sZW5ndGggLSAxXSA9PSBcXFwiYVxcXCIpIHtcXG4gICAgICAgIGMgPSBjLnJlcGxhY2UoXFxcIiYmbGkmJmFcXFwiLCBcXFwiJiZsaVxcXCIpO1xcbiAgICB9XFxuICAgIGxvZyhjKTtcXG4gICAgbGV0IGFyciA9IHBkZmEoaHRtbCwgXFxcImJvZHkmJlxcXCIgKyBjKTtcXG4gICAgaWYgKHIxLmxlbmd0aCA+IDEpIHtcXG4gICAgICAgIGxldCByMiA9IHIxWzFdLnNwbGl0KFxcXCI6XFxcIik7XFxuICAgICAgICBsZXQgcjMgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGl0IG9mIHIyKSB7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgbGV0IGkgPSBwYXJzZUludChpdCk7XFxuICAgICAgICAgICAgICAgIGlmIChpc05hTihpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcjMucHVzaChpKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IGFycjIgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgYXJyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICAgICAgaWYgKHIzLmluZGV4T2YoaSkgPCAwKSB7XFxuICAgICAgICAgICAgICAgIGFycjIucHVzaChhcnJbaV0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBhcnIyO1xcbiAgICB9XFxuICAgIGxvZyhcXFwi6I635Y+W5aSx6LSl77yM5aSx6LSl5a6a5L2N77yaX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1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICBmdW5jOiBmdW5jdGlvbihydWxlKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBzZWFyY2gocnVsZSwgcywgMSk7XFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBwYXJhbTogaXQsXFxuICAgICAgICAgICAgaWQ6IFxcXCJydWxlQFxcXCIgKyBpdC5uYW1lXFxuICAgICAgICB9XFxuICAgIH0pO1xcblxcbiAgICBiYXRjaEV4ZWN1dGUodGFza3MsIHtcXG4gICAgICAgIGZ1bmM6IGZ1bmN0aW9uKHBhcmFtLCBpZCwgZXJyb3IsIHJlc3VsdCkge1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCJsaXN0ZW5lcjogXFxcIiArIChyZXN1bHQgfHwgW10pLmxlbmd0aClcXG4gICAgICAgICAgICBwYXJhbS5pID0gcGFyYW0uaSArIDE7XFxuICAgICAgICAgICAgaWYgKHJlc3VsdCkge1xcbiAgICAgICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgcmVzdWx0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW0uaiA9IHBhcmFtLmogKyAxO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaE11c3QpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFzZWFyY2hDb250YWlucyhpdC50aXRsZSwgcykpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBleHRyYSA9IGl0LmV4dHJhIHx8IHt9O1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmlkID0gXFxcIl9fYXBwXFxcIiArIE1ZX1BBR0UgKyBcXFwiQFxcXCIgKyBwYXJhbS5qO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmJvb2tOYW1lID0gaXQudGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYS5jb3ZlciA9IGl0LnBpY191cmwgfHwgaXQuaW1nXFxuICAgICAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUJlZm9yZShwYWdlaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLmluY2x1ZGVzKFxcXCLigJzigJzigJ3igJ1cXFwiKSA/IGl0LnRpdGxlIDogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBpdC50aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAoXFxcIjxlbT58PC9lbT5cXFwiLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIikucmVwbGFjZShuZXcgUmVnRXhwKHMsIFxcXCJnXFxcIiksIFxcXCI8c3Ryb25nPjxzcGFuIHN0eWxlPVxcXFxcXFwiY29sb3I6ICMxRTkwRkZcXFxcXFxcIj5cXFwiICsgcyArIFxcXCI8L3NwYW4+PC9zdHJvbmc+XFxcIiksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlc2M6IGl0LmRlc2MsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaXQudXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBpdC5waWNfdXJsIHx8IGl0LmltZyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IGl0LnBpY191cmwgfHwgaXQuaW1nID8gJ21vdmllXzFfdmVydGljYWxfcGljJyA6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYTogZXh0cmFcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxcblxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAocGFyYW0uaSA+PSBwYXJhbS5hbGwpIHtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShwYWdlaWQpXFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWKoOi9veesrFxcXCIgKyBNWV9QQUdFICsgXFxcIumhteS4re+8jOi/m+W6pu+8mlxcXCIgKyAocGFyYW0uaSArIDEpICsgXFxcIi9cXFwiICsgcGFyYW0uYWxsLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFwiXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHBhZ2VpZFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sXFxuICAgICAgICBwYXJhbToge1xcbiAgICAgICAgICAgIGFsbDogZGF0YS5sZW5ndGgsXFxuICAgICAgICAgICAgaTogMCxcXG4gICAgICAgICAgICBqOiAtMVxcbiAgICAgICAgfVxcbiAgICB9KTtcXG59XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmkJzntKLovoXliqlcIixcInBhdGhcIjpcInNzXCIsXCJydWxlXCI6XCJ2YXIge1xcbiAgICBjb252ZXJ0LFxcbiAgICBwYXJzZVVybCxcXG4gICAgZ2V0Q2hhcnNldFxcbn0g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JpbmcodXJsMS5pbmRleE9mKFxcXCIse1xcXCIpICsgMiwgdXJsMS5sZW5ndGgpO1xcbiAgICAgICAgICAgIC8vbG9nKGV4dCk7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgZXh0ID0gSlNPTi5wYXJzZShleHQpO1xcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgZXZhbChcXFwiZXh0PVxcXCIgKyBleHQpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoZXh0Lm1ldGhvZCAmJiBleHQubWV0aG9kICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgIG1ldGhvZCA9IGV4dC5tZXRob2Q7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChleHQuYm9keSAmJiBleHQuYm9keSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBib2R5ID0gZXh0LmJvZHk7XFxuICAgICAgICAgICAgICAgIGhlYWRlcnNbXFxcIkNvbnRlbnQtVHlwZVxcXCJdID0gXFxcImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZFxcXCIgKyAoaGVhZGVycy5jaGFyc2V0ID8gXFxcIjtjaGFyc2V0PVxcXCIgKyBoZWFkZXJzLmNoYXJzZXQgOiBcXFwiXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICBpZiAodXJsMS5pbmNsdWRlcygnXFxcIlBPU1RcXFwiJykgfHwgdXJsMS5pbmNsdWRlcygnXFxcInBvc3RcXFwiJykpIHtcXG4gICAgICAgICAgICBtZXRob2QgPSBcXFwicG9zdFxcXCI7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgaWYgKG1ldGhvZCA9PSBcXFwicG9zdFxcXCIgfHwgbWV0aG9kID09IFxcXCJQT1NUXFxcIikge1xcbiAgICAgICAgbG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bCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gcnVsZXMuZmlsdGVyKGkgPT4gaS5uYW1lID09IHJ1bGUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgc3RhcnQgPSAocGFnZSAtIDEpICogc2l6ZTtcXG4gICAgICAgICAgICBpZiAocnVsZXMubGVuZ3RoIDwgc3RhcnQgKyAxKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGxlbiA9IHNpemU7XFxuICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA8IHBhZ2UgKiBzaXplKSB7XFxuICAgICAgICAgICAgICAgIGxlbiA9IHJ1bGVzLmxlbmd0aCAtIHN0YXJ0XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBhbGwgPSBydWxlcy5sZW5ndGg7XFxuICAgICAgICAgICAgbGV0IHVzZSA9IChwYWdlIC0gMSkgKiBzaXplICsgbGVuO1xcbiAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgIGFsbDogYWxsLFxcbiAgICAgICAgICAgICAgICB1c2U6IHVzZSxcXG4gICAgICAgICAgICAgICAgZGF0YTogcnVsZXMuc2xpY2Uoc3RhcnQsIHN0YXJ0ICsgbGVuKVxcbiAgICAgICAgICAgIH07XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICAgICAgYWxsOiAwLFxcbiAgICAgICAgICAgICAgICB1c2U6IDAsXFxuICAgICAgICAgICAgICAgIGRhdGE6IFtdXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9XFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5pWw5o2uXCIsXCJwYXRoXCI6XCJkYXRhdFwiLFwicnVsZVwiOlwibGV0IGxvYWQgPSBmdW5jdGlvb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G4gICAgICAgIGxldCBjID0gcmVhZEZpbGUoXFxcImNoYXB0ZXIuanNvblxcXCIpIHx8IFxcXCJbXVxcXCI7XFxuICAgICAgICBjID0gSlNPTi5wYXJzZShjKVxcbiAgICAgICAgbGV0IGNoZSA9IHtcXG4gICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICBuZXh0OiBcXFwiXFxcIixcXG4gICAgICAgICAgICBjaGFwdGVyczogW11cXG4gICAgICAgIH07XFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGMubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICBpZiAoY1tpXS51cmwgPT0gY2hlLnVybCkge1xcbiAgICAgICAgICAgICAgICBjW2ldID0gY2hlO1xcbiAgICAgICAgICAgICAgICBsb2coXFxcImNsZWFyOlxcXCIgKyB1cmwpXFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKFxcXCJjaGFwdGVyLmpzb25cXFwiLCBKU09OLnN0cmluZ2lmeShjKSlcXG4gICAgICAgICAgICAgICAgYnJlYWtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0sIHVybCkpXFxuICAgIGZvciAobGV0IGl0IG9mIGNhY2hlcykge1xcbiAgICAgICAgaWYgKGl0LnVybCA9PSB1cmwpIHtcXG4gICAgICAgICAgICByZXR1cm4gaXQ7XFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgcmV0dXJuIHtcXG4gICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgbmV4dDogXFxcIlxcXCIsXFxuICAgICAgICBjaGFwdGVyczogW11cXG4gICAgfVxcbn1cXG5cXG5mdW5jdGlvbiBzYXZlQ2FjaGUoY2hlKSB7XFxuICAgIGxldCBjID0gY2FjaGVzXFxuICAgIGlmIChjLmxlbmd0aCA+IDEwKSB7XFxuICAgICAgICBjLnNoaWZ0KClcXG4gICAgfVxcbiAgICBsZXQgZXhpc3QgPSBmYWxzZVxcbiAgICBmb3IgKGxldCBpID0gMDsga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AgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IE1ZX1BBUkFNUy5jb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdTFcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCJcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICAvL2xvZyhjYWNoZS5uZXh0ICsgXFxcIjpcXFwiICsgY2FjaGUuY2hhcHRlcnMubGVuZ3RoKTtcXG4gICAgbGV0IGQyID0gY2MoYXJyKTtcXG4gICAgZDIucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIuWKoOi9veS4re+8jOivt+eojeWAmS4uLlxcXCIsXFxuICAgICAgICB1cmw6IFxcXCJcXFwiLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgaWQ6IGlkXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBkMi51bnNoaWZ0KHtcXG4gICAgICAgIHRpdGxlOiBNWV9QQVJBTVMuYm9va05hbWUsXFxuICAgICAgICBpbWc6IE1ZX1BBUkFNUy5jb3ZlcixcXG4gICAgICAgIHVybDogTVlfVVJMLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJtb3ZpZV8xX3ZlcnRpY2FsX3BpY19ibHVyXFxcIlxcbiAgICB9KTtcXG4gICAgc2V0UmVzdWx0KGQyKTtcXG4gICAgaGVhZGVyc1tcXFwiUmVmZXJlclxcXCJdID0gTVlfVVJMLnNwbGl0KFxcXCIjXFxcIilbMF07XFxuICAgIGlmIChudXJsICE9IE1ZX1VSTCkge1xcbiAgICAgICAgTVlfVVJMID0gbnVybDtcXG4gICAgICAgIHJlcyA9IGZldGNoKE1ZX1VSTCwge1xcbiAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnNcXG4gICAgICAgIH0pO1xcbiAgICB9IGVsc2UgaWYgKE1ZX1BBUkFNUy51MSkge1xcbiAgICAgICAgcmVzID0gZmV0Y2goTVlfVVJMLCB7XFxuICAgICAgICAgICAgaGVhZGVyczogaGVhZGVyc1xcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgdmFyIHVybHMgPSBbbnVybF07XFxuICAgIHdoaWxlICh0cnVlKSB7XFxuICAgICAgICBsZXQgYSA9IFtdO1xcbiAgICAgICAgZm9yIChsZXQgaXQgb2YgYXJyKSB7XFxuICAgICAgICAgICAgYS5wdXNoKGl0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGNhY2hlLmNoYXB0ZXJzID0gYTtcXG4gICAgICAgIGxldCBhcnIxID0gZ2V0QXJyYXkocmVzLCBUb2MuY2hhcHRlckxpc3QpO1xcbiAgICAgICAgLy9sb2coYXJyMSk7XFxuICAgICAgICBpZiAoYXJyMSAmJiBhcnIxLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICBmb3IgKGxldCBpdCBvZiBhcnIxKSB7XFxuICAgICAgICAgICAgICAgIGFyci5wdXNoKGl0KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGFkZEl0ZW1CZWZvcmUoaWQsIGNjKGFycjEpKTtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKGFpZCwgXFxcIjBcXFwiKSAhPSBcXFwiMVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgbG9nKFxcXCJicmVhazogXFxcIiArIGFpZCk7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBqYXZhLmxhbmcuVGhyZWFkLnNsZWVwKDUwKTtcXG4gICAgICAgICAgICBsZXQgbnVybDIgPSBwZChyZXMsIFxcXCJib2R5JiZcXFwiICsgbmV4dCk7XFxuICAgICAgICAgICAgaWYgKG51cmwyICYmIG51cmwyICE9IFxcXCJcXFwiICYmICF1cmxzLmluY2x1ZGVzKG51cmwyKSkge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzW1xcXCJSZWZlcmVyXFxcIl0gPSBjYWNoZS5uZXh0LnNwbGl0KFxcXCIjXFxcIilbMF07XFxuICAgICAgICAgICAgICAgIHVybHMucHVzaChudXJsMik7XFxuICAgICAgICAgICAgICAgIGNhY2hlLm5leHQgPSBudXJsMjtcXG4gICAgICAgICAgICAgICAgbnVybCA9IG51cmwyO1xcbiAgICAgICAgICAgICAgICBNWV9VUkwgPSBudXJsO1xcbiAgICAgICAgICAgICAgICByZXMgPSBmZXRjaChudXJsLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBkZWxldGVJdGVtKGlkKTtcXG4gICAgLy9sb2coY2FjaGUubmV4dCArIFxcXCI6ZW5kOlxcXCIgKyBjYWNoZS5jaGFwdGVycy5sZW5ndGgpO1xcbiAgICBzYXZlQ2FjaGUoY2FjaGUpO1xcbn0gZWxzZSB7XFxuICAgIGxpc3QgPSBnZXRBcnJheShyZXMsIFRvYy5jaGFwdGVyTGlzdCk7XFxuICAgIGxpc3QuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgIC8vbG9nKGl0ZW0pOyAgICBcXG4gICAgICAgIHZhciB0aXRsZSA9IGdldFRleHQoaXRlbSwgVG9jLmNoYXB0ZXJOYW1lKVxcbiAgICAgICAgaWYgKHRpdGxlICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgbGV0IHUxID0gZ2V0VXJsMChpdGVtLCBUb2MuY2hhcHRlckxpc3QsIFRvYy5jaGFwdGVyVXJsKSArIFxcXCIjYXV0b1BhZ2UjI3JlYWRUaGVtZSNcXFwiO1xcbiAgICAgICAgICAgIGlmIChNWV9QQVJBTVMuY2hhcnNldCkge1xcbiAgICAgICAgICAgICAgICB1MSA9IHUxICsgXFxcIjtnZXQ7XFxcIiArIE1ZX1BBUkFNUy5jaGFyc2V0O1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9jb250ZW50XFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IE1ZX1BBUkFNUy5jb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1MVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuXFxuICAgIHZhciBjcCA9IGQubWFwKGZ1bmN0aW9uKGl0ZW0pIHtcXG4gICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgXFxcInRpdGxlXFxcIjogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICBcXFwidXJsXFxcIjogaXRlbS5leHRyYS51cmwucmVwbGFjZShcXFwiI2F1dG9QYWdlIyNyZWFkVGhlbWUjXFxcIiwgXFxcIlxcXCIpXFxuICAgICAgICB9XFxuICAgIH0pO1xcbiAgICBpZiAobGlzdC5sZW5ndGggPiAwKSB7XFxuICAgICAgICBkLnVuc2hpZnQoe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5LiL6L29XFxcIixcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvZG93bmxvYWQudmlldyNub1JlY29yZEhpc3RvcnkjI25vUmVmcmVzaCMjbm9IaXN0b3J5Iz9ydWxlPeacrOWcsOi1hOa6kOeuoeeQhlxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBjaGFwdGVyTGlzdDogY3AsXFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWaWV3OiBcXFwiMVxcXCIsXFxuICAgICAgICAgICAgICAgIGluZm86IHtcXG4gICAgICAgICAgICAgICAgICAgIGJvb2tOYW1lOiBNWV9QQVJBTVMuYm9va05hbWUsXFxuICAgICAgICAgICAgICAgICAgICBib29rVG9wUGljOiBNWV9QQVJBTVMuY292ZXIsXFxuICAgICAgICAgICAgICAgICAgICBydWxlTmFtZTogXFxcIuaCpuivu1xcXCIsXFxuICAgICAgICAgICAgICAgICAgICBwYXJzZUNvZGU6ICQudG9TdHJpbmcoKE1ZX1BBUkFNUywgcjApID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb252ZXJ0XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL2NvbnZlcnRlcj9ydWxlPVxcXCIgKyByMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IHJlcXVlc3QoaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBydWxlID0gTVlfUEFSQU1TLmNvbnRlbnQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHIgPSBjb252ZXJ0KHJ1bGUuY29udGVudCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHIxID0gci5zcGxpdChcXFwiJiZcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcjIgPSByMS5zbGljZSgwLCByMS5sZW5ndGggLSAxKS5qb2luKFxcXCImJlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBhcnIgPSBwZGZhKHJlcywgXFxcImJvZHkmJlxcXCIgKyByMik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coYXJyKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdHQgPSBcXFwiXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGFycikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdCA9IGl0LnJlcGxhY2UobmV3IFJlZ0V4cChcXFwiXFxcXG5cXFwiLCBcXFwiZ1xcXCIpLCBcXFwiLS1ici0tXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGl0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBwZGZoKGl0LCBcXFwiVGV4dFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gdC5yZXBsYWNlKG5ldyBSZWdFeHAoXFxcIi0tYnItLVxcXCIsIFxcXCJnXFxcIiksIFxcXCI8YnI+XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0MiA9IHQuc3BsaXQoXFxcIjxicj5cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQyIG9mIHQyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXQyID09IFxcXCJcXFwiIHx8IGl0Mi5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWl0Mi5zdGFydHNXaXRoKFxcXCLjgIBcXFwiKSAmJiAhaXQyLnN0YXJ0c1dpdGgoXFxcIiZuYnNwOyZuYnNwO1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXQyID0gXFxcIiZuYnNwOyZuYnNwOyZuYnNwOyZuYnNwO1xcXCIgKyBpdDIudHJpbSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJ1bGUucmVwbGFjZVJlZ2V4KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXQyID0gaXQyLnJlcGxhY2UobmV3IFJlZ0V4cChydWxlLnJlcGxhY2VSZWdleC5yZXBsYWNlKFxcXCIjI1xcXCIsIFxcXCJcXFwiKSwgXFxcImdcXFwiKSwgXFxcIlxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXQyID09IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWVcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR0ICs9IGl0MiArIFxcXCJcXFxcblxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHRcXG4gICAgICAgICAgICAgICAgICAgIH0sIE1ZX1BBUkFNUywgTVlfU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m4gJChcXFxcXFxcIlxcXFxcXFwiLCBcXFxcXFxcIuivt+i+k+WFpeiuoumYheWcsOWdgFxcXFxcXFwiKS5pbnB1dCgobmFtZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGxldCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFkZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlXFxcXG4gICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICBhZGQobmFtZSwgaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCBpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5a+85YWl5oiQ5YqfXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5a+85YWl5aSx6LSlXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9LCBpbnB1dClcXFxcbiAgICAgICAgfSksXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfMlxcXFxcXFwiXFxcXG4gICAgfSlcXFxcbiAgICBkLnB1c2goe1xcXFxuICAgICAgICB0aXRsZTogXFxcXFxcXCLmt7vliqDmnKzlnLBcXFxcXFxcIixcXFxcbiAgICAgICAgdXJsOiAkKFxcXFxcXFwiXFxcXFxcXCIsIFxcXFxcXFwi6K+36L6T5YWl6K6i6ZiF5ZCN56ew77yM5Y+W5Liq5ZCN5ZCn77yI6L6T5a6M54K55Ye756Gu5a6a5ZCO5L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cXFxcIlxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBsZXQgdXJsID0gXFxcXFxcXCJoaWtlcjovL2ZpbGVzL3l1ZWR1L1xcXFxcXFwiICsgZm5hbWU7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGMgPSBmZXRjaChcXFxcXFxcImZpbGU6Ly9cXFxcXFxcIiArIGlucHV0KTtcXFxcbiAgICAgICAgICAgICAgICBpZiAoIWMuaW5jbHVkZXMoXFxcXFxcXCJib29rU291cmNlXFxcXFxcXCIpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5qC85byP5LiN5a+577yM5LuF5pSv5oyB5Lmm5rqQ5paH5Lu2XFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgd3JpdGVGaWxlKHVybCwgYyk7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgYWRkLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVcXFxcbiAgICAgICAgICAgICAgICB9ID0gJC5yZXF1aXJlKFxcXFxcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgIGFkZChuYW1lLCB1cmwpO1xcXFxuICAgICAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZShuYW1lLCB1cmwpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WvvOWFpeaIkOWKn1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WvvOWFpeWksei0pVxcXFx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GV0ZUZpbGUoXFxcXFxcXCJoaWtlcjovL2ZpbGVzL3l1ZWR1L1xcXFxcXFwiICsgbWQ1KG5hbWUpICsgXFxcXFxcXCIuanNvblxcXFxcXFwiKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXFxcXFwiaGlrZXI6Ly9wYWdlL2RhdGF0XFxcXFxcXCIpLnJlbW92ZSh1cmwpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5bey5Yig6ZmkXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT0gXFxcXFxcXCLnvJbovpHlkI3np7BcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIlxcXFxcXFwiKS5pbnB1dCgobmFtZSwgdXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVGaWxlKFxcXFxcXFwiaGlrZXI6Ly9maWxlcy95dWVkdS9cXFxcXFxcIiArIG1kNShuYW1lKSArIFxcXFxcXFwiLmpzb25cXFxcXFxcIilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVuYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZShpbnB1dCwgdXJsKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZSh1cmwsIGlucHV0KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgbmFtZSwgdXJsKVxcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT0gXFxcXFxcXCLliIbkuqvorqLpmIVcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAodXJsLnN0YXJ0c1dpdGgoXFxcXFxcXCJoaWtlcjovL2ZpbGVzL1xcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/lvZPliY3orqLpmIXkuLrmnKzlnLDmlofku7bvvIzml6Dms5XliIbkuqtcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIiNub0xvYWRpbmcjXFxcXFxcXCIpLmxhenlSdWxlKChuYW1lLCB1cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hhcmVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcXFxcXCJoaWtlcjovL3BhZ2UvZGF0YXRcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gc2hhcmUobmFtZSwgdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCBuYW1lLCB1cmwpXFxcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxcXG4gICAgIC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FxuICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9wYWdlL2NvbnRlbnRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQ6IE1ZX1BBUkFNUy5jb250ZW50LFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB1MVxcXFxuICAgICAgICAgICAgICAgICAgICB9LFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0XzFcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pO1xcXFxuICAgIH1cXFxcbiAgICAvL2xvZyhjYWNoZS5uZXh0ICsgXFxcXFxcXCI6XFxcXFxcXCIgKyBjYWNoZS5jaGFwdGVycy5sZW5ndGgpO1xcXFxuICAgIGxldCBkMiA9IGNjKGFycik7XFxcXG4gICAgZDIucHVzaCh7XFxcXG4gICAgICAgIHRpdGxlOiBcXFxcXFxcIuWKoOi9veS4re+8jOivt+eojeWAmS4uLlxcXFxcXFwiLFxcXFxuICAgICAgICB1cmw6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIixcXFxcbiAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgIGlkOiBpZFxcXFxuICAgICAgICB9XFxcXG4gICAgfSk7XFxcXG4gICAgZDIudW5zaGlmdCh7XFxcXG4gICAgICAgIHRpdGxlOiBNWV9QQVJBTVMuYm9va05hbWUsXFxcXG4gICAgICAgIGltZzogTVlfUEFSQU1TLmNvdmVyLFxcXFxuICAgICAgICB1cmw6IE1ZX1VSTCxcXFxcbiAgICAgICAgY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cXFxcbiAgICAgICAgYWRkSXRlbUJlZm9yZShpZCwgY2MoYXJyMSkpO1xcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKGFpZCwgXFxcXFxcXCIwXFxcXFxcXCIpICE9IFxcXFxcXFwiMVxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgbG9nKFxcXFxcXFwiYnJlYWs6IFxcXFxcXFwiICsgYWlkKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAoNTApO1xcXFxuICAgICAgICAgICAgbGV0IG51cmwyID0gcGQocmVzLCBcXFxcXFxcImJvZHkmJlxcXFxcXFwiICsgbmV4dCk7XFxcXG4gICAgICAgICAgICBpZiAobnVybDIgJiYgbnVybDIgIT0gXFxcXFxcXCJcXFxcXFxcIiAmJiAhdXJscy5pbmNsdWRlcyhudXJsMikpIHtcXFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzW1xcXFxcXFwiUmVmZXJlclxcXFxcXFwiXSA9IGNhY2hlLm5leHQuc3BsaXQoXFxcXFxcXCIjXFxcXFxcXCIpWzBdO1xcXFxuICAgICAgICAgICAgICAgIHVybHMucHVzaChudXJsMik7XFxcXG4gICAgICAgICAgICAgICAgY2FjaGUubmV4dCA9IG51cmwyO1xcXFxuICAgICAgICAgICAgICAgIG51cmwgPSBudXJsMjtcXFxcbiAgICAgICAgICAgICAgICBNWV9VUkwgPSBudXJsO1xcXFxuICAgICAgICAgICAgICAgIHJlcyA9IGZldGNoKG51cmwsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVyc1xcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSB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pdGxlOiB0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgY29udGVudDogTVlfUEFSQU1TLmNvbnRlbnQsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdTFcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICB9XFxcXG4gICAgfSk7XFxcXG5cXFxcbiAgICB2YXIgY3AgPSBkLm1hcChmdW5jdGlvbihpdGVtKSB7XFxcXG4gICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICBcXFxcXFxcInRpdGxlXFxcXFxcXCI6IGl0ZW0udGl0bGUsXFxcXG4gICAgICAgICAgICBcXFxcXFxcInVybFxcXFxcXFwiOiBpdGVtLmV4dHJhLnVybC5yZXBsYWNlKFxcXFxcXFwiI2F1dG9QYWdlIyNyZWFkVGhlbWUjXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpXFxcXG4gICAgICAgIH1cXFxcbiAgICB9KTtcXFxcbiAgICBpZiAobGlzdC5sZW5ndGggPiAwKSB7XFxcXG4gICAgICAgIGQudW5zaGlmdCh7XFxcXG4gICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLkuIvovb1cXFxcXFxcIixcXFxcbiAgICAgICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL3BhZ2UvZG93bmxvYWQudmlldyNub1JlY29yZEhpc3RvcnkjI25vUmVmcmVzaCMjbm9IaXN0b3J5Iz9ydWxlPeacrOWcsOi1hOa6kOeuoeeQhlxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF9jZW50ZXJfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICBjaGFwdGVyTGlzdDogY3AsXFxcXG4gICAgICAgICAgICAgICAgZGVmYXVsdFZpZXc6IFxcXFxcXFwiMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGluZm86IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgYm9va05hbWU6IE1ZX1BBUkFNUy5ib29rTmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgYm9va1RvcFBpYzogTVlfUEFSQU1TLmNvdmVyLFxcXFxuICAgICAgICAgICAgICAgICAgICBydWxlTmFtZTogXFxcXFxcXCLmgqbor7tcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgcGFyc2VDb2RlOiAkLnRvU3RyaW5nKChNWV9QQVJBTVMsIHIwKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnZlcnRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcXFxcXCJoaWtlcjovL3BhZ2UvY29udmVydGVyP3J1bGU9XFxcXFxcXCIgKyByMCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzID0gcmVxdWVzdChpbnB1dCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgcnVsZSA9IE1ZX1BBUkFNUy5jb250ZW50O1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHIgPSBjb252ZXJ0KHJ1bGUuY29udGVudCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcjEgPSByLnNwbGl0KFxcXFxcXFwiJiZcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcjIgPSByMS5zbGljZSgwLCByMS5sZW5ndGggLSAxKS5qb2luKFxcXFxcXFwiJiZcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgYXJyID0gcGRmYShyZXMsIFxcXFxcXFwiYm9keSYmXFxcXFxcXCIgKyByMik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhhcnIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHR0ID0gXFxcXFxcXCJcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgYXJyKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaXQgPSBpdC5yZXBsYWNlKG5ldyBSZWdFeHAoXFxcXFxcXCJcXFxcXFxcXG5cXFxcXFxcIiwgXFxcXFxcXCJnXFxcXFxcXCIpLCBcXFxcXFxcIi0tYnItLVxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhpdCk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHQgPSBwZGZoKGl0LCBcXFxcXFxcIlRleHRcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdCA9IHQucmVwbGFjZShuZXcgUmVnRXhwKFxcXFxcXFwiLS1ici0tXFxcXFxcXCIsIFxcXFxcXFwiZ1xcXFxcXFwiKSwgXFxcXFxcXCI8YnI+XFxcXFxcXCIpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0ID09IFxcXFxcXFwiXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHQyID0gdC5zcGxpdChcXFxcXFxcIjxicj5cXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChsZXQgaXQyIG9mIHQyKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpdDIgPT0gXFxcXFxcXCJcXFxcXFxcIiB8fCBpdDIubGVuZ3RoID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpdDIuc3RhcnRzV2l0aChcXFxcXFxcIuOAgFxcXFxcXFwiKSAmJiAhaXQyLnN0YXJ0c1dpdGgoXFxcXFxcXCImbmJzcDsmbmJzcDtcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGl0MiA9IFxcXFxcXFwiJm5ic3A7Jm5ic3A7Jm5ic3A7Jm5ic3A7XFxcXFxcXCIgKyBpdDIudHJpbSgpO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChydWxlLnJlcGxhY2VSZWdleCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXQyID0gaXQyLnJlcGxhY2UobmV3IFJlZ0V4cChydWxlLnJlcGxhY2VSZWdleC5yZXBsYWNlKFxcXFxcXFwiIyNcXFxcXFxcIiwgXFxcXFxcXCJcXFxcXFxcIiksIFxcXFxcXFwiZ1xcXFxcXFwiKSwgXFxcXFxcXCJcXFxcXFxcIilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaXQyID09IFxcXFxcXFwiXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHQgKz0gaXQyICsgXFxcXFxcXCJcXFxcXFxcXG5cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJ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uICAgICAgICBsZXQgcjMgPSBbXTtcXFxcbiAgICAgICAgZm9yIChsZXQgaXQgb2YgcjIpIHtcXFxcbiAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGkgPSBwYXJzZUludChpdCk7XFxcXG4gICAgICAgICAgICAgICAgaWYgKGlzTmFOKGkpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByMy5wdXNoKGkpO1xcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge31cXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBsZXQgYXJyMiA9IFtdO1xcXFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGFyci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgaWYgKHIzLmluZGV4T2YoaSkgPCAwKSB7XFxcXG4gICAgICAgICAgICAgICAgYXJyMi5wdXNoKGFycltpXSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgcmV0dXJuIGFycjI7XFxcXG4gICAgfVxcXFxuICAgIGxvZyhcXFxcXFxcIuiOt+WPluWksei0pe+8jOWksei0peWumuS9je+8mlxcXFxcXFwiICsgcjEpXFxcXG4gICAgcmV0dXJuIGFycjtcXFxcbn07XFxcXG5sZXQgZ2V0VGV4dCA9IChodG1sLCBydWxlKSA9PiB7XFxcXG4gICAgdmFyIHJ1ID0gY29udmVydChydWxlKVxcXFxuICAgIHZhciByID0gcGRmaChodG1sLCBydSlcXFxcbiAgICBpZiAociA9PSBcXFxcXFxcIlxcXFxcXFwiKSB7XFxcXG4gICAgICAgIGxvZyhcXFxcXFxcIui/lOWbnuS4uuepuu+8jOWPr+iDveaYr+WumuS9jeWksei0pe+8mlxcXFxcXFwiICsgcnVsZSlcXFxcbiAgICB9XFxcXG4gICAgcmV0dXJuIHJcXFxcbn07XFxcXG5sZ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ICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdCBvZiByZXN1bHQpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtLmogPSBwYXJhbS5qICsgMTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChtYXRjaE11c3QpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIXNlYXJjaENvbnRhaW5zKGl0LnRpdGxlLCBzKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250aW51ZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZXh0cmEgPSBpdC5leHRyYSB8fCB7fTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmlkID0gXFxcXFxcXCJfX2FwcFxcXFxcXFwiICsgTVlfUEFHRSArIFxcXFxcXFwiQFxcXFxcXFwiICsgcGFyYW0uajtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmJvb2tOYW1lID0gaXQudGl0bGVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhLmNvdmVyID0gaXQucGljX3VybCB8fCBpdC5pbWdcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1CZWZvcmUocGFnZWlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LnRpdGxlLmluY2x1ZGVzKFxcXFxcXFwi4oCc4oCc4oCd4oCdXFxcXFxcXCIpID8gaXQudGl0bGUgOiBcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiICsgaXQudGl0bGUucmVwbGFjZShuZXcgUmVnRXhwKFxcXFxcXFwiPGVtPnw8L2VtPlxcXFxcXFwiLCBcXFxcXFxcImdcXFxcXFxcIiksIFxcXFxcXFwiXFxcXFxcXCIpLnJlcGxhY2UobmV3IFJlZ0V4cChzLCBcXFxcXFxcImdcXFxcXFxcIiksIFxcXFxcXFwiPHN0cm9uZz48c3BhbiBzdHlsZT1cXFxcXFxcXFxcXFxcXFwiY29sb3I6ICMxRTkwRkZcXFxcXFxcXFxcXFxcXFwiPlxcXFxcXFwiICsgcyArIFxcXFxcXFwiPC9zcGFuPjwvc3Ryb25nPlxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBpdC5kZXNjLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaXQudXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGl0LnBpY191cmwgfHwgaXQuaW1nLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBpdC5waWNfdXJsIHx8IGl0LmltZyA/ICdtb3ZpZV8xX3ZlcnRpY2FsX3BpYycgOiBcXFxcXFxcInRleHRfMVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiBleHRyYVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmIChwYXJhbS5pID49IHBhcmFtLmFsbCkge1xcXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW0ocGFnZWlkKVxcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5Yqg6L2956ysXFxcXFxcXCIgKyBNWV9QQUdFICsgXFxcXFxcXCLpobXkuK3vvIzov5vluqbvvJpcXFxcXFxcIiArIChwYXJhbS5pICsgMSk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O1xcXFxufVxcXFxuJC5leHBvcnRzID0ge1xcXFxuICAgIGNvbnZlcnQ6IGNvbnZlcnQsXFxcXG4gICAgc2VhcmNoOiBzZWFyY2gsXFxcXG4gICAgbGlzdFJ1bGVzOiAocGFnZSwgcnVsZSkgPT4ge1xcXFxuICAgICAgICB0cnkge1xcXFxuICAgICAgICAgICAgLy/lubblj5HmlbDph49cXFxcbiAgICAgICAgICAgIGxldCBzaXplID0gMTY7XFxcXG4gICAgICAgICAgICBsZXQge1xcXFxuICAgICAgICAgICAgICAgIGxvYWQsXFxcXG4gICAgICAgICAgICAgICAgbG9hZFJ1bGVzLFxcXFxuICAgICAgICAgICAgICAgIGdldFNlbGVjdFxcXFxuICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcXFxcXFxcImhpa2VyOi8vcGFnZS9kYXRhdFxcXFxcXFwiKTtcXFxcbiAgICAgICAgICAgIGxldCBkYXRhID0gbG9hZCgpO1xcXFxuICAgICAgICAgICAgbGV0IHNlbGVjdCA9IGdldFNlbGVjdChkYXRhKTtcXFxcbiAgICAgICAgICAgIGxldCBydWxlcyA9IGRhdGEubGVuZ3RoID4gMCA/IGxvYWRSdWxlcyhzZWxlY3QubmFtZSkgOiBbXTtcXFxcbiAgICAgICAgICAgIGlmICghcGFnZSAmJiAhcnVsZSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBydWxlcy5tYXAoaXQgPT4gaXQubmFtZSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAocnVsZSAhPSBudWxsKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHJ1bGVzLmZpbHRlcihpID0+IGkubmFtZSA9PSBydWxlKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGxldCBzdGFydCA9IChwYWdlIC0gMSkgKiBzaXplO1xcXFxuICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA8IHN0YXJ0ICsgMSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBbXTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGxldCBsZW4gPSBzaXplO1xcXFxuICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA8IHBhZ2UgKiBzaXplKSB7XFxcXG4gICAgICAgICAgICAgICAgbGVuID0gcnVsZXMubGVuZ3RoIC0gc3RhcnRcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGxldCBhbGwgPSBydWxlcy5sZW5ndGg7XFxcXG4gICAgICAgICAgICBsZXQgdXNlID0gKHBhZ2UgLSAxKSAqIHNpemUgKyBsZW47XFxcXG4gICAgICAgICAgICByZXR1cm4ge1xcXFxuICAgICAgICAgICAgICAgIGFsbDogYWxsLFxcXFxuICAgICAgICAgICAgICAgIHVzZTogdXNlLFxcXFxuICAgICAgICAgICAgICAgIGRhdGE6IHJ1bGVzLnNsaWNlKHN0YXJ0LCBzdGFydCArIGxlbilcXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXFxcbiAgICAgICAgICAgIHJldHVybiB7XFxcXG4gICAgICAgICAgICAgICAgYWxsOiAwLFxcXFxuICAgICAgICAgICAgICAgIHVzZTogMCxcXFxcbiAgICAgICAgICAgICAgICBkYXRhOiBbXVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9XFxcXG4gICAgfVxcXFxufVxcXCJ9LHtcXFwiY29sX3R5cGVcXFwiOlxcXCJtb3ZpZV8zXFxcIixcXFwibmFtZVxcXCI6XFxcIuaVsOaNrlxcXCIsXFxcInBhdGhcXFwiOlxcXCJkYXRhdFxcXCIsXFxcInJ1bGVcXFwiOlxcXCJsZXQgbG9hZCA9IGZ1bmN0aW9uKCkge1xcXFxuICAgIHRyeSB7XFxcXG4gICAgICAgIHJldHVybiBKU09OLnBhcnNlKGZldGNoKFxcXFxcXFwiaGlrZXI6Ly9maWxlcy95dWVkdS9saXN0Lmpzb25cX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