Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥当前无Alist配置@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS4u+mhtVwiLFwicGF0aFwiOlwiaG9tZVwiLFwicnVsZVwiOlwianM6XFxudmFyIGQgPSBbXTtcXG5pZiAoZmlsZUV4aXN0KFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL2FsaXN0X2NhY2hlLmpzb25cXFwiKSkge1xcbiAgICBsZXQgYWxpc3QgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXCJsaXN0XFxcIiwgW10pXFxuICAgIHZhciBsID0gSlNPTi5wYXJzZShmZXRjaChcXFwiaGlrZXI6Ly9maWxlcy9jYWNoZS9hbGlzdF9jYWNoZS5qc29uXFxcIikpXFxuICAgIHZhciB0ZXN0bGlzdCA9IGFsaXN0Lm1hcChmdW5jdGlvbihpdGVtKSB7XFxuICAgICAgICByZXR1cm4gaXRlbS51cmxcXG4gICAgfSlcXG4gICAgbC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgaWYgKCF0ZXN0bGlzdC5pbmNsdWRlcyhpdGVtLnVybCkpIHtcXG4gICAgICAgICAgICBhbGlzdC5wdXNoKGl0ZW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AgIH0gZWxzZSB7XFxuICAgICAgICAgICAgdG9hc3QoXFxcIueZu+mZhuWksei0pVxcXCIpXFxuICAgICAgICAgICAgbG9nKHJlcylcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIui0puWPt+WvhueggemUmeivr1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9jb25maWdcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBzZXRSZXN1bHQoZClcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBpZiAoTVlfUEFHRSA9PSAxKSB7XFxuICAgICAgICBpZiAocGF0aCA9PSBcXFwiL1xcXCIpIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKame+4j+iuvue9rlxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9jb25maWdcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBhbGlzdC5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaSA9PSBzZWxlY3RlZCA/ICQucmVxdWlyZShcXFwiYXBpXFxcIikuY29sb3IoaXRlbS5uYW1lLCBcXFwicmVkXFxcIikgOiBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBpID09IHNlbGVjdGVkID8gXFxcIng1Oi8vXFxcIiArIG5vdy51cmwgOiAkKCkubGF6eVJ1bGUoKGkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzZWxlY3RlZFxcXCIsIGkgKyBcXFwiXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSwgaSlcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIlxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChub3cuc2VhcmNoKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLwn5SOIOaQnOe0olxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9zZWFyY2g/cGFnZT1meXBhZ2UmdT1cXFwiICsgbm93LnVybCArIFxcXCImcGF0aD1cXFwiICsgcGF0aCxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgICAgICBub3c6IG5vd1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChub3cudXNlciAmJiBub3cucGFzc3dvcmQpIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuaWsOW7uuaWh+S7tuWkuVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiXFxcIikuaW5wdXQoKHBhdGgsIG5vdywgaGVhZGVycykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcImFwaS9mcy9ta2RpclxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IHBhdGggKyBcXFwiL1xcXCIgKyBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnNcXG4gICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxuICAgICAgICAgICAgICAgICAgICBpZiAocmVzID09IDIwMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yib5bu65oiQ5YqfXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yib5bu65aSx6LSlXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBwYXRoLCBub3csIGhlYWRlcnMpXFxuICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuaWsOW7uuaWh+S7tlxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiXFxcIikuaW5wdXQoKHBhdGgsIG5vdywgaGVhZGVycykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyc1tcXFwiRmlsZS1QYXRoXFxcIl0gPSBlbmNvZGVVUkkocGF0aCArIFxcXCIvXFxcIiArIGlucHV0KVxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocmVxdWVzdChub3cudXJsICsgXFxcImFwaS9mcy9wdXRcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogXFxcIlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6IFxcXCJQVVRcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9KSkuY29kZVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcyA9PSAyMDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIm+W7uuaIkOWKn1xcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIm+W7uuWksei0pVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgcGF0aCwgbm93LCBoZWFkZXJzKVxcbiAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmt7vliqBhcmlhMuS7u+WKoVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiXFxcIiwgXFxcIuWkmuadoeeUqOWbnui9pumalOW8gFxcXCIpLmlucHV0KChwYXRoLCBub3csIGhlYWRlcnMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciByZXMgPSBKU09OLnBhcnNlKHBvc3Qobm93LnVybCArIFxcXCJhcGkvZnMvYWRkX2FyaWEyXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogcGF0aCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsczogaW5wdXQuc3BsaXQoXFxcIlxcXFxuXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzXFxuICAgICAgICAgICAgICAgICAgICB9KSkuY29kZVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcyA9PSAyMDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIm+W7uuaIkOWKn1xcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIm+W7uuWksei0pVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgcGF0aCwgbm93LCBoZWFkZXJzKVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG4gICAgICAgIH0pXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmlnX2JsYW5rX2Jsb2NrXFxcIlxcbiAgICAgICAgfSlcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJiaWdfYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICB9KVxcblxcbiAgICAgICAgLy8g5o6S5bqPXFxuICAgICAgICBzb3JyLmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgaWYgKG5zb3J0ID09IGl0ZW0pIHtcXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbSArIFxcXCLihpNcXFwiXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChuc29ydC5pbmNsdWRlcyhcXFwi5Y+NXFxcIikgJiYgbnNvcnQuaW5jbHVkZXMoaXRlbSkpIHtcXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbSArIFxcXCLihpFcXFwiXFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbSArIFxcXCLihpVcXFwiXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChnZXRJdGVtKFxcXCJzb3J0XFxcIiwgXFxcIum7mOiupFxcXCIpID09IGl0ZW0pIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzb3J0XFxcIiwgaXRlbSArIFxcXCLlj41cXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzb3J0XFxcIiwgaXRlbSlcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgfSwgaXRlbSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSlcXG4gICAgfVxcblxcbiAgICBsZXQgYmlkID0gcGF0aCArIFxcXCItbG9hZGluZy1cXFwiICsgTVlfUEFHRTtcXG4gICAgbGV0IGQyID0gW107XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogXFxcIuWKquWKm+WKoOi9veS4re+8jOivt+eojeWAmS4uLlxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBpZDogYmlkLFxcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9KVxcbiAgICBzZXRSZXN1bHQoZCk7XFxuXFxuICAgIHRyeSB7XFxuICAgICAgICAvLyDojrflj5bmlofku7bliJfooahcXG4gICAgICAgIHZhciBsaXN0ID0gSlNPTi5wYXJzZShwb3N0KG5vdy51cmwgKyBcXFwiYXBpL2ZzL2xpc3RcXFwiLCB7XFxuICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICBcXFwicGF0aFxcXCI6IHBhdGgsXFxuICAgICAgICAgICAgICAgIFxcXCJwYXNzd29yZFxcXCI6IGFsaXN0W3NlbGVjdGVkXVtcXFwiYnJvd3Nlci1wYXNzd29yZFxcXCJdW3BhdGhdID8gYWxpc3Rbc2VsZWN0ZWRdW1xcXCJicm93c2VyLXBhc3N3b3JkXFxcIl1bcGF0aF0gOiBcXFwiXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcInBhZ2VcXFwiOiBNWV9QQUdFLFxcbiAgICAgICAgICAgICAgICBcXFwicGVyX3BhZ2VcXFwiOiAzMCxcXG4gICAgICAgICAgICAgICAgXFxcInJlZnJlc2hcXFwiOiBmYWxzZVxcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnNcXG4gICAgICAgIH0pKVxcbiAgICAgICAgaWYgKGxpc3QuY29kZSA9PSAyMDAgJiYgbGlzdC5kYXRhLmNvbnRlbnQpIHtcXG4gICAgICAgICAgICBzb3J0cyhsaXN0LmRhdGEuY29udGVudCwgbnNvcnQpXFxuICAgICAgICAgICAgbGlzdC5kYXRhLmNvbnRlbnQuZm9yRWFjaCgoaXRlbSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgdmFyIGRlc2MgPSBmb3JtYXREYXRlKGl0ZW0ubW9kaWZpZWQpICsgXFxcIiBcXFwiICsgZ2V0RmlsZVNpemUoaXRlbS5zaXplKVxcbiAgICAgICAgICAgICAgICB2YXIgZG93bl91cmwgPSBlbmNvZGVVUkkobm93LnVybCArIFxcXCJkXFxcIiArIChwYXRoID09IFxcXCIvXFxcIiA/IFxcXCJcXFwiIDogcGF0aCkgKyBcXFwiL1xcXCIgKyBpdGVtLm5hbWUgKyBcXFwiP3NpZ249XFxcIiArIGl0ZW0uc2lnbilcXG4gICAgICAgICAgICAgICAgdmFyIHVybCA9ICQoKS5sYXp5UnVsZSgoaXRlbSwgdXJsLCBwYXRoLCBsaXN0LCB1KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBjb25zdCB0eXBlX2RpY3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgMDogJC50b1N0cmluZygodXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiZG93bmxvYWQ6Ly9cXFwiICsgdXJsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAyOiAkLnRvU3RyaW5nKCh1cmwsIGxpc3QsIHUsIHBhdGgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHN1YnRpdGxlcyA9ICQucmVxdWlyZShcXFwiYXBpXFxcIikuZ2V0U3VidGl0bGVzKGxpc3QsIHUsIHBhdGgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdWJ0aXRsZXMubGVuZ3RoID4gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG5hbWVsaXN0ID0gc3VidGl0bGVzLm1hcChmdW5jdGlvbihpdGVtKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0ZW0ubmFtZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKG5hbWVsaXN0LCAxLCBcXFwi6K+36YCJ5oup5a2X5bmVXFxcIikuc2VsZWN0KChzdWJ0aXRsZXMsIG5hbWVsaXN0LCB1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmxzOiBbdXJsXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidGl0bGU6IHN1YnRpdGxlc1tuYW1lbGlzdC5pbmRleE9mKGlucHV0KV0udXJsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHN1YnRpdGxlcywgbmFtZWxpc3QsIHVybClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB1cmwsIGxpc3QsIHUsIHBhdGgpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDM6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsICsgXFxcIiNpc011c2ljPXRydWUjXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgNDogJC50b1N0cmluZygodXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiZG93bmxvYWQ6Ly9cXFwiICsgdXJsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICA1OiAkLnRvU3RyaW5nKCh1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArIFxcXCIjLmpwZ1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB1cmwpXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5pc19kaXIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9ob21lP3BhZ2U9ZnlwYWdlXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgkLnJlcXVpcmUoXFxcImFwaVxcXCIpLmdldEh6bShpdGVtLm5hbWUpID09IFxcXCJwZGZcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJodHRwczovL2FsaXN0LW9yZy5naXRodWIuaW8vcGRmLmpzL3dlYi92aWV3ZXIuaHRtbD9maWxlPVxcXCIgKyB1cmxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoJC5vZmZpY2UuaW5jbHVkZXMoJC5yZXF1aXJlKFxcXCJhcGlcXFwiKS5nZXRIem0oaXRlbS5uYW1lKSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChbXFxcIuW+rui9r1xcXCIsIFxcXCLosLfmrYxcXFwiXSkuc2VsZWN0KCh1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IFxcXCLlvq7ova9cXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImh0dHBzOi8vdmlldy5vZmZpY2VhcHBzLmxpdmUuY29tL29wL3ZpZXcuYXNweD9zcmM9XFxcIiArIHVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJodHRwczovL2RvY3MuZ29vZ2xlLmNvbS9ndmlldz8mZW1iZWRkZWQ9dHJ1ZSZ1cmw9XFxcIiArIHVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZXZhbCh0eXBlX2RpY3RbaXRlbS50eXBlXSlcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgZG93bl91cmwsIHBhdGgsIGxpc3QuZGF0YS5jb250ZW50LCBub3cudXJsKVxcbiAgICAgICAgICAgICAgICB2YXIgbG9uZ0NsaWNrID0gW11cXG4gICAgICAgICAgICAgICAgaWYgKCFpdGVtLmlzX2Rpcikge1xcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5LiL6L29XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgdSwgcGF0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImRvd25sb2FkOi8vXFxcIiArIHVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBkb3duX3VybCwgcGF0aClcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIueUqOWFtuS7lui9r+S7tuaJk+W8gFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIHUsIHBhdGgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRGaWxlKHUsIFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL1xcXCIgKyBpdGVtLm5hbWUpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwib3BlbkZpbGU6Ly9cXFwiICsgXFxcImhpa2VyOi8vZmlsZXMvY2FjaGUvXFxcIiArIGl0ZW0ubmFtZVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIGRvd25fdXJsLCBwYXRoKVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAobm93LnVzZXIgJiYgbm93LnBhc3N3b3JkKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2sucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuehruiupOWIoOmZpO+8n1xcXCIpLmNvbmZpcm0oKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcImFwaS9mcy9yZW1vdmVcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpcjogcGF0aCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZXM6IFtpdGVtLm5hbWVdXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzID09IDIwMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yig6Zmk5oiQ5YqfXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yig6Zmk5aSx6LSlXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6YeN5ZG95ZCNXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKGl0ZW0ubmFtZSkuaW5wdXQoKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcImFwaS9mcy9yZW5hbWVcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IHBhdGggKyBcXFwiL1xcXCIgKyBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzID09IDIwMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6YeN5ZG95ZCN5oiQ5YqfXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6YeN5ZG95ZCN5aSx6LSlXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkMi5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogZ2V0SXRlbShcXFwic3R5bGVcXFwiLCBcXFwiYXZhdGFyXFxcIiksXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGdldEljb24oaXRlbSksXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogbG9uZ0NsaWNrLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IChwYXRoID09IFxcXCIvXFxcIiA/IFxcXCIvXFxcIiA6IHBhdGggKyBcXFwiL1xcXCIpICsgaXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBcXFwicGxheWxpc3QgbWFpblxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgaWYgKGdldEl0ZW0oXFxcInN0eWxlXFxcIiwgXFxcImF2YXRhclxcXCIpID09IFxcXCJhdmF0YXJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICBkMi5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYOKAmOKAmOKAmeKAmTxzbWFsbD48Zm9udCBjb2xvcj0nI2FhYWFhYSc+JHtkZXNjfTwvZm9udD48L3NtYWxsPmAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogbG9uZ0NsaWNrLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogKHBhdGggPT0gXFxcIi9cXFwiID8gXFxcIi9cXFwiIDogcGF0aCArIFxcXCIvXFxcIikgKyBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogXFxcInBsYXlsaXN0IGRlc2NcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9IGVsc2UgaWYgKGxpc3QubWVzc2FnZSA9PSBcXFwicGFzc3dvcmQgaXMgaW5jb3JyZWN0IG9yIHlvdSBoYXZlIG5vIHBlcm1pc3Npb25cXFwiKSB7XFxuICAgICAgICAgICAgZDIucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5rWP6KeI5a+G56CB6ZSZ6K+vXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCJcXFwiLCBcXFwi6L6T5YWl5a+G56CBXFxcIikuaW5wdXQoKGFsaXN0LCBzZWxlY3RlZCwgcGF0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgYWxpc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gICByZXR1cm4gXFxcInRvYXN0Oi8v5ZCN56ew5LiN6IO95Li656m6XFxcIlxcbiAgICAgICAgfSBlbHNlIGlmIChzdG9yYWdlMC5nZXRJdGVtKFxcXCJsaXN0XFxcIiwgW10pLm1hcChmdW5jdGlvbihpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBpLm5hbWVcXG4gICAgICAgICAgICB9KS5pbmNsdWRlcyhpbnB1dCkpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey57uP5pyJ55u45ZCM55qE572R56uZ5LqGXFxcIlxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIiwgXFxcIumTvuaOpSDnpLrkvos6aHR0cDovLzEyNy4wLjAuMS9cXFwiKS5pbnB1dCgobmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoIWlucHV0LmluY2x1ZGVzKFxcXCJodHRwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pk77mjqXmoLzlvI/plJnor69cXFwiXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXRbaW5wdXQubGVuZ3RoIC0gMV0gIT0gXFxcIi9cXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQgKz0gXFxcIi9cXFwiXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY29uZmlnID0gSlNPTi5wYXJzZShyZXF1ZXN0KGlucHV0ICsgXFxcImFwaS9wdWJsaWMvc2V0dGluZ3NcXFwiKSkuZGF0YVxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGxpc3QgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXCJsaXN0XFxcIiwgW10pXFxuICAgICAgICAgICAgICAgICAgICBsaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBpbnB1dCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiYnJvd3Nlci1wYXNzd29yZFxcXCI6IHt9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJzZWFyY2hcXFwiOiBjb25maWcuc2VhcmNoX2luZGV4ICYmIGNvbmZpZy5zZWFyY2hfaW5kZXggIT0gXFxcIm5vbmVcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwibGlzdFxcXCIsIGxpc3QpXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbnB1dClcXG4gICAgICAgIH1cXG4gICAgfSksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIlxcbn0sIHtcXG4gICAgdGl0bGU6IFxcXCLliIbkuqtcXFwiLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCIsXFxuICAgIHVybDogJChbXFxcIuS7heWIhuS6q+e9keermVxcXCIsIFxcXCLliIbkuqvnvZHnq5nliqDlr4bnoIFcXFwiXSkuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgIHZhciBsaXN0ID0gc3RvcmFnZTAuZ2V0SXRlbShcXFwibGlzdFxcXCIsIFtdKVxcbiAgICAgICAgaWYgKGlucHV0ID09IFxcXCLku4XliIbkuqvnvZHnq5lcXFwiKSB7XFxuICAgICAgICAgICAgdmFyIGFsaXN0ID0gbGlzdC5tYXAoZnVuY3Rpb24oaXRlbSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBpdGVtLnVybCxcXG4gICAgICAgICAgIC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ICAgdGl0bGU6IGl0ZW0ubmFtZSxcXG4gICAgICAgIGRlc2M6IGl0ZW0udXJsLFxcbiAgICAgICAgdXJsOiAkKFtcXFwi5Yig6ZmkXFxcIiwgXFxcIuaOkuW6j1xcXCIsIFxcXCLkv67mlLnlkI3np7BcXFwiLCBcXFwi5L+u5pS56ZO+5o6lXFxcIiwgXFxcIuS/ruaUuei0puaIt+WvhueggVxcXCJdKS5zZWxlY3QoKGEsIGkpID0+IHtcXG4gICAgICAgICAgICB2YXIgbGlzdCA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcImxpc3RcXFwiLCBbXSlcXG4gICAgICAgICAgICBzd2l0Y2ggKGlucHV0KSB7XFxuICAgICAgICAgICAgICAgIGNhc2UgXFxcIuWIoOmZpFxcXCI6XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu6K6k5Yig6Zmk77yfXFxcIikuY29uZmlybSgobGlzdCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3Quc3BsaWNlKGksIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwibGlzdFxcXCIsIGxpc3QpXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJdGVtKFxcXCJzZWxlY3RlZFxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGlzdCwgaSlcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLkv67mlLnlkI3np7BcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXS5uYW1lKS5pbnB1dCgobGlzdCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5ZCN56ew5LiN6IO95Li656m6XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RvcmFnZTAuZ2V0SXRlbShcXFwibGlzdFxcXCIsIFtdKS5tYXAoZnVuY3Rpb24oaSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkubmFtZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5pbmNsdWRlcyhpbnB1dCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3sue7j+acieebuOWQjOeahOe9keermeS6hlxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldLm5hbWUgPSBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKFxcXCJsaXN0XFxcIiwgbGlzdClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0sIGxpc3QsIGkpXFxuICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLkv67mlLnpk77mjqVcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXS51cmwpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpbnB1dC5pbmNsdWRlcyhcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pk77mjqXmoLzlvI/plJnor69cXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dFtpbnB1dC5sZW5ndGggLSAxXSAhPSBcXFwiL1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+mTvuaOpeagvOW8j+mUmeivr1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldLnVybCA9IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcImxpc3RcXFwiLCBsaXN0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGlzdCwgaSlcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgIGNhc2UgXFxcIuS/ruaUuei0puaIt+WvhueggVxcXCI6XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChsaXN0W2ldW1xcXCJ1c2VyXFxcIl0gPyBsaXN0W2ldW1xcXCJ1c2VyXFxcIl0gOiBcXFwiXFxcIiwgXFxcIui0puWPt1xcXCIpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXVtcXFwicGFzc3dvcmRcXFwiXSA/IGxpc3RbaV1bXFxcInBhc3N3b3JkXFxcIl0gOiBcXFwiXFxcIiwgXFxcIuWvhueggVxcXCIpLmlucHV0KCh1c2VyLCBsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RbaV1bXFxcInVzZXJcXFwiXSA9IHVzZXJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdFtpXVtcXFwicGFzc3dvcmRcXFwiXSA9IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcImxpc3RcXFwiLCBsaXN0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaW5wdXQsIGxpc3QsIGkpXFxuICAgICAgICAgICAgICAgICAgICB9LCBsaXN0LCBpKVxcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLmjpLluo9cXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoaSArIDEgKyBcXFwiXFxcIiwgXFxcIuaLjeWIsOesrOWHoOS4qlxcXCIpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2hlY2tSYXRlKGlucHV0KSB744CA44CAXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZSA9IC9eWzAtOV0rLj9bMC05XSovOyAvL+WIpOaWreWtl+espuS4suaYr+WQpuS4uuaVsOWtly8v5Yik5pat5q2j5pW05pWwL1sx4oiSOV0rWzDiiJI5XeKIl13iiJcvXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIOOAgOOAgFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmUudGVzdChpbnB1dCnjgIDjgIBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoZWNrUmF0ZShpbnB1dCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBwYXJzZUludChpbnB1dCkgLSAxIC8vIOebruagh1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA+IGxpc3QubGVuZ3RoICYmIGEgPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcIuS4jeiDveWkp+S6juWIl+ihqOaVsOmHj++8gVxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGVtcCA9IGxpc3RbYV1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RbYV0gPSBsaXN0W2ldXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldID0gdGVtcFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwibGlzdFxcXCIsIGxpc3QpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi6K+36L6T5YWl5q2j5pW05pWwXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCBsaXN0LCBpKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGl0ZW0sIGkpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiXFxuICAgIH0pXFxufSlcXG5zZXRSZXN1bHQoZCk7XCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLku6PnoIFcIixcInBhdGhcIjpcImFwaVwiLFwicnVsZVwiOlwiJC5leHBvcnRzID0ge1xcbiAgICBjb2xvcjogZnVuY3Rpb24odGV4dCwgY29sb3IpIHtcXG4gICAgICAgIHJldHVybiBg4oCY4oCY4oCZ4oCZPHN0cm9uZz48Zm9udCBjb2xvcj1cXFwiJHtjb2xvcn1cXFwiPiR7dGV4dH08L2Zyb250Pjwvc3Ryb25nPmBcXG4gICAgfSxcXG4gICAgZ2V0SWNvbjogZnVuY3Rpb24oY29udGVudCkge1xcbiAgICAgICAgaWYgKGNvbnRlbnQuaXNfZGlyKSB7XFxuICAgICAgICAgICAgaW1nID0gXFxcImh0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9tb3JlLzI3NC5wbmdcXFwiXFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxldCBmaWxlTmFtZSA9IGNvbnRlbnQubmFtZS50b0xvd2VyQ2FzZSgpXFxuICAgICAgICAgICAgbGV0IGh6bSA9ICQucmVxdWlyZShcXFwiYXBpXFxcIikuZ2V0SHptKGZpbGVOYW1lKVxcbiAgICAgICAgICAgIGlmIChjb250ZW50LnRodW1iICYmIGNvbnRlbnQudHlwZSAhPSAwKSB7XFxuICAgICAgICAgICAgICAgIGltZyA9IGNvbnRlbnQudGh1bWJcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKCQubW92aWUuaW5jbHVkZXMoaHptKSkge1xcbiAgICAgICAgICAgICAgICBpbWcgPSBcXFwiaHR0cHM6Ly9sYW5tZWlndW9qaWFuZy5jb20vdHViaWFvL21vcmUvMzAucG5nXFxcIlxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoJC5hdWRpby5pbmNsdWRlcyhoem0pKSB7XFxuICAgICAgICAgICAgICAgIGltZyA9IFxcXCJodHRwczovL2xhbm1laWd1b2ppYW5nLmNvbS90dWJpYW8vbW9yZS80MC5wbmdcXFwiXFxuICAgICAgICAgICAgfSBlbHNlIGlmICgkLnRleHQuaW5jbHVkZXMoaHptKSkge1xcbiAgICAgICAgICAgICAgICBpbWcgPSBcXFwiaHR0cHM6Ly9sYW5tZWlndW9qaWFuZy5jb20vdHViaWFvL21vcmUvNzgucG5nXFxcIlxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoJC5pbWcuaW5jbHVkZXMoaHptKSkge1xcbiAgICAgICAgICAgICAgICBpbWcgPSBcXFwiaHR0cHM6Ly9sYW5tZWlndW9qaWFuZy5jb20vdHViaWFvL21vcmUvMzgucG5nXFxcIlxcbiAgICAgICAgICAgIH0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ndGg7IGkgPCBsZW47IGkrKykge1xcbiAgICAgICAgICAgIGlmIChzaXplID4gMTAyNCkge1xcbiAgICAgICAgICAgICAgICBzaXplIC89IDEwMjQ7XFxuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBzaXplLnRvRml4ZWQoMikucmVwbGFjZSgvKFxcXFwuMDApJC8sIFxcXCJcXFwiKSArIHVuaXRGb3JtW2ldO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBcXFwiRVJST1I65pWw5YC86L+H5aSnXFxcIjtcXG4gICAgfSxcXG4gICAgZ2V0SHptOiBmdW5jdGlvbihmaWxlTmFtZSkge1xcbiAgICAgICAgcmV0dXJuIGZpbGVOYW1lLnN1YnN0cihmaWxlTmFtZS5sYXN0SW5kZXhPZihcXFwiLlxcXCIpICsgMSlcXG4gICAgfSxcXG4gICAgc29ydHM6IGZ1bmN0aW9uKGxpc3QsIG1ldGhvZCkge1xcbiAgICAgICAgaWYgKG1ldGhvZC5pbmNsdWRlcyhcXFwi5ZCN56ewXFxcIikpIHtcXG4gICAgICAgICAgICBsaXN0LnNvcnQoZnVuY3Rpb24oYSwgYikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYS5uYW1lLmxvY2FsZUNvbXBhcmUoYi5uYW1lKVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9IGVsc2UgaWYgKG1ldGhvZC5pbmNsdWRlcyhcXFwi5pe26Ze0XFxcIikpIHtcXG4gICAgICAgICAgICBsaXN0LnNvcnQoZnVuY3Rpb24oYSwgYikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYS5tb2RpZmllZCAtIGIubW9kaWZpZWRcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSBlbHNlIGlmIChtZXRob2QuaW5jbHVkZXMoXFxcIuWkp+Wwj1xcXCIpKSB7XFxuICAgICAgICAgICAgbGlzdC5zb3J0KGZ1bmN0aW9uKGEsIGIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGEuc2l6ZSAtIGIuc2l6ZVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgICAgICBpZiAobWV0aG9kLmluY2x1ZGVzKFxcXCLlj41cXFwiKSkge1xcbiAgICAgICAgICAgIGxpc3QucmV2ZXJzZSgpO1xcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIGxpc3RcXG4gICAgfSxcXG4gICAgZ2V0U3VidGl0bGVzOiBmdW5jdGlvbihsaXN0LCB1cmwsIHBhdGgpIHtcXG4gICAgICAgIGNvbnN0IHtcXG4gICAgICAgICAgICBnZXRIem1cXG4gICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcImFwaVxcXCIpXFxuICAgICAgICBsZXQgcyA9IFtdXFxuICAgICAgICBsaXN0LmZvckVhY2goaXRlbSA9PiB7XFxuICAgICAgICAgICAgaWYgKCQuc3VidGl0bGUuaW5jbHVkZXMoZ2V0SHptKGl0ZW0ubmFtZSkpKSB7XFxuICAgICAgICAgICAgICAgIHMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lOiBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGVuY29kZVVSSSh1cmwgKyBcXFwiZFxcXCIgKyAocGF0aCA9PSBcXFwiL1xcXCIgPyBcXFwiXFxcIiA6IHBhdGgpICsgXFxcIi9cXFwiICsgaXRlbS5uYW1lICsgXFxcIj9zaWduPVxcXCIgKyBpdGVtLnNpZ24pXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIHMudW5zaGlmdCh7XFxuICAgICAgICAgICAgbmFtZTogXFxcIuS4jemcgOimgeWtl+W5lVxcXCJcXG4gICAgICAgIH0pXFxuICAgICAgICByZXR1cm4gc1xcbiAgICB9XFxufVwifSx7XCJjb2xfdHlwZ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gICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgIFxcXCJwYXJlbnRcXFwiOiBnZXRQYXJhbShcXFwicGF0aFxcXCIpLFxcbiAgICAgICAgICAgICAgICBcXFwia2V5d29yZHNcXFwiOiBnZXRNeVZhcihcXFwia3dcXFwiLCBcXFwiXFxcIiksXFxuICAgICAgICAgICAgICAgIFxcXCJwYWdlXFxcIjogTVlfUEFHRSxcXG4gICAgICAgICAgICAgICAgXFxcInBlcl9wYWdlXFxcIjogMTAwXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0pKVxcbiAgICAgICAgaWYgKGxpc3QuY29kZSA9PSAyMDAgJiYgbGlzdC5kYXRhLmNvbnRlbnQpIHtcXG4gICAgICAgICAgICBsaXN0LmRhdGEuY29udGVudC5mb3JFYWNoKGl0ZW0gPT4ge1xcbiAgICAgICAgICAgICAgICB2YXIgZGVzYyA9IGdldEZpbGVTaXplKGl0ZW0uc2l6ZSlcXG4gICAgICAgICAgICAgICAgdmFyIHVybCA9ICQoKS5sYXp5UnVsZSgoaXRlbSwgdSwgcGF0aCwgaGVhZGVycykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHNpZ24gPSBKU09OLnBhcnNlKHBvc3QodSArIFxcXCJhcGkvZnMvZ2V0XFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwicGF0aFxcXCI6IGl0ZW0ucGFyZW50ICsgXFxcIi9cXFwiICsgaXRlbS5uYW1lXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0pKS5kYXRhLnNpZ25cXG4gICAgICAgICAgICAgICAgICAgIHZhciB1cmwgPSBlbmNvZGVVUkkodSArIFxcXCJkXFxcIiArIGl0ZW0ucGFyZW50ICsgXFxcIi9cXFwiICsgaXRlbS5uYW1lICsgXFxcIj9zaWduPVxcXCIgKyBzaWduKVxcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdHlwZV9kaWN0ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIDA6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImRvd25sb2FkOi8vXFxcIiArIHVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgMjogJC50b1N0cmluZygodXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAzOiAkLnRvU3RyaW5nKCh1cmwpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArIFxcXCIjaXNNdXNpYz10cnVlI1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB1cmwpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDQ6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImRvd25sb2FkOi8vXFxcIiArIHVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgNTogJC50b1N0cmluZygodXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyBcXFwiIy5qcGdcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0uaXNfZGlyKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvaG9tZT9wYWdlPWZ5cGFnZVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoJC5yZXF1aXJlKFxcXCJhcGlcXFwiKS5nZXRIem0oaXRlbS5uYW1lKSA9PSBcXFwicGRmXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaHR0cHM6Ly9hbGlzdC1vcmcuZ2l0aHViLmlvL3BkZi5qcy93ZWIvdmlld2VyLmh0bWw/ZmlsZT1cXFwiICsgdXJsXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCQub2ZmaWNlLmluY2x1ZGVzKCQucmVxdWlyZShcXFwiYXBpXFxcIikuZ2V0SHptKGl0ZW0ubmFtZSkpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoW1xcXCLlvq7ova9cXFwiLCBcXFwi6LC35q2MXFxcIl0pLnNlbGVjdCgodXJsKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwi5b6u6L2vXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJodHRwczovL3ZpZXcub2ZmaWNlYXBwcy5saXZlLmNvbS9vcC92aWV3LmFzcHg/c3JjPVxcXCIgKyB1cmxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaHR0cHM6Ly9kb2NzLmdvb2dsZS5jb20vZ3ZpZXc/JmVtYmVkZGVkPXRydWUmdXJsPVxcXCIgKyB1cmxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybClcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGV2YWwodHlwZV9kaWN0W2l0ZW0udHlwZV0pXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG5vdy51cmwsIHBhdGgsIGhlYWRlcnMpXFxuICAgICAgICAgICAgICAgIHZhciBsb25nQ2xpY2sgPSBbXVxcbiAgICAgICAgICAgICAgICBpZiAoIWl0ZW0uaXNfZGlyKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2sucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLkuIvovb1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtLCB1LCBwYXRoLCBoZWFkZXJzKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiZG93bmxvYWQ6Ly9cXFwiICsgZW5jb2RlVVJJKHUgKyBcXFwiZFxcXCIgKyBpdGVtLnBhcmVudCArIFxcXCIvXFxcIiArIGl0ZW0ubmFtZSArIFxcXCI/c2lnbj1cXFwiICsgSlNPTi5wYXJzZShwb3N0KHUgKyBcXFwiYXBpL2ZzL2dldFxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcInBhdGhcXFwiOiBpdGVtLnBhcmVudCArIFxcXCIvXFxcIiArIGl0ZW0ubmFtZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLmRhdGEuc2lnbilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBub3cudXJsLCBwYXRoLCBoZWFkZXJzKVxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi55So5YW25LuW6L2v5Lu25omT5byAXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgdSwgcGF0aCwgaGVhZGVycykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc2lnbiA9IEpTT04ucGFyc2UocG9zdCh1ICsgXFxcImFwaS9mcy9nZXRcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJwYXRoXFxcIjogaXRlbS5wYXJlbnQgKyBcXFwiL1xcXCIgKyBpdGVtLm5hbWVcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5kYXRhLnNpZ25cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRGaWxlKGVuY29kZVVSSSh1ICsgXFxcImRcXFwiICsgaXRlbS5wYXJlbnQgKyBcXFwiL1xcXCIgKyBpdGVtLm5hbWUgKyBcXFwiP3NpZ249XFxcIiArIHNpZ24pLCBcXFwiaGlrZXI6Ly9maWxlcy9jYWNoZS9cXFwiICsgaXRlbS5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcIm9wZW5GaWxlOi8vXFxcIiArIFxcXCJoaWtlcjovL2ZpbGVzL2NhY2hlL1xcXCIgKyBpdGVtLm5hbWVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBub3cudXJsLCBwYXRoLCBoZWFkZXJzKVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZiAobm93LnVzZXIgJiYgbm93LnBhc3N3b3JkKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2sucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLliKDpmaRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuehruiupOWIoOmZpO+8n1xcXCIpLmNvbmZpcm0oKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcImFwaS9mcy9yZW1vdmVcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpcjogaXRlbS5wYXJlbnQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbaXRlbS5uYW1lXVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkuY29kZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlcyA9PSAyMDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIoOmZpOaIkOWKn1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIoOmZpOWksei0pVxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdylcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIumHjeWRveWQjVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChpdGVtLm5hbWUpLmlucHV0KChpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZXMgPSBKU09OLnBhcnNlKHBvc3Qobm93LnVybCArIFxcXCJhcGkvZnMvcmVuYW1lXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhcmVudCArIFxcXCIvXFxcIiArIGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogaW5wdXRcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLmNvZGVcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXMgPT0gMjAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mk43kvZzmiJDlip9cXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mk43kvZzlpLHotKVcXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdylcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5uYW1lLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IGdldEl0ZW0oXFxcInN0eWxlXFxcIiwgXFxcImF2YXRhclxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgaW1nOiBnZXRJY29uKGl0ZW0pLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IGxvbmdDbGljayxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhcmVudCArIFxcXCIvXFxcIiArIGl0ZW0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGl0ZW0ubmFtZVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0SXRlbShcXFwic3R5bGVcXFwiLCBcXFwiYXZhdGFyXFxcIikgPT0gXFxcImF2YXRhclxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGDigJjigJjigJnigJk8c21hbGw+PGZvbnQgY29sb3I9JyNhYWFhYWEnPiR7ZGVzY308L2ZvbnQ+PC9zbWFsbD5gLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IGxvbmdDbGljayxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogaXRlbS5wYXJlbnQgKyBcXFwiL1xcXCIgKyBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXRlbS5uYW1lXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9IGVsc2UgaWYgKGxpc3QuY29kZSAhPSAyMDApIHtcXG4gICAgICAgICAgICB0b2FzdChcXFwi5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FxuICAgICAgICBpZiAoaW5wdXQgPT0gXFxcIlxcXCIpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5ZCN56ew5LiN6IO95Li656m6XFxcIlxcbiAgICAgICAgfSBlbHNlIGlmIChzdG9yYWdlMC5nZXRJdGVtKFxcXCJsaXN0XFxcIiwgW10pLm1hcChmdW5jdGlvbihpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBpLm5hbWVcXG4gICAgICAgICAgICB9KS5pbmNsdWRlcyhpbnB1dCkpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey57uP5pyJ55u45ZCM55qE572R56uZ5LqGXFxcIlxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIiwgXFxcIumTvuaOpSDnpLrkvos6aHR0cDovLzEyNy4wLjAuMS9cXFwiKS5pbnB1dCgobmFtZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBpZiAoIWlucHV0LmluY2x1ZGVzKFxcXCJodHRwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pk77mjqXmoLzlvI/plJnor69cXFwiXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXRbaW5wdXQubGVuZ3RoIC0gMV0gIT0gXFxcIi9cXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaW5wdXQgKz0gXFxcIi9cXFwiXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY29uZmlnID0gSlNPTi5wYXJzZShyZXF1ZXN0KGlucHV0ICsgXFxcImFwaS9wdWJsaWMvc2V0dGluZ3NcXFwiKSkuZGF0YVxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGxpc3QgPSBzdG9yYWdlMC5nZXRJdGVtKFxcXCJsaXN0XFxcIiwgW10pXFxuICAgICAgICAgICAgICAgICAgICBsaXN0LnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IG5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBpbnB1dCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwiYnJvd3Nlci1wYXNzd29yZFxcXCI6IHt9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJzZWFyY2hcXFwiOiBjb25maWcuc2VhcmNoX2luZGV4ICYmIGNvbmZpZy5zZWFyY2hfaW5kZXggIT0gXFxcIm5vbmVcXFwiXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwibGlzdFxcXCIsIGxpc3QpXFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbnB1dClcXG4gICAgICAgIH1cXG4gICAgfSksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIlxcbn0sIHtcXG4gICAgdGl0bGU6IFxcXCLliIbkuqtcXFwiLFxcbiAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCIsXFxuICAgIHVybDogJChbXFxcIuS7heWIhuS6q+e9keermVxcXCIsIFxcXCLliIbkuqvnvZHnq5nliqDlr4bnoIFcXFwiXSkuc2VsZWN0KCgpID0+IHtcXG4gICAgICAgIHZhciBsaXN0ID0gc3RvcmFnZTAuZ2V0SXRlbShcXFwibGlzdFxcXCIsIFtdKVxcbiAgICAgICAgaWYgKGlucHV0ID09IFxcXCLku4XliIbkuqvnvZHnq5lcXFwiKSB7XFxuICAgICAgICAgICAgdmFyIGFsaXN0ID0gbGlzdC5tYXAoZnVuY3Rpb24oaXRlbSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgbmFtZTogaXRlbS5uYW1lLFx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m9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcbiAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6IGl0ZW0ubmFtZSxcXG4gICAgICAgIGRlc2M6IGl0ZW0udXJsLFxcbiAgICAgICAgdXJsOiAkKFtcXFwi5Yig6ZmkXFxcIiwgXFxcIuaOkuW6j1xcXCIsIFxcXCLkv67mlLnlkI3np7BcXFwiLCBcXFwi5L+u5pS56ZO+5o6lXFxcIiwgXFxcIuS/ruaUuei0puaIt+WvhueggVxcXCJdKS5zZWxlY3QoKGEsIGkpID0+IHtcXG4gICAgICAgICAgICB2YXIgbGlzdCA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcImxpc3RcXFwiLCBbXSlcXG4gICAgICAgICAgICBzd2l0Y2ggKGlucHV0KSB7XFxuICAgICAgICAgICAgICAgIGNhc2UgXFxcIuWIoOmZpFxcXCI6XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi56Gu6K6k5Yig6Zmk77yfXFxcIikuY29uZmlybSgobGlzdCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3Quc3BsaWNlKGksIDEpXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwibGlzdFxcXCIsIGxpc3QpXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJdGVtKFxcXCJzZWxlY3RlZFxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGlzdCwgaSlcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLkv67mlLnlkI3np7BcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXS5uYW1lKS5pbnB1dCgobGlzdCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5ZCN56ew5LiN6IO95Li656m6XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoc3RvcmFnZTAuZ2V0SXRlbShcXFwibGlzdFxcXCIsIFtdKS5tYXAoZnVuY3Rpb24oaSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGkubmFtZVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KS5pbmNsdWRlcyhpbnB1dCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3sue7j+acieebuOWQjOeahOe9keermeS6hlxcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldLm5hbWUgPSBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKFxcXCJsaXN0XFxcIiwgbGlzdClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0sIGxpc3QsIGkpXFxuICAgICAgICAgICAgICAgICAgICBicmVha1xcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLkv67mlLnpk77mjqVcXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXS51cmwpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCFpbnB1dC5pbmNsdWRlcyhcXFwiaHR0cFxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/pk77mjqXmoLzlvI/plJnor69cXFwiXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dFtpbnB1dC5sZW5ndGggLSAxXSAhPSBcXFwiL1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+mTvuaOpeagvOW8j+mUmeivr1xcXCJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldLnVybCA9IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcImxpc3RcXFwiLCBsaXN0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGlzdCwgaSlcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrXFxuICAgICAgICAgICAgICAgIGNhc2UgXFxcIuS/ruaUuei0puaIt+WvhueggVxcXCI6XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChsaXN0W2ldW1xcXCJ1c2VyXFxcIl0gPyBsaXN0W2ldW1xcXCJ1c2VyXFxcIl0gOiBcXFwiXFxcIiwgXFxcIui0puWPt1xcXCIpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXVtcXFwicGFzc3dvcmRcXFwiXSA/IGxpc3RbaV1bXFxcInBhc3N3b3JkXFxcIl0gOiBcXFwiXFxcIiwgXFxcIuWvhueggVxcXCIpLmlucHV0KCh1c2VyLCBsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RbaV1bXFxcInVzZXJcXFwiXSA9IHVzZXJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdFtpXVtcXFwicGFzc3dvcmRcXFwiXSA9IGlucHV0XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcImxpc3RcXFwiLCBsaXN0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaW5wdXQsIGxpc3QsIGkpXFxuICAgICAgICAgICAgICAgICAgICB9LCBsaXN0LCBpKVxcbiAgICAgICAgICAgICAgICBjYXNlIFxcXCLmjpLluo9cXFwiOlxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoaSArIDEgKyBcXFwiXFxcIiwgXFxcIuaLjeWIsOesrOWHoOS4qlxcXCIpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZnVuY3Rpb24gY2hlY2tSYXRlKGlucHV0KSB744CA44CAXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZSA9IC9eWzAtOV0rLj9bMC05XSovOyAvL+WIpOaWreWtl+espuS4suaYr+WQpuS4uuaVsOWtly8v5Yik5pat5q2j5pW05pWwL1sx4oiSOV0rWzDiiJI5XeKIl13iiJcvXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIOOAgOOAgFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gcmUudGVzdChpbnB1dCnjgIDjgIBcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoZWNrUmF0ZShpbnB1dCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGEgPSBwYXJzZUludChpbnB1dCkgLSAxIC8vIOebruagh1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoYSA+IGxpc3QubGVuZ3RoICYmIGEgPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcIuS4jeiDveWkp+S6juWIl+ihqOaVsOmHj++8gVxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGVtcCA9IGxpc3RbYV1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RbYV0gPSBsaXN0W2ldXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldID0gdGVtcFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFwibGlzdFxcXCIsIGxpc3QpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi6K+36L6T5YWl5q2j5pW05pWwXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9LCBsaXN0LCBpKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGl0ZW0sIGkpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiXFxuICAgIH0pXFxufSlcXG5zZXRSZXN1bHQoZCk7XCIsXCJncm91cFwiOlwi4pGg572R55uYXCIsXCJ1YVwiOlwibW9iaWxlXCIsXCJwcmVSdWxlXCI6XCIkLmV4dGVuZCh7XFxuICAgIHRleHQ6IFtcXFwiaHRtXFxcIiwgXFxcImh0bWxcXFwiLCBcXFwieG1sXFxcIiwgXFxcImphdmFcXFwiLCBcXFwicHJvcGVydGllc1xcXCIsIFxcXCJzcWxcXFwiLCBcXFwianNcXFwiLCBcXFwibWRcXFwiLCBcXFwianNvblxcXCIsIFxcXCJjb25mXFxcIiwgXFxcImluaVxcXCIsIFxcXC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xuICAgICAgICAgICAgYWxpc3QuZm9yRWFjaCgoaXRlbSwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpID09IHNlbGVjdGVkID8gJC5yZXF1aXJlKFxcXFxcXFwiYXBpXFxcXFxcXCIpLmNvbG9yKGl0ZW0ubmFtZSwgXFxcXFxcXCJyZWRcXFxcXFxcIikgOiBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInNjcm9sbF9idXR0b25cXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBpID09IHNlbGVjdGVkID8gXFxcXFxcXCJ4NTovL1xcXFxcXFwiICsgbm93LnVybCA6ICQoKS5sYXp5UnVsZSgoaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInNlbGVjdGVkXFxcXFxcXCIsIGkgKyBcXFxcXFxcIlxcXFxcXFwiKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIGkpXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFxcXFxcImJsYW5rX2Jsb2NrXFxcXFxcXCJcXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgaWYgKG5vdy5zZWFyY2gpIHtcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi8J+UjiDmkJzntKJcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFxcXFxcImhpa2VyOi8vcGFnZS9zZWFyY2g/cGFnZT1meXBhZ2UmdT1cXFxcXFxcIiArIG5vdy51cmwgKyBcXFxcXFxcIiZwYXRoPVxcXFxcXFwiICsgcGF0aCxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcXFxuICAgICAgICAgICAgICAgICAgICBub3c6IG5vd1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgaWYgKG5vdy51c2VyICYmIG5vdy5wYXNzd29yZCkge1xcXFxuICAgICAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmlrDlu7rmlofku7blpLlcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiXFxcXFxcXCIpLmlucHV0KChwYXRoLCBub3csIGhlYWRlcnMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcXFxcXCJhcGkvZnMvbWtkaXJcXFxcXFxcIiwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IHBhdGggKyBcXFxcXFxcIi9cXFxcXFxcIiArIGlucHV0XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnNcXFxcbiAgICAgICAgICAgICAgICAgICAgfSkpLmNvZGVcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcyA9PSAyMDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5Yib5bu65oiQ5YqfXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5Yib5bu65aSx6LSlXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0sIHBhdGgsIG5vdywgaGVhZGVycylcXFxcbiAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmlrDlu7rmlofku7ZcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiXFxcXFxcXCIpLmlucHV0KChwYXRoLCBub3csIGhlYWRlcnMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyc1tcXFxcXFxcIkZpbGUtUGF0aFxcXFxcXFwiXSA9IGVuY29kZVVSSShwYXRoICsgXFxcXFxcXCIvXFxcXFxcXCIgKyBpbnB1dClcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocmVxdWVzdChub3cudXJsICsgXFxcXFxcXCJhcGkvZnMvcHV0XFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IFxcXFxcXFwiXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBcXFxcXFxcIlBVVFxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXMgPT0gMjAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WIm+W7uuaIkOWKn1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WIm+W7uuWksei0pVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9LCBwYXRoLCBub3csIGhlYWRlcnMpXFxcXG4gICAgICAgICAgICB9LCB7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5re75YqgYXJpYTLku7vliqFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXFxcXFwiXFxcXFxcXCIsIFxcXFxcXFwi5aSa5p2h55So5Zue6L2m6ZqU5byAXFxcXFxcXCIpLmlucHV0KChwYXRoLCBub3csIGhlYWRlcnMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcXFxcXCJhcGkvZnMvYWRkX2FyaWEyXFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBwYXRoLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybHM6IGlucHV0LnNwbGl0KFxcXFxcXFwiXFxcXFxcXFxuXFxcXFxcXCIpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnNcXFxcbiAgICAgICAgICAgICAgICAgICAgfSkpLmNvZGVcXFxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJlcyA9PSAyMDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5Yib5bu65oiQ5YqfXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v5Yib5bu65aSx6LSlXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0sIHBhdGgsIG5vdywgaGVhZGVycylcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcblxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwibGluZV9ibGFua1xcXFxcXFwiXFxcXG4gICAgICAgIH0pXFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJiaWdfYmxhbmtfYmxvY2tcXFxcXFxcIlxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiYmlnX2JsYW5rX2Jsb2NrXFxcXFxcXC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XG4gICAgICAgICAgICAgICAgdmFyIHVybCA9ICQoKS5sYXp5UnVsZSgoaXRlbSwgdXJsLCBwYXRoLCBsaXN0LCB1KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHR5cGVfZGljdCA9IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDA6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImRvd25sb2FkOi8vXFxcXFxcXCIgKyB1cmxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybCksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAyOiAkLnRvU3RyaW5nKCh1cmwsIGxpc3QsIHUsIHBhdGgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc3VidGl0bGVzID0gJC5yZXF1aXJlKFxcXFxcXFwiYXBpXFxcXFxcXCIpLmdldFN1YnRpdGxlcyhsaXN0LCB1LCBwYXRoKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzdWJ0aXRsZXMubGVuZ3RoID4gMSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgbmFtZWxpc3QgPSBzdWJ0aXRsZXMubWFwKGZ1bmN0aW9uKGl0ZW0pIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpdGVtLm5hbWVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobmFtZWxpc3QsIDEsIFxcXFxcXFwi6K+36YCJ5oup5a2X5bmVXFxcXFxcXCIpLnNlbGVjdCgoc3VidGl0bGVzLCBuYW1lbGlzdCwgdXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybHM6IFt1cmxdLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRpdGxlOiBzdWJ0aXRsZXNbbmFtZWxpc3QuaW5kZXhPZihpbnB1dCldLnVybFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgc3VidGl0bGVzLCBuYW1lbGlzdCwgdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyBcXFxcXFxcIiNpc1ZpZGVvPXRydWUjXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB1cmwsIGxpc3QsIHUsIHBhdGgpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgMzogJC50b1N0cmluZygodXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHVybCArIFxcXFxcXFwiI2lzTXVzaWM9dHJ1ZSNcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDQ6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImRvd25sb2FkOi8vXFxcXFxcXCIgKyB1cmxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybCksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICA1OiAkLnRvU3RyaW5nKCh1cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC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iArIHVybFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImh0dHBzOi8vZG9jcy5nb29nbGUuY29tL2d2aWV3PyZlbWJlZGRlZD10cnVlJnVybD1cXFxcXFxcIiArIHVybFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybClcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBldmFsKHR5cGVfZGljdFtpdGVtLnR5cGVdKVxcXFxuICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgZG93bl91cmwsIHBhdGgsIGxpc3QuZGF0YS5jb250ZW50LCBub3cudXJsKVxcXFxuICAgICAgICAgICAgICAgIHZhciBsb25nQ2xpY2sgPSBbXVxcXFxuICAgICAgICAgICAgICAgIGlmICghaXRlbS5pc19kaXIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5LiL6L29XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgdSwgcGF0aCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImRvd25sb2FkOi8vXFxcXFxcXCIgKyB1XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBkb3duX3VybCwgcGF0aClcXFxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi55So5YW25LuW6L2v5Lu25omT5byAXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgdSwgcGF0aCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvd25sb2FkRmlsZSh1LCBcXFxcXFxcImhpa2VyOi8vZmlsZXMvY2FjaGUvXFxcXFxcXCIgKyBpdGVtLm5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwib3BlbkZpbGU6Ly9cXFxcXFxcIiArIFxcXFxcXFwiaGlrZXI6Ly9maWxlcy9jYWNoZS9cXFxcXFxcIiArIGl0ZW0ubmFtZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgZG93bl91cmwsIHBhdGgpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGlmIChub3cudXNlciAmJiBub3cucGFzc3dvcmQpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5Yig6ZmkXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcXFxcXCLnoa7orqTliKDpmaTvvJ9cXFxcXFxcIikuY29uZmlybSgoaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciByZXMgPSBKU09OLnBhcnNlKHBvc3Qobm93LnVybCArIFxcXFxcXFwiYXBpL2ZzL3JlbW92ZVxcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpcjogcGF0aCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lczogW2l0ZW0ubmFtZV1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXMgPT0gMjAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WIoOmZpOaIkOWKn1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WIoOmZpOWksei0pVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIumHjeWRveWQjVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKGl0ZW0ubmFtZSkuaW5wdXQoKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzID0gSlNPTi5wYXJzZShwb3N0KG5vdy51cmwgKyBcXFxcXFxcImFwaS9mcy9yZW5hbWVcXFxcXFxcIiwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBwYXRoICsgXFxcXFxcXCIvXFxcXFxcXCIgKyBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogaW5wdXRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXMgPT0gMjAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+mHjeWRveWQjeaIkOWKn1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+mHjeWRveWQjeWksei0pVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIGQyLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogZ2V0SXRlbShcXFxcXFxcInN0eWxlXFxcXFxcXCIsIFxcXFxcXFwiYXZhdGFyXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGdldEljb24oaXRlbSksXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBsb25nQ2xpY2ssXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGl0ZW0ubmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdGg6IChwYXRoID09IFxcXFxcXFwiL1xcXFxcXFwiID8gXFxcXFxcXCIvXFxcXFxcXCIgOiBwYXRoICsgXFxcXFxcXCIvXFxcXFxcXCIpICsgaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0ubmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsczogXFxcXFxcXCJwbGF5bGlzdCBtYWluXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldEl0ZW0oXFxcXFxcXCJzdHlsZVxcXFxcXFwiLCBcXFxcXFxcImF2YXRhclxcXFxcXFwiKSA9PSBcXFxcXFxcImF2YXRhclxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGQyLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGDigJjigJjigJnigJk8c21hbGw+PGZvbnQgY29sb3I9JyNhYWFhYWEnPiR7ZGVzY308L2ZvbnQ+PC9zbWFsbD5gLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF8xXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBsb25nQ2xpY2ssXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0aDogKHBhdGggPT0gXFxcXFxcXCIvXFxcXFxcXCIgPyBcXFxcXFxcIi9cXFxcXFxcIiA6IHBhdGggKyBcXFxcXFxcIi9cXFxcXFxcIikgKyBpdGVtLm5hbWUsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBcXFxcXFxcInBsYXlsaXN0IGRlc2NcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH0gZWxzZSBpZiAobGlzdC5tZXNzYWdlID09IFxcXFxcXFwicGFzc3dvcmQgaXMgaW5jb3J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0XFxcXFxcXCIsIFtdKVxcXFxuICAgICAgICAgICAgICAgICAgICBsaXN0LnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogbmFtZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaW5wdXQsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcImJyb3dzZXItcGFzc3dvcmRcXFxcXFxcIjoge30sXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInNlYXJjaFxcXFxcXFwiOiBjb25maWcuc2VhcmNoX2luZGV4ICYmIGNvbmZpZy5zZWFyY2hfaW5kZXggIT0gXFxcXFxcXCJub25lXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFxcXFxcImxpc3RcXFxcXFxcIiwgbGlzdClcXFxcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0sIGlucHV0KVxcXFxuICAgICAgICB9XFxcXG4gICAgfSksXFxcXG4gICAgY29sX3R5cGU6IFxcXFxcXFwidGV4dF8yXFxcXFxcXCJcXFxcbn0sIHtcXFxcbiAgICB0aXRsZTogXFxcXFxcXCLliIbkuqtcXFxcXFxcIixcXFxcbiAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0XzJcXFxcXFxcIixcXFxcbiAgICB1cmw6ICQoW1xcXFxcXFwi5LuF5YiG5Lqr572R56uZXFxcXFxcXCIsIFxcXFxcXFwi5YiG5Lqr572R56uZ5Yqg5a+G56CBXFxcXFxcXCJdKS5zZWxlY3QoKCkgPT4ge1xcXFxuICAgICAgICB2YXIgbGlzdCA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcXFxcXCJsaXN0XFxcXFxcXCIsIFtdKVxcXFxuICAgICAgICBpZiAoaW5wdXQ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gICAgICAgICAgICAgICAgICBsaXN0LnNwbGljZShpLCAxKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFxcXFxcImxpc3RcXFxcXFxcIiwgbGlzdClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFySXRlbShcXFxcXFxcInNlbGVjdGVkXFxcXFxcXCIpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIGxpc3QsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgIGNhc2UgXFxcXFxcXCLkv67mlLnlkI3np7BcXFxcXFxcIjpcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXS5uYW1lKS5pbnB1dCgobGlzdCwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGlucHV0ID09IFxcXFxcXFwiXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WQjeensOS4jeiDveS4uuepulxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHN0b3JhZ2UwLmdldEl0ZW0oXFxcXFxcXCJsaXN0XFxcXFxcXCIsIFtdKS5tYXAoZnVuY3Rpb24oaSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gaS5uYW1lXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkuaW5jbHVkZXMoaW5wdXQpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/lt7Lnu4/mnInnm7jlkIznmoTnvZHnq5nkuoZcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldLm5hbWUgPSBpbnB1dFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcXFxcXCJsaXN0XFxcXFxcXCIsIGxpc3QpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICB9LCBsaXN0LCBpKVxcXFxuICAgICAgICAgICAgICAgICAgICBicmVha1xcXFxuICAgICAgICAgICAgICAgIGNhc2UgXFxcXFxcXCLkv67mlLnpk77mjqVcXFxcXFxcIjpcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXS51cmwpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWlucHV0LmluY2x1ZGVzKFxcXFxcXFwiaHR0cFxcXFxcXFwiKSkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6ZO+5o6l5qC85byP6ZSZ6K+vXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXRbaW5wdXQubGVuZ3RoIC0gMV0gIT0gXFxcXFxcXCIvXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+mTvuaOpeagvOW8j+mUmeivr1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpc3RbaV0udXJsID0gaW5wdXRcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKFxcXFxcXFwibGlzdFxcXFxcXFwiLCBsaXN0KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGlzdCwgaSlcXFxcbiAgICAgICAgICAgICAgICAgICAgYnJlYWtcXFxcbiAgICAgICAgICAgICAgICBjYXNlIFxcXFxcXFwi5L+u5pS56LSm5oi35a+G56CBXFxcXFxcXCI6XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKGxpc3RbaV1bXFxcXFxcXCJ1c2VyXFxcXFxcXCJdID8gbGlzdFtpXVtcXFxcXFxcInVzZXJcXFxcXFxcIl0gOiBcXFxcXFxcIlxcXFxcXFwiLCBcXFxcXFxcIui0puWPt1xcXFxcXFwiKS5pbnB1dCgobGlzdCwgaSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQobGlzdFtpXVtcXFxcXFxcInBhc3N3b3JkXFxcXFxcXCJdID8gbGlzdFtpXVtcXFxcXFxcInBhc3N3b3JkXFxcXFxcXCJdIDogXFxcXFxcXCJcXFxcXFxcIiwgXFxcXFxcXCLlr4bnoIFcXFxcXFxcIikuaW5wdXQoKHVzZXIsIGxpc3QsIGkpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldW1xcXFxcXFwidXNlclxcXFxcXFwiXSA9IHVzZXJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsaXN0W2ldW1xcXFxcXFwicGFzc3dvcmRcXFxcXFxcIl0gPSBpbnB1dFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcXFxcXCJsaXN0XFxcXFxcXCIsIGxpc3QpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaW5wdXQsIGxpc3QsIGkpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIGxpc3QsIGkpXFxcXG4gICAgICAgICAgICAgICAgY2FzZSBcXFxcXFxcIuaOkuW6j1xcXFxcXFwiOlxcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChpICsgMSArIFxcXFxcXFwiXFxcXFxcXCIsIFxcXFxcXFwi5ouN5Yiw56ys5Yeg5LiqXFxcXFxcXCIpLmlucHV0KChsaXN0LCBpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBjaGVja1JhdGUoaW5wdXQpIHvjgIDjgIBcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSAvXlswLTldKy4/WzAtOV0qLzsgLy/liKTmlq3lrZfnrKbkuLLmmK/lkKbkuLrmlbDlrZcvL+WIpOaWreato+aVtOaVsC9bMeKIkjldK1sw4oiSOV3iiJdd4oiXL1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIOOAgOOAgFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZS50ZXN0KGlucHV0KeOAgOOAgFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGNoZWNrUmF0ZShpbnB1dCkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgYSA9IHBhcnNlSW50KGlucHV0KSAtIDEgLy8g55uu5qCHXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGEgPiBsaXN0Lmxlbmd0aCAmJiBhID09IDApIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcXFxcXCLkuI3og73lpKfkuo7liJfooajmlbDph4/vvIFcXFxcXFxcIilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGVtcCA9IGxpc3RbYV1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdFthXSA9IGxpc3RbaV1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlzdFtpXSA9IHRlbXBcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShcXFxcXFxcImxpc3RcXFxcXFxcIiwgbGlzdClcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcXFxcXCLor7fovpPlhaXmraPmlbTmlbBcXFxcXFxcIilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgfSwgbGlzdCwgaSlcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSwgaXRlbSwgaSksXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfMVxcXFxcXFwiXFxcXG4gICAgfSlcXFxcbn0pXFxcXG5zZXRSZXN1bHQoZCk7XFxcIn0se1xcXCJjb2xfdHlwZVxcXCI6XFxcIm1vdmllXzNcXFwiLFxcXCJuYW1lXFxcIjpcXFwi5Luj56CBXFxcIixcXFwicGF0aFxcXCI6XFxcImFwaVxcXCIsXFxcInJ1bGVcXFwiOlxcXCIkLmV4cG9ydHMgPSB7XFxcXG4gICAgY29sb3I6IGZ1bmN0aW9uKHRleHQsIGNvbG9yKSB7XFxcXG4gICAgICAgIHJldHVybiBg4oCY4oCY4oCZ4oCZPHN0cm9uZz48Zm9udCBjb2xvcj1cXFxcXFxcIiR7Y29sb3J9XFxcXFxc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nkoe1xcXFxuICAgICAgICAgICAgICAgIFxcXFxcXFwicGFyZW50XFxcXFxcXCI6IGdldFBhcmFtKFxcXFxcXFwicGF0aFxcXFxcXFwiKSxcXFxcbiAgICAgICAgICAgICAgICBcXFxcXFxcImtleXdvcmRzXFxcXFxcXCI6IGdldE15VmFyKFxcXFxcXFwia3dcXFxcXFxcIiwgXFxcXFxcXCJcXFxcXFxcIiksXFxcXG4gICAgICAgICAgICAgICAgXFxcXFxcXCJwYWdlXFxcXFxcXCI6IE1ZX1BBR0UsXFxcXG4gICAgICAgICAgICAgICAgXFxcXFxcXCJwZXJfcGFnZVxcXFxcXFwiOiAxMDBcXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH0pKVxcXFxuICAgICAgICBpZiAobGlzdC5jb2RlID09IDIwMCAmJiBsaXN0LmRhdGEuY29udGVudCkge1xcXFxuICAgICAgICAgICAgbGlzdC5kYXRhLmNvbnRlbnQuZm9yRWFjaChpdGVtID0+IHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgZGVzYyA9IGdldEZpbGVTaXplKGl0ZW0uc2l6ZSlcXFxcbiAgICAgICAgICAgICAgICB2YXIgdXJsID0gJCgpLmxhenlSdWxlKChpdGVtLCB1LCBwYXRoLCBoZWFkZXJzKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciBzaWduID0gSlNPTi5wYXJzZShwb3N0KHUgKyBcXFxcXFxcImFwaS9mcy9nZXRcXFxcXFxcIiwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFxcXFxcInBhdGhcXFxcXFxcIjogaXRlbS5wYXJlbnQgKyBcXFxcXFxcIi9cXFxcXFxcIiArIGl0ZW0ubmFtZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSkpLmRhdGEuc2lnblxcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgdXJsID0gZW5jb2RlVVJJKHUgKyBcXFxcXFxcImRcXFxcXFxcIiArIGl0ZW0ucGFyZW50ICsgXFxcXFxcXCIvXFxcXFxcXCIgKyBpdGVtLm5hbWUgKyBcXFxcXFxcIj9zaWduPVxcXFxcXFwiICsgc2lnbilcXFxcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgdHlwZV9kaWN0ID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgMDogJC50b1N0cmluZygodXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiZG93bmxvYWQ6Ly9cXFxcXFxcIiArIHVybFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDI6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyBcXFxcXFxcIiNpc1ZpZGVvPXRydWUjXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybCksXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAzOiAkLnRvU3RyaW5nKCh1cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsICsgXFxcXFxcXCIjaXNNdXNpYz10cnVlI1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB1cmwpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgNDogJC50b1N0cmluZygodXJsKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiZG93bmxvYWQ6Ly9cXFxcXFxcIiArIHVybFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIDU6ICQudG9TdHJpbmcoKHVybCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmwgKyBcXFxcXFxcIiMuanBnXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHVybClcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5pc19kaXIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vcGFnZS9ob21lP3BhZ2U9ZnlwYWdlXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICgkLnJlcXVpcmUoXFxcXFxcXCJhcGlcXFxcXFxcIikuZ2V0SHptKGl0ZW0ubmFtZSkgPT0gXFxcXFxcXCJwZGZcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaHR0cHM6Ly9hbGlzdC1vcmcuZ2l0aHViLmlvL3BkZi5qcy93ZWIvdmlld2VyLmh0bWw/ZmlsZT1cXFxcXFxcIiArIHVybFxcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCQub2ZmaWNlLmluY2x1ZGVzKCQucmVxdWlyZShcXFxcXFxcImFwaVxcXFxcXFwiKS5nZXRIem0oaXRlbS5uYW1lKSkpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFtcXFxcXFxcIuW+rui9r1xcXFxcXFwiLCBcXFxcXFxcIuiwt+atjFxcXFxcXFwiXSkuc2VsZWN0KCh1cmwpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gXFxcXFxcXCLlvq7ova9cXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJodHRwczovL3ZpZXcub2ZmaWNlYXBwcy5saXZlLmNvbS9vcC92aWV3LmFzcHg/c3JjPVxcXFxcXFwiICsgdXJsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaHR0cHM6Ly9kb2NzLmdvb2dsZS5jb20vZ3ZpZXc/JmVtYmVkZGVkPXRydWUmdXJsPVxcXFxcXFwiICsgdXJsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgdXJsKVxcXFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGV2YWwodHlwZV9kaWN0W2l0ZW0udHlwZV0pXFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLCBub3cudXJsLCBwYXRoLCBoZWFkZXJzKVxcXFxuICAgICAgICAgICAgICAgIHZhciBsb25nQ2xpY2sgPSBbXVxcXFxuICAgICAgICAgICAgICAgIGlmICghaXRlbS5pc19kaXIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXFxcXFwi5LiL6L29XFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoaXRlbSwgdSwgcGF0aCwgaGVhZGVycykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImRvd25sb2FkOi8vXFxcXFxcXCIgKyBlbmNvZGVVUkkodSArIFxcXFxcXFwiZFxcXFxcXFwiICsgaXRlbS5wYXJlbnQgKyBcXFxcXFxcIi9cXFxcXFxcIiArIGl0ZW0ubmFtZSArIFxcXFxcXFwiP3NpZ249XFxcXFxcXCIgKyBKU09OLnBhcnNlKHBvc3QodSArIFxcXFxcXFwiYXBpL2ZzL2dldFxcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXFxcXFwicGF0aFxcXFxcXFwiOiBpdGVtLnBhcmVudCArIFxcXFxcXFwiL1xcXFxcXFwiICsgaXRlbS5uYW1lXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpLmRhdGEuc2lnbilcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0sIG5vdy51cmwsIHBhdGgsIGhlYWRlcnMpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIueUqOWFtuS7lui9r+S7tuaJk+W8gFxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIHUsIHBhdGgsIGhlYWRlcnMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgc2lnbiA9IEpTT04ucGFyc2UocG9zdCh1ICsgXFxcXFxcXCJhcGkvZnMvZ2V0XFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keTogSlNPTi5zdHJpbmdpZnkoe1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcXFxcXCJwYXRoXFxcXFxcXCI6IGl0ZW0ucGFyZW50ICsgXFxcXFxcXCIvXFxcXFxcXCIgKyBpdGVtLm5hbWVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkuZGF0YS5zaWduXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG93bmxvYWRGaWxlKGVuY29kZVVSSSh1ICsgXFxcXFxcXCJkXFxcXFxcXCIgKyBpdGVtLnBhcmVudCArIFxcXFxcXFwiL1xcXFxcXFwiICsgaXRlbS5uYW1lICsgXFxcXFxcXCI/c2lnbj1cXFxcXFxcIiArIHNpZ24pLCBcXFxcXFxcImhpa2VyOi8vZmlsZXMvY2FjaGUvXFxcXFxcXCIgKyBpdGVtLm5hbWUpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwib3BlbkZpbGU6Ly9cXFxcXFxcIiArIFxcXFxcXFwiaGlrZXI6Ly9maWxlcy9jYWNoZS9cXFxcXFxcIiArIGl0ZW0ubmFtZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgbm93LnVybCwgcGF0aCwgaGVhZGVycylcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKG5vdy51c2VyICYmIG5vdy5wYXNzd29yZCkge1xcXFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2sucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcXFxcXCLliKDpmaRcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIuehruiupOWIoOmZpO+8n1xcXFxcXFwiKS5jb25maXJtKChpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHJlcyA9IEpTT04ucGFyc2UocG9zdChub3cudXJsICsgXFxcXFxcXCJhcGkvZnMvcmVtb3ZlXFxcXFxcXCIsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IGhlYWRlcnMsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeSh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlyOiBpdGVtLnBhcmVudCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYW1lczogW2l0ZW0ubmFtZV1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKS5jb2RlXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXMgPT0gMjAwKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WIoOmZpOaIkOWKn1xcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+WIoOmZpOWksei0pVxcXFxcXFwiXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtLCBoZWFkZXJzLCBwYXRoLCBub3cpXFxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFxcXFxcIumHjeWRveWQjVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKGl0ZW0ubmFtZSkuaW5wdXQoKGl0ZW0sIGhlYWRlcnMsIHBhdGgsIG5vdykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcmVzID0gSlNPTi5wYXJzZShwb3N0KG5vdy51cmwgKyBcXFxcXFxcImFwaS9mcy9yZW5hbWVcXFxcXFxcIiwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogaGVhZGVycyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhcmVudCArIFxcXFxcXFwiL1xcXFxcXFwiICsgaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6IGlucHV0XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KSkuY29kZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocmVzID09IDIwMCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mk43kvZzmiJDlip9cXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mk43kvZzlpLHotKVcXFxcXFxcIlxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSwgaXRlbSwgaGVhZGVycywgcGF0aCwgbm93KVxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogZ2V0SXRlbShcXFxcXFxcInN0eWxlXFxcXFxcXCIsIFxcXFxcXFwiYXZhdGFyXFxcXFxcXCIpLFxcXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGdldEljb24oaXRlbSksXFxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbG9uZ0NsaWNrOiBsb25nQ2xpY2ssXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhcmVudCArIFxcXFxcXFwiL1xcXFxcXFwiICsgaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBpdGVtLm5hbWVcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldEl0ZW0oXFxcXFxcXCJzdHlsZVxcXFxcXFwiLCBcXFxcXFxcImF2YXRhclxcXFxcXFwiKSA9PSBcXFxcXFxcImF2YXRhclxcXFxcXFwiKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogYOKAmOKAmOKAmeKAmTxzbWFsbD48Zm9udCBjb2xvcj0nI2FhYWFhYSc+JHtkZXNjfTwvZm9udD48L3NtYWxsPmAsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJ0ZXh0XzFcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogdXJsLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IGxvbmdDbGljayxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhcmVudCArIFxcXFxcXFwiL1xcXFxcXFwiICsgaXRlbS5uYW1lLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZTogaXRlbS5uYW1lXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgfSBlbHNlIGlmIChsaXN0LmNvZGUgIT0gMjAwKSB7XFxcXG4gICAgICAgICAgICB0b2FzdChcXFxcXFxcIuWHuumUmeS6hlxcXFxcXFwiKVxcXFxuICAgICAgICAgICAgbG9nKGxpc3QubWVzc2FnZSlcXFxcbiAgICAgICAgfVxcXFxuICAgIH1cXFxcbn0gY2F0Y2ggKGUpIHtcXFxcbiAgICBzZXRSZXN1bHQoW3tcXFxcbiAgICAgICAgdGl0bGU6IFxcXFxcXFwi6K6+572uXFxcXFxcXCIsXFxcXG4gICAgICAgIHVybDogXFxcXFxcXCJoaWtlcjovL3BhZ2UvY29uZmlnXFxcXFxcXCIsXFxcXG4gICAgICAgIGNvbF90eXBlOiBcXFxcXFxcInRleHRfY2VudGVyXzFcXFxcXFxcIlxcXFxuICAgIH1dKVxcXFxuICAgIGxvZyhlLm1lc3NhZ2UpXFxcXG4gICAgdG9hc3QoXFxcXFxcXCLnqIvluo/lh7rnjrDplJnor6/vvIzor7fph43or5VcXFxcXFxcIilcXFxcbn1cXFxcbnNldFJlc3VsdChkKTtcXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCLkupHlj6Pku6RcXFwiLFxcXCJwYXRoXFxcIjpcXFwiY2xvdWRpbXBvcnRcXFwiLFxcXCJydWxlXFxcIjpcXFwiJC5leHBvcnRzLmlucHV0ID0gZnVuY3Rpb24odXJsKSB7XFxcXG4gICAgdmFyIHVybCA9IHVybC5zcGxpdChcXFxcXFxcIkBcXFxcXFxcIilbMV1cXFxcbiAgICB2YXIgY29udGVudCA9IHBhcnNlUGFzdGUodXJsKVxcXFxuICAgIHdyaXRlRmlsZShcXFxcXFxcImhpa2VyOi8vZmlsZXMvY2FjaGUvYWxpc3RfY2FjaGUuanNvblxcXFxcXFwiLCBjb250ZW50KVxcXFxufVxcXCJ9XVwiLFwicHJveHlcIjpcIlwifSIsInRpdGxlIjoi5b2T5YmN5pegQWxpc3TphY3nva4ifQ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement