Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥封神第一部@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS4gOe6p+WIhuexu+WIl+ihqFwiLFwicGF0aFwiOlwieWlcIixcInJ1bGVcIjpcImpzOlxcbi8qXFxu5LiA57qn5bCB6KOFIFxcbuWKqOaAgeWIhuexuyDliJfooajliJvlu7og6Ieq5Yqo5LiL5LiA6aG1XFxudmVyIDIwMjMwNzEwIDEuMFxcbiovXFxuZnVuY3Rpb24gZHluYW1pY0NsYXNzKG9wdGlvbnMpIHtcXG4gIGNvbnN0IG9iaiA9IHtcXG4gICAgLy/pu5jorqTlgLxcXG4gICAgbGF5b3V0OiBcXFwidW5kZWZpbmVkXFxcIixcXG4gICAgaHRtbDogXFxcImVtcHR5XFxcIixcXG4gICAgcGFnZTogMCxcXG4gICAg5YiG57G76aKc6ImyOiBcXFwiI0ZBNzI5OFxcXCIsXFxuICAgIOaKmOWPoDogXFxcIuKAnOKAnOKAneKAnTxiPlxcXCIgKyBcXFwi4oioXFxcIi5mb250Y29sb3IoXFxcIiMxYWFkMTlcXFwiKSArIFxcXCI8L2I+XFxcIixcXG4gICAg5bGV5byAOiBcXFwi4oCc4oCc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ShrLCBpLCB0KSB7XFxuICAgICAgcmV0dXJuIGsgPT0gaSA/IFxcXCLigJzigJzigJ3igJ1cXFwiICsgdC5mb250Y29sb3IodGhpcy7liIbnsbvpopzoibIpIDogdDtcXG4gICAgfSxcXG4gICAgYWN0aW9uKG9iaikge1xcbiAgICAgIHJldHVybiBbXFxuICAgICAgICB7XFxuICAgICAgICAgIHRpdGxlOiBcXFwi5riF6Zmk54q25oCBXFxcIixcXG4gICAgICAgICAganM6ICQudG9TdHJpbmcoKG9iaikgPT4ge1xcbiAgICAgICAgICAgIGxvZyhvYmopO1xcbiAgICAgICAgICAgIGNsZWFyTXlWYXIob2JqLnN0YXRlKTtcXG4gICAgICAgICAgICBjbGVhck15VmFyKFxcXCJoZWFkLmNhdGVcXFwiKTtcXG4gICAgICAgICAgICBvYmouYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgb2JqLmNsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgfSwgb2JqKSxcXG4gICAgICAgIH0sXFxuICAgICAgXTtcXG4gICAgfSxcXG4gICAgY2hlY2tQYXJhbSgpIHtcXG4gICAgICB2YXIgb2JqID0ge307XFxuICAgICAgaWYgKHRoaXMucGFnZSA9PSAwICYmIHR5cGVvZiBwYWdlID09IFxcXCJ1bmRlZmluZWRcXFwiKSB7XFxuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpemhteeggVxcXCIpO1xcbiAgICAgIH0gZWxzZSB7XFxuICAgICAgICBpZiAodHlwZW9mIHBhZ2UgPT0gXFxcInVuZGVmaW5lZFxcXCIpIHtcXG4gICAgICAgICAgb2JqW1xcXC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dGxlOiBcXFwiXFxcIixcXG4gICAgICAgICAgdXJsOiBcXFwiJ2hpa2VyOi8vc2VhcmNoP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFwiJnM9JytpbnB1dFxcXCIsXFxuICAgICAgICAgIGRlc2M6IFxcXCLmkJzntKLlhbPplK7or41cXFwiLFxcbiAgICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGdldE15VmFyKFxcXCJrZXl3b3JkXFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgICAgIG9uQ2hhbmdlOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJrZXl3b3JkXFxcIiwgaW5wdXQpO1xcbiAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICB9LFxcbiAgICAgICAgfSk7XFxuICAgICAgfVxcbiAgICAgIGNvbnN0IGNhdGVnb3JpZXMgPSBbXTtcXG4gICAgICBydWxlT2JqLmZvckVhY2goKHgpID0+IHtcXG4gICAgICAgIHZhciBsaXN0ID0gW107XFxuICAgICAgICBpZih4LuS4gOe6p+WumuS9jSl7XFxuICAgICAgICAgIGlmICh4LuS4gOe6p+WumuS9jS5zdGFydHNXaXRoKFxcXCJAanM6XFxcIikpIHtcXG4gICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxuICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdCA9IHBkZmEoaHRtbCwgeC7kuIDnuqflrprkvY0pO1xcbiAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBpZih4LuWkp+exu+WumuS9jSl7XFxuICAgICAgICAgIGlmICh4LuWkp+exu+WumuS9jS5zdGFydHNXaXRoKFxcXCJAanM6XFxcIikpIHtcXG4gICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuWkp+exu+WumuS9jSk7XFxuICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgbGlzdCA9IFtwZGZhKGh0bWwsIHgu5aSn57G75a6a5L2NKS5qb2luKCdcXFxcbicpXTtcXG4gICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICB2YXIg5LiA57qnID0gbGlzdC5tYXAoKHMpID0+IHtcXG4gICAgICAgICAgdmFyIHNsaXN0ID0gW107XFxuICAgICAgICAgIGlmICghKFxcXCLlsI/nsbtcXFwiIGluIHgpKSB7XFxuICAgICAgICAgICAgeC7lsI/nsbsgPSBcXFwiYm9keSYmYTpub3QoOm1hdGNoZXMo6aaW6aG1KSk6bm90KGE6bm90KFtocmVmXSkpXFxcIjtcXG4gICAgICAgICAgfVxcbiAgICAgICAgICBpZiAoeC7lsI/nsbsuc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgc2xpc3QgPSB0aGlzLmV2YWxKU1J1bGUocywgeC7lsI/nsbspO1xcbiAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHNsaXN0ID0gcGRmYShzLCB4LuWwj+exuyk7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgdmFyIOWumuS9jSA9IHNsaXN0Lm1hcCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IHRoaXMuZ2V0VGl0bGUoaXRlbSwgeC7moIfpopgpO1xcbiAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLmdldFVybChpdGVtLCB4KTtcXG4gICAgICAgICAgICB2YXIgb2JqID0geyB0aXRsZTogdGl0bGUsIHVybDogdXJsIH07XFxuICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KG9iaik7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICByZXR1cm4g5a6a5L2NO1xcbiAgICAgICAgfSk7XFxuICAgICAgICAvL2xvZyjkuIDnuqcpXFxuICAgICAgICAvL2xvZyjkuIDnuqcubGVuZ3RoKVxcbiAgICAgICAgaWYgKOS4gOe6py5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICBjYXRlZ29yaWVzLnB1c2go5LiA57qnLmpvaW4oXFxcIlxcXFxuXFxcIikpO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAg5LiA57qnLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICBjYXRlZ29yaWVzLnB1c2goaXRlbS5qb2luKFxcXCIsXFxcIikpO1xcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIC8vbG9nKGNhdGVnb3JpZXMpXFxuICAgICAgfSk7XFxuICAgICAgaWYgKOaKmOWPoOeKtuaAgSkge1xcbiAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBmb2xkID09PSBcXFwiMVxcXCIgPyDmipjlj6AgOiDlsZXlvIAsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKFxcbiAgICAgICAgICAgICAgKGZvbGQsIHUsIGFsbCkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihNWV9SVUxFLmdyb3VwLCBmb2xkID09PSBcXFwiMVxcXCIgPyBcXFwiMFxcXCIgOiBcXFwiMVxcXCIpO1xcbiAgICAgICAgICAgICAgICAvKmFsbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7Ki9cXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgIGZvbGQsXFxuICAgICAgICAgICAgICDnirbmgIEsXFxuICAgICAgICAgICAgICDlhajmuIVcXG4gICAgICAgICAgICApLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgIGxvbmdDbGljazogdGhpcy5hY3Rpb24oe1xcbiAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgICBhbGw6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgY2w6IOa4hemZpCxcXG4gICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgIH1cXG4gICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgY2F0ZWdvcmllcy5mb3JFYWNoKChjYXRlZ29yeSwgaW5kZXgpID0+IHtcXG4gICAgICAgIC8vbG9nKGNhdGVnb3JpZXMpXFxuICAgICAgICBsZXQgc3ViX2NhdGVnb3JpZXMgPSBbXTtcXG4gICAgICAgIC8qaWYgKOWwj+exu+WumuS9jS5pbmNsdWRlcyhcXFwiO1xcXCIpKSB7XFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXCI7XFxcIilbMF0pO1xcbiAgICAgICAgICBpZiAoc3ViX2NhdGVnb3JpZXMubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcXFwiO1xcXCIpWzFdKTtcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHsqL1xcbiAgICAgICAgLy9sb2coaW5kZXgpXFxuICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IEpTT04ucGFyc2UoYFske2NhdGVnb3J5fV1gKTtcXG4gICAgICAgIC8vIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NKTtcXG4gICAgICAgIC8vfVxcbiAgICAgICAgaWYgKGluZGV4ID09PSAwKSB7XFxuICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcblxcbiAgICAgICAgICAgIC8vbGV0IHRpdGxlID0gcGRmaChpdGVtLCBf5aSn57G75qCH6aKYKTtcXG4gICAgICAgICAgICBsZXQgdGl0bGUgPSBpdGVtLnRpdGxlO1xcbiAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ld1JlZ0V4cCjmjpLpmaQsIFxcXCJnXFxcIiksIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGpzb249JydcXG4gICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgXFxuICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXG4gICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAgY2xlYXJzOiDmuIXpmaQsXFxuICAgICAgICAgICAgICBqc29uOiBqc29uLFxcbiAgICAgICAgICAgICAgc3RhdGU6IOeKtuaAgSxcXG4gICAgICAgICAgICAgIGFsbGNsZWFyczog5YWo5riFLFxcbiAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgLy9sZXQgdXJsID0gcGQoaXRlbSwgX+Wkp+exu+mTvuaOpSk7XFxuICAgICAgICAgICAgbGV0IHVybCA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgIC8qaWYgKOWkp+exu+WkhOeQhikge1xcbiAgICAgICAgICAgICAgdXJsID0g5LiA57qn5YiG57G75aSE55CGKHVybCk7XFxuICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgLy9sb2codXJsKVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eSNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXTtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgbmV3X2NhdGUucHVzaChpbmRleCA9PT0gMCA/IHBhcmFtcy5rZXkudG9TdHJpbmcoKSA6IFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkobmV3X2NhdGUpKTtcXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZHRfXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgIH0sIHBhcmFtcyksXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSBpZiAoZm9sZCA9PT0gXFxcIjFcXFwiIHx8IOaKmOWPoOeKtuaAgSA9PSBmYWxzZSkge1xcbiAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG4gICAgICAgICAgICB2YXIgZXh0cmFwb3MgPSBmYWxzZTtcXG4gICAgICAgICAgICAvKmlmIChpdGVtLmluY2x1ZGVzKCd0eXBlPVxcXCJAZXh0cmFcXFwiJykpIHtcXG4gICAgICAgICAgICAgIGV4dHJhcG9zID0gdHJ1ZTtcXG4gICAgICAgICAgICAgIC8vbG9nKCfpmYTliqDlrprkvY0nKVxcbiAgICAgICAgICAgIH0qL1xcblxcbiAgICAgICAgICAgIGlmIChleHRyYXBvcykge1xcbiAgICAgICAgICAgICAgdmFyIHRpdGxlID0gcGRmaChpd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wZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAQFxcXCIpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXCJAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMF0sXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgICAgIC8vIGpzb24gPSBwZChpdGVtLCDliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAvKnZhciBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEBAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVswXSksXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAganNvbj3liIbnsbvpk77mjqUuaW5jbHVkZXMoJ0BAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgdHlwZTrliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMF0sXFxuICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQCcpWzFdKSxcXG4gICAgICAgICAgICAgICAgfTpwZChpdGVtLOWIhuexu+mTvuaOpSk7Ki9cXG4gICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgbGV0IHBhcmFtcyA9IHtcXG4gICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgaW5kZXg6IGluZGV4LFxcbiAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAganNvbjoganNvbixcXG4gICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcbiAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5XFxcIiArIFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmFsbGNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXBbcGFyYW1zLmluZGV4XSA9IHBhcmFtcy5rZXkudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKTtcXG4gICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiZHRfXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSwgcGFyYW1zKSxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH0pO1xcbiAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiLFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgfVxcbiAgICB9LFxcbiAgfTtcXG4gIG9iai7pooTorr4ob3B0aW9ucyk7XFxuICByZXR1cm4gb2JqO1xcbn1cXG5cXG4gIC8vLueKtuaAgShcXFwidXJsXFxcIilcXG4gIC8vLueVjOmdoihkKVxcbiAgLy8u5rqQ56CBKHhodG1sKVxcbiAgLy8u5YWo5riFKFtcXFwiMVxcXCIsIFxc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AgICAgICAgIGNscyA9IFxcXCJsYXN0bWFya1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiArIHVybCxcXG4gICAgICAgICAgY29udGVudDogY29udGVudCxcXG4gICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgIGlkOiBpZCxcXG4gICAgICAgICAgICBjbHM6IGNscyxcXG4gICAgICAgICAgfSxcXG4gICAgICAgIH0pO1xcbiAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxICYmIHNob3cpIHtcXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICBpZDogXFxcInBhZ2VsaW5lXFxcIixcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzbWFsbD7liqDovb3kuK0uLi48L3NtYWxsPlxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbnVtXFxcIixcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICB9KTtcXG4gICAgfSBlbHNlIHtcXG4gICAgICB1cGRhdGVJdGVtKFxcXCJwYWdlbnVtXFxcIiwge1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuWIsOW6leS6hjwvc21hbGw+PC9mb250PicsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBpZDogXFxcImxhc3RcXFwiLFxcbiAgICAgICAgfSxcXG4gICAgICB9KTtcXG4gICAgfVxcbiAgICBpZiAobGlzdC5sZW5ndGggPT0gMCAmJiBwYWdlID09IDEpIHtcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICB9KTtcXG4gICAgICBkLnB1c2goe1xcbiAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuaXoOWGheWuuTwvc21hbGw+PC9mb250PicsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge30sXFxuICAgICAgfSk7XFxuICAgIH1cXG4gICAgaWYodGhpcy5uZXh0UGFnZSgpKXtcXG4gICAgICAvL2xvZygndCcpO1xcbiAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ3lpX2lzbmV4dCcsJ3QnKTtcXG4gICAgfWVsc2V7XFxuICAgICAgLy9sb2coJ2YnKTtcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCd5aV9pc25leHQnLCdmJyk7XFxu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IOahhuaetuaPj+i/sDEpO1xcbiAgICAgdmFyIOaPj+i/sDIgPSBwYXJzZURvbUZvckh0bWwobGlzdFtqXSwg5qGG5p625o+P6L+wMik7XFxuICAgICB2YXIg5Zu+54mHID0gcGFyc2VEb20obGlzdFtqXSwg5qGG5p625Zu+54mHKSArICdAUmVmZXJlcj1odHRwczovL2ltZzkuZG91YmFuaW8uY29tLyc7XFxuICAgICB2YXIg6ZO+5o6lID0gcGFyc2VEb20obGlzdFtqXSwg5qGG5p626ZO+5o6lKSArIFxcXCIjaW1tZXJzaXZlVGhlbWUjXFxcIjtcXG4gICAgICBcXG4gICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgdGl0bGU6IOagh+mimCwgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgIGNvbnRlbnQ6IOeugOS7izEgKyAnXFxcXG4nICsg566A5LuLMixcXG4gICAgICAgICAgICAgICBkZXNjOiDmj4/ov7AxICsgJyAnICsg5o+P6L+wMixcXG4gICAgICAgICAgICAgICBpbWc6IOWbvueJhyxcXG4gICAgICAgICAgICAgICB1cmw6IOmTvuaOpSxcXG4gICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIHRpdGxlOiDmoIfpopgsICAgICAgICAgICBcXG4gICAgICAgICAgICBpbWc6IOWbvueJhyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcblwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5LqM57qn5aSW6YOo5pCc57SiXCIsXCJwYXRoXCI6XCJ0b29sXCIsXCJydWxlXCI6XCIvL3ZhciB0aXRsZSA9IHBhcnNlRG9tRm9ySHRtbChodG1sLCDmkJzntKLmoIfnrb4pO1xcbnZhciB0aXRsZSA9IE1ZX1BBUkFNUy50aXRsZTtcXG5sb2codGl0bGUpXFxuZC5wdXNoKHtcXG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mFyIHVybCA9IGh0bWwudXJsXFxuICAgICAgICAgICAgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUodXJsKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGh0bWwuZW5jcnlwdCA9PSAnMicpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUoYmFzZTY0RGVjb2RlKHVybCkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoL20zdTh8bXA0Ly50ZXN0KHVybCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVybFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidmlkZW86Ly9cXFwiICsgaW5wdXRcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ2aWRlbzovL1xcXCIgKyBpbnB1dFxcbiAgICAgICAgfVxcbiAgICB9KSxcXG4gICAgdXBkYXRhOiBmdW5jdGlvbihydWxlKSB7XFxuICAgICAgICBzZXRMYXN0Q2hhcHRlclJ1bGUoJ2pzOicgKyAkLnRvU3RyaW5nKCh1cmwscnVsZSkgPT4ge1xcbiAgICAgICAgICAgIHZhciBodG1sPWZldGNoKHVybCk7XFxuICAgICAgICAgICAgc2V0UmVzdWx0KGV2YWwocnVsZSkpXFxuICAgICAgICB9LE1ZX1VSTCwgcnVsZSkpXFxuICAgIH0sXFxuICAgIGNsb3NlOiBmdW5jdGlvbihsaXN0LCBzb3J0cykge1xcbiAgICAgICAgYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAkLnRvU3RyaW5nKChsaXN0LCBzb3J0cykgPT4ge1xcbiAgICAgICAgICAgIGxpc3QubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdlcl8nICsgeCArICdmb2xkJyk7XFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2VyXycreCk7XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHNvcnRzOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcigncGxheWxpc3RfJyArIGkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBjbGVhck15VmFyKCdlcl9wbGF5bGlzdHMnKTtcXG4gICAgICAgIH0sIGxpc3QsIHNvcnRzKSlcXG4gICAgfSxcXG4gICAgZGF0YUNvbnZlcnQ6IGZ1bmN0aW9uKGRhdGEpIHtcXG4gICAgICAgIHZhciBuZXdjbHNsaXN0ID0gZGF0YS5tYXAoZnVuY3Rpb24ob2JqKSB7XFxuICAgICAgICAgICAgdmFyIG5ld09iaiA9IE9iamVjdC5hc3NpZ24oe30sIG9iaik7XFxuICAgICAgICAgICAgaWYgKG5ld09iai5oYXNPd25Qcm9wZXJ0eSgndHlwZScpKSB7XFxuICAgICAgICAgICAgICAgIG5ld09iai5jb2xfdHlwZSA9IG5ld09iai50eXBlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gbmV3T2JqO1xcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gbmV3Y2xzbGlzdDtcXG4gICAgfSxcXG4gICAgcHJlTG9hZDogZnVuY3Rpb24oZnVuYykge1xcbiAgICAgICAgbGV0IG15ZnVuYz1udWxsXFxuICAgICAgICBpZihmdW5jIT11bmRlZmluZWQmJmZ1bmMuY29uc3RydWN0b3I9PUZ1bmN0aW9uKXtcXG4gICAgICAgICAgICBteWZ1bmM9ZnVuY1xcbiAgICAgICAgfVxcbiAgICAgICAgJC5leHRlbmQoe1xcbiAgICAgICAgICAgIGRhdGFDb252ZXJ0OiB0aGlzLmRhdGFDb252ZXJ0LFxcbiAgICAgICAgICAgIG1zbTpNZXRob2RzLk11bHRpU2VsZWN0TW9kZSxcXG4gICAg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ID09IDApIHtcXG4gICAgICAgICAgICByZXR1cm5cXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBpbmZvPXN0b3JhZ2UwLmdldE15VmFyKCdlcl9pbmZvJywne30nKVxcbiAgICAgICAgaWYoaW5mb1snZGVzYyddIT11bmRlZmluZWQpe1xcbiAgICAgICAgICBpbmZvWydkZXNjJ109aW5mb1snZGVzYyddKycg566A5LuLOicrZGVzYztcXG4gICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2VyX2luZm8nLGluZm8pO1xcbiAgICAgICAgfVxcbiAgICAgICAgXFxuICAgICAgICBjb25zdCBtYXJrID0gJ2Rlc2MnO1xcbiAgICAgICAgbnVtID0gdHlwZW9mKG51bSkgPT0gJ3VuZGVmaW5lZCcgPyA5MCA6IG51bVxcbiAgICAgICAgZGVzYyA9IGRlc2Muc3RhcnRzV2l0aCgn44CA44CAJykgPyBkZXNjIDogJ+OAgOOAgCcgKyBkZXNjO1xcbiAgICAgICAgZGVzYyA9IGRlc2MucmVwbGFjZSgvJy9nLCBcXFwiJiMzOTtcXFwiKVxcblxcbiAgICAgICAgZnVuY3Rpb24gc3Vic3RyKHN0ciwgbWF4TGVuZ3RoKSB7XFxuICAgICAgICAgICAgbGV0IGxlbiA9IDA7XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdHIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgaWYgKHN0ci5jaGFyQ29kZUF0KGkpID4gMjU1KSB7XFxuICAgICAgICAgICAgICAgICAgICBsZW4gKz0gMjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxlbisrO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChsZW4gPiBtYXhMZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzdHIuc2xpY2UoMCwgaSkgKyAnLi4uJztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gc3RyO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IHNkZXNjID0gc3Vic3RyKGRlc2MsIG51bSk7XFxuICAgICAgICB2YXIgbGF6eSA9ICQoYCNub0xvYWRpbmcjYCkubGF6eVJ1bGUoKGRjLCBzZGMsIG0pID0+IHtcXG4gICAgICAgICAgICB2YXIgc2hvdyA9IHN0b3JhZ2UwLmdldEl0ZW0obSwgJzAnKTtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSBmaW5kSXRlbSgnZGVzYycpLnRpdGxlO1xcbiAgICAgICAgICAgIHZhciByZSA9IC8oPFxcXFwvc21hbGw+PGJyPi4qPz4pLisvZztcXG4gICAgICAgICAgICB2YXIgZXhwID0gJ+WxleW8gDonO1xcbiAgICAgICAgICAgIHZhciByZXQgPSAn5pS26LW3Oic7XFxuICAgICAgICAgICAgaWYgKHNob3cgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZXQsIGV4cClcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIHNkYyArICc8L3NtYWxsPicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXC9zbWFsbD48YnI+PGZvbnQgY29sb3I9XFxcIikuKj8oXFxcIj4pLywgJyQxIzhBMkJFMiQyJykvL+aUtui1t+minOiJslxcblxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG0sICcwJyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnZGVzYycsIHtcXG4gICAgICAgICAgICAgICAgICAgI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cXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogJ2Rlc2MnLFxcbiAgICAgICAgICAgICAgICBsaW5lU3BhY2luZzogNixcXG4gICAgICAgICAgICAgICAgdGV4dFNpemU6IDE1LFxcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogdHJ1ZSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9LFxcblxcblxcbi8v5rW35oqlXFxuICAgIHN0ckNvbnZlcnQ6IGZ1bmN0aW9uKGFycikge1xcbiAgICAgICAgcmV0dXJuIGFyci5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgc3RyID0geDtcXG4gICAgICAgICAgICBpZiAoLyjlr7zmvJR85Li75ryUfOexu+WeiynvvJovLnRlc3Qoc3RyKSkge1xcbiAgICAgICAgICAgICAgICBzdHIgPSBzdHIuc3BsaXQoJy8nKS5tYXAoKHZhbCwgaW5kZXgpID0+IChpbmRleCA9PT0gMCA/ICcnIDogJycpICsgdmFsKS5zbGljZSgwLCA1KS5qb2luKCcgJykucmVwbGFjZSgvICQvLCAnJyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiBzdHJcXG4gICAgICAgIH0pXFxuICAgIH0sXFxuICAgIHNldENvbnRlbnQ6IGZ1bmN0aW9uKG9iaikge1xcbiAgICAgICAgLy9sb2cob2JqKVxcbiAgICAgICAgdmFyIGNvbnRlbnRzID0gb2JqLm1haW47XFxuICAgICAgICB2YXIgc29ydE9yZGVyID0gb2JqLnNvcnQ7XFxuICAgICAgICB2YXIgaW1nID0gb2JqLmltZztcXG4gICAgICAgIHZhciB0ZXh0cyA9IGNvbnRlbnRzLm1hcCh4ID0+IHBkZmgoeCwgJ1RleHQnKSk7XFxuICAgICAgICBcXG4gICAgICAgIHZhciBhcnJheSA9IHRleHRzLnNvcnQoKGEsIGIpID0+IHtcXG4gICAgICAgICAgICBjb25zdCBpbmRleEEgPSBzb3J0T3JkZXIuaW5kZXhPZihhLnN1YnN0cigwLCAyKSk7XFxuICAgICAgICAgICAgY29uc3QgaW5kZXhCID0gc29ydE9yZGVyLmluZGV4T2YoYi5zdWJzdHIoMCwgMikpO1xcbiAgICAgICAgICAgIHJldHVybiBpbmRleEEgLSBpbmRleEI7XFxuICAgICAgICB9KVxcbiAgICAgICAgdmFyIHJlZ2V4ID0gbmV3IFJlZ0V4cCgnKCcgKyBzb3J0T3JkZXIuam9pbignfCcpICsgJyknKTtcXG4gICAgICAgIGFycmF5ID0gYXJyYXkuZmlsdGVyKGZ1bmN0aW9uKGl0ZW0pIHtcXG4gICAgICAgICAgICByZXR1cm4gcmVnZXgudGVzdChpdGVtKTtcXG4gICAgICAgIH0pO1xcbiAgICAgICAgLy9sb2coYXJyYXkpXFxuICAgICAgICBcXG4gICAgICAgIC8vYXJyYXkgPSBzb3J0T3JkZXIubGVuZ3RoPT0wP2FycmF5OnRoaXMuc3RyQ29udmVydChhcnJheSk7XFxuICAgICAgICBhcnJheSA9IHRoaXMuc3RyQ29udmVydChhcnJheSk7XFxuICAgICAgICBcXG4gICAgICAgIGlmKGFycmF5Lmxlbmd0aD42KXtcXG4gICAgICAgICAgICBhcnJheT1hcnJheS5zbGljZSgwLDYpO1xcbiAgICAgICAgfVxcbiAgICAgICAgXFxuICAgICAgICB2YXIgdGl0bGVzID0gW107XFxuICAgICAgICB2YXIgZGVzY3MgPSBbXTtcXG4gICAgICAgIFxcbiAgICAgICAgc3dpdGNoIChhcnJheS5sZW5ndGgpIHtcXG4gICAgICAgICAgICBjYXNlIDQ6XFxuICAgICAgICAgICAgY2FzZSA1OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAyKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSA2OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgzKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICB9XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycse1xcbiAgICAgICAgICBkZXNjOmRlc2NzLmpvaW4oJ1xcXFxuJyksXFxuICAgICAgICAgIGltZzppbWcsXFxuICAgICAgICB9KVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogIHRoaXMuc21hbGwodGl0bGVzWzBdICsgJ1xcXFxuJyArdGl0bGVzLnNsaWNlKDEsIDMpLmpvaW4oJ1xcXFxuJyksJ3JlZCcpLFxcbiAgICAgLy90aXRsZTogIHRoaXMuc21hbGwocGRmaChodG1sLCAnLmRhdGE6Y29udGFpbnMo5pu05pawKSYmVGV4dCcpICsgJ1xcXFxuJyArIHBkZmgoaHRtbCwgJy5kYXRhOmNvbnRhaW5zKOexu+WeiykmJlRleHQnKSwncmVkJyksXFxuICAgICAgICAgZGVzYzogdGhpcy5zbWFsbChkZXNjcy5qb2luKCdcXFxcbicpLCcjRkY3RjAwJyksXFxuICAgICAgLy9kZXNjOiB0aGlzLnNtYWxsKHBkZmgoaHRtbCwgJy5kYXRhOmNvbnRhaW5zKOWvvOa8lCkmJlRleHQnKSArICdcXFxcbicgKyBwZGZoKGh0bWwsICcuZGF0YTpjb250YWlucyjkuLvmvJQpJiZUZXh0JyksJyNGRjdGMDAnKSxcXG4gICAgIC8vZGVzYzogdGhpcy5zbWFsbChwZGZoKGh0bWwsICcuZGF0YTpjb250YWlucyjmm7TmlrApJiZUZXh0JyksJyNGRjdGMDAnKSxcXG4gICAgICAgICAgICBwaWNfdXJsOiBpbWcgKyAnQFJlZmVyZXI9JyxcXG4gICAgICAgICAgICB1cmw6IE1ZX1VSTCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljX2JsdXInLFxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChvYmouZGVzYyAhPSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICB0aGlzLnNldERlc2Mob2JqLmRlc2MpO1xcbiAgICAgICAgfVxcbiAgICB9LFxcbiAgICBzZXRDdXN0b206IGZ1bmN0aW9uKG9iaiwgaW1nKSB7XFxuICAgICAgICB2YXIgYXJyYXkgPSBbXTtcXG4gICAgICAgIGlmIChvYmouY29uc3RydWN0b3IgPT0gQXJyYXkpIHtcXG4gICAgICAgICAgICBhcnJheSA9IG9iajtcXG4gICAgICAgIH1cXG4gICAgICAgIGFycmF5ID0gdGhpcy5zdHJDb252ZXJ0KGFycmF5KTtcXG4gICAgICAgIHZhciB0aXRsZXMgPSBbXTtcXG4gICAgICAgIHZhciBkZXNjcyA9IFtdO1xcbiAgICAgICAgc3dpdGNoIChhcnJheS5sZW5ndGgpIHtcXG4gICAgICAgICAgICBjYXNlIDQ6XFxuICAgICAgICAgICAgY2FzZSA1OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAyKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgY2FzZSA2OlxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgzKTtcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICB9XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycse1xcbiAgICAgICAgICBkZXNjOmRlc2NzLmpvaW4oJ1xcXFxuJyksXFxuICAgICAgICAgIGltZzppbWcsXFxuICAgICAgICB9KVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogdGl0bGVzWzBdICsgJ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xuICAgICAgICAgICAgICAgICAgdmFyIGNscyA9IHBsaXN0W3Noc29ydF0uY2xzO1xcbiAgICAgICAgICAgICAgICAgIHZhciBwaWM9cGxpc3Rbc2hzb3J0XS5waWM7XFxuICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1swXSwgZm9sZHNbMV0pLFxcbiAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIodmFyaSsnZm9sZCcsJzEnKTtcXG4gICAgICAgICAgICAgIC8vcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxuICAgICAgICAgICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXG4gICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNvbCA9IHBsaXN0W3Noc29ydF0uY29sX3R5cGU7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgY2xzID0gcGxpc3Rbc2hzb3J0XS5jbHM7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGljPXBsaXN0W3Noc29ydF0ucGljO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKHZhcmksIGkpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgeGxpc3Q9bGlzdHNbaV07XFxuICAgICAgICAgICAgICAgIGlmKCQuZnVuYyE9dW5kZWZpbmVkJiYkLmZ1bmMuY29uc3RydWN0b3I9PUZ1bmN0aW9uKXtcXG4gICAgICAgICAgICAgICAgICAgIHhsaXN0PSQuZnVuYyhpKTtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19saXN0JywgeGxpc3QpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHZhciBwbGF5cyA9IHhsaXN0Lm1hcCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHgudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogY29sLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpYzpwaWMsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHgudXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGNscyxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnKSA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBsYXlzLnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB2YXIgcGNmZz1zdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJywne30nKTtcXG4gICAgICAgICAgICAgICAgaWYocGNmZ1sn5Y2V5o6oJ10pe1xcbiAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaCcse1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6cGNmZ1snb2JqJ11bJ+WNleaOqCddWzBdXFxuICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXT1mYWxzZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpZihwY2ZnWyfpgInmjqgnXSl7XFxuICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNocycse1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6cGNmZ1snb2JqJ11bJ+mAieaOqCddWzBdXFxuICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXT1mYWxzZTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJyxwY2ZnKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2xpbmUnLCBwbGF5cyk7XFxuXFxuICAgICAgICAgICAgICAgIHZhciB0YWJ4ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgdGFieC5mb3JFYWNoKCh4LCBpaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0geC50aXRsZTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpID09IGlpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFx3Kyk/L2csIGxpbmVjKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLnJlcGxhY2UoLyMoXFxcXHcrKT8vZywgJyMnKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5oiQ5Yqf77yBJztcXG4gICAgICAgICAgICB9LCB2YXJpLCBzaHNvcnQsIGksY3VzdG9tLue6v+i3r+mAieS4rSlcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAoZ2V0TXlWYXIodmFyaSwgJzAnKSA9PSBpID8gdGFic1tpXS5mb250Y29sb3IoY3VzdG9tLue6v+i3r+mAieS4rSkgOiB0YWJzW2ldLmZvbnRjb2xvcignIycpKSxcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfdGFiJyxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX3RhYl8nICsgaSxcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOidibGFua19ibG9jaycsIC8vJ2JsYW5rX2Jsb2NrJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19saW5lJyxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9LFxcbiAgICBwdXNoVGFiOmZ1bmN0aW9uKHZhcmksc2hzb3J0KXtcXG4gICAgICBhZGRMaXN0ZW5lcignb25SZWZyZXNoJywgJC50b1N0cmluZygoc2hzb3J0KSA9PiB7XFxuICAgICAgICBjbGVhck15VmFyKHNoc29ydCsnX3B1c2hjZmcnKTtcXG4gICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0KydfZHVvc2VsZWN0Jyk7XFxuICAgICAgICB9LCBzaHNvcnQpKVxcbiAgICAgICB2YXIgcG9iaj17XFxuICAgICAgICfljZXmjqgnOlsn4qa/5Y2V5o6oJywnPGI+4qa/5Y2V5o6oPC9iPicuZm9udGNvbG9yKCcjMDBGQTlBJyldLFxcbiAgICAgICAn6YCJ5o6oJzpbJ+KYkemAieaOqCcsJzxiPuKYkemAieaOqDwvYj4nLmZvbnRjb2xvcignIzQ2ODJCNCcpXSxcXG4gICAgICB9XFxuICAgICAgXFxuICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgdGl0bGU6J+KMmCcsXFxuICAgICAgICAgIGNvbF90eXBlOidzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgdXJsOidoaWtlcjovL2VtcHR5JyxcXG4gICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgIGNsczpzaHNvcnQrJ19wdXNodGFiJyxcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSx7XFxuICAgICAgICAgIHRpdGxlOnBvYmpbJ+WNleaOqCddWzBdLFxcbiAgICAgICAgICBjb2xfdHlwZTonc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgIHVybDokKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQscG9iaix2YXJpKT0+e1xcbiAgICAgICAgICBpZihnZXRNeVZhcih2YXJpKydmb2xkJywnMScpPT0nMCcpe1xcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lsZXlvIDmiY3og73mk43kvZwnO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgICAgXFxuICAgICAgICAgIHZhciB0aXRsZXM9cG9ialsn5Y2V5o6oJ107XFxuICAgICAgICAgIHZ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aXN0O1xcbiAgICAgICAgICAgIGZpbmRJdGVtc0J5Q2xzKHNoc29ydCkubWFwKHg9PntcXG4gICAgICAgICAgICAgIHZhciBkcHVzaD17XFxuICAgICAgICAgICAgICAgIG5hbWU6Z2V0UGFnZVRpdGxlKCksXFxuICAgICAgICAgICAgICAgIHVybDp4LnRpdGxlKyckJyt4LmV4dHJhLmlkXFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQse1xcbiAgICAgICAgICAgICAgICB1cmw6JCgnJykubGF6eVJ1bGUoKGRwdXNoKT0+e1xcbiAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL3BhZ2UvcHVzaD9ydWxlPVhZUeaOqOmAgSZwdXNodXJsPScgKyBlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnkoZHB1c2gpKTtcXG4gICAgICAgICAgICAgICAgfSxkcHVzaClcXG4gICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfVxcbiAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJyxwY2ZnKTtcXG4gICAgICAgICAgcmV0dXJuICd0b2FzdDovLycrKOWNleaOqD8n5Y2V5o6o5byA5ZCvJzon5Y2V5o6o5YWz6ZetJyk7XFxuICAgICAgICAgIH0sc2hzb3J0LHBvYmosdmFyaSksXFxuICAgICAgICAgIGV4dHJhOntcXG4gICAgICAgICAgICBpZDpzaHNvcnQrJ19wdXNoJyxcXG4gICAgICAgICAgICBjbHM6c2hzb3J0KydfcHVzaHRhYicsXFxuICAgICAgICAgIH1cXG4gICAgICAgIH0se1xcbiAgICAgICAgICB0aXRsZTpwb2JqWyfpgInmjqgnXVswXSxcXG4gICAgICAgICAgY29sX3R5cGU6J3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICB1cmw6JCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2hzb3J0LHBvYmosdmFyaSk9PntcXG4gICAgICAgICAgaWYoZ2V0TXlWYXIodmFyaSsnZm9sZCcsJzEnKT09JzAnKXtcXG4gICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgICAgfVxcbiAgICAgICAgICB2YXIgdGl0bGVzPXBvYmpbJ+mAieaOqCddO1xcbiAgICAgICAgICB2YXIgcGNmZz1zdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQrJ19wdXNoY2ZnJywne30nKTtcXG4gICAgICAgICAgcGNmZ1snb2JqJ109cG9iajtcXG4gICAgICAgICAgdmFyIOmAieaOqD1wY2ZnWyfpgInmjqgnXT9wY2ZnWyfpgInmjqgnXTpmYWxzZTtcXG4gICAgICAgICAgaWYo6YCJ5o6oKXtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCsnX3B1c2hzJyx7XFxuICAgICAgICAgICAgICB0aXRsZTp0aXRsZXNbMF0sXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBwY2ZnWyfpgInmjqgnXT1mYWxzZTtcXG4gICAgICAgICAgICBwY2ZnWydwbGF5bGlzdCddLm1hcCgoeCk9PntcXG4gICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQse1xcbiAgICAgICAgICAgICAgICAgdGl0bGU6eC50aXRsZSxcXG4gICAgICAgICAgICAgICAgIHVybDp4LnVybCxcXG4gICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNodG8nLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aOqOmAgeacrOmhtT0+VFZCb3gnLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoc2hzb3J0KydfZHVvc2VsZWN0Jyk7XFxuICAgICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCsnX3B1c2hzJyx7XFxuICAgICAgICAgICAgICB0aXRsZTon4oCc4oCc4oCd4oCdJyt0aXRsZXNbMV0sXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBwY2ZnWyfpgInmjqgnXT10cnVlO1xcbiAgICAgICAgICAgIHBjZmdbJ+WNleaOqCddPWZhbHNlO1xcbiAgICAgICAgICAgIHZhciBwbGF5bGlzdD1maW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgIHBjZmdbJ3BsYXlsaXN0J109cGxheWxpc3Q7XFxuICAgICAgICAgICAgbGV0IElkcz1wbGF5bGlzdC5tYXAoaXQgPT4gaXQuZXh0cmEuaWQpO1xcbiAgICAgICAgICAgICAgICBJZHMuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IGZpbmRJdGVtKHgpLnRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkLm1zbSh0aXRsZSwgeCxzaHNvcnQpLFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaCcse1xcbiAgICAgICAgICAgICAgdGl0bGU6cG9ialsn5Y2V5o6oJ11bMF0sXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCsnX3B1c2h0bycsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5o6o6YCB6YCJ5LitPT5UVkJveCcsXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0KydfcHVzaGNmZycscGNmZyk7XFxuICAgICAgICAgIHJldHVybiAndG9hc3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AgICAgICAgICAgICAgICAgICAgIH0pLmpvaW4oJyQkJCcpO1xcbiAgICAgICAgICB9Y2F0Y2h7XFxuICAgICAgICAgIHZhciBwbHM9c3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0K1xcXCJfbGlzdFxcXCIsJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXCIkXFxcIiArIHgudXJsKS5qb2luKFxcXCIjXFxcIik7XFxuICAgICAgICAgIHZhciB0YWJzPVt0YWJzW2dldE15VmFyKHZhcmksJzAnKV1dO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIC8qbG9nKHBscylcXG4gICAgICAgICAgbG9nKHRhYnMpKi9cXG4gICAgICAgICAgfVxcbiAgICAgICAgICBpZijpgInmjqgpe1xcbiAgICAgICAgICB2YXIgcGxzPXN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCtcXFwiX2R1b3NlbGVjdFxcXCIsJ1tdJykubWFwKHggPT4geC50aXRsZSArIFxcXCIkXFxcIiArIHgudXJsKS5qb2luKFxcXCIjXFxcIik7XFxuICAgICAgICAgIGlmKHBscy5sZW5ndGg9PTApe1xcbiAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/pgInmi6nkuLrnqbonO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIHZhciB0YWJzPVsn5pKt5pS+5YiX6KGoJ107XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgXFxuICAgICAgICAgIHZhciBpbmZvPXN0b3JhZ2UwLmdldE15VmFyKCdlcl9pbmZvJywne30nKTtcXG4gICAgICAgICAgdmFyIGRlc2MgPWluZm9bJ2Rlc2MnXTtcXG4gICAgICAgICAgdmFyIOaOqOmAgSA9IHtcXG4gICAgICAgICAgICAgICAgIFxcXCJuYW1lXFxcIjogZ2V0UGFnZVRpdGxlKCksXFxuICAgICAgICAgICAgICAgICBcXFwiY29udGVudFxcXCI6IGRlc2N8fCcnLFxcbiAgICAgICAgICAgICAgICAgXFxcInBpY1xcXCI6IGluZm9bJ2ltZyddIHx8ICcnLFxcbiAgICAgICAgICAgICAgICAgXFxcImZyb21cXFwiOiB0YWJzLmpvaW4oJyQkJCcpLFxcbiAgICAgICAgICAgICAgICAgXFxcInVybFxcXCI6IHBscyxcXG4gICAgICAgICAgIH1cXG4gICAgICAgICAgLy9sb2co5o6o6YCBKVxcbiAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvcHVzaD9ydWxlPVhZUeaOqOmAgSZwdXNodXJsPVxcXCIgKyBlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnko5o6o6YCBKSlcXG4gICAgICAgICAgfSxzaHNvcnQsdmFyaSksXFxuICAgICAgICAgIGV4dHJhOntcXG4gICAgICAgICAgICBpZDpzaHNvcnQrJ19wdXNodG8nLFxcbiAgICAgICAgICAgIGNsczpzaHNvcnQrJ19wdXNodGFiJ1xcbiAgICAgICAgICB9XFxuICAgICAgICB9LHtcXG4gICAgICAgICAgY29sX3R5cGU6J2JsYW5rX2Jsb2NrJyxcXG4gICAgICAgICAgZXh0cmE6e1xcbiAgICAgICAgICAgIGNsczpzaHNvcnQrJ19wdXNodGFiJyxcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgc2V0TG9uZ2NsaWNrOmZ1bmN0aW9uKHNoc29ydCxjdXN0b20pe1xcbiAgICAgIHJldHVybiBbe3RpdGxlOifmoLflvI/wn46oJyxqczogJC50b1N0cmluZygoc2hzb3J0KT0+e1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFsbF9jb2xzID0gWycnXS5jb25jYXQoZ2V0Q29sVHlwZXMoKSk7XFxuICAgICAgICAgICAgICAgICAgICBhbGxfY29scz1hbGxfY29scy5maWx0ZXIoeD0+XFxuICAgICAgICAgICAgICAgICAgICAgIC8odGV4dF98ZmxleCkuKi8udGVzdCh4KSYmeCE9J3RleHRfaWNvbicpO1xcbiAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhhbGxfY29scylcXG4gICAgICAgICAgICAgICAgICAgIGxldCBjbHMgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywne30nKVxcbiAgICAgICAgICAgICAgICAgICAgfHwgJyc7XFxuICAgICAgICAgICAgICAgICAgICBpZihjbHNbc2hzb3J0XSE9Jycpe1xcbiAgICAgICAgICAgICAgICAgICAgICBjb2w9Y2xzW3Noc29ydF0uY29sX3R5cGU7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBsZXQg5oyJ6ZKu5qC35byPID0gYWxsX2NvbHMubWFwKChpdCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBpdCA9PT0gY29sID8gJ/CfkYknICsgaXQ6IGl0O1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGlwcyA9ICfor7fpgInmi6npgInpm4bmjInpkq7moLflvI8nO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQo5oyJ6ZKu5qC35byPLCAyLCB0aXBzKS5zZWxlY3QoKHNoc29ydCxjbHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgaW5wdXQgPSBpbnB1dC5yZXBsYWNlKC/wn5GJL2csICcnKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvKnN0b3JhZ2UwLnNldEl0ZW0oJ+aMiemSruagt+W8jycsIGlucHV0KTsqL1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvbGRJZHMgPSAoZmluZEl0ZW1zQnlDbHMoc2hzb3J0KSB8fCBbXSkubWFwKGl0PT5pdC5leHRyYS5pZCk7IC8v6ICB5YWD57SgaWRzXFxuICAgICAgICAgICAgICAgICAgICAgICAgb2xkSWRzLmZvckVhY2goeD0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogaW5wdXRcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suWIh+aNoumAiembhuaMiemSruagt+W8j+S4ujonICsgaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICB9LHNoc29ydCxjbHMpO1xcbiAgICAgICAgICAgICAgICB9LHNoc29ydCxjdXN0b20pfV1cXG4gICAgfSxcXG4gICAgc2V0VGFiczogZnVuY3Rpb24odGFicywgdmFyaSwgc2hzb3J0LHBhcnNlKSB7XFxuICAgICAgICBsZXQgY3VzdG9tPXBhcnNlLuiHquWumuS5iTtcXG4gICAgICAgIGN1c3RvbSA9dGhpcy5nZXRQcmVzZXQoY3VzdG9tKTtcXG4gICAgICAgIHNoc29ydCA9IHNoc29ydCA/IHNoc29ydCA6ICdzaHNvcnQnO1xcbiAgICAgICAgdmFyIHRpdGxlID0gKGdldE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJykgPT0gJzEnKSA/ICc8Yj48c3BhbiBzdHlsZT1cXFwiY29sb3I6ICcrY3VzdG9tLumAhuW6j+minOiJsisnXFxcIj7pgIbluo88L3NwYW4+PC9iPicgOiAnPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiAnK2N1c3RvbS7mraPluo/popzoibIrJ1xcXCI+5q2j5bqPPC9zcGFuPjwvYj4nXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB2YXJpICsgJzonICsgdGl0bGUsXFxuICAgICAgICAgICAgZGVzYzogJ+WFsScgKyBTdHJpbmcodGFicy5sZW5ndGgpLmZvbnRjb2xvcignIzQ2ODJCNCcpICsgJ+adoee6v+i3rycsXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsdmFyaSxjdXN0b20pID0+IHtcXG4gICAgICAgICAgICAgIGxldCBjb25mID0gZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXG4gICAgICAgICAgICAgIGlmKGdldE15VmFyKCdlcl8nK3ZhcmkrJ2ZvbGQnLCcxJyk9PScwJyl7XFxuICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGNsc2xpc3RzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXG4gICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICB2YXIgdGl0bGVzPVtgJHtjdXN0b20u5q2j5bqP6aKc6ImyfVxcXCI+5q2j5bqPYCxgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXCI+6YCG5bqPYF07XFxuICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICBuZXdjbHNsaXN0LnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIG5ld2Nsc2xpc3QpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcblxcbiAgICAgICAgICAgICAgICBpZiAoY29uZiA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2F2YXRhcicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzBdLCB0aXRsZXNbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaOkuW6j+aIkOWKnyc7XFxuICAgICAgICAgICAgfSwgc2hzb3J0LHZhcmksY3VzdG9tKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxuICAgICAgICAgICAgaW1nOiBjdXN0b20u5Zu+5qCHICxcXG4gICAgICAgICAgICBleHRyYTp7XFxuICAgICAgICAgICAgICBpZDpzaHNvcnQrJ19hdmF0YXInLFxcbiAgICAgICAgICAgICAgbG9uZ0NsaWNrOnRoaXMuc2V0TG9uZ2NsaWNrKHNoc29ydCksXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIHZhciDmipjlj6AgPSAn4oCc4oCc4oCd4oCdPGI+JyArICfimLcnLmZvbnRjb2xvcihcXFwiI0QzRDNEM1xcXCIpO1xcbiAgICAgICAgdmFyIOWxleW8gCA9ICfigJzigJzigJ3igJ08Yj4nICsgJ+KYsCcuZm9udGNvbG9yKFxcXCIjRkZBNTAwXFxcIik7XFxuICAgICAgICB2YXIgZm9sZG5hbWUgPSAnZXJfJyt2YXJpICsgJ2ZvbGQnO1xcbiAgICAgICAgdmFyICBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxuICAgICAgICBpZih0eXBlb2YocGFyc2VbJ+aOqOmAgSddKSE9J3VuZGVmaW5lZCcmJnBhcnNlWyfmjqjpgIEnXSlcXG4gICAgICAgIHRoaXMucHVzaFRhYignZXJfJyt2YXJpLHNoc29ydCk7XFxuICAgICAgICBcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT09ICcwJyA/IOaKmOWPoCA6IOWxleW8gCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZm9sZG5hbWUsc2hzb3J0KSA9PiB7XFxuICAgICAgICAgICAgICAgIHZhciAgZm9sZCA9IGdldE15VmFyKGZvbGRuYW1lLCAnMScpO1xcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0KydfbGluZScpO1xcbiAgICAgICAgICAgICAgICB2YXIgYnRuPWZpbmRJdGVtKHNoc29ydCsnX2J1dHRvbicpO1xcbiAgICAgICAgICAgICAgICB2YXIgZm9sZHM9Wyc8Zm9udCBjb2xvcj1cXFwiI0QzRDNEM1xcXCI+4pi3JywnPGZvbnQgY29sb3I9XFxcIiNGRkE1MDBcXFwiPuKYsCddO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgaWYoZm9sZD09JzAnKXtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoZm9sZG5hbWUsICAnMScpO1xcbiAgICAgICAgICAgICAgICB2YXIgY3MgPSBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQgKyAnX2NscycpO1xcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIob2JqLmV4dHJhLmlkLCBjcyk7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oYnRuLmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogYnRuLnRpdGxlLnJlcGxhY2UoZm9sZHNbMF0sIGZvbGRzWzFdKSxcXG4gICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmKGZvbGQ9PScxJyl7XFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoZm9sZG5hbWUsICAnMCcpO1xcbiAgICAgICAgICAgICAgICB2YXIgcGNscyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQocGNscyk7XFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfY2xzJywgY3gpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1sxXSwgZm9sZHNbMF0pLFxcbiAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArIChmb2xkID09PSAnMScgPyAn5pS26LW3JyA6ICflsZXlvIAnKTtcXG4gICAgICAgICAgICB9LCBmb2xkbmFtZSxzaHNvcnQpLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGlkOiBzaHNvcnQgKyAnX2J1dHRvbicsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIHRoaXMuY3JlYXRlUExpc3QodGFicyx2YXJpLHNoc29ydCxjdXN0b20pO1xcbiAgICB9LFxcbiAgICBzZXRUYWJzMjogZnVuY3Rpb24odGFicywgdmFyaSwgc2hzb3J0LHBhcnNlLGV4cCkge1xcbiAgICAgICAgbGV0I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gICAgICAgICAgICB2YXIgZm9sZCA9IGdldE15VmFyKGZvbGRuYW1lLCAnMScpO1xcbiAgICAgICAgICAgIHZhciBvYmogPSBmaW5kSXRlbShzaHNvcnQgKyAnX2F2YXRhcicpXFxuICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHZhciBiY2xzID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgdmFyIHRjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQgKyAnX3RhYicpO1xcbiAgICAgICAgICAgICAgICB2YXIgbGNscyA9IGZpbmRJdGVtKHNoc29ydCArICdfbGluZScpO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgdmFyIHBjbHMgPSBmaW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICB2YXIgY3MgPSBbYmNsc10uY29uY2F0KHRjbHMsIFtsY2xzXSwgcGNscyk7XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICBpZihwdXNoKXtcXG4gICAgICAgICAgICAgICAgICB2YXIgcGNscz1maW5kSXRlbXNCeUNscyhzaHNvcnQrJ19wdXNodGFiJyk7XFxuICAgICAgICAgICAgICAgICAgY3M9cGNscy5jb25jYXQoY3MpO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIHZhciBjeCA9ICQuZGF0YUNvbnZlcnQoY3MpO1xcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2NscycsIGN4KTtcXG4gICAgICAgICAgICAgICAgaWYocHVzaCl7XFxuICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCsnX3B1c2h0YWInKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKGJjbHMuZXh0cmEuaWQpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbShzaHNvcnQgKyAnX2xpbmUnKTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxuXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ob2JqLmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBvYmouZGVzYy5yZXBsYWNlKCflsZXlvIA8Zm9udCBjb2xvcj1cXFwiI0ZGQTUwMFxcXCI+4piwJywgJ+aKmOWPoDxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnKSxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxuICAgICAgICAgICAgICAgIHZhciBjcyA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCArICdfY2xzJyk7XFxuICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihzaHNvcnQgKyAnX2F2YXRhcicsIGNzKTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShvYmouZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgIGRlc2M6IG9iai5kZXNjLnJlcGxhY2UoJ+aKmOWPoDxmb250IGNvbG9yPVxcXCIjRDNEM0QzXFxcIj7imLcnLCAn5bGV5byAPGZvbnQgY29sb3I9XFxcIiNGRkE1MDBcXFwiPuKYsCcpLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgZm9sZCA9PT0gJzEnID8gJzAnIDogJzEnKTtcXG4gICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArIChmb2xkID09PSAnMScgPyAn5pS26LW3JyA6ICflsZXlvIAnKTtcXG4gICAgICAgIH0sIGZvbGRuYW1lLCBzaHNvcnQsKHBhcnNlWyfmjqjpgIEnXT90cnVlOmZhbHNlKSk7XFxuICAgICAgICB2YXIgZGVzYyA9IChmb2xkID09PSAnMCcgPyDmipjlj6AgOiDlsZXlvIApICsgJ1xcXFx0JztcXG4gICAgICAgIFxcbiAgICAgICAgaWYoZXhwLmxlbmd0aD09MSl7XFxuICAgICAgICAgICAgdXJsPSdoaWtlcjovL2VtcHR5JztcXG4gICAgICAgICAgICBkZXNjPScnO1xcbiAgICAgICAgfVxcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogdmFyaSArICc6XFxcXHRcXFxcdCcgKyAn5YWxJyArIFN0cmluZyh0YWJzLmxlbmd0aCkuZm9udGNvbG9yKCcjNDY4MkI0JykgKyAn5p2h57q/6LevJyxcXG4gICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYXZhdGFyJyxcXG4gICAgICAgICAgICBpbWc6IGN1c3RvbS7lm77moIcsXFxuICAgICAgICAgICAgdXJsOiB1cmwsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYXZhdGFyJyxcXG4gICAgICAgICAgICAgICAgbG9uZ0NsaWNrOnRoaXMuc2V0TG9uZ2NsaWNrKHNoc29ydCksXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmKHR5cGVvZihwYXJzZVsn5o6o6YCBJ10pIT0ndW5kZWZpbmVkJyYmcGFyc2VbJ+aOqOmAgSddKVxcbiAgICAgICAgdGhpcy5wdXNoVGFiKCdlcl8nK3Zhcmksc2hzb3J0KTtcXG4gICAgICAgIFxcbiAgICAgICAgaWYgKGZvbGQgPT0gJzAnKSB7XFxuICAgICAgICAgICAgcmV0dXJuXFxuICAgICAgICB9XFxuXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIHRpdGxlLFxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgodmFyaSwgc2hzb3J0LGN1c3RvbSkgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgY29uZiA9IGdldE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJyk7XFxuICAgICAgICAgICAgICAgIHZhciBjbHNsaXN0cyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxuICAgICAgICAgICAgICAgIHZhciBuZXdjbHNsaXN0ID0gJC5kYXRhQ29udmVydChjbHNsaXN0cyk7XFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcbiAgICAgICAgICAgICAgICBuZXdjbHNsaXN0LnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIG5ld2Nsc2xpc3QpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19idXR0b24nKVxcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGVzPVtgJHtjdXN0b20u5q2j5bqP6aKc6ImyfVxcXCI+5q2j5bqPYCxgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXCI+6YCG5bqPYF07XFxuICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICBpZiAoY29uZiA9PSAnMScpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19idXR0b24nLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQgKyAnX2J1dHRvbicsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzBdLCB0aXRsZXNbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHNoc29ydCArICdfc29ydCcsICcxJyk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZSgpXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/liIfmjaLmjpLluo/miJDlip8nXFxuICAgICAgICAgICAgfSwgdmFyaSwgc2hzb3J0LGN1c3RvbSksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBpZDogc2hzb3J0ICsgJ19idXR0b24nLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pXFxuICAgICAgICB0aGlzLmNyZWF0ZVBMaXN0KHRhYnMsdmFyaSxzaHNvcnQsY3VzdG9tKTtcXG4gICAgfSxcXG4gICAgc2V0TGlzdHM6IGZ1bmN0aW9uKGxpc3RzLCBpbmRleCwgc2hzb3J0LHBhcnNlKSB7XFxuXFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCBsaXN0cyk7XFxuICAgICAgICBcXG4gICAgICAgIHBhcnNlPXBhcnNlP3BhcnNlOnt9O1xcbiAgICAgICAgdmFyIOagt+W8jz1wYXJzZS7moLflvI8/cGFyc2Uu5qC35byPOicnO1xcbiAgICAgICAgdmFyIOWbvuaghz1wYXJzZS7lm77moIc/cGFyc2Uu5Zu+5qCHOidodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21vdmllLzEzLnN2Zyc7XFxuICAgICAgICB2YXIgYWpheD1wYXJzZS5BamF4P3BhcnNlLkFqYXg6ZmFsc2U7XFxuXFxuICAgICAgICBzaHNvcnQgPSBzaHNvcnQgPyBzaHNvcnQgOiAnc2hzb3J0JztcXG5cXG4gICAgICAgIGlmKGFqYXgpe1xcbiAgICAgICAgICAgIHZhciBsaXN0ID0gbGlzdHM7XFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKHNoc29ydCArICdfc29ydCcpID09ICcxJyAmJiBsaXN0cy5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgIGxpc3QgPSBsaXN0cy5yZXZlcnNlKCk7XFxuICAgICAgICAgICB9XFxuICAgICAgICB9ZWxzZXtcXG4gICAgICAgICAgICB2YXIgbGlzdCA9IGxpc3RzW2luZGV4XTtcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JykgPT0gJzEnICYmIGxpc3RzLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgbGlzdCA9IGxpc3RzW2luZGV4XS5yZXZlcnNlKCk7XFxuICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBcXG4gICAgICAgIGlmKOagt+W8jz09Jycpe1xcbiAgICAgICAgICDmoLflvI89bGlzdC5sZW5ndGggPiAzID8gJ3RleHRfNCcgOiAndGV4dF8yJ1xcbiAgICAgICAgfVxcbiAgICAgICAgXFxuICAgICAgICBpZihsaXN0Lmxlbmd0aCA+IDApe1xcbiAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcbiAgICAgICAgaWYoIXBsaXN0Lmhhc093blByb3BlcnR5KHNoc29ydCkpe1xcbiAgICAgICAgICAgICBwbGlzdFtzaHNvcnRdPXt9O1xcbiAgICAgICAgfVxcbiAgICAgICAgcGxpc3Rbc2hzb3J0XVsnY2xzJ109c2hzb3J0O1xcbiAgICAgICAgcGxpc3Rbc2hzb3J0XVsnY29sX3R5cGUnXT3moLflvI87XFxuICAgICAgICBwbGlzdFtzaHNvcnRdWydwaWMnXT3lm77moIc7XFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfcGxheWxpc3RzJywgcGxpc3QpO1xcbiAgICAgICAgfSAgIFxcbiAgICAgICAgXFxuICAgICAgICBcXG4gICAgICAgIGZvciAodmFyIGogaW4gbGlzdCkge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBsaXN0W2pdLnRpdGxlLFxcbiAgICAgICAgICAgICAgICB1cmw6IGxpc3Rbal0udXJsLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTog5qC35byPLFxcbiAgICAgICAgICAgICAgICBwaWM65Zu+5qCHLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IGxpc3Rbal0udXJsLnJlcGxhY2UoL0BsYXp5UnVsZVtcXFxcc1xcXFxTXSsvZywgJycpLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBzaHNvcnQsXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfSxcXG4gICAgZ2V0VGFiczogZnVuY3Rpb24ocGFyc2UpIHtcXG4gICAgICAgIHZhciB0YWJzID0gW107XFxuICAgICAgICB2YXIgYXJ0cyA9IHBkZmEoaHRtbCwgcGFyc2Uu57q/6LevKTtcXG4gICAgICAgIHZhciDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7A7XFxuICAgICAgICB2YXIg5pu/5o2i5Ye95pWwID0gJyc7XFxuICAgICAgICBpZiAocGFyc2Uu57q/6Lev5ZCN56ewLmluY2x1ZGVzKCdAQCcpKSB7XFxuICAgICAgICAgICAg57q/6Lev5ZCNID0gcGFyc2Uu57q/6Lev5ZCN56ewLnNwbGl0KCdAQCcpWzBdO1xcbiAgICAgICAgICAgIOabv+aNouWHveaVsCA9IHBhcnNlLue6v+i3r+WQjeensC5zcGxpdCgnQEAnKVsxXTtcXG4gICAgICAgIH1cXG4gICAgICAgIGZvciAodmFyIGkgaW4gYXJ0cykge1xcbiAgICAgICAgICAgIHZhciBsaW5lbmFtZSA9IHBkZmgoYXJ0c1tpXSwg57q/6Lev5ZCNKTtcXG4gICAgICAgICAgICBpZiAo5pu/5o2i5Ye95pWwICE9ICcnKSB7XFxuICAgICAgICAgICAgICAgIGxpbmVuYW1lID0gZXZhbCgnbGluZW5hbWUnICsg5pu/5o2i5Ye95pWwKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGFicy5wdXNoKGxpbmVuYW1lKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB0YWJzO1xcbiAgICB9LFxcbiAgICBnZXRMaXN0czogZnVuY3Rpb24ocGFyc2Usc2hzb3J0KSB7XFxuICAgICAgICBzaHNvcnQgPSBzaHNvcnQgPyBzaHNvcnQgOiAnc2hzb3J0JztcXG4gICAgICAgIHZhciBsaXN0cyA9IFtdO1xcbiAgICAgICAgdmFyIGNvbnRzID0gcGRmYShodG1sLCBwYXJzZS7pgInpm4YpO1xcbiAgICAgICAgdmFyIOmAiembhuWQjeensCA9IHBhcnNlLumAiembhuWQjeensCA/IHBhcnNlLumAiembhuWQjeensCA6ICdhJiZUZXh0JztcXG4gICAgICAgIHZhciDpgInpm4bpk77mjqUgPSBwYXJzZS7pgInpm4bpk77mjqUgPyBwYXJzZS7pgInpm4bpk77mjqUgOiAnYSYmaHJlZic7XFxuICAgICAgICB2YXIg6Kej5p6QID0gcGFyc2Uu6Kej5p6QID8gcGFyc2Uu6Kej5p6QIDogJyc7XFxuICAgICAgICB2YXIgdGVtcCA9IFtdO1xcbiAgICAgICAgZm9yICh2YXIgaSBpbiBjb250cykge1xcbiAgICAgICAgICAgIGlmIChwYXJzZS7pgInpm4bliJfooaggIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIGxpc3RzLnB1c2gocGRmYShjb250c1tpXSwgcGFyc2Uu6YCJ6ZuG5YiX6KGoKS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKHgsIOmAiembhuWQjeensCksXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBwZCh4LCDpgInpm4bpk77mjqUpICsg6Kej5p6QLFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KSlcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB2YXIgdXJsID0gcGQoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxuICAgICAgICAgICAgICAgIGlmICgh6YCJ6ZuG6ZO+5o6lLmluY2x1ZGVzKCdocmVmJykpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVybCA9IHBkZmgoY29udHNbaV0sIOmAiembhumTvuaOpSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdGVtcC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwZGZoKGNvbnRzW2ldLCDpgInpm4blkI3np7ApLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiB1cmwgKyDop6PmnpAsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgbGV0IOWAkuW6jyA9IHBhcnNlLuWAkuW6jyA/IHBhcnNlLuWAkuW6jyA6IGZhbHNlO1xcbiAgICAgICAgdmFyIHJlc3VsdHMgPSBsaXN0cy5sZW5ndGggPyBsaXN0cyA6IFt0ZW1wXTtcXG4gICAgICAgIGlmICjlgJLluo8pIHtcXG4gICAgICAgICAgICByZXN1bHRzID0gcmVzdWx0cy5tYXAoeCA9PiB4LnJld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VkKSB7XFxuICAgICAgICAgICAgICAgIHRhYnMgPSB0aGlzLmdldFRhYnMoaXRlbSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHB1dE15VmFyKHBsYXkraSsnX3RhYnMnLHRhYnMpO1xcbiAgICAgICAgICAgIGlmKGl0ZW0uQWpheCl7XFxuICAgICAgICAgICAgICAgIGlmIChtb2RlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksaXRlbSk7XFxuICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksaXRlbSxwZSk7XFxuICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfaHRtbCcsaHRtbCk7XFxuICAgICAgICAgICAgICAgICBwdXRNeVZhcignZXJfdXJsJyxNWV9VUkwpO1xcblxcbiAgICAgICAgICAgICAgICB2YXIgbGlzdHM9ZnVuYyhnZXRNeVZhcignZXJfJytpdGVtLuexu+WeiywnMCcpLE1ZX1VSTCk7XFxuICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgdmFyIGxpc3RzID0gdGhpcy5nZXRMaXN0cyhpdGVtLCBwbGF5K2kpO1xcbiAgICAgICAgICAgIFxcbiAgICAgICAgICAgIFxcbiAgICAgICAgICAgIGlmIChsaXN0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcbiAgICAgICAgICAgICAgICBpZiAobW9kZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNldFRhYnModGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFiczIodGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLGl0ZW0scGUpO1xcbiAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcignZXJfJyArIGl0ZW0u57G75Z6LICsgJ2ZvbGQnLCAnMScpID09ICcxJykge1xcbiAgICAgICAgICAgICAgICB0aGlzLnNldExpc3RzKGxpc3RzLCBnZXRNeVZhcignZXJfJytpdGVtLuexu+WeiywgJzAnKSwgcGxheSArIGksaXRlbSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0pXFxuICAgIH1cXG59XFxuXFxuXFxubGV0IE1ldGhvZHM9e1xcbiAgICAvL+WkmumAieaooeWdl1xcbiAgICBNdWx0aVNlbGVjdE1vZGU6ZnVuY3Rpb24obmFtZSxpZCxzaHNvcnQpe1xcbiAgICAgICAgcmV0dXJuICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGRhdGF0aXRsZSwgZGF0YXVybCxzaHNvcnQpID0+IHtcXG4gICAgICAgICAgICBmdW5jdGlvbiB1bmlxdWUoYXJyKSB7XFxuICAgICAgICAgICAgY29uc3QgcmVzID0gbmV3IE1hcCgpXFxuICAgICAgICAgICAgcmV0dXJuIGFyci5maWx0ZXIoKGEpID0+ICFyZXMuaGFzKGEudXJsKSAmJiByZXMuc2V0KGEudXJsLCAxKSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGR1b3NlbGVjdCA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCtcXFwiX2R1b3NlbGVjdFxcXCIpID8gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0K1xcXCJfZHVvc2VsZWN0XFxcIikgOiBbXTtcXG4gICAgICAgICAgICBpZiAoZHVvc2VsZWN0LmZpbmRJbmRleCh4ID0+IHgudXJsID09PSBkYXRhdXJsKSA9PSAtMSkge1xcbiAgICAgICAgICAgICAgICBkdW9zZWxlY3QucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZGF0YXRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBkYXRhdXJsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIGR1b3NlbGVjdCA9IHVuaXF1ZShkdW9zZWxlY3QpXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZGF0YXVybCwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGDigJzigJzigJ3igJ08c3BhbiBzdHlsZT1cXFwiY29sb3I6I0ZGNTczM1xcXCI+YCArIGRhdGF0aXRsZSxcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZnVuY3Rpb24gcmVtb3ZlQnlWYWx1ZShhcnIsIHZhbCkge1xcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoYXJyW2ldWyd1cmwnXSA9PSB2YWwpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlbW92ZUJ5VmFsdWUoZHVvc2VsZWN0LCBkYXRhdXJsKVxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKGRhdGF1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRhdGl0bGVcXG4gICAgICAgICAgICAgICA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5pCc57SiKCkge1xcXFxuICAgICAgdGhpcy5zZWFyY2ggPSB0cnVlO1xcXFxuICAgICAgcmV0dXJuIHRoaXM7XFxcXG4gICAgfSxcXFxcbiAgICDlvIDlkK/mipjlj6AoaW5wdXQpIHtcXFxcbiAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXFxcbiAgICAgICAgaW5wdXQgPSB0cnVlO1xcXFxuICAgICAgfVxcXFxuICAgICAgdGhpcy5pc0Jvb2xlYW4oaW5wdXQpO1xcXFxuICAgICAgdGhpcy5vcGVuID0gaW5wdXQ7XFxcXG4gICAgICByZXR1cm4gdGhpcztcXFxcbiAgICB9LFxcXFxuICAgIHNldFRpdGxlKGssIGksIHQpIHtcXFxcbiAgICAgIHJldHVybiBrID09IGkgPyBcXFxcXFxcIuKAnOKAnOKAneKAnVxcXFxcXFwiICsgdC5mb250Y29sb3IodGhpcy7liIbnsbvpopzoibIpIDogdDtcXFxcbiAgICB9LFxcXFxuICAgIGFjdGlvbihvYmopIHtcXFxcbiAgICAgIHJldHVybiBbXFxcXG4gICAgICAgIHtcXFxcbiAgICAgICAgICB0aXRsZTogXFxcXFxcXCLmuIXpmaTnirbmgIFcXFxcXFxcIixcXFxcbiAgICAgICAgICBqczogJC50b1N0cmluZygob2JqKSA9PiB7XFxcXG4gICAgICAgICAgICBsb2cob2JqKTtcXFxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIob2JqLnN0YXRlKTtcXFxcbiAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcXFxcXCJoZWFkLmNhdGVcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICBvYmouYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgb2JqLmNsLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgY2xlYXJNeVZhcihpd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cXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgIH0pOyovXFxcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICAgICAgZm9sZCxcXFxcbiAgICAgICAgICAgICAg54q25oCBLFxcXFxuICAgICAgICAgICAgICDlhajmuIVcXFxcbiAgICAgICAgICAgICksXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuYWN0aW9uKHtcXFxcbiAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcXFxuICAgICAgICAgICAgICAgIGFsbDog5YWo5riFLFxcXFxuICAgICAgICAgICAgICAgIGNsOiDmuIXpmaQsXFxcXG4gICAgICAgICAgICAgIH0pLFxcXFxuICAgICAgICAgICAgfSxcXFxcbiAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgfVxcXFxuICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcXFxuICAgICAgY2F0ZWdvcmllcy5mb3JFYWNoKChjYXRlZ29yeSwgaW5kZXgpID0+IHtcXFxcbiAgICAgICAgLy9sb2coY2F0ZWdvcmllcylcXFxcbiAgICAgICAgbGV0IHN1Yl9jYXRlZ29yaWVzID0gW107XFxcXG4gICAgICAgIC8qaWYgKOWwj+exu+WumuS9jS5pbmNsdWRlcyhcXFxcXFxcIjtcXFxcXFxcIikpIHtcXFxcbiAgICAgICAgICBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jS5zcGxpdChcX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FxuICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcXFxuICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXFxcbiAgICAgICAgICAgICAga2V5OiBrZXksXFxcXG4gICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxcXG4gICAgICAgICAgICAgIGNsZWFyczog5riF6ZmkLFxcXFxuICAgICAgICAgICAgICBqc29uOiBqc29uLFxcXFxuICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcXFxuICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXFxcbiAgICAgICAgICAgIH07XFxcXG5cXFxcbiAgICAgICAgICAgIC8vbGV0IHVybCA9IHBkKGl0ZW0sIF/lpKfnsbvpk77mjqUpO1xcXFxuICAgICAgICAgICAgbGV0IHVybCA9IGl0ZW0udXJsO1xcXFxuICAgICAgICAgICAgLyppZiAo5aSn57G75aSE55CGKSB7XFxcXG4gICAgICAgICAgICAgIHVybCA9IOS4gOe6p+WIhuexu+WkhOeQhih1cmwpO1xcXFxuICAgICAgICAgICAgfSovXFxcXG4gICAgICAgICAgICAvL2xvZyh1cmwpXFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICAgIHVybDogJChcXFxcXFxcImhpa2VyOi8vZW1wdHkjbm9Mb2FkaW5nI1xcXFxcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IG5ld19jYXRlID0gW107XFxcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNsZWFycy5mb3JFYWNoKChpdGVtKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICBjbGVhck15VmFyKGl0ZW0pO1xcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgIG5ld19jYXRlLnB1c2goaW5kZXggPT09IDAgPyBwYXJhbXMua2V5LnRvU3RyaW5nKCkgOiBcXFxcXFxcIjBcXFxcXFxcIik7XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJoZWFkLmNhdGVcXFxcXFxcIiwgSlNPTi5zdHJpbmdpZnkobmV3X2NhdGUpKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcXFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJkdF9cXFxcXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKHRydWUpO1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcImhpa2VyOi8vZW1wdHlcXFxcXFxcIjtcXFxcbiAgICAgICAgICAgICAgfSwgcGFyYW1zKSx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xuICAgICAgICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXFxcXFwiQEBcXFxcXFxcIik6XFxcXG4gICAgICAgICAgICAgICAgICBqc29uID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICB0eXBlOiDliIbnsbvpk77mjqUuc3BsaXQoXFxcXFxcXCJAQFxcXFxcXFwiKVswXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IHBkZmgoaXRlbSwg5YiG57G76ZO+5o6lLnNwbGl0KFxcXFxcXFwiQEBcXFxcXFxcIilbMV0pLFxcXFxuICAgICAgICAgICAgICAgICAgfTtcXFxcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxcXG4gICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxcXG4gICAgICAgICAgICAgICAgICAvLyBqc29uID0gcGQoaXRlbSwg5YiG57G76ZO+5o6lKTtcXFxcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICAgICAgICB9Ki9cXFxcbiAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcXFxuICAgICAgICAgICAgICAvKnZhciBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEBAJyk/e1xcXFxuICAgICAgICAgICAgICAgICAgICB0eXBlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAQCcpWzBdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6cGRmaChpdGVtLOWIhuexu+mTvuaOpS5zcGxpdCgnQEBAJylbMV0pLFxcXFxuICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpO1xcXFxuICAgICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgIGpzb2495YiG57G76ZO+5o6lLmluY2x1ZGVzKCdAQCcpP3tcXFxcbiAgICAgICAgICAgICAgICAgICAgdHlwZTrliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMF0sXFxcXG4gICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMV0pLFxcXFxuICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpOyovXFxcXG4gICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxcXG4gICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcXFxuICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxcXG4gICAgICAgICAgICAgIGtleToga2V5LFxcXFxuICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcXFxuICAgICAgICAgICAgICBqc29uOiBqc29uLFxcXFxuICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcXFxuICAgICAgICAgICAgICBhbGxjbGVhcnM6IOWFqOa4hSxcXFxcbiAgICAgICAgICAgIH07XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICB0aXRsZTogdGhpcy5zZXRUaXRsZShrZXkudG9TdHJpbmcoKSwgY2F0ZV90ZW1wW2luZGV4XSwgdGl0bGUpLFxcXFxuICAgICAgICAgICAgICB1cmw6ICQoXFxcXFxcXCJoaWtlcjovL2VtcHR5XFxcXFxcXCIgKyBcXFxcXFxcIiNub0xvYWRpbmcjXFxcXFxcXCIpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXFxcbiAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgcGFyYW1zLmNhdGVfdGVtcFtwYXJhbXMuaW5kZXhdID0gcGFyYW1zLmtleS50b1N0cmluZygpO1xcXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXFxcXFwiaGVhZC5jYXRlXFxcXFxcXCIsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcXFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcXFxcXCJkdF9cXFxcXFxcIiArIHBhcmFtcy5qc29uLnR5cGUsIHBhcmFtcy5qc29uLnZhbHVlKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiaGlrZXI6Ly9lbXB0eVxcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICB9LCBwYXJhbXMpLFxcXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcXFxcXCJzY3JvbGxfYnV0dG9uXFxcXFxcXCIsXFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXFxcXFwiYmxhbmtfYmxvY2tcXFxcXFxcIixcXFxcbiAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgfSk7XFxcXG4gICAgfVxcXFxuICAgIH0sXFxcXG4gIH07XFxcXG4gIG9iai7pooTorr4ob3B0aW9ucyk7XFxcXG4gIHJldHVybiBvYmo7XFxcXG59XFxcXG5cXFxcbiAgLy8u54q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4syLFxcXFxuICAgICAgICAgICAgICAgZGVzYzog5o+P6L+wMSArICcgJyArIOaPj+i/sDIsXFxcXG4gICAgICAgICAgICAgICBpbWc6IOWbvueJhyxcXFxcbiAgICAgICAgICAgICAgIHVybDog6ZO+5o6lLFxcXFxuICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiDmoIfpopgsICAgICAgICAgICBcXFxcbiAgICAgICAgICAgIGltZzog5Zu+54mHLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG5cXFwifSx7XFxcImNvbF90eXBlXFxcIjpcXFwibW92aWVfM1xcXCIsXFxcIm5hbWVcXFwiOlxcXCLkuoznuqflpJbpg6jmkJzntKJcXFwiLFxcXCJwYXRoXFxcIjpcXFwidG9vbFxcXCIsXFxcInJ1bGVcXFwiOlxcXCIvL3ZhciB0aXRsZSA9IHBhcnNlRG9tRm9ySHRtbChodG1sLCDmkJzntKLmoIfnrb4pO1xcXFxudmFyIHRpdGxlID0gTVlfUEFSQU1TLnRpdGxlO1xcXFxubG9nKHRpdGxlKVxcXFxuZC5wdXNoKHtcXFxcbiAgICB0aXRsZTogJ+KAmOKAmOKAmeKAmTxiPjxtaWRkbGU+PGZvbnQgY29sb3I9XFxcXFxcXCIjRkYwMDAwXFxcXFxcXCI+IOiBmuW9seKImjwvZm9udD48L21pZGRsZT4nLFxcXFxuICAgIHBpY191cmw6ICdodHRwOi8vaW1hZ2UuY29vbGFway5jb20vL2Fwa19sb2dvLzIwMjIvMDUwNy8xNC8wXzM4MjhfNzI1NF82MzlAMjYweDI2MC5wbmcudC5wbmcnLFxcXFxuICAgIHVybDogJ2hpa2VyOi8vc2VhcmNoP3M9JyArIHRpdGxlICsgJyZydWxlPeiBmuW9seKImicsXFxcXG4gICAgY29sX3R5cGU6ICdpY29uX3NtYWxsXzQnLF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3J5cHQgPT0gJzInKSB7XFxcXG4gICAgICAgICAgICAgICAgdXJsID0gdW5lc2NhcGUoYmFzZTY0RGVjb2RlKHVybCkpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgaWYgKC9tM3U4fG1wNC8udGVzdCh1cmwpKSB7XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHVybFxcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ2aWRlbzovL1xcXFxcXFwiICsgaW5wdXRcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidmlkZW86Ly9cXFxcXFxcIiArIGlucHV0XFxcXG4gICAgICAgIH1cXFxcbiAgICB9KSxcXFxcbiAgICB1cGRhdGE6IGZ1bmN0aW9uKHJ1bGUpIHtcXFxcbiAgICAgICAgc2V0TGFzdENoYXB0ZXJSdWxlKCdqczonICsgJC50b1N0cmluZygodXJsLHJ1bGUpID0+IHtcXFxcbiAgICAgICAgICAgIHZhciBodG1sPWZldGNoKHVybCk7XFxcXG4gICAgICAgICAgICBzZXRSZXN1bHQoZXZhbChydWxlKSlcXFxcbiAgICAgICAgfSxNWV9VUkwsIHJ1bGUpKVxcXFxuICAgIH0sXFxcXG4gICAgY2xvc2U6IGZ1bmN0aW9uKGxpc3QsIHNvcnRzKSB7XFxcXG4gICAgICAgIGFkZExpc3RlbmVyKCdvbkNsb3NlJywgJC50b1N0cmluZygobGlzdCwgc29ydHMpID0+IHtcXFxcbiAgICAgICAgICAgIGxpc3QubWFwKHggPT4ge1xcXFxuICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2VyXycgKyB4ICsgJ2ZvbGQnKTtcXFxcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdlcl8nK3gpO1xcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAg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gIGZ1bmM6bXlmdW5jLFxcXFxuICAgICAgICB9KVxcXFxuICAgIH0sXFxcXG4gICAgc21hbGw6IGZ1bmN0aW9uKHN0ciwgY29sb3IpIHtcXFxcbiAgICAgICAgcmV0dXJuICfigJjigJjigJnigJk8c21hbGw+PGZvbnQgY29sb3I9XFxcXFxcXCInICsgKGNvbG9yIHx8ICcnKSArICdcXFxcXFxcIj4nICsgc3RyICsgJzwvZm9udD48L3NtYWxsPic7XFxcXG4gICAgfSxcXFxcbiAgICDlo7DmmI46IGZ1bmN0aW9uKCkge1xcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IHRoaXMuc21hbGwoJ+S7peS4iuaVsOaNruadpea6kOS6jue9kee7nO+8jOWmguaCqOWWnOasou+8jOivt+aUr+aMgeWumOaWue+8gScsICcjODcxRjc4JyksXFxcXG4gICAgICAgICAgICBkZXNjOiB0aGlzLnNtYWxsKCfmraTop4TliJnku4XpmZDlrabkuaDkuqTmtYHkvb/nlKjvvIzor7fkuo7lr7zlhaXlkI4yNOWwj+aXtuWGheWIoOmZpO+8jOS7u+S9lee7hOe7h+aIluS4quS6uuS4jeW+l+S7peS7u+S9leaWueW8j+aWueazleS8oOaSreatpOinhOWImeeahOaVtOS9k+aIlumDqOWIhu+8gScsICcjRjIwQzAwJyksXFxcXG4gICAgICAgICAgICB1cmw6ICdoaWtlcjovL2VtcHR5JyxcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMSdcXFxcbiAgICAgICAgfSk7XFxcXG4gICAgfSxcXFxcblxcXFxuXFxcXG4vL+eugOS7i1xcXFxuICAgIHNldERlc2M6IGZ1bmN0aW9uKGRlc2MsIG51bSkge1xcXFxuICAgICAgICBkZXNjID0gZGVzYy5jb25zdHJ1Y3RvciA9PSBBcnJheSA/IGRlc2Muam9pbignPGJyPicpIDogZGVzYztcXFxcbiAgICAgICAgaWYgKGRlc2MucmVwbGFjZSgvKDxicj58XFxcXFxcXFxzKykvZywgJycpLmxlbmd0aCA9PSAwKSB7XFxcXG4gICAgICAgICAgICByZXR1cm5cXFxcbiAgICAgICAgfVxcXFxuICAgICAgICB2YXIgaW5mbz1zdG9yYWdlMC5nZXRNeVZhcignZXJfaW5mbycsJ3t9JylcXFxcbiAgICAgICAgaWYoaW5mb1snZGVzYyddIT11bmRlZmluZWQpe1xcXFxuICAgICAgICAgIGluZm9bJ2Rlc2MnXT1pbmZvWydkZXNjJ10rJyDnroDku4s6JytkZXNjO1xcXFxuICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJyxpbmZvKTtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBcXFxcbiAgICAgICAgY29uc3QgbWFyayA9ICdkZXNjJztcXFxcbiAgICAgICAgbnVtID0gdHlwZW9mKG51bSkgPT0gJ3VuZGVmaW5lZCcgPyA5MCA6IG51bVxcXFxuICAgICAgICBkZXNjID0gZGVzYy5zdGFydHNXaXRoKCfjgIDjgIAnKSA/IGRlc2MgOiAn44CA44CAJyArIGRlc2M7XFxcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoLycvZywgXFxcXFxcXCImIzM5O1xcXFxcXFwiKVxcXFxuXFxcXG4gICAgICAgIGZ1bmN0aW9uIHN1YnN0cihzdHIsIG1heExlbmd0aCkge1xcXFxuICAgICAgICAgICAgbGV0IGxlbiA9IDA7XFxcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0ci5sZW5ndGg7IGkrKykge1xcXFxuICAgICAgICAgICAgICAgIGlmIChzdHIuY2hhckNvZGVBdChpKSA+IDI1NSkge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZW4gKz0gMjtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZW4rKztcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYgKGxlbiA+IG1heExlbmd0aCkge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gc3RyLnNsaWNlKDAsIGkpICsgJy4uLic7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcmV0dXJuIHN0cjtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBsZXQgc2Rlc2MgPSBzdWJzdHIoZGVzYywgbnVtKTtcXFxcbiAgICAgICAgdmFyIGxhenkgPSAkKGAjbm9Mb2FkaW5nI2ApLmxhenlSdWxlKChkYywgc2RjLCBtKSA9PiB7XFxcXG4gICAgICAgICAgICB2YXIgc2hvdyA9IHN0b3JhZ2UwLmdldEl0ZW0obSwgJzAnKTtcXFxcbiAgICAgICAgICAgIHZhciB0aXRsZSA9IGZpbmRJdGVtKCdkZXNjJykudGl0bGU7XFxcXG4gICAgICAgICAgICB2YXIgcmUgPSAvKDxcXFxcXFxcXC9zbWFsbD48YnI+Lio/PikuKy9nO1xcXFxuICAgICAgICAgICAgdmFyIGV4cCA9ICflsZXlvIA6JztcXFxcbiAgICAgICAgICAgIHZhciByZXQgPSAn5pS26LW3Oic7XFxcXG4gICAgICAgICAgICBpZiAoc2hvdyA9PSAnMScpIHtcXFxcbiAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKCdkZXNjJywge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKHJldCwgZXhwKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UocmUsICckMScgKyBzZGMgKyAnPC9zbWFsbD4nKVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXFxcXFwvc21hbGw+PGJyPjxmb250IGNvbG9yPVxcXFxcXFwiKS4qPyhcXFxcXFxcIj4pLywgJyQxIzhBMkJFMiQyJykvL+aUtui1t+minOiJslxcXFxuXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKG0sICcwJyk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZVxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoZXhwLCByZXQpXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIGRjICsgJzwvc21hbGw+JylcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIC5yZXBsYWNlKC8oPFxcXFxcXFxcL3NtYWxsPjxicj48Zm9udCBjb2xvcj1cXFxcXFxcIikuKj8oXFxcXFxcXCI+KS8sICckMSMwMDgwMDAkMicpLy/lsZXlvIDpopzoibJcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0obSwgJzEnKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHJldHVybiBgaGlrZXI6Ly9lbXB0eWBcXFxcbiAgICAgICAgfSwgZGVzYywgc2Rlc2MsIG1hcmspXFxcXG4gICAgICAgIHZhciBzYyA9IHN0b3JhZ2UwLmdldEl0ZW0obWFyaywgJzAnKSA9PSAnMCcgPyAn5bGV5byAOicgOiAn5pS26LW3Oic7XFxcXG4gICAgICAgIHZhciBkYyA9IHN0b3JhZ2UwLmdldEl0ZW0obWFyaywgJzAnKSA9PSAnMCcgPyBzZGVzYyA6IGRlc2M7XFxcXG4gICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgIHRpdGxlOiAnJyArICc8Yj48Zm9udCBjb2xvcj1cXFxcXFxcIiMwOThBQzFcXFxcXFxcIj7iiLcgIOWJp+aDheeugOS7i1xcXFx0PC9mb250PjwvYj4nICsgXFxcXFxc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9uKG9iaikge1xcXFxuICAgICAgICAvL2xvZyhvYmopXFxcXG4gICAgICAgIHZhciBjb250ZW50cyA9IG9iai5tYWluO1xcXFxuICAgICAgICB2YXIgc29ydE9yZGVyID0gb2JqLnNvcnQ7XFxcXG4gICAgICAgIHZhciBpbWcgPSBvYmouaW1nO1xcXFxuICAgICAgICB2YXIgdGV4dHMgPSBjb250ZW50cy5tYXAoeCA9PiBwZGZoKHgsICdUZXh0JykpO1xcXFxuICAgICAgICBcXFxcbiAgICAgICAgdmFyIGFycmF5ID0gdGV4dHMuc29ydCgoYSwgYikgPT4ge1xcXFxuICAgICAgICAgICAgY29uc3QgaW5kZXhBID0gc29ydE9yZGVyLmluZGV4T2YoYS5zdWJzdHIoMCwgMikpO1xcXFxuICAgICAgICAgICAgY29uc3QgaW5kZXhCID0gc29ydE9yZGVyLmluZGV4T2YoYi5zdWJzdHIoMCwgMikpO1xcXFxuICAgICAgICAgICAgcmV0dXJuIGluZGV4QSAtIGluZGV4QjtcXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgdmFyIHJlZ2V4ID0gbmV3IFJlZ0V4cCgnKCcgKyBzb3J0T3JkZXIuam9pbignfCcpICsgJyknKTtcXFxcbiAgICAgICAgYXJyYXkgPSBhcnJheS5maWx0ZXIoZnVuY3Rpb24oaXRlbSkge1xcXFxuICAgICAgICAgICAgcmV0dXJuIHJlZ2V4LnRlc3QoaXRlbSk7XFxcXG4gICAgICAgIH0pO1xcXFxuICAgICAgICAvL2xvZyhhcnJheSlcXFxcbiAgICAgICAgXFxcXG4gICAgICAgIC8vYXJyYXkgPSBzb3J0T3JkZXIubGVuZ3RoPT0wP2FycmF5OnRoaXMuc3RyQ29udmVydChhcnJheSk7XFxcXG4gICAgICAgIGFycmF5ID0gdGhpcy5zdHJDb252ZXJ0KGFycmF5KTtcXFxcbiAgICAgICAgXFxcXG4gICAgICAgIGlmKGFycmF5Lmxlbmd0aD42KXtcXFxcbiAgICAgICAgICAgIGFycmF5PWFycmF5LnNsaWNlKDAsNik7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgXFxcXG4gICAgICAgIHZhciB0aXRsZXMgPSBbXTtcXFxcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxcXG4gICAgICAgIFxcXFxuICAgICAgICBzd2l0Y2ggKGFycmF5Lmxlbmd0aCkge1xcXFxuICAgICAgICAgICAgY2FzZSA0OlxcXFxuICAgICAgICAgICAgY2FzZSA1OlxcXFxuICAgICAgICAgICAgICAgIHRpdGxlcyA9IGFycmF5LnNsaWNlKDAsIDIpO1xcXFxuICAgICAgICAgICAgICAgIGRlc2NzID0gYXJyYXkuc2xpY2UoMik7XFxcXG4gICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICBjYXNlIDY6XFxcXG4gICAgICAgICAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMyk7XFxcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgzKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfaW5mbycse1xcXFxuICAgICAgICAgIGRlc2M6ZGVzY3Muam9pbignXFxcXFxcXFxuJyksXFxcXG4gICAgICAgICAgaW1nOmltZyxcXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiAgdGhpcy5zbWFsbCh0aXRsZXNbMF0gKyAnXFxcXFxcXFxuJyArdGl0bGVzLnNsaWNlKDEsIDMpLmpvaW4oJ1xcXFxcXFxcbicpLCdyZWQnKSxcXFxcbiAgICAgLy90aXRsZTogIHRoaXMuc21hbGwocGRmaChodG1sLCAnLmRhdGE6Y29udGFpbnMo5pu05pawKSYmVGV4dCcpICsgJ1xcXFxcXFxcbicgKyBwZGZoKGh0bWwsICcuZGF0YTpjb250YWlucyjnsbvlnospJiZUZXh0JyksJ3JlZCcpLFxcXFxuICAgICAgICAgZGVzYzogdGhpcy5zbWFsbChkZXNjcy5qb2luKCdcXFxcXFxcXG4nKSwnI0ZGN0YwMCcpLFxcXFxuICAgICAgLy9kZXNjOiB0aGlzLnNtYWxsKHBkZmgoaHRtbCwgJy5kYXRhOmNvbnRhaW5zKOWvvOa8lCkmJlRleHQnKSArICdcXFxcXFxcXG4nICsgcGRmaChodG1sLCAnLmRhdGE6Y29udGFpbnMo5Li75ryUKSYmVGV4dCcpLCcjRkY3RjAwJyksXFxcXG4gICAgIC8vZGVzYzogdGhpcy5zbWFsbChwZGZoKGh0bWwsICcuZGF0YTpjb250YWlucyjmm7TmlrApJiZUZXh0JyksJyNGRjdGMDAnKSxcXFxcbiAgICAgICAgICAgIHBpY191cmw6IGltZyArICdAUmVmZXJlcj0nLFxcXFxuICAgICAgICAgICAgdXJsOiBNWV9VUkwsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzFfdmVydGljYWxfcGljX2JsdXInLFxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICBpZiAob2JqLmRlc2MgIT0gdW5kZWZpbmVkKSB7XFxcXG4gICAgICAgICAgICB0aGlzLnNldERlc2Mob2JqLmRlc2MpO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSxcXFxcbiAgICBzZXRDdXN0b206IGZ1bmN0aW9uKG9iaiwgaW1nKSB7XFxcXG4gICAgICAgIHZhciBhcnJheSA9IFtdO1xcXFxuICAgICAgICBpZiAob2JqLmNvbnN0cnVjdG9yID09IEFycmF5KSB7XFxcXG4gICAgICAgICAgICBhcnJheSA9IG9iajtcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBhcnJheSA9IHRoaXMuc3RyQ29udmVydChhcnJheSk7XFxcXG4gICAgICAgIHZhciB0aXRsZXMgPSBbXTtcXFxcbiAgICAgICAgdmFyIGRlc2NzID0gW107XFxcXG4gICAgICAgIHN3aXRjaCAoYXJyYXkubGVuZ3RoKSB7XFxcXG4gICAgICAgICAgICBjYXNlIDQ6XFxcXG4gICAgICAgICAgICBjYXNlIDU6XFxcXG4gICAgICAgICAgICAgICAgdGl0bGVzID0gYXJyYXkuc2xpY2UoMCwgMik7XFxcXG4gICAgICAgICAgICAgICAgZGVzY3MgPSBhcnJheS5zbGljZSgyKTtcXFxcbiAgICAgICAgICAgICAgICBicmVhaztcXFxcbiAgICAgICAgICAgIGNhc2UgNjpcXFxcbiAgICAgICAgICAgICAgICB0aXRsZXMgPSBhcnJheS5zbGljZSgwLCAzKTtcXFxcbiAgICAgICAgICAgICAgICBkZXNjcyA9IGFycmF5LnNsaWNlKDMpO1xcXFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKCdlcl9pbmZvJyx7XFxcXG4gICAgICAgICAgZGVzYzpkZXNjcy5qb2luKCdcXFxcXFxcXG4nKSxcXFxcbiAgICAgICAgICBpbWc6aW1nLFxcXFxuICAgICAgICB9KVxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IHRpdGxlc1swXSArICdcXFxcXFxcXG4nICsgdGhpcy5zbWFsbCh0aXRsZXMuc2xpY2UoMSwgMykuam9pbignXFxcXFxcXFxuJykpLFxcXFxuICAgICAgICAgICAgZGVzYzogdGhpcy5zbWFsbChkZXNjcy5qb2luKCdcXFxcXFxcXG4nKSksXFxcXG4gICAgICAgICAgICBwaWNfdXJsOiBpbWcgKyAnQFJlZmVyZXI9JyxcXFxcbiAgICAgICAgICAgIHVybDogTVlfVVJMLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdtb3ZpZV8xX3ZlcnRpY2FsX3BpY19ibHVyJyxcXFxcbiAgICAgICAgfSlcXFxcbiAgICB9LFxcXFxuICAgIGlzQ29sb3I6ZnVuY3Rpb24odGV4dCkge1xcXFxuICAgICBjb25zdCByZWdleCA9IC9eIyhbMC05QS1GYS1mXXszfX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AgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICAgIHB1dE15VmFyKHZhcmkrJ2ZvbGQnLCcxJyk7XFxcXG4gICAgICAgICAgICAgIC8vcmV0dXJuICd0b2FzdDovL+WxleW8gOaJjeiDveaTjeS9nCc7XFxcXG4gICAgICAgICAgICAgICAgIH1lbHNle1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGxpc3QgPSBzdG9yYWdlMC5nZXRNeVZhcignZXJfcGxheWxpc3RzJywgJ3t9Jyk7XFxcXG4gICAgICAgICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgY29sID0gcGxpc3Rbc2hzb3J0XS5jb2xfdHlwZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIGNscyA9IHBsaXN0W3Noc29ydF0uY2xzO1xcXFxuICAgICAgICAgICAgICAgICAgICB2YXIgcGljPXBsaXN0W3Noc29ydF0ucGljO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcih2YXJpLCBpKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciB4bGlzdD1saXN0c1tpXTtcXFxcbiAgICAgICAgICAgICAgICBpZigkLmZ1bmMhPXVuZGVmaW5lZCYmJC5mdW5jLmNvbnN0cnVjdG9yPT1GdW5jdGlvbil7XFxcXG4gICAgICAgICAgICAgICAgICAgIHhsaXN0PSQuZnVuYyhpKTtcXFxcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihzaHNvcnQgKyAnX2xpc3QnLCB4bGlzdCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciBwbGF5cyA9IHhsaXN0Lm1hcCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB4LnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiB4LnVybCxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjb2wsXFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBwaWM6cGljLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogeC51cmwucmVwbGFjZSgvQGxhenlSdWxlW1xcXFxcXFxcc1xcXFxcXFxcU10rL2csICcnKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGNscyxcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHNoc29ydCArICdfc29ydCcpID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgICAgICBwbGF5cy5yZXZlcnNlKCk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciBwY2ZnPXN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCsnX3B1c2hjZmcnLCd7fScpO1xcXFxuICAgICAgICAgICAgICAgIGlmKHBjZmdbJ+WNleaOqCddKXtcXFxcbiAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaCcse1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTpwY2ZnWydvYmonXVsn5Y2V5o6oJ11bMF1cXFxcbiAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICBwY2ZnWyfljZXmjqgnXT1mYWxzZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgaWYocGNmZ1sn6YCJ5o6oJ10pe1xcXFxuICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShzaHNvcnQrJ19wdXNocycse1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTpwY2ZnWydvYmonXVsn6YCJ5o6oJ11bMF1cXFxcbiAgICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgICBwY2ZnWyfpgInmjqgnXT1mYWxzZTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0KydfcHVzaGNmZycscGNmZyk7XFxcXG4gICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKHNoc29ydCArICdfbGluZScsIHBsYXlzKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciB0YWJ4ID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXFxcbiAgICAgICAgICAgICAgICB0YWJ4LmZvckVhY2goKHgsIGlpKSA9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHZhciB0aXRsZSA9IHgudGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpID09IGlpKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHguZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUucmVwbGFjZSgvIyhcXFxcXFxcXHcrKT8vZywgbGluZWMpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZS5yZXBsYWNlKC8jKFxcXFxcXFxcdyspPy9nLCAnIycpLFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaIkOWKn++8gSc7XFxcXG4gICAgICAgICAgICB9LCB2YXJpLCBzaHNvcnQsIGksY3VzdG9tLue6v+i3r+mAieS4rSlcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgKGdldE15VmFyKHZhcmksICcwJykgPT0gaSA/IHRhYnNbaV0uZm9udGNvbG9yKGN1c3RvbS7nur/ot6/pgInkuK0pIDogdGFic1tpXS5mb250Y29sb3IoJyMnKSksXFxcXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCArICdfdGFiJyxcXFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfdGFiXycgKyBpLFxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIH0pXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIGNvbF90eXBlOidibGFua19ibG9jaycsIC8vJ2JsYW5rX2Jsb2NrJyxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfbGluZScsXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSxcXFxcbiAgICBwdXNoVGFiOmZ1bmN0aW9uKHZhcmksc2hzb3J0KXtcXFxcbiAgICAgIGFkZExpc3RlbmVyKCdvblJlZnJlc2gnLCAkLnRvU3RyaW5nKChz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VwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaHRvJywge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+aOqOmAgeacrOmhtT0+VFZCb3gnLFxcXFxuICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICBjbGVhck15VmFyKHNoc29ydCsnX2R1b3NlbGVjdCcpO1xcXFxuICAgICAgICAgICB9ZWxzZXtcXFxcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaHMnLHtcXFxcbiAgICAgICAgICAgICAgdGl0bGU6J+KAnOKAnOKAneKAnScrdGl0bGVzWzFdLFxcXFxuICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgIHBjZmdbJ+mAieaOqCddPXRydWU7XFxcXG4gICAgICAgICAgICBwY2ZnWyfljZXmjqgnXT1mYWxzZTtcXFxcbiAgICAgICAgICAgIHZhciBwbGF5bGlzdD1maW5kSXRlbXNCeUNscyhzaHNvcnQpO1xcXFxuICAgICAgICAgICAgcGNmZ1sncGxheWxpc3QnXT1wbGF5bGlzdDtcXFxcbiAgICAgICAgICAgIGxldCBJZHM9cGxheWxpc3QubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTtcXFxcbiAgICAgICAgICAgICAgICBJZHMuZm9yRWFjaCh4ID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gZmluZEl0ZW0oeCkudGl0bGU7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeCwge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkLm1zbSh0aXRsZSwgeCxzaHNvcnQpLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0KydfcHVzaCcse1xcXFxuICAgICAgICAgICAgICB0aXRsZTpwb2JqWyfljZXmjqgnXVswXSxcXFx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YWInXFxcXG4gICAgICAgICAgfVxcXFxuICAgICAgICB9LHtcXFxcbiAgICAgICAgICBjb2xfdHlwZTonYmxhbmtfYmxvY2snLFxcXFxuICAgICAgICAgIGV4dHJhOntcXFxcbiAgICAgICAgICAgIGNsczpzaHNvcnQrJ19wdXNodGFiJyxcXFxcbiAgICAgICAgICB9XFxcXG4gICAgICAgIH0pXFxcXG4gICAgfSxcXFxcbiAgICBzZXRMb25nY2xpY2s6ZnVuY3Rpb24oc2hzb3J0LGN1c3RvbSl7XFxcXG4gICAgICByZXR1cm4gW3t0aXRsZTon5qC35byP8J+OqCcsanM6ICQudG9TdHJpbmcoKHNoc29ydCk9PntcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGFsbF9jb2xzID0gWycnXS5jb25jYXQoZ2V0Q29sVHlwZXMoKSk7XFxcXG4gICAgICAgICAgICAgICAgICAgIGFsbF9jb2xzPWFsbF9jb2xzLmZpbHRlcih4PT5cXFxcbiAgICAgICAgICAgICAgICAgICAgICAvKHRleHRffGZsZXgpLiovLnRlc3QoeCkmJnghPSd0ZXh0X2ljb24nKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhhbGxfY29scylcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGNscyA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCd7fScpXFxcXG4gICAgICAgICAgICAgICAgICAgIHx8ICcnO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZihjbHNbc2hzb3J0XSE9Jycpe1xcXFxuICAgICAgICAgICAgICAgICAgICAgIGNvbD1jbHNbc2hzb3J0XS5jb2xfdHlwZTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgICAgICBsZXQg5oyJ6ZKu5qC35byPID0gYWxsX2NvbHMubWFwKChpdCkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGl0ID09PSBjb2wgPyAn8J+RiScgKyBpdDogaXQ7XFxcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgdGlwcyA9ICfor7fpgInmi6npgInpm4bmjInpkq7moLflvI8nO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJCjmjInpkq7moLflvI8sIDIsIHRpcHMpLnNlbGVjdCgoc2hzb3J0LGNscykgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQucmVwbGFjZSgv8J+RiS9nLCAnJyk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAvKnN0b3JhZ2UwLnNldEl0ZW0oJ+aMiemSruagt+W8jycsIGlucHV0KTsqL1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG9sZElkcyA9IChmaW5kSXRlbXNCeUNscyhzaHNvcnQpIHx8IFtdKS5tYXAoaXQ9Pml0LmV4dHJhLmlkKTsgLy/ogIHlhYPntKBpZHNcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9sZElkcy5mb3JFYWNoKHg9PiB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbSh4LCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBpbnB1dFxcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bey5YiH5o2i6YCJ6ZuG5oyJ6ZKu5qC35byP5Li6OicgKyBpbnB1dDtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSxzaHNvcnQsY2xzKTtcXFxcbiAgICAgICAgICAgICAgICB9LHNoc29ydCxjdXN0b20pfV1cXFxcbiAgICB9LFxcXFxuICAgIHNldFRhYnM6IGZ1bmN0aW9uKHRhYnMsIHZhcmksIHNoc29ydCxwYXJzZSkge1xcXFxuICAgICAgICBsZXQgY3VzdG9tPXBhcnNlLuiHquWumuS5iTtcXFxcbiAgICAgICAgY3VzdG9tID10aGlzLmdldFByZXNldChjdXN0b20pO1xcXFxuICAgICAgICBzaHNvcnQgPSBzaHNvcnQgPyBzaHNvcnQgOiAnc2hzb3J0JztcXFxcbiAgICAgICAgdmFyIHRpdGxlID0gKGdldE15VmFyKHNoc29ydCArICdfc29ydCcsICcwJykgPT0gJzEnKSA/ICc8Yj48c3BhbiBzdHlsZT1cXFxcXFxcImNvbG9yOiAnK2N1c3RvbS7pgIbluo/popzoibIrJ1xcXFxcXFwiPumAhuW6jzwvc3Bhbj48L2I+JyA6ICc8Yj48c3BhbiBzdHlsZT1cXFxcXFxcImNvbG9yOiAnK2N1c3RvbS7mraPluo/popzoibIrJ1xcXFxcXFwiPuato+W6jzwvc3Bhbj48L2I+J1xcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IHZhcmkgKyAnOicgKyB0aXRsZSxcXFxcbiAgICAgICAgICAgIGRlc2M6ICflhbEnICsgU3RyaW5nKHRhYnMubGVuZ3RoKS5mb250Y29sb3IoJyM0NjgyQjQnKSArICfmnaHnur/ot68nLFxcXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChzaHNvcnQsdmFyaSxjdXN0b20pID0+IHtcXFxcbiAgICAgICAgICAgICAgbGV0IGNvbmYgPSBnZXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcXFxuICAgICAgICAgICAgICBpZihnZXRNeVZhcignZXJfJyt2YXJpKydmb2xkJywnMScpPT0nMCcpe1xcXFxuICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bGV5byA5omN6IO95pON5L2cJztcXFxcbiAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgICAgIHZhciBjbHNsaXN0cyA9IGZpbmRJdGVtc0J5Q2xzKHNoc29ydCk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIG5ld2Nsc2xpc3QgPSAkLmRhdGFDb252ZXJ0KGNsc2xpc3RzKTtcXFxcbiAgICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgdmFyIHRpdGxlcz1bYCR7Y3VzdG9tLuato+W6j+minOiJsn1cXFxcXFxcIj7mraPluo9gLGAke2N1c3RvbS7pgIbluo/popzoibJ9XFxcXFxcXCI+6YCG5bqPYF07XFxcXG4gICAgICAgICAgICAgICBcXFxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICBuZXdjbHNsaXN0LnJldmVyc2UoKTtcXFxcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoc2hzb3J0ICsgJ19saW5lJywgbmV3Y2xzbGlzdCk7XFxcXG5cXFxcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgaWYgKGNvbmYgPT0gJzEnKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzFdLCB0aXRsZXNbMF0pLFxcXFxuICAgICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihzaHNvcnQgKyAnX3NvcnQnLCAnMCcpO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogb2JqLnRpdGxlLnJlcGxhY2UodGl0bGVzWzBdLC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cXFxcbiAgICAgICAgZC5wdXNoKHtcXFxcbiAgICAgICAgICAgIHRpdGxlOiBmb2xkID09PSAnMCcgPyDmipjlj6AgOiDlsZXlvIAsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChmb2xkbmFtZSxzaHNvcnQpID0+IHtcXFxcbiAgICAgICAgICAgICAgICB2YXIgIGZvbGQgPSBnZXRNeVZhcihmb2xkbmFtZSwgJzEnKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0KydfbGluZScpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBidG49ZmluZEl0ZW0oc2hzb3J0KydfYnV0dG9uJyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGZvbGRzPVsnPGZvbnQgY29sb3I9XFxcXFxcXCIjRDNEM0QzXFxcXFxcXCI+4pi3JywnPGZvbnQgY29sb3I9XFxcXFxcXCIjRkZBNTAwXFxcXFxcXCI+4piwJ107XFxcXG4gICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgaWYoZm9sZD09JzAnKXtcXFxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihmb2xkbmFtZSwgICcxJyk7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGNzID0gc3RvcmFnZTAuZ2V0TXlWYXIoc2hzb3J0ICsgJ19jbHMnKTtcXFxcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIob2JqLmV4dHJhLmlkLCBjcyk7XFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShidG4uZXh0cmEuaWQsIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGJ0bi50aXRsZS5yZXBsYWNlKGZvbGRzWzBdLCBmb2xkc1sxXSksXFxcXG4gICAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICBpZihmb2xkPT0nMScpe1xcXFxuICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoZm9sZG5hbWUsICAnMCcpO1xcXFxuICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgY3ggPSAkLmRhdGFDb252ZXJ0KHBjbHMpO1xcXFxuICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKHNoc29ydCArICdfY2xzJywgY3gpO1xcXFxuICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyhzaHNvcnQpO1xcXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oYnRuLmV4dHJhLmlkLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBidG4udGl0bGUucmVwbGFjZShmb2xkc1sxXSwgZm9sZHNbMF0pLFxcXFxuICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly8nICsgKGZvbGQgPT09ICcxJyA/ICfmlLbotbcnIDogJ+WxleW8gCcpO1xcXFxuICAgICAgICAgICAgfSwgZm9sZG5hbWUsc2hzb3J0KSxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgfSlcXFxcbiAgICAgICAgdGhpcy5jcmVhdGVQTGlzdCh0YWJzLHZhcmksc2hzb3J0LGN1c3RvbSk7XFxcXG4gICAgfSxcXFxcbiAgICBzZXRUYWJzMjogZnVuY3Rpb24odGFicywgdmFyaSwgc2hzb3J0LHBhcnNlLGV4cCkge1xcXFxuICAgICAgICBsZXQgY3VzdG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pIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxcXG4gICAgICAgICAgICB9XFxcXG5cXFxcbiAgICAgICAgICAgIHZhciBmb2xkID0gZ2V0TXlWYXIoZm9sZG5hbWUsICcxJyk7XFxcXG4gICAgICAgICAgICB2YXIgb2JqID0gZmluZEl0ZW0oc2hzb3J0ICsgJ19hdmF0YXInKVxcXFxuICAgICAgICAgICAgaWYgKGZvbGQgPT0gJzEnKSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIGJjbHMgPSBmaW5kSXRlbShzaHNvcnQgKyAnX2J1dHRvbicpO1xcXFxuICAgICAgICAgICAgICAgIHZhciB0Y2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0ICsgJ190YWInKTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgbGNscyA9IGZpbmRJdGVtKHNoc29ydCArICdfbGluZScpO1xcXFxuICAgICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgIHZhciBwY2xzID0gZmluZEl0ZW1zQnlDbHMoc2hzb3J0KTtcXFxcbiAgICAgICAgICAgICAgICB2YXIgY3MgPSBbYmNsc10uY29uY2F0KHRjbHMsIFtsY2xzXSwgcGNscyk7XFxcXG4gICAgICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICAgICAgaWYocHVzaCl7XFxcXG4gICAgICAgICAgICAgICAgICB2YXIgcGNscz1maW5kSXRlbXNCeUNscyhzaHNvcnQrJ19wdXNodGFiJyk7XFxcXG4gICAgICAgICAgICAgICAgICBjcz1wY2xzLmNvbmNhdChjcyk7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuXFxcXG4gICAgICAgICAgICAgICAgdmFyIGN4ID0gJC5kYXRhQ29udmVydChjcyk7XFxcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoc2hzb3J0ICsgJ19jbHMnLCBjeCk7XFxcXG4gICAgICAgICAgICAgICAgaWYocHVzaCl7XFx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RkE1MDBcXFxcXFxcIj7imLAnKSxcXFxcbiAgICAgICAgICAgICAgICB9KVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgcHV0TXlWYXIoZm9sZG5hbWUsIGZvbGQgPT09ICcxJyA/ICcwJyA6ICcxJyk7XFxcXG4gICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8vJyArIChmb2xkID09PSAnMScgPyAn5pS26LW3JyA6ICflsZXlvIAnKTtcXFxcbiAgICAgICAgfSwgZm9sZG5hbWUsIHNoc29ydCwocGFyc2VbJ+aOqOmAgSddP3RydWU6ZmFsc2UpKTtcXFxcbiAgICAgICAgdmFyIGRlc2MgPSAoZm9sZCA9PT0gJzAnID8g5oqY5Y+gIDog5bGV5byAKSArICdcXFxcXFxcXHQnO1xcXFxuICAgICAgICBcXFxcbiAgICAgICAgaWYoZXhwLmxlbmd0aD09MSl7XFxcXG4gICAgICAgICAgICB1cmw9J2hpa2VyOi8vZW1wdHknO1xcXFxuICAgICAgICAgICAgZGVzYz0nJztcXFxcbiAgICAgICAgfVxcXFxuICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgdGl0bGU6IHZhcmkgKyAnOlxcXFxcXFxcdFxcXFxcXFxcdCcgKyAn5YWxJyArIFN0cmluZyh0YWJzLmxlbmd0aCkuZm9udGNvbG9yKCcjNDY4MkI0JykgKyAn5p2h57q/6LevJyxcXFxcbiAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxcXG4gICAgICAgICAgICBpbWc6IGN1c3RvbS7lm77moIcsXFxcXG4gICAgICAgICAgICB1cmw6IHVybCxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYXZhdGFyJyxcXFxcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6dGhpcy5zZXRMb25nY2xpY2soc2hzb3J0KSxcXFx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XCI+5q2j5bqPYCxgJHtjdXN0b20u6YCG5bqP6aKc6ImyfVxcXFxcXFwiPumAhuW6j2BdO1xcXFxuICAgICAgICAgICAgICAgIFxcXFxuICAgICAgICAgICAgICAgIGlmIChjb25mID09ICcxJykge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1sxXSwgdGl0bGVzWzBdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzAnKTtcXFxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHNoc29ydCArICdfYnV0dG9uJywge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IG9iai50aXRsZS5yZXBsYWNlKHRpdGxlc1swXSwgdGl0bGVzWzFdKSxcXFxcbiAgICAgICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoc2hzb3J0ICsgJ19zb3J0JywgJzEnKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgLy9yZWZyZXNoUGFnZSgpXFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+WIh+aNouaOkuW6j+aIkOWKnydcXFxcbiAgICAgICAgICAgIH0sIHZhcmksIHNoc29ydCxjdXN0b20pLFxcXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgaWQ6IHNoc29ydCArICdfYnV0dG9uJyxcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICA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AgICAgICAgICAgIGxpc3QgPSBsaXN0c1tpbmRleF0ucmV2ZXJzZSgpO1xcXFxuICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgXFxcXG4gICAgICAgIGlmKOagt+W8jz09Jycpe1xcXFxuICAgICAgICAgIOagt+W8jz1saXN0Lmxlbmd0aCA+IDMgPyAndGV4dF80JyA6ICd0ZXh0XzInXFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgXFxcXG4gICAgICAgIGlmKGxpc3QubGVuZ3RoID4gMCl7XFxcXG4gICAgICAgIHZhciBwbGlzdCA9IHN0b3JhZ2UwLmdldE15VmFyKCdlcl9wbGF5bGlzdHMnLCAne30nKTtcXFxcbiAgICAgICAgaWYoIXBsaXN0Lmhhc093blByb3BlcnR5KHNoc29ydCkpe1xcXFxuICAgICAgICAgICAgIHBsaXN0W3Noc29ydF09e307XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgcGxpc3Rbc2hzb3J0XVsnY2xzJ109c2hzb3J0O1xcXFxuICAgICAgICBwbGlzdFtzaHNvcnRdWydjb2xfdHlwZSddPeagt+W8jztcXFxcbiAgICAgICAgcGxpc3Rbc2hzb3J0XVsncGljJ1095Zu+5qCHO1xcXFxuICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcignZXJfcGxheWxpc3RzJywgcGxpc3QpO1xcXFxuICAgICAgICB9ICAgXFxcXG4gICAgICAgIFxcXFxuICAgICAgICBcXFxcbiAgICAgICAgZm9yICh2YXIgaiBpbiBsaXN0KSB7XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBsaXN0W2pdLnRpdGxlLFxcXFxuICAgICAgICAgICAgICAgIHVybDogbGlzdFtqXS51cmwsXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IOagt+W8jyxcXFxcbiAgICAgICAgICAgICAgICBwaWM65Zu+5qCHLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBsaXN0W2pdLnVybC5yZXBsYWNlKC9AbGF6eVJ1bGVbXFxcXFxcXFxzXFxcXFxcXFxTXSsvZywgJycpLFxcXFxuICAgICAgICAgICAgICAgICAgICBjbHM6IHNoc29ydCxcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0sXFxcXG4gICAgZ2V0VGFiczogZnVuY3Rpb24ocGFyc2UpIHtcXFxcbiAgICAgICAgdmFyIHRhYnMgPSBbXTtcXFxcbiAgICAgICAgdmFyIGFydHMgPSBwZGZhKGh0bWwsIHBhcnNlLue6v+i3ryk7XFxcXG4gICAgICAgIHZhciDnur/ot6/lkI0gPSBwYXJzZS7nur/ot6/lkI3np7A7XFxcXG4gICAgICAgIHZhciDmm7/mjaLlh73mlbAgPSAnJztcXFxcbiAgICAgICAgaWYgKHBhcnNlLue6v+i3r+WQjeensC5pbmNsdWRlcygnQEAnKSkge1xcXFxuICAgICAgICAgICAg57q/6Lev5ZCNID0gcGFyc2Uu57q/6Lev5ZCN56ewLnNwbGl0KCdAQCcpWzBdO1xcXFxuICAgICAgICAgICAg5pu/5o2i5Ye95pWwID0gcGFyc2Uu57q/6Lev5ZCN56ewLnNwbGl0KCdAQCcpWzFdO1xcXFxuICAgICAgICB9XFxcXG4gICAgICAgIGZvciAodmFyIGkgaW4gYXJ0cykge1xcXFxuICAgICAgICAgICAgdmFyIGxpbmVuYW1lID0gcGRmaChhcnRzW2ldLCDnur/ot6/lkI0pO1xcXFxuICAgICAgICAgICAgaWYgKOabv+aNouWHveaVsCAhPSAnJykge1xcXFxuICAgICAgICAgICAgICAgIGxpbmVuYW1lID0gZXZhbCgnbGluZW5hbWUnICsg5pu/5o2i5Ye95pWwKTtcXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIHRhYnMucHVzaChsaW5lbmFtZSk7XFxcXG4gICAgICA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lcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdmFyIHVybCA9IHBkKGNvbnRzW2ldLCDpgInpm4bpk77mjqUpO1xcXFxuICAgICAgICAgICAgICAgIGlmICgh6YCJ6ZuG6ZO+5o6lLmluY2x1ZGVzKCdocmVmJykpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsID0gcGRmaChjb250c1tpXSwg6YCJ6ZuG6ZO+5o6lKTtcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgdGVtcC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBkZmgoY29udHNbaV0sIOmAiembhuWQjeensCksXFxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogdXJsICsg6Kej5p6QLFxcXFxuICAgICAgICAgICAgICAgIH0pXFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgbGV0IOWAkuW6jyA9IHBhcnNlLuWAkuW6jyA/IHBhcnNlLuWAkuW6jyA6IGZhbHNlO1xcXFxuICAgICAgICB2YXIgcmVzdWx0cyA9IGxpc3RzLmxlbmd0aCA/IGxpc3RzIDogW3RlbXBdO1xcXFxuICAgICAgICBpZiAo5YCS5bqPKSB7XFxcXG4gICAgICAgICAgICByZXN1bHRzID0gcmVzdWx0cy5tYXAoeCA9PiB4LnJldmVyc2UoKSk7XFxcXG4gICAgICAgIH1cXFxcbiAgICAgICAgdmFyIHBsaXN0ID0gc3RvcmFnZTAuZ2V0TXlWYXIoJ2VyX3BsYXlsaXN0cycsICd7fScpO1xcXFxuICAgICAgICBpZiAocmVzdWx0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcXFxuICAgICAgICAgICBpZighcGxpc3QuaGFzT3duUHJvcGVydHkoc2hzb3J0KSl7XFxcXG4gICAgICAgICAgICAgcGxpc3Rbc2hzb3J0XT17fTtcXFxcbiAgICAgICAgICAgfVxcX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G4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFicyh0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksaXRlbSk7XFxcXG4gICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuc2V0VGFiczIodGFicywgaXRlbS7nsbvlnossIHBsYXkgKyBpLGl0ZW0scGUpO1xcXFxuICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgIHB1dE15VmFyKCdlcl9odG1sJyxodG1sKTtcXFxcbiAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2VyX3VybCcsTVlfVVJMKTtcXFxcblxcXFxuICAgICAgICAgICAgICAgIHZhciBsaXN0cz1mdW5jKGdldE15VmFyKCdlcl8nK2l0ZW0u57G75Z6LLCcwJyksTVlfVVJMKTtcXFxcbiAgICAgICAgICAgIH1lbHNle1xcXFxuICAgICAgICAgICAgdmFyIGxpc3RzID0gdGhpcy5nZXRMaXN0cyhpdGVtLCBwbGF5K2kpO1xcXFxuICAgICAgICAgICAgXFxcXG4gICAgICAgICAgICBcXFxcbiAgICAgICAgICAgIGlmIChsaXN0cy5zb21lKHggPT4geC5sZW5ndGggPiAwKSkge1xcXFxuICAgICAgICAgICAgICAgIGlmIChtb2RlID09IDEpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzKHRhYnMsIGl0ZW0u57G75Z6LLCBwbGF5ICsgaSxpdGVtKTtcXFxcbiAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXRUYWJzMih0YWJzLCBpdGVtLuexu+WeiywgcGxheSArIGksaXRlbSxwZSk7XFxcXG4gICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBpZiAoZ2V0TXlWYXIoJ2VyXycgKyBpdGVtLuexu+WeiyArICdmb2xkJywgJzEnKSA9PSAnMScpIHtcXFxcbiAgICAgICAgICAgICAgICB0aGlzLnNldExpc3RzKGxpc3RzLCBnZXRNeVZhcignZXJfJytpdGVtLuexu+WeiywgJzAnKSwgcGxheSArIGksaXRlbSk7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICBkLnB1c2goe1xcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxcXG4gICAgICAgICAgICB9KVxcXFxuICAgICAgICB9KVxcXFxuICAgIH1cXFxcbn1cXFxcblxcXFxuXFxcXG5sZXQgTWV0aG9kcz17XFxcXG4gICAgLy/lpJrpgInmqKHlnZdcXFxcbiAgICBNdWx0aVNlbGVjdE1vZGU6ZnVuY3Rpb24obmFtZSxpZCxzaHNvcnQpe1xcXFxuICAgICAgICByZXR1cm4gJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZGF0YXRpdGxlLCBkYXRhdXJsLHNoc29ydCkgPT4ge1xcXFxuICAgICAgICAgICAgZnVuY3Rpb24gdW5pcXVlKGFycikge1xcXFxuICAgICAgICAgICAgY29uc3QgcmVzID0gbmV3IE1hcCgpXFxcXG4gICAgICAgICAgICByZXR1cm4gYXJyLmZpbHRlcigoYSkgPT4gIXJlcy5oYXMoYS51cmwpICYmIHJlcy5zZXQoYS51cmwsIDEpKVxcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgbGV0IGR1b3NlbGVjdCA9IHN0b3JhZ2UwLmdldE15VmFyKHNoc29ydCtcXFxcXFxcIl9kdW9zZWxlY3RcXFxcXFxcIikgPyBzdG9yYWdlMC5nZXRNeVZhcihzaHNvcnQrXFxcXFxcXCJfZHVvc2VsZWN0XFxcXFxcXCIpIDogW107XFxcXG4gICAgICAgICAgICBpZiAoZHVvc2VsZWN0LmZpbmRJbmRleCh4ID0+IHgudXJsID09PSBkYXRhdXJsKSA9PSAtMSkge1xcXFxuICAgICAgICAgICAgICAgIGR1b3NlbGVjdC5wdXNoKHtcXFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGRhdGF0aXRsZSxcXFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBkYXRhdXJsXFxcXG4gICAgICAgICAgICAgICAgfSlcXFxcbiAgICAgICAgICAgICAgICBkdW9zZWxlY3QgPSB1bmlxdWUoZHVvc2VsZWN0KVxcXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oZGF0YXVybCwge1xcXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogYOKAnOKAnOKAneKAnTxzcGFuIHN0eWxlPVxcXFxcXFwiY29sb3I6I0ZGNTczM1xcXFxcXFwiPmAgKyBkYXRhdGl0bGUsXFxcXG4gICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHJlbW92ZUJ5VmFsdWUoYXJyLCB2YWwpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBhcnIubGVuZ3RoOyBpKyspIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhcnJbaV1bJ3VybCddID09IHZhbCkge1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoaSwgMSk7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmVtb3ZlQnlWYWx1ZShkdW9zZWxlY3QsIGRhdGF1cmwpXFxcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShkYXRhdXJsLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBkYXRhdGl0bGVcXFxcbiAgICAgICAgICAgICAgICB9KTtcXFxc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XFxcL2luZGV4LnBocC4qP3ZlcmlmeT0vKVswXSArIEpTT04ucGFyc2UodmNvZGUpLnJldCwge1xcXFxuICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcXFxuICAgICAgICBtZXRob2Q6ICdQT1NUJ1xcXFxuICAgIH0pXFxcXG4gICAgdmFyIHl6ID0gTVlfVFlQRSA9PSAnaG9tZScgPyB0cnVlX3VybCA6IE1ZX1VSTFxcXFxuICAgIGxvZyhNWV9UWVBFKVxcXFxuICAgIGh0bWwgPSByZXF1ZXN0KHl6LCB7XFxcXG4gICAgICAgIC8vICAgaGVhZGVyczogaGVhZGVyc1xcXFxuICAgIH0pXFxcXG59XFxcXG5pZiAoL+mikee5geaTjeS9nC8udGVzdChodG1sKSkge1xcXFxuICAgIGQucHVzaCh7XFxcXG4gICAgdGl0bGU6ICfnvZHnq5nmkJzntKLml7bpl7Tpl7TpmpQnLFxcXFxuICAgIGRlc2M6IFxcXFxcXFwi5LiL5ouJ6YeN6K+VXFxcXFxcXCJcXFxcbn0pXFxcXG5cXFxcbn1cXFwifV1cIn0iLCJwaWNVcmwiOiJodHRwczovL2ltZzkuZG91YmFuaW8uY29tL3ZpZXcvcGhvdG8vbF9yYXRpb19wb3N0ZXIvcHVibGljL3AyODkyOTU2Nzc2LndlYnBAUmVmZXJlcj1odHRwczovL2ltZzkuZG91YmFuaW8uY29tLyIsInRpdGxlIjoi5bCB56We56ys5LiA6YOoIn0=
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement