Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@鸭先知@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi6bit5YWI55+lIiwiYXV0aG9yIjoiUiIsInVybCI6Imhpa2VyOi8vZW1wdHkjI2h0dHBzOi8vd3d3Lnl4emhpLmNvbS9hbmRyb2lkIyNmeXBhZ2UiLCJ2ZXJzaW9uIjoyMDIzMTExMiwiY29sX3R5cGUiOiJtb3ZpZV8xX2xlZnRfcGljIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxudmFyIGQgPSBbXTtcbmV2YWwoSlNPTi5wYXJzZShyZXF1ZXN0KCdoaWtlcjovL3BhZ2UvcmVwYWlyJykpLnJ1bGUpO1xuXG5hZGRMaXN0ZW5lcihcIm9uQ2xvc2VcIiwgJC50b1N0cmluZygoKSA9PiB7XG4gICAgbGV0IGtleXMgPSBsaXN0TXlWYXJLZXlzKCk7XG4gICAgZm9yIChsZXQgaXQgb2Yga2V5cykge1xuICAgICAgICBjbGVhck15VmFyKGl0KTtcbiAgICB9XG59KSk7XG52YXIgZ2V0UmFuZ2VDb2xvcnMgPSBmdW5jdGlvbigpIHvCoMKgwqDCoMKgwqDCoFxuICAgIHJldHVybiAnIycgKyAoJzAwMDAwJyArIChNYXRoLnJhbmRvbSgpICogMHgxMDAwMDAwIDw8IDApLnRvU3RyaW5nKDE2KSkuc3Vic3RyKC02KTvCoMKgwqDCoMKgXG59XG5jb25zdCDkuIvkuIDpobUgPSBcInBkKGh0bWwsICdhOm1hdGNoZXMo5LiL5LiA6aG1KSYmaHJlZicpXCI7XG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jAwMDBcXFwiKSArIFxcXCI8L2I+XFxcIixcXG4gICAgICAgIG9wZW46IHRydWUsXFxuICAgICAgICBzdGF0ZTogTVlfUlVMRS51cmwsXFxuICAgICAgICBzZWFyY2g6IGZhbHNlLFxcbiAgICAgICAgY2xlYXJzOiBbXSxcXG4gICAgICAgIGNsZWFyYWxsOiBbXFxcInlpX2ZpcnN0cGFnZVxcXCJdLFxcbiAgICAgICAgZGVidWc6IGZhbHNlLFxcblxcbiAgICAgICAg6aKE6K6+KHBhcmFtKSB7XFxuICAgICAgICAgICAgaWYgKHBhcmFtID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICBwYXJhbSA9IFtdO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBPYmplY3Qua2V5cyhwYXJhbSkuZm9yRWFjaCgocHJvcGVydHkpID0+IHtcXG4gICAgICAgICAgICAgICAgLy8g5a+55q+P5Liq5bGe5oCn5ZCN5omn6KGM5pON5L2cXFxuICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gcGFyYW1bcHJvcGVydHldOyAvLyDojrflj5blsZ7mgKflgLxcXG4gICAgICAgICAgICAgICAgLy8g5Zyo6L+Z6YeM5omn6KGM5oKo55qE5pON5L2cXFxuICAgICAgICAgICAgICAgIHRoaXNbcHJvcGVydHldID0gdmFsdWU7XFxuICAgICAgICAgICAgICAgIGlmICh0aGlzLmRlYnVnKSB7XFxuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhwcm9wZXJ0eSArIFxcXCI6XFxcIiArIHZhbHVlKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGV2YWxKU1J1bGUoaXRlbSxcXG4gICAgICAgICAgICBqc1J1bGUpIHtcXG4gICAgICAgICAgICBsZXQgcnVsZSA9IGpzUnVsZS5yZXBsYWNlKFxcXCJAanM6XFxcIixcXG4gICAgICAgICAgICAgICAgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIHJ1bGUgPSBydWxlLnRyaW0oKTtcXG4gICAgICAgICAgICAvL2xvZygkLnN0cmluZ2lmeShydWxlKSlcXG4gICAgICAgICAgICBsZXQgaW5wdXQgPSBpdGVtO1xcbiAgICAgICAgICAgIGlmIChydWxlLnN0YXJ0c1dpdGgoXFxcIihcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBldmFsKFxcXCJyZXN1bHQgPSBcXFwiICsgcnVsZSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgLyoqXFxuICAgICAgICAgICAgICAgICAqIOi/mOWOn+aIkCAkLnRvU3RyaW5nKC4uLikg55qE5pyA57uI57uT5p6c77yM6L6+5Yiw5pyA57uI5aSE55CG5pa55byP6Lef5LiK6Z2i55qEIGlmIOS4gOiHtOeahOebrueahFxcbiAgICAgICAgICAgICAgICAgKi9cXG4gICAgICAgICAgICAgICAgZXZhbChcXFwicmVzdWx0ID0gXFxcIiArIFxcXCIoKCkgPT4ge1xcXCIgKyBydWxlICsgXFxcIn0pKClcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHJlc3VsdCB8fCBcXFwiXFxcIjtcXG4gICAgICAgIH0sXFxuICAgICAgICBnZXRUaXRsZShzcmMsIGNhdGVnb3J5KSB7XFxuICAgICAgICAgICAgbGV0IHRpdGxlID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgbGV0IHRpdGxlUnVsZSA9IGNhdGVnb3J5IHx8IFxcXCJhJiZUZXh0XFxcIjtcXG4gICAgICAgICAgICBpZiAodGl0bGVSdWxlLnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICB0aXRsZSA9IHRoaXMuZXZhbEpTUnVsZShzcmMsIHRpdGxlUnVsZSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdGl0bGUgPSBwYXJzZURvbUZvckh0bWwoc3JjLCB0aXRsZVJ1bGUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdGl0bGUgfHwgXFxcIlxcXCI7XFxuICAgICAgICB9LFxcbiAgICAgICAgZ2V0VXJsKHNyYywgY2F0ZWdvcnkpIHtcXG4gICAgICAgICAgICBsZXQgdXJsID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgbGV0IHVybFJ1bGUgPSBjYXRlZ29yeS7pk77mjqUgfHwgXFxcImEmJmhyZWZcXFwiO1xcbiAgICAgICAgICAgIGlmICh1cmxSdWxlLnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICB1cmwgPSB0aGlzLmV2YWxKU1J1bGUoc3JjLCB1cmxSdWxlKTtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICB1cmwgPSBwZChzcmMsIHVybFJ1bGUpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAodHlwZW9mIGNhdGVnb3J5LumTvuaOpeWkhOeQhiA9PSBcXFwiZnVuY3Rpb25cXFwiKSB7XFxuICAgICAgICAgICAgICAgIHVybCA9IGNhdGVnb3J5LumTvuaOpeWkhOeQhih1cmwpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gdXJsIHx8IFxcXCJcXFwiO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGlzTnVsbChwYXJhbSkge1xcbiAgICAgICAgICAgIGlmIChwYXJhbSA9PSBudWxsKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XFxuICAgICAgICB9LFxcbiAgICAgICAgaXNCb29sZWFuKHZhcmlhYmxlKSB7XFxuICAgICAgICAgICAgaWYgKHR5cGVvZiB2YXJpYWJsZSAhPT0gXFxcImJvb2xlYW5cXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihcXFwi5byA5ZCv5oqY5Y+g6K+35Lyg5YWl5biD5bCU5YC8XFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSxcXG4gICAgICAgIOa4hemZpChsaXN0KSB7XFxuICAgICAgICAgICAgaWYgKHRoaXMuaXNOdWxsKGxpc3QpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAobGlzdC5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLmuIXpmaTmiqXplJk66K+35Lyg5YiX6KGoXFxcIik7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRoaXMuY2xlYXJzID0gbGlzdDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDlhajmuIUobGlzdCkge1xcbiAgICAgICAgICAgIGlmICh0aGlzLmlzTnVsbChsaXN0KSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdmFyIGMgPSB0aGlzLmNsZWFyYWxsO1xcbiAgICAgICAgICAgIGxpc3QgPSBjLmNvbmNhdChsaXN0KTtcXG4gICAgICAgICAgICB0aGlzLmNsZWFyYWxsID0gbGlzdDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDmupDnoIEoaW5wdXQpIHtcXG4gICAgICAgICAgICB0aGlzLmh0bWwgPSBpbnB1dDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDnlYzpnaIoaW5wdXQpIHtcXG4gICAgICAgICAgICB0aGlzLmxheW91dCA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOmhteeggShpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMucGFnZSA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIOeKtuaAgShpbnB1dCkge1xcbiAgICAgICAgICAgIHRoaXMuc3RhdGUgPSBpbnB1dDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDlvIDlkK/mkJzntKIoaW5wdXQpIHtcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIGlucHV0ID0gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy5zZWFyY2ggPSBpbnB1dDtcXG4gICAgICAgICAgICByZXR1cm4gdGhpcztcXG4gICAgICAgIH0sXFxuICAgICAgICDlvIDlkK/mipjlj6AoaW5wdXQpIHtcXG4gICAgICAgICAgICBpZiAoaW5wdXQgPT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgICAgIGlucHV0ID0gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgdGhpcy5pc0Jvb2xlYW4oaW5wdXQpO1xcbiAgICAgICAgICAgIHRoaXMub3BlbiA9IGlucHV0O1xcbiAgICAgICAgICAgIHJldHVybiB0aGlzO1xcbiAgICAgICAgfSxcXG4gICAgICAgIHNldFRpdGxlKGssIGksIHQpIHtcXG4gICAgICAgICAgICByZXR1cm4gayA9PSBpID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyB0LmZvbnRjb2xvcih0aGlzLuWIhuexu+minOiJsikgOiB0O1xcbiAgICAgICAgfSxcXG4gICAgICAgIGFjdGlvbihvYmopIHtcXG4gICAgICAgICAgICByZXR1cm4gW3tcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLmuIXpmaTnirbmgIFcXFwiLFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygob2JqKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsb2cob2JqKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIob2JqLnN0YXRlKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignY2F0ZV9idXR0b24nKTtcXG4gICAgICAgICAgICAgICAgICAgIG9iai5hbGwuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIG9iai5jbC5mb3JFYWNoKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfSwgb2JqKSxcXG4gICAgICAgICAgICB9LCBdO1xcbiAgICAgICAgfSxcXG4gICAgICAgIGNoZWNrUGFyYW0oKSB7XFxuICAgICAgICAgICAgdmFyIG9iaiA9IHt9O1xcbiAgICAgICAgICAgIGlmICh0aGlzLnBhZ2UgPT0gMCAmJiB0eXBlb2YgcGFnZSA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpemhteeggVxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgcGFnZSA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLpobXnoIFcXFwiXSA9IHRoaXMucGFnZTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFwi6aG156CBXFxcIl0gPSBwYWdlO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLmh0bWwgPT0gXFxcImVtcHR5XFxcIiAmJiB0eXBlb2YgaHRtbCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpea6kOeggVxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgaHRtbCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLmupDnoIFcXFwiXSA9IHRoaXMuaHRtbDtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIG9ialtcXFwi5rqQ56CBXFxcIl0gPSBodG1sO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLmxheW91dCA9PSBcXFwidW5kZWZpbmVkXFxcIiAmJiB0eXBlb2YgZCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXFxcIuivt+S8oOWFpeeVjOmdolxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgZCA9PSBcXFwidW5kZWZpbmVkXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLnlYzpnaJcXFwiXSA9IHRoaXMubGF5b3V0O1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgb2JqW1xcXCLnlYzpnaJcXFwiXSA9IGQ7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIG9iajtcXG4gICAgICAgIH0sXFxuICAgICAgICDliJvlu7rliqjmgIHliIbnsbsocnVsZU9iaikge1xcbiAgICAgICAgICAgIGxldCBpdGVtcyA9IFtdO1xcbiAgICAgICAgICAgIGxldCBjYXRlcyA9IFtdO1xcbiAgICAgICAgICAgIGlmIChydWxlT2JqID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICBydWxlT2JqID0gW107XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIC8v5Yid5aeL5YyW5Y+Y6YeP5byA5aeLXFxuICAgICAgICAgICAgY29uc3QgcGFyYW0gPSB0aGlzLmNoZWNrUGFyYW0oKTtcXG4gICAgICAgICAgICBjb25zdCBwYWdlID0gcGFyYW0u6aG156CBO1xcbiAgICAgICAgICAgIGNvbnN0IGh0bWwgPSBwYXJhbS7mupDnoIE7XFxuICAgICAgICAgICAgY29uc3QgZCA9IHBhcmFtLueVjOmdojtcXG4gICAgICAgICAgICBjb25zdCDnirbmgIEgPSB0aGlzLnN0YXRlO1xcbiAgICAgICAgICAgIGNvbnN0IHNlYXJjaCA9IHRoaXMuc2VhcmNoO1xcbiAgICAgICAgICAgIGNvbnN0IGVtcHR5ID0gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgIGNvbnN0IOaKmOWPoOeKtuaAgSA9IHRoaXMub3BlbjtcXG4gICAgICAgICAgICB2YXIg5bGV5byAID0gdGhpcy7lsZXlvIA7XFxuICAgICAgICAgICAgdmFyIOaKmOWPoCA9IHRoaXMu5oqY5Y+gO1xcbiAgICAgICAgICAgIHZhciDlhajmuIUgPSB0aGlzLmNsZWFyYWxsO1xcbiAgICAgICAgICAgIHZhciDmuIXpmaQgPSB0aGlzLmNsZWFycztcXG4gICAgICAgICAgICAvL+WIneWni+WMluWPmOmHj+e7k+adn1xcbiAgICAgICAgICAgIGxldCBpbml0X2NhdGUgPSBuZXcgQXJyYXkoMjApLmZpbGwoXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICBjb25zdCBmb2xkID0gZ2V0TXlWYXIoTVlfUlVMRS5ncm91cCwgXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICBjb25zdCBjYXRlX3RlbXAgPSBKU09OLnBhcnNlKFxcbiAgICAgICAgICAgICAgICBnZXRNeVZhcihcXFwiaGVhZC5jYXRlXFxcIiwgSlNPTi5zdHJpbmdpZnkoaW5pdF9jYXRlKSlcXG4gICAgICAgICAgICApO1xcbiAgICAgICAgICAgIGlmIChzZWFyY2ggJiYgcGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiJ2hpa2VyOi8vc2VhcmNoP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUgKyBcXFwiJnM9JytpbnB1dFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBcXFwi5pCc57Si5YWz6ZSu6K+NXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0VmFsdWU6IGdldE15VmFyKFxcXCJrZXl3b3JkXFxcIiwgXFxcIlxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2hhbmdlOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImtleXdvcmRcXFwiLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgY29uc3QgY2F0ZWdvcmllcyA9IFtdO1xcbiAgICAgICAgICAgIHJ1bGVPYmouZm9yRWFjaCgoeCkgPT4ge1xcbiAgICAgICAgICAgICAgICB2YXIgbGlzdCA9IFtdO1xcbiAgICAgICAgICAgICAgICAvL2xvZyh4KVxcbiAgICAgICAgICAgICAgICBpZiAoeC5qc29uICE9IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgICAgICAgICAgeC5qc29uLm1hcChrID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlZ29yaWVzLnB1c2goSlNPTi5zdHJpbmdpZnkoaykucmVwbGFjZSgvXlxcXFxbfFxcXFxdJC9nLCAnJykpXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgLy9jYXRlZ29yaWVzLnB1c2goeC5qc29uKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICh4LuS4gOe6p+WumuS9jSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu5LiA57qn5a6a5L2NLnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSB0aGlzLmV2YWxKU1J1bGUoaHRtbCwgeC7kuIDnuqflrprkvY0pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaXN0ID0gcGRmYShodG1sLCB4LuS4gOe6p+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaWYgKHgu5aSn57G75a6a5L2NKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoeC7lpKfnsbvlrprkvY0uc3RhcnRzV2l0aChcXFwiQGpzOlxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGlzdCA9IHRoaXMuZXZhbEpTUnVsZShodG1sLCB4LuWkp+exu+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxpc3QgPSBbcGRmYShodG1sLCB4LuWkp+exu+WumuS9jSkuam9pbignXFxcXG4nKV07XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy8tLemineWkluWkhOeQhi0tXFxuICAgICAgICAgICAgICAgIGlmICgoJ+WinuWKoCcgaW4geCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuWinuWKoC5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB4LuWinuWKoCA9IGV2YWwoeC7lop7liqApO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSB4LuWinuWKoC5jb25jYXQoc2xpc3QpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmICgoJ+ihpeWFhScgaW4geCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmICh4LuihpeWFhS5jb25zdHJ1Y3RvciA9PSBTdHJpbmcpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB4LuihpeWFhSA9IGV2YWwoeC7ooaXlhYUpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSBzbGlzdC5jb25jYXQoeC7ooaXlhYUpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIC8vLS3pop3lpJblpITnkIYtLVxcbiAgICAgICAgICAgICAgICB2YXIg5LiA57qnID0gbGlzdC5tYXAoKHMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBzbGlzdCA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCEoXFxcIuWwj+exu1xcXCIgaW4geCkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB4LuWwj+exuyA9IFxcXCJib2R5JiZhOm5vdCg6bWF0Y2hlcyjpppbpobUpKTpub3QoYTpub3QoW2hyZWZdKSlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHgu5bCP57G7LnN0YXJ0c1dpdGgoXFxcIkBqczpcXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNsaXN0ID0gdGhpcy5ldmFsSlNSdWxlKHMsIHgu5bCP57G7KTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2xpc3QgPSBwZGZhKHMsIHgu5bCP57G7KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHZhciDlrprkvY0gPSBzbGlzdC5tYXAoKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLmdldFRpdGxlKGl0ZW0sIHgu5qCH6aKYKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgdXJsID0gdGhpcy5nZXRVcmwoaXRlbSwgeCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIG9iaiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHVybFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KG9iaik7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiDlrprkvY07XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAvL2xvZyjkuIDnuqcpXFxuICAgICAgICAgICAgICAgIC8vbG9nKOS4gOe6py5sZW5ndGgpXFxuICAgICAgICAgICAgICAgIGlmICjkuIDnuqcubGVuZ3RoID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaCjkuIDnuqcuam9pbihcXFwiXFxcXG5cXFwiKSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICDkuIDnuqcuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMucHVzaChpdGVtLmpvaW4oXFxcIixcXFwiKSk7XFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL2xvZyhjYXRlZ29yaWVzKVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGlmICjmipjlj6DnirbmgIEpIHtcXG4gICAgICAgICAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgaXRlbXMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGZvbGQgPT09IFxcXCIxXFxcIiA/IOaKmOWPoCA6IOWxleW8gCxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICh0aXRsZSwgZm9sZCwgdSwgYWxsLCBleHBzKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZm9sZCA9IGdldE15VmFyKE1ZX1JVTEUuZ3JvdXAsIGZvbGQpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIFvlsZXlvIAsIOaKmOWPoF0gPSBleHBzO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZvbGQgPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBjeCA9IGZpbmRJdGVtc0J5Q2xzKHRpdGxlICsgJ2NhdGVfYnV0dG9uJyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2NhdGVfYnV0dG9uJywgY3gpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlbGV0ZUl0ZW1CeUNscyh0aXRsZSArICdjYXRlX2J1dHRvbicpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgY3ggPSBzdG9yYWdlMC5nZXRNeVZhcignY2F0ZV9idXR0b24nLCBbXSkubWFwKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB4Wydjb2xfdHlwZSddID0geFsnY29sX3R5cGUnXSA/IHhbJ2NvbF90eXBlJ10gOiB4Wyd0eXBlJ107XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB4O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcih0aXRsZSArICdjYXRlX2xpbmUnLCBjeClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qYWxsLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pOyovXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKHRpdGxlICsgJ2NhdGVfZXhwJywge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBmb2xkID09IDEgPyDlsZXlvIAgOiDmipjlj6AsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoTVlfUlVMRS5ncm91cCwgZm9sZCA9PT0gXFxcIjFcXFwiID8gXFxcIjBcXFwiIDogXFxcIjFcXFwiKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTVlfUlVMRS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9sZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAg54q25oCBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICDlhajmuIUsIFvlsZXlvIAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICDmipjlj6BcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICApLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9leHAnLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IHRoaXMuYWN0aW9uKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXRlOiDnirbmgIEsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGw6IOWFqOa4hSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsOiDmuIXpmaQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgICAgIGNhdGVnb3JpZXMuZm9yRWFjaCgoY2F0ZWdvcnksIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhjYXRlZ29yeSlcXG4gICAgICAgICAgICAgICAgICAgIGxldCBzdWJfY2F0ZWdvcmllcyA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgLyppZiAo5bCP57G75a6a5L2NLmluY2x1ZGVzKFxcXCI7XFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMgPSBwZGZhKGNhdGVnb3J5LCDlsI/nsbvlrprkvY0uc3BsaXQoXFxcIjtcXFwiKVswXSk7XFxuICAgICAgICAgICAgICAgICAgICAgIGlmIChzdWJfY2F0ZWdvcmllcy5sZW5ndGggPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gcGRmYShjYXRlZ29yeSwg5bCP57G75a6a5L2NLnNwbGl0KFxcXCI7XFxcIilbMV0pO1xcbiAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgeyovXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhpbmRleClcXG4gICAgICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzID0gSlNPTi5wYXJzZShgWyR7Y2F0ZWdvcnl9XWApO1xcbiAgICAgICAgICAgICAgICAgICAgLy9sb2coc3ViX2NhdGVnb3JpZXMpXFxuICAgICAgICAgICAgICAgICAgICAvLyBzdWJfY2F0ZWdvcmllcyA9IHBkZmEoY2F0ZWdvcnksIOWwj+exu+WumuS9jSk7XFxuICAgICAgICAgICAgICAgICAgICAvL31cXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbmRleCA9PT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIC8v5aSn57G7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3ViX2NhdGVnb3JpZXMuZm9yRWFjaCgoaXRlbSwga2V5KSA9PiB7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbGV0IHRpdGxlID0gcGRmaChpdGVtLCBf5aSn57G75qCH6aKYKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXRlbS50aXRsZTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLnJlcGxhY2UobmV3UmVnRXhwKOaOkumZpCwgXFxcImdcXFwiKSwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBqc29uID0gJydcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgcGFyYW1zID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2U6IHBhZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhcnM6IOa4hemZpCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbGV0IHVybCA9IHBkKGl0ZW0sIF/lpKfnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qaWYgKOWkp+exu+WkhOeQhikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybCA9IOS4gOe6p+WIhuexu+WkhOeQhih1cmwpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9Ki9cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2codXJsKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpdGVtcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aGlzLnNldFRpdGxlKGtleS50b1N0cmluZygpLCBjYXRlX3RlbXBbaW5kZXhdLCB0aXRsZSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKFxcXCJoaWtlcjovL2VtcHR5I25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBuZXdfY2F0ZSA9IFtdO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuYWxsY2xlYXJzLmZvckVhY2goKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoaXRlbSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdjYXRlX2J1dHRvbicpO1xcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wLmZvckVhY2goKGNhdGUsIGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuZXdfY2F0ZS5wdXNoKGluZGV4ID09PSAwID8gcGFyYW1zLmtleS50b1N0cmluZygpIDogXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoZWFkLmNhdGVcXFwiLCBKU09OLnN0cmluZ2lmeShuZXdfY2F0ZSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocGFyYW1zLmpzb24uY29uc3RydWN0b3IgPT09IE9iamVjdCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImR0X1xcXCIgKyBwYXJhbXMuanNvbi50eXBlLCBwYXJhbXMuanNvbi52YWx1ZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuc3RhdGUsIHBhcmFtcy5qc29uKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBNWV9SVUxFLnRpdGxlICsgJ2NhdGVfbGluZScsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy/lsI/nsbtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdWJfY2F0ZWdvcmllcy5mb3JFYWNoKChpdGVtLCBrZXkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGV4dHJhcG9zID0gZmFsc2U7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qaWYgKGl0ZW0uaW5jbHVkZXMoJ3R5cGU9XFxcIkBleHRyYVxcXCInKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhcG9zID0gdHJ1ZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZygn6ZmE5Yqg5a6a5L2NJylcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChleHRyYXBvcykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gcGRmaChpdGVtLCBcXFwiYSYmVGV4dFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiDmjpLpmaQgIT0gXFxcInVuZGVmaW5lZFxcXCIgJiYg5o6S6ZmkICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSB0aXRsZS5yZXBsYWNlKG5ldyBSZWdFeHAo5o6S6ZmkLCBcXFwiZ1xcXCIpLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIganNvbiA9IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBwZGZoKGl0ZW0sIFxcXCJhJiZzdGF0ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIFxcXCJhJiZ2YWx1ZVxcXCIpLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vdmFyIHRpdGxlID0gcGRmaChpdGVtLCDliIbnsbvmoIfpopgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRpdGxlID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Yg5o6S6ZmkICE9IFxcXCJ1bmRlZmluZWRcXFwiICYmIOaOkumZpCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gdGl0bGUucmVwbGFjZShuZXcgUmVnRXhwKOaOkumZpCwgXFxcImdcXFwiKSwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGpzb24gPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qc3dpdGNoICh0cnVlKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXCJAQEBcXFwiKTpcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAQFxcXCIpWzBdKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBwZGZoKGl0ZW0sIOWIhuexu+mTvuaOpS5zcGxpdChcXFwiQEBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhc2Ug5YiG57G76ZO+5o6lLmluY2x1ZGVzKFxcXCJAQFxcXCIpOlxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb24gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMF0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogcGRmaChpdGVtLCDliIbnsbvpk77mjqUuc3BsaXQoXFxcIkBAXFxcIilbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQ6XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAganNvbiA9IGl0ZW0udXJsO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGpzb24gPSBwZChpdGVtLCDliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSovXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uID0gaXRlbS51cmw7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvKnZhciBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEBAJyk/e1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdHlwZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVswXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTpwZGZoKGl0ZW0s5YiG57G76ZO+5o6lLnNwbGl0KCdAQEAnKVsxXSksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH06cGQoaXRlbSzliIbnsbvpk77mjqUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqc29uPeWIhuexu+mTvuaOpS5pbmNsdWRlcygnQEAnKT97XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlOuWIhuexu+mTvuaOpS5zcGxpdCgnQEAnKVswXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOnBkZmgoaXRlbSzliIbnsbvpk77mjqUuc3BsaXQoJ0BAJylbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OnBkKGl0ZW0s5YiG57G76ZO+5o6lKTsqL1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbXMgPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBpbmRleCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleToga2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzb246IGpzb24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdGF0ZTog54q25oCBLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYWxsY2xlYXJzOiDlhajmuIUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNhdGVzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRoaXMuc2V0VGl0bGUoa2V5LnRvU3RyaW5nKCksIGNhdGVfdGVtcFtpbmRleF0sIHRpdGxlKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiaGlrZXI6Ly9lbXB0eVxcXCIgKyBcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgocGFyYW1zKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5hbGxjbGVhcnMuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihpdGVtKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ2NhdGVfYnV0dG9uJyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXBbcGFyYW1zLmluZGV4XSA9IHBhcmFtcy5rZXkudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImhlYWQuY2F0ZVxcXCIsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHBhcmFtcy5qc29uLmNvbnN0cnVjdG9yID09PSBPYmplY3QpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJkdF9cXFwiICsgcGFyYW1zLmpzb24udHlwZSwgcGFyYW1zLmpzb24udmFsdWUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIocGFyYW1zLnN0YXRlLCBwYXJhbXMuanNvbik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcyksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IE1ZX1JVTEUudGl0bGUgKyAnY2F0ZV9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoZm9sZCA9PT0gXFxcIjFcXFwiIHx8IOaKmOWPoOeKtuaAgSA9PSBmYWxzZSkge1xcbiAgICAgICAgICAgICAgICBpdGVtcyA9IGl0ZW1zLmNvbmNhdChjYXRlcyk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChmb2xkID09PSBcXFwiMFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoJ2NhdGVfYnV0dG9uJywgY2F0ZXMpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0eXBlb2Ygc2V0UHJlUmVzdWx0ICE9ICd1bmRlZmluZWQnKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW1zID0gZC5jb25jYXQoaXRlbXMpO1xcbiAgICAgICAgICAgICAgICAvL+a4heepuue7p+aJv+aVsOe7hFxcbiAgICAgICAgICAgICAgICBkLmxlbmd0aCA9IDA7XFxuICAgICAgICAgICAgICAgIHNldFByZVJlc3VsdChpdGVtcyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaXRlbXMuZm9yRWFjaChpdGVtID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaChpdGVtKTtcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9LFxcbiAgICB9O1xcbiAgICBvYmou6aKE6K6+KG9wdGlvbnMpO1xcbiAgICByZXR1cm4gb2JqO1xcbn1cXG5cXG52YXIg54q25oCBID1cXG4gICAgdHlwZW9mIOeKtuaAgeagh+iusCAhPSBcXFwidW5kZWZpbmVkXFxcIiAmJiDnirbmgIHmoIforrAgIT0gXFxcIlxcXCIgPyDnirbmgIHmoIforrAgOiBNWV9SVUxFLnVybDtcXG5cXG5sZXQgZHRfZGVidWcgPSBmYWxzZTtcXG5cXG5hZGRMaXN0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fSBlbHNlIHtcXG4gICAgICAgICAgICBocmVmID0gcGQoaXRlbSwgcnVsZS51cmwpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaHJlZiA9IHJ1bGUuaW10ID8gaHJlZiArIFxcXCIjaW1tZXJzaXZlVGhlbWUjXFxcIiA6IGhyZWY7XFxuICAgICAgICByZXR1cm4gaHJlZjtcXG4gICAgfSxcXG4gICAgc2V0Q29udGVudDogZnVuY3Rpb24oaXRlbSwgaW5wdXQpIHtcXG4gICAgICAgIGxldCBvdXRwdXQgPSBcXFwiXFxcIjtcXG4gICAgICAgIGlmIChpbnB1dCA9PSB1bmRlZmluZWQpIHtcXG4gICAgICAgICAgICByZXR1cm4gb3V0cHV0O1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGlucHV0LnN0YXJ0c1dpdGgoXFxcInBkXFxcIikpIHtcXG4gICAgICAgICAgICBvdXRwdXQgPSBldmFsKGlucHV0KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgb3V0cHV0ID0gcGRmaChpdGVtLCBpbnB1dCk7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gb3V0cHV0O1xcbiAgICB9LFxcbiAgICByZWZyZXNoOiBmdW5jdGlvbigpIHtcXG4gICAgICAgIGFkZExpc3RlbmVyKFxcbiAgICAgICAgICAgIFxcXCJvblJlZnJlc2hcXFwiLFxcbiAgICAgICAgICAgICQudG9TdHJpbmcoKHUpID0+IHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwieWlsaXN0XFxcIik7XFxuICAgICAgICAgICAgICAgIC8vdmFyIHAgPSBzdG9yYWdlMC5nZXRNeVZhcignc3BhZ2UnLCAnJyk7XFxuICAgICAgICAgICAgICAgIC8vcHV0TXlWYXIodSwgcCk7XFxuICAgICAgICAgICAgfSwg54q25oCBKVxcbiAgICAgICAgKTtcXG4gICAgfSxcXG4gICAgZ2V0Qm9vbGVhblZhbHVlOiBmdW5jdGlvbih2YWx1Z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iAgJHtvYmoudXJsfWBcXG4gICAgICAgICk7XFxuICAgICAgICBsb2coJy0tLS0tLS0tLS0nICsgKGkgKyAxKSArICc66LCD6K+V57uT5p2fLS0tLS0tLS0tLScpO1xcbiAgICB9LFxcbiAgICBqc29uTGlzdDogZnVuY3Rpb24oYXJyLCBqc29uLCBydWxlKSB7XFxuICAgICAgICBpZiAoanNvbi5jb25zdHJ1Y3RvciAhPSBPYmplY3QpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBqc29uID0gSlNPTi5wYXJzZShqc29uKTtcXG4gICAgICAgICAgICB9IGNhdGNoIHt9XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoanNvbltydWxlLmxpc3RdID09IHVuZGVmaW5lZCkge1xcbiAgICAgICAgICAgIGFyci5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuaXoOWGheWuuTwvc21hbGw+PC9mb250PicsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge30sXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIGRlYnVnID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5kZWJ1ZywgZmFsc2UpO1xcbiAgICAgICAgdmFyIGVtcHR5ID0gdGhpcy5nZXRCb29sZWFuVmFsdWUocnVsZS5lbXB0eSk7XFxuICAgICAgICBpZiAoZGVidWcpIHtcXG4gICAgICAgICAgICBsb2coJ+WumuS9jeWIl+ihqDonICsgcnVsZS5saXN0KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGpzb25bcnVsZS5saXN0XS5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxuICAgICAgICAgICAgdmFyIHRpdGxlID0gZXZhbChydWxlLnRpdGxlKTtcXG4gICAgICAgICAgICB2YXIgZGVzYyA9IGV2YWwocnVsZS5kZXNjKTtcXG4gICAgICAgICAgICB2YXIgY29udGVudCA9IGV2YWwocnVsZS5jb250ZW50KTtcXG4gICAgICAgICAgICB2YXIgaW1nID0gZXZhbChydWxlLmltZykgKyBydWxlLnJlZjtcXG4gICAgICAgICAgICB2YXIgaHJlZiA9IGV2YWwocnVsZS51cmwpO1xcbiAgICAgICAgICAgIHZhciB1cmwgPSBydWxlLmltdCA/IGhyZWYgKyBcXFwiI2ltbWVyc2l2ZVRoZW1lI1xcXCIgOiBocmVmO1xcbiAgICAgICAgICAgIHZhciBsYXp5ID0gcnVsZS5sYXp5ID8gcnVsZS5sYXp5IDogXFxcIlxcXCI7XFxuXFxuICAgICAgICAgICAgdmFyIGRkID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgICAgIGNvbnRlbnQ6IGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgICAgICAgdXJsOiAoZW1wdHkgPyBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiA6ICcnKSArIHVybCxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9O1xcblxcbiAgICAgICAgICAgIGlmIChkZWJ1Zykge1xcbiAgICAgICAgICAgICAgICB2YXIgcnggPSB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIGRlc2MsXFxuICAgICAgICAgICAgICAgICAgICBpbWcsXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHRoaXMuZGVidWdsb2coaSwgaXRlbSwgcnVsZSwgcngpO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBpZiAobGF6eSAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICBkZFtcXFwidXJsXFxcIl0gPSBocmVmICsgbGF6eTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgYXJyLnB1c2goZGQpO1xcbiAgICAgICAgfSk7XFxuICAgIH0sXFxuICAgIHJ1bGVMaXN0OiBmdW5jdGlvbihhcnIsIGh0bWwsIHJ1bGUpIHtcXG4gICAgICAgIHZhciBsaXN0ID0gcGRmYShodG1sLFxcbiAgICAgICAgICAgIHJ1bGUubGlzdCk7XFxuICAgICAgICB2YXIgZGVidWcgPSB0aGlzLmdldEJvb2xlYW5WYWx1ZShydWxlLmRlYnVnLFxcbiAgICAgICAgICAgIGZhbHNlKTtcXG4gICAgICAgIHZhciBlbXB0eSA9IHRoaXMuZ2V0Qm9vbGVhblZhbHVlKHJ1bGUuZW1wdHkpO1xcbiAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgbG9nKCflrprkvY3liJfooag6JyArIHJ1bGUubGlzdCk7XFxuICAgICAgICB9XFxuICAgICAgICBsaXN0LmZvckVhY2goKGl0ZW0sIGkpID0+IHtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS50aXRsZSk7XFxuICAgICAgICAgICAgdmFyIGRlc2MgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS5kZXNjKTtcXG4gICAgICAgICAgICB2YXIgaW1nID0gdGhpcy5pbWdIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICAgICAgdmFyIHVybCA9IHRoaXMudXJsSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgICAgIHZhciBjb250ZW50ID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuY29udGVudCk7XFxuXFxuICAgICAgICAgICAgaWYgKGRlYnVnKSB7XFxuICAgICAgICAgICAgICAgIHZhciByeCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYyxcXG4gICAgICAgICAgICAgICAgICAgIGltZyxcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICB1cmxcXG4gICAgICAgICAgICAgICAgfTtcXG4gICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIHZhciBsYXp5ID0gcnVsZS5sYXp5ID8gcnVsZS5sYXp5IDogXFxcIlxcXCI7XFxuICAgICAgICAgICAgdmFyIGRkID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIGRlc2M6IGRlc2MsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgICAgICAgdXJsOiAoZW1wdHkgPyBcXFwiaGlrZXI6Ly9lbXB0eSMjXFxcIiA6ICcnKSArIHVybCxcXG4gICAgICAgICAgICAgICAgY29udGVudDogY29udGVudCxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIGlmIChsYXp5ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGRkW1xc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bShcXFwicGFnZW51bVxcXCIpO1xcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKFxcXCJwYWdlbGluZVxcXCIpO1xcbiAgICAgICAgICAgICAgICB2YXIgaWQgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgdmFyIGNscyA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICB2YXIgdGl0bGUgPSB0aGlzLnNldENvbnRlbnQoaXRlbSwgcnVsZS50aXRsZSk7XFxuICAgICAgICAgICAgICAgIHZhciBkZXNjID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuZGVzYyk7XFxuICAgICAgICAgICAgICAgIHZhciBkZXNjMSA9IHRoaXMuc2V0Q29udGVudChpdGVtLCBydWxlLmRlc2MxKTtcXG4gICAgICAgICAgICAgICAgdmFyIGltZyA9IHRoaXMuaW1nSGFuZGxlKGl0ZW0sIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICB2YXIgdXJsID0gdGhpcy51cmxIYW5kbGUoaXRlbSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgIHZhciBjb250ZW50ID0gdGhpcy5zZXRDb250ZW50KGl0ZW0sIHJ1bGUuY29udGVudCk7XFxuXFxuICAgICAgICAgICAgICAgIGlmIChkZWJ1Zykge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJ4ID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlc2MsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRlbnQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsXFxuICAgICAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5kZWJ1Z2xvZyhpLCBpdGVtLCBydWxlLCByeCk7XFxuICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgaWYgKGkgPT0gbGlzdC5sZW5ndGggLSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZCA9IFxcXCJsYXN0aWRfXFxcIiArIHBhZ2U7XFxuICAgICAgICAgICAgICAgICAgICBjbHMgPSBcXFwibGFzdG1hcmtcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBkZXNjICsgJ1xcXFx0XFxcXHRcXFxcdOmYheivu+aVsO+8micgKyBkZXNjMSxcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGltZyxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogKGVtcHR5ID8gXFxcImhpa2VyOi8vZW1wdHkjI1xcXCIgOiAnJykgKyB1cmwsXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IHJ1bGUuY29sX3R5cGUsXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGltZzogaW1nLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBpZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGNscyxcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBpZiAoaSA9PSBsaXN0Lmxlbmd0aCAtIDEgJiYgc2hvdykge1xcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBcXFwicGFnZWxpbmVcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ08c21hbGw+5Yqg6L295LitLi4uPC9zbWFsbD5cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJwYWdlbnVtXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwicGFnZW51bVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuWIsOW6leS6hjwvc21hbGw+PC9mb250PicsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJsYXN0XFxcIixcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChsaXN0Lmxlbmd0aCA9PSAwICYmIHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ08Zm9udCBjb2xvcj1cXFwiZ3JleVxcXCI+PHNtYWxsPuaXoOWGheWuuTwvc21hbGw+PC9mb250PicsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge30sXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAodGhpcy5uZXh0UGFnZSgpKSB7XFxuICAgICAgICAgICAgLy9sb2coJ3QnKTtcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcigneWlfaXNuZXh0JywgJ3QnKTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgLy9sb2coJ2YnKTtcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcigneWlfaXNuZXh0JywgJ2YnKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChhdXRvKSB7XFxuICAgICAgICAgICAgLy9jcmVhdGVOZXh0UGFnZSgpO1xcbiAgICAgICAgICAgIGF1dG9QYWdlKCk7XFxuICAgICAgICB9XFxuICAgIH0sXFxufTtcXG5cXG52YXIgZXh0TWV0aG9kID0ge1xcbiAgICBUb1BhcmFtczogZnVuY3Rpb24oKSB7XFxuICAgICAgICB2YXIganNvbiA9IGFyZ3VtZW50c1swXTtcXG4gICAgICAgIHJldHVybiBPYmplY3Qua2V5cyhqc29uKVxcbiAgICAgICAgICAgIC5tYXAoKGtleSkgPT4ga2V5ICsgXFxcIj1cXFwiICsganNvbltrZXldKVxcbiAgICAgICAgICAgIC5qb2luKFxcXCImXFxcIik7XFxuICAgIH0sXFxuICAgIHVybFBhcnNlOiBmdW5jdGlvbih1KSB7XFxuICAgICAgICB2YXIgZGljdCA9IHt9O1xcbiAgICAgICAgZGljdC5Tb3VyY2UgPSB1O1xcbiAgICAgICAgbGV0IHBhcmFtcyA9ICh1cmwpID0+IHtcXG4gICAgICAgICAgICBsZXQgcXVlcnlQYXJhbXMgPSB7fTtcXG4gICAgICAgICAgICBsZXQgcmVnID0gLyhbXj89Jl0rKT0oW14/PSZdKykvZztcXG4gICAgICAgICAgICB1cmwucmVwbGFjZShyZWcsIGZ1bmN0aW9uKCkge1xcbiAgICAgICAgICAgICAgICBxdWVyeVBhcmFtc1thcmd1bWVudHNbMV1dID0gYXJndW1lbnRzWzJdO1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHJldHVybiBxdWVyeVBhcmFtcztcXG4gICAgICAgIH07XFxuICAgICAgICB2YXIgamF2YVVybCA9IEphdmFJbXBvcnRlcihqYXZhLm5ldC5VUkwpO1xcbiAgICAgICAgd2l0aChqYXZhVXJsKSB7XFxuICAgICAgICAgICAgdmFyIHVybCA9IG5ldyBVUkwodSk7XFxuICAgICAgICAgICAgZGljdC5Qcm90b2NvbCA9IHVybC5nZXRQcm90b2NvbCgpO1xcbiAgICAgICAgICAgIGRpY3QuSG9zdCA9IHVybC5nZXRIb3N0KCk7XFxuICAgICAgICAgICAgZGljdC5Qb3J0ID0gdXJsLmdldFBvcnQoKTtcXG4gICAgICAgICAgICBkaWN0LkZpbGUgPSB1cmwuZ2V0RmlsZSgpO1xcbiAgICAgICAgICAgIGRpY3QuUGF0aCA9IHVybC5nZXRQYXRoKCk7XFxuICAgICAgICAgICAgZGljdC5SZWYgPSB1cmwuZ2V0UmVmKCk7XFxuICAgICAgICAgICAgZGljdC5Ib3N0cyA9IGAke2RpY3QuUHJvdG9jb2x9Oi8vJHt1cmwuZ2V0SG9zdCgpfWA7XFxuICAgICAgICB9XFxuICAgICAgICBkaWN0LlBhcmFtcyA9IHBhcmFtcyh1KTtcXG4gICAgICAgIHJldHVybiBkaWN0O1xcbiAgICB9LFxcbiAgICBpc0VxdWFsOiBmdW5jdGlvbih4LCB5KSB7XFxuICAgICAgICBjb25zdCBvayA9IE9iamVjdC5rZXlzLFxcbiAgICAgICAgICAgIHR4ID0gdHlwZW9mIHgsXFxuICAgICAgICAgICAgdHkgPSB0eXBlb2YgeTtcXG4gICAgICAgIHJldHVybiB4ICYmIHkgJiYgdHggPT09IFxcXCJvYmplY3RcXFwiICYmIHR4ID09PSB0eSA/XFxuICAgICAgICAgICAgb2soeCkubGVuZ3RoID09PSBvayh5KS5sZW5ndGggJiZcXG4gICAgICAgICAgICBvayh4KS5ldmVyeSgoa2V5KSA9PiB0aGlzLmlzRXF1YWwoeFtrZXldLCB5W2tleV0pKSA6IHggPT09IHk7XFxuICAgIH0sXFxuICAgIGZpbmREaWZmZXJlbnRJbmRleDogZnVuY3Rpb24oc3RyMSwgc3RyMikge1xcbiAgICAgICAgY29uc3QgZGlmZkNoYXJzID0gW107XFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHN0cjIubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICBpZiAoc3RyMVtpXSAhPT0gc3RyMltpXSkge1xcbiAgICAgICAgICAgICAgICBkaWZmQ2hhcnMucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICBpbmRleDogaSxcXG4gICAgICAgICAgICAgICAgICAgIHMxOiBzdHIxW2ldLFxcbiAgICAgICAgICAgICAgICAgICAgczI6IHN0cjJbaV0sXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBkaWZmQ2hhcnM7XFxuICAgIH0sXFxuICAgIHJlcGxhY2VDaGFyQXQ6IGZ1bmN0aW9uKHN0ciwgaW5kZXgsIHJlcGxhY2VtZW50KSB7XFxuICAgICAgICBpZiAoaW5kZXggPCAwIHx8IGluZGV4ID49IHN0ci5sZW5ndGgpIHtcXG4gICAgICAgICAgICByZXR1cm4gc3RyO1xcbiAgICAgICAgfVxcbiAgICAgICAgLy9sb2coaW5kZXgpXFxuICAgICAgICBjb25zdCBhcnIgPSBzdHIuc3BsaXQoXFxcIlxcXCIpO1xcbiAgICAgICAgYXJyW2luZGV4XSA9IHJlcGxhY2VtZW50O1xcbiAgICAgICAgcmV0dXJuIGFyci5qb2luKFxcXCJcXFwiKTtcXG4gICAgfSxcXG4gICAgZ2V0T2JqZWN0S2V5c0RpZmY6IGZ1bmN0aW9uKG9iajEsIG9iajIpIHtcXG4gICAgICAgIGNvbnN0IGRpZmZlcmVudEtleXMgPSBbXTtcXG4gICAgICAgIGZvciAobGV0IGtleSBpbiBvYmoxKSB7XFxuICAgICAgICAgICAgaWYgKCFvYmoyLmhhc093blByb3BlcnR5KGtleSkgfHwgb2JqMVtrZXldICE9PSBvYmoyW2tleV0pIHtcXG4gICAgICAgICAgICAgICAgZGlmZmVyZW50S2V5cy5wdXNoKGtleSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICAgICAgZm9yIChsZXQga2V5IGluIG9iajIpIHtcXG4gICAgICAgICAgICBpZiAoIW9iajEuaGFzT3duUHJvcGVydHkoa2V5KSkge1xcbiAgICAgICAgICAgICAgICBkaWZmZXJlbnRLZXlzLnB1c2goa2V5KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gZGlmZmVyZW50S2V5cztcXG4gICAgfSxcXG4gICAgZ2V0TmV4dFVybDogZnVuY3Rpb24oc291cmNlLCB0YXJnZXQsIHBhcmFtcykge1xcbiAgICAgICAgdmFyIHUxID0gdGhpcy51cmxQYXJzZShzb3VyY2UpO1xcbiAgICAgICAgdmFyIHUyID0gdGhpcy51cmxQYXJzZSh0YXJnZXQpO1xcbiAgICAgICAgdmFyIHBhID0gdW5kZWZpbmVkO1xcbiAgICAgICAgaWYgKHR5cGVvZiBwYXJhbXMgPT0gXFxcIm9iamVjdFxcXCIpIHtcXG4gICAgICAgICAgICBwYSA9IHBhcmFtcy5oYXNPd25Qcm9wZXJ0eShcXFwi54m55b6BXFxcIikgPyBwYXJhbXMu54m55b6BIDogdW5kZWZpbmVkO1xcbiAgICAgICAgfVxcbiAgICAgICAgdmFyIG5leHR1cmwgPSBzb3VyY2U7XFxuICAgICAgICB2YXIgY2EgPSBPYmplY3Qua2V5cyh1Mi5QYXJhbXMpLmxlbmd0aCA9PSAwID8gXFxcIlxcXCIgOiBcXFwiP1xcXCI7XFxuICAgICAgICBpZiAocGEgIT0gdW5kZWZpbmVkKSB7XFxuICAgICAgICAgICAgdmFyIHJzID0gU3RyaW5nKHUyLlBhdGgpLnJlcGxhY2UobmV3IFJlZ0V4cChwYSksIFxcXCIkMWZ5cGFnZVxcXCIpO1xcbiAgICAgICAgICAgIG5leHR1cmwgPSB1Mi5Ib3N0cyArIHJzICsgY2EgKyB0aGlzLlRvUGFyYW1zKHUyLlBhcmFtcyk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGlmICh0aGlzLmlzRXF1YWwodTEuUGFyYW1zLCB1Mi5QYXJhbXMpKSB7XFxuICAgICAgICAgICAgICAgIGlmIChkdF9kZWJ1Zykge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKHUxLlBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKHUyLlBhdGgpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHZhciBkZiA9IHRoaXMuZmluZERpZmZlcmVudEluZGV4KFN0cmluZyh1MS5QYXRoKSwgU3RyaW5nKHUyLlBhdGgpKTtcXG4gICAgICAgICAgICAgICAgaWYgKGR0X2RlYnVnKSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2coZGYpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGlmIChkZi5sZW5ndGggPT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgdmFyIHJlID0gZGZbMF0uaW5kZXg7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgZiA9IGRmLmZpbHRlcigoeCkgPT4gL1xcXFxkKy8udGVzdCh4LnMyKSk7XFxuICAgICAgICAgICAgICAgICAgICB2YXIgcmUgPSBmWzBdLmluZGV4O1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHZhciBlcSA9IHRoaXMucmVwbGFjZUNoYXJBdChTdHJpbmcodTIuUGF0aCksIHJlLCBcXFwiZnlwYWdlXFxcIik7XFxuICAgICAgICAgICAgICAgIG5leHR1cmwgPSB1Mi5Ib3N0cyArIGVxICsgY2EgKyB0aGlzLlRvUGFyYW1zKHUyLlBhcmFtcyk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgdmFyIGVwID0gdGhpcy5nZXRPYmplY3RLZXlzRGlmZih1MS5QYXJhbXMsIHUyLlBhcmFtcylcXG4gICAgICAgICAgICAgICAgaWYgKGVwLmxlbmd0aCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICB1MS5QYXJhbXNbZXBbMF1dID0gJ2Z5cGFnZSdcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhlcCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgdmFyIGVxID0gU3RyaW5nKHUxLlBhdGgpLnJlcGxhY2UoL1xcXFxkKy8sIFxcXCJmeXBhZ2VcXFwiKTtcXG4gICAgICAgICAgICAgICAgbmV4dHVybCA9IHUxLkhvc3RzICsgZXEgKyBjYSArIHRoaXMuVG9QYXJhbXModTEuUGFyYW1zKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICAvL2xvZygnbmV4dDonK25leHR1cmwpXFxuICAgICAgICByZXR1cm4gbmV4dHVybDtcXG4gICAgfSxcXG59O1xcblxcb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AgICAgICAgICAgIG5leHQgPSBcXFwiXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChuZXh0ICE9IFxcXCJcXFwiKSB7XFxuICAgICAgICAgICAgdmFyIG54dXJsID0gZXh0TWV0aG9kLmdldE5leHRVcmwodHJ1ZV91cmwsIG5leHQsIG9iaik7XFxuICAgICAgICAgICAgLy9sb2coXFxcIm54dXJsOlxcXCIgKyBueHVybCk7XFxuICAgICAgICAgICAgcHV0TXlWYXIo54q25oCBLCBueHVybCk7XFxuICAgICAgICAgICAgcHV0TXlWYXIoXFxcInlpX3BhZ2V1cmxcXFwiLCBueHVybCk7XFxuICAgICAgICB9XFxuICAgIH1cXG59XFxuXFxuZnVuY3Rpb24gYXV0b1BhZ2UoKSB7XFxuICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgIHB1dE15VmFyKFxcXCJ5aV9maXJzdHBhZ2VcXFwiLCB0cnVlX3VybCk7XFxuICAgIH1cXG4gICAgdHJ5IHtcXG4gICAgICAgIHZhciBuZXh0ID0gZXZhbCjkuIvkuIDpobUpO1xcbiAgICAgICAgLy9sb2coXFxcIm5leHRcXFwiKTtcXG4gICAgICAgIC8vbG9nKCduZXh0OicrbmV4dCk7XFxuICAgIH0gY2F0Y2gge1xcbiAgICAgICAgbG9nKFxcXCLlj6/og73kuI3lrZjlnKjkuIvkuIDpobXmiJbogIXkuIvkuIDpobXlrprkvY3mnInpl67pophcXFwiKTtcXG4gICAgICAgIG5leHQgPSBcXFwiXFxcIjtcXG4gICAgfVxcbiAgICBpZiAobmV4dCAhPSBcXFwiXFxcIikge1xcbiAgICAgICAgcHV0TXlWYXIo54q25oCBLCBuZXh0KTtcXG4gICAgfVxcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuino+aekFwiLFwicGF0aFwiOlwibGF6eVwiLFwicnVsZVwiOlwidmFyIGxhenkgPSAkKCcnKS5sYXp5UnVsZSgoTVlfSE9NRSxydW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AgICAgICAgbGlzdCA9IFt2YWx1ZV07XFxuICAgICAgICB9XFxuICAgICAgICBsaXN0LmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgdmFyIGluZGV4ID0geC5pbmRleE9mKFxcXCI9XFxcIik7XFxuICAgICAgICAgICAgdmFyIGtleSA9IHguc3Vic3RyaW5nKDAsIGluZGV4KS50cmltKCk7XFxuICAgICAgICAgICAgdmFyIHZhbHVlID0geC5zdWJzdHJpbmcoaW5kZXggKyAxKTtcXG4gICAgICAgICAgICBjb29raWVzW2tleV0gPSB2YWx1ZTtcXG4gICAgICAgIH0pXFxuICAgIH1cXG59KTtcXG5cXG5mdW5jdGlvbiBndWFyZCh1cmwsIGhlYWRvYmopIHtcXG4gICAgdmFyIGhlYWQgPSBoZWFkb2JqID8gaGVhZG9iajp7XFxuICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgQ29va2llOiBnZXRDb29raWUodXJsKSxcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICB2YXIgaHRtbCA9IGZldGNoQ29kZUJ5V2ViVmlldyh1cmwsIGhlYWQpO1xcbiAgICBpZiAoaHRtbC5pbmNsdWRlcygnX2d1YXJkL2F1dG8uanMnKSkge1xcbiAgICAgICAgZG9jdW1lbnRbXFxcImNvb2tpZVxcXCJdID0gZ2V0Q29va2llKHVybCk7XFxuICAgICAgICBldmFsKGZldGNoKGdldEhvbWUodXJsKSArICcvX2d1YXJkL2F1dG8uanMnKSlcXG4gICAgICAgIGh0bWwgPSBmZXRjaCh1cmwsIHtcXG4gICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgIENvb2tpZTogZG9jdW1lbnRbXFxcImNvb2tpZVxcXCJdLFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxuICAgIC8vbG9nKGRvY3VtZW50W1xcXCJjb29raWVcXFwiXSlcXG4gICAgcmV0dXJuIGh0bWxcXG59XCJ9XSIsImljb24iOiJodHRwczovL3d3dy55eHpoaS5jb20vd3AtY29udGVudC91cGxvYWRzLzIwMjMvMDYvZmF2aWNvbi0zNTB4MzAwLnBuZyIsInByb3h5IjoiIn0=
Add Comment
Please, Sign In to add comment