xiaomianao666

小程序:DrpyHiker

Jun 27th, 2024
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@DrpyHiker@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoiRHJweUhpa2VyIiwiYXV0aG9yIjoiQExveURnSWsmemV0YWxwaGEiLCJ1cmwiOiJoaWtlcjovL2VtcHR5IyNmeXBhZ2UiLCJ2ZXJzaW9uIjo0MywiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOiQucmVxdWlyZShcIk1pYW5Mb2FkXCIpOyIsInNlYXJjaF91cmwiOiJoaWtlcjovL2VtcHR5P3M9KiomcGFnZT1meXBhZ2UiLCJncm91cCI6Iua1i+ivlSIsInNlYXJjaEZpbmQiOiJqczpcbihmdW5jdGlvbiAoKSB7XG4gIGxldCBzbW9kZSA9IE51bWJlcihnZXRJdGVtKFwic21vZGVcIiwgXCIwXCIpKTtcbiAgbGV0IHRlbXNtb2RlID0gZ2V0TXlWYXIoXCJ0ZW1zbW9kZVwiLCBcIlwiKTtcbiAgaWYgKHRlbXNtb2RlKSB7XG4gICAgc21vZGUgPSBOdW1iZXIodGVtc21vZGUpO1xuICAgIGNsZWFyTXlWYXIoXCJ0ZW1zbW9kZVwiKTtcbiAgfVxuICBpZiAoIWZpbGVFeGlzdChcImhpa2VyOi8vZmlsZXMvZGF0YS9cIiArIE1ZX1JVTEUudGl0bGUgKyBcIi9saWJzX2hpa2VyL2RycHkyLmpzXCIpKSByZXR1cm4gc2V0UmVzdWx0KFt7XG4gICAgdGl0bG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ICAgICB0aXRsZTogaXQudm9kX25hbWUsXG4gICAgICAgIGRlc2M6IGl0LnZvZF9yZW1hcmtzICsgXCLCt1wiICsgc291cmNlLm5hbWUsXG4gICAgICAgIGNvbnRlbnQ6IGl0LnZvZF9jb250ZW50LFxuICAgICAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL2RldGFpbGVkI2ltbWVyc2l2ZVRoZW1lI1wiLFxuICAgICAgICBwaWNfdXJsOiBpdC52b2RfcGljLFxuICAgICAgICBjb2xfdHlwZTogXCJtb3ZpZV8zXCIsXG4gICAgICAgIGV4dHJhOiB7XG4gICAgICAgICAgdm9kSWQ6IFN0cmluZyhpdC52b2RfaWQpLFxuICAgICAgICAgIGltZzogaXQudm9kX3BpYyxcbiAgICAgICAgICBzbmFtZTogc291cmNlLm5hbWUsXG4gICAgICAgICAgc2tleTogc291cmNlLmtleSxcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgfVxuICAgIHNldFJlc3VsdChkKTtcbiAgfSBlbHNlIHtcbiAgICBzZXRSZXN1bHQoW3tcbiAgICAgIHRpdGxlOiBcIueCueaIkeW8gOWni+iBmuWQiOaQnOe0olwiICsgTVlfS0VZV09SRCxcbiAgICAgIHVybDogXCJoaWtlcjovL3NlYXJjaD9zPVwiICsgTVlfS0VZV09SRCxcbiAgICAgIGV4dHJhOiB7XG4gICAgICAgIGRlbGVnYXRlT25seVNlYXJjaDogdHJ1ZSxcbiAgICAgICAgcnVsZXM6ICQudG9TdHJpbmcoKCkgPT4ge1xuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICBsZXQgcnVudGltZUNvbmZpZyA9IEdNLmRlZmluZU1vZHVsZShcInJ1bnRpbWVDb25maWdcIiwgXCJydW50aW1lQ29uZmlnXCIpO1xuICAgICAgICAgICAgbGV0IHNtb2RlID0gTnVtYmVyKGdldEl0ZW0oXCJzbW9kZVwiLCBcIjBcIikpO1xuICAgICAgICAgICAgbGV0IGxpc3QgPSBydW50aW1lQ29uZmlnLmdldEFsbG93U2VhcmNoU291cmNlKHNtb2RlPT09Mik7XG5cbiAgICAgICAgICAgIGxldCBzb3VyY2UgPSBydW50aW1lQ29uZmlnLmdldEN1cnJlbnRTb3VyY2UoKTtcblxuICAgICAgICAgICAgbGV0IGxpc3RpID0gbGlzdC5maW5kSW5kZXgoeCA9PiB4LmtleSA9PSBzb3VyY2Uua2V5KTtcblxuICAgICAgICAgICAgaWYgKHNvdXJjZS5zZWFyY2hhYmxlICYmIGxpc3RpICE9IC0xKSB7XG4gICAgICAgICAgICAgIGxpc3Quc3BsaWNlKGxpc3QuaW5kZXhPZihzb3VyY2UpLCAxKTtcbiAgICAgICAgICAgICAgbGlzdC51bnNoaWZ0KHNvdXJjZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsZXQgc2VhcmNoc29ydCA9IE51bWJlcihnZXRJdGVtKFwic2VhcmNoc29ydFwiLCBcIjBcIikpO1xuICAgICAgICAgICAgbGV0IHtcbiAgICAgICAgICAgICAgbmF0dXJhbFNvcnQsXG4gICAgICAgICAgICAgIHVzaW5nU29ydFxuICAgICAgICAgICAgfSA9ICQucmVxdWlyZShcIm1ldGhvZHNcIik7XG5cbiAgICAgICAgICAgIGlmIChzZWFyY2hzb3J0ID4gMCkge1xuICAgICAgICAgICAgICBpZiAoc2VhcmNoc29ydCA9PSAxKSB7XG4gICAgICAgICAgICAgICAgbmF0dXJhbFNvcnQobGlzdCwgXCJuYW1lXCIpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNlYXJjaHNvcnQgPT0gMikge1xuICAgICAgICAgICAgICAgIHVzaW5nU29ydC5zZXRrZXkoXCJuYW1lXCIpO1xuICAgICAgICAgICAgICAgIHVzaW5nU29ydC5nZXQobGlzdClcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBsZXQgcnVsZXMgPSBbXTtcbiAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGxpc3QpIHtcbiAgICAgICAgICAgICAgcnVsZXMucHVzaCh7XG4gICAgICAgICAgICAgICAgdGl0bGU6IGl0Lm5hbWUsXG4gICAgICAgICAgICAgICAgc2VhcmNoX3VybDogXCJoaWtlcjovL2VtcHR5P3BhZ2U9ZnlwYWdlJnNlYXJjaFRlcm1zPSoqXCIsXG4gICAgICAgICAgICAgICAgc2VhcmNoRmluZDogXCJqczpcIiArICQudG9TdHJpbmcoKGl0ZW0pID0+IHtcbiAgICAgICAgICAgICAgICAgIGxldCBkcnB5ID0gR00uZGVmaW5lTW9kdWxlKFwiRHJweU1hbmFnZVwiKS5nZXQoaXRlbS5rZXkpO1xuXG4gICAgICAgICAgICAgICAgICBsZXQgaG9tZUxpc3QgPSBKU09OLnBhcnNlKGRycHkuc2VhcmNoKE1ZX0tFWVdPUkQsIGZhbHNlLCBNWV9QQUdFKSkubGlzdCB8fCBbXTtcbiAgICAgICAgICAgICAgICAgIGxldCBkID0gW107XG4gICAgICAgICAgICAgICAgICBmb3IgKGxldCBpdCBvZiBob21lTGlzdCkge1xuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdC52b2RfbmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBpdC52b2RfcmVtYXJrcyxcbiAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBpdC52b2RfY29udGVudCxcbiAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL2RldGFpbGVkI2ltbWVyc2l2ZVRoZW1lI1wiLFxuICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGl0LnZvZF9waWMsXG4gICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFwibW92aWVfM1wiLFxuICAgICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2b2RJZDogU3RyaW5nKGl0LnZvZF9pZCksXG4gICAgICAgICAgICAgICAgICAgICAgICBp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cIiZkbz1qc1xcXCI7XFxuICAgIH1cXG4gICAgZXZhbChnZXRDcnlwdG9KUygpKTtcXG4gICAgZ2xvYmFsVGhpcy5DcnlwdG9KUyA9IENyeXB0b0pTO1xcblxcbiAgICBsZXQgJHJlcXVlc3QgPSByZXF1ZXN0O1xcbiAgICBsZXQgJHBvc3QgPSBwb3N0O1xcbiAgICBnbG9iYWxUaGlzLnJlcSA9IGZ1bmN0aW9uICh1cmwsIGNvYmopIHtcXG4gICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgbGV0IHJlcyA9IHt9O1xcbiAgICAgICAgICAgIGxldCBvYmogPSBPYmplY3QuYXNzaWduKHt9LCBjb2JqKTtcXG4gICAgICAgICAgICBpZiAob2JqLmRhdGEpIHtcXG4gICAgICAgICAgICAgICAgb2JqLmJvZHkgPSBvYmouZGF0YTtcXG4gICAgICAgICAgICAgICAgZGVsZXRlIG9iai5kYXRhO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBpZiAob2JqLmhhc093blByb3BlcnR5KFxcXCJyZWRpcmVjdFxcXCIpKSBvYmoucmVkaXJlY3QgPSAhIW9iai5yZWRpcmVjdDtcXG4gICAgICAgICAgICBpZiAob2JqLmJ1ZmZlciA9PT0gMikge1xcbiAgICAgICAgICAgICAgICBvYmoudG9IZXggPSB0cnVlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBvYmouaGVhZGVycyA9IE9iamVjdC5hc3NpZ24oe1xcbiAgICAgICAgICAgICAgICBDb29raWU6IFxcXCIjbm9Db29raWUjXFxcIlxcbiAgICAgICAgICAgIH0sIG9iai5oZWFkZXJzKTtcXG4gICAgICAgICAgICBpZiAodXJsID09PSBcXFwiaHR0cHM6Ly9hcGkubm4uY2kvb2NyL2I2NC90ZXh0XFxcIiAmJiBvYmouaGVhZGVycykge1xcbiAgICAgICAgICAgICAgICBvYmouaGVhZGVyc1tcXFwiQ29udGVudC1UeXBlXFxcIl0gPSBcXFwidGV4dC9wbGFpblxcXCI7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGlmICh1cmwuc3RhcnRzV2l0aChcXFwiZmlsZTovL1xcXCIpICYmICh1cmwuaW5jbHVkZXMoXFxcIj90eXBlPVxcXCIpIHx8IHVybC5pbmNsdWRlcyhcXFwiP3BhcmFtcz1cXFwiKSkpIHtcXG4gICAgICAgICAgICAgICAgdXJsID0gdXJsLnNsaWNlKDAsIHVybC5sYXN0SW5kZXhPZihcXFwiP1xcXCIpKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZm9yIChsZXQga2V5IGluIG9iai5oZWFkZXJzKSB7XFxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygb2JqLmhlYWRlcnNba2V5XSAhPT0gXFxcInN0cmluZ1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIG9iai5oZWFkZXJzW2tleV0gPSBTdHJpbmcob2JqLmhlYWRlcnNba2V5XSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IHIgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAvKiBpZiAoU3RyaW5nKG9iai5tZXRob2QpLnRvTG93ZXJDYXNlKCkgPT09IFxcXCJwb3N0XFxcIikge1xcbiAgICAgICAgICAgICAgICAgciA9ICRwb3N0KHVybCwgb2JqKTtcXG4gICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgIHIgPSAkcmVxdWVzdCh1cmwsIG9iaik7XFxuICAgICAgICAgICAgIH0qL1xcbiAgICAgICAgICAgIHIgPSAkcmVxdWVzdCh1cmwsIG9iaik7XFxuICAgICAgICAgICAgaWYgKG9iai53aXRoSGVhZGVycykge1xcbiAgICAgICAgICAgICAgICByID0gSlNPTi5wYXJzZShyKTtcXG4gICAgICAgICAgICAgICAgcmVzLmNvbnRlbnQgPSByLmJvZHk7XFxuICAgICAgICAgICAgICAgIHJlcy5oZWFkZXJzID0ge307XFxuICAgICAgICAgICAgICAgIGZvciAobGV0IFtrLCB2XSBvZiBPYmplY3QuZW50cmllcyhyLmhlYWRlcnMgfHwge30pKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXMuaGVhZGVyc1trXSA9IHZbMF07XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICByZXMuY29udGVudCA9IHI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChvYmouYnVmZmVyID09PSAyKSB7XFxuICAgICAgICAgICAgICAgIHJlcy5jb250ZW50ID0gQ3J5cHRvVXRpbC5EYXRhLnBhcnNlSGV4KHJlcy5jb250ZW50KS50b0Jhc2U2NChfYmFzZTY0Lk5PX1dSQVApO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gcmVzO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGxvZyhcXFwiRXJyb3JcXFwiICsgZS50b1N0cmluZygpKTtcXG4gICAgICAgIH1cXG4gICAgfVxcbiAgICAvKlxcbiAgICBjb25zdCBKaW5KYSA9ICQucmVxdWlyZShcXFwiaHR0cHM6Ly9jZG4uYm9vdGNkbi5uZXQvYWpheC9saWJzL211c3RhY2hlLmpzLzQuMS4wL211c3RhY2hlLmpzXFxcIik7XFxuICBcXG4gICAgY29uc3QgSlAgPSAkLnJlcXVpcmUoXFxcImh0dHBzOi8vanNvbnBhdGgtcGx1cy5naXRodWIuaW8vSlNPTlBhdGgvZGlzdC9pbmRleC1icm93c2VyLXVtZC5janNcXFwiKTtcXG4gICAgZ2xvYmFsVGhpcy5jaGVlcmlvID0ge1xcbiAgICAgICAgamluamEyKHRlbXBsYXRlLCBvYmopIHtcXG4gICAgICAgICAgICBcXG4gICAgICAgICAgICByZXR1cm4gJC5sb2coSmluSmEucmVuZGVyKHRlbXBsYXRlLCBvYmopKTtcXG4gICAgICAgIH0sXFxuICAgICAgICBqc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XNjID0gZGVzYy5jb25zdHJ1Y3RvciA9PSBBcnJheSA/IGRlc2Muam9pbignPGJyPicpIDogZGVzYztcXG4gICAgICAgIGlmIChkZXNjLnJlcGxhY2UoLyg8YnI+fFxcXFxzKykvZywgJycpLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdiaWdfYmxhbmtfYmxvY2snXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2JpZ19ibGFua19ibG9jaydcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIGNvbnN0IG1hcmsgPSAnZGVzYyc7XFxuICAgICAgICBudW0gPSB0eXBlb2YobnVtKSA9PSAndW5kZWZpbmVkJyA/IDEwMCA6IG51bVxcbiAgICAgICAgZGVzYyA9IGRlc2Muc3RhcnRzV2l0aCgn44CA44CAJykgPyBkZXNjIDogJ+OAgOOAgCcgKyBkZXNjO1xcbiAgICAgICAgZGVzYyA9IGRlc2MucmVwbGFjZSgvJy9nLCBcXFwiJiMzOTtcXFwiKTtcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoL1xcXFxyXFxcXG4vZywgXFxcIjxicj5cXFwiKTtcXG4gICAgICAgIGRlc2MgPSBkZXNjLnJlcGxhY2UoL1xcXFxuL2csIFxcXCI8YnI+XFxcIik7XFxuICAgICAgICBsZXQgc2Rlc2MgPSBzdWJzdHIoZGVzYywgbnVtKTtcXG5cXG4gICAgICAgIHZhciBjb2xvcnMgPSB7XFxuICAgICAgICAgICAgc2hvdzogXFxcImJsYWNrXFxcIixcXG4gICAgICAgICAgICBoaWRlOiBcXFwiZ3JleVxcXCJcXG4gICAgICAgIH1cXG5cXG4gICAgICAgIHZhciBsYXp5ID0gJChgI25vTG9hZGluZyNgKS5sYXp5UnVsZSgoZGMsIHNkYywgbSwgY3MpID0+IHtcXG4gICAgICAgICAgICB2YXIgc2hvdyA9IHN0b3JhZ2UwLmdldEl0ZW0obSwgJzAnKTtcXG4gICAgICAgICAgICB2YXIgdGl0bGUgPSBmaW5kSXRlbSgnZGVzYycpLnRpdGxlO1xcbiAgICAgICAgICAgIHZhciByZSA9IC8oPFxcXFwvc21hbGw+PGJyPi4qPz4pLisvZztcXG4gICAgICAgICAgICB2YXIgZXhwID0gJ+WxleW8gDonO1xcbiAgICAgICAgICAgIHZhciByZXQgPSAn5pS26LW3Oic7XFxuICAgICAgICAgICAgaWYgKHNob3cgPT0gJzEnKSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZXQsIGV4cClcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIHNkYyArICc8L3NtYWxsPicpXFxuICAgICAgICAgICAgICAgICAgICAgICAgLnJlcGxhY2UoLyg8XFxcXC9zbWFsbD48YnI+XFxcXDxmb250IGNvbG9yPVxcXCIpLio/KFxcXCI+KS8sICckMScgKyBjcy5oaWRlICsgJyQyJylcXG5cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAuc2V0SXRlbShtLCAnMCcpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ2Rlc2MnLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGVcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShleHAsIHJldClcXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZShyZSwgJyQxJyArIGRjICsgJzwvc21hbGw+JylcXG4gICAgICAgICAgICAgICAgICAgICAg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AgICAgICAgICBsaW5lU3BhY2luZzogNixcXG4gICAgICAgICAgICAgICAgdGV4dFNpemU6IDE1LFxcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogdHJ1ZSxcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxuXFxuICAgIGxldCBzb3J0b2JqID0gW3tcXG4gICAgICAgICAgICB0aXRsZTogZm9udHN0eWxlKFxcXCLihr9cXFwiLCB7XFxuICAgICAgICAgICAgICAgIGg6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICBjOiBcXFwiIzFBQUQxOVxcXCIsXFxuICAgICAgICAgICAgICAgIHRhZ3M6IFxcXCJiXFxcIlxcbiAgICAgICAgICAgIH0pICsgZm9udHN0eWxlKFxcXCLih4JcXFwiLCB7XFxuICAgICAgICAgICAgICAgIGg6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICB0YWdzOiBcXFwiYlxcXCJcXG4gICAgICAgICAgICB9KSArIFxcXCJcXFxcdFxcXCIsXFxuICAgICAgICAgICAgaW1nOiBcXFwiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8xMjMuc3ZnXFxcIlxcbiAgICAgICAgfSxcXG4gICAgICAgIHtcXG4gICAgICAgICAgICB0aXRsZTogZm9udHN0eWxlKFxcXCLihr9cXFwiLCB7XFxuICAgICAgICAgICAgICAgIGg6IGZhbHNlLFxcbiAgICAgICAgICAgICAgICB0YWdzOiBcXFwiYlxcXCJcXG4gICAgICAgICAgICB9KSArIGZvbnRzdHlsZShcXFwi4oeCXFxcIiwge1xcbiAgICAgICAgICAgICAgICBoOiBmYWxzZSxcXG4gICAgICAgICAgICAgICAgYzogXFxcIiNGRjAwMDBcXFwiLFxcbiAgICAgICAgICAgICAgICB0YWdzOiBcXFwiYlxcXCJcXG4gICAgICAgICAgICB9KSArIFxcXCJcXFxcdFxcXCIsXFxuICAgICAgICAgICAgaW1nOiBcXFwiaHR0cHM6Ly9oaWtlcmZhbnMuY29tL3R1Ymlhby9tZXNzeS8xMjQuc3ZnXFxcIlxcbiAgICAgICAgfVxcbiAgICBdXFxuXFxuICAgIHZhciBzb3J0aSA9IGdldE15VmFyKFxcXCJzb3J0aVxcXCIsIFxcXCIwXFxcIik7XFxuXFxuICAgIC8vbG9nKHNvcnRvYmopXFxuICAgICQuZXh0ZW5kKHtcXG4gICAgICAgIHNwbGl0UGFnZSh0b3RhbEl0ZW1zLCBwYWdlU2l6ZSkge1xcbiAgICAgICAgICAgIHBhZ2VTaXplID0gTnVtYmVyKHBhZ2VTaXplKSB8fCA1MDtcXG4gICAgICAgICAgICBsZXQgcmVzdWx0ID0gW107XFxuICAgICAgICAgICAgaWYgKHBhZ2VTaXplID09IDApIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFtgMS0ke3RvdGFsSXRlbXN9YF1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZm9yIChsZXQgaSA9IDE7IGkgPD0gdG90YWxJdGVtczsgaSArPSBwYWdlU2l6ZSkge1xcbiAgICAgICAgICAgICAgICBsZXQgZW5kID0gaSArIHBhZ2VTaXplIC0gMTtcXG4gICAgICAgICAgICAgICAgaWYgKGVuZCA+IHRvdGFsSXRlbXMpIHtcXG4gICAgICAgICAgICAgICAgICAgIGVuZCA9IHRvdGFsSXRlbXM7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmVzdWx0LnB1c2goYCR7aX0tJHtlbmR9YCk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XFxuICAgICAgICB9LFxcbiAgICAgICAgc3BsaXRBcnJheUJ5UmFuZ2VzKGFycmF5LCByYW5nZXMpIHtcXG4gICAgICAgICAgICAvLyDmoLnmja7ojIPlm7Tmi4bliIbmlbDnu4RcXG4gICAgICAgICAgICB2YXIgcmVzdWx0ID0gcmFuZ2VzLm1hcChmdW5jdGlvbihyYW5nZSkge1xcbiAgICAgICAgICAgICA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0gXFxcIlxcXCIpLmxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICBwbGF5cGFnZXNbaV0gPSBwYWdlcztcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRjID4gMjQpIHtcXG4gICAgICAgICAgICAgICAgY29sID0gXFxcInRleHRfMVxcXCI7XFxuICAgICAgICAgICAgICAgIGltZyA9IFxcXCJodHRwczovL2hpa2VyZmFucy5jb20vdHViaWFvL21vdmllLzE0Ni5zdmdcXFwiO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodGMgPj0gMTIgJiYgdGMgPCAxNSkge1xcbiAgICAgICAgICAgICAgICBjb2wgPSBcXFwidGV4dF8zXFxcIjtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHRjID49IDE1KSB7XFxuICAgICAgICAgICAgICAgIGNvbCA9IFxcXCJ0ZXh0XzJcXFwiO1xcbiAgICAgICAgICAgICAgICB0ZXh0YWxpZ24gPSBcXFwibGVmdFxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBwbGF5b2JqID0gdC5zcGxpdChcXFwiI1xcXCIpLm1hcCgoaiwgaWkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGsgPSBqLnNwbGl0KFxcXCIkXFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCB0ID0ga1swXTtcXG4gICAgICAgICAgICAgICAgbGV0IHVpZCA9IChrWzFdIHx8IGtbMF0pO1xcbiAgICAgICAgICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICAgICAgICAgICAgc3RpdGxlOiB0LFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGZvbnRzdHlsZSh0LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGFnczogXFxcInNtYWxsXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgICAgICBzdXJsOiB1aWQgKyBcXFwiI1xcXCIgKyBmcm9tW2ldLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBpc05vdmVsID8gXFxcImhpa2VyOi8vcGFnZS9ub3ZlbCNhdXRvUGFnZSMjcmVhZFRoZW1lI1xcXCIgOiAodWlkICsgXFxcIiNcXFwiICsgZnJvbVtpXSArIHBsYXlMYXp5KSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBjb2wsXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgICAgIC8qZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sIGV4dHJhLCB7XFxuICAgICAgICAgICAgICAgICAgICAgIFxcXCJSZWZlcmVyXFxcIjogZGVjb2RlVVJJQ29tcG9uZW50KGtbMV0pLFxcbiAgICAgICAgICAgICAgICAgICAgICBpZDoga1sxXSxcXG4gICAgICAgICAgICAgICAgICAgICAgLy9saW5lVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICAgIHRleHRBbGlnbjogdGV4dGFsaWduLFxcbiAgICAgICAgICAgICAgICAgICAgICBjbHM6IFxcXCJwbGF5bGlzdFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICB9KSovXFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZyb206IGZyb21baV0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlOiBzb3VyY2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IHVpZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBibG9ja1J1bGVzOiBbJ2JiLioucG5nJywgJy5qcGcnLCBcXFwiaG1cXFxcLmJhaWR1XFxcXC5jb21cXFxcL2htLmpzXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgdmlkZW9FeGNsdWRlUnVsZXM6IFsnP3VybD0nXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGV4dEFsaWduOiB0ZXh0YWxpZ24sXFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiBcXFwicGxheWxpc3RcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgIH0pO1xcblxcbiAgICAgICAgICAgIGlmIChzdHlwZSA9PSBcXFwi5ryr55S7XFxcIiB8fCBzdHlwZSA9PSBcXFwi5bCP6K+0XFxcIikge1xcblxcbiAgICAgICAgICAgICAgICB2YXIgZG93bmxvYWRsYXp5ID0gJC50b1N0cmluZygoa2V5LCBza2V5LCB0aXRsZSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGRycHk7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoJC5oaWtlcltcXFwiX19kcnB5X19cXFwiXSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGRycHkgPSAkLmhpa2VyW1xcXCJfX2RycHlfX1xcXCJdO1xcblxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBHTVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gPSAkLnJlcXVpcmUoXFxcImh0dHA6Ly9oaWtlci5ub2tpYS5wcmVzcy9oaWtlcnVsZS9ydWxlbGlzdC5qc29uP2lkPTY5MTYmYXV0aD0xZDM1ZThmMC0yMmU4LTUyNzAtYTlkMS04MjZmNTNmMTc3YWRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBHTS5zZXRTZWxmS2V5KGtleSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IERycHlNYW5hZ2UgPSBHTS5kZWZpbmVNb2R1bGUoXFxcIkRycHlNYW5hZ2VcXFwiLCBcXFwiRHJweU1hbmFnZT9ydWxlPVxcXCIgKyB0aXRsZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZHJweSA9IERycHlNYW5hZ2UuZ2V0KHNrZXkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICQuaGlrZXJbXFxcIl9fZHJweV9fXFxcIl0gPSBkcnB5O1xcbiAgICAgICAgICAgICAgICAgICAgICAgICQuaGlrZXJbXFxcIl9fdGVzdF9fXFxcIl0gPSBbXTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGlucHV0ID0gaW5wdXQuc3BsaXQoXFxcIiNcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCByZXN1bHQgPSBKU09OLnBhcnNlKGRycHkucGxheShpbnB1dFsxXSwgaW5wdXRbMF0pKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChyZXN1bHQudXJsLnN0YXJ0c1dpdGgoXFxcInBpY3M6Ly9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQudXJsO1xcbiAgICAgICAgICAgICAgICAgICAgfWVsc2UgaWYgKHJlc3VsdC51cmwuc3RhcnRzV2l0aChcXFwibm92ZWw6Ly9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjb250ZW50PUpTT04ucGFyc2UocmVzdWx0LnVybC5yZXBsYWNlKFxcXCJub3ZlbDovL1xcXCIsIFxcXCJcXFwiKSkuY29udGVudDtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgY21kNT1tZDUoY29udGVudCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGluZGV4PTA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoKGluZGV4PSQuaGlrZXJbXFxcIl9fdGVzdF9fXFxcIl0uaW5kZXhPZihjbWQ1KSkhPT0tMSl7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxvZyhcXFwi6YeN5aSN77yaXFxcIitpbnB1dCtcXFwiPT5cXFwiK2luZGV4KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgJC5oaWtlcltcXFwiX190ZXN0X19cXFwiXS5wdXNoKGNtZDUpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBjb250ZW50O1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLmvKvnlLvmiJbmraPmlofojrflj5blpLHotKVcXFwiKTtcXG4gICAgICAgICAgICAgICAgfSwgR00uZ2V0U2VsZktleSgpLCBNWV9QQVJBTVMuc2tleSwgTVlfUlVMRS50aXRsZSk7XFxuXFxuICAgICAgICAgICAgICAgIGxldCBjaGFwdGVyTGlzdCA9IHBsYXlvYmouZXhjbHVkZUtleXMoW1xcXCJzdXJsXFxcIiwgXFxcInN0aXRsZVxcXCJdLCBmYWxzZSkudHJhbnNmb3JtS2V5cyh7XFxuICAgICAgICAgICAgICAgICAgICBcXFwic3VybFxcXCI6IFxcXCJ1cmxcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgXFxcInN0aXRsZVxcXCI6IFxcXCJ0aXRsZVxcXCJcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgIHdyaXRlRmlsZShcXFwiaGlrZXI6Ly9maWxlcy9fY2FjaGUvZHJfZG93X2xpc3QuanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KGNoYXB0ZXJMaXN0KSk7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuS4i+i9vVxcXCIgKyBzdHlwZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9kb3dubG9hZC52aWV3I25vUmVjb3JkSGlzdG9yeSMjbm9SZWZyZXNoIz9ydWxlPeacrOWcsOi1hOa6kOeuoeeQhicsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjaGFwdGVyTGlzdDogXFxcImhpa2VyOi8vZmlsZXMvX2NhY2hlL2RyX2Rvd19saXN0Lmpzb25cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZm86IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9va05hbWU6IGluZm8udm9kX25hbWUsIC8v5ryr55S75ZCN56ewLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlTmFtZTogTVlfUlVMRS50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9va1RvcFBpYzogaW5mby52b2RfcGljLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJzZUNvZGU6IGRvd25sb2FkbGF6eSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9va0lkOiBNWV9QQVJBTVMuc25hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHR5cGU6IHN0eXBlID09PSBcXFwi5ryr55S7XFxcIiA/IFxcXCJjb21pY1xcXCIgOiBcXFwibm92ZWxcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdFZpZXc6IFxcXCIxXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5pys5Zyw5Lmm5p62XFxcIixcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vcGFnZS9Cb29rcmFjay52aWV3I25vUmVjb3JkSGlzdG9yeSM/cnVsZT3mnKzlnLDotYTmupDnrqHnkIYmcnVsZU5hbWU9JyArIE1ZX1JVTEUudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0eXBlOiBzdHlwZSA9PT0gXFxcIua8q+eUu1xcXCIgPyBcXFwiY29taWNcXFwiIDogXFxcIm5vdmVsXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdibGFua19ibG9jaydcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIHBsYXlvYmogPSAkLnNwbGl0QXJyYXlCeVJhbmdlcyhwbGF5b2JqLCBwYWdlcyk7XFxuICAgICAgICAgICAgcmV0dXJuIHBsYXlvYmo7XFxuICAgICAgICB9KTtcXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIlxcbiAgICAgICAgfSwge1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5pqC5peg5pKt5pS+5rqQ5oiW5pKt5pS+5YiX6KGo5a6a5L2N6ZSZ6K+vXFxcIixcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfY2VudGVyXzFcXFwiLFxcbiAgICAgICAgICAgIHVybDogTVlfUEFSQU1TLnZvZElkLFxcbiAgICAgICAgfSk7XFxuICAgICAgICBjYWNoZVNob3dUaXBzKCk7XFxuICAgICAgICBzZXRSZXN1bHQoZCk7XFxuICAgIH1cXG5cXG5cXG4gICAgbGV0IGN1cnJlbnRMb2NhdGlvbiA9IDA7XFxuXFxuICAgIGlmIChmcm9tLmxlbmd0aCkge1xcbiAgICAgICAgZXJPcHRpb25zLnNldChcXFwiZnJvbVxcXCIsIGZyb20pO1xcbiAgICAgICAgZXJPcHRpb25zLnNldChcXFwidG90YWxcXFwiLCBwbGF5VXJsTGlzdC5tYXAoeCA9PiB4Lmxlbmd0aCkpO1xcbiAgICAgICAgZXJPcHRpb25zLnNldChcXFwicGxheXNcXFwiLCBwbGF5VXJsTGlzdC5tYXAoeCA9PiB4LmZsYXQoKS5sZW5ndGgpKTtcXG4gICAgfVxcblxcblxcbiAgICBmdW5jdGlvbiByZW5vdmF0ZUxpc3QobG9jYXRpb24pIHtcXG4gICAgICAgIC8vZGVsZXRlSXRlbUJ5Q2xzKFxcXCJwbGF5cGFnZVxcXCIpO1xcbiAgICAgICAgLy9kZWxldGVJdGVtQnlDbHMoXFxcInBsYXlsaXN0XFxcIik7XFxuXFxuICAgICAgICBpZiAocGxheVVybExpc3QubGVuZ3RoID09IDApIHtcXG4gICAgICAgICAgICByZXR1cm47XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgaGlzID0gaGlzdG9yeWxvZyhcXFwiZ2V0XFxcIiwgTVlfUEFSQU1TLnNrZXksIG1kNShNWV9QQVJBTVMudm9kSWQpKTtcXG5cXG5cXG4gICAgICAgIGxldCBwYWdlbnVtID0gZ2V0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCAoaGlzIHx8IFxcXCIwXFxcIikpO1xcblxcbiAgICAgICAgbGV0IHBjb3VudCA9IHBsYXlVcmxMaXN0W2xvY2F0aW9uXS5sZW5ndGg7XFxuICAgICAgICBsZXQgbGlzdCA9IHBsYXlVcmxMaXN0W2xvY2F0aW9uXVtwYWdlbnVtXTtcXG4gICAgICAgIGlmICghbGlzdCkge1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSBwYWdlbnVtOyBpID49IDA7IGktLSkge1xcbiAgICAgICAgICAgICAgICBsaXN0ID0gcGxheVVybExpc3RbbG9jYXRpb25dW2ldO1xcbiAgICAgICAgICAgICAgICBpZiAobGlzdCkge1xcbiAgICAgICAgICAgICAgICAgICAgcGFnZW51bSA9IGk7XFxuICAgICAgICAgICAgICAgICAgICBicmVhaztcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1c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BEYXRlKCkuZ2V0VGltZSgpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgbGV0IHRlbXAgPSB7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJyxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogXFxcInBsYXlwYWdlXFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcblxcbiAgICAgICAgICAgIGxldCBmYyA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgIGlmICghKHBsYXlwICYmIHBsYXlwLmxlbmd0aCA+IDEpKSB7XFxuICAgICAgICAgICAgICAgIGZjID0gXFxcImdyZXlcXFwiO1xcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICBsZXQgcGFnZW9iaiA9IFt7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBmb250c3R5bGUoJ+S4iuS4gOmhtScsIHtcXG4gICAgICAgICAgICAgICAgICAgIGM6IGZjXFxuICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaWQsIHBjb3VudCwgcGFnZW51bSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGxvY2F0aW9uID0gZ2V0TXlWYXIoaWQgKyBcXFwic291cmNlaVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZWYgPSAkLnJlcXVpcmUoXFxcIm1ldGhvZHNcXFwiKS5nZXRFSW5mbygpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBjb3VudCA9IGVmLm1heFtsb2NhdGlvbl07XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGFnZW51bSA9IGVmLnBhZ2VudW07XFxuICAgICAgICAgICAgICAgICAgICBpZiAocGNvdW50ID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBhZ2VudW0gPT0gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZ2VudW0gPSBwY291bnQgLSAxO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlbnVtLS07XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFN0cmluZyhwYWdlbnVtKSk7XFxuICAgICAgICAgICAgICAgICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHt9KShsb2NhdGlvbik7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICB9LCBpZCwgcGNvdW50LCBTdHJpbmcocGFnZW51bSkpLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBcXFwicGxheXBhZ2VcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJwbGF5cGFnZUB1cFxcXCJcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IGZvbnRzdHlsZShwbGF5cFtwYWdlbnVtXSwge1xcbiAgICAgICAgICAgICAgICAgICAgYzogZmNcXG4gICAgICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8yXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpZCwgcGFnZW51bSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGxvY2F0aW9uID0gZ2V0TXlWYXIoaWQgKyBcXFwic291cmNlaVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGFnZW51bSA9IGdldE15VmFyKFxcXCJwYWdlbnVtXFxcIiwgcGFnZW51bSk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgZWYgPSAkLnJlcXVpcmUoXFxcIm1ldGhvZHNcXFwiKS5nZXRFSW5mbygpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBjb3VudCA9IGVmLm1heFtsb2NhdGlvbl07XFxuICAgICAgICAgICAgICAgICAgICBpZiAocGNvdW50ID09IDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBsYXlwID0gZWYucGxheXA7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGFnZWFyciA9IHBsYXlwLm1hcCgoeCwgaSkgPT4gaSA9PSBwYWdlbnVtID8gJ+KAnOKAnOKAneKAnScgKyB4LmZvbnRjb2xvcihcXFwiI2ZmYTUwMFxcXCIpIDogeCk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJChwYWdlYXJyLCAzKS5zZWxlY3QoKGxvY2F0aW9uKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCBTdHJpbmcoTVlfSU5ERVgpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHt9KShsb2NhdGlvbik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSwgbG9jYXRpb24pXFxuICAgICAgICAgICAgICAgIH0sIGlkLCBwYWdlbnVtKSxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsczogXFxcInBsYXlwYWdlXFxcIixcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBcXFwicGxheXBhZ2VAcGFnZWFyclxcXCIsXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBmb250c3R5bGUoJ+S4i+S4gOmhtScsIHtcXG4gICAgICAgICAgICAgICAgICAgIGM6IGZjXFxuICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaWQpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBsb2NhdGlvbiA9IGdldE15VmFyKGlkICsgXFxcInNvdXJjZWlcXFwiLCBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IGVmID0gJC5yZXF1aXJlKFxcXCJtZXRob2RzXFxcIikuZ2V0RUluZm8oKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwY291bnQgPSBlZi5tYXhbbG9jYXRpb25dO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHBhZ2VudW0gPSBlZi5wYWdlbnVtO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHBjb3VudCA9PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgIGlmIChwYWdlbnVtID49IHBjb3VudCAtIDEpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWdlbnVtID0gMDtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZW51bSsrO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCBTdHJpbmcocGFnZW51bSkpO1xcbiAgICAgICAgICAgICAgICAgICAgR00uZ2V0KFxcXCJyZW5vdmF0ZUxpc3RcXFwiLCAoKSA9PiB7fSkobG9jYXRpb24pO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICAgICAgfSwgaWQpLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgY2xzOiBcXFwicGxheXBhZ2VcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgaWQ6IFxcXCJwbGF5cGFnZUBuZXh0XFxcIlxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfV1cXG5cXG4gICAgICAgICAgICBsZXQgcGxpbmUgPSBkLmZpbmRJbmRleCh4ID0+IHguZXh0cmEgJiYgeC5leHRyYS5pZCA9PSBcXFwicGxheXBhZ2VsaW5lXFxcIik7XFxuXFxuICAgICAgICAgICAgaWYgKGdldE15VmFyKFxcXCJwbGF5bGlzdF9yZWFkeVxcXCIsIFxcXCIwXFxcIikgPT0gXFxcIjBcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGlmIChwbGluZSA+IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgICBpbnNlcnRBcnJheUF0KGQsIHBsaW5lICsgMSwgcGFnZW9iaik7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgLy9BcnJheS5wcm90b3R5cGUucHVzaC5hcHBseShkLHBhZ2VvYmopO1xcbiAgICAgICAgICAgICAgICAvL2FkZEl0ZW1BZnRlcihcXFwicGxheXBhZ2VsaW5lXFxcIiwgcGFnZW9iaik7XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKFxcXCJub3BhZ2VcXFwiLCBcXFwiMFxcXCIpID09IFxcXCIxXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgYWRkSXRlbUFmdGVyKFxcXCJwbGF5cGFnZWxpbmVcXFwiLCBwYWdlb2JqKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcIm5vcGFnZVxcXCIpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcInBsYXlwYWdlQHVwXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHBhZ2VvYmpbMF0udGl0bGUsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcInBsYXlwYWdlQHBhZ2VhcnJcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogcGFnZW9ialsxXS50aXRsZSxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwicGxheXBhZ2VAbmV4dFxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwYWdlb2JqWzJdLnRpdGxlLFxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAvLyBhZGRJdGVtQWZ0ZXIoXFxcInBsYXlwYWdlbGluZVxcXCIsIFt7XFxuICAgICAgICAgICAgLy8gICB0aXRsZTogJ+S4iuS4gOmhtScsXFxuICAgICAgICAgICAgLy8gICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCIsXFxuICAgICAgICAgICAgLy8gICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGxvY2F0aW9uLCBwY291bnQpID0+IHtcXG4gICAgICAgICAgICAvLyAgICAgbGV0IHBhZ2VudW0gPSBnZXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgLy8gICAgIGlmIChwYWdlbnVtID09IDApIHtcXG4gICAgICAgICAgICAvLyAgICAgICBwYWdlbnVtID0gcGNvdW50IC0gMTtcXG4gICAgICAgICAgICAvLyAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAvLyAgICAgICBwYWdlbnVtLS07XFxuICAgICAgICAgICAgLy8gICAgIH1cXG4gICAgICAgICAgICAvLyAgICAgcHV0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCBTdHJpbmcocGFnZW51bSkpO1xcbiAgICAgICAgICAgIC8vICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHsgfSkobG9jYXRpb24pO1xcbiAgICAgICAgICAgIC8vICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgIC8vICAgfSwgbG9jYXRpb24sIHBjb3VudCksXFxuICAgICAgICAgICAgLy8gICBleHRyYToge1xcbiAgICAgICAgICAgIC8vICAgICBjbHM6IFxcXCJwbGF5cGFnZVxcXCJcXG4gICAgICAgICAgICAvLyAgIH1cXG4gICAgICAgICAgICAvLyB9LCB7XFxuICAgICAgICAgICAgLy8gICB0aXRsZTogcGxheXBbcGFnZW51bV0sXFxuICAgICAgICAgICAgLy8gICBjb2xfdHlwZTogXFxcInRleHRfMlxcXCIsXFxuICAgICAgICAgICAgLy8gICB1cmw6ICQocGFnZWFyciwgMykuc2VsZWN0KChsb2NhdGlvbikgPT4ge1xcbiAgICAgICAgICAgIC8vICAgICBwdXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFN0cmluZyhNWV9JTkRFWCkpO1xcbiAgICAgICAgICAgIC8vICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHsgfSkobG9jYXRpb24pO1xcbiAgICAgICAgICAgIC8vICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgLy8gICB9LCBsb2NhdGlvbiksXFxuICAgICAgICAgICAgLy8gICBleHRyYToge1xcbiAgICAgICAgICAgIC8vICAgICBjbHM6IFxcXCJwbGF5cGFnZVxcXCJcXG4gICAgICAgICAgICAvLyAgIH1cXG4gICAgICAgICAgICAvLyB9LCB7XFxuICAgICAgICAgICAgLy8gICB0aXRsZTogJ+S4i+S4gOmhtScsXFxuICAgICAgICAgICAgLy8gICBjb2xfdHlwZTogXFxcInRleHRfNFxcXCIsXFxuICAgICAgICAgICAgLy8gICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGxvY2F0aW9uLCBwY291bnQpID0+IHtcXG4gICAgICAgICAgICAvLyAgICAgbGV0IHBhZ2VudW0gPSBnZXRNeVZhcihcXFwicGFnZW51bVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgLy8gICAgIGlmIChwYWdlbnVtID49IHBjb3VudCAtIDEpIHtcXG4gICAgICAgICAgICAvLyAgICAgICBwYWdlbnVtID0gMDtcXG4gICAgICAgICAgICAvLyAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAvLyAgICAgICBwYWdlbnVtKys7XFxuICAgICAgICAgICAgLy8gICAgIH1cXG4gICAgICAgICAgICAvLyAgICAgcHV0TXlWYXIoXFxcInBhZ2VudW1cXFwiLCBTdHJpbmcocGFnZW51bSkpO1xcbiAgICAgICAgICAgIC8vICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHsgfSkobG9jYXRpb24pO1xcbiAgICAgICAgICAgIC8vICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgIC8vICAgfSwgbG9jYXRpb24sIHBjb3VudCksXFxuICAgICAgICAgICAgLy8gICBleHRyYToge1xcbiAgICAgICAgICAgIC8vICAgICBjbHM6IFxcXCJwbGF5cGFnZVxcXCJcXG4gICAgICAgICAgICAvLyAgIH1cXG4gICAgICAgICAgICAvLyB9XSlcXG4gICAgICAgICAgICAvKnBsYXlwID0gcGxheXAubWFwKCh4LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgbGV0IG9iaiA9IE9iamVjdC5hc3NpZ24oe30sIHRlbXAsIHtcXG4gICAgICAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIChwYWdlbnVtID09IGkgPyB4LmZvbnRjb2xvcihcXFwicmVkXFxcIikgOiB4KSxcXG4gICAgICAgICAgICAgICAgIGNvbF90eXBlOlxcXCJzY3JvbGxfYnV0dG9uXFxcIixcXG4gICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoXFxcInBhZ2VudW1cXFwiKSA9PSBpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJwYWdlbnVtXFxcIiwgU3RyaW5nKGkpKTtcXG4gICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKFxcXCJwbGF5bGlzdFxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIoXFxcInBsYXlsaXN0c1xcXCIsICQudGVtcF9saXN0W2ldKTtcXG4gICAgICAgICAgICAgICAgICAgZmluZEl0ZW1zQnlDbHMoXFxcInBsYXlwYWdlXFxcIikuZm9yRWFjaCgoeCwgaWkpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICBsZXQgdGl0bGUgPSB4LnRpdGxlLnJlcGxhY2UoL+KAmHzigJl84oCcfOKAnXw8W14+XSs+L2csIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICBpZiAoaWkgPT0gaSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgdGl0bGUgPSAn4oCc4oCc4oCd4oCdJyArIHRpdGxlLmZvbnRjb2xvcihcXFwicmVkXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oeC5leHRyYS5pZCwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICAgICAgICAgICB9LCBpKSxcXG4gICAgICAgICAgICAgICAgIGV4dHJhOiBPYmplY3QuYXNzaWduKHt9LCB0ZW1wLmV4dHJhLCB7XFxuICAgICAgICAgICAgICAgICAgIGlkOiBcXFwicGFnZW51bVxcXCIgKyBpLFxcbiAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgIHJldHVybiBvYmo7XFxuICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcihcXFwicGxheXBhZ2VsaW5lXFxcIiwgcGxheXApKi9cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKFxcXCJwbGF5cGFnZVxcXCIpO1xcbiAgICAgICAgICAgIHB1dE15VmFyKFxcXCJub3BhZ2VcXFwiLCBcXFwiMVxcXCIpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGdldE15VmFyKFxcXCJwbGF5bGlzdF9yZWFkeVxcXCIsIFxcXCIwXFxcIikgPT0gXFxcIjFcXFwiKSB7XFxuICAgICAgICAgICAgbGV0IG9sZElkcyA9IChmaW5kSXRlbXNCeUNscygncGxheWxpc3QnKSB8fCBbXSkubWFwKGl0ID0+IGl0LmV4dHJhLmlkKTtcXG4gICAgICAgICAgICBsZXQgdG9EZWxldGVJZHMgPSBbXTsgLy/lvoXliKDpmaTnmoTml6dpZFxcbiAgICAgICAgICAgIGxldCB0b0FkZERhdGFzID0gW107IC8v5b6F5paw5aKe55qE5paw5pWw5o2uXFxuICAgICAgICAgICAgaWYgKG9sZElkcy5sZW5ndGggPiBsaXN0Lmxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICB0b0RlbGV0ZUlkcyA9IG9sZElkcy5zbGljZShsaXN0Lmxlbmd0aCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChvbGRJZHMubGVuZ3RoIDwgbGlzdC5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgdG9BZGREYXRhcyA9IGxpc3Quc2xpY2Uob2xkSWRzLmxlbmd0aClcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IGNudCA9IE1hdGgubWluKG9sZElkcy5sZW5ndGgsIGxpc3QubGVuZ3RoKTtcXG4gICAgICAgICAgICBpZiAodG9EZWxldGVJZHMubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAvL+acieWIoOmZpOeahOWFiOWIoOmZpFxcbiAgICAgICAgICAgICAgICBkZWxldGVJdGVtKHRvRGVsZXRlSWRzKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKHRvQWRkRGF0YXMubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAvL+acieaWsOWinueahOWFiOaWsOWinlxcbiAgICAgICAgICAgICAgICBhZGRJdGVtQWZ0ZXIob2xkSWRzW2NudCAtIDFdLCB0b0FkZERhdGFzKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgLy9zaG93TG9hZGluZygn5Yqg6L295LitJylcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IGNudDsgaSsrKSB7XFxuICAgICAgICAgICAgICAgIC8v5pyA5ZCO6aG65bqP5pu05pawXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ob2xkSWRzW2ldLCBsaXN0W2ldKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGVsc2Uge1xcblxcbiAgICAgICAgICAgIC8vbG9nKGxpc3QubGVuZ3RoKVxcbiAgICAgICAgICAgIGlmIChsaXN0KSB7XFxuICAgICAgICAgICAgICAgIGxldCBwbHMgPSBkLmZpbmRJbmRleCh4ID0+IHguZXh0cmEgJiYgeC5leHRyYS5pZCA9PSBcXFwicGxheWxpc3RzXFxcIik7XFxuICAgICAgICAgICAgICAgIGlmIChwbHMgPiAtMSkge1xcbiAgICAgICAgICAgICAgICAgICAgaW5zZXJ0QXJyYXlBdChkLCBwbHMgKyAxLCBsaXN0KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAvL0FycmF5LnByb3RvdHlwZS5wdXNoLmFwcGx5KGQsbGlzdCk7XFxuICAgICAgICAgICAgICAgIC8vYWRkSXRlbUFmdGVyKFxcXCJwbGF5bGlzdHNcXFwiLCBsaXN0KTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInBsYXlsaXN0X3JlYWR5XFxcIiwgXFxcIjFcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuXFxuICAgICAgICB1cGRhdGVJdGVtKFxcXCJsb2NhdGlvbkBcXFwiICsgY3VycmVudExvY2F0aW9uLCB7XFxuICAgICAgICAgICAgdGl0bGU6IGZyb21bY3VycmVudExvY2F0aW9uXSxcXG4gICAgICAgIH0pO1xcblxcbiAgICAgICAgdXBkYXRlSXRlbShcXFwibG9jYXRpb25AXFxcIiArIGxvY2F0aW9uLCB7XFxuICAgICAgICAgICAgdGl0bGU6IGZvbnRzdHlsZShmcm9tW2xvY2F0aW9uXSwge1xcbiAgICAgICAgICAgICAgICBjOiBcXFwiI0ZGRDcwMFxcXCIsXFxuICAgICAgICAgICAgIC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SdWxlKChzbykgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgc2kgPSBnZXRNeVZhcihcXFwic29ydGlcXFwiLCBcXFwiMFxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgaWkgPSAoc2kgPT0gXFxcIjBcXFwiID8gXFxcIjFcXFwiIDogXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwiQHNvcnRcXFwiLCB7XFxuICAgICAgICAgICAgICAgICAgICBkZXNjOiBzb1tpaV0udGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICBpbWc6IHNvW2lpXS5pbWcsXFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIHZhciBwbGF5cyA9IGZpbmRJdGVtc0J5Q2xzKFxcXCJwbGF5bGlzdFxcXCIpLnJldmVyc2UoKS5tYXAoeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICB4LmNvbF90eXBlID0geC50eXBlO1xcbiAgICAgICAgICAgICAgICAgICAgeC5leHRyYS5pZCA9IHguZXh0cmEuaWQuZW5kc1dpdGgoXFxcIuKHhVxcXCIpID8geC5leHRyYS5pZC5yZXBsYWNlKC/ih4UkLywgXFxcIlxcXCIpIDogeC5leHRyYS5pZCArIFxcXCLih4VcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHg7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBsZXQgb2xkSWRzID0gKGZpbmRJdGVtc0J5Q2xzKCdwbGF5bGlzdCcpIHx8IFtdKS5tYXAoaXQgPT4gaXQuZXh0cmEuaWQpO1xcblxcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG9sZElkcy5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICAgICAgLy/mnIDlkI7pobrluo/mm7TmlrBcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0ob2xkSWRzW2ldLCBwbGF5c1tpXSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgbGV0IG5ld0l0ZW0gPSAoZmluZEl0ZW1zQnlDbHMoJ3BsYXlsaXN0JykgfHwgW10pO1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5ld0l0ZW0ubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIC8v5pyA5ZCO6aG65bqP5pu05pawXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKG5ld0l0ZW1baV0uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYTogT2JqZWN0LmFzc2lnbih7fSwgbmV3SXRlbVtpXS5leHRyYSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogbmV3SXRlbVtpXS5leHRyYS5pZC5yZXBsYWNlKC/ih4UkLywgXFxcIlxcXCIpXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9XFxuXFxuICAgICAgICAgICAgICAgIC8vIGRlbGV0ZUl0ZW1CeUNscyhcXFwicGxheWxpc3RcXFwiKTtcXG4gICAgICAgICAgICAgICAgLy8gYWRkSXRlbUFmdGVyKFxcXCJwbGF5bGlzdHNcXFwiLCBwbGF5cyk7XFxuXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJzb3J0aVxcXCIsIGlpKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL1xcXCIgKyAoaWkgPT0gXFxcIjBcXFwiID8gXFxcIuato+W6j1xcXCIgOiBcXFwi5YCS5bqPXFxcIik7XFxuICAgICAgICAgICAgICAgIC8vcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgICAgICB9LCBzb3J0b2JqKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ2F2YXRhcicsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IFxcXCJAc29ydFxcXCIsXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChmcm9tLmxlbmd0aCA+IDEpIHtcXG4gICAgICAgICAgICBmb3IgKGxldCBpIGluIGZyb20pIHtcXG4gICAgICAgICAgICAgICAgbGV0IGNpID0gZ2V0TXlWYXIoaWQgKyBcXFwic291cmNlaVxcXCIsIFxcXCIwXFxcIik7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogKGkgPT0gY2kgPyBmb250c3R5bGUoZnJvbVtpXSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGM6IFxcXCIjRkZENzAwXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICB0YWdzOiBcXFwiXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgfSkgOiBmcm9tW2ldKSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaSwgaWQpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoaWQgKyBcXFwic291cmNlaVxcXCIsIFxcXCIwXFxcIikgPT0gaSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihpZCArIFxcXCJzb3VyY2VpXFxcIiwgU3RyaW5nKGkpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBHTS5nZXQoXFxcInJlbm92YXRlTGlzdFxcXCIsICgpID0+IHt9KShpKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfSwgaSwgaWQpLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbHM6IFxcXCJsb2NhdGlvbkBcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBcXFwibG9jYXRpb25AXFxcIiArIGlcXG4gICAgICAgICAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgfVxcblxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBcXFwicGxheXBhZ2VsaW5lXFxcIlxcbiAgICAgICAgfVxcbiAgICB9KVxcblxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJsaW5lXFxcIixcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgaWQ6IFxcXCJwbGF5bGlzdHNcXFwiXFxuICAgICAgICB9XFxuICAgIH0pO1xcblxcbiAgICBkLnB1c2goe1xcbiAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGlkOiBcXFwicGxheWxpc3RzRU5EXFxcIlxcbiAgICAgICAgfVxcbiAgICB9KTtcXG4gICAgY2FjaGVTaG93VGlwcygpO1xcbiAgICByZW5vdmF0ZUxpc3QoZ2V0TXlWYXIoaWQgKyBcXFwic291cmNlaVxcXCIsIFxcXCIwXFxcIikpO1xcbiAgICBzZXRSZXN1bHQoZCk7XFxufSkoKVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi6Kej5p6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op6PmnpDnmoTluo/lj7dcXFxcbi0x5YWo6YOo77yMLTLlt7LlkK/nlKjnmoTvvIwtM+W3suemgeeUqOeahFxcXCIpLmlucHV0KChsZW5ndGgpID0+IHtcXG4gICAgICAgIGxldCBpbmRleGMgPSBpbnB1dC5zcGxpdCgvLHzvvIwvKTtcXG4gICAgICAgIGxldCBpbmRleHMgPSBbXTtcXG4gICAgICAgIGxldCBtbyA9IHBhcnNlSW50KGluZGV4Y1swXSk7XFxuICAgICAgICBpZiAoIShpbmRleGMubGVuZ3RoICE9PSAwICYmIG1vIDwgMCAmJiBtbyA+IC01KSkge1xcbiAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGluZGV4Yykge1xcbiAgICAgICAgICAgICAgICBsZXQgbnVtID0gcGFyc2VJbnQoaXQpO1xcbiAgICAgICAgICAgICAgICBpZiAoTnVtYmVyLmlzTmFOKG51bSkgfHwgbnVtID49IGxlbmd0aCB8fCBudW0gPCAwKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5pWw5a2X5LiN5ZCI5rOVXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBpbmRleHMucHVzaChudW0pO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH1cXG5cXG4gICAgICAgIHJldHVybiAkKFtcXFwiSElLRVJcXFwiLCBcXFwiVFhUXFxcIl0uY29uY2F0KGdldFBhc3RlcygpKSwgMiwgXFxcIuWIhuS6q+aWueW8j1xcXCIpLnNlbGVjdCgobW8sIGluZGV4cywgZXh0KSA9PiB7XFxuICAgICAgICAgICAgZnVuY3Rpb24gdXAocnVsZXMpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGViNjQgPSBiYXNlNjRFbmNvZGUoSlNPTi5zdHJpbmdpZnkocnVsZXMpKTtcXG4gICAgICAgICAgICAgICAgbGV0IGdldFBhc3MgPSAobGVuZ3RoLCBydWxlLCB0eXBlKSA9PiBcXFwi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ZXN0KGYpKSB7XFxuICAgICAgICAgICAgICAgIGZsYWdpID0gW2ZdXFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgZmxhZ2kgPSBmbGFnaS5maWx0ZXIoeCA9PiAhLyjlhajpg6h85bey56aB55SoKS8udGVzdCh4KSk7XFxuICAgICAgICAgICAgICAgIGlmIChmbGFnaS5pbmNsdWRlcyhmKSkge1xcbiAgICAgICAgICAgICAgICAgICAgZmxhZ2kgPSBmbGFnaS5maWx0ZXIoeCA9PiB4ICE9IGYpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGZsYWdpLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZmxhZ2kgPSBbXFxcIuWFqOmDqFxcXCJdXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBmbGFnaS5wdXNoKGYpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcImZsYWdpXFxcIiwgZmxhZ2kpO1xcbiAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIjtcXG4gICAgICAgIH0sIGYpXFxuICAgIH0pXFxufSlcXG5mb3IgKGxldCBpID0gMDsgaSA8IGxlbmd0aDsgaSsrKSB7XFxuICAgIGxldCBpdCA9IGFycltpXTtcXG5cXG4gICAgbGV0IGZsYWcgPSBpdC5mbGFnLnNwbGl0KFxcXCJ8XFxcIik7XFxuICAgIGlmIChmbGFnaS5sZW5ndGggPiAwICYmICFbXFxcIuWFqOmDqFxcXCIsIFxcXCLlt7LnpoHnlKhcXFwiXS5pbmNsdWRlcyhmbGFnaVswXSkpIHtcXG4gICAgICAgIGlmICghZmxhZ2kuZXZlcnkoZiA9PiBm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ik7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1ID0gc2hhcmVQYXN0ZShydWxlYjY0LCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8vXFxcIiArIGdldFBhc3MocnVsZS5uYW1lLCB1LCBcXFwiYlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9LCBpbmRleCk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuenu+WKqFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoaW5kZXggKyBcXFwiXFxcIiwgXFxcIui+k+WFpeS9jee9rlxcXCIpLmlucHV0KChpbmRleCwgbGVuZ3RoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgbmV3SW5kZXggPSBOdW1iZXIoaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKE51bWJlci5pc05hTihuZXdJbmRleCkgfHwgbmV3SW5kZXggPj0gbGVuZ3RoKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S4jeWSjOinhOeahOS9jee9rlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHJ1bGVzLnNwbGljZShpbmRleCwgMSlbMF07XFxuICAgICAgICAgICAgICAgICAgICBydWxlcy5zcGxpY2UobmV3SW5kZXgsIDAsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuc2F2ZUpzb24ocnVsZXMpO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpO1xcbiAgICAgICAgICAgICAgICB9LCBpbmRleCwgbGVuZ3RoKTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKGlucHV0ID09PSBcXFwi572u6aG2XFxcIikge1xcbiAgICAgICAgICAgICAgICBsZXQgbmV3SW5kZXggPSAwO1xcbiAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gcnVsZXMuc3BsaWNlKGluZGV4LCAxKVswXTtcXG4gICAgICAgICAgICAgICAgcnVsZXMuc3BsaWNlKG5ld0luZGV4LCAwLCBydWxlKTtcXG4gICAgICAgICAgICAgICAgJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuc2F2ZUpzb24ocnVsZXMpO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgfSBlbHNlIGlmIChpbnB1dCA9PT0gXFxcIuWIoOmZpFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuICQoXFxcIuehruiupOWIoOmZpO+8n1xcXCIpLmNvbmZpcm0oKGluZGV4KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZXMgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcnVsZSA9IHJ1bGVzLnNwbGljZShpbmRleCwgMSlbMF07XFxuICAgICAgICAgICAgICAgICAgICAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5zYXZlSnNvbihydWxlcyk7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey5Yig6ZmkXFxcIiArIHJ1bGUubmFtZTtcXG4gICAgICAgICAgICAgICAgfSwgaW5kZXgpO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGxldCBhcnIgPSAkLnJlcXVpcmUoXFxcImNvbmZpZ3NcXFwiKS5nZXRKc29uKCk7XFxuICAgICAgICAgICAgICAgIGxldCBydWxlID0gYXJyW2luZGV4XTtcXG4gICAgICAgICAgICAgICAgcnVsZS5mb3JiaWRkZW4gPSAhcnVsZS5mb3JiaWRkZW47XFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKGFycik7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgLy9yZXR1cm4gXFxcInRvYXN0Oi8vXFxcIiArIChydWxlLmZvcmJpZGRlbiA/IFxcXCLnpoHnlKhcXFwiIDogXFxcIuWQr+eUqFxcXCIpICsgcnVsZS5uYW1lO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0sIGksIGxlbmd0aCksXFxuICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGk6IGksXFxuICAgICAgICAgICAgcGFnZVRpdGxlOiBpdC5uYW1lXFxuICAgICAgICB9XFxuICAgIH0pO1xcbn1cXG5cXG5jb3VudFRpdGxlLnRpdGxlID0gJzxmb250IGNvbG9yPVxcXCIjMTNCNjFCXFxcIj7ilpAgPC9mb250PjxiPuino+aekOWIl+ihqDxiPiAoJyArICgoaXRzLmxlbmd0aCAtIGNvdW50KSArIFxcXCIvXFxcIiArIGxlbmd0aCkuZm9udGNvbG9yKFxcXCIjZmY2NjAxXFxcIikgKyBcXFwiKVxcXCI7XFxuXFxuZCA9IGQuY29uY2F0KGl0cyk7XFxuXFxuc2V0UmVzdWx0KGQpO1wifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZV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b2FkaW5nI1xcXCIpLmxhenlSdWxlKChpbmRleCwgdXJsSW5kZXgpID0+IHtcXG4gICAgICAgIGlmIChpbmRleCA9PT0gdm9pZCgwKSkge1xcbiAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/mraTpobnml6Dms5XliKDpmaRcXFwiO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKHVybEluZGV4ICE9PSB2b2lkKDApKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+ato+WcqOabtOaWsOino+aekO+8jOWIoOmZpOivt+S7juino+aekOeuoeeQhui/m+WFpVxcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBjb25maXJtKHtcXG4gICAgICAgICAgICB0aXRsZTogXFxcIua4qemmqOaPkOekulxcXCIsXFxuICAgICAgICAgICAgY29udGVudDogXFxcIuehruWumuimgeWIoOmZpOatpOino+aekOWQl++8n+azqOaEj+WIoOmZpOWQjuaXoOazleaBouWkjVxcXCIsXFxuICAgICAgICAgICAgY29uZmlybTogJC50b1N0cmluZygoaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IGFyciA9ICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLmdldEpzb24oKTtcXG4gICAgICAgICAgICAgICAgYXJyLnNwbGljZShpbmRleCwgMSk7XFxuICAgICAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlnc1xcXCIpLnNhdmVKc29uKGFycik7XFxuICAgICAgICAgICAgICAgIGJhY2sodHJ1ZSk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwidG9hc3Q6Ly/liKDpmaTmiJDlip9cXFwiO1xcbiAgICAgICAgICAgIH0sIGluZGV4KVxcbiAgICAgICAgfSk7XFxuICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgIH0sIGluZGV4LCB1cmxJbmRleCksXFxuICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG59KTt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IDA7XFxuICAgICAgICAgICAgaWYgKGhlYWRlcnMpIHtcXG4gICAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnMgPSBKU09OLnBhcnNlKGhlYWRlcnMpO1xcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhlYWRlcnPmoLzlvI/plJnor686XFxcIiArIGUudG9TdHJpbmcoKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICByZXR1cm4gJC5yZXF1aXJlKFxcXCJ2aWRlb1VybFxcXCIpLnByZXBhcmVQYXJzZXMoW3tcXG4gICAgICAgICAgICAgICAgbmFtZSxcXG4gICAgICAgICAgICAgICAgdXJsLFxcbiAgICAgICAgICAgICAgICBmbGFnLFxcbiAgICAgICAgICAgICAgICBoZWFkZXJzLFxcbiAgICAgICAgICAgICAgICBydW5UeXBlLFxcbiAgICAgICAgICAgICAgICBtZXRob2QsXFxuICAgICAgICAgICAgICAgIGpzb25QYXRoLFxcbiAgICAgICAgICAgICAgICBqc1xcbiAgICAgICAgICAgIH1dLCBpbnB1dCxudWxsLCB0cnVlKTtcXG4gICAgICAgIH0pO1xcbiAgICB9KSxcXG4gICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzNcXFwiLFxcbn0pO1xcblxcbmQucHVzaCh7XFxuICAgIHRpdGxlOiBcXFwi5L+d5a2YXFxcIixcXG4gICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpbmRleCwgaXNJbXBvcnQpID0+IHtcXG4gICAgICAgIGxldCBuYW1lID0gZ2V0TXlWYXIoXFxcInBzX25hbWVcXFwiLCBcXFwiXFxcIikudHJpbSgpO1xcbiAgICAgICAgaWYgKCFuYW1lKSB7XFxuICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WQjeWtl+W+l+acieS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NeVZhcihcXFwicHNfbWV0aG9kXFxcIiwgXFxcIkdFVFxcXCIpO1xcbiAgICAgICAgbGV0IGpzb25QYXRoID0gZ2V0TXlWYXIoXFxcInBzX2pzb25QYXRoXFxcIiwgXFxcIlxcXCIpLnRyaW0oKSB8fCB2b2lkIDA7XFxuICAgICAgICBsZXQganMgPSBnZXRNeVZhcihcXFwicHNfanNcXFwiLCBcXFwiXFxcIikgfHwgdm9pZCAwO1xcbiAgICAgICAgaWYgKHJ1blR5cGUgPT09IFxcXCJKU09OXFxcIiAmJiAhanNvblBhdGgpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vSlNPTuaooeW8j+S4i+W/hemhu+Whq2pzb25QYXRoXFxcIjtcXG4gICAgICAgIH0gZWxzZSBpZiAocnVuVHlwZSA9PT0gXFxcIkpTXFxcIiAmJiAhanMpIHtcXG4gICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8vSlPmqKHlvI/kuIvlv4Xpobvloatqc1xcXCI7XFxuICAgICAgICB9XFxuICAgICAgICBsZXQgYXJyID0gJC5yZXF1aXJlKFxcXCJjb25maWdzXFxcIikuZ2V0SnNvbigpO1xcbiAgICAgICAgbGV0IG9iajEgPSB7XFxuICAgICAgICAgICAgbmFtZSxcXG4gICAgICAgICAgICB1cmwsXFxuICAgICAgICAgICAgZmxhZyxcXG4gICAgICAgICAgICBoZWFkZXJzLFxcbiAgICAgICAgICAgIHJ1blR5cGUsXFxuICAgICAgICAgICAgbWV0aG9kLFxcbiAgICAgICAgICAgIGpzb25QYXRoLFxcbiAgICAgICAgICAgIGpzXFxuICAgICAgICB9O1xcbiAgICAgICAgaWYgKGluZGV4ID09PSB2b2lkKDApKSB7XFxuICAgICAgICAgICAgaWYgKGFyci5zb21lKHYgPT4gdi5uYW1lID09PSBuYW1lKSkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey57uP5a2Y5Zyo6K+l6Kej5p6QXFxcIjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKG9iajEuZ3JvdXApIHtcXG4gICAgICAgICAgICAgICAgbGV0IGdyb3VwID0gb2JqMS5ncm91cDtcXG4gICAgICAgICAgICAgICAgbGV0IGluZGV4ID0gYXJyLmZpbmRJbmRleCh2ID0+IHYuZ3JvdXAgPT09IGdyb3VwKTtcXG4gICAgICAgICAgICAgICAgaWYgKGluZGV4ID09PSAtMSkge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyLnVuc2hpZnQob2JqMSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBhcnIuc3BsaWNlKGluZGV4LCAwLCBvYmoxKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIGlmIChpc0ltcG9ydCkge1xcbiAgICAgICAgICAgICAgICAgICAgYXJyLnB1c2gob2JqMSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBhcnIudW5zaGlmdChvYmoxKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgbGV0IG5hbWV5ID0gYXJyW2luZGV4XS5uYW1lO1xcbiAgICAgICAgICAgIGlmIChuYW1lICE9PSBuYW1leSkge1xcbiAgICAgICAgICAgICAgICBpZiAoYXJyLnNvbWUodiA9PiB2Lm5hbWUgPT09IG5hbWUpKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5bey57uP5a2Y5Zyo6K+l6Kej5p6QXFxcIjtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBvYmoxID0gT2JqZWN0LmFzc2lnbihhcnJbaW5kZXhdLCBvYmoxKTtcXG4gICAgICAgICAgICBhcnIuc3BsaWNlKGlu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xlLmlkO1xcbiAgICAgICAgbGV0IHJ1bGVUaXRsZSA9IGdldFBhcmFtKFxcXCJydWxlXFxcIik7XFxuICAgICAgICBsZXQgYXJyID0gJC5yZXF1aXJlKFxcXCJjb25maWdzP3J1bGU9XFxcIiArIHJ1bGVUaXRsZSkuZ2V0SnNvbigpO1xcbiAgICAgICAgbGV0IG5ld0kgPSAwO1xcbiAgICAgICAgZm9yIChsZXQgcnVsZSBvZiBydWxlcykge1xcbiAgICAgICAgICAgIGxldCBpbmRleCA9IGFyci5maW5kSW5kZXgodiA9PiB2Lm5hbWUgPT09IHJ1bGUubmFtZSk7XFxuICAgICAgICAgICAgaWYgKGluZGV4ID4gLTEpIHtcXG4gICAgICAgICAgICAgICAgcnVsZSA9IE9iamVjdC5hc3NpZ24oYXJyW2luZGV4XSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgIGFyci5zcGxpY2UoaW5kZXgsIDEsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBpZiAocnVsZXMubGVuZ3RoID09PSAxKSB7XFxuICAgICAgICAgICAgICAgICAgICBzYXZlQ2FjaGUocnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vcGFnZS9ydWxlRWRpdCNub0hpc3RvcnkjI25vUmVjb3JkSGlzdG9yeSM/aXNJbXBvcnQ9dHJ1ZSZpbmRleD1cXFwiICsgaW5kZXggKyBcXFwiJnJ1bGU9XFxcIiArIHJ1bGVUaXRsZTtcXG4gICAgICAgICAgICAgICAgICAgIC8vdG9hc3QoXFxcIuW3suabtOaWsOinhOWIme+8mlxcXCIgKyBydWxlLm5hbWUpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKFxcXCLlt7Lmm7TmlrDop4TliJnvvJpcXFwiICsgcnVsZS5uYW1lKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgbmV3SSsrO1xcbiAgICAgICAgICAgICAgICBhcnIucHVzaChydWxlKTtcXG4gICAgICAgICAgICAgICAgaWYgKHJ1bGVzLmxlbmd0aCA9PT0gMSkge1xcbiAgICAgICAgICAgICAgICAgICAgc2F2ZUNhY2hlKHJ1bGUpO1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL3BhZ2UvcnVsZUVkaXQjbm9IaXN0b3J5IyNub1JlY29yZEhpc3RvcnkjP2lzSW1wb3J0PXRydWUmcnVsZT1cXFwiICsgcnVsZVRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgLy90b2FzdChcXFwi5bey5a+85YWl6KeE5YiZ77yaXFxcIiArIHJ1bGUubmFtZSk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuW3suWvvOWFpeinhOWIme+8mlxcXCIgKyBydWxlLm5hbWUpXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgICAgICBpZiAocnVsZXMubGVuZ3RoID4gMSkge1xcbiAgICAgICAgICAgICQucmVxdWlyZShcXFwiY29uZmlncz9ydWxlPVxcXCIgKyBydWxlVGl0bGUpLnNhdmVKc29uKGFycik7XFxuICAgICAgICAgICAgdG9hc3QoXFxcIuaWsOWinu+8mlxcXCIgKyBuZXdJICsgXFxcIiDopobnm5bmm7TmlrDvvJpcXFwiICsgKHJ1bGVzLmxlbmd0aCAtIG5ld0kpKTtcXG4gICAgICAgIH1cXG4gICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgbG9nKGUudG9TdHJpbmcoKSk7XFxuICAgICAgICB0b2FzdChcXFwi5a+85YWl5aSx6LSlXFxcIik7XFxuICAgIH1cXG59XFxuXFxuZnVuY3Rpb24gaW1wb3J0UnVsZShwYXNzKSB7XFxuICAgIHRyeSB7XFxuICAgICAgICBsZXQgW18sIHJ1bGUsIHBuYW1lX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c3QocGF0aCArIGl0Lm5hbWUpKSkge1xcbiAgICAgICAgICAgICAgICB3cml0ZUZpbGUocGF0aCArIGl0Lm5hbWUsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBydWxlcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICdrZXknOiBgaGlweV9qc18ke25hbWV9YCxcXG4gICAgICAgICAgICAgICAgICAgICduYW1lJzogYCR7bmFtZX1gLFxcbiAgICAgICAgICAgICAgICAgICAgJ3R5cGUnOiAzLFxcbiAgICAgICAgICAgICAgICAgICAgJ2FwaSc6ICcuLi9saWJzL2RycHkyLmpzJyxcXG4gICAgICAgICAgICAgICAgICAgICdzZWFyY2hhYmxlJzogMSxcXG4gICAgICAgICAgICAgICAgICAgICdxdWlja1NlYXJjaCc6IDEsXFxuICAgICAgICAgICAgICAgICAgICAnZmlsdGVyYWJsZSc6IDEsXFxuICAgICAgICAgICAgICAgICAgICAnZXh0JzogXFxcIi4vXFxcIiArIGl0Lm5hbWUsXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBjb3VudCsrO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBcXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS50b1N0cmluZygpKTtcXG4gICAgICAgIH1cXG4gICAgICAgIG5hbWVzLnB1c2goaXQubmFtZSk7XFxuICAgIH1cXG4gICAgZGVsZXRlbG9zZShuYW1lcywgcGF0aClcXG4gICAgd3JpdGVGaWxlKHBhdGggKyBcXFwiaW5kZXguanNvblxcXCIsIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgIHNpdGVzOiBydWxlc1xcbiAgICB9KSk7XFxuXFxuICAgIHJldHVybiBcXFwidG9hc3Q6Ly/miJDlip/mm7TmlrBcXFwiICsgY291bnQgKyBcXFwi5LiqXFxcIjs7XFxufVxcblxcbmZ1bmN0aW9uIGRlbGV0ZWxvc2UobmFtZXMsIHBhdGgp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QuZW5kc1dpdGgoXFxcIi5qc1xcXCIpID8gZGVjb2RlVVJJQ29tcG9uZW50KGl0LmV4dC5zcGxpdChcXFwiL1xcXCIpLmF0KC0xKSkgOiAoaXQubmFtZSArIFxcXCIuanNcXFwiKTtcXG4gICAgICAgICAgICAgICAgbGV0IHJ1bGU7XFxuICAgICAgICAgICAgICAgIGlmIChTdHJpbmcoaXQuZXh0KS5zdGFydHNXaXRoKFxcXCJodHRwXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJ1bGUgPSByZXF1ZXN0KGl0LmV4dCk7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICBydWxlID0gcmVxdWVzdChqb2luVXJsKHVybCwgaXQuZXh0KSk7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgaXQuZXh0ID0gXFxcIi4vXFxcIiArIG5hbWU7XFxuICAgICAgICAgICAgICAgIGlmICghcnVsZSB8fCAhcnVsZS5pbmNsdWRlcyhcXFwicnVsZVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoIWZpbGVFeGlzdChwYXRoICsgbmFtZSkpXFxuICAgICAgICAgICAgICAgICAgICAgICAgYXJyLnNwbGljZShpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xcbiAgICAgICAgICAgICAgICB9O1xcbiAgICAgICAgICAgICAgICB3cml0ZUZpbGUocGF0aCArIG5hbWUsIHJ1bGUpO1xcbiAgICAgICAgICAgICAgICBuYW1lcy5wdXNoKG5hbWUpO1xcbiAgICAgICAgICAgICAgICBjb3VudCsrO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS50b1N0cmluZygpKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGkrKztcXG4gICAgfVxcbiAgICBkZWxldGVsb3NlKG5hbWVzLCBwYXRoKTtcXG4gICAgd3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pc3Q9W107XFxuICAgICAgICB9IGVsc2UgaWYgKGNvbmZpZy5wYXRoLnN0YXJ0c1dpdGgoXFxcImh0dHBzOi8vZ2l0aHViLmNvbVxcXCIpKSB7XFxuICAgICAgICAgICAgc291cmNlTGlzdCA9IGdlbmVyYXRlQ29uZmlnQnlHaXRodWIoY29uZmlnLnBhdGgpO1xcbiAgICAgICAgICAgIGNvbmZpZy50eXBlID0gXFxcImdpdGh1YkRpclxcXCI7XFxuICAgICAgICAgICAgLy9zb3VyY2VMaXN0PVtdO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UodG9Db3JyZWN0SlNPTlN0cmluZyhmZXRjaChjb25maWcucGF0aCkgfHwgXFxcInt9XFxcIikpO1xcbiAgICAgICAgICAgIGlmICghQXJyYXkuaXNBcnJheShqc29uLnNpdGVzKSB8fCAhanNvbi5zaXRlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFxcXCLku47nvZHnu5zojrflj5bnmoTphY3nva7mlofku7bkuLrnqbrvvIzor7fmo4Dmn6XnvZHnu5xcXFwiKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgc291cmNlTGlzdCA9IGZpbHRlck90aGVyKGpzb24uc2l0ZXMpO1xcbiAgICAgICAgICAgIGNvbmZpZy50eXBlID0gXFxcImluZGV4XFxcIjtcXG4gICAgICAgIH1cXG4gICAgICAgIGZpbGUgPSB2b2lkIDA7XFxuICAgICAgICBsZXQgY3VycmVudFNvdXJjZSwgc2VhcmNoQWxsb3c7XFxuICAgICAgICBpZiAoY29uZmlnLmNLZXkpIHtcXG4gICAgICAgICAgICBjdXJyZW50U291cmNlID0gc291cmNlTGlzdC5maW5kKHYgPT4gdi5rZXkgPT09IGNvbmZpZy5jS2V5KTtcXG4gICAgICAgICAgICBpZiAoIWN1cnJlbnRTb3VyY2UpIHtcXG4gICAgICAgICAgICAgICAgY3VycmVudFNvdXJjZSA9IHNvdXJjZUxpc3RbMF07XFxuICAgICAgICAgICAgICAgIC8vY3VycmVudENvbmZpZy5jS2V5ID0gc291cmNlTGlzdFswXS5rZXk7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICBjdXJyZW50U291cmNlID0gc291cmNlTGlzdFswXTtcXG4gICAgICAgICAgICAvL2NvbmZpZy5jS2V5ID0gc291cmNlTGlzdFswXS5rZXk7XFxuICAgICAgICB9XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHNlYXJjaEFsbG93ID0gSlNPTi5wYXJzZShmZXRjaChzZWFyY2hBbGxvd1BhdGgpIHx8IFxcXCJbXVxcXCIpO1xcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGRlbGV0ZUZpbGUoc2VhcmNoQWxsb3dQYXRoKTtcXG4gICAgICAgICAgICBzZWFyY2hBbGxvdyA9IFtdO1xcbiAgICAgICAgfVxcbiAgICAgICAgbG9hZEVycm9yID0gdm9pZCAwO1xcbiAgICAgICAgcmV0dXJuIHtcXG4gICAgICAgICAgICBjdXJyZW50U291cmNlLFxcbiAgICAgICAgICAgIHNlYXJjaEFsbG93LFxcbiAgICAgICAgICAgIHNvdXJjZUxpc3RcXG4gICAgICAgIH07XFxuICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpO1xcbiAgICAgICAgbG9hZEVycm9yID0gZTtcXG4gICAgfVxcblxcbiAgICByZXR1cm4gbnVsbDtcXG59XFxuXFxuZnVuY3Rpb24gZ2VuZXJhdGVDb25maWdCeUxvY2FsKGRpckZpbGUpIHtcXG4gICAgbGV0IGxpc3QgPSBkaXJGaWxlLmxpc3RGaWxlcygpO1xcbiAgICBsZXQgcnVsZXMgPSBbXTtcXG5cXG4gICAgZm9yIChsZXQgaXQgb2YgbGlzdCkge1xcbiAgICAgICAgbGV0IG5hbWUgPSBTd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xufVxcblxcbmZ1bmN0aW9uIGdlbmVyYXRlQ29uZmlnQnlKcyhqc1BhdGgpIHtcXG5cXG4gICAgbGV0IG1haW4gPSBldmFsSnMocmVxdWVzdChqc1BhdGgpLnJlcGxhY2UoL2FzeW5jXFxcXHMqP2Z1bmN0aW9uXFxcXHMqP21haW4vZywgXFxcImZ1bmN0aW9uIG1haW5cXFwiKSArIFxcXCJcXFxcbjttYWluO1xcXCIsIHtcXG4gICAgICAgIHBhdGhMaWI6IHtcXG4gICAgICAgICAgICBqb2luOiBqb2luVXJsLFxcbiAgICAgICAgICAgIHJlYWRGaWxlKHBhdGgpIHtcXG4gICAgICAgICAgICAgICAgcGF0aCA9IHBhdGguc3RhcnRzV2l0aChcXFwiZmlsZTovL1xcXCIpID8gcGF0aCA6IChcXFwiZmlsZTovL1xcXCIgKyBwYXRoKTtcXG5cXG4gICAgICAgICAgICAgICAgcmV0dXJuIGZldGNoKHBhdGgpO1xcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgcmVhZERpcihwYXRoKSB7XFxuICAgICAgICAgICAgICAgIGxldCBuYW1lcyA9IFtdO1xcbiAgICAgICAgICAgICAgICBsZXQgZmlsZSA9IG5ldyBqYXZhLmlvLkZpbGUocGF0aC5yZXBsYWNlKFxcXCJmaWxlOi8vXFxcIiwgXFxcIlxcXCIpKTtcXG5cXG4gICAgICAgICAgICAgICAgaWYgKCEoZmlsZS5leGlzdHMoKSAmJiBmaWxlLmlzRGlyZWN0b3J5KCkpKSByZXR1cm4gbmFtZXM7XFxuICAgICAgICAgICAgICAgIGZvciAobGV0IGl0IG9mIGZpbGUubGlzdEZpbGVzKCkpIHtcXG4gICAgICAgICAgICAgICAgICAgIG5hbWVzLnB1c2goU3RyaW5nKGl0LmdldE5hbWUoKSkpO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIHJldHVybiBuYW1lcztcXG4gICAgICAgICAgICB9LFxcbiAgICAgICAgICAgIGRpcm5hbWUocGEpIHtcXG4gICAgICAgICAgICAgICAgbGV0IHBhdGggPSBqb2luVXJsKGpzUGF0aCwgcGEpO1xcbiAgICAgICAgICAgICAgICBsZXQgbmFtZXMgPSBbXTtcXG4gICAgICAgICAgICAgICAgbGV0IGZpbGUgPSBuZXcgamF2YS5pby5GaWxlKHBhdGgpO1xcblxcbiAgICAgICAgICAgICAgICBpZiAoIShmaWxlLmV4aXN0cygpICYmIGZpbGUuaXNEaXJlY3RvcnkoKSkpIHJldHVybiBuYW1lcztcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaXQgb2YgZGlyRmlsZS5saXN0RmlsZXMoKSkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0LmlzRGlyZWN0b3J5KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbmFtZXMucHVzaChTdHJpbmcoaXQuZ2V0TmFtZSgpKSk7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgcmV0dXJuIHBhdGhzO1xcbiAgICAgICAgICAgIH0sXFxuICAgICAgICAgICAgc3RhdCgpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSxcXG4gICAgICAgIGxvZzogbG9nLFxcbiAgICAgICAgcGF0aDoganNQYXRoLFxcbiAgICAgICAgcGF0aF9kaXI6IGpvaW5VcmwoanNQYXRoLCBcXFwiLi9cXFwiKVxcbiAgICB9KTtcXG4gICAgbGV0IGpzb25UZXh0ID0gbWFpbigpO1xcbiAgICBsZXQganNvbiA9IEpTT04ucGFyc2UoanNvblRleHQpO1xcblxcbiAgICBpZiAoQXJyYXkuaXNBcnJheShqc29uKSkge1xcbiAgICAgICAgcmV0dXJuIGZpbHRlck90aGVyKGpzb24pO1xcbiAgICB9IGVsc2UgaWYgKEFycmF5LmlzQXJyYXkoanNvbi5zaXRlcykgJiYganNvbi5zaXRlcy5sZW5ndGgpIHt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Fwibm9cXFwiO1xcbiAgICAgICAgICBsZXQgcGF0aCA9IG9iai51cmwucmVwbGFjZShcXFwiZmlsZTovL1xcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgbGV0IGRpciA9IG5ldyBqYXZhLmlvLkZpbGUocGF0aCk7XFxuICAgICAgICAgIGlmIChkaXIuaXNEaXJlY3RvcnkoKSkge1xcbiAgICAgICAgICAgIGxldCBmbGlzdCA9IGRpci5saXN0RmlsZXMoKTtcXG4gICAgICAgICAgICBmb3IgKHZhciBmIG9mIGZsaXN0KSB7XFxuICAgICAgICAgICAgICAvLyDmo4Dmn6Xmlofku7blkI3mmK/lkKbku6UuanPnu5PlsL5cXG4gICAgICAgICAgICAgIGlmIChmLmlzRmlsZSgpICYmIGYuZ2V0TmFtZSgpLnRvTG93ZXJDYXNlKCkuZW5kc1dpdGgoXFxcIi5qc1xcXCIpKSB7XFxuICAgICAgICAgICAgICAgIGpzRmlsZXMucHVzaChmKTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgaWYgKGRpci5pc0ZpbGUoKSAmJiBmaWxlRXhpc3Qob2JqLnVybCkpIHtcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAganNvbiA9IEpTT04ucGFyc2UocmVhZEZpbGUob2JqLnVybCkpO1xcbiAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoanNvbi5zaXRlcykgfHwganNvbi5zaXRlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgY291bnQgPSBmaWx0ZXJPdGhlcihqc29uLnNpdGVzKS5sZW5ndGg7XFxuICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkgeyB9XFxuICAgICAgICAgICAgY29kZSA9IFxcXCJva1xcXCI7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgaWYgKGpzRmlsZXMubGVuZ3RoID49IDUpIHtcXG4gICAgICAgICAgICBjb3VudCA9IGpzRmlsZXMubGVuZ3RoO1xcbiAgICAgICAgICAgIGNvZGUgPSBcXFwib2tcXFwiO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIHJldHVybiB7XFxuICAgICAgICAgICAgdGltZTogKERhdGUubm93KCkgLSBzKSxcXG4gICAgICAgICAgICB1cmw6IG9iai51cmwsXFxuICAgICAgICAgICAgY291bnQ6IGNvdW50LFxcbiAgICAgICAgICAgIGNvZGU6IGNvZGUsXFxuICAgICAgICAgICAgaW5kZXg6IG9iai5pXFxuICAgICAgICAgIH1cXG4gICAgICAgIH1cXG4gICAgICAgIHZhciBqID0gSlNPTi5wYXJzZShmZXRjaChvYmoudXJsLCB7XFxuICAgICAgICAgIHdpdGhIZWFkZXJzOiB0cnVlLFxcbiAgICAgICAgICB0aW1lb3V0OiA1MDAwLFxcbiAgICAgICAgfSkpO1xcbiAgICAgICAgbGV0IGUgPSBEYXRlLm5vdygpO1xcbiAgICAgICAgbGV0IGMgPSBlIC0gcztcXG4gICAgICAgIGlmIChvYmoudXJsLmluY2x1ZGVzKFxcXCJnaXRodWIuY29tXFxcIikgJiYgai5zdGF0dXNDb2RlID09IDIwMCkge1xcbiAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIHZhciBodG1sID0gai5ib2R5O1xcbiAgICAgICAgICAgIHZhciBqc29uID0gSlNPTi5wYXJzZShwZGZoKGh0bWwsIFxcXCIjcmVwby1jb250ZW50LXBqYXgtY29udGFpbmVyJiZzY3JpcHQmJkh0bWxcXFwiKSk7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBqc29uLnBheWxvYWQudHJlZS5pdGVtcztcXG4gICAgICAgICAgICBjb3VudCA9IGxpc3QuZmlsdGVyKHggPT4geC5uYW1lLmVuZHNXaXRoKFxcXCIuanNcXFwiKSkubGVuZ3RoO1xcbiAgICAgICAgICB9IGNhdGNoIHsgfVxcbiAgICAgICAgfVxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgbGV0IGpzb24gPSBKU09OLnBhcnNlKHRvQ29ycmVjdEpTT05TdHJpbmcoai5ib2R5KSB8fCBcXFwie31cXFwiKTtcXG4gICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoanNvbi5zaXRlcykgfHwganNvbi5zaXRlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICBjb3VudCA9IGZpbHRlck90aGVyKGpzb24uc2l0ZXMpLmxlbmd0aDtcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSBjYXRjaCAoZSkgeyB9XFxuXFxuICAgICAgICByZXR1cm4ge1xcbiAgICAgICAgICB0aW1lOiBjLFxcbiAgICAgICAgICB1cmw6IGoudXJsLFxcbiAgICAgICAgICBjb3VudDogY291bnQsXFxuICAgICAgICAgIGNvZGU6IGouc3RhdHVzQ29kZSxcXG4gICAgICAgICAgaW5kZXg6IG9iai5pLFxcbiAgICAgICAgfVxcbiAgICAgIH07XFxuICAgICAgbGV0IHRhc2tzID0gbGlzdC5tYXAoKHgsIGkpID0+IHtcXG4gICAgICAgIGkgPSBpICsgMTtcXG4gICAgICAgIHJldHVybiB7XFxuICAgICAgICAgIGZ1bmM6IHRhc2ssXFxuICAgICAgICAgIHBhcmFtOiB7XFxuICAgICAgICAgICAgdXJsOiB4LFxcbiAgICAgICAgICAgIGk6IGkgLSAxLFxcbiAgICAgICAgICB9LFxcbiAgICAgICAgICBpZDogJ3Rhc2tpZCcgKyBpXFxuICAgICAgICB9XFxuICAgICAgfSk7XFxuICAgICAgdmFyIGNvdW50ID0gc3VjY2VzcyA9IHRhc2tzLmxlbmd0aDtcXG4gICAgICBiZSh0YXNrcywge1xcbiAgICAgICAgZnVuYzogZnVuY3Rpb24gKG9iaiwgaWQsIGVycm9yLCB0YXNrUmVzdWx0KSB7XFxuICAgICAgICAgIG9iai5yZXN1bHRzLnB1c2godGFza1Jlc3VsdClcXG4gICAgICAgICAgY291bnQgPSBjb3VudCAtIDE7XFxuICAgICAgICAgIGlmIChjb3VudCA+ID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lvdXQucHVzaCh7XFxuICAgICAgdGl0bGU6ICfigJzigJzigJ3igJ0nICsgXFxcIjxzbWFsbD5cXFwiICsgY3VycmVudCArIFxcXCLlkI3np7A6XFxcIiArIGl0ZW0ubmFtZSArIFxcXCJcXFxcbui3r+W+hDpcXFwiICsgaXRlbS5wYXRoICsgXFxcIjwvc21hbGw+XFxcIixcXG4gICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoaXRlbSA9PiB7XFxuICAgICAgICBjbGVhckl0ZW0oXFxcIm5vX2xvYWRpbmdcXFwiKTtcXG4gICAgICAgIGxldCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXCJydW50aW1lQ29uZmlnXFxcIik7XFxuICAgICAgICBsZXQge1xcbiAgICAgICAgICBwYXRoLFxcbiAgICAgICAgICBuYW1lXFxuICAgICAgICB9ID0gaXRlbTtcXG4gICAgICAgIGlmIChwYXRoLnN0YXJ0c1dpdGgoXFxcImh0dHBcXFwiKSkge1xcbiAgICAgICAgICBzaG93TG9hZGluZyhcXFwi5q2j5Zyo5Yqg6L296YWN572uLi4uXFxcIik7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAocnVudGltZUNvbmZpZy5zZXRDdXJyZW50Q29uZmlnKHtcXG4gICAgICAgICAgcGF0aCxcXG4gICAgICAgICAgbmFtZSxcXG4gICAgICAgIH0pKSB7XFxuXFxuICAgICAgICAgIGxldCBEcnB5TWFuYWdlID0gR00uZGVmaW5lTW9kdWxlKFxcXCJEcnB5TWFuYWdlXFxcIik7XFxuICAgICAgICAgIERycHlNYW5hZ2UuY2xlYXIoKTtcXG4gICAgICAgICAgYmFjayhmYWxzZSk7XFxuICAgICAgICAgICQucmVxdWlyZShcXFwiQ2hhbmdlU291cmNlUG9wXFxcIikuc2hvdygxMDApO1xcbiAgICAgICAgICBoaWRlTG9hZGluZygpO1xcbiAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdH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c3QuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnB1c2goeCk7XFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBkZWZhdWx0VmFsdWU6IFxcXCJcXFwiLFxcbiAgICAgICAgICAgIGNsaWNrKHMsIG1hbmFnZSkge1xcbiAgICAgICAgICAgICAgICBsZXQgdGFnQ2xhc3NlcyA9IHJ1bnRpbWVDb25maWcuZ2V0VGFnQ2xhc3NlcygpO1xcbiAgICAgICAgICAgICAgICBpZiAoIXRhZ0NsYXNzZXMubGVuZ3RoKSByZXR1cm4gXFxcInRvYXN0Oi8v5b2T5YmN6YWN572u5rKh5pyJVEFH5ZOm44CCXFxcIjtcXG4gICAgICAgICAgICAgICAgaGlrZXJQb3Auc2VsZWN0Q2VudGVyKHtcXG4gICAgICAgICAgICAgICAgICAgIG9wdGlvbnM6IHRhZ0NsYXNzZXMsXFxuICAgICAgICAgICAgICAgICAgICBjb2x1bW5zOiAzLFxcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCJUQUdbXFxcIiArIHRhZ0NsYXNzZXMubGVuZ3RoICsgXFxcIl1cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgY2xpY2soYSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlucHV0Qm94LnNldERlZmF1bHRWYWx1ZShcXFwiW1xcXCIgKyBhICsgXFxcIl1cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB0aXRsZVZpc2libGU6IHRydWVcXG4gICAgICAgIH0pKSxcXG4gICAgICAgIGxvbmdDbGljayhzLCBpKSB7XFxuICAgICAgICAgICAgc2hvd1NlbGVjdE9wdGlvbnMoe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWIhuS6q+inhumikea6kFxcXCIsXFxuICAgICAgICAgICAgICAgIG9wdGlvbnM6IFtcXFwiSlPmlofku7bliIbkuqtcXFwiXS5jb25jYXQoZ2V0UGFzdGVzKCkpLFxcbiAgICAgICAgICAgICAgICBjb2w6IDIsXFxuICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKG5hbWUgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcnVudGltZUNvbmZpZyA9IEdNLmRlZmluZU1vZHVsZShcXFwicnVudGltZUNvbmZpZ1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHNvdXJjZXMgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHNvdXJjZSA9IHNvdXJjZXMuZmluZCh2ID0+IHYubmFtZSA9PSBuYW1lKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXRoID0gcnVudGltZUNvbmZpZy5nZXRBYnNvbHV0ZVBhdGgoc291cmNlLmV4dCk7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcG5hbWUgPSBwYXRoLnNwbGl0KFxcXCIvXFxcIikuYXQoLTEpO1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHJ1bGUgPSBmZXRjaChwYXRoKTtcXG4gICAgICAgICAgICAgICAgICAgIGxldCBlbmNvZGVNb2RlID0gZ2V0SXRlbShcXFwic2hhcmVfZW5jb2RlXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGVuY29kZU1vZGUgJiYgL3ZhciBydWxlfFtcXFxcdTRFMDAtXFxcXHU5RkE1XSt8ZnVuY3Rpb258bGV0IHx2YXIgfGNvbnN0IHxcXFxcKHxcXFxcKXxcXFwifCcvLnRlc3QocnVsZSkpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoZW5jb2RlTW9kZSA9PT0gXFxcIkd6aXBcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBHWklQID0gJC5yZXF1aXJlKFxcXCJHWklQXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGUgPSBHWklQLnppcChydWxlKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGVuY29kZU1vZGUgPT09IFxcXCJCYXNlNjRcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJ1bGUgPSBiYXNlNjRFbmNvZGUocnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChlbmNvZGVNb2RlID09PSBcXFwiQUVTXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBDcnlwdG9VdGlsID0gJC5yZXF1aXJlKFxcXCJoaWtlcjovL2Fzc2V0cy9jcnlwdG8tamF2YS5qc1xcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQga2V5ID0gQ3J5cHRvVXRpbC5EYXRhLnBhcnNlSGV4KFxcXCI2ODZBNjQ2ODZFNzgwQTBBMEEwQTBBMEEwQTBBMEEwQVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgaXYgPSBDcnlwdG9VdGlsLkRhdGEucGFyc2VIZXgoXFxcIjY0N0E3OTc5NjQ3MzBBMEEwQTBBMEEwQTBBMEEwQTBBXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCB0ZXh0RGF0YSA9IENyeXB0b1V0aWwuRGF0YS5wYXJzZVVURjgocnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBlbmNyeXB0ZWQwID0gQ3J5cHRvVXRpbC5BRVMuZW5jcnlwdCh0ZXh0RGF0YSwga2V5LCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtb2RlOiBcXFwiQUVTL0NCQy9QS0NTN1BhZGRpbmdcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaXY6IGl2XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBydWxlID0gZW5jcnlwdGVkMC50b0Jhc2U2NChfYmFzZTY0Lk5PX1dSQVApO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGlmICghcnVsZSkgcmV0dXJuIFxcXCJ0b2FzdDovL+iOt+WPluWksei0pVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoTVlfSU5ERVggPT09IDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB3cml0ZUZpbGUoXFxcImhpa2VyOi8vZmlsZXMvX2NhY2hlL1xcXCIgKyBwbmFtZSwgcnVsZSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJzaGFyZTovL2hpa2VyOi8vZmlsZXMvX2NhY2hlL1xcXCIgKyBwbmFtZTtcXG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHVybCA9IHNoYXJlUGFzdGUoYmFzZTY0RW5jb2RlKHJ1bGUpLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJjb3B5Oi8v5rW36ZiU6KeG55WM77yMRFJQWeinhumikea6kOOAjFxcXCIgKyBuYW1lICsgXFxcIuOAjeWkjeWItuaVtOadoeWPo+S7pOaJk+W8gOi9r+S7tuWwseS8muiHquWKqOWvvOWFpSRcXFwiICsgdXJsICsgXFxcIiRcXFwiICsgcG5hbWUgKyBcXFwiQGltcG9ydD1qczokLnJlcXVpcmUoJ2ltcG9ydD9ydWxlPScrXFxcIiArIEpTT04uc3RyaW5naWZ5KE1ZX1JVTEUudGl0bGUpICsgXFxcIikoaW5wdXQsIHRydWUpXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSwgcy5yZXBsYWNlKC9b4oCZ4oCYXS9nLCBcXFwiXFxcIikpXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9LFxcbiAgICAgICAgY2xpY2socywgaSwgbWFuYWdlKSB7XFxuICAgICAgICAgICAgcG9wLmRpc21pc3MoKTtcXG4gICAgICAgICAgICBzZXRJdGVtKFxcXCJub19sb2FkaW5nXFxcIiwgXFxcIjFcXFwiKTtcXG4gICAgICAgICAgICAvLyBtYW5hZ2UubGlzdC5mb3JFYWNoKCh2LCBpaSkgPT4gKFxcbiAgICAgICAgICAgIC8vICAgbWFuYWdlLmxpc3RbaWldID0gaSA9PT0gaWkgPyBcXFwi4oCY4oCYXFxcIiArIG5hbWVzW2lpXSArIFxcXCLigJnigJlcXFwiIDogbmFtZXNbaWldLnJlcGxhY2UoL1vigJnigJhdL2csIFxcXCJcXFwiKVxcbiAgICAgICAgICAgIC8vICkpO1xcbiAgICAgICAgICAgIGxldCBuYW1lID0gbWFuYWdlLmxpc3RbaV0ucmVwbGFjZSgvW+KAmeKAmF0vZywgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgIGlmIChuYW1lID09IHNvdXJjZS5uYW1lKSB7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybjtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IHNvdXJjZXMgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZSgpO1xcbiAgICAgICAgICAgIGxldCBrZXkgPSBzb3VyY2VzLmZpbmQodiA9PiB2Lm5hbWUgPT0gbmFtZSkua2V5O1xcblxcbiAgICAgICAgICAgIHVzaW5nU29ydC5zZXQobmFtZSk7XFxuXFxuICAgICAgICAgICAgLy9tYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgbGV0IH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lueggTpcXFwiICsgZ2V0SXRlbShcXFwic2hhcmVfZW5jb2RlXFxcIiwgXFxcIuS4jee8lueggVxcXCIpLCBcXFwi6Z2S5bCR5bm05qih5byPOlxcXCIgKyAobGVhY2ggPyBcXFwi5byA5ZCvXFxcIiA6IFxcXCLlhbPpl61cXFwiKV0sXFxuICAgICAgICAgICAgICAgIGNvbHVtbnM6IDIsXFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6K+36YCJ5oupIOaXtumXtCBcXFwiICsgZGF0ZXRpbWUsXFxuICAgICAgICAgICAgICAgIGNsaWNrKHMsIGkpIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChzID09IFxcXCLmlLnlj5jmoLflvI9cXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc3BlbiA9IHNwZW4gPT0gMyA/IDEgOiAoc3BlbiA9PSAyID8gMyA6IDIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2VDb2x1bW5zKHNwZW4pO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzLmluY2x1ZGVzKFxcXCLlgJLluo9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnJldmVyc2UoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBuYW1lcy5yZXZlcnNlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzLmluY2x1ZGVzKFxcXCLoh6rnhLbmjpLluo9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gT2JqZWN0LmFzc2lnbihbXSwgbWFuYWdlLmxpc3QpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBuYXR1cmFsID0gZ2V0SXRlbShcXFwibmF0dXJhbFxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAobmF0dXJhbCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuYXR1cmFsU29ydChsaXN0KS5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaCh4KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcInVzaW5nc3RcXFwiLCBcXFwiXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzbmFtZS5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QucHVzaCh4KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcIm5hdHVyYWxcXFwiLCBuYXR1cmFsID8gXFxcIlxcXCIgOiBcXFwiMVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzLmluY2x1ZGVzKFxcXCLkvb/nlKjmjpLluo9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBsaXN0ID0gT2JqZWN0LmFzc2lnbihbXSwgbWFuYWdlLmxpc3QpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB1c2luZ3N0ID0gZ2V0SXRlbShcXFwidXNpbmdzdFxcXCIsIFxcXCJcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAodXNpbmdzdCA9PSBcXFwiXFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1c2luZ1NvcnQuZ2V0KGxpc3QpLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5wdXNoKHgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwibmF0dXJhbFxcXCIsIFxcXCJcXFwiKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0Lmxlbmd0aCA9IDA7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNuYW1lLmZvckVhY2goeCA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5wdXNoKHgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwidXNpbmdzdFxcXCIsIHVzaW5nc3QgPyBcXFwiXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHMgPT0gXFxcIuWIt+aWsOmFjee9rlxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBmdW5jdGlvbiBhcnJheURpZmZlcmVuY2UoYXJyMSwgYXJyMikge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBtYXAgPSBuZXcgTWFwKGFycjIubWFwKGl0ZW0gPT4gW2l0ZW0ua2V5LCBpdGVtXSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXJyMS5maWx0ZXIoaXRlbSA9PiAhbWFwLmhhcyhpdGVtLmtleSkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgcnVudGltZUNvbmZpZyA9IEdNLmRlZmluZU1vZHVsZShcXFwicnVudGltZUNvbmZpZ1xcXCIsIFxcXCJydW50aW1lQ29uZmlnXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGxpc3QgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcnVudGltZUNvbmZpZy5pbml0RGVmYXVsdCgpKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KFxcXCLliLfmlrDlpLHotKVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XFxuICAgICAgICAgICAgICAgICAgICAgICAgLypcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgQ2tleSA9IHJ1bnRpbWVDb25maWcuZ2V0Q3VycmVudFNvdXJjZSgpLmtleTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhDa2V5KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBjZmcgPSBydW50aW1lQ29uZmlnLmdldEN1cnJlbnRDb25maWcoKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGgsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWVcXG4gICAgICAgICAgICAgICAgICAgICAgICB9ID0gY2ZnO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJ1bnRpbWVDb25maWcuc2V0Q3VycmVudENvbmZpZyh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGgsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcnVudGltZUNvbmZpZy5zZXRDdXJyZW50U291cmNlKENrZXkpOyovXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5zb3VyY2VzID0gcnVudGltZUNvbmZpZy5nZXRBbGxTb3VyY2UoKTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgYWxpc3QgPSBhcnJheURpZmZlcmVuY2UobnNvdXJjZXMsIGxpc3QpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkbGlzdCA9IGFycmF5RGlmZmVyZW5jZShsaXN0LCBuc291cmNlcyk7XFxuXFxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGFsaXN0Lmxlbmd0aCA+IDAgfHwgZGxpc3QubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgbXNnID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChhbGlzdC5sZW5ndGggPiAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhbGlzdC5mb3JFYWNoKHggPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnB1c2goeC5uYW1lKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuaWsOWinjpcXFwiICsgYWxpc3QubWFwKGsgPT4gay5uYW1lKS5qb2luKFxcXCIsXFxcIikpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgKz0gXFxcIuaWsOWinlxcXCIgKyBhbGlzdC5sZW5ndGggKyBcXFwi5Liq5rqQXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZGxpc3QubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGxpc3QuZm9yRWFjaCh4ID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2UubGlzdC5zcGxpY2UobWFuYWdlLmxpc3QuaW5kZXhPZih4Lm5hbWUpLCAxKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBsb2coXFxcIuenu+mZpDpcXFwiICsgZGxpc3QubWFwKGsgPT4gay5uYW1lKS5qb2luKFxcXCIsXFxcIikpXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtc2cgKz0gXFxcIiDnp7vpmaRcXFwiICsgZGxpc3QubGVuZ3RoICsgXFxcIuS4qua6kFxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYW5hZ2Uuc2V0VGl0bGUoXFxcIumAieaLqeinhumikea6kCDlvZPliY3lhbE6XFxcIiArIG1hbmFnZS5saXN0Lmxlbmd0aCArIFxcXCLkuKrop4bpopHmupBcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QobXNnICsgXFxcIiDmm7TlpJror6bmg4XnnItsb2dcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi5bey5Yi35pawXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzLmluY2x1ZGVzKFxcXCLpnZLlsJHlubTmqKHlvI9cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uIHNlbGVjdCgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvd1NlbGVjdE9wdGlvbnMoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxcInRpdGxlXFxcIjogXFxcIumAieaLqVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXFwib3B0aW9uc1xcXCI6IFtcXFwi5Li05pe25YWz6ZetXFxcIiwgXFxcIuWFs+mXrVxcXCIsIFxcXCLorr7nva7lr4bnoIFcXFwiXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbDogMSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaW5wdXQgPT0gXFxcIuS4tOaXtuWFs+mXrVxcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcInRlbXBMZWFjaFxcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYoaW5wdXQgPT0gXFxcIuWFs+mXrVxcXCIpe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhckl0ZW0oXFxcImxlYWNoXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAkKFxcXCJcXFwiLCBcXFwi6K6+572u5a+G56CBXFxcXG7mjIfnurnkuI3og73nlKjml7bmnInmlYhcXFwiKS5pbnB1dCgoKT0+e1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoaW5wdXQpe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcImxlYWNoUGFzc1xcXCIsIGlucHV0KTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v6K6+572u5oiQ5YqfXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsZWFySXRlbShcXFwibGVhY2hQYXNzXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+S9v+eUqOm7mOiupOWvhueggVxcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbGVhY2hQYXNzID0gZ2V0SXRlbShcXFwibGVhY2hQYXNzXFxcIiwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChzLmluY2x1ZGVzKFxcXCLlhbPpl61cXFwiKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGhpa2VyUG9wLmNhbkJpb21ldHJpYygpICE9PSAwJiYhbGVhY2hQYXNzKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWtlclBvcC5pbnB1dENvbmZpcm0oe1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi6K6+572u5a+G56CBXFxcIiwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaW50OiBcXFwi5a+G56CBXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtKHRleHQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCF0ZXh0KSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcInRvYXN0Oi8v5a+G56CB5LiN6IO95Li656m6XFxcIjtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldEl0ZW0oXFxcImxlYWNoUGFzc1xcXCIsIHRleHQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwibGVhY2hcXFwiLCBcXFwiMVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwidGVtcExlYWNoXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi5omT5byA6L+H5rukXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1lbHNle1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwibGVhY2hcXFwiLCBcXFwiMVxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwidGVtcExlYWNoXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0b2FzdChcXFwi5omT5byA6L+H5rukXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoaGlrZXJQb3AuY2FuQmlvbWV0cmljKCkgIT09IDApIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpa2VyUG9wLmlucHV0Q29uZmlybSh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGVudDogXFxcIui+k+WFpeWvhueggei/m+ihjOWFs+mXrVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLovpPlhaXlr4bnoIFcXFwiLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhpbnQ6IFxcXCLlr4bnoIFcXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbmZpcm0odGV4dCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAodGV4dCA9PT0gbGVhY2hQYXNzfHwoIWxlYWNoUGFzcyYmdGV4dD09PVN0cmluZyhwcykpKXtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdCgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL+WvhueggemUmeivr1xcXCI7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWtlclBvcC5jaGVja0J5QmlvbWV0cmljKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoaWtlclBvcC5ydW5Pbk5ld1RocmVhZCgoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNlbGVjdCgpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgcG9wLmRpc21pc3MoKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzaG93U2VsZWN0T3B0aW9ucyh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi57yW56CB57G75Z6LXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgb3B0aW9uczogW1xcXCLkuI3nvJbnoIFcXFwiLCBcXFwiR3ppcFxcXCIsIFxcXCJCYXNlNjRcXFwiLCBcXFwiQUVTXFxcIl0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbDogMSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKE1ZX0lOREVYID09PSAwKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJdGVtKFxcXCJzaGFyZV9lbmNvZGVcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0SXRlbShcXFwic2hhcmVfZW5jb2RlXFxcIiwgaW5wdXQpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJ0b2FzdDovL1xcXCIgKyBpbnB1dDtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH1cXG4gICAgfSk7XFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwiZHJweeeuoeeQhlwiLFwicGF0aFwiOlwiRHJweU1hbmFnZVwiLFwicnVsZVwiOlwianM6XFxuY29uc3QgSlNFbmdpbmUgPSBjb20uZXhhbXBsZS5oaWtlcnZpZXcuc2VydmljZS5wYXJzZXIuSlNFbmdpbmU7XFxuY29uc3QgcnVudGltZUNvbmZpZyA9IEdNLmRlZmluZU1vZHVsZShcXFwicnVudGltZUNvbmZpZ1xcXCIpO1xcbmNvbnN0IGRycHlNYXAgPS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ge1xcbiAgICAgICAgICAgIERycHlNYW5hZ2UucHV0KGtleSwgZHJweSk7XFxuICAgICAgICB9KTtcXG4gICAgfSwga2V5LCBHTWtleSwgTVlfVElDS0VUKSArIFxcXCI7XFxcXG5cXFwiLCBcXFwiXFxcIiwgZmFsc2UpO1xcbn1cXG5cXG5mdW5jdGlvbiBnZXQoa2V5KSB7XFxuICAgIHJldHVybiBzeW5jKCgpID0+IHtcXG4gICAgICAgIC8vbG9nKGRycHlNYXAuc2l6ZSlcXG4gICAgICAgIGlmIChkcnB5TWFwLmhhcyhrZXkpKSB7XFxuICAgICAgICAgICAgcmV0dXJuIGRycHlNYXAuZ2V0KGtleSk7XFxuICAgICAgICB9XFxuICAgICAgICBpZiAoZHJweU1hcC5zaXplID49IDUpIHtcXG4gICAgICAgICAgICAvL2xvZyhcXFwi6K+35rGCOlxcXCIgKyBrZXkpXFxuICAgICAgICAgICAgZGVsKEFycmF5LmZyb20oZHJweU1hcC5rZXlzKCkpLmF0KDApKTtcXG4gICAgICAgIH1cXG4gICAgICAgIGxldCBzb3VyY2UgPSBydW50aW1lQ29uZmlnLmdldEFsbFNvdXJjZXMoKS5maW5kKHYgPT4gdi5rZXkgPT09IGtleSk7XFxuICAgICAgICBjcmVhdGVEcnB5KGtleSk7XFxuICAgICAgICBsZXQgZHJweSA9IGRycHlNYXAuZ2V0KGtleSk7XFxuICAgICAgICBkcnB5LmluaXQocnVudGltZUNvbmZpZy5nZXRBYnNvbHV0ZVBhdGgoc291cmNlLmV4dCkpO1xcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBpZiAoZHJweS5nZXRSdWxlKFxcXCJwcm94eV9ydWxlXFxcIikpIHtcXG4gICAgICAgICAgICAgICAgbGV0IFByb3h5ID0gJC5yZXF1aXJlKFxcXCJMb2NhbFByb3h5XFxcIik7XFxuICAgICAgICAgICAgICAgIGxldCBwcm94eVVybCA9IFByb3h5LnN0YXJ0UHJveHkoTVlfUlVMRS50aXRsZSwgR00uZ2V0U2VsZktleSgpKTtcXG4gICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcIlByb3h5X1VybFxcXCIsIHByb3h5VXJsKTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9IGNhdGNoIChlKSB7XFxuXFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gZHJweTtcXG4gICAgfSwgdGhpcykuY2FsbCgpO1xcbn1cXG4vL3NvdXJjZS5leHTlv4XpobvkuLrnu53lr7not6/lvoRcXG5mdW5jdGlvbiBnZXRCeVNvdXJjZShzb3VyY2UpIHtcXG4gICAgcmV0dXJuIHN5bmMoKCkgPT4ge1xcbiAgICAgICAgbGV0IGtleSA9IHNvdXJjZS5rZXk7XFxuICAgICAgICAvL2xvZyhkcnB5TWFwLnNpemUpXFxuICAgICAgICBpZiAoZHJweU1hcC5oYXMoa2V5KSkge1xcbiAgICAgICAgICAgIHJldHVybiBkcnB5TWFwLmdldChrZXkpO1xcbiAgICAgICAgfVxcbiAgICAgICAgaWYgKGRycHlNYXAuc2l6ZSA+PSA1KSB7XFxuICAgICAgICAgICAgLy9sb2coXFxcIuivt+axgjpcXFwiICsga2V5KVxcbiAgICAgICAgICAgIGRlbChBcnJheS5mcm9tKGRycHlNYXAua2V5cygpKS5hdCgwKSk7XFxuICAgICAgICB9XFxuICAgICAgICBjcmVhdGVEcnB5KGtleSk7XFxuICAgICAgICBsZXQgZHJweSA9IGRycHlNYXAuZ2V0KGtleSk7XFxuICAgICAgICBkcnB5LmluaXQoc291cmNlLmV4dCk7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGlmIChkcnB5LmdldFJ1bGUoXFxcInByb3h5X3J1bGVcXFwiKSkge1xcbiAgICAgICAgICAgICAgICBsZXQgUHJveHkgPSAkLnJlcXVpcmUoXFxcIkxvY2FsUHJveHlcXFwiKTtcXG4gICAgICAgICAgICAgICAgbGV0IHByb3h5VXJsID0gUHJveHkuc3RhcnRQcm94eShNWV9SVUxFLnRpdGxlLCBHTS5nZXRTZWxmS2V5KCkpO1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiUHJveHlfVXJsXFxcIiwgcHJveHlVcmwpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG5cXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiBkcnB5O1xcbiAgICB9LCB0aGlzKS5jYWxsKCk7XFxufVxcblxcbmZ1bmN0aW9uIHB1dChrZXksIGRycHkpIHtcXG4gICAgc3luYygoKSA9PiBkcnB5TWFwLnNldChrZXksIGRycHkpLCB0aGlzKS5jYWxsKCk7XFxufVxcblxcbmZ1bmN0aW9uIHJ1blByb3h5KGRycHksIGFyZ3MpIHtcXG4gICAgaWYgKHR5cGVvZiBkcnB5LnByb3h5ID09PSBcXFwiZnVuY3Rpb25cXFwiKSB7XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIC8vbGV0IHRpbWUxID0gRGF0ZS5ub3coKTtcXG4gICAgICAgICAgICBwcm94eVNlbWFwaG9yZS5hY3F1aXJlKCk7XFxuICAgICAgICAgICAgLy9sZXQgdGltZTIgPSBEYXRlLm5vdygpO1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCIx562J5b6F5pe26Ze0OlxcXCIgKyAodGltZTIgLSB0aW1lMSkgKyBcXFwibXNcXFwiKTtcXG4gICAgICAgICAgICBsZXQgcmVzID0gZHJweS5wcm94eS5hcHBseShkcnB5LCBhcmdzKTtcXG4gICAgICAgICAgICAvL2xldCB0aW1lMyA9IERhdGUubm93KCk7XFxuICAgICAgICAgICAgLy9sb2coXFxcIjLmiafooYzku6PnkIbogJfml7Y6XFxcIiArICh0aW1lMyAtIHRpbWUyKSArIFxcXCJtc1xcXCIpO1xcbiAgICAgICAgICAgIC8vbG9nKFxcXCIz5oC76ICX5pe26ICX5pe2OlxcXCIgKyAodGltZTMgLSB0aW1lMSkgKyBcXFwibXNcXFwiKTtcXG5cXG4gICAgICAgICAgICByZXR1cm4g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AgICAgICAgIHRleHRhcmVhOiBmYWxzZSwgLy/lpJrooYzmqKHlvI9cXG4gICAgICAgICAgICAgIG1heFRleHRhcmVhOiB0cnVlLFxcbiAgICAgICAgICAgICAgbm9BdXRvU29mdDogZmFsc2UsXFxuICAgICAgICAgICAgICAvL2hpZGVDYW5jZWw6IHRydWUsXFxuICAgICAgICAgICAgICBjb25maXJtKHRleHQpIHtcXG4gICAgICAgICAgICAgICAgc2VhcmNoS2V5ID0gdGV4dDtcXG4gICAgICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG4gICAgICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgICAgICBpZiAodGV4dCkge1xcbiAgICAgICAgICAgICAgICAgIGNhblNlYXJjaFNvdXJjZS5mb3JFYWNoKCh2LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodGV4dC5zcGxpdCgvXFxcXHwvKS5maWx0ZXIoZiA9PiBmKS5zb21lKHggPT4gdi5uYW1lLmluY2x1ZGVzKHgpKSkge1xcbiAgICAgICAgICAgICAgICAgICAgICBkeW5hbWljU291cmNlLnB1c2godik7XFxuICAgICAgICAgICAgICAgICAgICAgIG1hbmFnZS5saXN0LnB1c2goc2VhcmNoQWxsb3cuaW5jbHVkZXModi5rZXkpID8gXFxcIuKAnOKAnOKAneKAnVxcXCIgKyAodi5uYW1lICsgXFxcIlxcXCIpLmZvbnRjb2xvcihcXFwiIzAwOTk2NlxcXCIpIDogdi5uYW1lKVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgIGR5bmFtaWNTb3VyY2UgPSBjYW5TZWFyY2hTb3VyY2Uuc2xpY2UoKTtcXG4gICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKG1hbmFnZS5saXN0LCBnZXROYW1lcygpKTtcXG5cXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgICAgICAgIC8vcmV0dXJuIFxcXCJ0b2FzdDovL+i+k+WFpeS6hlxcXCIgKyB0ZXh0O1xcbiAgICAgICAgICAgICAgfSxcXG5cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgfSBlbHNlIGlmIChpID09PSAyKSB7XFxuICAgICAgICAgICAgbGV0IGxpc3QgPSBPYmplY3QuYXNzaWduKFtdLCBtYW5hZ2UubGlzdCk7XFxuICAgICAgICAgICAgbWFuYWdlLmxpc3QubGVuZ3RoID0gMDtcXG5cXG5cXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLnNvcnQoKGEsIGIpID0+IHtcXG4gICAgICAgICAgICAgIHJldHVybiBTdHJpbmcoYS5uYW1lKS5sb2NhbGVDb21wYXJlKFN0cmluZyhiLm5hbWUpLCB1bmRlZmluZWQsIHtcXG4gICAgICAgICAgICAgICAgbnVtZXJpYzogdHJ1ZSxcXG4gICAgICAgICAgICAgICAgc2Vuc2l0aXZpdHk6ICdiYXNlJ1xcbiAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihtYW5hZ2UubGlzdCwgZ2V0TmFtZXMoKSk7XFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gMykge1xcbiAgICAgICAgICAgIG1hbmFnZS5saXN0LnJldmVyc2UoKTtcXG4gICAgICAgICAgICBkeW5hbWljU291cmNlLnJldmVyc2UoKTtcXG5cXG4gICAgICAgICAgICBtYW5hZ2UuY2hhbmdlKCk7XFxuICAgICAgICAgIH0gZWxzZSBpZiAoaSA9PSA0KSB7XFxuICAgICAgICAgICAgZHluYW1pY1NvdXJjZS5mb3JFYWNoKHYgPT4ge1xcbiAgICAgICAgICAgICAgaWYgKCFzZWFyY2hBbGxvdy5pbmNsdWRlcyh2KSkge1xcbiAgICAgICAgICAgICAgICBzZWFyY2hBbGxvdy5wdXNoKHYua2V5KTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBPYmplY3QuYXNzaWduKG1hbmFnZS5saXN0LCBnZXROYW1lcygpKTtcXG4gICAgICAgICAgICBydW50aW1lQ29uZmlnLnNldFNlYXJjaEFsbG93KCk7XFxuICAgICAgICAgICAgbWFuYWdlLmNoYW5nZSgpO1xcbiAgICAgICAgICB9IGVsc2UgaWYgKGkgPT0gNSkge1xcbiAgICAgICAgICAgIGxldCB0ZW1saXN0ID0gc2VhcmNoQWxsb3cuc2xpY2UoKTtcXG4gICAgICAgICAgICBzZWFyY2hBbGxvdy5sZW5ndGggPSAwO1xcbiAgICAgICAgICAgIGR5bmFtaWNTb3VyY2UuZm9yRWFjaCh2ID0+IHtcXG4gICAgICAgICAgICAgIGlmICh0ZW1saXN0LmluY2x1ZGVzKHYua2V5KSkgcmV0dXJuO1xcbiAgICAgICAgICAgICAgc2VhcmNoQWxsb3cucHVzaCh2LmtleSk7XFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihtYW5hZ2UubGlzdCwgZ2V0TmFtZXMoKSk7XFxuICAgICAgICAgICAgcnVudGltZUNvbmZpZy5zZXRTZWFyY2hBbGxvdygpO1xcbiAgICAgICAgICAgIG1hbmFnZS5jaGFuZ2UoKTtcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSxcXG4gICAgICB9KTtcXG4gICAgfVxcbiAgfSk7XFxufVwifSx7XCJjb2xfdHlwZVwiOlwibW92aWVfM1wiLFwibmFtZVwiOlwi5YiG57G7XCIsXCJwYXRoXCI6XCJjYXRlZ29yeXNcIixcInJ1bGVcIjpcImpzOlxcbmxldCBmbCA9IHt9O1xcbmxldCByZXN1bHRzID0gW107XFxubGV0IGhvbWVsaX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XFxcIiArIHQgKyBcXFwiPC9mb250PjwvYj5cXFwiO1xcbiAgICAgICAgICAgIGZsW3gua2V5XSA9IGl0LnY7XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgaWYgKGNhdGVfdGVtcFtpbmRleF0gPT0gXFxcIi0xXFxcIikge1xcbiAgICAgICAgICAgIGZsW3gua2V5XSA9IFxcXCJ1bmRlZmluZWRcXFwiO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIGlmIChmb2xkID09IDEpIHtcXG4gICAgICAgICAgICBsYXlvdXQucHVzaCh7XFxuICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyB0LFxcbiAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChvKSA9PiB7XFxuICAgICAgICAgICAgICAgIGxldCBpID0gby5pO1xcbiAgICAgICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwiaXNfZGVmXFxcIiwgXFxcIjFcXFwiKTtcXG4gICAgICAgICAgICAgICAgbGV0IGNhdGVfb2JqID0gc3RvcmFnZTAuZ2V0TXlWYXIoXFxcImNhdGVfb2JqXFxcIiwge30pO1xcblxcbiAgICAgICAgICAgICAgICBsZXQgY2F0ZV90ZW1wID0gby5jYXRlX3RlbXA7XFxuICAgICAgICAgICAgICAgIGlmIChjYXRlX3RlbXAuY29uc3RydWN0b3IgIT0gQXJyYXkpIHtcXG4gICAgICAgICAgICAgICAgICBjYXRlX3RlbXAgPSBbXTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQgaW5kZXggPSBvLmluZGV4O1xcbiAgICAgICAgICAgICAgICBsZXQgYyA9IGNhdGVfdGVtcFtpbmRleF0gfHwgXFxcIi0xXFxcIjtcXG4gICAgICAgICAgICAgICAgLy9sb2coYylcXG4gICAgICAgICAgICAgICAgaWYgKGMgPT0gaSkge1xcbiAgICAgICAgICAgICAgICAgIG8uY2F0ZV90ZW1wW2luZGV4XSA9IFxcXCItMVxcXCI7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgICAgby5jYXRlX3RlbXBbaW5kZXhdID0gaSArIFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIGNhdGVfb2JqW28uY2F0ZV0gPSBjYXRlX3RlbXA7XFxuICAgICAgICAgICAgICAgIC8vbG9nKGNhdGVfdGVtcClcXG4gICAgICAgICAgICAgICAgLy9zdG9yYWdlMC5wdXRNeVZhcihcXFwiY2F0ZV90ZW1wXFxcIiwgY2F0ZV90ZW1wKTtcXG4gICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcImNhdGVfb2JqXFxcIiwgY2F0ZV9vYmopO1xcbiAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICBpbmRleDogaW5kZXgsXFxuICAgICAgICAgICAgICAgIGNhdGVfdGVtcDogY2F0ZV90ZW1wLFxcbiAgICAgICAgICAgICAgICBpOiBpLFxcbiAgICAgICAgICAgICAgICBjYXRlOiBjYXRlXFxuICAgICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICB9KVxcbiAgICB9XFxuICB9XFxufVxcblxcbmZ1bmN0aW9uIGdldEZsKCkge1xcbiAgZmwgPSBPYmplY3Qua2V5cyhmbCkuZmlsdGVyKGtleSA9PiBmbFtrZXldICE9PSBcXFwidW5kZWZpbmVkXFxcIikucmVkdWNlKChyZXMsIGtleSkgPT4ge1xcbiAgICByZXNba2V5XSA9IGZsW2tleV07XFxuICAgIHJld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cm4gJC5yZXF1aXJlKFxcXCJ2aWRlb1VybFxcXCIpLnBhcnNlKHVybCwgaWQsIHNvdXJjZSk7XFxuICAgICAgICB9LCBzb3VyY2UsIGlkKTtcXG4gICAgICB9XFxuICAgICAgZC5wdXNoKHtcXG4gICAgICAgIHRpdGxlOiBuYW1lLFxcbiAgICAgICAgZGVzYzogaXQudm9kX3JlbWFya3MsXFxuICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgIHBpY191cmw6IGl0LnZvZF9waWMsXFxuICAgICAgICBjb2xfdHlwZTogaG9tZUxpc3RDb2wsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICBpbWc6IGl0LnZvZF9waWMsXFxuICAgICAgICAgIHZvZElkOiBpZCxcXG4gICAgICAgICAgc25hbWU6IHNvdXJjZS5uYW1lLFxcbiAgICAgICAgICBza2V5OiBzb3VyY2Uua2V5LFxcbiAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICB0aXRsZTogXFxcIuiBmuWQiOaQnOe0olxcXCIsXFxuICAgICAgICAgICAganM6IFxcXCJwdXRNeVZhcigndGVtc21vZGUnLCAnMScpOydoaWtlcjovL3NlYXJjaD9ydWxlPScgKyBNWV9SVUxFLnRpdGxlICsgJyZzPVxcXCIgKyBuYW1lICsgXFxcIic7XFxcIlxcbiAgICAgICAgICB9XVxcbiAgICAgICAgfVxcbiAgICAgIH0pO1xcbiAgICB9XFxuICB9XFxuICBkZWxldGVJdGVtKE1ZX1JVTEUudGl0bGUgKyBcXFwibG9hZFxcXCIpO1xcbn1cXG5cXG5mdW5jdGlvbiBzZXREcnB5UGF0aChkKSB7XFxuICBkLnB1c2goe1xcbiAgICB0aXRsZTogXFxcIue8uuWwkei/kOihjOW6k1xcXFxu6K+l5bCP56iL5bqP5LiN6IO96YCa6L+H5LqR5Ymq6LS05p2/5YiG5Lqr77yM5Y+q6IO96YCa6L+H5omT5YyF5YiG5LqrXFxcIixcXG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ml0KHJ1bnRpbWVDb25maWcuZ2V0QWJzb2x1dGVQYXRoKHNvdXJjZS5leHQpKTtcXG4gICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgIH0pXFxuICAgICAgfSwge1xcbiAgICAgICAgdGl0bGU6IFxcXCLph43ovb3mupBcXFwiLFxcbiAgICAgICAganM6ICQudG9TdHJpbmcoKCkgPT4ge1xcbiAgICAgICAgICBsZXQgcnVudGltZUNvbmZpZyA9IEdNLmRlZmluZU1vZHVsZShcXFwicnVudGltZUNvbmZpZ1xcXCIpO1xcbiAgICAgICAgICBsZXQgc291cmNlID0gcnVudGltZUNvbmZpZy5nZXRDdXJyZW50U291cmNlKCk7XFxuICAgICAgICAgIGxldCBEcnB5TWFuYWdlID0gR00uZGVmaW5lTW9kdWxlKFxcXCJEcnB5TWFuYWdlXFxcIik7XFxuICAgICAgICAgIERycHlNYW5hZ2UuZGVsKHNvdXJjZS5rZXkpO1xcbiAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgfSlcXG4gICAgICB9LCB7XFxuICAgICAgICB0aXRsZTogXFxcIuafpeeci+a6kOS7o+eggVxcXCIsXFxuICAgICAgICBqczogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgIGxldCBydW50aW1lQ29uZmlnID0gR00uZGVmaW5lTW9kdWxlKFxcXCJydW50aW1lQ29uZmlnXFxcIik7XFxuICAgICAgICAgIGxldCBzb3VyY2UgPSBydW50aW1lQ29uZmlnLmdldEN1cnJlbnRTb3VyY2UoKTtcXG4gICAgICAgICAgbGV0IERycHlNYW5hZ2UgPSBHTS5kZWZpbmVNb2R1bGUoXFxcIkRycHlNYW5hZ2VcXFwiKTtcXG4gICAgICAgICAgbGV0IGNvZGUgPSBEcnB5TWFuYWdlLmdldChzb3VyY2Uua2V5KS5ydW5NYWluKFxcXCJsZXQgbWFpbj1cXFwiICsgJC50b1N0cmluZygoZXh0KSA9PiB7XFxuICAgICAgICAgICAgcmV0dXJuICgpID0+IGdldE9yaWdpbmFsSnMocmVxdWVzdChleHQsIHtcXG4gICAgICAgICAgICAgICdtZXRob2QnOiAnR0VUJ1xcbiAgICAgICAgICAgIH0pKTtcXG4gICAgICAgICAgfSwgcnVudGltZUNvbmZpZy5nZXRDdXJyZW50U291cmNlUGF0aCgpKSk7XFxuXFxuICAgICAgICAgIGxldCBwYXRoID0gXFxcImhpa2VyOi8vZmlsZXMvX2NhY2hlL3ZpZXdTb3VyY2VDb2RlLmpzXFxcIjtcXG4gICAgICAgICAgd3JpdGVGaWxlKHBhdGgsIGNvZGUpO1xcbiAgICAgICAgICByZXR1cm4gXFxcImVkaXRGaWxlOi8vXFxcIiArIHBhdGg7XFxuICAgICAgICB9KVxcbiAgICAgIH1dLmNvbmNhdChjb25maWcudHlwZSA9PT0gXFxcImxvY2FsRGlyXFxcIiA/IFt7XFxuICAgICAgICB0aXRsZTogXFxcIue8lui+keWPguaVsOaYoOWwhOihqFxcXCIsXFxuICAgICAgICBqczogJC50b1N0cmluZygocGF0aCkgPT4ge1xcbiAgICAgICAgICBwYXRoICs9IFxcXCIvLm1hcHBpbmcudHh0XFxcIjtcXG4gICAgICAgICAgaWYgKGZpbGVFeGlzdChwYXRoKSkge1xcbiAgICAgICAgICAgIHRvYXN0KFxcXCLkv53lrZjlkI7liLfmlrDphY3nva7miJbph43lkK/miY3kvJrnlJ/mlYhcXFwiKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcImVkaXRGaWxlOi8vXFxcIiArIHBhdGg7XFxuICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcIuS4jeWtmOWcqOaYoOWwhOaWh+S7tuaYr+WQpuWIm+W7uu+8n1xcXCIpLmNvbmZpcm0ocGF0aCA9PiB7XFxuICAgICAgICAgICAgICB3cml0ZUZpbGUocGF0aCwgXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgdG9hc3QoXFxcIuS/neWtmOWQjuWIt+aWsOmFjee9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nRzW2ldO1xcbiAgICAgICAgICBpZiAoIWN1cnJlbnRbcGFydF0pIHtcXG4gICAgICAgICAgICBjdXJyZW50W3BhcnRdID0ge307XFxuICAgICAgICAgIH1cXG4gICAgICAgICAgY3VycmVudCA9IGN1cnJlbnRbcGFydF07XFxuICAgICAgICB9XFxuICAgICAgICBjdXJyZW50W3BhcnRzW3BhcnRzLmxlbmd0aCAtIDFdXSA9IHZhbHVlO1xcbiAgICAgIH0sXFxuICAgICAgZ2V0KCkge1xcbiAgICAgICAgbGV0IHVjID0gc3RvcmFnZTAuZ2V0SXRlbShcXFwidWlfY29uZmlnXFxcIiwgdGhpcy51Yyk7XFxuICAgICAgICBpZiAoT2JqZWN0LmtleXModWMpLmxlbmd0aCA9PSAwKSB7XFxuICAgICAgICAgIHVjID0gdGhpcy5kZWY7XFxuICAgICAgICB9XFxuICAgICAgICByZXR1cm4gdWM7XFxuICAgICAgfSxcXG4gICAgICBzZXQodmFsdWUsIGtleSkge1xcbiAgICAgICAgbGV0IHVjID0gdGhpcy5nZXQoKTtcXG4gICAgICAgIGlmIChrZXkpIHtcXG4gICAgICAgICAgdGhpcy5kZWVwT2JqZWN0UHJvcGVydHkodWMsIGtleSwgdmFsdWUpO1xcbiAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgdWMgPSB2YWx1ZTtcXG4gICAgICAgIH1cXG4gICAgICAgIHN0b3JhZ2UwLnNldEl0ZW0oXFxcInVpX2NvbmZpZ1xcXCIsIHVjKTtcXG4gICAgICB9LFxcbiAgICAgIGdldEluZGV4cygpIHtcXG4gICAgICAgIGxldCB1YyA9IHRoaXMuZ2V0KCk7XFxuICAgICAgICBpZiAodWMueWkudWkubGVuZ3RoID4gMCkge1xcbiAgICAgICAgICByZXR1cm4gdWMueWkudWk7XFxuICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICByZXR1cm4gdGhpcy5pdGVtcztcXG4gICAgICAgIH1cXG4gICAgICB9XFxuICAgIH1cXG4gIH0pXFxu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XG4gICAgICAgICAgICAgIHBpYzogY3VycmVudC5waWMgfHwgXFxcIlxcXCIsXFxuICAgICAgICAgICAgICBkZXNjOiBjdXJyZW50LmRlc2MgfHwgXFxcIlxcXCIsXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogY3VycmVudC50eXBlLFxcbiAgICAgICAgICAgICAgZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sIGl0ZW0uZXh0cmEsIHtcXG4gICAgICAgICAgICAgICAga2V5OiBjdXJyZW50LmV4dHJhLmtleSxcXG4gICAgICAgICAgICAgICAgaW5kZXg6IGN1cnJlbnQuZXh0cmEuaW5kZXhcXG4gICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgdXBkYXRlSXRlbShjdXJyZW50LmV4dHJhLmlkLCB7XFxuICAgICAgICAgICAgICB0aXRsZTogaXRlbS50aXRsZSxcXG4gICAgICAgICAgICAgIHBpYzogaXRlbS5waWMgfHwgXFxcIlxcXCIsXFxuICAgICAgICAgICAgICBkZXNjOiBpdGVtLmRlc2MgfHwgXFxcIlxcXCIsXFxuICAgICAgICAgICAgICBjb2xfdHlwZTogaXRlbS50eXBlLFxcbiAgICAgICAgICAgICAgZXh0cmE6IE9iamVjdC5hc3NpZ24oe30sIGN1cnJlbnQuZXh0cmEsIHtcXG4gICAgICAgICAgICAgICAga2V5OiBpdGVtLmV4dHJhLmtleSxcXG4gICAgICAgICAgICAgICAgaW5kZXg6IGl0ZW0uZXh0cmEuaW5kZXhcXG4gICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICAgICAgbGV0IG5hcnIgPSAkLnN3YXBBcnJheUVsZW1lbnRzKGluZGV4cywgY3VycmVudC5leHRyYS5pbmRleCwgaXRlbS5leHRyYS5pbmRleCk7XFxuXFxuICAgICAgICAgICAgJC51aUNvbmZpZy5zZXQobmFyciwgXFxcInlpLnVpXFxcIik7XFxuICAgICAgICAgICAgY2xlYXJNeVZhcihcXFwidWlfY3VycmVudFxcXCIpO1xcbiAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgIGxldCBoID0gJ+KAnOKAnOKAneKAnSc7XFxuICAgICAgICAgICAgbGV0IHRpdGxlID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICB0b2FzdChcXFwi6YCJ5oup56e75Yqo55qE55uu5qCHXFxcIik7XFxuICAgICAgICAgICAgaWYgKC90ZXh0X2ljb258YXZhdGFyfGljb25fc21hbGxfMy8udGVzdChpdGVtLnR5cGUpKSB7XFxuICAgICAgICAgICAgICBoID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLmZvbnRjb2xvcihcXFwiI2ZmZlxcXCIpO1xcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoL2ljb25fMV9zZWFyY2gvLnRlc3QoaXRlbS50eXBlKSkge1xcbiAgICAgICAgICAgICAgaCA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgICAgdGl0bGUgPSBcXFwi4p6h77iPXFxcIiArIHRpdGxlO1xcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICB0aXRsZSA9IHRpdGxlLmZvbnRjb2xvcihcXFwiI2ZmZlxcXCIpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB1cGRhdGVJdGVtKGl0ZW0uZXh0cmEuaWQsIHtcXG4gICAgICAgICAgICAgIHRpdGxlOiBoICsgdGl0bGUsXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBzdG9yYWdlMC5wdXRNeVZhcihcXFwidWlfY3VycmVudFxcXCIsIGl0ZW0pO1xcbiAgICAgICAgICB9XFxuICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICB9LCBpKVxcbiAgICAgICAgaXRlbVtcXFwiZXh0cmFcXFwiXSA9IHtcXG4gICAgICAgICAga2V5OiBpdGVtLmtleSxcXG4gICAgICAgICAgY2xzOiBNWV9SVUxFLnRpdGxlICsgXFxcIl91aVxcXCIsXFxuICAgICAgICAgIGlkOiBNWV9SVUxFLnRpdGxlICsgXFxcIl91aVxcXCIgKyBpLFxcbiAgICAgICAgICBpbmRleDogaXRlbS5pbmRleCxcXG4gICAgICAgIH1cXG4gICAgICAgIGlmIChpdGVtLmtleSAhPSBcXFwi6K6+572uXFxcIikge1xcbiAgICAgICAgICBsb25nY2xpY2tzLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5Yig6ZmkXFxcIixcXG4gICAgICAgICAgICBqczogJC50b1N0cmluZygoa2V5KSA9PiB7XFxuICAgICAgICAgICAgICBsZXQgaXRlbXMgPSAkLnVpQ29uZmlnLmdldEluZGV4cygpO1xcbiAgICAgICAgICAgICAgbGV0IGkgPSBpdGVtcy5maW5kSW5kZXgoeCA9PiB4LmtleSA9PSBrZXkpO1xcbiAgICAgICAgICAgICAgaWYgKGkgIT0gLTEpIHtcXG4gICAgICAgICAgICAgICAgaXRlbXNbaV1bXFxcImluZGV4XFxcIl0gPSAtMTtcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICQudWlDb25maWcuc2V0KGl0ZW1zLCBcXFwieWkudWlcXFwiKTtcXG4gICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgfSwgaXRlbS5rZXkpXFxuICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgICAgICBpZiAoIS9pY29uXzFfc2VhcmNofGF2YXRhci8udGVzdChpdGVtLmNvbF90eXBlKSkge1xcbiAgICAgICAgICBsb25nY2xpY2tzLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiBcXFwi5pu05o2i5Zu+5qCHXFxcIixcXG4gICAgICAgICAgICBqczogJC50b1N0cmluZygoa2V5KSA9PiB7XFxuICAgICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIikuaW5wdXQoKGtleSkgPT4ge1xcbiAgICAgICAgICAgICAgICBsZXQgaXRlbXMgPSAkLnVpQ29uZmlnLmdldEluZGV4cygpO1xcbiAgICAgICAgICAgICAgICBsZXQgaSA9IGl0ZW1zLmZpbmRJbmRleCh4ID0+IHgua2V5ID09IGtleSk7XFxuICAgICAgICAgICAgICAgIGlmIChpICE9IC0xKSB7XFxuICAgICAgICAgICAgICAgICAgaXRlbXNbaV1bXFxcImltZ1xcXCJdID0gaW5wdXQ7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgJC51aUNvbmZpZy5zZXQoaXRlbXMsIFxcXCJ5aS51aVxcXCIpO1xcbiAgICAgICAgICAgICAgICBsZXQgaWQgPSBmaW5kSXRlbXNCeUNscyhNWV9SVUxFLnRpdGxlICsgXFxcIl91aVxcXCIpLmZpbHRlcih4ID0+IHguZXh0cmEua2V5ID09IGtleSlbMF0uZXh0cmEuaWQ7XFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oaWQsIHsgcGljOiBpbnB1dCB9KVxcbiAgICAgICAgICAgICAgfSwga2V5KVxcbiAgICAgICAgICAgIH0sIGl0ZW0ua2V5KVxcbiAgICAgICAgICB9KVxcbiAgICAgICAgICBpZiAoaXRlbS5rZXkgIT0gXFxcIuaNoua6kFxcXCIgJiYgaXRlbS5rZXkgIT0gXFxcIuaQnOe0ouaooeW8j1xcXCIpIHtcXG4gICAgICAgICAgICBsb25nY2xpY2tzLnB1c2goe1xcbiAgICAgICAgICAgICAgdGl0bGU6IFxcXCLkv67mlLnlkI3np7BcXFwiLFxcbiAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGtleSkgPT4ge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gJChcXFwiXFxcIikuaW5wdXQoKGtleSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgIGxldCBpdGVtcyA9ICQudWlDb25maWcuZ2V0SW5kZXhzKCk7XFxuICAgICAgICAgICAgICAgICAgbGV0IGkgPSBpdGVtcy5maW5kSW5kZXgoeCA9PiB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koSlNPTi5zdHJpbmdpZnkodWlfY29uZmlnLnlpKSk7XFxuICAgICAgICAgIH0sIHVpX2NvbmZpZyksXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgIHRpdGxlOiBcXFwi5a+85YWlXFxcIixcXG4gICAgICAgICAganM6ICQudG9TdHJpbmcoKHVpX2NvbmZpZykgPT4ge1xcbiAgICAgICAgICAgIHZhciB1YyA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcInVpX2NvbmZpZ1xcXCIsIHVpX2NvbmZpZyk7XFxuICAgICAgICAgICAgcmV0dXJuICQoXFxcInt7Y2xpcGJvYXJkfX1cXFwiKS5pbnB1dCgodWMpID0+IHtcXG4gICAgICAgICAgICAgIHZhciB5aSA9IHt9O1xcbiAgICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgeWkgPSBKU09OLnBhcnNlKGlucHV0KTtcXG4gICAgICAgICAgICAgICAgaWYgKHlpLmhhc093blByb3BlcnR5KFxcXCJ1aVxcXCIpKSB7XFxuICAgICAgICAgICAgICAgICAgdWMueWkgPSB5aTtcXG4gICAgICAgICAgICAgICAgICBzdG9yYWdlMC5zZXRJdGVtKFxcXCJ1aV9jb25maWdcXFwiLCB1Yyk7XFxuICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICB0b2FzdChcXFwi5qC85byP6ZSZ6K+vXFxcIilcXG4gICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9LCB1YylcXG4gICAgICAgICAgfSwgdWlfY29uZmlnKVxcbiAgICAgICAgfV1cXG4gICAgICB9XFxuICAgIH0pXFxuICAgIGQucHVzaCh7XFxuICAgICAgdGl0bGU6IFxcXCLlpLTpg6jnu4Tku7bmoLflvI86XFxcIiArIHVpX2NvbmZpZy55aS5jb2wsXFxuICAgICAgY29sX3R5cGU6IFxcXCJ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ICAgICAgICAgICAgIHJldHVybiBbXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgbGV0IHBhdGggPSBbXTtcXG4gICAgICAgICAgICBsZXQgY3VycmVudCA9ICcnO1xcbiAgICAgICAgICAgIGxldCBpbkJyYWNrZXRzID0gZmFsc2U7XFxuICAgICAgICAgICAgbGV0IGVzY2FwZSA9IGZhbHNlO1xcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgdmFsdWUubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGNoYXIgPSB2YWx1ZVtpXTtcXG4gICAgICAgICAgICAgICAgaWYgKGVzY2FwZSkge1xcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudCArPSBjaGFyO1xcbiAgICAgICAgICAgICAgICAgICAgZXNjYXBlID0gZmFsc2U7XFxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhciA9PT0gJ1xcXFxcXFxcJykge1xcbiAgICAgICAgICAgICAgICAgICAgZXNjYXBlID0gdHJ1ZTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaGFyID09PSAnLicgJiYgIWluQnJhY2tldHMpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBhdGgucHVzaChjdXJyZW50KTtcXG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnQgPSAnJztcXG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaGFyID09PSAnWycpIHtcXG4gICAgICAgICAgICAgICAgICAgIGluQnJhY2tldHMgPSB0cnVlO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGNoYXIgPT09ICddJykge1xcbiAgICAgICAgICAgICAgICAgICAgaW5CcmFja2V0cyA9IGZhbHNlO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgY3VycmVudCArPSBjaGFyO1xcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChjdXJyZW50KSB7XFxuICAgICAgICAgICAgICAgIHBhdGgucHVzaChjdXJyZW50KTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIHBhdGg7XFxuICAgICAgICB9XFxuXFxuICAgICAgICBmdW5jdGlvbiBnZXRKc29uKG9iaiwgcGF0aCkge1xcbiAgICAgICAgICAgIGlmICghb2JqIHx8ICFBcnJheS5pc0FycmF5KHBhdGgpKSB7XFxuICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGlmIChwYXRoLmxlbmd0aCA9PT0gMCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gb2JqO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgY3VycmVudCA9IG9iajtcXG4gICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHBhdGgubGVuZ3RoOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgbGV0IGtleSA9IHBhdGhbaV07XFxuICAgICAgICAgICAgICAgIGlmIChjdXJyZW50ID09PSBudWxsIHx8IGN1cnJlbnQgPT09IHVuZGVmaW5lZCB8fCB0eXBlb2YgY3VycmVudCAhPT0gJ29iamVjdCcpIHtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB1bmRlZmluZWQ7XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgY3VycmVudCA9IGN1cnJlbnRba2V5XTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgcmV0dXJuIGN1cnJlbnQ7XFxuICAgICAgICB9XFxuICAgICAgICB0cnkge1xcbiAgICAgICAgICAgIGxldCBydW5UeXBlID0gTVlfUEFSQU1TLnJ1blR5cGVbMF07XFxuICAgICAgICAgICAgbGV0IHVybCA9IGRlY29kZVVSSUNvbXBvbmVudChiYXNlNjREZWNvZGUoTVlfUEFSQU1TLnVybFswXSkpO1xcbiAgICAgICAgICAgIGlmIChydW5UeXBlID09IFxcXCJKU09OXFxcIikge1xcblxcbiAgICAgICAgICAgICAgICBsZXQgcGFyYW0gPSBKU09OLnBhcnNlKGRlY29kZVVSSUNvbXBvbmVudChiYXNlNjREZWNvZGUoTVlfUEFSQU1TLnBhcmFtWzBdKSkpO1xcbiAgICAgICAgICAgICAgICBsZXQganNvbiA9IEpTT04ucGFyc2UocmVxdWVzdCh1cmwsIHtcXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHBhcmFtLmhlYWRlcnMgfHwge30sXFxuICAgICAgICAgICAgICAgICAgICBtZXRob2Q6IHBhcmFtLm1ldGhvZCB8fCB2b2lkIDBcXG4gICAgICAgICAgICAgICAgfSkpO1xcbiAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgc3RhdHVzQ29kZTogMzAyLFxcbiAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogT2JqZWN0LmFzc2lnbih7fSwgcGFyYW0uaGVhZGVycyB8fCB7fSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJMb2NhdGlvblxcXCI6IGdldEpzb24oanNvbiwgdG9QYXRoKHBhcmFtLmpzb25QYXRoKSksXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICB9IGVsc2UgaWYgKHJ1blR5cGUgPT0gXFxcIkpTXFxcIikge1xcblxcbiAgICAgICAgICAgICAgICBsZXQgcGFyc2U7XFxuICAgICAgICAgICAgICAgIGlmIChNWV9QQVJBTVMuaW5kZXgpIHtcXG4gICAgICAgICAgICAgICAgICAgIHBhcnNlID0gJC5yZXF1aXJlKFxcXCJjb25maWdzP3J1bGU9XFxcIiArIHRpdGxlKS5nZXRKc29uKClbTVlfUEFSQU1TLmluZGV4WzBdXTtcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgIHBhcnNlID0gSlNPTi5wYXJzZShiYXNlNjREZWNvZGUoZGVjb2RlVVJJQ29tcG9uZW50KE1ZX1BBUkFNUy5wYXJhbVswXSkpKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICBsZXQgcmVzID0gbmV3IEZ1bmN0aW9uKFxcXCJ1cmxcXFwiLCBcXFwic2VsZlxcXCIsIHBhcnNlLmpzKSh1cmwsIHBhcnNlKTtcXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZiByZXMgPT09IFxcXCJzdHJpbmdcXFwiKSB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gSlNPTi5zdHJpbmdpZnkoe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1c0NvZGU6IDMwMixcXG4gICAgICAgICAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxcXCJMb2NhdGlvblxcXCI6IHJlc1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCQudHlwZShyZXMpID09PSBcXFwib2JqZWN0XFxcIikge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIEpTT04uc3RyaW5naWZ5KHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBzdGF0dXNDb2RlOiAzMDIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczogcmVzXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICBsb2coZS50b1N0cmluZygpKTtcXG4gICAgICAgIH1cXG4gICAgfVxcblxcbiAgICBmdW5jdGlvbiBkb0pzKE1ZX1BBUkFNUywgdGl0bGUsIGdrZXkpIHtcXG4gICAgICAgIGxldCB7XFxuICAg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gICAgICAgICAgICAvLyDlpoLmnpzmnInph43lkb3lkI3lm57osIPlh73mlbDvvIzliJnosIPnlKjlroNcXG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgcmVuYW1lQ2FsbGJhY2sgPT09ICdmdW5jdGlvbicpIHtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIFtyZW5hbWVDYWxsYmFjayhrZXksIHZhbHVlKSwgdmFsdWVdO1xcbiAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgcmV0dXJuIFtrZXksIHZhbHVlXTtcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgICAgICBjb25zdCBmaWx0ZXJlZEVudHJpZXMgPSBzaG91bGRFeGNsdWRlID9cXG4gICAgICAgICAgICAgIHByb2Nlc3NlZEVudHJpZXMuZmlsdGVyKChba2V5XSkgPT4gIWtleXNUb0hhbmRsZS5pbmNsdWRlcyhrZXkpKSA6XFxuICAgICAgICAgICAgICBwcm9jZXNzZWRFbnRyaWVzLmZpbHRlcigoW2tleV0pID0+IGtleXNUb0hhbmRsZS5pbmNsdWRlcyhrZXkpKTtcXG4gICAgICAgICAgICByZXR1cm4gT2JqZWN0LmZyb21FbnRyaWVzKGZpbHRlcmVkRW50cmllcyk7XFxuICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgLy8g5aaC5p6c5YWD57Sg5LiN5piv5a+56LGh5oiW5pWw57uE77yM55u05o6l6L+U5ZueXFxuICAgICAgICAgICAgcmV0dXJuIGl0ZW07XFxuICAgICAgICAgIH1cXG4gICAgICAgIH0pO1xcbiAgICAgIH0sXFxuICAgICAgZW51bWVyYWJsZTogZmFsc2UsIC8vIOiuvue9ruS4uuS4jeWPr+aemuS4vlxcbiAgICB9LFxcbiAgICB0cmFuc2Zvcm1LZXlzOiB7XFxuICAgICAgdmFsdWU6IGZ1bmN0aW9uIChrZXlNYXBwaW5nKSB7XFxuICAgICAgICAvLyDkvb/nlKhBcnJheS5wcm90b3R5cGUubWFw6YGN5Y6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ICAgICAgIFxcXCLigJjigJhuZXfigJnigJnvvJrmlK/mjIFwcm94eV9ydWxl5Luj55CG44CCXFxcIixcXG4gICAgICAgIFxcXCLigJzigJxmaXjigJ3igJ3vvJrkv67lpI3kupHnm5jpk77mjqXkuI3osIPlj5bkupHnm5jnroDjgIJcXFwiLFxcbiAgICAgICAgXFxcIuKAnOKAnGZpeOKAneKAne+8muS/ruWkjeWTlOWTqeW9seinhuS4jeiDveS9v+eUqOino+aekOOAglxcXCIsXFxuICAgIF1cXG59XTtcIn1dIiwiaWNvbiI6IiIsInByb3h5IjoiIn0=
Add Comment
Please, Sign In to add comment