Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@本地资源管理@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi5pys5Zyw6LWE5rqQ566h55CGIiwiYXV0aG9yIjoiQExveURnSWsiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IiwidmVyc2lvbiI6OTAsImNvbF90eXBlIjoibW92aWVfM19tYXJxdWVlIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ0b29sIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6XG5cbmlmICghZ2V0SXRlbShcIjpzdGFydFVzZVwiLCBmYWxzZSkpIHtcbiAgICB0b2FzdChcIjotKeWIneasoeingemdou+8jOivt+WkmuWFs+eFp1wiKTtcbiAgICBjb25maXJtKHtcbiAgICAgICAgdGl0bGU6IFwi5L2/55So6aG755+lXCIsXG4gICAgICAgIGNvbnRlbnQ6IFwiMS7mma7pgJrnlKjmiLfvvJrmnKznqIvluo/lj6rmj5DkvpvmnKzlnLDpmIXor7vmnI3liqHvvIzkuI3mj5DkvpvnvZHnu5zlhoXlrrnjgIJcXG5cXG4yLuW8gOWPkeiAhe+8muaPkOS+m+Wkmue6v+eoi+S4i+i9veaUr+aMgeOAglxcblxcbjMu5aaC5L2V6I635Y+W5YaF5a65P1xcbumAmui/h+OAjOiBmua8q+OAjeOAjOmBk+mVv+WQiOmbhuOAjeetieesrOS4ieaWueWwj+eoi+W6j+S4i+i9veOAglwiLFxuICAgICAgICBjb25maXJtOiBcInNldEl0ZW0oJzpzdGFydFVzZScsJzEnKTtyZWZyZXNoUGFnZSgpOyd0b2FzdDovL+aEn+iwouaCqOeahOeQhuinoydcIixcbiAg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gICAgICAgICAgICByZXR1cm4gZG93bmxvYWQoY2hhcHRlclRlYW0sIGluZm8sIE1ZX0lEKSB8fCBcXFwidG9hc3Q6Ly/kuIvovb3plJnor69cXFwiO1xcbiAgICAgICAgfSwgY2hhcHRlclRlYW0sIGluZm8sIE1ZX0lEKSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBNWV9JRCArIFxcXCJ8fOW8gOWni+S4i+i9vVxcXCJcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi5Lu75Yqh5YiX6KGo77yaXFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwicmljaF90ZXh0XFxcIixcXG4gICAgfSk7XFxuICAgIGZvciAobGV0IGl0ZW0gb2YgY2hhcHRlclRlYW0pIHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCJcXG4gICAgICAgIH0pO1xcbiAgICB9XFxuXFxufSBlbHNlIHtcXG4gICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgdGl0bGU6IFxcXCLkuIvovb3ov5vluqY6MC9cXFwiK2NoYXB0ZXJUZWFtLmxlbmd0aCxcXG4gICAgICAgIGRlc2M6IFxcXCLigJzigJzigJ3igJ3ilofilofilofilofilofilofilofilofilofilodcXFwiLmZvbnRjb2xvcihcXFwiI2U1ZTFlNFxcXCIpK1xcXCIgMCVcXFwiLFxcbiAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwi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Inx85LiL6L295o6n5Yi2XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ato+WcqOWPlua2iOS4i+i9veS7u+WKoVxcXCI7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChzdGF0dXMgPT09IFxcXCIxXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5q2j5Zyo5pqC5YGcLi4uXFxcIjtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHN0YXR1cyA9PT0gXFxcIjJcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGJhY2soKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3sumAgOWHuuS4i+i9veWZqFxcXCI7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChbXFxcIjNcXFwiLCBcXFwiNFxcXCJdLmluY2x1ZGVzKHN0YXR1cykpIHtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihNWV9JRCArIFxcXCI6aXNTdGFydFxcXCIpO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKE1ZX0lEICsgXFxcIjpzdGF0dXNcXFwiKTtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhcihNWV9JRCArIFxcXCI6bG9nXFxcIik7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/ph43mlrDngrnlh7vkuIvovb1cXFwiXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSwgTVlfSUQpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBpZDogTVlfSUQgKyBcXFwifHzkuIvovb3mjqfliLZcXFwiXFxuICAgICAgICB9XFx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ICAgICAgIGxldCByYXRpbyA9IChjb3VudCAvIHRhc2tDb3VudCkudG9GaXhlZCg0KTtcXG4gICAgICAgICAgICBsZXQgc3RyaXBDb3VudCA9IE1hdGguY2VpbChyYXRpbyAqIDEwKTtcXG4gICAgICAgICAgICBpc1N1Y2Nlc3MgPSB0cnVlO1xcbiAgICAgICAgICAgIHVwZGF0ZUl0ZW0oe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuS4i+i9vei/m+W6pu+8mlxcXCIgKyBzdWNjZXNzQ0lELmxlbmd0aCArIFxcXCIvXFxcIiArIHRhc2tDb3VudCxcXG4gICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBcXFwi4paHXFxcIi5yZXBlYXQoc3RyaXBDb3VudCkuZm9udGNvbG9yKFxcXCIjZmZhYzJkXFxcIikgKyBcXFwi4paHXFxcIi5yZXBlYXQoMTAgLSBzdHJpcENvdW50KS5mb250Y29sb3IoXFxcIiNlNWUxZTRcXFwiKSArIFxcXCIgXFxcIiArIFN0cmluZygocmF0aW8gKiAxMDApKS5zbGljZSgwLCA1KSArIFxcXCIlXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBNWV9JRCArIFxcXCJ8fOS4i+i9vei/m+W6plxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIHB1dExvZyhcXFwiW2xpc3RlbmVyXeW3suWujOaIkOS4i+i9ve+8mlxcXCIgKyBpZCk7XFxuICAgICAgICB9IGVsc2UgaWYgKENJRCA9PT0gLTEpIHtcXG4gICAgICAgICAgICBmYWlsTmFtZS5wdXNoKGlkKTtcXG4gICAgICAgICAgICBwdXRMb2coXFxcIltsaXN0ZW5lcl3lt7LlgZzmraLvvJpcXFwiICsgaWQpO1xcbiAgICAgICAgICAgIGNvdW50ID0gdGFza0NvdW50O1xcbiAgICAgICA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CLkuIvovb3lpLHotKU6W1xcXCIgKyBmYWlsTmFtZS5qb2luKFxcXCJd77yMW1xcXCIpICsgXFxcIl3jgIJcXFwiKTtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCJb5aSE55CG5aSx6LSlXVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogTVlfSUQgKyBcXFwifHzkuIvovb3mjqfliLZcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSBpZiAoZmFpbFRlYW0ubGVuZ3RoID4gMCAmJiBzdGF0dXMgPT09IFxcXCIxXFxcIikge1xcbiAgICAgICAgICAgIHB1dE15VmFyKE1ZX0lEICsgXFxcIjpzdGF0dXNcXFwiLCBcXFwiNFxcXCIpO1xcbiAgICAgICAgICAgIHB1dExvZyhcXFwiW2xpc3RlbmVyXSPlt7LlgZzmraLmiYDmnInku7vliqHvvIzkvYblt7LmnInov5vluqbkuI3kvJrmtojlpLEjXFxcIik7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbSh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwiW+mHjeaWsOW8gOWni11cXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX0lEICsgXFxcInx85LiL6L295o6n5Yi2XFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJicmVha1xcXCI7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHB1dE15VmFyKE1ZX0lEICsgXFxcIjpzdGF0dXNcXFwiLCBcXFwiMlxcXCIpO1xcbiAgICAgICAgICAgIHB1dExvZyhcXFwi5LiL6L295Lu75YqhW1xcXCIgKyBpbmZvLmJvb2tOYW1lICsgXFxcIl3lt7Llhajpg6jmiJDlip/lrozmiJBcXFwiKTtcXG4gICAgICAgICAgICB1cGRhdGVJdGVtKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCJb6L+U5ZueXVxcXCIsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogTVlfSUQgKyBcXFwifHzkuIvovb3mjqfliLZcXFwiXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIHRvYXN0KFxcXCLkuIvovb3ku7vliqFbXFxcIiArIGluZm8uYm9va05hbWUgKyBcXFwiXeW3suWujOaIkFxcXCIpO1xcbiAgICB9XFxuICAgIGxldCB0YXNrVGVhbUNodW5rID0gW107XFxuICAgIGlmIChDb25maWcudGhyZWFkTnVtID4gMCkge1xcbiAgICAgICAgdGFza1RlYW1DaHVuayA9IFRvb2wuY2h1bmsodGFza1RlYW0sIENvbmZpZy50aHJlYWROdW0pO1xcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgdGFza1RlYW1DaHVuayA9IFt0YXNrVGVhbV07XFxuICAgIH1cXG4gICAgZm9yIChsZXQgdGFza0xpc3Qgb2YgdGFza1RlYW1DaHVuaykge1xcbiAgICAgICAgYmUodGFza0xpc3QsIHtcXG4gICAgICAgICAgICBmdW5jOiBsaXN0ZW5lclxcbiAgICAgICAgfSk7XFxuICAgICAgICBsZXQgc3RhdHVzID0gZ2V0TXlWYXIoTVlfSUQgKyBcXFwiOnN0YXR1c1xcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICBpZiAoc3RhdHVzID09PSBcXFwiMVxcXCIpIHtcXG4gICAgICAgICAgICBsZXQgYmF0Y2hUZWFtID0gSlNPTi5wYXJzZShnZXRNeVZhcihNWV9JRCArIFxcXCI6YmF0Y2hUZWFtXFxcIiwgXFxcIltdXFxcIikgfHwgXFxcIltdXFxcIik7XFxuICAgICAgICAg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V0IHBpYyA9IFRvb2wuaGlrZXJQaWModGFza1BhcmFtLnVybCk7XFxuICAgICAgICAgICAgICAgIFRvb2wucGljRG93bmxvYWQocGljWzBdLCB0YXNrUGFyYW0uY2hhcHRlclBhdGggKyAodGFza1BhcmFtLmkgKyAxKSArIFxcXCIuanBnXFxcIiwgcGljWzFdLCB0YXNrUGFyYW0uZGVjb2RlKTtcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKHRhc2tQYXJhbS5NWV9JRCArIFxcXCI6c3RhdHVzXFxcIiwgXFxcIlxcXCIpID09PSBcXFwiMVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAtMTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBlcnJvck51bSA9IDA7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgaWYgKGkgPT09IDkpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRocm93IGU7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gdGFza1BhcmFtLkNJRDtcXG4gICAgfVxcbiAgICBsZXQgY291bnQgPSAwO1xcbiAgICBsZXQgdG90YWxDb3VudCA9IDA7XFxuICAgIGxldCBzdWNjZXNzQ0lEID0gW107XFxuXFxuICAgIGZ1bmN0aW9uIGxpc3RlbmVyKHBhcmFtLCBpZCwgZXJyb3IsIHJlc3VsdCkge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICB0b3RhbENvdW50Kys7XFxuXFxuICAgICAgICAgICAgaWYgKGVycm9yICE9IG51bGwpIHtcXG4gICAgICAgICAgICAgICAgcHV0TG9nKFxcXCJbbGlzdGVuZXJd5LiL6L295aSx6LSl77yaXFxcIiArIGlkICsgXFxcIjxFUlJPUkAgXFxcIiArIGVycm9yICsgXFxcIj5cXFwiKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHJlc3VsdCA9PT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgcHV0TG9nKFxcXCJbbGlzdGVuZXJd5bey5YGc5q2i77yaXFxcIiArIGlkKTtcXG4gICAgICAgICAgICAgICAgdG90YWxDb3VudCA9IHBhcmFtLnBpdkNvdW50O1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGNvdW50Kys7XFxuICAgICAgICAgICAgICAgIGxldCByYXRpbyA9ICgoY291bnQgLyBwYXJhbS5waXZDb3VudCkpLnRvRml4ZWQoNCk7XFxuICAgICAgICAgICAgICAgIGxldCBzdHJpcENvdW50ID0gTWF0aC5jZWlsKHJhdGlvICogMTApO1xcbiAgICAgICAgICAgICAgICBpZiAocGFyYW0ucGl2Q291bnQgPT09IHRvdGFsQ291bnQgJiYgdG90YWxDb3VudCA9PT0gY291bnQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3NDSUQucHVzaChwYXJhbS5DSUQpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLkuIvovb3ov5vluqbvvJpcXFwiICsgKHN1Y2Nlc3NDSUQubGVuZ3RoKSArIFxcXCIvXFxcIiArIHBhcmFtLnRvdGFsLFxcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyBcXFwi4paHXFxcIi5yZXBlYXQoc3RyaXBDb3VudCkuZm9udGNvbG9yKFxcXCIjZmZhYzJkXFxcIikgKyBcXFwi4paHXFxcIi5yZXBlYXQoMTAgLSBzdHJpcENvdW50KS5mb250Y29sb3IoXFxcIiNlNWUxZTRcXFwiKSArIFxcXCIgXFxcIiArIFN0cmluZygocmF0aW8gKiAxMDApKS5zbGljZSgwLCA1KSArIFxcXCIlXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IE1ZX0lEICsgXFxcInx85LiL6L296L+b5bqmXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgLy9wdXRMb2coXFxcIltsaXN0ZW5lcl3lt7LlrozmiJDkuIvovb3vvJpcXFwiICsgaWQpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAodG90YWxDb3VudCAhPT0gcGFyYW0ucGl2Q291bnQpIHJldHVybjtcXG4gICAgICAgICAgICBpZiAodG90YWxDb3VudCA9PT0gY291bnQpIHtcXG4gICAgICAgICAgICAgICAgRmlsZS5yZW5hbWVGaWxlKHBhcmFtLmNoYXB0ZXJQYXRoLCBwYXJhbS5DSUQgKyBcXFwiJEEkXFxcIiArIFRvb2wudGV4dFNoaWVsZChwYXJhbS50aXRsZSkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB0b3RhbENvdW50ID0gY291bnQgPSAwO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiYnJlYWtcXFwiO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgfVxcbiAgICB9XFxuICAgIGxldCB0YXNrVGVhbSA9IFtdO1xcbiAgICBsZXQgbWFpblBhdGggPSBDb25maWcuY29taWNQYXRoICsgXFxcIi9cXFwiICsgaW5mby5ydWxlTmFtZSArIFxcXCIvXFxcIiArIFRvb2wudGV4dFNoaWVsZChpbmZvLmJvb2tOYW1lKSArIFxcXCIvXFxcIjtcXG4gICAgaWYgKGluZm8uYm9va1RvcFBpYykge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgYm9va1RvcFBpYyA9IFRvb2wuaGlrZXJQaWMoaW5mby5ib29rVG9wUGljKTtcXG4gICAgICAg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AgICAgIHB1dExvZyhcXFwiPOa8q+eUu+WbvueJh+ino+aekOmUmeivrz4gXFxcIiArIGUubWVzc2FnZSk7XFxuICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAocGljTGlzdC5sZW5ndGggPT09IDApIHtcXG4gICAgICAgICAgICBwdXRMb2coXFxcIjzmvKvnlLvlm77niYfop6PmnpDplJnor6/vvJrlm77niYfpk77mjqXov5Tlm57kuLrnqbo+XFxcIik7XFxuICAgICAgICAgICAgY29udGludWU7XFxuICAgICAgICB9XFxuICAgICAgICBwaWNMaXN0ID0gcGljTGlzdC5maWx0ZXIocCA9PiBwKTtcXG4gICAgICAgIHZhciB0YXNrVGVhbSA9IHBpY0xpc3QubWFwKCh1cmwsIGkpID0+ICh7XFxuICAgICAgICAgICAgZnVuYzogdGFzayxcXG4gICAgICAgICAgICBpZDogaSxcXG4gICAgICAgICAgICBwYXJhbToge1xcbiAgICAgICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICAgICAgaTogaSxcXG4gICAgICAgICAgICAgICAgY2hhcHRlclBhdGg6IGNoYXB0ZXJQYXRoLFxcbiAgICAgICAgICAgICAgICBNWV9JRDogTVlfSUQsXFxuICAgICAgICAgICAgICAgIGRlY29kZTogaW5mby5kZWNvZGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KSk7XFxuICAgICAgICBiZSh0YXNrVGVhbSwge1xcbiAgICAgICAgICAgIGZ1bmM6IGxpc3RlbmVyLFxcbiAgICAgICAgICAgIHBhcmFtOiB7XFxuICAgICAgICAgICAgICAgIHBpdkNvdW50OiBwaWNMaXN0Lmxlbmd0aCxcXG4gICAgICAgICAgICAgICAgdG90YWw6IGNoYXB0ZXJUZWFtLmxlbmd0aCxcXG4gICAgICAgICAgICAgICAgb3JkZXI6IG9yZGVyLFxcbiAgICAgICAgICAgICAgICBDSUQ6IGl0ZW0uQ0lELFxcbiAgICAgICAgICAgICAgICB0aXRsZTogaXRlb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emUpKTtcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiByZXN1bHQ7XFxuICAgIH0sXFxuICAgIGhpa2VyUGljKHVybCkge1xcbiAgICAgICAgdmFyIGhlYWRlcnMgPSB7fTtcXG4gICAgICAgIGxldCB1cmxzID0gdXJsLnNwbGl0KFxcXCJAXFxcIik7XFxuICAgICAgICBsZXQgcGljVXJsID0gdXJscy5zaGlmdCgpO1xcbiAgICAgICAgbGV0IGxlbmd0aCA9IHVybHMubGVuZ3RoO1xcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgIGxldCBba2V5LCB2YWx1ZV0gPSB2LnNwbGl0KHVybHNbaV0sIFxcXCI9XFxcIik7XFxuICAgICAgICAgICAgaWYgKGtleSA9PT0gXFxcImhlYWRlcnNcXFwiKSB7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKGhlYWRlcnMsIEpTT04ucGFyc2UodmFsdWUpKTtcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGtleS5pbmNsdWRlcyhcXFwiLlxcXCIpIHx8IGtleS5pbmNsdWRlcyhcXFwiP1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgIHBpY1VybCArPSBcXFwiQFxcXCIgKyBrZXkgKyAodmFsdWUgPyBcXFwiPVxcXCIgKyB2YWx1ZSA6IFxcXCJcXFwiKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGtleSAhPT0gXFxcImpzXFxcIikge1xcbiAgICAgICAgICAgICAgICBoZWFkZXJzW2tleV0gPSB2YWx1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gW3BpY1VybCwgaGVhZGVyc107XFxuICAgIH0sXFxuICAgIHJhbmdlKHN0YXJ0LCBlbmQpIHtcXG4gICAgICAgIHJldHVybiBBcnJheShlbmQgLSBzdGFydCkuZmlsbCgwKS5tYXAoKGVsLCBpKSA9PiBzdGFydCArIGkpO1xcbiAgICB9LFxcbiAgICBwaWNEb3dubG9hZCh1cmwsIHBhdGgsIGhlYWRlcnMsIGRlY2lwaGUpIHtcXG4gICAgICAgIGlmICh0eXBlb2YgZGVjaXBoZSA9PT0gXFxcInN0cmluZ1xcXCIgJiYgZGVjaXBoZS5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgbGV0IGluc3RyZWFtO1xcbiAgICAgICAgICAgIGxldCBvdXRzdHJlYW07XFxuICAgICAgICAgICAgbGV0IGZpbGU7XFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgZmlsZSA9IG5ldyBqYXZhLmlvLkZpbGUocGF0aCk7XFxuICAgICAgICAgICAgICAgIGlmIChmaWxlLmV4aXN0cygpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IGRpciA9IGZpbGUuZ2V0UGFyZW50RmlsZSgpO1xcbiAgICAgICAgICAgICAgICBpZiAoZGlyICE9IG51bGwgJiYgIWRpci5leGlzdHMoKSkge1xcbiAgICAgICAgICAgICAgICAgICAgZGlyLm1rZGlycygpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGluc3RyZWFtID0gZmV0Y2godXJsLCB7XFxuICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxcbiAgICAgICAgICAgICAgICAgICAgaW5wdXRTdHJlYW06IHRydWVcXG4gICAgICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgICAgIG91dHN0cmVhbSA9IG5ldyBqYXZhLmlvLkZpbGVPdXRwdXRTdHJlYW0ocGF0aCk7XFxuICAgICAgICAgICAgICAgIGxldCB0ID0gJC5oaWtlci5pbnB1dCxcXG4gICAgICAgICAgICAgICAgICAgIGMgPSAkLmhpa2VyLnVybDtcXG4gICAgICAgICAgICAgICAgJC5oaWtlci5pbnB1dCA9IGluc3RyZWFtO1xcbiAgICAgICAgICAgICAgICAkLmhpa2VyLnVybCA9IHVybDtcXG4gICAgICAgICAgICAgICAgbGV0IHBpY2luID0gKG5ldyBGdW5jdGlvbihcXFwicmV0dXJuIFxcXCIgKyBkZWNpcGhlKSkoKTtcXG4gICAgICAgICAgICAgICAgJC5oaWtlci5pbnB1dCA9IHQ7XFxuICAgICAgICAgICAgICAgICQuaGlrZXIudXJsID0gYztcXG4gICAgICAgICAgICAgICAgbGV0IGJ1ZiA9IGphdmEubGFuZy5yZWZsZWN0LkFycmF5Lm5ld0luc3RhbmNlKGphdmEubGFuZy5CeXRlLlRZUEUsIDEwMjQpO1xcbiAgICAgICAgICAgICAgICBsZXQgbGVuO1xcbiAgICAgICAgICAgICAgICB3aGlsZSAoKGxlbiA9IHBpY2luLnJlYWQoYnVmKSkgIT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgICAgIG91dHN0cmVhbS53cml0ZShidWYsIDAsIGxlbik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY2xvc2VNZShpbnN0cmVhbSk7XFxuICAgICAgICAgICAgICAgIGNsb3NlTWUob3V0c3RyZWFtKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgIGNsb3NlTWUoaW5zdHJlYW0pO1xcbiAgICAgICAgICAgICAgICBjbG9zZU1lKG91dHN0cmVhbSk7XFxuICAgICAgICAgICAgICAgIGlmIChmaWxlIGluc3RhbmNlb2YgamF2YS5pby5GaWxlICYmIGZpbGUuZXhpc3RzKCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGZpbGUuZGVsZXRlKCk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgIC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sIFxcXCJkaXJcXFwiKTtcXG4gICAgaWYgKHRhZy5sZW5ndGggPT09IDApIHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVfYmxhbmtcXFwiLFxcbiAgICAgICAgfSk7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLorr7nva5cXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9TZXR0aW5nLnZpZXcjbm9SZWZyZXNoIyNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICB2ZXJzaW9uOiBNWV9SVUxFLnZlcnNpb25cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOW4ruWKqeKAneKAnVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL2hlbHAudmlldyNub1JlZnJlc2gjI25vUmVjb3JkSGlzdG9yeSMjbm9IaXN0b3J5Iz9rZXl3b3JkPW5vdmVsQ29taWNcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6ICc8aDEgc3R5bGU9XFxcInRleHQtYWxpZ246IGNlbnRlcjtcXFwiPuWVpemDveayoeacieiAtjwvaDE+JyxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgcmV0dXJuIHNldFJlc3VsdChsYXlvdXQpO1xcbiAgICB9XFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIHVybDogJ1xcXCJoaWtlcjovL3NlYXJjaD9zPVxcXCIraW5wdXQnLFxcbiAgICAgICAgZGVzYzogXFxcIuaQnOS9oOaDs+imgeeahCNcXFwiICsgdHlwZSArIFxcXCIjLi4uLi4uXFxcIixcXG4gICAgICAgIHRpdGxlOiBcXFwi8J+UjVxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgcnVsZXM6ICQudG9TdHJpbmcoKHRhZywgdHlwZSkgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgYXJyMSA9IFtdO1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHRhZy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyMS5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwidGl0bGVcXFwiOiB0YWdbaV0ubmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwic2VhcmNoX3VybFxcXCI6IFxcXCJoaWtlcjovL2VtcHR5P2lzQWxsPTEmc2VhcmNoVGVybXM9KiomdHlwZT1cXFwiICsgdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwic2VhcmNoRmluZFxcXCI6IFxcXCJqczokLnJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9TZWFyY2gudmlldz9ydWxlPScrTVlfUlVMRS5fdGl0bGUpO1xcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShhcnIxKTtcXG4gICAgICAgICAgICB9LCB0YWcsIHR5cGUpLFxcbiAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoJ3NlYXJjaEtleScsICcnKSxcXG4gICAgICAgICAgICBvbkNoYW5nZTogXFxcInB1dE15VmFyKCdzZWFyY2hLZXknLGlucHV0KVxcXCJcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuXFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi4oCY4oCY4pqZ6K6+572u4oCZ4oCZXFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvU2V0dGluZy52aWV3I25vUmVmcmVzaCMjbm9SZWNvcmRIaXN0b3J5IyNub0hpc3RvcnkjXFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgdmVyc2lvbjogTVlfUlVMRS52ZXJzaW9uXFxuICAgICAgICB9XFxuICAgIH0pO1xcblxcblxcbiAgICBmb3IgKGxldCBpIGluIHRhZykge1xcbiAgICAgICAgbGV0IGl0ID0gdGFnW2ldO1xcbiAgICAgICAgaWYgKHRnbnVtID09PSBpKSB7XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnFxcXCIgKyBpdC5uYW1lICsgXFxcIuKAneKAnVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChbXFxcIuWIoOmZpOivpeebruW9lVxcXCIsIFxcXCLot7PovazlsI/nqIvluo9cXFwiLCBcXFwi5omT5byA5Lmm5p62XFxcIl0sIDEsIFxcXCLpgInmi6nmk43kvZxcXFwiKS5zZWxlY3QoKGl0LCB0eXBlKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoXFxcIui3s+i9rOWwj+eoi+W6j1xcXCIgPT09IGlucHV0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2hvbWVAXFxcIiArIGl0Lm5hbWU7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYoXFxcIuWIoOmZpOivpeebruW9lVxcXCI9PT1pbnB1dCl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gdGhlbihbXFxcIuivpeaTjeS9nOS4jeS8muWIoOmZpOWwj+eoi+W6j++8jOS9huivpeWwj+eoi+W6j+S4i+i9veeahOaJgOaciea8q+eUu+Wwhuiiq+WIoOmZpFxcXCJdKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwi6K+l5pON5L2c5LiN5Lya5Yig6Zmk5bCP56iL5bqP77yM5L2G6K+l5bCP56iL5bqP5LiL6L2955qE5omA5pyJIOa8q+eUuy/lsI/or7Qg5bCG6KKr5Yig6ZmkXFxcIikuY29uZmlybSgocGF0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBGaWxlID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvRmlsZS5qc1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoRmlsZS5kZWxldGVGaWxlcyhwYXRoKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiLnRnbnVtXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WIoOmZpOaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yig6Zmk5aSx6LSlXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0LnBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvQm9va3JhY2sudmlldz9ydWxlPeacrOWcsOi1hOa6kOeuoeeQhiZydWxlTmFtZT1cXFwiK2l0Lm5hbWUrXFxcIiZ0eXBlPVxcXCIrdHlwZTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgaXQsIHR5cGUpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0Lm5hbWUsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCIudGdudW1cXFwiLCBpKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICB9LCBpKSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICBsZXQgcGF0aCA9IHRhZ1t0Z251bV0ucGF0aDtcXG4gICAgbGV0IG1obGlzdCA9IEZpbGUuZ2V0RmlsZVBhdGgocGF0aCwgXFxcImRpclxcXCIpO1xcblxcbiAgICBpZiAobWhsaXN0Lmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdXFxcIiArIFxcXCLllaXpg73msqHmnInogLZcXFwiLmJpZygpLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gc2V0UmVzdWx0KGxheW91dCk7XFxuICAgIH1cXG4gICAgbGV0IHBhZ2VVcmwgPSB0eXBlID09PSBcXFwibm92ZWxcXFwiID8gXFxcImhpa2VyOi8vcGFnZS9Ob3ZlbEJyb3dzZXIudmlld1xcXCIgOiBcXFwiaGlrZXI6Ly9wYWdlL0NvbWljQnJvd3Nlci52aWV3XFxcIjtcXG4gICAgZm9yIChsZXQgaXRlbSBvZiBtaGxpc3QpIHtcXG4gICAgICAgIGxldCBwaWMgPSBmaWxlRXhpc3QoXFxcImZpbGU6Ly9cXFwiICsgaXRlbS5wYXRoICsgXFxcIi9cXFwiICsgaXRlbS5uYW1lICsgXFxcIi5qcGdcXFwiKSA/IGl0ZW0ucGF0aCArIFxcXCIvXFxcIiArIGl0ZW0ubmFtZSArIFxcXCIuanBnXFxcIiA6IENvbmZpZy5kZWZfUGljO1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBpdGVtLm5hbWUsXFxuICAgICAgICAgICAgcGljX3VybDogcGljLFxcbiAgICAgICAgICAgIHVybDogcGFnZVVybCArIFxcXCI/cnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZSxcXG4gICAgICAgICAgICBleHRyYTogT2JqZWN0LmFzc2lnbihpdGVtLCB7XFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICA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AgICAgICAgICAgICAgICBwYXRoOiBpdGVtLnBhdGgsXFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZ2V0VGl0bGUyKGl0ZW0ubmFtZSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICB9XFxuXFxufSBlbHNlIHtcXG4gICAgZm9yIChsZXQgaXRlbSBvZiBtaGxpc3QpIHtcXG4gICAgICAgIGxldCBuYW1lID0gZ2V0VGl0bGUyKGl0ZW0ubmFtZSk7XFxuICAgICAgICBhcnJheS5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogbmFtZSxcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIuehruiupOWIoOmZpFtcXFwiICsgbmFtZSArIFxcXCJd77yfXFxcIikuY29uZmlybSgocGF0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjb25zdCBGaWxlID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvRmlsZS5qc1xcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoRmlsZS5kZWxldGVGaWxlcyhwYXRoKSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yig6Zmk5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liKDpmaTlpLHotKVcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSwgaXRlbS5wYXRoKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogQ29uZmlnLmRlZl9WaWV3X1N0eWxlXFxuICAgICAgICB9KTtcXG4gICAgfVxcbn1cXG5pZiAoaXNSZXZlcnNlID09PSBcXFwiMVxcXCIpIHtcXG4gICAgYXJyYXkucmV2ZXJzZSgpO1x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H0sXFxuICAgICAgICAgICAgY29sX3R5cGU6IENvbmZpZy5kZWZfVmlld19TdHlsZVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG59IGVsc2Uge1xcbiAgICBmb3IgKGxldCBpdGVtIG9mIGNoYXB0ZXJMaXN0KSB7XFxuICAgICAgICBsZXQgbmFtZSA9IGdldFRpdGxlKGl0ZW0ubmFtZSk7XFxuICAgICAgICBhcnJheS5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogbmFtZSxcXG4gICAgICAgICAgICB1cmw6ICQoXFxcIuehruiupOWIoOmZpFtcXFwiICsgbmFtZSArIFxcXCJd77yfXFxcIikuY29uZmlybSgocGF0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjb25zdCBGaWxlID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvRmlsZS5qc1xcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoRmlsZS5kZWxldGVGaWxlcyhwYXRoKSkge1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yig6Zmk5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liKDpmaTlpLHotKVcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSwgaXRlbS5wYXRoKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogQ29uZmlnLmRlZl9WaWV3X1N0eWxlXFxuICAgICAgICB9KTtcXG4gICAgfVxcbn1cXG5pZiAoaXNSZXZlcnNlID09PSBcXFwiMVxcXCIpIHtcXG4gICAgYXJyYXkucmV2ZXJzZSgpO1xcbn1cXG5sYXlvdXQucHVzaC5hcHBseShsYXlvdXQsIGFycmF5KTtcXG5zZXRSZXN1bHQobGF5b3V0KTtcIn0se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AgICAgICAgIGJyZWFrO1xcbiAgICAgICAgY2FzZSBcXFwi5omT5byA5pa55byPXFxcIjpcXG4gICAgICAgICAgICByZXR1cm4gXFxcIm9wZW5GaWxlOi8vZmlsZTovL1xcXCIgKyBwYXRoO1xcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICB9XFxufVxcbmZvciAobGV0IHJ1bGVQYXRocyBvZiBydWxlbERpcikge1xcbiAgICBsZXQgbm92ZWxzID0gRmlsZS5nZXRGaWxlUGF0aChydWxlUGF0aHMucGF0aCwgXFxcImZpbGVcXFwiLCBcXFwiLnR4dFxcXCIpO1xcbiAgICBmb3IgKGxldCBub3ZlbCBvZiBub3ZlbHMpIHtcXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogbm92ZWwubmFtZSxcXG4gICAgICAgICAgICB1cmw6ICQoW1xcXCLliIbkuqtcXFwiLCBcXFwi5Yig6ZmkXFxcIiwgXFxcIua1t+mYlOmihOiniFxcXCIsIFxcXCLmiZPlvIDmlrnlvI9cXFwiXSwgMSkuc2VsZWN0KG9wZXJhdGlvbiwgbm92ZWwucGF0aCksXFxuICAgICAgICAgICAgZGVzYzogXFxcIuadpea6kO+8mlxcXCIgKyBydWxlUGF0aHMubmFtZSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgcGF0aDogbm92ZWwucGF0aFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICB9XFxufVxcbmlmIChsYXlvdXQubGVuZ3RoID09PSAwKSB7XFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiAnPGgxIHN0eWxlPVxcXCJ0ZXh0LWFsaWduOiBjZW50ZXI7XFxcIj7llaXpg73msqHmnInogLY8L2gxPicsXFxuICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCJcXG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UoY2FjaGUucGF0aCkgKyBcXFwiXFxcXG7mj4/ov7DvvJpcXFwiICsgKGtub3duTGlzdC5nZXQoY2FjaGUubmFtZSkgfHwgXFxcIuacquefpeebruW9lVvpo47pmanmnKrnn6VdXFxcIiksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCLnoa7orqTmuIXpmaQgXFxcIiArIGNhY2hlLm5hbWUgKyBcXFwiID9cXFwiKS5jb25maXJtKGNsZWFuQ2FjaGUsIGNhY2hlLnBhdGgpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLlhajpg6jmuIXpmaQoXFxcIiArIEZpbGUuZ2V0RmlsZVNpemUoQ29uZmlnLmhvbWVQYXRoKSArIFxcXCIpXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogJChcXFwi56Gu6K6k5riF6Zmk5YWo6YOo57yT5a2Y5pWw5o2uP1xcXCIpLmNvbmZpcm0oY2xlYW5DYWNoZSwgQ29uZmlnLmhvbWVQYXRoKVxcbiAgICAgICAgfSk7XFxuICAgICAgICBicmVhaztcXG4gICAgY2FzZSBcXFwiZGVmYXVsdFBpY1xcXCI6XFxuICAgICAgICBzZXRQYWdlVGl0bGUoXFxcIum7mOiupOWwgemdonzorr7nva5cXFwiKTtcXG4gICAgICAgIGlmIChnZXRNeVZhcihcXFwiOmRlZmF1bHRQaWNCYWNrXFxcIikpIHtcXG4gICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwiOmRlZmF1bHRQaWNCYWNrXFxcIik7XFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICB9XFxuXFxuICAgICAgICBmdW5jdGlvbiBzZXREZWZhdWx0UGljKHVybCkge1xcbiAgICAgICAgICAgIGxldCBDb25maWcgPSBKU09OLnBhcnNlKHJlYWRGaWxlKFxcXCJjb25maWcuanNvblxcXCIsIDApIHx8IFxcXCJ7fVxcXCIpO1xcbiAgICAgICAgICAgIENvbmZpZy5kZWZfUGljID0gdXJsO1xcbiAgICAgICAgICAgIHNhdmVGaWxlKFxcXCJjb25maWcuanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KENvbmZpZyksIDApO1xcbiAgICAgICAgICAgIGJhY2soKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5L+u5pS55oiQ5YqfXFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBzdGFydCA9IDE7XFxuICAgICAgICBpZiAodHlwZW9mKE1ZX05BTUUpICE9PSBcXFwidW5kZWZpbmVkXFxcIiAmJiBNWV9OQU1FID09PSBcXFwi5ZeF6KeJ5rWP6KeI5ZmoXFxcIikge1xcbiAgICAgICAgICAgIHN0YXJ0ID0gNDtcXG4gICAgICAgIH1cXG4gICAgICAgIGZvciAobGV0IGkgPSBzdGFydDsgaSA8PSA0OyBpKyspIHtcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5Zu+54mHXFxcIiArIGksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibW92aWVfM1xcXCIsXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IFxcXCJoaWtlcjovL2ltYWdlcy9ob21lX3BpY1xcXCIgKyBpLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoc2V0RGVmYXVsdFBpYywgXFxcImhpa2VyOi8vaW1hZ2VzL2hvbWVfcGljXFxcIiArIGkpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLoh6rlrprkuYninpVcXFwiLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG4gICAgICAgICAgICB1cmw6ICQoW1xcXCLoh6rlrprkuYl1cmxcXFwiLCBcXFwi6YCJ5oup5paH5Lu26Lev5b6EXFxcIl0pLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PT0gXFxcIuiHquWumuS5iXVybFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCJcXFwiLCBcXFwi6L6T5YWl5Zu+54mH55qE6Lev5b6E5oiW6ICF6ZO+5o6lXFxcIikuaW5wdXQoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBDb25maWcgPSBKU09OLnBhcnNlKHJlYWRGaWxlKFxcXCJjb25maWcuanNvblxcXCIsIDApIHx8IFxcXCJ7fVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIENvbmZpZy5kZWZfUGljID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoXFxcImNvbmZpZy5qc29uXFxcIiwgSlNPTi5zdHJpbmdpZnkoQ29uZmlnKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgYmFjaygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kv67mlLnmiJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcmVxdWlyZVVybCA9IFxcXCJodHRwOi8vaGlrZXIubm9raWEucHJlc3MvaGlrZXJ1bGUvcnVsZWxpc3QuanNvbj9pZD01MDk5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBmaWxlU2VsZWN0ID0gcmVxdWlyZShyZXF1aXJlVXJsKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBmaWxlU2VsZWN0LmZpbGVTZWxlY3Rpb25Vcmkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNhbGxiYWNrOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IENvbmZpZyA9IEpTT04ucGFyc2UocmVhZEZpbGUoXFxcImNvbmZpZy5qc29uXFxcIiwgMCkgfHwgXFxcInt9XFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIENvbmZpZy5kZWZfUGljID0gXFxcImZpbGU6Ly9cXFwiICsgUEFUSDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2F2ZUZpbGUoXFxcImNvbmZpZy5qc29uXFxcIiwgSlNPTi5zdHJpbmdpZnkoQ29uZmlnKSwgMCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCI6ZGVmYXVsdFBpY0JhY2tcXFwiLCBcXFwidHJ1ZVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/kv67mlLnmiJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVpcmVVcmw6IHJlcXVpcmVVcmwsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZmlsZVR5cGU6IFxcXCIuanBnfC5qcGVnfC5naWZ8LnBuZ3wuc3ZnfC5ibXBcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2tUeXBlOiBcXFwiY29uZmlybVxcXCIsXFxuICAgICA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y+W5paH5Lu25Li656m6XFxcIjtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBsZXQgbmV3UnVsZUxpc3QgPSBKU09OLnBhcnNlKHJ1bGVUZXh0KTtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGVMaXN0ID0gSlNPTi5wYXJzZShyZWFkRmlsZShcXFwicmVwbGFjZVJ1bGUuanNvblxcXCIpIHx8IFxcXCJbXVxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgbmV3Q291bnQgPSAwLFxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlQ291bnQgPSAwO1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpIGluIG5ld1J1bGVMaXN0KSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgbmV3UnVsZSA9IG5ld1J1bGVMaXN0W2ldO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKCFuZXdSdWxlLmhhc093blByb3BlcnR5KFxcXCJyZXBsYWNlbWVudFxcXCIpIHx8ICFuZXdSdWxlLmhhc093blByb3BlcnR5KFxcXCJwYXR0ZXJuXFxcIikgfHwgIW5ld1J1bGUuaGFzT3duUHJvcGVydHkoXFxcIm5hbWVcXFwiKSB8fCAobmV3UnVsZS5zY29wZUNvbnRlbnQgPT09IHVuZGVmaW5lZCA/IGZhbHNlIDogIW5ld1J1bGUuc2NvcGVDb250ZW50KSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IGlkID0gbmV3UnVsZS5pZDtcXG4gICAgICAgICAgICAgICAgICAgIG5ld1J1bGUuaWQgPSBpZCB8fCBuZXcgRGF0ZSgpLmdldFRpbWUoKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpZEluZGV4ID0gcnVsZUxpc3QuZmluZEluZGV4KHJ1bGUgPT4gcnVsZS5pZCA9PT0gaWQpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlkSW5kZXggPiAtMSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUNvdW50Kys7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcnVsZUxpc3Quc3BsaWNlKGlkSW5kZXgsIDEsIG5ld1J1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuZXdDb3VudCsrO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGVMaXN0LnB1c2gobmV3UnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgc2F2ZUZpbGUoXFxcInJlcGxhY2VSdWxlLmpzb25cXFwiLCBKU09OLnN0cmluZ2lmeShydWxlTGlzdCkpO1xcbiAgICAgICAgICAgICAgICBpZiAoaXNiYWNrKSB7XFxuICAgICAgICAgICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGxvZyhcXFwiXFxcXG7ot6/lvoTvvJpcXFwiICsgaW5wdXQgKyBcXFwiXFxcXG7mgLvop4TliJnmlbDvvJpcXFwiICsgbmV3UnVsZUxpc3QubGVuZ3RoICsgXFxcIlxcXFxu5pu05paw6KeE5YiZIFxcXCIgKyB1cGRhdGVDb3VudCArIFxcXCIg5p2hXFxcXHTmlrDlop7op4TliJkgXFxcIiArIG5ld0NvdW50ICsgXFxcIiDmnaFcXFwiKTtcXG4gICAgICAgICAgICAgICAgdG9hc3QoXFxcIuWvvOWFpeaIkOWKn1xcXCIpO1xcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICAgICAgICAgIGlmIChpc2JhY2spIGJhY2soKTtcXG4gICAgICAgICAgICAgICAgdG9hc3QoXFxcIuWvvOWFpeWksei0pVxcXCIpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuWvvOWFpeinhOWImVxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKFtcXFwi5aSW6YOo5paH5Lu2XFxcIiwgXFxcIuWGhemDqOaWh+S7tlxcXCJdLCAxLCBcXFwi6KeE5YiZ5a+85YWlXFxcIikuc2VsZWN0KChpbXBvcnRSdWxlKSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCA9PT0gXFxcIuWklumDqOaWh+S7tlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiZmlsZVNlbGVjdDovL1xcXCIgKyAkLnRvU3RyaW5nKGltcG9ydFJ1bGUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJlcXVpcmVVcmwgPSBcXFwiaHR0cDovL2hpa2VyLm5va2lhLnByZXNzL2hpa2VydWxlL3J1bGVsaXN0Lmpzb24/aWQ9NTA5OVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZmlsZVNlbGVjdCA9IHJlcXVpcmUocmVxdWlyZVVybCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmlsZVNlbGVjdC5maWxlU2VsZWN0aW9uVXJpKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogJC50b1N0cmluZyhpbXBvcnRSdWxlLCB0cnVlKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1aXJlVXJsOiByZXF1aXJlVXJsLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZpbGVUeXBlOiBcXFwiLmpzb25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIG9uQ2xpY2tUeXBlOiBcXFwiY29uZmlybVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgbWVtb3J5OiBcXFwic2VsZWN0UGF0aENhY2hlXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCBpbXBvcnRSdWxlKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZV9ibGFua1xcXCJcXG4gICAgICAgIH0pO1xcbiAgICAgICAgZm9yIChsZXQgaSA9IDAsIGxlbiA9IHJ1bGVMaXN0Lmxlbmd0aDsgaSA8IGxlbjsgaSsrKSB7XFxuICAgICAgICAgICAgbGV0IHJlcGxhY2VSdWxlID0gcnVsZUxpc3RbaV07XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogcmVwbGFjZVJ1bGUubmFtZSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzFcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL2VtcHR5XFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiLlxcXCIgKyBpLFxcbiAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpZCwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHZhciBydWxlTGlzdCA9IEpTT04ucGFyc2UocmVhZEZpbGUoXFxcInJlcGxhY2VSdWxlLmpzb25cXFwiKSB8fCBcXFwiW11cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBnID0gcnVsZUxpc3Quc3BsaWNlKGluZGV4LCAxKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgIHNhdmVGaWxlKFxcXCJyZXBsYWNlUnVsZS5qc29uXFxcIiwgSlNPTi5zdHJpbmdpZnkocnVsZUxpc3QpKTtcXG4gICAgICAgICAgICAgICAgICAgIC8vZGVsZXRlSXRlbUJ5Q2xzKGlkICsgXFxcIi5cXFwiICsgaW5kZXgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcIuWIoOmZpOaIkOWKn1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgfSwgaWQsIGkpLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBpZCArIFxcXCIuXFxcIiArIGlcXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIue8lui+kVxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9lZGl0UmVwbGFjZVJ1bGUudmlldyNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSMjbm9SZWZyZXNoIz9pbmRleD1cXFwiICsgaSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzJcXFwiLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBpZCArIFxcXCIuXFxcIiArIGlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIixcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogaWQgKyBcXFwiLlxcXCIgKyBpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgICAgIGJyZWFrO1xcbiAgICBjYXNlIFxcXCJjb250ZW50c1xcXCI6XFxuICAgICAgICBsZXQgZiA9IHJlcXVpcmUoXFxcImh0dHA6Ly9oaWtlci5ub2tpYS5wcmVzcy9oaWtlcnVsZS9ydWxlbGlzdC5qc29uP2lkPTUwOTlcXFwiKTtcXG4gICAgICAgIHNldFBhZ2VUaXRsZShcXFwi55uu5b2V6K6+572ufOiuvue9rlxcXCIpO1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi6YCJ5oup5paH5Lu25aS5XFxcIixcXG4gICAgICAgICAgICB1cmw6IEpTT04uc3RyaW5naWZ5KGYuZmlsZVNlbGVjdGlvblVyaSh7XFxuICAgICAgICAgICAgICAgIGNhbGxiYWNrOiAkLnRvU3RyaW5nKChpZCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRhcmdldCA9IGZpbmRJdGVtKGlkKS5leHRyYTtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYTogT2JqZWN0LmFzc2lnbih0YXJnZXQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZhbHVlOiBQQVRIXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XFxuICAgICAgICAgICAgICAgIH0sIGlkKSxcXG4gICAgICAgICAgICAgICAgaW5pdGlhbFBhdGg6IENvbmZpZy5ob21lUGF0aCxcXG4gICAgICAgICAgICAgICAgcmVxdWlyZVVybDogXFxcImh0dHA6Ly9oaWtlci5ub2tpYS5wcmVzcy9oaWtlcnVsZS9ydWxlbGlzdC5qc29uP2lkPTUwOTlcXFwiLFxcbiAgICAgICAgICAgICAgICBwYXR0ZXJuOiAxXFxuICAgICAgICAgICAgfSkpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgICAgIGRlc2M6IFxcXCLmlK/mjIFoaWtlcjovL2ZpbGVz6Lev5b6EKOivpeaTjeS9nOS4jeS8muWIneWni+WMluebruW9lSlcXFwiLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogQ29uZmlnLmhvbWVQYXRoLFxcbiAgICAgICAgICAgICAgICBvbkNoYW5nZTogJC50b1N0cmluZygoaWQpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKGlkLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIH0sIGlkKSxcXG4gICAgICAgICAgICAgICAgaWQ6IGlkXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lX2JsYW5rXFxcIlxcbiAgICAgICAgfSk7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLnoa7orqRcXFwiLFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaWQpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGlucHV0ID0gZ2V0TXlWYXIoaWQsIGZpbmRJdGVtKGlkKS5leHRyYS5kZWZhdWx0VmFsdWUgfHwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICBjb25zdCBDb25maWcgPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9Db25maWcuanNvblxcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoaW5wdXQuc3RhcnRzV2l0aChcXFwiaGlrZXI6Ly9maWxlcy9cXFwiKSkgaW5wdXQgPSBnZXRQYXRoKGlucHV0KS5zbGljZSg3KTtcXG4gICAgICAgICAgICAgICAgaWYgKGlucHV0LmVuZHNXaXRoKFxcXCIvXFxcIikpIGlucHV0PWlucHV0LnJlcGxhY2UoL1xcXFwvJC8sXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICBpZiAoQ29uZmlnLmhvbWVQYXRoID09IGlucHV0KSByZXR1cm4gXFxcInRvYXN0Oi8v5bey57uP5piv5b2T5YmN55uu5b2VXFxcIjtcXG4gICAgICAgICAgICAgICAgQ29uZmlnID0gSlNPTi5wYXJzZShyZWFkRmlsZShcXFwiY29uZmlnLmpzb25cXFwiLCAwKSB8fCBcXFwie31cXFwiKTtcXG4gICAgICAgICAgICAgICAgQ29uZmlnLmhvbWVQYXRoID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgIHNhdmVGaWxlKFxcXCJjb25maWcuanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KENvbmZpZyksIDApO1xcbiAgICAgICAgICAgICAgICBiYWNrKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/lt7Lkv53lrZhcXFwiO1xcbiAgICAgICAgICAgIH0sIGlkKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAg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yYToge1xcbiAgICAgICAgICAgICAgICAgICAgaXNUcnVlOiB0cnVlLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6ICRpZCxcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgd3JpdGVGaWxlKFxcXCJmaWxlOi8vXFxcIiArIHBhdGggKyBcXFwiL2Jvb2tJbmZvLmpzb25cXFwiLCBKU09OLnN0cmluZ2lmeShib29rSW5mbykpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICB9LCBpZCArIGksIHJlcGxhY2VSdWxlLCBNWV9QQVJBTVMucGF0aCksXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCJcXG4gICAgfSk7XFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBcXFwi5YWz6ZetXFxcIixcXG4gICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoJGlkLCByZXBsYWNlUnVsZSwgcGF0aCkgPT4ge1xcbiAgICAgICAgICAgIGlmICghZmluZEl0ZW0oJGlkKS5leHRyYS5pc1RydWUpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+W3suWFs+mXrVxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGNvbnN0IGJvb2tJbmZvID0gT2JqZWN0LmFzc2lnbih7XFxuICAgICAgICAgICAgICAgIHNlbGVjdGVkOiBbXVxcbiAgICAgICAgICAgIH0sIEpTT04ucGFyc2UocmVxdWVzdChcXFwiZmlsZTovL1xcXCIgKyBwYXRoICsgXFxcIi9ib29rSW5mby5qc29uXFxcIikgfHwgXFxcInt9XFxcIikpO1xcbiAgICAgICAgICAgIGJvb2tJbmZvLnNlbGVjdGVkLnNwbG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gIHVybDogJChbXFxcIuezu+e7n+mAieaLqeWZqFxcXCIsIFxcXCLmtbfpmJTpgInmi6nlmahcXFwiXSwgMSwgXFxcIumAieaLqeWZqOexu+Wei1xcXCIpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGlucHV0ID09PSBcXFwi57O757uf6YCJ5oup5ZmoXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImZpbGVTZWxlY3Q6Ly9cXFwiICsgJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIS8oXFxcXC50eHR8LmVwdWIpJC9pLnRlc3QoaW5wdXQpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcIumAieaLqeS6humUmeivr+eahOaWh+S7tuexu+Wei1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IENvbmZpZyA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL0NvbmZpZy5qc29uXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZmlsZU1hdGNoID0gaW5wdXQubWF0Y2goL1xcXFwvKFteXFxcXC9dKj8pKFxcXFwudHh0fFxcXFwuZXB1YikkL2kpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IG5vdmVsTmFtZSA9IGZpbGVNYXRjaFsxXS5yZXBsYWNlKFxcXCJfZmlsZVNlbGVjdF9cXFwiLCBcXFwiXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgdG9wYXRoID0gQ29uZmlnLmV4dGVybmFsSW1wb3J0UGF0aCArIG5vdmVsTmFtZSArIGZpbGVNYXRjaFsyXTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCB0b3BhdGhDYWNoZSA9IENvbmZpZy5jb250ZW50c0NhY2hlICsgbm92ZWxOYW1lICsgZmlsZU1hdGNoWzJdO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBhdGggPSBpbnB1dC5yZXBsYWNlKFxcXCJmaWxlOi8vXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVFeGlzdChcXFwiZmlsZTovL1xcXCIgKyB0b3BhdGgpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5a+85YWl5o+Q56S6XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIuW3suWtmOWcqFtcXFwiICsgbm92ZWxOYW1lICsgXFxcIl3mmK/lkKbopobnm5Y/XFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygocGF0aCwgdG9wYXRoLCB0b3BhdGhDYWNoZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgRmlsZSA9ICQucmVxdWlyZShcXFwiaGlrZXI6Ly9wYWdlL0ZpbGUuanNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUuY29weUZpbGUocGF0aCwgdG9wYXRoLCB0cnVlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaWxlRXhpc3QoXFxcImZpbGU6Ly9cXFwiICsgdG9wYXRoQ2FjaGUpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgRmlsZS5kZWxldGVGaWxlcyh0b3BhdGhDYWNoZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5a+85YWl5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSwgcGF0aCwgdG9wYXRoLCB0b3BhdGhDYWNoZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm47XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEZpbGUgPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9GaWxlLmpzXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgRmlsZS5jb3B5RmlsZShwYXRoLCB0b3BhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaWxlRXhpc3QoXFxcImZpbGU6Ly9cXFwiICsgdG9wYXRoQ2FjaGUpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUuZGVsZXRlRmlsZXModG9wYXRoQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoXFxcIuWvvOWFpeaIkOWKn1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJlcXVpcmVVcmwgPSBcXFwiaHR0cDovL2hpa2VyLm5va2lhLnByZXNzL2hpa2VydWxlL3J1bGVsaXN0Lmpzb24/aWQ9NTA5OVxcXCI7XFxuICAgICAgICAgICAgICAgIGxldCBmaWxlU2VsZWN0ID0gcmVxdWlyZShyZXF1aXJlVXJsKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZpbGVTZWxlY3QuZmlsZVNlbGVjdGlvblVyaSh7XFxuICAgICAgICAgICAgICAgICAgICBjYWxsYmFjazogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgQ29uZmlnID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL3BhZ2UvQ29uZmlnLmpzb25cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgZmlsZU1hdGNoID0gUEFUSC5tYXRjaCgvXFxcXC8oW15cXFxcL10qPykoXFxcXC50eHR8XFxcXC5lcHViKSQvaSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5vdmVsTmFtZSA9IGZpbGVNYXRjaFsxXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdG9wYXRoID0gQ29uZmlnLmV4dGVybmFsSW1wb3J0UGF0aCArIG5vdmVsTmFtZSArIGZpbGVNYXRjaFsyXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgdG9wYXRoQ2FjaGUgPSBDb25maWcuY29udGVudHNDYWNoZSArIG5vdmVsTmFtZSArIGZpbGVNYXRjaFsyXTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcGF0aCA9IFBBVEg7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVFeGlzdChcXFwiZmlsZTovL1xcXCIgKyB0b3BhdGgpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCLlt7LlrZjlnKhbXFxcIiArIG5vdmVsTmFtZSArIFxcXCJd5piv5ZCm6KaG55uWP1xcXCIpLmNvbmZpcm0oKHBhdGgsIHRvcGF0aCwgdG9wYXRoQ2FjaGUpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEZpbGUgPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9GaWxlLmpzXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBGaWxlLmNvcHlGaWxlKHBhdGgsIHRvcGF0aCwgdHJ1ZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmlsZUV4aXN0KFxcXCJmaWxlOi8vXFxcIiArIHRvcGF0aENhY2hlKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUuZGVsZXRlRmlsZXModG9wYXRoQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmFjaygpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvvOWFpeaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0sIHBhdGgsIHRvcGF0aCwgdG9wYXRoQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IEZpbGUgPSAkLnJlcXVpcmUoXFxcImhpa2VyOi8vcGFnZS9GaWxlLmpzXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUuY29weUZpbGUocGF0aCwgdG9wYXRoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZpbGVFeGlzdChcXFwiZmlsZTovL1xcXCIgKyB0b3BhdGhDYWNoZSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUuZGVsZXRlRmlsZXModG9wYXRoQ2FjaGUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJhY2soKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvvOWFpeaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIC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gICAgICBpZiAoRmlsZS5kZWxldGVGaWxlcyhwYXRoKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmaWxlRXhpc3QoXFxcImZpbGU6Ly9cXFwiICsgcGF0aCArIFxcXCIuanNvblxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIEZpbGUuZGVsZXRlRmlsZXMocGF0aCArIFxcXCIuanNvblxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAvL3JlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbShwYXRoKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liKDpmaTmiJDlip9cXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5Yig6Zmk5aSx6LSlXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgcGF0aCk7XFxuICAgICAgICAgICAgICAgIGJyZWFrO1xcbiAgICAgICAgICAgIGNhc2UgXFxcIumYheivu1xcXCI6XFxuICAgICAgICAgICAgICAgIHJldHVybiAodHlwZT09PVxcXCIudHh0XFxcIj9cXFwiaGlrZXI6Ly9wYWdlL3R4dFBhcnNlci52aWV3XFxcIjpcXFwiaGlrZXI6Ly9wYWdlL2VwdWJQYXJzZXIudmlldyNhdXRvQ2FjaGUjXFxcIikrXFxcIj9ydWxlPVxcXCIgKyBNWV9SVUxFLnRpdGxlO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICBjYXNlIFxcXCLmiZPlvIDmlrnlvI9cXFwiOlxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcIm9wZW5GaWxlOi8vZmlsZTovL1xcXCIgKyBwYXRoO1xcbiAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgIH1cXG4gICAgfVxcblxcbiAgICBmb3IgKGxldCBub3ZlbCBvZiBmaWxlcykge1xcbiAgICAgICAgbGV0IHR5cGUgPSBub3ZlbC5uYW1lLnN1YnN0cmluZyhub3ZlbC5uYW1lLmxhc3RJbmRleE9mKFxcXCIuXFxcIikpO1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBub3ZlbC5uYW1lLFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZShvcGVyYXRpb24sIG5vdmVsLnBhdGgsIG5vdmVsLm5hbWUsIHR5cGUpLFxcbiAgICAgICAgICAgIGRlc2M6IFxcXCLlpKflsI/vvJpcXFwiICsgRmlsZS5nZXRGaWxlU2l6ZShub3ZlbC5wYXRoKSArIFxcXCJcXFxcbuS/ruaUueaXtumXtO+8mlxcXCIgKyAkLmRhdGVGb3JtYXQobm92ZWwubGFzdE1vZGlmaWVkLCBcXFwieXl5eS1NTS1kZCBISDptbTpzc1xcXCIpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBwYXRoOiBub3ZlbC5wYXRoLFxcbiAgICAgICAgICAgICAgICBpc0NhY2hlOiB0cnVlLFxcbiAgICAgICAgICAgICAgICB0aXRsZTogbm92ZWwubmFtZSxcXG4gICAgICAgICAgICAgICAgaWQ6IG5vdmVsLnBhdGgsXFxuICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5YiG5LqrXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFwic2hhcmU6Ly9cXFwiICsgbm92ZWwucGF0aClcXG4gICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLpmIXor7tcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KCh0eXBlPT09XFxcIi50eHRcXFwiP1xcXCJoaWtlcjovL3BhZ2UvdHh0UGFyc2VyLnZpZXdcXFwiOlxcXCJoaWtlcjovL3BhZ2UvZXB1YlBhcnNlci52aWV3I2F1dG9DYWNoZSNcXFwiKStcXFwiP3J1bGU9XFxcIiArIE1ZX1JVTEUudGl0bGUpXFxuICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5omT5byA5pa55byPXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGpzOiBKU09OLnN0cmluZ2lmeShcXFwib3BlbkZpbGU6Ly9maWxlOi8vXFxcIiArIG5vdmVsLnBhdGgpXFxuICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChwYXRoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICQucmVxdWlyZShcXFwibG9uZ1ByZXNzLmpzXFxcIikuZGVsZXRlRmlsZUZvclR4dChwYXRoKVxcbiAgICAgICAgICAgICAgICAgICAgfSwgbm92ZWwucGF0aClcXG4gICAgICAgICAgICAgICAgfV1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG4gICAgfVxcbiAgICBpZiAoZmlsZXMubGVuZ3RoID09PSAwKSB7XFxuICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLorr7nva5cXFwiLFxcbiAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vcGFnZS9TZXR0aW5nLnZpZXcjbm9SZWZyZXNoIyNub1JlY29yZEhpc3RvcnkjI25vSGlzdG9yeSNcXFwiLFxcbi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bGFjZShDb25maWcuZXh0ZXJuYWxJbXBvcnRQYXRoLCBDb25maWcuY29udGVudHNDYWNoZSk7XFxuICAgIGlmIChpc0NhY2hlJiZmaWxlRXhpc3QoY2FjaGVQYXRoKSkge1xcbiAgICAgICAgdHJ5IHtcXG5cXG4gICAgICAgICAgICBsZXQgYyA9IEpTT04ucGFyc2UocmVxdWVzdChjYWNoZVBhdGgpKTtcXG4gICAgICAgICAgICBjaGFwdGVyTmFtZXMgPSBjLmNoYXB0ZXJOYW1lcztcXG4gICAgICAgICAgICBpbnRlcnZhbHMgPSBjLmludGVydmFscztcXG4gICAgICAgICAgICBoYXNQcmVmYWNlID0gYy5oYXNQcmVmYWNlO1xcbiAgICAgICAgICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLph43mlrDop6PmnpDnm67lvZVcXFwiLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHBhdGgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUZpbGUocGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgfSwgcGF0aCtcXFwiLmpzb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOmZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOlxcXCJsaW5lX2JsYW5rXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgICAgIHNldFJlc3VsdChbe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnTxzdHJvbmc+55uu5b2V6Kej5p6Q5aSx6LSlKOmHjeaWsOino+aekCk8L3N0cm9uZz5cXFwiLmJpZygpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKHBhdGgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZUZpbGUocGF0aCk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgfSwgcGF0aCtcXFwiLmpzb25cXFwiKSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfV0pO1xcbiAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgIH1cXG5cXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIHNob3dMb2FkaW5nKFxcXCLmraPlnKjop6PmnpDnm67lvZVcXFwiKTtcXG4gICAgICAgIGxldCB0eHQgPSByZXF1ZXN0KHBhdGgsIHtcXG4gICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgIC8vXFxcImNvbnRlbnQtdHlwZVxcXCI6IFxcXCJ0ZXh0L3BsYWluOyBjaGFyc3Q9XFxcIiArIGNoYXJzdFxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICAgICAgbGV0IHBhdHRlcm4gPSByZWdzLmdldFRvY1J1bGUodHh0KTtcXG4gICAgICAgIGlmICghcGF0dGVybikge1xcbiAgICAgICAgICAgIGhpZGVMb2FkaW5nKCk7XFxuICAgICAgICAgICAgc2V0UmVzdWx0KFt7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi4oCc4oCc4oCd4oCdPHN0cm9uZz7nm67lvZXop6PmnpDlpLHotKU8L3N0cm9uZz5cXFwiLmJpZygpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgYmFjayhmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfV0pO1xcbiAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBtYXRjaGVyID0gcGF0dGVybi5tYXRjaGVyKHR4dCk7XFxuICAgICAgICBsZXQgcG9pbnRlciA9IDA7XFxuICAgICAgICB3aGlsZSAobWF0Y2hlci5maW5kKCkpIHtcXG4gICAgICAgICAgICBsZXQgc3RhcnQgPSBtYXRjaGVyLnN0YXJ0KCk7XFxuICAgICAgICAgICAgbGV0IGVuZCA9IG1hdGNoZXIuZW5kKCk7XFxuICAgICAgICAgICAgbGV0IHQgPSBtYXRjaGVyLmdyb3VwKCk7XFxuICAgICAgICAgICAgaWYgKHBvaW50ZXIgPT09IDAgJiYgc3RhcnQgPiAzMCkge1xcbiAgICAgICAgICAgICAgICBoYXNQcmVmYWNlID0gdHJ1ZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgY2hhcHRlck5hbWVzLnB1c2godCk7XFxuICAgICAgICAgICAgaW50ZXJ2YWxzLnB1c2goW3BvaW50ZXIsIHN0YXJ0XSk7XFxuICAgICAgICAgICAgcG9pbnRlciA9IGVuZDtcXG4gICAgICAgIH1cXG4gICAgICAgIGludGVydmFscy5wdXNoKFtwb2ludGVyLCB0eHQubGVuZ3RoXSk7XFxuICAgICAgICBpZiAoaXNDYWNoZSkge1xcbiAgICAgICAgICAgIHdyaXRlRmlsZShjYWNoZVBhdGgsIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICAgICAgY2hhcHRlck5hbWVzOiBjaGFwdGVyTmFtZXMsXFxuICAgICAgICAgICAgICAgIGludGVydmFsczogaW50ZXJ2YWxzLFxcbiAgICAgICAgICAgICAgICBoYXNQcmVmYWNlOiBoYXNQcmVmYWNlXFxuICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaGlkZUxvYWRpbmcoKTtcXG4gICAgfVxcblxcblxcbiAgICBpZiAoaGFzUHJlZmFjZSkge1xcbiAgICAgICAgbGV0IGludGVydmFsID0gaW50ZXJ2YWxzWzBdO1xcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5bqP6KiAXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL1RYVFZpZXdlci52aWV3I2F1dG9QYWdlIyNyZWFkVGhlbWUjXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBjaGFwdGVyTmFtZTogXFxcIuW6j+iogFxcXCIsXFxuICAgICAgICAgICAgICAgIHN0YXJ0OiBpbnRlcnZhbFswXSxcXG4gICAgICAgICAgIC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uICAgICAgICBcXFwibmFtZVxcXCI6IFxcXCLnm67lvZUo5Y6756m655m9KVxcXCIsXFxuICAgICAgICBcXFwicnVsZVxcXCI6IFxcXCIoPzw9W+OAgFxcXFxcXFxcc10pKD865bqP56ugfOallOWtkHzmraPmlocoPyHlrox857uTKXznu4jnq6B85ZCO6K6wfOWwvuWjsHznlarlpJZ856ysP1xcXFxcXFxcc3swLDR9W1xcXFxcXFxcZOOAh+mbtuS4gOS6jOS4pOS4ieWbm+S6lOWFreS4g+WFq+S5neWNgeeZvuWNg+S4h+Wjuei0sOWPgeiChuS8jemZhuafkuaNjOeOluaLvuS9sOS7n10rP1xcXFxcXFxcc3swLDR9KD8656ugfOiKgig/Ieivvil85Y23fOmbhig/IVvlkIjlkoxdKSkpLnswLDMwfSRcXFwiLFxcbiAgICAgICAgXFxcImV4YW1wbGVcXFwiOiBcXFwi56ys5LiA56ugIOWBh+ijheesrOS4gOeroOWJjemdouacieepuueZveS9huaIkeS4jeimgVxcXCIsXFxuICAgICAgICBcXFwic2VyaWFsTnVtYmVyXFxcIjogMFxcbiAgICB9LFxcbiAgICB7XFxuICAgICAgICBcXFwiaWRcXFwiOiAtMixcXG4gICAgICAgIFxcXCJlbmFibGVcXFwiOiB0cnVlLFxcbiAgICAgICAgXFxcIm5hbWVcXFwiOiBcXFwi55uu5b2VXFxcIixcXG4gICAgICAgIFxcXCJydWxlXFxcIjogXFxcIl5bIOOAgFxcXFxcXFxcdF17MCw0fSg/OuW6j+eroHzmpZTlrZB85q2j5paHKD8h5a6MfOe7kyl857uI56ugfOWQjuiusHzlsL7lo7B855Wq5aSWfOesrD9cXFxcXFxcXHN7MCw0fVtcXFxcXFxcXGTjgIfpm7bkuIDkuozkuKTkuInlm5vkupTlha3kuIPlhavkuZ3ljYHnmb7ljYPkuIflo7notLDlj4HogobkvI3pmYbmn5LmjYznjpbmi77kvbDku59dKz9cXFxcXFxcXHN7MCw0fSg/OueroHzoioIoPyHor74pfOWNt3zpm4YoPyFb5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mZvLmRlY29kZSk7XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgbG9nKFxcXCI85bCB6Z2i5LiL6L296ZSZ6K+vPiBcXFwiICsgZS5tZXNzYWdlKTtcXG4gICAgICAgIH1cXG4gICAgfVxcblxcbiAgICBsZXQgZXJyb3JOdW0gPSAwO1xcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IEw7IGkrKykge1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsZXQgcGljID0gVG9vbC5oaWtlclBpYyhwaWNMaXN0W2ldKTtcXG4gICAgICAgICAgICBUb29sLnBpY0Rvd25sb2FkKHBpY1swXSwgY2hhcHRlclBhdGggKyAoaSArIDEpICsgXFxcIi5qcGdcXFwiLCBwaWNbMV0sIGluZm8uZGVjb2RlKTtcXG4gICAgICAgICAgICBpZiAoaW50ZXJydXB0ICYmIGdldE15VmFyKE1ZX0lEICsgXFxcIjpzdGF0dXNcXFwiLCBcXFwiXFxcIikgPT09IFxcXCIxXFxcIikge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gLTE7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGVycm9yTnVtID0gMDtcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBpZiAoZXJyb3JOdW0gPCAxMCkge1xcbiAgICAgICAgICAgICAgICBpLS07XFxuICAgICAgICAgICAgICAgIGVycm9yTnVtKys7XFxuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IGU7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9XFxuXFxuICAgIEZpbGUucmVuYW1lRmlsZShjaGFwdGVyUGF0aCwgb3JkZXIgKyBcXFwiJEEkXFxcIiArIFRvb2wudGV4dFNoaWVsZChpdGVtLnRpdGxlKSk7XFxufVxcblwifSx7XCJjb2xfdHlwZVwiOlwib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BcXFwibW92aWVfMV92ZXJ0aWNhbF9waWNcXFwiLCBcXFwicGljXzJcXFwiLCBcXFwicGljXzNcXFwiLCBcXFwicGljXzNfc3F1YXJlXFxcIiwgXFxcInBpY18yX2NhcmRcXFwiXTtcXG4gICAgXFxuICAgIGxldCByYW5rTWV0aG9kcyA9IFtcXFwi57O757ufXFxcIiwgXFxcIuWkp+Wwj1xcXCIsIFxcXCLlkI3np7BcXFwiLCBcXFwi5pe26Ze0XFxcIl07XFxuICAgIGxheW91dC5wdXNoKHtcXG4gICAgICAgIHVybDogJ1xcXCJoaWtlcjovL3NlYXJjaD9zPVxcXCIraW5wdXQnLFxcbiAgICAgICAgZGVzYzogXFxcIuaQnOS9oOaDs+imgeeahCNcXFwiICsgdHlwZSArIFxcXCIjLi4uLi4uXFxcIixcXG4gICAgICAgIHRpdGxlOiBcXFwi8J+UjVxcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImlucHV0XFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgcnVsZXM6ICQudG9TdHJpbmcoKHJ1bGVOYW1lLCB0eXBlKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBhcnIxID0gW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwidGl0bGVcXFwiOiBydWxlTmFtZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwic2VhcmNoX3VybFxcXCI6IFxcXCJoaWtlcjovL2VtcHR5P2lzQWxsPTEmc2VhcmNoVGVybXM9KiomdHlwZT1cXFwiICsgdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBcXFwic2VhcmNoRmluZFxcXCI6IFxcXCJqczokLnJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9TZWFyY2gudmlldz9ydWxlPScrTVlfUlVMRS5fdGl0bGUpO1xcXCJcXG4gICAgICAgICAgICAgICAgICAgIH1dO1xcbiAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgcmV0dXJu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B9IGVsc2Uge1xcbiAgICAgICAgICAgIHRpdGxlYiA9IFxcXCLihpVcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgbGF5b3V0LnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZWEgKyB0aXRsZWIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJmbGV4X2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChuYW1lKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCByYW5rTWV0aG9kID0gZ2V0SXRlbShcXFwiYm9va3JhY2s6cmFua01ldGhvZFxcXCIsIFxcXCLns7vnu59cXFwiKTtcXG4gICAgICAgICAgICAgICAgbGV0IHJhbmtJc1JldmVyc2UgPSBnZXRJdGVtKFxcXCJib29rcmFjazpyYW5rSXNSZXZlcnNlXFxcIiwgXFxcIlxcXCIpO1xcblxcbiAgICAgICAgICAgICAgICBpZiAocmFua01ldGhvZCA9PT0gbmFtZSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHJhbmtJc1JldmVyc2UpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByYW5rSXNSZXZlcnNlID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJhbmtJc1JldmVyc2UgPSBcXFwiMVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJib29rcmFjazpyYW5rSXNSZXZlcnNlXFxcIiwgcmFua0lzUmV2ZXJzZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJib29rcmFjazpyYW5rSXNSZXZlcnNlXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwiYm9va3JhY2s6cmFua01ldGhvZFxcXCIsIG5hbWUpO1xcblxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICB9LCBuYW1lKVxcbiAgICAgICAgfSk7XFxuICAgIH1cXG4gICAgbGV0IHJhbmtNZXRob2RNYXAgPSB7XFxuICAgICAgICBcXFwi57O757ufXFxcIjogXFxcIlxcXCIsXFxuICAgICAgICBcXFwi5aSn5bCPXFxcIjogXFxcInNpemVcXFwiLFxcbiAgICAgICAgXFxcIuWQjeensFxcXCI6IFxcXCJuYW1lXFxcIixcXG4gICAgICAgIFxcXCLml7bpl7RcXFwiOiBcXFwidGltZVxcXCJcXG4gICAgfTtcXG4gICAgbGV0IGJvb2tMaXN0ID0gW107XFxuICAgIGxldCBsaXN0ID0gcmFuayhGaWxlLmdldEZpbGVzKHBhdGgsIFxcXCJkaXJcXFwiKSwgcmFua01ldGhvZE1hcFtyYW5rTWV0aG9kXSk7XFxuICAgIGlmIChsaXN0Lmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgYm9va0xpc3QucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgXFxcIuWVpemDveayoeacieiAtlxcXCIuYmlnKCksXFxuICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KTtcXG5cXG4gICAgfVxcbiAgICBsZXQgcGFnZVVybCA9IHR5cGUgPT09IFxcXCJub3ZlbFxcXCIgPyBcXFwiaGlrZXI6Ly9wYWdlL05vdmVsQnJvd3Nlci52aWV3XFxcIiA6IFxcXCJoaWtlcjovL3BhZ2UvQ29taWNCcm93c2VyLnZpZXdcXFwiO1xcbiAgICBmb3IgKGxldCBpdGVtIG9mIGxpc3QpIHtcXG4gICAgICAgIGxldCBwaWMgPSBmaWxlRXhpc3QoXFxcImZpbGU6Ly9cXFwiICsgaXRlbS5nZXRQYXRoKCkgKyBcXFwiL1xcXCIgKyBpdGVtLmdldE5hbWUoKSArIFxcXCIuanBnXFxcIikgPyBpdGVtLmdldFBhdGgoKSArIFxcXCIvXFxcIiArIGl0ZW0uZ2V0TmFtZSgpICsgXFxcIi5qcGdcXFwiIDogQ29uZmlnLmRlZl9QaWM7XFxuICAgICAgICBib29rTGlzdC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogaXRlbS5nZXROYW1lKCksXFxuICAgICAgICAgICAgcGljX3VybDogcGljLFxcbiAgICAgICAgICAgIHVybDogcGFnZVVybCArIFxcXCI/cnVsZT1cXFwiICsgTVlfUlVMRS50aXRsZSxcXG4gICAgICAgICAgICBjb2xfdHlwZTpjb2xfdHlwZSxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWIoOmZpFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygocGF0aCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkLnJlcXVpcmUoXFxcImxvbmdQcmVzcy5qc1xcXCIpLmRlbGV0ZUZpbGVGb3JCb29rKHBhdGgpO1xcbiAgICAgICAgICAgICAgICAgICAgfSwgaXRlbS5nZXRQYXRoKCkpXFxuICAgICAgICAgICAgICAgIH1dLFxcbiAgICAgICAgICAgICAgICBpZDogaXRlbS5nZXRQYXRoKCksXFxuICAgICAgICAgICAgICAgIHB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kur86IHtcXG4gICAgICAgIHZhbHVlOiAxMDAwMDAwMDAsXFxuICAgICAgICBzZWNVbml0OiB0cnVlXFxuICAgIH1cXG59XFxuXFxuZnVuY3Rpb24gQ2hpbmVzZVRvTnVtYmVyKGNoblN0cikge1xcbiAgICBsZXQgcnRuID0gMDtcXG4gICAgbGV0IHNlY3Rpb24gPSAwO1xcbiAgICBsZXQgbnVtYmVyID0gMDtcXG4gICAgbGV0IHNlY1VuaXQgPSBmYWxzZTtcXG4gICAgbGV0IHN0ciA9IGNoblN0ci5zcGxpdCgnJyk7XFxuXFxuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgc3RyLmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICBsZXQgbnVtID0gY2huTnVtQ2hhcltzdHJbaV1dO1xcbiAgICAgICAgaWYgKHR5cGVvZiBudW0gIT09ICd1bmRlZmluZWQnKSB7XFxuICAgICAgICAgICAgbnVtYmVyID0gbnVtO1xcbiAgICAgICAgICAgIGlmIChpID09PSBzdHIubGVuZ3RoIC0gMSkge1xcbiAgICAgICAgICAgICAgICBzZWN0aW9uICs9IG51bWJlcjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxldCB1bml0ID0gY2huTmFtZVZhbHVlW3N0cltpXV0udmFsdWU7XFxuICAgICAgICAgICAgc2VjVW5pdCA9IGNobk5hbWVWYWx1ZVtzdHJbaV1dLnNlY1VuaXQ7XFxuICAgICAgICAgICAgaWYgKHNlY1VuaXQpIHtcXG4gICAgICAgICAgICAgICAgc2VjdGlvbiA9IChzZWN0aW9uICsgbnVtYmVyKSAqIHVuaXQ7XFxuICAgICAgICAgICAgICAgIHJ0biArPSBzZWN0aW9uO1xcbiAgICAgICAgICAgICAgICBzZWN0aW9uID0gMDtcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBzZWN0aW9uICs9IChudW1iZXIgKiB1bml0KTtcXG4gICAgICAgICAgICB9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VuRmlsZTovL2ZpbGU6Ly9cXFwiICsgcGF0aCwgUEFUSCk7XFxuICAgICAgICB9XFxuICAgIH0pLFxcbiAgICBpbml0aWFsUGF0aDogQ29uZmlnW3R5cGVdLFxcbiAgICByb290RGlyUGF0aDogQ29uZmlnLmhvbWVQYXRoLFxcbiAgICAvL29uQ2xpY2tUeXBlOiBcXFwiY29uZmlybVxcXCIsXFxuICAgIC8vbWVtb3J5OiBcXFwiRmlsZU1hbmFnZW1lbnQ6bWVtb3J5XFxcIixcXG4gICAgcmVxdWlyZVVybDogdXJsLFxcbiAgICBmaWxlVHlwZTogXFxcIlxcXFwudHh0fFxcXFwuZXB1YnwuanBnXFxcIixcXG4gICAgLy9jSG9tZVRpcHM6IFxcXCLmmK/lkKbkvb/nlKjmtbfpmJTlsI/nqIvluo/miZPlvIBbJHtuYW1lfV0/XFxcIixcXG4gICAgLy9jU2VhcmNoVGlwczogXFxcIuaYr+WQpuS9v+eUqOa1t+mYlOWwj+eoi+W6j+aJk+W8gFske3BhdGh9XT9cXFwiXFxufSk7XCJ9XSIsImljb24iOiJodHRwczovL2xhbm1laWd1b2ppYW5nLmNvbS90dWJpYW8vcS81OC5wbmciLCJwcm94eSI6IiJ9
Add Comment
Please, Sign In to add comment