xiaomianao666

小程序:腾讯视频

May 23rd, 2024
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@腾讯视频@eyJmaXJzdEhlYWRlciI6ImNsYXNzIiwibGFzdF9jaGFwdGVyX3J1bGUiOiJqczpcbi8vbG9nKE1ZX1VSTClcbnZhciBjaWQgPSBNWV9VUkwuc3BsaXQoJyMnKVsxXTtcbnZhciB2aWQgPSBNWV9VUkwuc3BsaXQoJyMnKVsyXTtcbi8vbG9nKGNpZClcbi8vbG9nKHZpZClcbmNvbnN0IGVqVXJsID0gXCJodHRwczovL3BiYWNjZXNzLnZpZGVvLnFxLmNvbS90cnBjLnVuaXZlcnNhbF9iYWNrZW5kX3NlcnZpY2UucGFnZV9zZXJ2ZXJfcnBjLlBhZ2VTZXJ2ZXIvR2V0UGFnZURhdGE/dmlkZW9fYXBwaWQ9MzAwMDAxMCZ2cGxhdGZvcm09MlwiO1xudmFyIGluZm9fZmV0Y2hEYXRhID0gSlNPTi5wYXJzZShmZXRjaFBDKGVqVXJsLCB7XG4gICAgaGVhZGVyczoge1xuICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb25cIixcbiAgICAgICAgXCJyZWZlcmVyXCI6IFwiaHR0cHM6Ly92LnFxLmNvbS9cIixcbiAgICAgICAgXCJDb29raWVcIjogXCJ2aWRlb19wbGF0Zm9ybT0yO3Z2ZXJzaW9uX25hbWU9OC4yLjk1XCJcbiAgICB9LFxuICAgIG1ldGhvZDogXCJQT1NUXCIsXG4gICAgYm9keToge1xuICAgICAgICBcInBhZ2VfcGFyYW1zXCI6IHtcbiAgICAgICAgICAgIFwicmVxX2Zyb21cIjogXCJ3ZWJcIixcbiAgICAgICAgICAgIFwiY2lkXCI6IChjaWQgPyBjaWQgOiBcIlwiKSxcbiAgICAgICAgICAgIFwidmlkXCI6IHZpZCxcbiAgICAgICAgICAgIFwibGlk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pO1xuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFwic2hlbHZlc19Mb2FkaW5kZXhcIik7XG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXCJ2aWRlb19Mb2FkaW5kZXhcIik7XG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXCJjaGFubmVsX2ZpcnN0X2NsYXNzXCIpO1xuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKTsgLy9mYWxzZeWIt+aWsOS4jeWbnua7muWIsOmhtemdoumhtumDqFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJoaWtlcjovL2VtcHR5XCJcbiAgICAgICAgICAgICAgICB9LCBuYW1lLCBpdC51bkNoYW5uZWxJZCksXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFwic2Nyb2xsX2J1dHRvblwiXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH0pXG4gICAgZC5wdXNoKHtcbiAgICAgICAgY29sX3R5cGU6IFwiYmxhbmtfYmxvY2tcIlxuICAgIH0pO1xuXG4gICAgdmFyIGhvbWVmZXRjaERhdGEgPSBKU09OLnBhcnNlKGZldGNoUEMoTVsxXSwge1xuICAgICAgICBoZWFkZXJzOiB7XG4gICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb25cIixcbiAgICAgICAgICAgIFwicmVmZXJlclwiOiBcImh0dHBzOi8vdi5xcS5jb20vXCIsXG4gICAgICAgICAgICBcIkNvb2tpZVwiOiBcInZpZGVvX3BsYXRmb3JtPTJcIlxuICAgICAgICB9LFxuICAgICAgICBtZXRob2Q6IFwiUE9TVFwiLFxuICAgICAgICBib2R5OiBib2R5XG4gICAgfSkpXG4gICAgLy9sb2coZkRhdGEpXG4gICAgdmFyIGhvbWVDYXJkTGlzdCA9IGhvbWVmZXRjaERhdGEuZGF0YS5DYXJkTGlzdDtcbiAgICB2YXIgaGFzX25leHRf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AgICAgICAgICAgICBsZXQgZGVzID0gXCJcIjtcbiAgICAgICAgICAgICAgICAgICAgaWYgKGl0ZW0ucGFyYW1zLmltZ3RhZykge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKC90YWdfMnx0YWdfMy8udGVzdChpdGVtLnBhcmFtcy5pbWd0YWcpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGltZ3RhZyA9IEpTT04ucGFyc2UoaXRlbS5wYXJhbXMuaW1ndGFnKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhpbWd0YWcpICAgICAgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzID0gaW1ndGFnLnRhZ18zLnRleHQgPyBpbWd0YWcudGFnXzMudGV4dCA6IGltZ3RhZy50YWdfMi50ZXh0LnNwbGl0KFwiLVwiKVswXVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXMgPSBpdGVtLnBhcmFtcy5pbWd0YWc7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkZXMgPSBpdGVtLnBhcmFtcy50aW1lbG9uZyB8fCBpdGVtLnBhcmFtcy5wdWJsaXNoX2RhdGUgfHwgaXRlbS5wYXJhbXMuZXBpc29kZV91cGRhdGVkIHx8IChpdGVtLnBhcmFtcy5kdXJhdGlvbiA/IHNlY29uZHNUb1RpbWUoaXRlbS5wYXJhbXMuZHVyYXRpb24pIDogXCJcIikgfHwgKGl0ZW0ucGFyYW1zLmNtc19pc3ZpcCA9PSAxID8gXCJWSVBcIiA6IFwiXCIpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbV9jaWQgPSBcIlwiO1xuICAgICAgICAgICAgICAgICAgICBpZiAoaXRlbS5wYXJhbXMuY2lkKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbV9jaWQgPSBpdGVtLnBhcmFtcy5jaWQ7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXRlbS5wYXJhbXMuYXR0YWNoZWRfaWQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtX2NpZCA9IGl0ZW0ucGFyYW1zLmF0dGFjaGVkX2lkO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKGl0ZW0pXG4gICAgICAgICAgICAgICAgICAgIGlmIChleHRyYV9wYXJhbSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGVtcF9saXN0cy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMudGl0bGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBpYyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL2VqX3BhZ2VcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbHM6IGV4dHJhX3BhcmFtLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNVcmw6IHBpYyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3I6IGl0ZW0ucGFyYW1zLmR1cmF0aW9uID8gc2Vjb25kc1RvVGltZShpdGVtLnBhcmFtcy5kdXJhdGlvbikgOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaGlrZXI6Ly9lbXB0eSNcIiArIHBhcmFtX2NpZCArIFwiI1wiICsgKGl0ZW0ucGFyYW1zLnZpZCA/IGl0ZW0ucGFyYW1zLnZpZCA6IFwiXCIpICsgXCIjaW1tZXJzaXZlVGhlbWUjXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgdGVtcF9saXN0cy5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMudGl0bGUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBpYyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaGlrZXI6Ly9wYWdlL2VqX3BhZ2VcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwaWNVcmw6IHBpYyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVzY3I6IGl0ZW0ucGFyYW1zLmR1cmF0aW9uID8gc2Vjb25kc1RvVGltZShpdGVtLnBhcmFtcy5kdXJhdGlvbikgOiBcIlwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFwiaGlrZXI6Ly9lbXB0eSNcIiArIHBhcmFtX2NpZCArIFwiI1wiICsgKGl0ZW0ucGFyYW1zLnZpZCA/IGl0ZW0ucGFyYW1zLnZpZCA6IFwiXCIpICsgXCIjaW1tZXJzaXZlVGhlbWUjXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpXG4gICAgICAgICAgICAgICAgbG9nKGl0ZW0pXG4gICAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gdGVtcF9saXN0c1xuICAgIH1cblxuICAgIGhvbWVDYXJkTGlzdC5mb3JFYWNoKChpdGVtKSA9PiB7XG4gICAgICAgIC8vbG9nKGl0ZW0udHlwZSlcbiAgICAgICAgLypcbiAgICAgICAgaWYgKC9odHRwLy50ZXN0KGl0ZW0uY2hpbGRyZW5fbGlzdC5saXN0LmNhcmRzWzBdLmlkKSlcbiAgICAgICAgICAgIHJldHVybiovXG4gICAgICAgIGlmIChpdGVtLnR5cGUgPT0gXCJwY19jYXJvdXNlbFwiKSB7XG4gICAgICAgICAgICAvL+a1t+aKpeWIl+ihqFxuICAgICAgICAgICAgLypcbiAgICAgICAgICAgIGxvZyhcIuWKoOi9vea1t+aKpVwiKSAgICAgICBcbiAgICAgICAgICAgIHB1dFZhcihcInBjX2Nhcm91c2VsXCIsIEpTT04uc3RyaW5naWZ5KGl0ZW0uY2hpbGRyZW5fbGlzdC5saXN0LmNhcmRzKSlcbiAgICAgICAgICAgIGQucHVzaCh7XG4gICAgICAgICAgICAgICAgdXJsOiBnZXRQYXRoKCdoaWtlcjovL2ZpbGVzL1R5cmFudEcvcHVibGljL3R4X2Jhbm5lcnMuaHRtbCcpLFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcIng1X3dlYnZpZXdfc2luZ2xlXCIsXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcbiAgICAgICAgICAgICAgICAgICAgZGVzYzogXCJhdXRvXCJcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KSovXG4gICAgICAgIH0gZWxzZSBpZiAoaXRlbS50eXBlID09IFwicGNfaG90X2ZpbHRlclwiKSB7XG4gICAgICAgICAgICAvL+eDremXqOWIhuexu+aOqOiNkCAgICAgICAgICAgIFxuICAgICAgICAgICAgdmFyIHBjX2hvdF9maWx0ZXIgPSBpdGVtLmNoaWxkcmVuX2xpc3QubGlzdC5jYXJkcztcbiAgICAgICAgICAgIC8vbG9nKHBjX2hvdF9maWx0ZXIpXG4gICAgICAgICAgICBpZiAoaXRlbS5pZCA9PSBcIjQwXzFjNDllXCIpIHtcbiAgICAgICAgICAgICAgICBwY19ob3RfZmlsdGVyLmZvckVhY2goaXQgPT4ge1xuICAgICAgICAgICAgICAgICAgICBsZXQgbmFtZSA9IGl0LnBhcmFtcy5sYWJlbF90aXRsZTtcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRNeVZhcignZnJlZVR5cGUnKSA9PT0gbmFtZSA/ICfigJzigJzigJ3igJ08Yj48Zm9udCBjb2xvcj0jMDBGRkZGPicgKyBuYW1lICsgJzwvZm9udD48L2I+JyA6IG5hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjI25vSGlzdG9yeSMnKS5sYXp5UnVsZSgobmFtZSwgZmlsdGVyX3ZhbHVlKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXCJmcmVlVHlwZVwiLCBuYW1lKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcImNoYW5uZWxfZmlyc3RfY2xhc3NcIiwgZmlsdGVyX3ZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7IC8vZmFsc2XliLfmlrDkuI3lm57mu5rliLDpobXpnaLpobbpg6hcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJoaWtlcjovL2VtcHR5XCJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIG5hbWUsIGl0LnBhcmFtcy5maWx0ZXJfdmFsdWUpLFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFwic2Nyb2xsX2J1dHRvblwiXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcGNfaG90X2ZpbHRlci5mb3JFYWNoKChpdGVtKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMubGFiZWxfdGl0bGUsXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6ICdoaWtlcjovL3BhZ2UvY2hhbm5lbF9saXN0X2ZpbHRlcicsXG4gICAgICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogXCJzY3JvbGxfYnV0dG9uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHVybDogTVsxXSArIFwiIyNmeXBhZ2VcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWx0ZXJfdmFsdWU6IGl0ZW0ucGFyYW1zLmZpbHRlcl92YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlX2lkOiBpdGVtLnBhcmFtcy5wYWdlX2lkXG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGl0ZW0udHlwZSA9PSBcInBjX3NoZWx2ZXNcIikge1xuICAgICAgICAgICAgLy9sb2coaXRlbSlcbiAgICAgICAgICAgIGlmIChnZXRNeVZhcihcInNoZWx2ZXNfTG9hZGluZGV4XCIsIFwiMVwiKSA9PSBcIjFcIikge1xuICAgICAgICAgICAgICAgIC8v56ys5LiA5qyh5Yqg6L29ICAgICAgICAgICAgICBcbiAgICAgICAgICAgICAgICB2YXIgc2hlbHZlc0xpc3QgPSBpdGVtLmNoaWxkcmVuX2xpc3QubGlzdC5jYXJkcztcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMuWlRfbGVhZl9oZWFkICsgJ1xcdFxcdFxcdFxcdFxcdFxcdOaNouS4gOaNovCflIEnLFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBcImh0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9xLzEzNi5wbmdAUmVmZXJlcj1cIixcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCkubGF6eVJ1bGUoKHNoZWx2ZXNMaXN0LCBnZXRSYW5kb21BcnJheVZhbHVlLCBzZWNvbmRzVG9UaW1lLCBwdXNoRGF0YSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNoZUxpc3RzID0gZ2V0UmFuZG9tQXJyYXlWYWx1ZShzaGVsdmVzTGlzdCwgNik7XG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhnZXRSYW5kb21BcnJheVZhbHVlLnRvU3RyaW5nKCkpXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhzZWNvbmRzVG9UaW1lLnRvU3RyaW5nKCkpXG4gICAgICAgICAgICAgICAgICAgICAgICB2YXIgc2hlcmFuZG9tTGlzdHMgPSBwdXNoRGF0YShzaGVMaXN0cywgc2Vjb25kc1RvVGltZSwgXCJzaGVsdmVzTGlzdHNcIik7XG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhzaGVyYW5kb21MaXN0cykgICAgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoc2hlcmFuZG9tTGlzdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoJ3NoZWx2ZXNMaXN0cycpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcignWlRfbGVhZl9oZWFkXzEnLCBzaGVyYW5kb21MaXN0cyk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXG4gICAgICAgICAgICAgICAgICAgIH0sIHNoZWx2ZXNMaXN0LCBnZXRSYW5kb21BcnJheVZhbHVlLCBzZWNvbmRzVG9UaW1lLCBwdXNoRGF0YSksXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcImF2YXRhclwiLFxuICAgICAgICAgICAgICAgICAgICBleHRyYToge1xuICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IFwiWlRfbGVhZl9oZWFkXzFcIlxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgdmFyIHNoZWx2ZXNEYXRhID0gZ2V0UmFuZG9tQXJyYXlWYWx1ZShzaGVsdmVzTGlzdCwgNik7XG4gICAgICAgICAgICAgICAgQXJyYXkucHJvdG90eXBlLnB1c2guYXBwbHkoZCwgcHVzaERhdGEoc2hlbHZlc0RhdGEsIHNlY29uZHNUb1RpbWUsIFwic2hlbHZlc0xpc3RzXCIpKTtcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcInNoZWx2ZXNfTG9hZGluZGV4XCIsIFwiMlwiKVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMuWlRfbGVhZl9oZWFkLFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBcImh0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9tZXNzeS8xNjcuc3ZnQFJlZmVyZXI9XCIsXG4gICAgICAgICAgICAgICAgICAgIHVybDogJChcIiNub1JlY29yZEhpc3RvcnkjI25vTG9hZGluZyNcIikubGF6eVJ1bGUoKCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xuICAgICAgICAgICAgICAgICAgICB9KSxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFwiYXZhdGFyXCJcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB2YXIgc2hlbHZlc0xpc3QgPSBpdGVtLmNoaWxkcmVuX2xpc3QubGlzdC5jYXJkcztcbiAgICAgICAgICAgICAgICBBcnJheS5wcm90b3R5cGUucHVzaC5hcHBseShkLCBwdXNoRGF0YShzaGVsdmVzTGlzdCwgc2Vjb25kc1RvVGltZSkpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9IGVsc2UgaWYgKGl0ZW0udHlwZSA9PSBcImNoYW5uZWxfcGxheV9zY2hlZHVsZVwiKSB7XG4gICAgICAgICAgICAvL+WKqOa8q+i/veeVquaXtumXtOihqCAgICAgICAgICAgXG4gICAgICAgICAgICBsZXQgY19wX3NjaGVkdWxlID0gaXRlbS5jaGlsZHJlbl9saXN0Lmxpc3QuY2FyZHM7XG4gICAgICAgICAgICBsZXQgZmxpcF9pbmZvID0gaXRlbS5mbGlwX2luZm9zLnRhYjtcbiAgICAgICAgICAgIGlmIChmbGlwX2luZm8pIHtcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcImZsaXBfaW5mb1wiLCBKU09OLnN0cmluZ2lmeShmbGlwX2luZm8pKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vbG9nKGNfcF9zY2hlZHVsZSlcbiAgICAgICAgICAgIHZhciBzY3RpdGxlQXJyID0gW107XG4gICAgICAgICAgICBjX3Bfc2NoZWR1bGUuZm9yRWFjaCgoaXRlbSwgaW5kZXgpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAoaW5kZXggPCA3KSB7XG4gICAgICAgICAgICAgICAgICAgIGxldCB0aXRsZSA9IGl0ZW0ucGFyYW1zLnRpdGxlO1xuICAgICAgICAgICAgICAgICAgICBzY3RpdGxlQXJyLnB1c2godGl0bGUpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoaW5kZXggPT0gNikge1xuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXCJzY3RpdGxlQXJyXCIsIEpTT04uc3RyaW5naWZ5KHNjdGl0bGVBcnIpKVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIC8vbG9nKHNjdGl0bGVBcnIpXG4gICAgICAgICAgICAgICAgICAgIGxldCBkYXRhX2tleSA9IGl0ZW0ucGFyYW1zLmRhdGFfa2V5O1xuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGdldE15VmFyKCd3ZWVrJywgXCLku4rlpKlcIikgPT09IHRpdGxlID8gJ+KAnOKAnOKAneKAnTxiPjxmb250IGNvbG9yPSNGQTcyOTg+JyArIHRpdGxlICsgJzwvZm9udD48L2I+JyA6IHRpdGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIyNub0hpc3RvcnkjJykubGF6eVJ1bGUoKHRpdGxlLCBkYXRhX2tleSwgaW5kZXgsIHB1c2hEYXRhLCBzZWNvbmRzVG9UaW1lKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXCJ3ZWVrXCIsIHRpdGxlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL3B1dE15VmFyKFwiZGF0YV9rZXlcIiwgZGF0YV9rZXkpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGRhdGFfa2V5KSAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGRhdGFfa2V5X09iaiA9IG5ldyBPYmplY3QoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgZGF0YV9rZXlzID0gZGF0YV9rZXkuc3BsaXQoXCImXCIpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgZGF0YV9rZXlzLmxlbmd0aDsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGFfa2V5X09ialtkYXRhX2tleXNbaV0uc3BsaXQoXCI9XCIpWzBdXSA9IHVuZXNjYXBlKGRhdGFfa2V5c1tpXS5zcGxpdChcIj1cIilbMV0pO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhkYXRhX2tleV9PYmopXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2coSlNPTi5wYXJzZShnZXRNeVZhcihcImZsaXBfaW5mb1wiKSkpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHBVcmwgPSBcImh0dHBzOi8vcGJhY2Nlc3MudmlkZW8ucXEuY29tL3RycGMudmVjdG9yX2xheW91dC5wYWdlX3ZpZXcuUGFnZVNlcnZpY2UvZ2V0Q2FyZD92aWRlb19hcHBpZD0zMDAwMDEwXCI7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHNjZmV0Y2hEYXRhID0gSlNPTi5wYXJzZShmZXRjaFBDKHBVcmwsIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczoge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJDb250ZW50LVR5cGVcIjogXCJhcHBsaWNhdGlvbi9qc29uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcInJlZmVyZXJcIjogXCJodHRwczovL3YucXEuY29tL1wiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJDb29raWVcIjogXCJ2aWRlb19wbGF0Zm9ybT0yXCJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWV0aG9kOiBcIlBPU1RcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYm9keToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJwYWdlX2NvbnRleHRcIjogbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwicGFnZV9wYXJhbXNcIjogZGF0YV9rZXlfT2JqLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJmbGlwX2luZm9cIjogSlNPTi5wYXJzZShnZXRNeVZhcihcImZsaXBfaW5mb1wiKSB8fCB7fSlcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBsZXQgc2NhcmRzID0gc2NmZXRjaERhdGEuZGF0YS5jYXJkLmNoaWxkcmVuX2xpc3QubGlzdC5jYXJkcztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgcG9zdGVyTGlzdHMgPSBwdXNoRGF0YShzY2FyZHMuc2xpY2UoNyksIHNlY29uZHNUb1RpbWUsIFwicG9zdGVyTGlzdHNcIik7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAocG9zdGVyTGlzdHMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2cocG9zdGVyTGlzdHMpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBzY3RpdGxlQXJyID0gSlNPTi5wYXJzZShnZXRNeVZhcihcInNjdGl0bGVBcnJcIikpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKFwid2Vla19pZF9cIiArIGdldE15VmFyKFwic2N0aXRsZU51bVwiLCBcIjBcIiksIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBzY3RpdGxlQXJyW3BhcnNlSW50KGdldE15VmFyKFwic2N0aXRsZU51bVwiLCBcIjBcIikpXVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKFwid2Vla19pZF9cIiArIGluZGV4LCB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnTxiPjxmb250IGNvbG9yPSNGQTcyOTg+JyArIHRpdGxlICsgJzwvZm9udD48L2I+J1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcInNjdGl0bGVOdW1cIiwgaW5kZXgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoJ3Bvc3Rlckxpc3RzJyk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFkZEl0ZW1BZnRlcignd2Vla19pZF82JywgcG9zdGVyTGlzdHMpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gXCJoaWtlcjovL2VtcHR5XCJcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHRpdGxlLCBkYXRhX2tleSwgaW5kZXgsIHB1c2hEYXRhLCBzZWNvbmRzVG9UaW1lKSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcImZsZXhfYnV0dG9uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlkOiBcIndlZWtfaWRfXCIgKyBpbmRleFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgQXJyYXkucHJvdG90eXBlLnB1c2guYXBwbHkoZCwgcHVzaERhdGEoY19wX3NjaGVkdWxlLnNsaWNlKDcpLCBzZWNvbm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XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJChvcF92YWx1ZSArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChwYXJhbXMpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsZXQgbmV3X2NhdGUgPSBbXVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcmFtcy5jYXRlX3RlbXAuZm9yRWFjaCgoY2F0ZSwgaW5kZXgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3X2NhdGUucHVzaChpbmRleCA9PT0gMCA/IHBhcmFtcy5rZXkudG9TdHJpbmcoKSA6IFxcXCIwXFxcIilcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXG5cXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHBhcmFtcy5TZmlsdGVyX2tleS5sZW5ndGg7IGkrKykge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKHBhcmFtcy5TZmlsdGVyX2tleVtpXSlcXG4gICAgICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2hlYWRlci5jYXRlZ29yeScsIEpTT04uc3RyaW5naWZ5KG5ld19jYXRlKSlcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuY2xhc3Nfa2V5LCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSh0cnVlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCJcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBjYXRlX3RlbXA6IGNhdGVfdGVtcCxcXG4gICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGtleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBjbGFzc19rZXk6IGNsYXNzX2tleSxcXG4gICAgICAgICAgICAgICAgICAgICAgICBTZmlsdGVyX2tleTogU2ZpbHRlcl9rZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFnZTogcGFnZSxcXG4gICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcblxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwiYmxhbmtfYmxvY2tcXFwiXFxuICAgICAgICAgICAgfSk7XFxuXFxuICAgICAgICB9IGVsc2UgaWYgKGZvbGQgPT09ICcxJykge1xcbiAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgIHN1Yl9jYXRlZ29yaWVzLmZvckVhY2goKGl0ZW0sIGtleSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgbGV0IHRpdGxlID0gaXRlbS5wYXJhbXMub3B0aW9uX25hbWU7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgb3BfdmFsdWUgPSBpdGVtLnBhcmFtcy5vcHRpb25fdmFsdWU7XFxuICAgICAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoY2xhc3Nfa2V5KSkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0gZ2V0TXlWYXIoY2xhc3Nfa2V5KSA9PSBvcF92YWx1ZSA/ICfigJzigJzigJ3igJ08Yj48c3BhbiBzdHlsZT1cXFwiY29sb3I6ICcgKyDliIbnsbvpopzoibIgKyAnXFxcIj4nICsgdGl0bGUgKyAnPC9zcGFuPjwvYj4nIDogdGl0bGU7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlID0ga2V5LnRvU3RyaW5nKCkgPT09IGNhdGVfdGVtcFtpbmRleF0gPyAn4oCc4oCc4oCd4oCdPGI+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiAnICsg5YiG57G76aKc6ImyICsgJ1xcXCI+JyArIHRpdGxlICsgJzwvc3Bhbj48L2I+JyA6IHRpdGxlO1xcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiAkKG9wX3ZhbHVlICsgJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKHBhcmFtcykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJhbXMuY2F0ZV90ZW1wW3BhcmFtcy5pbmRleF0gPSBwYXJhbXMua2V5LnRvU3RyaW5nKClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ2hlYWRlci5jYXRlZ29yeScsIEpTT04uc3RyaW5naWZ5KHBhcmFtcy5jYXRlX3RlbXApKVxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihwYXJhbXMuY2xhc3Nfa2V5LCBpbnB1dClcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSlcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFxcXCJoaWtlcjovL2VtcHR5XFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2F0ZV90ZW1wOiBjYXRlX3RlbXAsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGluZGV4OiBpbmRleCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5OiBrZXksXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsYXNzX2tleTogY2xhc3Nfa2V5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYWdlOiBwYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicsXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgbG9nKHN1Yl9jYXRlZ29yaWVzKVxcbiAgICAgICAgICAgICAgICBsb2coZS50b1N0cmluZygpKVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcImJsYW5rX2Jsb2NrXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcblxcbiAgICB9KVxcbn1cIn0se1wiY29sX3R5cGVcIjpcIm1vdmllXzNcIixcIm5hbWVcIjpcIueJh+W6k1wiLFwicGF0aFwiOlwiY2hhbm5lbF9saXN0X2ZpbHRlclwiLFwicnVsZVwiOlwianM6XFxuYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAoKSA9PiB7XFxuICAgIHZhciBTZmlsdGVyX2tleSA9IEpTT04ucGFyc2UoZ2V0TXlWYXIoXFxcIlNmaWx0ZXJfa2V5XFxcIikpO1xcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IFNmaWx0ZXJfa2V5Lmxlbmd0aDsgaSsrKSB7XFxuICAgICAgICBjbGVhck15VmFyKFNmaWx0ZXJfa2V5W2ldKVxcbiAgICB9XFxuICAgIGNsZWFyTXlWYXIoXFxcIlNmaWx0ZXJfa2V5XFxcIik7XFxufSlcXG52YXIgZCA9IFtdO1xcbmNvb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Expc3QuZm9yRWFjaCgoaXRlbSkgPT4ge1xcbiAgICAgICAgaWYgKGl0ZW0udHlwZSA9PSBcXFwiY2hhbm5lbF9saXN0X2ZpbHRlclxcXCIpIHtcXG4gICAgICAgICAgICBmdW5jdGlvbiBncm91cEJ5KGFyciwgcHJvcCkge1xcbiAgICAgICAgICAgICAgICByZXR1cm4gYXJyLnJlZHVjZShmdW5jdGlvbihncm91cHMsIGl0ZW0pIHtcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbCA9IGl0ZW0ucGFyYW1zW3Byb3BdXFxuICAgICAgICAgICAgICAgICAgICBncm91cHNbdmFsXSA9IGdyb3Vwc1t2YWxdIHx8IFtdXFxuICAgICAgICAgICAgICAgICAgICBncm91cHNbdmFsXS5wdXNoKGl0ZW0pXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZ3JvdXBzXFxuICAgICAgICAgICAgICAgIH0sIHt9KVxcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB2YXIgZml0ZXJPYmogPSBncm91cEJ5KGl0ZW0uY2hpbGRyZW5fbGlzdC5saXN0LmNhcmRzLCBcXFwiZmlsdGVyX2tleVxcXCIpO1xcbiAgICAgICAgICAgIC8vbG9nKGdib2JqKVxcbiAgICAgICAgICAgIHZhciBTQ2F0ZXMgPSBbXTtcXG4gICAgICAgICAgICB2YXIgU2ZpbHRlcl9rZXkgPSBbXTtcXG4gICAgICAgICAgICBmb3IgKGxldCBpIGluIGZpdGVyT2JqKSB7XFxuICAgICAgICAgICAgICAgIFNDYXRlcy5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJmaWx0ZXJfa2V5XFxcIjogaSxcXG4gICAgICAgICAgICAgICAgICAgIFxcXCJpdGVtc1xcXCI6IGZpdGVyT2JqW2ldXFxuICAgICAgICAgICAgICAgIH0pO1xcbiAgICAgICAgICAgICAgICBTZmlsdGVyX2tleS5wdXNoKGkpO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAg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vXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBwaWMgPSBwaWMuc3Vic3RyaW5nKDAsIGluZGV4KTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBkZXMgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLnBhcmFtcy5pbWd0YWcpIHsgIFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmKHR5cGVvZihpdGVtLnBhcmFtcy5pbWd0YWcpID09PSBcXFwib2JqZWN0XFxcIil7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXFxuICAgICAgICAgICAgICAgICAgICAgICAgIGxldCBpbWd0YWcgPSBKU09OLnBhcnNlKGl0ZW0ucGFyYW1zLmltZ3RhZyk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgIC8vbG9nKGltZ3RhZykgICAgICAgICAgICAgICAgICAgICBcXG4gICAgICAgICAgICAgICAgICAgICAgICAgZGVzID0gaW1ndGFnLnRhZ18zLnRleHQgPyBpbWd0YWcudGFnXzMudGV4dCA6IGltZ3RhZy50YWdfMi50ZXh0LnNwbGl0KFxcXCItXFxcIilbMF1cXG4gICAgICAgICAgICAgICAgICAgICAgICAgfWVsc2V7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXMgPSBpdGVtLnBhcmFtcy5pbWd0YWc7XFxuICAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICBkZXMgPSBpdGVtLnBhcmFtcy50aW1lbG9uZyB8fCBpdGVtLnBhcmFtcy5wdWJsaXNoX2RhdGUgfHwgaXRlbS5wYXJhbXMuZXBpc29kZV91cGRhdGVkIHx8IChpdGVtLnBhcmFtcy5kdXJhdGlvbiA/IHNlY29uZHNUb1RpbWUoaXRlbS5wYXJhbXMuZHVyYXRpb24pIDogXFxcIlxcXCIpIHx8IChpdGVtLnBhcmFtcy5jbXNfaXN2aXAgPT0gMSA/IFxcXCJWSVBcXFwiIDogXFxcIlxcXCIpO1xcbiAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIGxldCBwYXJhbV9jaWQgPSBcXFwiXFxcIjtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpdGVtLnBhcmFtcy5jaWQpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJhbV9jaWQgPSBpdGVtLnBhcmFtcy5jaWQ7XFxuICAgICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKGl0ZW0ucGFyYW1zLmF0dGFjaGVkX2lkKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1fY2lkID0gaXRlbS5wYXJhbXMuYXR0YWNoZWRfaWQ7XFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogaXRlbS5wYXJhbXMudGl0bGUsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVzYzogZGVzLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBpYyxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJoaWtlcjovL3BhZ2UvZWpfcGFnZVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eSNcXFwiICsgcGFyYW1fY2lkICsgXFxcIiNcXFwiICsgKGl0ZW0ucGFyYW1zLnZpZCA/IGl0ZW0ucGFyYW1zLnZpZCA6IFxcXCJcXFwiKSArIFxcXCIjaW1tZXJzaXZlVGhlbWUjXFxcIlxcbiAgICAgICAgICAgICAgICAgICAgICAgIH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gZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+W9seeJh+eugOS7iyA8c21hbGw+PHNtYWxsPjxzcGFuIHN0eWxlPVxcXCJjb2xvcjojMTlCODlEXFxcIj7lsZXlvIA+PC9zcGFuPjwvc21hbGw+PC9zbWFsbD4nLFxcbiAgICAgICAgICAgIGltZzogXFxcImh0dHBzOi8vbGFubWVpZ3VvamlhbmcuY29tL3R1Ymlhby9tb3JlLzE5Ny5wbmdcXFwiLFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoY29udGVudF9kZXNjKSA9PiB7XFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcihcXFwiampfc3RhdGVcXFwiLCBcXFwi5pS26LW3XFxcIikgPT0gXFxcIuaUtui1t1xcXCIpIHtcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcImNvbnRlbnRfamppZFxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJ+W9seeJh+eugOS7iyA8c21hbGw+PHNtYWxsPjxzcGFuIHN0eWxlPVxcXCJjb2xvcjojMTlCODlEXFxcIj7mlLbotbc+PC9zcGFuPjwvc21hbGw+PC9zbWFsbD4nXFxuICAgICAgICAgICAgICAgICAgICB9KVxcblxcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwiY29udGVudF9kZWNpZFxcXCIsIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogJzxzcGFuIHN0eWxlPVxcXCJjb2xvcjojODA4MDgwXFxcIj4nICsgY29udGVudF9kZXNjICsgJzwvc3Bhbj4nXFxuICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoXFxcImpqX3N0YXRlXFxcIiwgXFxcIuWxleW8gFxcXCIpO1xcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwiY29udGVudF9qamlkXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAn5b2x54mH566A5LuLIDxzbWFsbD48c21hbGw+PHNwYW4gc3R5bGU9XFxcImNvbG9yOiMxOUI4OURcXFwiPuWxleW8gD48L3NwYW4+PC9zbWFsbD48L3NtYWxsPidcXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuXFxuICAgICAgICAgICAgICAgICAgICB1cGRhdGVJdGVtKFxcXCJjb250ZW50X2RlY2lkXFxcIiwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiAnPHNwYW4gc3R5bGU9XFxcImNvbG9yOiM4MDgwODBcXFwiPicgKyBjb250ZW50X2Rlc2Muc3Vic3RyKDAsIDUwKSArICcuLi48L3NwYW4+J1xcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJqal9zdGF0ZVxcXCIsIFxcXCLmlLbotbdcXFwiKTtcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiXFxuICAgICAgICAgICAgfSwgY29udGVudF9kZXNjKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImF2YXRhclxcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgaWQ6IFxcXCJjb250ZW50X2pqaWRcXFwiXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSk7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAnPHNwYW4gc3R5bGU9XFxcImNvbG9yOiM4MDgwODBcXFwiPicgKyBjb250ZW50X2Rlc2Muc3Vic3RyKDAsIDUwKSArICcuLi48L3NwYW4+JyxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInJpY2hfdGV4dFxcXCIsXFxuICAgICAg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gICAgICAgICAgICAgICAgICAgICAgZGVzYzogc2Vjb25kc1RvVGltZShpdGVtLml0ZW1fcGFyYW1zLmR1cmF0aW9uKSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB1cmw6IFxcXCJodHRwczovL3YucXEuY29tL3gvY292ZXIvXFxcIiArIChpdGVtLml0ZW1fcGFyYW1zLmNpZCA/IChpdGVtLml0ZW1fcGFyYW1zLmNpZCArIFxcXCIvXFxcIikgOiBcXFwiXFxcIikgKyBpdGVtLml0ZW1fcGFyYW1zLnZpZCArIFxcXCIuaHRtbFxcXCIgKyBsYXp5LFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibW92aWVfMlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWQ6IGl0ZW0uaXRlbV9wYXJhbXMuY2lkICsgXFxcIi9cXFwiICsgaXRlbS5pdGVtX3BhcmFtcy52aWQsXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNsczogJ3BsYXlMaXN0J1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhlLnRvU3RyaW5nKCkpXFxuICAgICAgICAgICAgICAgICAgICBsb2coaXRlbSlcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICBsZXQgcGljID0gaXRlbS5pdGVtX3BhcmFtcy5pbWFnZV91cmwgPyBpdGVtLml0ZW1fcGFyYW1zLmltYWdlX3VybCA6IGl0ZW0uaXRlbV9wYXJhbXMucGljX25ldztcXG4gICAgICAgICAgICAgICAgICAgIGxldCBpbmRleCA9IHBpYy5sYXN0SW5kZXhPZihcXFwiXFxcXC9cXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHBpYyA9IHBpYy5zdWJzdHJpbmcoMCwgaW5kZXgpO1xcbiAgICAgICAgICAgICAgICAgICAgcHJlX2xpc3RzLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdGVtLml0ZW1fcGFyYW1zLnVuaW9uX3RpdGxlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IHBpYyxcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZXNjOiBzZWNvbmRzVG9UaW1lKGl0ZW0uaXRlbV9wYXJhbXMuZHVyYXRpb24pLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogXFxcImh0dHBzOi8vdi5xcS5jb20veC9jb3Zlci9cXFwiICsgKGl0ZW0uaXRlbV9wYXJhbXMuY2lkID8gKGl0ZW0uaXRlbV9wYXJhbXMuY2lkICsgXFxcIi9cXFwiKSA6IFxcXCJcXFwiKSArIGl0ZW0uaXRlbV9wYXJhbXMudmlkICsgXFxcIi5odG1sXFxcIiArIGxhenksXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJtb3ZpZV8yXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5pdGVtX3BhcmFtcy5jaWQgKyBcXFwiL1xcXCIgKyBpdGVtLml0ZW1fcGFyYW1zLnZpZCxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xzOiAncGxheUxpc3QnXFxuICAgICAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICAgICAgbG9nKGUudG9TdHJpbmcoKSlcXG4gICAgICAgICAgICAgICAgICAgIGxvZyhpdGVtKVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIC8qXFxuICAgICAgICBwcmVfbGlzdHMuZmlsdGVyKGl0ID0+IHtcXG4gICAgICAgICAgICBcXG4gICAgICAgIH0pKi9cXG4gICAgICAgIHJldHVyblxcbiAgICAgICAgLy9yZXR1cm4gZXBpc29kZV9saXN0cy5jb25jYXQocHJlX2xpc3RzKVxcbiAgICB9O1xcbiAgICBwdXNoX0xpc3RzKGxpc3RfSnNvbilcXG4gICAgLy9wbGF5X0xpc3RzLnB1c2gocHVzaF9MaXN0cyhsaXN0X0pzb24pKVxcbiAgICAvL2xvZyhoYXNfbmV4dClcXG4gICAgLy9sb2codHlwZW9mKGhhc19uZXh0KSlcXG4gICAgLy9sb2cobmV4dF9wYWdlX2NvbnRleHQpXFxuICAgIHdoaWxlIChoYXNfbmV4dCA9PT0gXFxcInRydWVcXFwiKSB7XFxuICAgICAgICBib2R5LnBhZ2VfcGFyYW1zLnBhZ2VfY29udGV4dCA9IG5leHRfcGFnZV9jb250ZXh0O1xcbiAgICAgICAgcGxheWxpc3RzX2ZldGNoRGF0YSA9IEpTT04ucGFyc2UoZmV0Y2hQQyhlalVybCwge1xcbiAgICAgICAgICAgIGhlYWRlcnM6IHtcXG4gICAgICAgICAgICAgICAgXFxcIkNvbnRlbnQtVHlwZVxcXCI6IFxcXCJhcHBsaWNhdGlvbi9qc29uXFxcIixcXG4gICAgICAgICAgICAgICAgXFxcInJlZmVyZXJcXFwiOiBcXFwiaHR0cHM6Ly92LnFxLmNvbS9cXFwiLFxcbiAgICAgICAgICAgICAgICBcXFwiQ29va2llXFxcIjogXFxcInZpZGVvX3BsYXRmb3JtPTI7dnZlcnNpb25fbmFtZT04LjIuOTVcXFwiXFxuICAgICAgICAgICAgfSxcXG4gICAgICAgICAgICBtZXRob2Q6IFxcXCJQT1NUXFxcIixcXG4gICAgICAgICAgICBib2R5OiBib2R5XFxuICAgICAgICB9KSk7XFxuICAgICAgICBuZXh0X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lID0g5pyA5aSn6aG15pWwO1xcclxcbiAgICAgICAgcHV0TXlWYXIoJ+mAiembhue/u+mhtScsICcnICsgbm93UGFnZSk7XFxyXFxuICAgIH1cXHJcXG4gICAgLy9sb2coXFxcIuW9k+WJjemhteaVsDpcXFwiK2dldE15VmFyKCfpgInpm4bnv7vpobUnLCAnMScpKVxcclxcbiAgICBsZXQgc2hvd0xpc3QsIHNob3dMaXN0X2NudDtcXHJcXG4gICAgaWYgKGxpc3RfY250ID4g57+76aG16ZiA5YC8ICYmIGdldE15VmFyKCfpgInpm4bmmL7npLonLCAn5YiG6aG1JykgPT09ICfliIbpobUnKSB7XFxyXFxuICAgICAgICBsZXQgbWF4TnVtID0g5q+P6aG15pWw6YePICogbm93UGFnZTsgLy/nrKzkuIDpobXnmoTor50s5pyA5aSn5pi+56S6NDAqMembhiznrKwy6aG1NDEtODDpm4YgICAgICAgXFxyXFxuICAgICAgICBzaG93TGlzdCA9IHRhYl9MaXN0cy5zbGljZSgoKG5vd1BhZ2UgLSAxKSAqIOavj+mhteaVsOmHjyksIG1heE51bSk7XFxyXFxuICAgICAgICBzaG93TGlzdF9jbnQgPSBzaG93TGlzdC5sZW5ndGhcXHJcXG4gICAgfSBlbHNlIHtcXHJcXG4gICAgICAgIHNob3dMaXN0X2NudCA9IHRhYl9MaXN0cy5sZW5ndGg7XFxyXFxuICAgIH1cXHJcXG5cXHJcXG4gICAgLy9sb2coXFxcInNob3dMaXN0X2NudDpcXFwiK3Nob3dMaXN0X2NudClcXHJcXG4gICAgcHV0TXlWYXIoXFxcInNob3dMaXN0X2NudFxcXCIsIHNob3dMaXN0X2NudCk7XFxyXFxuICAgIHB1dE15VmFyKFxcXCJsaXN0X2NudFxcXCIsIGxpc3RfY250KTtcXHJcXG4gICAgLy/nur/ot69cXHJcXG4gICAgdmFyIGZ1bmNUYWIgPSBmdW5jdGlvbih0YWJzLCB0YWJfdHlwZSkge1xcclxcbiAgICAgICAgLy90YWJz5Li657q/6Lev5pWw57u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gICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKHRhYnNbaV0pLFxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJ0YWJudW1cXFwiLCBpKTtcXHJcXG5cXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhcXFwi54K55Ye7OlxcXCIrZ2V0TXlWYXIoXFxcInRhYm51bVxcXCIpKTsgICAgXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGV0IGQgPSBbXVxcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGZ1bmNMb2FkcGFnZShkKVxcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5oiQ5YqfISdcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxyXFxuICAgICAgICAgICAgICAgIH0sIHRhYnMsIGdldEhlYWQsIGksIGZ1bmNMb2FkcGFnZSksXFxyXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiB0YWJfdHlwZSxcXHJcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIGlkOiBcXFwidGFiaWRcXFwiICsgaVxcclxcbiAgICAgICAgICAgICAgICB9LFxcclxcbiAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgfSk7XFxyXFxuICAgICAgICBkLnB1c2goe1xcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxyXFxuICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgaWQ6ICd0YWJfU2VwcycgLy8g57uZ57+76aG157uE5Lu25YGaaWTnlKhcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICA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2UpID0+IHtcXHJcXG4gICAgICAgICAgICAgICAgbGV0IG5leHRNb2RlID0gZ2V0TXlWYXIoJ+mAiembhuaYvuekuicsICfliIbpobUnKSA9PT0gJ+WIhumhtScgPyAn5YWo6YOoJyA6ICfliIbpobUnO1xcclxcbiAgICAgICAgICAgICAgICBsZXQgcGFnZVRpdGxlLCBwYWdlUGljO1xcclxcbiAgICAgICAgICAgICAgICBpZiAobmV4dE1vZGUgPT09ICfliIbpobUnKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBwYWdlVGl0bGUgPSBzaG93VGl0bGU7XFxyXFxuICAgICAgICAgICAgICAgICAgICBwYWdlUGljID0gc2hvd1BpYztcXHJcXG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VUaXRsZSA9IHNodXRUaXRsZTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHBhZ2VQaWMgPSBzaHV0UGljO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oJ3BhZ2VTdGF0ZScsIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBwYWdlVGl0bGUsXFxyXFxuICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiBwYWdlUGljXFxyXFxuICAgICAgICAgICAgICAgIH0pO1xcclxcbiAgICAgICAgICAgICAgICBwdXRNeVZhcign6YCJ6ZuG5pi+56S6JywgbmV4dE1vZGUpO1xcclxcbiAgICAgICAgICAgICAgICBsZXQgZCA9IFtdO1xcclxcbiAgICAgICAgICAgICAgICBmdW5jTG9hZHBhZ2UoZCk7XFxyXFxuICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXHJcXG4gICAgICAgICAgICB9LCBzaG93VGl0bGUsIHNob3dQaWMsIHNodXRUaXRsZSwgc2h1dFBpYywgZnVuY0xvYWRwYWdlKSxcXHJcXG4gICAgICAgICA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XCIg6ZuGXFxcIiwgXFxcIiMwOThBQzFcXFwiKTtcXHJcXG4gICAgICAgIGxldCB0aXRsZTIgPSB0aXRsZS5yZXBsYWNlKCckbm93X3RhYicsIHRhYnNbZ2V0TXlWYXIoXFxcInRhYm51bVxcXCIsIFxcXCIwXFxcIildKTtcXHJcXG4gICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICBkLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiB0aXRsZTIucmVwbGFjZSgv4oCc4oCc4oCd4oCdL2csIFxcXCJcXFwiKSwgICAgIFxcbiAgICAgICAgICAgIHBpY191cmw6IGdldE15VmFyKFxcXCLpobrluo9cXFwiLCBcXFwi5q2j5bqPXFxcIikgPT09IFxcXCLpgIbluo9cXFwiID8gdXBfaWNvbiA6IGRvd25faWNvbiwgICAgIFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBvcmRlcl90eXBlLFxcclxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgodXBfaWNvbiwgZG93bl9pY29uLCBmdW5jTG9hZHBhZ2UpID0+IHtcXHJcXG5cXHJcXG4gICAgICAgICAgICAgICAgaWYgKGdldE15VmFyKCfpobrluo8nLCAn5q2j5bqPJykgPT09ICfpgIbluo8nKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcign6aG65bqPJywgJ+ato+W6jycpO1xcclxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+mhuuW6jycsICfpgIbluo8nKTtcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICBsZXQgb3JkZXJOb3cgPSBnZXRNeVZhcign6aG65bqPJywgJ+ato+W6jycpOyAgICAgICAgICAgICAgICBcXHJcXG4gICAgICAgICAgICAgICAgdXBkYXRlSXRlbSgnb3JkZXJpZCcsIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHBpY191cmw6IG9yZGVyTm93ID09PSBcXFwi6YCG5bqPXFxcIiA/IHVwX2ljb24gOiBkb3duX2ljb25cXHJcXG4gICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgIC8vbG9nKFxcXCLngrnlh7vpobrluo9cXFwiK29yZGVyTm93KVxcclxcbiAgICAgICAgICAgICAgICBpZiAoZ2V0TXlWYXIoXFxcImxpc3RfY250XFxcIikgPiAxKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgZCA9IFtdXFxyXFxuICAgICAgICAgICAgICAgICAgICBmdW5jTG9hZHBhZ2UoZClcXHJcXG4gICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5bey5YiH5o2i6aG65bqP5Li6OicgKyBvcmRlck5vd1xcclxcbiAgICAgICAgICAgICAgICAvL3JldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxyXFxuICAgICAgICAgICAgfSwgdXBfaWNvbiwgZG93bl9pY29uLCBmdW5jTG9hZHBhZ2UpLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGlkOiBcXFwib3JkZXJpZFxcXCIsXFxyXFxuICAgICAgICAgICAgICAgIGNsczogJ29yZGVyX2NscycsXFxyXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcclxcbiAgICAgICAgICAgIH0sXFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIGQucHVzaCh7XFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJibGFua19ibG9ja1xcXCIsXFxyXFxuICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgaWQ6ICdvcmRlcl9TcGVzJywgLy8g57uZ57uE5Lu25YGaaWTnlKhcXHJcXG4gICAgICAgICAgICAgICAgY2xzOiAnb3JkZXJfY2xzJ1xcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICAgICAgcmV0dXJuIGRcXHJcXG4gICAgfTtcXHJcXG4gICAgLy9sb2coXFxcIuW9k+WJjemhuuW6j+S4ujouIFxcXCIrZ2V0TXlWYXIoJ+mhuuW6jycsICfmraPluo8nKSlcXHJcXG4gICAgbGV0IOWIhumhteaVsOe7hCA9IFtdO1xcclxcbiAgICBmb3IgKHZhciBpID0gMTsgaSA8PSDmnIDlpKfpobXmlbA7IGkrKykge1xcclxcbiAgICAgICAgdmFyIHRvdGFsMSA9IHBhcnNlSW50KChpIC0gMSkgKiDmr4/pobXmlbDph48pO1xcclxcbiAgICAgICAgdmFyIHRvdGFsMiA9IHBhcnNlSW50KGkgKiDmr4/pobXmlbDph48pO1xcclxcbiAgICAgICAgLy9sb2coXFxcIuWIhumhteaVsOe7hOeUn+aIkOmhteeggTogXFxcIitnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSk7XFxyXFxuICAgICAgICBpZiAoaSA9PSBnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSkge1xcclxcbiAgICAgICAgICAgIHRvdGFsMSA9ICfwn5S7JyArIHRvdGFsMVxcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgLy9sb2codG90YWwxKVxcclxcbiAgICAgICAgaWYgKGkgPT0gcGFyc2VJbnQo5pyA5aSn6aG15pWwKSkge1xcclxcbiAgICAgICAgICAgIHRvdGFsMiA9IGxpc3RfY250O1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAg5YiG6aG15pWw57uELnB1c2godG90YWwxICsgJy0nICsgdG90YWwyKVxcclxcbiAgICB9O1xcclxcbiAgICAvL2xvZyjliIbpobXmlbDnu4QpXFxyXFxuICAgIHZhciDpobbpg6jmjInpkq4gPSBmdW5jdGlvbigpIHtcXHJcXG4gICAgICAgIGxldCB0b3BCID0gW107XFxyXFxuICAgICAgICBsZXQg5pyA5aSn6aG15pWwID0gZ2V0TXlWYXIoXFxcIuacgOWkp+mhteaVsFxcXCIpO1xcclxcbiAgICAgICAgbGV0IOavj+mhteaVsOmHjyA9IGdldE15VmFyKFxcXCLmr4/pobXmlbDph49cXFwiKTtcXHJcXG4gICAgICAgIC8vbG9nKFxcXCLmnIDlpKfpobXmlbA6IFxcXCIgKyDmnIDlpKfpobXmlbApXFxyXFxuICAgICAgICAvL2xvZyhcXFwi5b2T5YmN6aG15pWwOlxcXCIgKyBnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSlcXHJcXG5cXHJcXG4gICAgICAgIHRvcEIucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6ICfwn5ORJyxcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcclxcbiAgICAgICAgICAgIHVybDogJ2hpa2VyOi8vZW1wdHknLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGlkOiAn5Y2g5L2N56ymJyxcXHJcXG4gICAgICAgICAgICAgICAgY2xzOiAndG9wUGFnZSdcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIOWIhumhteaVsOe7hC5mb3JFYWNoKChpdGVtLCBpKSA9PiB7XFxyXFxuICAgICAgICAgICAgaWYgKC/wn5S7Ly50ZXN0KGl0ZW0pKSB7XFxyXFxuICAgICAgICAgICAgICAgIGl0ZW0gPSBpdGVtLnJlcGxhY2UoJ/CflLsnLCAnJyk7XFxyXFxuICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgIHRvcEIucHVzaCh7XFxyXFxuICAgICAgICAgICAgICAgIHRpdGxlOiAocGFyc2VJbnQoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpIC0gMSkgPT0gaSA/IGdldEhlYWQoaXRlbSkgOiBpdGVtLFxcclxcbiAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjI25vSGlzdG9yeSNcXFwiKS5sYXp5UnVsZSgoZ2V0SGVhZCwgZ2V0YnRuc0NvbG9yLCDliIbpobXmlbDnu4QsIGksIGZ1bmNMb2FkcGFnZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAgICAgaWYgKChwYXJzZUludChnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSkgLSAxKSAhPSBpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwidG9wQlxcXCIgKyAocGFyc2VJbnQoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpIC0gMSksIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IOWIhumhteaVsOe7hFsocGFyc2VJbnQoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpIC0gMSldLnJlcGxhY2UoJ/CflLsnLCAnJyksXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwidG9wQlxcXCIgKyBpLCB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRIZWFkKOWIhumhteaVsOe7hFtpXSkucmVwbGFjZSgn8J+UuycsICcnKSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwi6YCJ6ZuG57+76aG1XFxcIiwgKGkgKyAxKSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlSXRlbShcXFwi5bqV5YiG6aG1MVxcXCIsIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGdldGJ0bnNDb2xvcihnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSArICcgLyAnICsgZ2V0TXlWYXIoXFxcIuacgOWkp+mhteaVsFxcXCIpKSxcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICAvL2xvZyhcXFwi54K55Ye76YCJ6ZuG57+76aG15pWwOiBcXFwiICsgZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgLy9sb2codHlwZW9mKGZ1bmNMb2FkcGFnZSkpXFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlSXRlbUJ5Q2xzKCdwbGF5TGlzdCcpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgZnVuY0xvYWRwYWdlKGQpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgfVxcclxcbiAgICAgICAgICAgICAgICAgICAgLy9yZXR1cm4gJ3RvYXN0Oi8v5YiH5o2i5oiQ5YqfISdcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxyXFxuICAgICAgICAgICAgICAgIH0sIGdldEhlYWQsIGdldGJ0bnNDb2xvciwg5YiG6aG15pWw57uELCBpLCBmdW5jTG9hZHBhZ2UpLFxcclxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcclxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICAgICAgaWQ6ICd0b3BCJyArIGksXFxyXFxuICAgICAgICAgICAgICAgICAgICBjbHM6ICd0b3BQYWdlJ1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICB9KVxcclxcbiAgICAgICAgdG9wQi5wdXNoKHtcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcImxpbmVcXFwiLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGlkOiAndG9wX1NwZXMnLCAvLyDnu5nnv7vpobXnu4Tku7blgZppZOeUqFxcclxcbiAgICAgICAgICAgICAgICBjbHM6ICd0b3BQYWdlJ1xcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICAgICAgcmV0dXJuIHRvcEJcXHJcXG4gICAgfTtcXHJcXG5cXHJcXG4gICAgdmFyIOW6lemDqOaMiemSriA9IGZ1bmN0aW9uKCkge1xcclxcbiAgICAgICAgbGV0IGJ0bnMgPSBbXTtcXHJcXG4gICAgICAgIGxldCDmnIDlpKfpobXmlbAgPSBnZXRNeVZhcihcXFwi5pyA5aSn6aG15pWwXFxcIik7XFxyXFxuICAgICAgICBsZXQg5q+P6aG15pWw6YePID0gZ2V0TXlWYXIoXFxcIuavj+mhteaVsOmHj1xcXCIpO1xcclxcbiAgICAgICAgbGV0IGxpc3RfY250ID0gZ2V0TXlWYXIoXFxcImxpc3RfY250XFxcIik7XFxyXFxuICAgICAgICBidG5zLnB1c2goe1xcclxcbiAgICAgICAgICAgIHRpdGxlOiBnZXRidG5zQ29sb3IoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykgKyAnIC8gJyArIOacgOWkp+mhteaVsCksXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0X2NlbnRlcl8xXFxcIixcXHJcXG4gICAgICAgICAgICB1cmw6ICQo5YiG6aG15pWw57uELCAzLCAn5YiG6aG16IyD5Zu06YCJ5oupJykuc2VsZWN0KChnZXRIZWFkLCBnZXRidG5zQ29sb3IsIOWIhumhteaVsOe7hCwg5pyA5aSn6aG15pWwLCDmr4/pobXmlbDph48sIGZ1bmNMb2FkcGFnZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICAvL2xvZyhcXFwiaW5wdXQ6XFxcIiArIGlucHV0KVxcclxcbiAgICAgICAgICAgICAgICBsZXQgdG8yID0gaW5wdXQuc3BsaXQoJy0nKVsxXTtcXHJcXG4gICAgICAgICAgICAgICAgbGV0IHBhZ2VOdW0gPSBNYXRoLmNlaWwocGFyc2VJbnQodG8yKSAvIOavj+mhteaVsOmHjyk7XFxyXFxuICAgICAgICAgICAgICAgIGlmIChnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSAhPSBwYWdlTnVtKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAvL2xvZyhcXFwi6IyD5Zu06YCJ5oup57+76aG15pWwOlxcXCIgKyBnZXRNeVZhcihcXFwi6YCJ6ZuG57+76aG1XFxcIiwgXFxcIjFcXFwiKSlcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCLpgInpm4bnv7vpobVcXFwiLCBwYWdlTnVtKTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcInRvcEJcXFwiICsgKHBhcnNlSW50KGdldE15VmFyKCfpgInpm4bnv7vpobUnLCAnMScpKSAtIDEpLCB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IOWIhumhteaVsOe7hFsocGFyc2VJbnQoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpIC0gMSldLnJlcGxhY2UoJ/CflLsnLCAnJyksXFxyXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcInRvcEJcXFwiICsgcGFyc2VJbnQocGFnZU51bSksIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogZ2V0SGVhZCjliIbpobXmlbDnu4RbcGFnZU51bV0pLnJlcGxhY2UoJ/CflLsnLCAnJyksXFxyXFxuICAgICAgICAgICAgICAgICAgICB9KTtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZUl0ZW0oXFxcIuW6leWIhumhtTFcXFwiLCB7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGdldGJ0bnNDb2xvcihwYWdlTnVtICsgJyAvICcgKyDmnIDlpKfpobXmlbApLFxcclxcbiAgICAgICAgICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgZCA9IFtdO1xcclxcbiAgICAgICAgICAgICAgICAgICAgZnVuY0xvYWRwYWdlKGQpXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgIH0sIGdldEhlYWQsIGdldGJ0bnNDb2xvciwg5YiG6aG15pWw57uELCDmnIDlpKfpobXmlbAsIOavj+mhteaVsOmHjywgZnVuY0xvYWRwYWdlKSxcXHJcXG4gICAgICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgICAgICBpZDogJ+W6leWIhumhtTEnLFxcclxcbiAgICAgICAgICAgICAgICBjbHM6ICdmb290UGFnZScsXFxyXFxuICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICAgICAgYnRucy5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogJ+KciO+4j+i3s+mbhicsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzVcXFwiLFxcclxcbiAgICAgICAgICAgIHVybDogJChsaXN0X2NudCwgJ+ivt+i+k+WFpeimgei3s+i9rOWIsOeahOmbhuaVsCcpLmlucHV0KChtYXgsIOavj+mhteaVsOmHjywgZnVuY0xvYWRwYWdlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGlmIChpc05hTihwYXJzZUludChpbnB1dCkpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6L6T5YWl5pyJ6K+vLOivt+i+k+WFpeS4gOS4qjF+JyArIG1heCArICfnmoTmlbDlrZcnXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgbGV0IHRvTnVtID0gcGFyc2VJbnQoaW5wdXQpO1xcclxcbiAgICAgICAgICAgICAgICBpZiAodG9OdW0gPCAxIHx8IHRvTnVtID4gbWF4KSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6L6T5YWl5pyJ6K+vLOivt+i+k+WFpeS4gOS4qjF+JyArIG1heCArICfnmoTmlbDlrZcnXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgbGV0IG5vd1BhZ2UgPSBwYXJzZUludChnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSkgfHwgMTsgLy/lvZPliY3pobXmlbBcXHJcXG4gICAgICAgICAgICAgICAgbGV0IHRvUGFnZSA9IE1hdGguY2VpbCh0b051bSAvIOavj+mhteaVsOmHjyk7XFxyXFxuICAgICAgICAgICAgICAgIGlmIChub3dQYWdlID09IHRvUGFnZSkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+acrOmhteWwseaYr+WIl+ihqOWFg+e0oOaJgOWcqOmhtSEnO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfpgInpm4bnv7vpobUnLCAnJyArIHRvUGFnZSk7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgIGZ1bmNMb2FkcGFnZShkKTtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3sui3s+WIsOWIl+ihqOWFg+e0oOesrCcgKyB0b051bSArICfkuKrmiYDlnKjpobXnoIE6JyArIHRvUGFnZVxcclxcbiAgICAgICAgICAgIH0sIGxpc3RfY250LCDmr4/pobXmlbDph48sIGZ1bmNMb2FkcGFnZSksXFxyXFxuICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgY2xzOiAnZm9vdFBhZ2UnLFxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICAgICAgYnRucy5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogJ/CflJ3ot7PpobUnLFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF81XFxcIixcXHJcXG4gICAgICAgICAgICB1cmw6ICQoMSwgJ+ivt+i+k+WFpeimgei3s+i9rOWIsOeahOmhteaVsCcpLmlucHV0KCjmnIDlpKfpobXmlbAsIOavj+mhteaVsOmHjywgZnVuY0xvYWRwYWdlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGlmIChpc05hTihwYXJzZUludChpbnB1dCkpKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6L6T5YWl5pyJ6K+vLOivt+i+k+WFpeS4gOS4qjF+JyArIOacgOWkp+mhteaVsCArICfnmoTmlbDlrZcnXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgbGV0IHRvUGFnZSA9IHBhcnNlSW50KGlucHV0KTtcXHJcXG4gICAgICAgICAgICAgICAgaWYgKHRvUGFnZSA8IDEgfHwgdG9QYWdlID4g5pyA5aSn6aG15pWwKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v6L6T5YWl5pyJ6K+vLOivt+i+k+WFpeS4gOS4qjF+JyArIOacgOWkp+mhteaVsCArICfnmoTmlbDlrZcnXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICAgICAgbGV0IG5vd1BhZ2UgPSBwYXJzZUludChnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSkgfHwgMTsgLy/lvZPliY3pobXmlbBcXHJcXG4gICAgICAgICAgICAgICAgaWYgKG5vd1BhZ2UgPT0gdG9QYWdlKSB7XFxyXFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ3RvYXN0Oi8v5pys6aG15bCx5piv56ysJyArIHRvUGFnZSArICfpobUnO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfpgInpm4bnv7vpobUnLCAnJyArIHRvUGFnZSk7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgIGZ1bmNMb2FkcGFnZShkKTtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3sui3s+WIsOesrCcgKyB0b1BhZ2UgKyAn6aG1J1xcclxcbiAgICAgICAgICAgIH0sIOacgOWkp+mhteaVsCwg5q+P6aG15pWw6YePLCBmdW5jTG9hZHBhZ2UpLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGNsczogJ2Zvb3RQYWdlJyxcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIGJ0bnMucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6ICfij67vuI/kuIrpobUnLFxcclxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF81XFxcIixcXHJcXG4gICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKOavj+mhteaVsOmHjywgZnVuY0xvYWRwYWdlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBub3dQYWdlID0gcGFyc2VJbnQoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpIHx8IDE7XFxyXFxuICAgICAgICAgICAgICAgIGxldCB0b1BhZ2UgPSBub3dQYWdlIC0gMTtcXHJcXG4gICAgICAgICAgICAgICAgaWYgKHRvUGFnZSA+IDApIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCfpgInpm4bnv7vpobUnLCAnJyArIHRvUGFnZSk7XFxyXFxuICAgICAgICAgICAgICAgICAgICBsZXQgZCA9IFtdO1xcclxcbiAgICAgICAgICAgICAgICAgICAgZnVuY0xvYWRwYWdlKGQpO1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3sue7j+ayoeacieS4iuS4gOmhteS6hiEnXFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICB9LCDmr4/pobXmlbDph48sIGZ1bmNMb2FkcGFnZSksXFxyXFxuICAgICAgICAgICAgZXh0cmE6IHtcXHJcXG4gICAgICAgICAgICAgICAgY2xzOiAnZm9vdFBhZ2UnLFxcclxcbiAgICAgICAgICAgIH1cXHJcXG4gICAgICAgIH0pO1xcclxcbiAgICAgICAgYnRucy5wdXNoKHtcXHJcXG4gICAgICAgICAgICB0aXRsZTogJ+KPre+4j+S4i+mhtScsXFxyXFxuICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzVcXFwiLFxcclxcbiAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgo5pyA5aSn6aG15pWwLCDmr4/pobXmlbDph48sIGZ1bmNMb2FkcGFnZSkgPT4ge1xcclxcbiAgICAgICAgICAgICAgICBsZXQgbm93UGFnZSA9IHBhcnNlSW50KGdldE15VmFyKCfpgInpm4bnv7vpobUnLCAnMScpKSB8fCAxO1xcclxcbiAgICAgICAgICAgICAgICBsZXQgdG9QYWdlID0gbm93UGFnZSArIDE7XFxyXFxuICAgICAgICAgICAgICAgIGlmICh0b1BhZ2UgPiDmnIDlpKfpobXmlbApIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAndG9hc3Q6Ly/lt7Lnu4/msqHmnInkuIvkuIDpobXkuoYhJ1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfpgInpm4bnv7vpobUnLCAnJyArIHRvUGFnZSk7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgIGZ1bmNMb2FkcGFnZShkKTtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcclxcbiAgICAgICAgICAgIH0sIOacgOWkp+mhteaVsCwg5q+P6aG15pWw6YePLCBmdW5jTG9hZHBhZ2UpLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGNsczogJ2Zvb3RQYWdlJyxcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIGJ0bnMucHVzaCh7XFxyXFxuICAgICAgICAgICAgdGl0bGU6ICfwn5Sa5bC+6aG1JyxcXHJcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfNVxcXCIsXFxyXFxuICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKCjmnIDlpKfpobXmlbAsIOavj+mhteaVsOmHjywgZnVuY0xvYWRwYWdlKSA9PiB7XFxyXFxuICAgICAgICAgICAgICAgIGxldCB0b1BhZ2UgPSDmnIDlpKfpobXmlbA7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBub3dQYWdlID0gcGFyc2VJbnQoZ2V0TXlWYXIoJ+mAiembhue/u+mhtScsICcxJykpIHx8IDE7IC8v5b2T5YmN6aG15pWwXFxyXFxuICAgICAgICAgICAgICAgIGlmIChub3dQYWdlID09IHRvUGFnZSkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3sue7j+aYr+acgOWQjuS4gOmhteWVpiEnO1xcclxcbiAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfpgInpm4bnv7vpobUnLCAnJyArIHRvUGFnZSk7XFxyXFxuICAgICAgICAgICAgICAgIGxldCBkID0gW107XFxyXFxuICAgICAgICAgICAgICAgIGZ1bmNMb2FkcGFnZShkKTtcXHJcXG4gICAgICAgICAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3sui3s+i9rOWIsOesrCcgKyDmnIDlpKfpobXmlbAgKyAn6aG1J1xcclxcbiAgICAgICAgICAgIH0sIOacgOWkp+mhteaVsCwg5q+P6aG15pWw6YePLCBmdW5jTG9hZHBhZ2UpLFxcclxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxyXFxuICAgICAgICAgICAgICAgIGNsczogJ2Zvb3RQYWdlJyxcXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9KTtcXHJcXG4gICAgICAgIHJldHVybiBidG5zXFxyXFxuICAgIH1cXHJcXG4gICAgbGV0IHNlcHMgPSBbXTtcXHJcXG4gICAgc2Vwcy5wdXNoKHtcXHJcXG4gICAgICAgIGNvbF90eXBlOiBcXFwibGluZVxcXCIsXFxyXFxuICAgICAgICBleHRyYToge1xcclxcbiAgICAgICAgICAgIGlkOiAnbGluZV9TcGVzJywgLy8g57uZ57+76aG157uE5Lu25YGaaWTnlKhcXHJcXG4gICAgICAgICAgICBjbHM6ICdwbGF5TGlzdCdcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgfSlcXHJcXG4gICAgLy/nur/ot69cXHJcXG4gICAgQXJyYXkucHJvdG90eXBlLnB1c2guYXBwbHkoZCwgZnVuY1RhYih0YWIsIFxcXCJmbGV4X2J1dHRvblxcXCIpKTtcXHJcXG4gICAgbGV0IG9yZGVyX2J0bnMgPSBmdW5jT3JkZXIodGFiKTtcXHJcXG4gICAgaWYgKGxpc3RfY250ID4gb2JqLnNpemUgJiYgZ2V0TXlWYXIoJ+mAiembhuaYvuekuicsICfliIbpobUnKSA9PSAn5YiG6aG1Jykge1xcclxcbiAgICAgICAgaWYgKGd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cbiAgICAgICAgaWYgKENoaW5lc2VNYXBbY2hpbmVzZV9udW1iZXJbMF1dID09PSAxMCkge1xcclxcbiAgICAgICAgICAgIGNoaW5lc2VfbnVtYmVyID0gXFxcIuS4gFxcXCIgKyBjaGluZXNlX251bWJlcjtcXHJcXG4gICAgICAgICAgICBsZW4rKztcXHJcXG4gICAgICAgIH1cXHJcXG4gICAgICAgIGlmIChsZW4gPj0gMyAmJiBDaGluZXNlTWFwW2NoaW5lc2VfbnVtYmVyW2xlbiAtIDFdXSA8IDEwKSB7XFxyXFxuICAgICAgICAgICAgbGV0IGxhc3Rfc2Vjb25kX251bSA9IENoaW5lc2VNYXBbY2hpbmVzZV9udW1iZXJbbGVuIC0gMl1dO1xcclxcbiAgICAgICAgICAgIGlmIChsYXN0X3NlY29uZF9udW0gPT09IDEwMCB8fCBsYXN0X3NlY29uZF9udW0gPT09IDEwMDAgfHwgbGFzdF9zZWNvbmRfbnVtID09PSAxMDAwMCB8fCBsYXN0X3NlY29uZF9udW0gPT09IDEwMDAwMDAwMCkge1xcclxcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBrZXkgaW4gQ2hpbmVzZU1hcCkge1xcclxcbiAgICAgICAgICAgICAgICAgICAgaWYgKENoaW5lc2VNYXBba2V5XSA9PT0gbGFzdF9zZWNvbmRfbnVtIC8gMTApIHtcXHJcXG4gICAgICAgICAgICAgICAgICAgICAgICBjaGluZXNlX251bWJlciArPSBrZXk7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgbGVuICs9IGtleS5sZW5ndGg7XFxyXFxuICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XFxyXFxuICAgICAgICAgICAgICAgICAgICB9XFxyXFxuICAgICAgICAgICAgICAgIH1cXHJcXG4gICAgICAgICAgICB9XFxyXFxuICAgICAgICB9XFxyXFxuICAgICAgICBpZiAoY2hpbmVzZV9udW1iZXIubWF0Y2goL+S6vy9nKSAmJiBjaGluZXNlX251bWJlci5tYXRjaCgv5Lq/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xcclxcbiAgICAgICAgbGV0IGZvb3RfSXRlbSA9IHtcXHJcXG4gICAgICAgICAgICB1cmw6IE1ZX1VSTCxcXHJcXG4gICAgICAgICAgICBwYWdlOiBwYXJzZUludChnZXRNeVZhcign6YCJ6ZuG57+76aG1JywgJzEnKSksXFxyXFxuICAgICAgICAgICAgc2l6ZTogc2l6ZVxcclxcbiAgICAgICAgfTtcXHJcXG4gICAgICAgIGlmIChNWV9QQVJBTVMudGl0bGUpIHtcXHJcXG4gICAgICAgICAgICBPYmplY3QuYXNzaWduKGZvb3RfSXRlbSwge1xcclxcbiAgICAgICAgICAgICAgICB0aXRsZTogTVlfUEFSQU1TLnRpdGxlXFxyXFxuICAgICAgICAgICAgfSk7XFxyXFxuICAgICAgICB9XFxyXFxuICAgICAgICBpZiAoZm9vdElkZXggPiAtMSkge1xcclxcbiAgICAgICAgICAgIGZvb3RIaXN0b3J5W2Zvb3RJZGV4XSA9IGZvb3RfSXRlbTtcXHJcXG4gICAgICAgIH0gZWxzZSB7XFxyXFxuICAgICAgICAgICAgZm9vdEhpc3RvcnkucHVzaChmb290X0l0ZW0pO1xcclxcbiAgICAgICAgfVxcclxcbiAgICAgICAgc2F2ZUZpbGUoJ2Zvb3RIaXN0b3J5Lmpzb24nLCBKU09OLnN0cmluZ2lmeShmb290SGlzdG9yeSksIDApO1xcclxcbiAgICAgICAgLy9sb2coJ+W3suWCqOWtmOi2s+i/uTonICsgSlNPTi5zdHJpbmdpZnkoZm9vdF9JdGVtKSk7XFxyXFxuICAgIH07XFxyXFxuXFxyXFxuICAgIGZ1bmN0aW9uIOWKoOi9vei2s+i/uShNWV9VUkwsIHNpemUpIHtcXHJcXG4gICAgICAgIC8vbG9nKFxcXCLmraPlnKjliqDovb3otrPov7lcXFwiKTtcXHJcXG4gICAgICAgIHNpemUgPSBzaXplIHx8IHBhcnNlSW50KGdldEl0ZW0oJ+avj+mhteaVsOmHjycsICczMCcpKTsgLy/mr4/pobXmlbDph49cXHJcXG4gICAg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ZcXFwiLCBcXFwic3RhcnRcXFwiKTtcXHJcXG4gICAgYWRkTGlzdGVuZXIoJ29uQ2xvc2UnLCAkLnRvU3RyaW5nKCjlgqjlrZjotrPov7ksIE1ZX1VSTCwg5q+P6aG15pWw6YePLCBNWV9QQVJBTVMpID0+IHtcXHJcXG4gICAgICAgIOWCqOWtmOi2s+i/uShNWV9VUkwsIOavj+mhteaVsOmHjywgTVlfUEFSQU1TKTtcXHJcXG4gICAgICAgIGNsZWFyTXlWYXIoXFxcIuWIneWni+WMllxcXCIpO1xcclxcbiAgICAgICAgY2xlYXJNeVZhcihcXFwi6aG65bqPXFxcIik7XFxyXFxuICAgICAgICBjbGVhck15VmFyKFxcXCJ0YWJudW1cXFwiKTtcXHJcXG4gICAgICAgIGNsZWFyTXlWYXIoXFxcIumAiembhue/u+mhtVxcXCIpOyAgIFxcbiAgICAgICAgY2xlYXJNeVZhcihcXFwi57+76aG154q25oCBXFxcIik7XFxyXFxuICAgICAgICBkZWxldGVGaWxlKFxcXCJPYmplY3QuanNvblxcXCIpO1xcclxcbiAgICB9LCDlgqjlrZjotrPov7ksIE1ZX1VSTCwg5q+P6aG15pWw6YePLCBNWV9QQVJBTVMgfHwge30pKTtcXHJcXG4gICAgcmV0dXJuIGZ1bmNMb2FkcGFnZShkLCBvYmopXFxyXFxufVwifV0iLCJpY29uIjoiaHR0cHM6Ly9naHByb3h5LmNvbS9odHRwczovL3Jhdy5naXRodWJ1c2VyY29udGVudC5jb20vbHMxMjU3ODEwMDMvbG10dWJpYW8vbWFpbi9tb3ZpZS8xMjMuc3ZnIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment