Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:二级页面详情¥page_detail¥春光乍泄.Happy.Together.1997.BluRay.1080p.x265.10bit@@eyJkYXRhIjoie1wiYXNzb2NpYXRlZE1vZGVsc01hcEZvckpvaW5UYWJsZVwiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhGS1wiOnt9LFwiYXNzb2NpYXRlZE1vZGVsc01hcFdpdGhvdXRGS1wiOnt9LFwiZmllbGRzVG9TZXRUb0RlZmF1bHRcIjpbXSxcImdtdE1vZGlmaWVkXCI6MCxcImlkXCI6MCxcImxhc3RfY2hhcHRlcl9ydWxlXCI6XCJcIixcImxpc3RUb0NsZWFyQXNzb2NpYXRlZEZLXCI6W10sXCJsaXN0VG9DbGVhclNlbGZGS1wiOltdLFwicGFnZUxpc3RcIjpbe1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuWkuOWFi+WIl+ihqEFQSVwiLFwicGF0aFwiOlwiUXVhcmtTaGFyZUFwaVwiLFwicnVsZVwiOlwianM6XFxuLy9AYXV0aG9yIExveURnSWtcXG5sZXQgaHR0cFJlcXVlc3QgPSAkLnJlcXVpcmUoXFxcImh0dHBSZXF1ZXN0XFxcIik7XFxubGV0IGZyb21Ecml2ZSA9IG1vZHVsZS5pbXBvcnRQYXJhbTtcXG5sZXQgcHIsIGJhc2VVcmxcXG5pZiAoZnJvbURyaXZlID09PSBcXFwidWNcXFwiKSB7XFxuICAgIGJhc2VVcmwgPSBcXFwiaHR0cHM6Ly9wYy1hcGkudWMuY25cXFwiO1xcbiAgICBwciA9IFxcXCJVQ0Jyb3dzZXJcXFwiO1xcbn0gZWxzZSB7XFxuICAgIGJhc2VVcmwgPSBcXFwiaHR0cHM6Ly9wYW4ucXVhcmsuY25cXFwiO1xcbiAgICBwciA9IFxcXCJ1Y3Byb1xcXCI7XFxufVxcblxcbmZ1bmN0aW9uIFF1YXJrU2hhcm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k7XFxuICAgICAgICAgICAgICAgIGlmICh0b0pzb24pIHtcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLnN1Y2Nlc3NDYWxsYmFjayhib2R5LCByZXMpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihTdHJpbmcocmVzLnN0YXR1c0NvZGUpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBlcnIgPSB0aGlzLmVycm9yVHlwZUNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHRyeVJlc3VsdCA9IHRoaXMuZXJyb3JDYWxsYmFja1dpdGhSZXRyeShlcnIsIHJlcywgdGhpcyk7XFxuICAgICAgICAgICAgICAgIGlmICh0cnlSZXN1bHQpIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuc3RhcnQodG9Kc29uKTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5lcnJvckNhbGxiYWNrKGVyciwgcmVzKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmVycm9yQ2FsbGJhY2soZXJyLCByZXMp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ICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruS4jeWQiOazlVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBzZXRJdGVtKFxcXCJzcGVlZFRocmVhZFxcXCIsIFN0cmluZyhzcGVlZFRocmVhZCkpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXCI7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoaW5wdXQgPT09IFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGlmIChmcm9tRHJpdmUgPT09IFxcXCJ1Y1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiY29weTovL1xcXCIgKyBidWlsZFVybChcXFwiaHR0cHM6Ly9kcml2ZS51Yy5jbi9zL1xcXCIgKyBzaGFyZUlkICsgXFxcIj9wdWJsaWM9MSMvbGlzdC9zaGFyZVxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGJ1aWxkVXJsKFxcXCJodHRwczovL3Bhbi5xdWFyay5jbi9zL1xcXCIgKyBzaGFyZUlkLCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFzc2NvZGU6IHNoYXJlUHdkXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIHNoYXJlSWQsIHNoYXJlUHdkLCBmcm9tRHJpdmUpLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVc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gICAgICAgIC8v5Yik5pat5piv5ZCm5paH5Lu25aS5XFxuICAgICAgICBpZiAoaXRlbS5kaXIpIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIvCfk4JcXFwiICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRlc2M6ICQuZGF0ZUZvcm1hdChpdGVtLnVwZGF0ZWRfYXQsICd5eXl5LU1NLWRkJykgKyAnICAnICsgaXRlbS5pbmNsdWRlX2l0ZW1zICsgJ+mhuSAgJyxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vbWVzc3kvMjcuc3ZnXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9wYWdlL3F1YXJrTGlzdD9wYWdlPWZ5cGFnZVxcXCIsXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlSWQsXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlVG9rZW46IHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSxcXG4gICAgICAgICAgICAgICAgICAgIGZpbGVJZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgZnJvbURyaXZlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGdldEhlYWQoaXRlbS5vYmpfY2F0ZWdvcnkpICsgaXRlbS5maWxlX25hbWUsXFxuICAgICAgICAgICAgICAgIGRl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0ub2JqX2NhdGVnb3J5LCBmcm9tRHJpdmUpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogc3R5bGUsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5maWQsXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheWxpc3QgJyArIGl0ZW0ub2JqX2NhdGVnb3J5XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcblxcbiAgICB9KTtcXG59IGNhdGNoIChlKSB7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZS5tZXNzYWdlLFxcbiAgICAgICAgdXJsOiAnaGlrZXI6Ly9lbXB0eScsXFxuICAgICAgICBjb2xfdHlwZTogJ3RleHRfY2VudGVyXzEnLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgIH1cXG4gICAgfSk7XFxuICAgIGlmIChlLm1lc3NhZ2UuaW5jbHVkZXMoXFxcIuaPkOWPlueggVxcXCIpKSB7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi6L6T5YWl5o+Q5Y+W56CBXFxcIixcXG4gICAgICAgICAgICB1cmw6ICQoKS5pbnB1dCgoTVlfUEFSQU1TKSA9PiB7XFxuICAgICAgICAgICAgICAgIHNldFBhZ2VQYXJhbXMoT2JqZWN0LmFzc2lnbih7fSwgTVlfUEFSQU1TLCB7XFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogaW5wdXRcXG4gICAgICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIH0sIE1ZX1BBUkFNUyksXFxuICAgICAgICAgICAgY29sX3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luZ1xcXCIpIHtcXG4gICAgICAgICAgICBjb29raWVzID0gY29va2llLnNwbGl0KFxcXCI7XFxcIik7XFxuICAgICAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoY29va2llKSkge1xcbiAgICAgICAgICAgIGNvb2tpZXMgPSBjb29raWU7XFxuICAgICAgICB9XFxuICAgICAgICBjb29raWVzLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgdiA9IHYuc3BsaXQoXFxcIj1cXFwiKTtcXG4gICAgICAgICAgICBpZiAodi5sZW5ndGggPCAyKSByZXR1cm47XFxuICAgICAgICAgICAgbGV0IGtleSA9IHYuc2hpZnQoKS50cmltKCk7XFxuICAgICAgICAgICAgdGhpcy5jb29raWVba2V5XSA9IHYuam9pbihcXFwiPVxcXCIpLnRyaW0oKTtcXG4gICAgICAgIH0pO1xcbiAgICB9LFxcbiAgICBnZXQoKSB7XFxuICAgICAgICByZXR1cm4gT2JqZWN0LmVudHJpZXModGhpcy5jb29raWUpLm1hcCh2ID0+IHZbMF0gKyBcXFwiPVxcXCIgKyB2WzFdKS5qb2luKFxcXCI7XFxcIik7XFxuICAgIH1cXG59KTtcXG5jb25zdCBjb29raWVNYW5hZ2UgPSBuZXcgQ29va2llTWFuYWdlKGNvb2tpZSk7XFxubGV0IGh0dHBSZXF1ZXN0ID0gJC5yZXF1aXJlKFxcXCJodHRwUmVxdWVzdFxcXCIpO1xcblxcbmZ1bmN0aW9uIHdhaXRTbGVlcCh0aW1lKSB7XFxuICAgIGphdmEubGFuZy5UaHJlYWQuc2xlZXAodGltZSB8fCA2MDApO1xcbn1cXG5cXG5mdW5jdGlvbiByZXF1ZXN0SHR0cCh1cmwpIHtcXG4gICAgcmV0dXJuIG5ldyBodHRwUmVxdWVzdCh1cmwpXFxuICAgICAgICAuc3VjY2VzcygoYm9keSwgcmVzKSA9PiB7XFxuICAgICAgICAgICAgaWYgKGJvZHkuc3RhdHVzICE9PSAyMDApIHtcXG4gICAgICAgICAgICAgICA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ICAgIGxldCBwbGF5SGVhZGVycyA9IE9iamVjdC5hc3NpZ24oe30sIHBsYXlIZWFkZXIsIHtcXG4gICAgICAgICAgICBcXFwiVXNlci1BZ2VudFxcXCI6IFxcXCJMb2dTdGF0aXN0aWNcXFwiXFxuICAgICAgICB9KTtcXG4gICAgICAgIGlmIChjYXRlZ29yeSA9PSBcXFwidmlkZW9cXFwiKSB7XFxuICAgICAgICAgICAgbGV0IHBsYXlNb2RlID0gZ2V0SXRlbShcXFwicXVhcmtfcGxheU1vZGVcXFwiLCBcXFwi6L2s56CBXFxcIik7XFxuICAgICAgICAgICAgaWYgKHBsYXlNb2RlID09PSBcXFwi6L2s56CBXFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9SZXMgPSBnZXRQcmV2aWV3VmlkZW8oYXNmaWQpO1xcblxcbiAgICAgICAgICAgICAgICBsZXQgdmlkZW9MaXN0ID0gdmlkZW9SZXMuZGF0YS52aWRlb19saXN0O1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW10sXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtdXFxuICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgIHZpZGVvTGlzdC5maWx0ZXIodiA9PiB2LmFjY2Vzc2FibGUpLmZvckVhY2godiA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC5uYW1lcy5wdXNoKHYucmVzb2x1dGlvbik7XFxuICAgICAgICAgICAgICAgICAgICBwbGF5TGlzdC51cmxzLnB1c2godi52aWRlb19pbmZvLnVybCArIFxcXCIjaXNWaWRlbz10cnVlI1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgcGxheUxpc3QuaGVhZGVycy5wdXNoKHBsYXlIZWFkZXJzKTtcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuXFxuICAgICAgICAgICAgICAgIGxldCBwbGF5VXJsID0gZ2V0RG93bmxvYWRVcmwoYXNmaWQpLmRhdGFbMF0uZG93bmxvYWRfdXJsO1xcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVycy5jb29raWU9Y29va2llTWFuYWdlLmdldCgpO1xcbiAgICAgICAgICAgICAgICBsZXQgcGxheUxpc3QgPSB7XFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW3BsYXlNb2RlXSxcXG4gICAgICAgICAgICAgICAgICAgIHVybHM6IFtwbGF5VXJsICsgXFxcIiNpc1ZpZGVvPXRydWUjXFxcIisocGxheU1vZGU9PT1cXFwi5Y6f55S7XFxcIj9cXFwiI2Zhc3RQbGF5TW9kZSMjdGhyZWFkcz1cXFwiICsgZ2V0SXRlbShcXFwic3BlZWRUaHJlYWRcXFwiLCBcXFwiMTBcXFwiKSArIFxcXCIjXFxcIjpcXFwiXFxcIildLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogW3BsYXlIZWFkZXJzXVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxuXFxuICAgICAgICAgICAgY3JlYXRlRGVsZXRlVGFzayhhc2ZpZCk7XFxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5ID09PSAnYXVkaW8nKSB7XFxuICAgICAgICAgICAgICAgIGxldCBwbGF5TGlzdCA9IHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzOiBbXFxcIumfs+mikVxcXCJdLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsczogW3BsYXlVcmwgKyBcXFwiI2lzVmlkZW89dHJ1ZSNcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyXSxcXG4gICAgICAgICAgICAgICAgICAgIGx5cmljOiBcXFwiXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiBKU09OLnN0cmluZ2lmeShwbGF5TGlzdCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChjYXRlZ29yeSA9PT0gJ2ltYWdlJykge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChwbGF5VXJsLCBwbGF5SGVhZGVyKS5pbWFnZSgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHBsYXlIZWFkZXIgPSBPYmplY3Qua2V5cyhwbGF5SGVhZGVyKS5tYXAoa2V5ID0+IGtleSArIFxcXCJAXFxcIiArIFN0cmluZyhwbGF5SGVhZGVyW2tleV0pLnJlcGxhY2UoLzsvZywgXFxcIu+8m++8m1xcXCIpKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJkb3dubG9hZDovL1xcXCIgKyBwbGF5VXJsICsgXFxcIjt7XFxcIiArIHBsYXlIZWFkZXIuam9pbihcXFwiJiZcXFwiKSArIFxcXCJ9XFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIGlmIChlLm1lc3NhZ2UuaW5jbHVkZXMoXFxcInJlcXVpcmUgbG9naW5cXFwiKSkge1xcbiAgICAgICAgICAgIHRvYXN0KFxcXCLmnKrnmbvlvZXmiJbnmbvlvZXov4fmnJ/vvIzor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xuICAgIGV4dHJhOiB7XFxuICAgICAgICB1YTogUENfVUEsXFxuICAgICAgICBqczogJC50b1N0cmluZygodGl0bGUsIGR1cmwpID0+IHtcXG4gICAgICAgICAgICBsZXQgY29va2llID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgc2V0SW50ZXJ2YWwoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICBjb29raWUgPSBmYmEuZ2V0Q29va2llKGR1cmwpO1xcbiAgICAgICAgICAgICAgICBmYmEucHV0VmFyKHRpdGxlICsgXFxcIkBjb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgIH0sIDIwMCk7XFxuICAgICAgICB9LCBNWV9SVUxFLnRpdGxlLCBkdXJsKVxcbiAgICB9XFxufSk7XFxuc2V0UmVzdWx0KGQpXCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLlt6XlhbdcIixcInBhdGhcIjpcInRvb2xcIixcInJ1bGVcIjpcImpzOlxcblxcbiQuZXhwb3J0cz17XFxuICAgIGlzTG9naW5Db29raWUoY29va2llKXtcXG4gICAgICAgIHJldHVybiAhIShjb29raWUgICYmIGNvb2tpZS5pbmNsdWRlcyhcXFwiX191aWQ9XFxcIikgJiYgY29va2llLmluY2x1ZGVzKFxcXCJfX3B1dXM9XFxcIikpO1xcbiAgICB9XFxufTtcIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIuS4quS6uui0puWPt+iuvue9rlwiLFwicGF0aFwiOlwiYWNjb3VudFwiLFwicnVsZVwiOlwiJC5leHBvcnRzID0gJChbXFxcIkNvb2tpZeeZu+W9lVxcXCIsIFxcXCLnvZHpobXnmbvlvZVcXFwiLCBcXFwi5aSN5Yi2Q29va2llXFxcIiwgXFxcIua4hemZpENvb2tpZVxcXCIsIFxcXCJVQ+e9kemhteeZu+W9lVxcXCIsXFxcIlVDQ29va2ll55m75b2VXFxcIixcXFwi5aSN5Yi2VUNDb29raWV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ICghbmV3IGphdmEuaW8uRmlsZShwYXRoKS5jYW5SZWFkKCkpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuayoeacieadg+mZkOivu+WPlkNvb2tpZeaWh+S7tu+8jOivt+aJk+W8gOaJgOacieaWh+S7tuadg+mZkFxcXFxu5rW36ZiU6K6+572uLT7mm7TlpJrlip/og70tPuWGhemDqOaWh+S7tueuoeeQhi0+5Y+z5LiK6KeSXFxcIikuY29uZmlybSgoKSA9PiB7fSk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIGxldCBqc29uID0gSlNPTi5wYXJzZShmZXRjaChcXFwiZmlsZTovL1xcXCIgKyBwYXRoKSk7XFxuICAgICAgICAgICAgICAgIGxldCBjb29raWUgPSBqc29uLmNvb2tpZTtcXG4gICAgICAgICAgICAgICAgaWYgKCQucmVxdWlyZShcXFwidG9vbFxcXCIpLmlzTG9naW5Db29raWUoY29va2llKSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwicXVhcmtDb29raWVcXFwiLCBjb29raWUpO1xcbiAgICAgICAgICAgICAgICAgICAgaXNyICYmIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly9Db29raWXmoLzlvI/plJnor69cXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIHJldHVybiAkKFx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cXFwiID8gXFxcIlVD572R55uYXFxcIiA6IFxcXCLlpLjlhYvnvZHnm5hcXFwiLFxcbiAgICAgICAgY29sX3R5cGU6IFxcXCJpY29uXzVcXFwiLFxcbiAgICAgICAgcGljX3VybDogZnJvbURyaXZlID09PSBcXFwidWNcXFwiID8gXFxcImh0dHBzOi8vaGlrZXJmYW5zLmNvbS90dWJpYW8vZXJkaS8xNC5wbmdcXFwiIDogXFxcImhpa2VyOi8vaW1hZ2VzL2ljb25fa3Vha2VcXFwiLFxcbiAgICAgICAgdXJsOiAkKFxcXCLngrnlh7vlip/og73mjInpkq49PuS4quS6uui0puWPt+euoeeQhuWNs+WPr+eZu+W9lei0puWPt1xcXCIpLmNvbmZpcm0oKCkgPT4ge30pLFxcbiAgICB9KTtcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBzdHlsZSxcXG4gICAgICAgIHVybDogJChzdHlsZXMsIDEsICfor7fpgInmi6knKS5zZWxlY3QoKCkgPT4ge1xcbiAgICAgICAgICAgIHNldEl0ZW0oJ3N0eWxlJywgaW5wdXQpO1xcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICB9KSxcXG4gICAgICAgIHBpY191cmw6IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vaW1nL2FsaV9pY29uLnN2Z1xcXCIsXFxuICAgICAgICBjb2xfdHlwZTogXFxcImljb25fNVxcXCJcXG4gICAgfSk7XFxuICAgIGQucHVzaCh7XFxuICAgICAgICB0aXRsZTogZ2V0SXRlbShcXFwic29ydEtleVxcXCIsIFxcXCLlkI3np7DmraPluo9cXFwiKSxcXG4gICAgICAgIHVybDogJChPYmplY3Qua2V5cyhzb3J0KSwgMSwgJ+ivt+mAieaLqScpLnNlbGVjdCgoKSA9PiB7XFxuICAgICAgICAgICAgc2V0SXRlbShcXFwic29ydEtleVxcXCIsIGlucHV0KVxcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICB9K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iAgICAgICAgICAgICAgICBwaWNfdXJsOiBcXFwiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8yNy5zdmdcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvcXVhcmtMaXN0P3BhZ2U9ZnlwYWdlXFxcIixcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVJZCxcXG4gICAgICAgICAgICAgICAgICAgIHNoYXJlUHdkLFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLFxcbiAgICAgICAgICAgICAgICAgICAgZmlsZUlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBmcm9tRHJpdmVcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogZ2V0SGVhZChpdGVtLm9ial9jYXRlZ29yeSkgKyBpdGVtLmZpbGVfbmFtZSxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBmb3JtYXRTaXplKGl0ZW0uc2l6ZSksXFxuICAgICAgICAgICAgICAgIHBpY191cmw6IGl0ZW0udGh1bWJuYWlsLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoKS5sYXp5UnVsZSgoZmlkLCBmaWRfdG9rZW4sIHB3ZF9pZCwgc3Rva2VuLCBjYXRlZ29yeSwgZnJvbURyaXZlKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcInBsYXlVcmxDYWNoZVxcXCIsIHt9KTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChwbGF5VXJsQ2FjaGVbZmlkXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9ICQucmVxdWlyZShcXFwicGxheVxcXCIsIGZyb21Ecml2ZSkuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwbGF5VXJsQ2FjaGVbZmlkXSA9IHVybDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwicGxheVVybENhY2hlXFxcIiwgcGxheVVybENhY2hlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gdXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnksIGZyb21Ecml2ZSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLmZpZCxcXG4gICAgICAgICAgICAgICAgICAgIGluaGVyaXRUaXRsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICBjbHM6ICdwbGF5bGlzdCAnICsgaXRlbS5vYmpfY2F0ZWdvcnlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAg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gICAgIGlmIChyZXMuc3RhdHVzQ29kZSA+PSAyMDAgJiYgcmVzLnN0YXR1c0NvZGUgPD0gMzAwKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IGJvZHkgPSByZXMuYm9keTtcXFxcbiAgICAgICAgICAgICAgICBpZiAodG9Kc29uKSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSBKU09OLnBhcnNlKGJvZHkpO1xcXFxuICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdWNjZXNzQ2FsbGJhY2soYm9keSwgcmVzKTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFN0cmluZyhyZXMuc3RhdHVzQ29kZSkpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGNhdGNoIChlcnIpIHtcXFxcbiAgICAgICAgICAgIHRyeSB7XFxcXG4gICAgICAgICAgICAgICAgZXJyID0gdGhpcy5lcnJvclR5cGVDYWxsYmFjayhlcnIsIHJlcyk7XFxcXG4gICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxcXG5cXFxcbiAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgIGlmICh0aGlzLnJldHJ5Q291bnQpIHtcXFxcbiAgICAgICAgICAgICAgICBsZXQgdHJ5UmVzdWx0ID0gdGhpcy5lcnJvckNhbGxiYWNrV2l0aFJldHJ5KGVyciwgcmVzLCB0aGlzKTtcXFxcbiAgICAgICAgICAgICAgICBpZiAodHJ5UmVzdWx0KSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudC0tO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5zdGFydCh0b0pzb24pO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmV0cnlDb3VudCA9IDA7X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FxcXFwiKSwgXFxcXFxcXCLor7fovpPlhaUzLTMy5LmL6Ze055qE5pW05pWwXFxcXFxcXCIpLmlucHV0KCgpID0+IHtcXFxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHNwZWVkVGhyZWFkID0gcGFyc2VJbnQoaW5wdXQpO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAoc3BlZWRUaHJlYWQgPCAzIHx8IHNwZWVkVGhyZWFkID4gMzIpIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6K6+572u5LiN5ZCI5rOVXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFxcXFxcInNwZWVkVGhyZWFkXFxcXFxcXCIsIFN0cmluZyhzcGVlZFRocmVhZCkpO1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH0pO1xcXFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLlpI3liLbliIbkuqvpk77mjqVcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgIGlmIChmcm9tRHJpdmUgPT09IFxcXFxcXFwidWNcXFxcXFxcIikge1xcXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJjb3B5Oi8vXFxcXFxcXCIgKyBidWlsZFVybChcXFxcXFxcImh0dHBzOi8vZHJpdmUudWMuY24vcy9cXFxcXFxcIiArIHNoYXJlSWQgKyBcXFxcXFxcIj9wdWJsaWM9MSMvbGlzdC9zaGFyZVxcXFxcXFwiLCB7XFxcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZDogc2hhcmVQd2RcXFxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxcXG4gICAgICAg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FxuICAgICAgICAgICAgICAgIHBpY191cmw6IFxcXFxcXFwiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8yNy5zdmdcXFxcXFxcIixcXFxcbiAgICAgICAgICAgICAgICB1cmw6IFxcXFxcXFwiaGlrZXI6Ly9wYWdlL3F1YXJrTGlzdD9wYWdlPWZ5cGFnZVxcXFxcXFwiLFxcXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBzdHlsZSxcXFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZUlkLFxcXFxuICAgICAgICAgICAgICAgICAgICBzaGFyZVB3ZCxcXFxcbiAgICAgICAgICAgICAgICAgICAgc2hhcmVUb2tlbjogcXVhcmtTaGFyZUFwaS5nZXRUb2tlbigpLFxcXFxuICAgICAgICAgICAgICAgICAgICBmaWxlSWQ6IGl0ZW0uZmlkLFxcXFxuICAgICAgICAgICAgICAgICAgICBpbmhlcml0VGl0bGU6IGZhbHNlLFxcXFxuICAgICAgICAgICAgICAgICAgICBmcm9tRHJpdmVcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICB9KTtcXFxcbiAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGdldEhlYWQoaXRlbS5vYmpfY2F0ZWdvcnkpICsgaXRlbS5maWxlX25hbWUsXFxcXG4gICAgICAgICAgICAgICAgZGVzYzogJC5kYXRlRm9ybWF0KGl0ZW0udXBkYXRlZF9hdCwgJ3l5eXktTU0tZGQnKSArICcgICcgKyBmb3JtYXRTaXplKGl0ZW0uc2l6ZSksXFxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogaXRlbS50aHVtYm5haWwsXFxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKGZpZCwgZmlkX3Rva2VuLCBwd2RfaWQsIHN0b2tlbiwgY2F0ZWdvcnksIGZyb21Ecml2ZSkgPT4ge1xcXFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGxheVVybENhY2hlID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcXFxcXCJwbGF5VXJsQ2FjaGVcXFxcXFxcIiwge30pO1xcXFxuICAgICAgICAgICAgICAgICAgICBpZiAocGxheVVybENhY2hlW2ZpZF0pIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBwbGF5VXJsQ2FjaGVbZmlkXTtcXFxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1cmwgPSAkLnJlcXVpcmUoXFxcXFxcXCJwbGF5XFxcXFxcXCIsIGZyb21Ecml2ZSkuZ2V0UGxheVVybChmaWQsIGZpZF90b2tlbiwgcHdkX2lkLCBzdG9rZW4sIGNhdGVnb3J5KTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXlVcmxDYWNoZVtmaWRdID0gdXJsO1xcXFxuICAgICAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcXFxcXCJwbGF5VXJsQ2FjaGVcXFxcXFxcIiwgcGxheVVybENhY2hlKTtcXFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB1cmw7XFxcXG4gICAgICAgICAgICAgICAgICAgIH1cXFxcbiAgICAgICAgICAgICAgICB9LCBpdGVtLmZpZCwgaXRlbS5zaGFyZV9maWRfdG9rZW4sIHNoYXJlSWQsIHF1YXJrU2hhcmVBcGkuZ2V0VG9rZW4oKSwgaXRlbS5vYmpfY2F0ZWdvcnksIGZyb21Ecml2ZSksXFxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IHN0eWxlLFxcXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLmZpZCxcXFxcbiAgICAgICAgICAg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gICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkocGxheUxpc3QpO1xcXFxuICAgICAgICAgICAgfVxcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgbGV0IHBsYXlVcmwgPSBnZXREb3dubG9hZFVybChhc2ZpZCkuZGF0YVswXS5kb3dubG9hZF91cmw7XFxcXG5cXFxcbiAgICAgICAgICAgIGNyZWF0ZURlbGV0ZVRhc2soYXNmaWQpO1xcXFxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5ID09PSAnYXVkaW8nKSB7XFxcXG4gICAgICAgICAgICAgICAgbGV0IHBsYXlMaXN0ID0ge1xcXFxuICAgICAgICAgICAgICAgICAgICBuYW1lczogW1xcXFxcXFwi6Z+z6aKRXFxcXFxcXCJdLFxcXFxuICAgICAgICAgICAgICAgICAgICB1cmxzOiBbcGxheVVybCArIFxcXFxcXFwiI2lzVmlkZW89dHJ1ZSNcXFxcXFxcIl0sXFxcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IFtwbGF5SGVhZGVyXSxcXFxcbiAgICAgICAgICAgICAgICAgICAgbHlyaWM6IFxcXFxcXFwiXFxcXFxcXCJcXFxcbiAgICAgICAgICAgICAgICB9XFxcXG4gICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHBsYXlMaXN0KTtcXFxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2F0ZWdvcnkgPT09ICdpbWFnZScpIHtcXFxcbiAgICAgICAgICAgICAgICByZXR1cm4gJChwbGF5VXJsLCBwbGF5SGVhZGVyKS5pbWFnZSgpO1xcXFxuICAgICAgICAgICAgfSBlbHNlIHtcXFxcbiAgICAgICAgICAgICAgICBwbGF5SGVhZGVyID0gT2JqZWN0LmtleXMocGxheUhlYWRlcikubWFwKGtleSA9PiBrZXkgKyBcXFxcXFxcIkBcXFxcXFxcIiArIFN0cmluZyhwbGF5SGVhZGVyW2tleV0pLnJlcGxhY2UoLzsvZ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FxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+iuvue9ruaIkOWKn1xcXFxcXFwiO1xcXFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8vQ29va2ll5qC85byP6ZSZ6K+vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICAgICAgfVxcXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcXFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFxcXFxcInRvYXN0Oi8v6I635Y+W5aSx6LSl5YWx5Lqr5paH5Lu25o2f5Z2PXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gJChcXFxcXFxcIuacquajgOa1i+WIsFRWQk9Y55qEQ29va2ll5paH5Lu2XFxcXFxcXFxu6K+35L2/55So6L+H5ZCO5YaN5bCd6K+VXFxcXFxcXCIpLmNvbmZpcm0oKCkgPT4ge30pO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcXFxcXCLlpI3liLZDb29raWVcXFxcXFxcIikge1xcXFxuICAgICAgICBsZXQgY29va2llID0gZ2V0SXRlbShcXFxcXFxcInF1YXJrQ29va2llXFxcXFxcXCIsIFxcXFxcXFwiXFxcXFxcXCIpO1xcXFxuICAgICAgICBpZiAoY29va2llKSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJjb3B5Oi8vXFxcXFxcXCIgKyBjb29raWU7XFxcXG4gICAgICAgIH0gZWxzZSB7XFxcXG4gICAgICAgICAgICByZXR1cm4gXFxcXFxcXCJ0b2FzdDovL+acqueZu+W9lVxcXFxcXFwiO1xcXFxuICAgICAgICB9XFxcXG4gICAgfSBlbHNlIGlmKGlucHV0PT09XFxcXFxcXCLmuIXpmaRDb29ra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6ZSZ6K+vXFxcXFxcXCI7XFxcXG4gICAgICAgICAgICB9XFxcXG4gICAgICAgIH0sIGlzcik7XFxcXG4gICAgfWVsc2UgaWYgKGlucHV0ID09PSBcXFxcXFxcIuWkjeWItlVDQ29va2llXFxcXFxcXCIpIHtcXFxcbiAgICAgICAgbGV0IGNvb2tpZSA9IGdldEl0ZW0oXFxcXFxcXCJ1Y0Nvb2tpZVxcXFxcXFwiLCBcXFxcXFxcIlxcXFxcXFwiKTtcXFxcbiAgICAgICAgaWYgKGNvb2tpZSkge1xcXFxuICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwiY29weTovL1xcXFxcXFwiICsgY29va2llO1xcXFxuICAgICAgICB9IGVsc2Uge1xcXFxuICAgICAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/mnKrnmbvlvZVcXFxcXFxcIjtcXFxcbiAgICAgICAgfVxcXFxuICAgIH0gZWxzZSBpZihpbnB1dD09PVxcXFxcXFwi5riF6ZmkVUNDb29raWVcXFxcXFxcIil7XFxcXG4gICAgICAgIGNsZWFySXRlbShcXFxcXFxcInVjQ29va2llXFxcXFxcXCIpO1xcXFxuICAgICAgICBpc3IgJiYgcmVmcmVzaFBhZ2UoKTtcXFxcbiAgICAgICAgcmV0dXJuIFxcXFxcXFwidG9hc3Q6Ly/pgIDlh7rnmbvlvZVcXFxcXFxcIjtcXFxcbiAgICB9XFxcXG59LCAkLmltcG9ydFBhcmFtKTtcXFwifV1cIixcInByb3h5XCI6XCJcIn0iLCJwaWNVcmwiOiJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21lc3N5LzI3LnN2ZyIsInRpdGxlIjoi5pil5YWJ5LmN5rOELkhhcHB5LlRvZ2V0aGVyLjE5OTcuQmx1UmF5LjEwODBwLngyNjUuMTBiaXQifQ==
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement