Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@葫芦侠@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi6JGr6Iqm5L6gIiwiYXV0aG9yIjoi5pen5be36ZmM5Lq6IiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjZnlwYWdlIiwidmVyc2lvbiI6MCwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJvdGhlciIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxucmVxdWlyZSgnaGlrZXI6Ly9wYWdlL2NvbmZpZy5odG1sJylcbmdldEJhc2VQYXJzZSgpIiwic2VhcmNoX3VybCI6IiIsImdyb3VwIjoi5LuT5bqTIiwic2VhcmNoRmluZCI6IiIsImRldGFpbF9jb2xfdHlwZSI6Im1vdmllXzEiLCJkZXRhaWxfZmluZF9ydWxlIjoiIiwic2RldGFpbF9jb2xfdHlwZSI6Im1vdmllXzEiLCJzZGV0YWlsX2ZpbmRfcnVsZSI6IiIsInVhIjoibW9iaWxlIiwicHJlUnVsZSI6IiIsInBhZ2VzIjoiW3tcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLpobXpnaJcIixcInBhdGhcIjpcImNvbmZpZy5odG1sXCIsXCJydWxlXCI6XCJjb25zdCBlbXB0eSA9ICdoaWtlcjovL2VtcHR5J1xcbmNvbnN0IHBhZ2UgPSBNWV9QQUdFO1xcblxcbmNvbnN0IENvbG9yID0gKHRlc3QpID0+IHtcXG4gICAgcmV0dXJuICc8Zm9udCBjb2xvcj1cXFwiI0ZBNzI5OFxcXCI+JyArIHRlc3QgKyAn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lmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgICBuYW1lID0gdGFiLnRpdGxlXFxuICAgICAgICAgICAgaWQgPSB0YWIuY2F0ZWdvcnlJRFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBnZXRNeVZhcign5YiG57G7JywgJzAnKSA9PSBpID8gUmljaChTdHJvbmcoQ29sb3IobmFtZSkpKSA6IG5hbWUsXFxuICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoZW1wdHksIGksIGlkKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdQYWdlJylcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCfliIbnsbsnLCBpKTtcXG4gICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCfnsbtJRCcsIGlkKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKClcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eTtcXG4gICAgICAgICAgICAgICAgfSwgZW1wdHksIGksIGlkKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgY29udGxpc3RbaV0gPSBbXTtcXG4gICAgICAgIGNvbnRzID0gdGFiLnRhZ3M7XFxuICAgICAgICBjb250cy5mb3JFYWNoKGNvbnQgPT4ge1xcbiAgICAgICAgICAgIGNvbnRsaXN0W2ldLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogY29udC5uYW1lLFxcbiAgICAgICAgICAgICAgICB1cmw6IGNvbnQuSURcXG4gICAgICAgICAgICB9KTtcXG4gICAgICAgIH0pXFxuICAgIH0pXFxuICAgIGNvbnN0IGNhdGVnb3J5ID0gZ2V0TXlWYXIoJ+exu0lEJywgJycgKyB0YWJzWzBdLmNhdGVnb3J5SUQgKyAnJylcXG4gICAgY29uc3QgaW5kZXggPSBnZXRNeVZhcign5YiG57G7JywgJzAnKVxcbiAgICBpZiAoY29udGxpc3RbaW5kZXhdLmxlbmd0aCkge1xcbiAgICAgICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBjb250bGlzdFtpbmRleF0uZm9yRWFjaCgoY29udHNsaXN0LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogZ2V0TXlWYXIoaW5kZXgsICcwJykgPT0gaSA/IFJpY2goU3Ryb25nKENvbG9yKGNvbnRzbGlzdC50aXRsZSkpKSA6IGNvbnRzbGlzdC50aXRsZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoaW5kZXgsIGVtcHR5LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJNeVZhcignUGFnZScpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoaW5kZXgsIGkpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgICAgICAgICAgfSwgaW5kZXgsIGVtcHR5LCBpKSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgICAgICAgICAgfSk7XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIGlkID0gY29udGxpc3RbaW5kZXhdW2dldE15VmFyKGluZGV4LCAnMCcpXS51cmxcXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGlkID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gICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+aOkuW6jycsIGl0ZW0pO1xcbiAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eTtcXG4gICAgICAgICAgICAgICAgfSwgaXRlbSwgZW1wdHkpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH0pXFxuICAgIH1cXG4gICAgc3dpdGNoIChnZXRNeVZhcign5o6S5bqPJywg5o6S5bqPWzBdKSkge1xcbiAgICAgICAgY2FzZSDmjpLluo9bMF06XFxuICAgICAgICAgICAgc29ydFR5cGUgPSAwXFxuICAgICAgICAgICAgYnJlYWs7XFxuICAgICAgICBjYXNlIOaOkuW6j1sxXTpcXG4gICAgICAgICAgICBzb3J0VHlwZSA9IDJcXG4gICAgICAgICAgICBicmVhaztcXG4gICAgICAgIGNhc2Ug5o6S5bqPWzJdOlxcbiAgICAgICAgICAgIHNvcnRUeXBlID0gMVxcbiAgICAgICAgICAgIGJyZWFrO1xcbiAgICB9XFxufVxcblxcbmNvbnN0IGxheW91dFBhcnNlID0gKGQsIGRhdGEsIGlkLCBzb3J0VHlwZSwgY2F0ZWdvcnkpID0+IHtcXG4gICAgYWRkTGlzdGVuZXIoJ29uUmVmcmVzaCcsICgpID0+IHtcXG4gICAgICAgIGNsZWFyTXlWYXIoJ1BhZ2UnKVxcbiAgICB9KVxcbiAgICBpZiAoZGF0YS5wb3N0cy5sZW5ndGgpIHtcXG4gICAgICAgIGRhdGEucG9zdHMuZm9yRWFjaChkYXRlID0+IHtcXG4gICAgICAgICAgICB1c2VySUQgPSBkYXRlLnVzZXIudXNlcklEXFxuICAgICAgICAgICAgbmljayA9IGRhdGUudXNlci5uaWNrXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG5pY2sgKyAnXFxcXHRcXFxcdCcgKyBTbWFsbChDb2xvcihnZXRGb3JtYXQoZGF0ZS5jcmVhdGVUaW1lKSkpLFxcbiAgICAgICAgICAgICAgICBwaWNfdXJsOiBkYXRlLnVzZXIuYXZhdGFyLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoZW1wdHkpLnJ1bGUoKHVzZXJJRCwgbmljaykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgTVlfUEFHRSA9IDFcXG4gICAgICAgICAgICAgICAgICAgIHNvcnRUeXBlID0gJydcXG4gICAgICAgICAgICAgICAgICAgIGNhdGVnb3J5ID0gJydcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoJ1BhZ2UnKVxcbiAgICAgICAgICAgICAgICAgICAgc2V0UGFnZVRpdGxlKG5pY2spXFxuICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvY29uZmlnLmh0bWwnKVxcbiAgICAgICAgICAgICAgICAgICAgcGF0aCA9ICcvcG9zdC9jcmVhdGUvbGlzdC9BTkRST0lELzQuMS44J1xcbiAgICAgICAgICAgICAgICAgICAgYm9keSA9ICcmc3RhcnQ9MCZjb3VudD0yMCZ1c2VyX2lkPScgKyB1c2VySURcXG4gICAgICAgICAgICAgICAgICAgIGRhdGUgPSBnZXRDb25maWdVcmwocGF0aCwgYm9keSlcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGQgPSBbXVxcbiAgICAgICAgICAgICAgICAgICAgbGF5b3V0UGFyc2UoZCwgZGF0ZSwgdXNlcklELCBzb3J0VHlwZSwgY2F0ZWdvcnkpXFxuICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoZClcXG4gICAgICAgICAgICAgICAgfSwgdXNlcklELCBuaWNrKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBwb3N0SUQgPSBkYXRlLnBvc3RJRFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKEdyYXkoZGF0ZS50aXRsZSkpLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoZW1wdHkgKyAnZnlwYWdlJyArICcjYXV0b0NhY2hlIyNnYW1lVGhlbWUjJykucnVsZSgocG9zdElEKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvY29uZmlnLmh0bWwnKVxcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgZCA9IFtdXFxuICAgICAgICAgICAgICAgICAgICBwbGF5VXJsUGFyc2UoZCwgcG9zdElEKVxcbiAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGQpXFxuICAgICAgICAgICAgICAgIH0sIHBvc3RJRCksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJyxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB0cnkge1xcbiAgICAgICAgICAgICAgICBpbWFnZXMgPSBkYXRlLmRldGFpbC5tYXRjaCgvPGltYWdlPiguKj8pPFxcXFwvaW1hZ2U+L2cpXFxuICAgICAgICAgICAgICAgIGltYWdlcyA9IGltYWdlcy5tYXAoaXRlbSA9PiBpdGVtLm1hdGNoKC88aW1hZ2U+KC4qPyksLio/PFxcXFwvaW1hZ2U+LylbMV0pXFxuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgICAgICBpbWFnZXMgPSBkYXRlLmltYWdlc1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoaW1hZ2VzLmxlbmd0aCkge1xcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDM7IGkrKykge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKGltYWdlc1tpXSAhPSBudWxsKSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaW1hZ2VzW2ldLFxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IGltYWdlc1tpXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdjYXJkX3BpY18zJ1xcbiAgICAgICAgICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lX2JsYW5rJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICAgICAgaWYgKGdldE15VmFyKCdQYWdlJywgJycpID09ICcnKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoU3ByaW5nR3JlZW4oJ++9nu+9nu+9nuWKoOi9veabtOWkmu+9nu+9nu+9nicpKSksXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoZGF0YSwgaWQsIHNvcnRUeXBlLCBjYXRlZ29yeSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgTVlfUEFHRSA9IDFcXG4gICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vcGFnZS9jb25maWcuaHRtbCcpXFxuICAgICAgICAgICAgICAgICAgICBpZiAoc29ydFR5cGUgPT0gJycgJiYgY2F0ZWdvcnkgPT0gJycpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoID0gJy9wb3N0L2NyZWF0ZS9saXN0L0FORFJPSUQvNC4xLjgnXFxuICAgICAgICAgICAgICAgICAgICAgICAgYm9keSA9ICcmc3RhcnQ9JyArIGdldE15VmFyKCdQYWdlJywgZGF0YS5zdGFydCkgKyAnJmNvdW50PTIwJnVzZXJfaWQ9JyArIGlkXFxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0ZSA9IGdldENvbmZpZ1VybChwYXRoLCBib2R5KVxcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXRoID0gJy9wb3N0L2xpc3QvQU5EUk9JRC80LjEuOCdcXG4gICAgICAgICAgICAgICAgICAgICAgICBib2R5ID0gJyZzdGFydD0nICsgZ2V0TXlWYXIoJ1BhZ2UnLCBkYXRhLnN0YXJ0KSArICcmY291bnQ9MjAmY2F0X2lkPScgKyBjYXRlZ29yeSArICcmdGFnX2lkPScgKyBpZCArICcmc29ydF9ieT0nICsgc29ydFR5cGVcXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRlID0gZ2V0Q29uZmlnVXJsKHBhdGgsIGJvZHkpXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcignUGFnZScsIGRhdGUuc3RhcnQpXFxuICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW11cXG4gICAgICAgICAgICAgICAgICAgIGxheW91dFBhcnNlKGQsIGRhdGUsIGlkLCBzb3J0VHlwZSwgY2F0ZWdvcnkpXFxuICAgICAgICAgICAgICAgICAgICBhZGRJdGVtQmVmb3JlKCdQYWdlJyArIGlkLCBkKTtcXG4gICAgICAgICAgICAgICAgICAgIGlmICghZGF0ZS5wb3N0cy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGVJdGVtQnlDbHMoJ1BhZ2VDbHMnICsgaWQpXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHlcXG4gICAgICAgICAgICAgICAgfSwgZGF0YSwgaWQsIHNvcnRUeXBlLCBjYXRlZ29yeSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBpZDogJ1BhZ2UnICsgaWQsXFxuICAgICAgICAgICAgICAgICAgICBjbHM6ICdQYWdlQ2xzJyArIGlkLFxcbiAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7miJHmmK/mnInlupXnur/nmoTvvZ7vvZ7vvZ4nKSkpLFxcbiAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmNvbnN0IGxheW91dFNlYXJjaFBhcnNlID0gKGQsIGRhdGEpID0+IHtcXG4gICAgaWYgKGRhdGEubGVuZ3RoKSB7XFxuICAgICAgICBkYXRhLmZvckVhY2goZGF0ZSA9PiB7XFxuICAgICAgICAgICAgdXNlcklEID0gZGF0ZS51c2VyLnVzZXJJRFxcbiAgICAgICAgICAgIG5pY2sgPSBkYXRlLnVzZXIubmlja1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBuaWNrICsgJ1xcXFx0XFxcXHQnICsgU21hbGwoQ29sb3IoZ2V0Rm9ybWF0KGRhdGUuY3JlYXRlVGltZSkpKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogZGF0ZS51c2VyLmF2YXRhcixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5ydWxlKCh1c2VySUQsIG5pY2spID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIE1ZX1BBR0UgPSAxXFxuICAgICAgICAgICAgICAgICAgICBzb3J0VHlwZSA9ICcnXFxuICAgICAgICAgICAgICAgICAgICBjYXRlZ29yeSA9ICcnXFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdQYWdlJylcXG4gICAgICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShuaWNrKVxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL2NvbmZpZy5odG1sJylcXG4gICAgICAgICAgICAgICAgICAgIHBhdGggPSAnL3Bvc3QvY3JlYXRlL2xpc3QvQU5EUk9JRC80LjEuOCdcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSAnJnN0YXJ0PTAmY291bnQ9MjAmdXNlcl9pZD0nICsgdXNlcklEXFxuICAgICAgICAgICAgICAgICAgICBkYXRlID0gZ2V0Q29uZmlnVXJsKHBhdGgsIGJvZHkpXFxuICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW11cXG4gICAgICAgICAgICAgICAgICAgIGxheW91dFBhcnNlKGQsIGRhdGUsIHVzZXJJRCwgc29ydFR5cGUsIGNhdGVnb3J5KVxcbiAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGQpXFxuICAgICAgICAgICAgICAgIH0sIHVzZXJJRCwgbmljayksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYXZhdGFyJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgcG9zdElEID0gZGF0ZS5wb3N0SURcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogUmljaChHcmF5KGRhdGUudGl0bGUpKSxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5ICsgJ2Z5cGFnZScgKyAnI2F1dG9DYWNoZSMjZ2FtZVRoZW1lIycpLnJ1bGUoKHBvc3RJRCkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL2NvbmZpZy5odG1sJylcXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGQgPSBbXVxcbiAgICAgICAgICAgICAgICAgICAgcGxheVVybFBhcnNlKGQsIHBvc3RJRClcXG4gICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChkKVxcbiAgICAgICAgICAgICAgICB9LCBwb3N0SUQpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfMScsXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICAgICAgaW1hZ2VzID0gZGF0ZS5kZXRhaWwubWF0Y2goLzxpbWFnZT4oLio/KTxcXFxcL2ltYWdlPi9nKVxcbiAgICAgICAgICAgICAgICBpbWFnZXMgPSBpbWFnZXMubWFwKGl0ZW0gPT4gaXRlbS5tYXRjaCgvPGltYWdlPiguKj8pLC4qPzxcXFxcL2ltYWdlPi8pWzFdKVxcbiAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcXG4gICAgICAgICAgICAgICAgaW1hZ2VzID0gZGF0ZS5pbWFnZXNcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGltYWdlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCAzOyBpKyspIHtcXG4gICAgICAgICAgICAgICAgICAgIGlmIChpbWFnZXNbaV0gIT0gbnVsbCkge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGltYWdlc1tpXSxcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBpbWFnZXNbaV0sXFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnY2FyZF9waWNfMydcXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnbGluZV9ibGFuaydcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfSlcXG4gICAgfSBlbHNlIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IFJpY2goU21hbGwoR3JheSgn772e772e772e5oiR5piv5pyJ5bqV57q/55qE772e772e772eJykpKSxcXG4gICAgICAgICAgICB1cmw6IGVtcHR5LFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF9jZW50ZXJfMScsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfVxcbn1cXG5cXG5jb25zdCBwbGF5VXJsUGFyc2UgPSAoZCwgcG9zdElEKSA9PiB7XFxuICAgIHNldFBhZ2VUaXRsZSgn6K+m5oOF6aG16Z2iJylcXG4gICAgcGF0aCA9ICcvcG9zdC9kZXRhaWwvQU5EUk9JRC80LjEuOCdcXG4gICAgYm9keSA9ICcmcG9zdF9pZD0nICsgcG9zdElEICsgJyZwYWdlX25vPScgKyBwYWdlICsgJyZwYWdlX3NpemU9MjAmZG9jPTEnXFxuICAgIGRhdGEgPSBnZXRDb25maWdVcmwocGF0aCwgYm9keSlcXG4gICAgaWYgKHBhZ2UgPT0gMSkge1xcbiAgICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCA2MDsgaSsrKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdibGFua19ibG9jaydcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICAgICAgY2VudGVycyA9IFJlZ0V4cFBhcnNlKGRhdGEucG9zdC5kZXRhaWwpXFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAnPGgxPicgKyBkYXRhLnBvc3QudGl0bGUgKyAnPC9oMT4nICsgU21hbGwoR3JheShjZW50ZXJzKSksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnXFxuICAgICAgICB9KVxcbiAgICAgICAgdm9pY2UgPSBkYXRhLnBvc3Qudm9pY2VcXG4gICAgICAgIGlmICh2b2ljZS5sZW5ndGgpIHtcXG4gICAgICAgICAgICB2b2ljZSA9IEpTT04ucGFyc2Uodm9pY2UpXFxuICAgICAgICAgICAgdmlkZW8gPSB2b2ljZS52aWRlb2hvc3QgKyB2b2ljZS52aWRlb2ZpZFxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiAnPHA+PGEgaHJlZj1cXFwiJyArIHZpZGVvICsgJyNpc1ZpZGVvPXRydWUjXFxcIj5b54K55Ye75p+l55yL6KeG6aKRXTwvYT48L3A+JyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIGltYWdlcyA9IGRhdGEucG9zdC5pbWFnZXNcXG4gICAgICAgIGlmIChpbWFnZXMubGVuZ3RoKSB7XFxuICAgICAgICAgICAgaW1hZ2VzLmZvckVhY2goaW1hZ2UgPT4ge1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgcGljX3VybDogaW1hZ2UsXFxuICAgICAgICAgICAgICAgICAgICB1cmw6IGltYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdwaWNfMV9mdWxsJ1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IDIwOyBpKyspIHtcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2JsYW5rX2Jsb2NrJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9XFxuICAgIH1cXG4gICAgaWYgKGRhdGEuY29tbWVudHMubGVuZ3RoKSB7XFxuICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goU3Ryb25nKEJpZygn5YWo6YOo6K+E6K66IycgKyBkYXRhLnBvc3QuY29tbWVudENvdW50ICsgJ+adoScpKSksXFxuICAgICAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJyxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgICAgIGRhdGEuY29tbWVudHMuZm9yRWFjaChkYXRlID0+IHtcXG4gICAgICAgICAgICByZWZDb21tZW50ID0gZGF0ZS5yZWZDb21tZW50XFxuICAgICAgICAgICAgaWYgKHJlZkNvbW1lbnQgIT0gbnVsbCkge1xcbiAgICAgICAgICAgICAgICBuaWNrQ29tbWVudCA9IHJlZkNvbW1lbnQubmlja1xcbiAgICAgICAgICAgICAgICByZWZDb21tZW50ID0gJ+WbnuWkjVxcXFx0JyArIG5pY2tDb21tZW50ICsgJ++8mjxicj4nICsgUmVnRXhwUGFyc2UocmVmQ29tbWVudC50ZXh0KVxcbiAgICAgICAgICAgICAgICByZWZDb21tZW50ID0gXFxcIjxibG9ja3F1b3RlPlxcXCIgKyBTbWFsbChHcmF5KHJlZkNvbW1lbnQpKSArIFxcXCI8L2Jsb2NrcXVvdGU+XFxcIlxcbiAgICAgICAgICAgIH0gZWxzZSB7XFxuICAgICAgICAgICAgICAgIHJlZkNvbW1lbnQgPSAnJ1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpc1RvcCA9ICfpobbnva4nXFxuICAgICAgICAgICAgaWYgKGRhdGUuaXNUb3AgIT0gMSkgaXNUb3AgPSBkYXRlLnNlcSArICfmpbwnXFxuICAgICAgICAgICAgY2VudGVycyA9IFJlZ0V4cFBhcnNlKGRhdGUudGV4dClcXG4gICAgICAgICAgICB1c2VySUQgPSBkYXRlLnVzZXIudXNlcklEXFxuICAgICAgICAgICAgbmljayA9IGRhdGUudXNlci5uaWNrXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG5pY2sgKyAnXFxcXHRcXFxcdCcgKyBTbWFsbChTcHJpbmdHcmVlbihpc1RvcCkpICsgJ1xcXFx0XFxcXHQnICsgU21hbGwoQ29sb3IoZ2V0Rm9ybWF0KGRhdGUuY3JlYXRlVGltZSkpKSxcXG4gICAgICAgICAgICAgICAgcGljX3VybDogZGF0ZS51c2VyLmF2YXRhcixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5KS5ydWxlKCh1c2VySUQsIG5pY2spID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIE1ZX1BBR0UgPSAxXFxuICAgICAgICAgICAgICAgICAgICBzb3J0VHlwZSA9ICcnXFxuICAgICAgICAgICAgICAgICAgICBjYXRlZ29yeSA9ICcnXFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKCdQYWdlJylcXG4gICAgICAgICAgICAgICAgICAgIHNldFBhZ2VUaXRsZShuaWNrKVxcbiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9wYWdlL2NvbmZpZy5odG1sJylcXG4gICAgICAgICAgICAgICAgICAgIHBhdGggPSAnL3Bvc3QvY3JlYXRlL2xpc3QvQU5EUk9JRC80LjEuOCdcXG4gICAgICAgICAgICAgICAgICAgIGJvZHkgPSAnJnN0YXJ0PTAmY291bnQ9MjAmdXNlcl9pZD0nICsgdXNlcklEXFxuICAgICAgICAgICAgICAgICAgICBkYXRlID0gZ2V0Q29uZmlnVXJsKHBhdGgsIGJvZHkpXFxuICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW11cXG4gICAgICAgICAgICAgICAgICAgIGxheW91dFBhcnNlKGQsIGRhdGUsIHVzZXJJRCwgc29ydFR5cGUsIGNhdGVnb3J5KVxcbiAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGQpXFxuICAgICAgICAgICAgICAgIH0sIHVzZXJJRCwgbmljayksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnYXZhdGFyJ1xcbiAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IHJlZkNvbW1lbnQgKyBTbWFsbChHcmF5KGNlbnRlcnMpKSxcXG4gICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdyaWNoX3RleHQnLFxcbiAgICAgICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGlmIChkYXRlLmltYWdlcy5sZW5ndGgpIHtcXG4gICAgICAgICAgICAgICAgZGF0ZS5pbWFnZXMuZm9yRWFjaChpbWFnZSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHBpY191cmw6IGltYWdlLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIHVybDogaW1hZ2UsXFxuICAgICAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdwaWNfMV9mdWxsJ1xcbiAgICAgICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lX2JsYW5rJ1xcbiAgICAgICAgICAgIH0pXFxuICAgICAgICB9KVxcbiAgICB9IGVsc2Uge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogUmljaChTbWFsbChHcmF5KCfvvZ7vvZ7vvZ7miJHmmK/mnInlupXnur/nmoTvvZ7vvZ7vvZ4nKSkpLFxcbiAgICAgICAgICAgIHVybDogZW1wdHksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0X2NlbnRlcl8xJyxcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICB9XFxufVxcblxcbmNvbnN0IGdldExvZ2luUGFyc2UgPSAoZCkgPT4ge1xcbiAgICBzZXRQYWdlVGl0bGUoJ+iRq+iKpuS+oMK355m75b2VJylcXG4gICAgZC5wdXNoKHtcXG4gICAgICAgIGRlc2M6IFxcXCLor7fovpPlhaXmgqjnmoTmiYvmnLrlj7cv6YKu566xXFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBvbkNoYW5nZTogXFxcInNldEl0ZW0oJ+iRq+iKpuS+oOi0puWPtycsIGlucHV0KVxcXCIsXFxuICAgICAgICAgICAgdGl0bGVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9LCB7XFxuICAgICAgICBkZXNjOiBcXFwi6K+36L6T5YWl5oKo55qE5a+G56CBXFxcIixcXG4gICAgICAgIGNvbF90eXBlOiBcXFwiaW5wdXRcXFwiLFxcbiAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICBvbkNoYW5nZTogXFxcInNldEl0ZW0oJ+iRq+iKpuS+oOWvhueggScsIGlucHV0KVxcXCIsXFxuICAgICAgICAgICAgdHlwZTogXFxcInBhc3N3b3JkXFxcIixcXG4gICAgICAgICAgICB0aXRsZVZpc2libGU6IGZhbHNlXFxuICAgICAgICB9XFxuICAgIH0sIHtcXG4gICAgICAgIHRpdGxlOiBSaWNoKENlbnRlcihcXFwi55m75b2V6LSm5Y+3XFxcIikpLFxcbiAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoKSA9PiB7XFxuICAgICAgICAgICAgTVlfUEFHRSA9IDFcXG4gICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL3BhZ2UvY29uZmlnLmh0bWwnKVxcbiAgICAgICAgICAgIHJldHVybiBnZXRMb2dpblVybCgpXFxuICAgICAgICB9KSxcXG4gICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF9jZW50ZXJfMVxcXCIsXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZVxcbiAgICAgICAgfVxcbiAgICB9KVxcbn1cXG5cXG5jb25zdCBnZXRTZWFyY2hQYXJzZSA9IChkKSA9PiB7XFxuICAgIHNldFBhZ2VUaXRsZSgn6JGr6Iqm5L6gwrfmkJzntKInKVxcbiAgICBhZGRMaXN0ZW5lcignb25DbG9zZScsICgpID0+IHtcXG4gICAgICAgIGNsZWFyTXlWYXIoXFxcIuaQnOe0ouWFs+mUruivjVxcXCIpXFxuICAgIH0pXFxuICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgdGl0bGU6IGdldEl0ZW0oJ+iRq+iKpuS+oG5pY2snKSxcXG4gICAgICAgICAgICBwaWNfdXJsOiBnZXRJdGVtKCfokavoiqbkvqBhdmF0YXInKSxcXG4gICAgICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgY29uZmlybSh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIumAgOWHuueZu+W9lVxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb250ZW50OiBcXFwi56Gu5a6a5aW95LqG5ZCX77yf5b2T5YmN6LSm5Y+35bCG5Lya6YCA5Ye6flxcXCIsXFxuICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJdGVtKCfokavoiqbkvqBUT0tFTicpO1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdG9hc3QoJ+mAgOWHuuaIkOWKn34nKTtcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGlucHV0XFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInXFxuICAgICAgICB9LCB7XFxuICAgICAgICAgICAgdGl0bGU6ICfwn5SNJyxcXG4gICAgICAgICAgICBkZXNjOiAn6K+36L6T5YWl5biW5a2Q5ZCN56ewL+WFs+mUruivjScsXFxuICAgICAgICAgICAgdXJsOiAkLnRvU3RyaW5nKChnZXRTZWFyY2hVcmwsIGVtcHR5KSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmkJzntKLlhbPplK7or40nLCBpbnB1dCk7XFxuICAgICAgICAgICAgICAgIGlmIChpbnB1dCAhPSAnJykgZ2V0U2VhcmNoVXJsKGlucHV0KTtcXG4gICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgIH0sIGdldFNlYXJjaFVybCwgZW1wdHkpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiAnaW5wdXQnLFxcbiAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoJ+aQnOe0ouWFs+mUruivjScpXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgfVxcbiAgICBpZiAoZ2V0TXlWYXIoJ+aQnOe0ouWFs+mUruivjScpID09ICcnKSB7XFxuICAgICAgICBpZiAocGFnZSA9PSAxKSB7XFxuICAgICAgICAgICAgbGV0IG1lbSA9IHN0b3JhZ2UwLmdldEl0ZW0oXFxcIuiRq+iKpuS+oFxcXCIsIFtdKTtcXG4gICAgICAgICAgICBpZiAobWVtLmxlbmd0aCA+IDApIHtcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKEJpZygn8J+TnSDmkJzntKLljoblj7InKSksXFxuICAgICAgICAgICAgICAgICAgICB1cmw6ICQoXFxcIiNub0xvYWRpbmcjXFxcIikubGF6eVJ1bGUoKGVtcHR5LCBnZXRDb25maXJtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0Q29uZmlybSgpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgICAgICAgICAgfSwgZW1wdHksIGdldENvbmZpcm0pLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzEnLFxcbiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9IGVsc2Uge1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFJpY2goQ2VudGVyKFxcXCLlloLlloJ+6L+Y5rKh5pCc57Si5ZGi772eKO+/o+KWve+/o++9nil+XFxcIikpLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJyxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGZvciAobGV0IGkgPSBtZW0ubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHtcXG4gICAgICAgICAgICAgICAgbGV0IGl0ID0gbWVtW2ldO1xcbiAgICAgICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGl0LFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpdCwgZ2V0U2VhcmNoVXJsLCBlbXB0eSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCfmkJzntKLlhbPplK7or40nLCBpdCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgZ2V0U2VhcmNoVXJsKGl0KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5O1xcbiAgICAgICAgICAgICAgICAgICAgfSwgaXQsIGdldFNlYXJjaFVybCwgZW1wdHkpLFxcbiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJmbGV4X2J1dHRvblxcXCJcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9XFxuICAgIH0gZWxzZSB7XFxuICAgICAgICBwYXRoID0gJy9wb3N0L3NlYXJjaC9BTkRST0lELzQuMS44J1xcbiAgICAgICAgYm9keSA9ICcmc3RhcnQ9JyArIChwYWdlIC0gMSkgKiAyMCArICcmY291bnQ9MjAmY2F0X2lkPTQzJmtleXdvcmQ9JyArIGdldE15VmFyKCfmkJzntKLlhbPplK7or40nKSArICcmZmxhZz0wJ1xcbiAgICAgICAgZGF0ZSA9IGdldENvbmZpZ1VybChwYXRoLCBib2R5KVxcbiAgICAgICAgdHJ5IHtcXG4gICAgICAgICAgICBsYXlvdXRTZWFyY2hQYXJzZShkLCBkYXRlLnBvc3RzKVxcbiAgICAgICAgfSBjYXRjaCAoZSkge1xcbiAgICAgICAgICAgIGlmIChwYWdlID09IDEpIHtcXG4gICAgICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgICAgIHRpdGxlOiBSaWNoKENlbnRlcihkYXRlLm1zZykpLFxcbiAgICAgICAgICAgICAgICAgICAgdXJsOiBlbXB0eSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJyxcXG4gICAgICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfVxcbiAgICB9XFxufVwifV0iLCJpY29uIjoiIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment