xiaomianao666

插件名:快猫视频

Oct 13th, 2022
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:网页插件¥js_url¥快猫视频@base64://Y29uc3QgZW1wdHkgPSAnaGlrZXI6Ly9lbXB0eScKY29uc3QgcGFnZSA9IE1ZX1BBR0U7Cgpjb25zdCBDb2xvciA9ICh0ZXN0KSA9PiB7CiAgICByZXR1cm4gJ+KAmOKAmOKAmeKAmTxzdHJvbmc+PGZvbnQgY29sb3I9IiNGQTcyOTgiPicgKyB0ZXN0ICsgJzwvZnJvbnQ+PC9zdHJvbmc+JzsKfQoKY29uc3QgU2lsdmVyID0gKHRlc3QpID0+IHsKICAgIHJldHVybiAn4oCY4oCY4oCZ4oCZPGZvbnQgY29sb3I9IiNDMEMwQzAiPjxzbWFsbD4nICsgdGVzdCArICc8L3NtYWxsPjwvZnJvbnQ+JzsKfQoKY29uc3QgU3R5bGUgPSAodGVzdCkgPT4gewogICAgcmV0dXJuICLigJjigJjigJnigJk8aDQgc3R5bGU9J3RleHQtYWxpZ246Y2VudGVyJz4iICsgdGVzdCArICI8L2g0PiIKfQoKY29uc3QgQiA9ICh0ZXN0KSA9PiB7CiAgICByZXR1cm4gJ+KAnOKAnOKAneKAnTxiPjxmb250IGNvbG9yPSMwMDA+JyArIHRlc3QgKyAnPC9mb250PjwvYj4nCn0KCmlmICghZ2V0TXlWYXIoJ+Wfn+WQjScpKSB7CiAgICDln5/lkI0gPSAnaHR0cHM6Ly93d3cua21xc2FxLmNvbScKICAgIHB1dE15VmFyKCfln5/lkI0nLCDln5/lkI0pCn0KCmNvbnN0IGdldFNlYXJjaFVybCA9IChrdywgZW1wdHkpID0+IHsKICAgIGxldCBtZW0gPSBzdG9yYWdlMC5nZXRJdGVtKCLlv6vnjKvop4bpopEiLCBbXSk7CiAgICBtZW0gPSBtZW0uZmlsdGVyKGl0ID0+IGl0ICE9IGt3KTsKICAgIGlmIChtZW0ubGVuZ3RoID49IDEwKSB7CiAgICAgICAgbWVtID0gbWVtLnNsaWNlKDEpOwogICAgfQogICAgbWVtLnB1c2goa3cpOwogICAgc3RvcmFnZTAuc2V0SXRlbSgi5b+r54yr6KeG6aKRIiwgbWVtKTsKICAgIHJldHVybiBlbXB0eTsKfTsKCmNvbnN0IERlY29kZSA9ICh3b3JkKSA9PiB7CiAgICBldmFsKGdldENyeXB0b0pTKCkpCiAgICBsZXQga2V5ID0gQ3J5cHRvSlMuZW5jLlV0ZjgucGFyc2UoIjQ2Y2M3OTNjNTNkYzQ1MWIiKQogICAgcmV0dXJuIENyeXB0b0pTLkFFUy5kZWNyeXB0KHdvcmQsIGtleSwgewogICAgICAgIG1vZGU6IENyeXB0b0pTLm1vZGUuRUNCLAogICAgICAgIHBhZGRpbmc6IENyeXB0b0pTLnBhZC5Qa2NzNwogICAgfSkudG9TdHJpbmcoQ3J5cHRvSlMuZW5jLlV0ZjgpCn07Cgpjb25zdCBMb2FkSW1hZ2UgPSAocGljX3VybCwgaWQpID0+IHsKICAgIGxldCBpbWcgPSAiZGF0YTppbWFnZS9wbmc7YmFzZTY0LCIgKyByZXF1ZXN0KHBpY191cmwpLnNwbGl0KCdzaGlwaW4nKVsxXTsKICAgIHVwZGF0ZUl0ZW0oewogICAgICAgIGltZzogaW1nLAogICAgICAgIGV4dHJhOiB7CiAgICAgICAgICAgIGlkOiBpZAogICAgICAgIH0KICAgIH0pOwp9Cgpjb25zdCBnZXRQaG9uZU51bSA9ICgpID0+IHsKICAgIGxldCBwcmVmaXhBcnJheSA9IG5ldyBBcnJheSgiMTMwIiwgIjEzMSIsICIxMzIiLCAiMTMzIiwgIjEzNSIsICIxMzciLCAiMTM4IiwgIjE3MCIsICIxODciLCAiMTg5Iik7CiAgICBsZXQgaSA9IHBhcnNlSW50KDEwICogTWF0aC5yYW5kb20oKSk7CiAgICBsZXQgcHJlZml4ID0gcHJlZml4QXJyYXlbaV07CgogICAgZm9yICh2YXIgaiA9IDA7IGogPCA4OyBqKyspIHsKCiAgICAgICAgcHJlZml4ID0gcHJlZml4ICsgTWF0aC5mbG9vcihNYXRoLnJhbmRvbSgpICogMTApOwoKICAgIH0KCiAgICByZXR1cm4gcHJlZml4Owp9Cgpjb25zdCB0aW1lID0gbmV3IERhdGUoKS5nZXRUaW1lKCkKCmNvbnN0IGNvbmZpZ1BhcnNlID0gKHBhdGgsIGJvZHkpID0+IHsKICAgIHBhdGggPSBnZXRNeVZhcign5Z+f5ZCNJykgKyBwYXRoCiAgICBkYXRhID0gcmVxdWVzdChwYXRoLCB7CiAgICAgICAgaGVhZGVyczogewogICAgICAgICAgICB0b2tlbjogZ2V0SXRlbSgn5b+r54yrVE9LRU4nLCAnJykKICAgICAgICB9LAogICAgICAgIGJvZHk6IEpTT04uc3RyaW5naWZ5KGJvZHkpLAogICAgICAgIG1ldGhvZDogJ1BPU1QnCiAgICB9KQogICAgZGF0YSA9IEpTT04ucGFyc2UoZGF0YSkuZGF0YQogICAgcmV0dXJuIEpTT04ucGFyc2UoRGVjb2RlKGRhdGEpKQp9Cgpjb25zdCBsb2dpbkNvbmZpZ1BhcnNlID0gKHBhdGgsIGJvZHkpID0+IHsKICAgIHBhdGggPSBnZXRNeVZhcign5Z+f5ZCNJykgKyBwYXRoCiAgICByZXR1cm4gSlNPTi5wYXJzZShyZXF1ZXN0KHBhdGgsIHsKICAgICAgICBib2R5OiBKU09OLnN0cmluZ2lmeShib2R5KSwKICAgICAgICBtZXRob2Q6ICdQT1NUJwogICAgfSkpCn0KCmNvbnN0IGdldFBsYXllclVybCA9IChpbnB1dCkgPT4gewogICAgcGF0aCA9ICcvdmlkZW8vZ2V0VXJsJwogICAgYm9keSA9IHsKICAgICAgICAiY2xpZW50VHlwZSI6IDUsCiAgICAgICAgInZpZGVvSWQiOiBpbnB1dAogICAgfQogICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpOwogICAgcmV0dXJuIGRhdGEudXJsCn0KCmlmIChOdW1iZXIodGltZSAtIGdldEl0ZW0oJ+W/q+eMq1RPS0VOLVRpbWUnLCAnMCcpKSA+IDI1OTIwMDAwMCkgewogICAgc2V0SXRlbSgn5b+r54yrVE9LRU4tVGltZScsICcnICsgdGltZSArICcnKQogICAgY2xlYXJJdGVtKCflv6vnjKtUT0tFTicpCn0KCmNvbnN0IGJhc2VQYXJzZSA9ICgpID0+IHsKICAgIGNvbnN0IGxpc3RQaWMgPSBbXQogICAgY29uc3QgZCA9IFtdCiAgICBpZiAoZ2V0SXRlbSgn5b+r54yrVE9LRU4nLCAnJykgIT0gJycpIHsKICAgICAgICBncm91UGFyc2UoZCwgbGlzdFBpYyk7CiAgICB9IGVsc2UgewogICAgICAgIHVzZXJQYXJzZShkKTsKICAgIH0KICAgIHNldFJlc3VsdChkKQogICAgdHJ5IHsKICAgICAgICBiZShsaXN0UGljKQogICAgfSBjYXRjaCAoZSkge30KfQoKY29uc3QgdXNlclBhcnNlID0gKGQpID0+IHsKICAgIOeUqOaItyA9IFsn55m75b2VJywgJ+azqOWGjCddOwogICAgaWYgKHBhZ2UgPT0gMSkgewogICAgICAgIOeUqOaIty5mb3JFYWNoKGkgPT4gewogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgdGl0bGU6IGkgPT0gZ2V0TXlWYXIoJ+eUqOaItycsIOeUqOaIt1swXSkgPyBDb2xvcihpKSA6IGksCiAgICAgICAgICAgICAgICB1cmw6ICQoJyNub0xvYWRpbmcjJykubGF6eVJ1bGUoKGksIGVtcHR5KSA9PiB7CiAgICAgICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+eUqOaItycsIGkpOwogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5CiAgICAgICAgICAgICAgICB9LCBpLCBlbXB0eSksCiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfMicKICAgICAgICAgICAgfSkKICAgICAgICB9KQogICAgICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ+eUqOaItycsIOeUqOaIt1swXSkpIHsKICAgICAgICAgICAgY2FzZSDnlKjmiLdbMF06CiAgICAgICAgICAgICAgICBsb2dpbkZvcm1QYXJzZShkKQogICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIGNhc2Ug55So5oi3WzFdOgogICAgICAgICAgICAgICAgcmVnaXN0ZXJGb3JtUGFyc2UoZCkKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgIH0KICAgIH0KfQoKY29uc3QgbG9naW5Gb3JtUGFyc2UgPSAoZCkgPT4gewogICAgZC5wdXNoKHsKICAgICAgICBkZXNjOiAi6K+36L6T5YWl5oKo55qE5omL5py65Y+35oiW6YKu566xIiwKICAgICAgICBjb2xfdHlwZTogImlucHV0IiwKICAgICAgICBleHRyYTogewogICAgICAgICAgICBvbkNoYW5nZTogInNldEl0ZW0oJ+W/q+eMq+i0puWPtycsIGlucHV0KSIsCiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2UKICAgICAgICB9CiAgICB9LCB7CiAgICAgICAgZGVzYzogIuivt+i+k+WFpeaCqOeahOWvhueggSIsCiAgICAgICAgY29sX3R5cGU6ICJpbnB1dCIsCiAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgb25DaGFuZ2U6ICJzZXRJdGVtKCflv6vnjKvlr4bnoIEnLCBpbnB1dCkiLAogICAgICAgICAgICB0aXRsZVZpc2libGU6IGZhbHNlCiAgICAgICAgfQogICAgfSwgewogICAgICAgIHRpdGxlOiBTdHlsZSgi55m75b2V6LSm5Y+3IiksCiAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoKSA9PiB7CiAgICAgICAgICAgIE1ZX1BBR0UgPSAxCiAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv5b+r54yr6KeG6aKRLmpzJykKICAgICAgICAgICAgcmV0dXJuIGxvZ2luUGFyc2UoKQogICAgICAgIH0pLAogICAgICAgIGNvbF90eXBlOiAidGV4dF9jZW50ZXJfMSIsCiAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlCiAgICAgICAgfQogICAgfSkKfQoKY29uc3QgcmVnaXN0ZXJGb3JtUGFyc2UgPSAoZCkgPT4gewogICAgZC5wdXNoKHsKICAgICAgICBkZXNjOiAi6K+36L6T5YWl5oKo55qE5omL5py65Y+35oiW6YKu566xIiwKICAgICAgICBjb2xfdHlwZTogImlucHV0IiwKICAgICAgICBleHRyYTogewogICAgICAgICAgICBvbkNoYW5nZTogInNldEl0ZW0oJ+W/q+eMq+i0puWPtycsIGlucHV0KSIsCiAgICAgICAgICAgIHRpdGxlVmlzaWJsZTogZmFsc2UKICAgICAgICB9CiAgICB9LCB7CiAgICAgICAgZGVzYzogIuivt+i+k+WFpeaCqOeahOWvhueggSIsCiAgICAgICAgY29sX3R5cGU6ICJpbnB1dCIsCiAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgb25DaGFuZ2U6ICJzZXRJdGVtKCflv6vnjKvlr4bnoIEnLCBpbnB1dCkiLAogICAgICAgICAgICB0aXRsZVZpc2libGU6IGZhbHNlCiAgICAgICAgfQogICAgfSwgewogICAgICAgIHRpdGxlOiAi5rOo5YaM6LSm5Y+3IiwKICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKCgpID0+IHsKICAgICAgICAgICAgTVlfUEFHRSA9IDEKICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/lv6vnjKvop4bpopEuanMnKQogICAgICAgICAgICByZXR1cm4gcmVnaXN0ZXJQYXJzZSgpCiAgICAgICAgfSksCiAgICAgICAgY29sX3R5cGU6ICJ0ZXh0XzIiLAogICAgICAgIGV4dHJhOiB7CiAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZQogICAgICAgIH0KICAgIH0sIHsKICAgICAgICB0aXRsZTogIuS4gOmUruazqOWGjCIsCiAgICAgICAgdXJsOiAkKGVtcHR5KS5sYXp5UnVsZSgoKSA9PiB7CiAgICAgICAgICAgIE1ZX1BBR0UgPSAxCiAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv5b+r54yr6KeG6aKRLmpzJykKICAgICAgICAgICAgc2V0SXRlbSgn5b+r54yr6LSm5Y+3JywgZ2V0UGhvbmVOdW0oKSkKICAgICAgICAgICAgc2V0SXRlbSgn5b+r54yr5a+G56CBJywgJzEyMzQ1NicpCiAgICAgICAgICAgIHJldHVybiByZWdpc3RlclBhcnNlKCkKICAgICAgICB9KSwKICAgICAgICBjb2xfdHlwZTogInRleHRfMiIsCiAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlCiAgICAgICAgfQogICAgfSkKfQoKY29uc3QgbG9naW5QYXJzZSA9ICgpID0+IHsKICAgIHBhdGggPSAnL3VzZXIvbG9naW4nCiAgICBib2R5ID0gewogICAgICAgICJjbGllbnRUeXBlIjogNSwKICAgICAgICAidXNlck5hbWUiOiBnZXRJdGVtKCflv6vnjKvotKblj7cnKSwKICAgICAgICAicGFzc3dvcmQiOiBnZXRJdGVtKCflv6vnjKvlr4bnoIEnKQogICAgfQogICAgZGF0YSA9IGxvZ2luQ29uZmlnUGFyc2UocGF0aCwgYm9keSkKICAgIGlmIChkYXRhLmNvZGUgPT0gMSkgewogICAgICAgIHRva2VuID0gSlNPTi5wYXJzZShEZWNvZGUoZGF0YS5kYXRhKSkudG9rZW4KICAgICAgICBzZXRJdGVtKCflv6vnjKtUT0tFTicsIHRva2VuKQogICAgICAgIHJlZnJlc2hQYWdlKCkKICAgICAgICB0b2FzdCgi55m75b2V5oiQ5YqfIikKICAgIH0gZWxzZSB7CiAgICAgICAgY2xlYXJJdGVtKCLlv6vnjKvotKblj7ciKQogICAgICAgIGNsZWFySXRlbSgi5b+r54yr5a+G56CBIikKICAgICAgICB0b2FzdChkYXRhLm1lc3NhZ2UpCiAgICB9CiAgICByZXR1cm4gZW1wdHkKfQoKY29uc3QgcmVnaXN0ZXJQYXJzZSA9ICgpID0+IHsKICAgIHBhdGggPSAnL3VzZXIvcmVnaXN0ZXInCiAgICBib2R5ID0gewogICAgICAgICJjbGllbnRUeXBlIjogNSwKICAgICAgICAidXNlck5hbWUiOiBnZXRJdGVtKCflv6vnjKvotKblj7cnKSwKICAgICAgICAicGFzc3dvcmQiOiBnZXRJdGVtKCflv6vnjKvlr4bnoIEnKSwKICAgICAgICAiY29kZSI6ICIiCiAgICB9CiAgICBpZiAoTnVtYmVyKHRpbWUgLSBnZXRJdGVtKCd0aW1lJywgJzAnKSkgPiAzMDAwMDApIHsKICAgICAgICBzZXRJdGVtKCd0aW1lJywgJycgKyB0aW1lICsgJycpCiAgICAgICAgZGF0YSA9IGxvZ2luQ29uZmlnUGFyc2UocGF0aCwgYm9keSkKICAgICAgICBpZiAoZGF0YS5jb2RlID09IDEpIHsKICAgICAgICAgICAgbG9nKCfotKblj7fvvJonICsgZ2V0SXRlbSgn5b+r54yr6LSm5Y+3JykpCiAgICAgICAgICAgIGxvZygn5a+G56CB77yaJyArIGdldEl0ZW0oJ+W/q+eMq+WvhueggScpKQogICAgICAgICAgICB0b2FzdCgi5rOo5YaM5oiQ5Yqf77yM6K+36L+U5Zue55m75b2VIikKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBjbGVhckl0ZW0oIuW/q+eMq+i0puWPtyIpCiAgICAgICAgICAgIGNsZWFySXRlbSgi5b+r54yr5a+G56CBIikKICAgICAgICAgICAgdG9hc3QoZGF0YS5tZXNzYWdlKQogICAgICAgICAgICBjbGVhckl0ZW0oJ3RpbWUnKQogICAgICAgIH0KICAgIH0gZWxzZSB7CiAgICAgICAgdG9hc3QoJ+ivt+etieW+hTXliIbpkp/nu6fnu61+JykKICAgIH0KICAgIHJldHVybiBlbXB0eQp9Cgpjb25zdCBncm91UGFyc2UgPSAoZCwgbGlzdFBpYykgPT4gewogICAg5YiG57uEID0gWyfpppbpobUnLCAn5Y+R546wJywgJ+S4k+mimCcsICfmkJzntKInXTsKICAgIGlmIChwYWdlID09IDEpIHsKICAgICAgICDliIbnu4QuZm9yRWFjaChpID0+IHsKICAgICAgICAgICAgZC5wdXNoKHsKICAgICAgICAgICAgICAgIHRpdGxlOiBpID09IGdldE15VmFyKCfliIbnu4QnLCDliIbnu4RbMF0pID8gQ29sb3IoaSkgOiBpLAogICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChpLCBlbXB0eSkgPT4gewogICAgICAgICAgICAgICAgICAgIHB1dE15VmFyKCfliIbnu4QnLCBpKTsKICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpOwogICAgICAgICAgICAgICAgICAgIHJldHVybiBlbXB0eTsKICAgICAgICAgICAgICAgIH0sIGksIGVtcHR5KSwKICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicKICAgICAgICAgICAgfSkKICAgICAgICB9KQogICAgICAgIGQucHVzaCh7CiAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snCiAgICAgICAgfSkKICAgIH0KICAgIHN3aXRjaCAoZ2V0TXlWYXIoJ+WIhue7hCcsIOWIhue7hFswXSkpIHsKICAgICAgICBjYXNlIOWIhue7hFswXToKICAgICAgICAgICAgaG9tZVBhcnNlKGQsIGxpc3RQaWMpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIGNhc2Ug5YiG57uEWzFdOgogICAgICAgICAgICBkaXNjb3ZlclBhcnNlKGQsIGxpc3RQaWMpCiAgICAgICAgICAgIGJyZWFrOwogICAgICAgIGNhc2Ug5YiG57uEWzJdOgogICAgICAgICAgICBzcGVjaWFsUGFyc2UoZCwgbGlzdFBpYykKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgY2FzZSDliIbnu4RbM106CiAgICAgICAgICAgIHNlYXJjaFBhcnNlKGQsIGxpc3RQaWMpCiAgICAgICAgICAgIGJyZWFrOwogICAgfQp9Cgpjb25zdCBob21lUGFyc2UgPSAoZCwgbGlzdFBpYykgPT4gewogICAgcGF0aCA9ICcvdmlkZW8vZ2V0VHlwZUxpc3QnCiAgICBib2R5ID0gewogICAgICAgICJjbGllbnRUeXBlIjogNQogICAgfQogICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICBpZiAocGFnZSA9PSAxKSB7CiAgICAgICAgZGF0YS5mb3JFYWNoKGl0ZW0gPT4gewogICAgICAgICAgICBpZCA9IGl0ZW0uaWQKICAgICAgICAgICAgbmFtZSA9IGl0ZW0udHlwZU5hbWUKICAgICAgICAgICAgZC5wdXNoKHsKICAgICAgICAgICAgICAgIHRpdGxlOiBpZCA9PSBnZXRNeVZhcign6aaW6aG1JywgJycgKyBkYXRhWzBdLmlkICsgJycpID8gQ29sb3IobmFtZSkgOiBuYW1lLAogICAgICAgICAgICAgICAgdXJsOiAkKCcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChpZCwgZW1wdHkpID0+IHsKICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcign6aaW6aG1JywgaWQpOwogICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7CiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5OwogICAgICAgICAgICAgICAgfSwgaWQsIGVtcHR5KSwKICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbicKICAgICAgICAgICAgfSkKICAgICAgICB9KQogICAgfQogICAgcGF0aCA9ICcvdmlkZW8vZ2V0TGlzdCcKICAgIGJvZHkgPSB7CiAgICAgICAgImNsaWVudFR5cGUiOiA1LAogICAgICAgICJsZW5ndGgiOiAxMiwKICAgICAgICAicGFnZSI6IHBhZ2UsCiAgICAgICAgInR5cGVJZCI6IGdldE15VmFyKCfpppbpobUnLCAnJyArIGRhdGFbMF0uaWQgKyAnJykKICAgIH0KICAgIGRhdGEgPSBjb25maWdQYXJzZShwYXRoLCBib2R5KS5saXN0OwogICAgbGF5b3V0UGFyc2UoZCwgZGF0YSwgbGlzdFBpYyk7Cn0KCmNvbnN0IGRpc2NvdmVyUGFyc2UgPSAoZCwgbGlzdFBpYykgPT4gewogICAgcGF0aCA9ICcvdmlkZW8vZmluZFZpZGVvJwogICAgYm9keSA9IHsKICAgICAgICAiY2xpZW50VHlwZSI6IDUsCiAgICAgICAgImxlbmd0aCI6IDIwLAogICAgICAgICJwYWdlIjogbnVsbAogICAgfQogICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICBsYXlvdXRQYXJzZShkLCBkYXRhLCBsaXN0UGljKTsKfQoKY29uc3Qgc3BlY2lhbFBhcnNlID0gKGQsIGxpc3RQaWMpID0+IHsKICAgIOWPkeeOsCA9IFsn57K+6YCJ5LiT6aKYJywgJ+efpeWQjeWls+S8mCddOwogICAgaWYgKHBhZ2UgPT0gMSkgewogICAgICAgIOWPkeeOsC5mb3JFYWNoKChpdGVtLCBpbmRleCkgPT4gewogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgdGl0bGU6IEIoaXRlbSksCiAgICAgICAgICAgICAgICBkZXNjOiAn5p+l55yL5pu05aSaJywKICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSArICdmeXBhZ2UnKS5ydWxlKChpbmRleCkgPT4gewogICAgICAgICAgICAgICAgICAgIHJlcXVpcmUoJ2hpa2VyOi8vZmlsZXMvcnVsZXMvanMv5b+r54yr6KeG6aKRLmpzJykKICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0UGljID0gW10KICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW10KICAgICAgICAgICAgICAgICAgICBzd2l0Y2ggKGluZGV4KSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMDoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGggPSAnL2FsYnVtL2dldEFsYnVtTGlzdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNsaWVudFR5cGUiOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJsZW5ndGgiOiAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInBhZ2UiOiBwYWdlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBkYXRhID0gY29uZmlnUGFyc2UocGF0aCwgYm9keSkubGlzdDsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGdldEFsYnVtTGlzdChkLCBkYXRhLCBsaXN0UGljKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhdGggPSAnL2FjdG9yL2dldEFjdG9yTGlzdCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJvZHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImNsaWVudFR5cGUiOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJsZW5ndGgiOiAxMDAsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInBhZ2UiOiBwYWdlLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0eXBlIjogMgogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZXRBY3Rvckxpc3QoZCwgZGF0YSwgbGlzdFBpYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBzZXRSZXN1bHQoZCkKICAgICAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgICAgICBiZShsaXN0UGljKQogICAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9CiAgICAgICAgICAgICAgICB9LCBpbmRleCksCiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfMScsCiAgICAgICAgICAgICAgICBleHRyYTogewogICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KQogICAgICAgICAgICBzd2l0Y2ggKGluZGV4KSB7CiAgICAgICAgICAgICAgICBjYXNlIDA6CiAgICAgICAgICAgICAgICAgICAgcGF0aCA9ICcvYWxidW0vZ2V0QWxidW1MaXN0JwogICAgICAgICAgICAgICAgICAgIGJvZHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICJjbGllbnRUeXBlIjogNSwKICAgICAgICAgICAgICAgICAgICAgICAgInBhZ2UiOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAibGVuZ3RoIjogNAogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBkYXRhID0gY29uZmlnUGFyc2UocGF0aCwgYm9keSkubGlzdDsKICAgICAgICAgICAgICAgICAgICBnZXRBbGJ1bUxpc3QoZCwgZGF0YSwgbGlzdFBpYykKICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgIGNhc2UgMToKICAgICAgICAgICAgICAgICAgICBwYXRoID0gJy9hY3Rvci9nZXRBY3Rvckxpc3QnCiAgICAgICAgICAgICAgICAgICAgYm9keSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgImNsaWVudFR5cGUiOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAicGFnZSI6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICJsZW5ndGgiOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAidHlwZSI6IDIKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICAgICAgICAgICAgICAgICAgZ2V0QWN0b3JMaXN0KGQsIGRhdGEsIGxpc3RQaWMpCiAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgIH0KICAgICAgICB9KQogICAgICAgIHBhdGggPSAnL2FjdG9yL2dldEFjdG9yUmVjTGlzdCcKICAgICAgICBib2R5ID0gewogICAgICAgICAgICAiY2xpZW50VHlwZSI6IDUsCiAgICAgICAgICAgICJwYWdlIjogMSwKICAgICAgICAgICAgImxlbmd0aCI6IDUKICAgICAgICB9CiAgICAgICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICAgICAgZGF0YS5mb3JFYWNoKGl0ZW0gPT4gewogICAgICAgICAgICBjb2RlID0gaXRlbS5pZAogICAgICAgICAgICBuaWNrID0gaXRlbS5uYW1lCiAgICAgICAgICAgIGF2YXRhciA9IGl0ZW0uaGVhZEljbwogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgY29sX3R5cGU6ICdsaW5lX2JsYW5rJwogICAgICAgICAgICB9LCB7CiAgICAgICAgICAgICAgICB0aXRsZTogbmljaywKICAgICAgICAgICAgICAgIHBpY191cmw6IGF2YXRhciwKICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSArICdmeXBhZ2UnKS5ydWxlKChjb2RlKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/lv6vnjKvop4bpopEuanMnKQogICAgICAgICAgICAgICAgICAgIHBhdGggPSAnL2FjdG9yL2dldEFjdG9yVmlkZW9MaXN0JwogICAgICAgICAgICAgICAgICAgIGJvZHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICJjbGllbnRUeXBlIjogNSwKICAgICAgICAgICAgICAgICAgICAgICAgImFjdG9ySWQiOiBjb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAibGVuZ3RoIjogMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICJwYWdlIjogcGFnZQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0UGljID0gW10KICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW10KICAgICAgICAgICAgICAgICAgICBkYXRhID0gY29uZmlnUGFyc2UocGF0aCwgYm9keSkubGlzdDsKICAgICAgICAgICAgICAgICAgICBsYXlvdXRQYXJzZShkLCBkYXRhLCBsaXN0UGljKQogICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChkKQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJlKGxpc3RQaWMpCiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge30KICAgICAgICAgICAgICAgIH0sIGNvZGUpLAogICAgICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInLAogICAgICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5uYW1lCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0sIHsKICAgICAgICAgICAgICAgIHRpdGxlOiAnXHRcdFx0JyArIFNpbHZlcign5pS25b2V6KeG6aKRJyArIGl0ZW0udmlkZW9Db3VudCArICfpg6gnKSwKICAgICAgICAgICAgICAgIHVybDogJChlbXB0eSArICdmeXBhZ2UnKS5ydWxlKChjb2RlKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/lv6vnjKvop4bpopEuanMnKQogICAgICAgICAgICAgICAgICAgIHBhdGggPSAnL2FjdG9yL2dldEFjdG9yVmlkZW9MaXN0JwogICAgICAgICAgICAgICAgICAgIGJvZHkgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICJjbGllbnRUeXBlIjogNSwKICAgICAgICAgICAgICAgICAgICAgICAgImFjdG9ySWQiOiBjb2RlLAogICAgICAgICAgICAgICAgICAgICAgICAibGVuZ3RoIjogMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICJwYWdlIjogcGFnZQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0UGljID0gW10KICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW10KICAgICAgICAgICAgICAgICAgICBkYXRhID0gY29uZmlnUGFyc2UocGF0aCwgYm9keSkubGlzdDsKICAgICAgICAgICAgICAgICAgICBsYXlvdXRQYXJzZShkLCBkYXRhLCBsaXN0UGljKQogICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChkKQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJlKGxpc3RQaWMpCiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge30KICAgICAgICAgICAgICAgIH0sIGNvZGUpLAogICAgICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzEnLAogICAgICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2UKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSkKICAgICAgICAgICAgbGF5b3V0UGFyc2UoZCwgaXRlbS52aWRlb3MsIGxpc3RQaWMpCiAgICAgICAgICAgIGxpc3RQaWMucHVzaCh7CiAgICAgICAgICAgICAgICBmdW5jOiAoKSA9PiBMb2FkSW1hZ2UoaXRlbS5oZWFkSWNvLCBpdGVtLm5hbWUpCiAgICAgICAgICAgIH0pOwogICAgICAgIH0pCiAgICB9Cn0KCmNvbnN0IGdldEFsYnVtTGlzdCA9IChkLCBkYXRhLCBsaXN0UGljKSA9PiB7CiAgICBpZiAoZGF0YS5sZW5ndGgpIHsKICAgICAgICBkYXRhLmZvckVhY2goaXRlbSA9PiB7CiAgICAgICAgICAgIGlkID0gaXRlbS5pZAogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0ubmFtZSwKICAgICAgICAgICAgICAgIHBpY191cmw6IGl0ZW0uY292ZXJJbWFnZVgsCiAgICAgICAgICAgICAgICB1cmw6ICQoZW1wdHkgKyAnZnlwYWdlJykucnVsZSgoaWQpID0+IHsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+W/q+eMq+inhumikS5qcycpCiAgICAgICAgICAgICAgICAgICAgcGF0aCA9ICcvYWxidW0vZ2V0QWxidW1WaWRlb0xpc3QnCiAgICAgICAgICAgICAgICAgICAgYm9keSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgImNsaWVudFR5cGUiOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAiYWxidW1JZCI6IGlkLAogICAgICAgICAgICAgICAgICAgICAgICAibGVuZ3RoIjogMjAsCiAgICAgICAgICAgICAgICAgICAgICAgICJwYWdlIjogcGFnZQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBjb25zdCBsaXN0UGljID0gW10KICAgICAgICAgICAgICAgICAgICBjb25zdCBkID0gW10KICAgICAgICAgICAgICAgICAgICBkYXRhID0gY29uZmlnUGFyc2UocGF0aCwgYm9keSkubGlzdDsKICAgICAgICAgICAgICAgICAgICBsYXlvdXRQYXJzZShkLCBkYXRhLCBsaXN0UGljKQogICAgICAgICAgICAgICAgICAgIHNldFJlc3VsdChkKQogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGJlKGxpc3RQaWMpCiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge30KICAgICAgICAgICAgICAgIH0sIGlkKSwKICAgICAgICAgICAgICAgIGNvbF90eXBlOiAncGljXzInLAogICAgICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5pZAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KQogICAgICAgICAgICBsaXN0UGljLnB1c2goewogICAgICAgICAgICAgICAgZnVuYzogKCkgPT4gTG9hZEltYWdlKGl0ZW0uY292ZXJJbWFnZVgsIGl0ZW0uaWQpCiAgICAgICAgICAgIH0pOwogICAgICAgIH0pCiAgICB9IGVsc2UgewogICAgICAgIGQucHVzaCh7CiAgICAgICAgICAgIHRpdGxlOiBTdHlsZSgn6K+l6aG16Z2i5pqC5peg6LWE5rqQJyksCiAgICAgICAgICAgIHVybDogZW1wdHksCiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJywKICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZQogICAgICAgICAgICB9CiAgICAgICAgfSkKICAgIH0KfQoKY29uc3QgZ2V0QWN0b3JMaXN0ID0gKGQsIGRhdGEsIGxpc3RQaWMpID0+IHsKICAgIGlmIChkYXRhLmxlbmd0aCkgewogICAgICAgIGRhdGEuZm9yRWFjaChpdGVtID0+IHsKICAgICAgICAgICAgY29kZSA9IGl0ZW0uaWQKICAgICAgICAgICAgbmljayA9IGl0ZW0ubmFtZQogICAgICAgICAgICBhdmF0YXIgPSBpdGVtLmhlYWRJY28KICAgICAgICAgICAgZC5wdXNoKHsKICAgICAgICAgICAgICAgIHRpdGxlOiBuaWNrLAogICAgICAgICAgICAgICAgcGljX3VybDogYXZhdGFyLAogICAgICAgICAgICAgICAgdXJsOiAkKGVtcHR5ICsgJ2Z5cGFnZScpLnJ1bGUoKGNvZGUpID0+IHsKICAgICAgICAgICAgICAgICAgICByZXF1aXJlKCdoaWtlcjovL2ZpbGVzL3J1bGVzL2pzL+W/q+eMq+inhumikS5qcycpCiAgICAgICAgICAgICAgICAgICAgcGF0aCA9ICcvYWN0b3IvZ2V0QWN0b3JWaWRlb0xpc3QnCiAgICAgICAgICAgICAgICAgICAgYm9keSA9IHsKICAgICAgICAgICAgICAgICAgICAgICAgImNsaWVudFR5cGUiOiA1LAogICAgICAgICAgICAgICAgICAgICAgICAiYWN0b3JJZCI6IGNvZGUsCiAgICAgICAgICAgICAgICAgICAgICAgICJsZW5ndGgiOiAyMCwKICAgICAgICAgICAgICAgICAgICAgICAgInBhZ2UiOiBwYWdlCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGNvbnN0IGxpc3RQaWMgPSBbXQogICAgICAgICAgICAgICAgICAgIGNvbnN0IGQgPSBbXQogICAgICAgICAgICAgICAgICAgIGRhdGEgPSBjb25maWdQYXJzZShwYXRoLCBib2R5KS5saXN0OwogICAgICAgICAgICAgICAgICAgIGxheW91dFBhcnNlKGQsIGRhdGEsIGxpc3RQaWMpCiAgICAgICAgICAgICAgICAgICAgc2V0UmVzdWx0KGQpCiAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAgYmUobGlzdFBpYykKICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fQogICAgICAgICAgICAgICAgfSwgY29kZSksCiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ2ljb25fNScsCiAgICAgICAgICAgICAgICBleHRyYTogewogICAgICAgICAgICAgICAgICAgIGlkOiBpdGVtLmhlYWRJY28KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSkKICAgICAgICAgICAgbGlzdFBpYy5wdXNoKHsKICAgICAgICAgICAgICAgIGZ1bmM6ICgpID0+IExvYWRJbWFnZShpdGVtLmhlYWRJY28sIGl0ZW0uaGVhZEljbykKICAgICAgICAgICAgfSk7CiAgICAgICAgfSkKICAgIH0gZWxzZSB7CiAgICAgICAgZC5wdXNoKHsKICAgICAgICAgICAgdGl0bGU6IFN0eWxlKCfor6XpobXpnaLmmoLml6DotYTmupAnKSwKICAgICAgICAgICAgdXJsOiBlbXB0eSwKICAgICAgICAgICAgY29sX3R5cGU6ICd0ZXh0XzEnLAogICAgICAgICAgICBleHRyYTogewogICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlCiAgICAgICAgICAgIH0KICAgICAgICB9KQogICAgfQp9Cgpjb25zdCBsYXlvdXRQYXJzZSA9IChkLCBkYXRhLCBsaXN0UGljKSA9PiB7CiAgICBpZiAoZGF0YS5sZW5ndGgpIHsKICAgICAgICBkYXRhLmZvckVhY2goaXRlbSA9PiB7CiAgICAgICAgICAgIGlkID0gaXRlbS5pZAogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgdGl0bGU6IGl0ZW0ubmFtZSwKICAgICAgICAgICAgICAgIGRlc2M6IGl0ZW0udGFncywKICAgICAgICAgICAgICAgIHBpY191cmw6IGl0ZW0uY292ZXJJbWdVcmwsCiAgICAgICAgICAgICAgICB1cmw6ICQoZW1wdHkpLmxhenlSdWxlKChpZCkgPT4gewogICAgICAgICAgICAgICAgICAgIE1ZX1BBR0UgPSAxCiAgICAgICAgICAgICAgICAgICAgcmVxdWlyZSgnaGlrZXI6Ly9maWxlcy9ydWxlcy9qcy/lv6vnjKvop4bpopEuanMnKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBnZXRQbGF5ZXJVcmwoaWQpCiAgICAgICAgICAgICAgICB9LCBpZCksCiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ21vdmllXzInLAogICAgICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgICAgICBpZDogaXRlbS5pZAogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KQogICAgICAgICAgICBsaXN0UGljLnB1c2goewogICAgICAgICAgICAgICAgZnVuYzogKCkgPT4gTG9hZEltYWdlKGl0ZW0uY292ZXJJbWdVcmwsIGl0ZW0uaWQpCiAgICAgICAgICAgIH0pOwogICAgICAgIH0pCiAgICB9IGVsc2UgewogICAgICAgIGQucHVzaCh7CiAgICAgICAgICAgIHRpdGxlOiBTdHlsZSgn6K+l6aG16Z2i5pqC5peg6LWE5rqQJyksCiAgICAgICAgICAgIHVybDogZW1wdHksCiAgICAgICAgICAgIGNvbF90eXBlOiAndGV4dF8xJywKICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZQogICAgICAgICAgICB9CiAgICAgICAgfSkKICAgIH0KfQoKY29uc3Qgc2VhcmNoUGFyc2UgPSAoZCwgbGlzdFBpYykgPT4gewogICAgaWYgKHBhZ2UgPT0gMSkgewogICAgICAgIGQucHVzaCh7CiAgICAgICAgICAgIHRpdGxlOiAn8J+UjScsCiAgICAgICAgICAgIHVybDogJC50b1N0cmluZygoZ2V0U2VhcmNoVXJsLCBlbXB0eSkgPT4gewogICAgICAgICAgICAgICAgcHV0TXlWYXIoJ+aQnOe0ouWFs+mUruivjScsIGlucHV0KTsKICAgICAgICAgICAgICAgIGlmIChpbnB1dCAhPSAnJykgZ2V0U2VhcmNoVXJsKGlucHV0KTsKICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7CiAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHk7CiAgICAgICAgICAgIH0sIGdldFNlYXJjaFVybCwgZW1wdHkpLAogICAgICAgICAgICBjb2xfdHlwZTogJ2lucHV0JywKICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgIGRlZmF1bHRWYWx1ZTogZ2V0TXlWYXIoJ+aQnOe0ouWFs+mUruivjScpCiAgICAgICAgICAgIH0KICAgICAgICB9KQogICAgfQogICAgaWYgKGdldE15VmFyKCfmkJzntKLlhbPplK7or40nKSA9PSAnJykgewogICAgICAgIGlmIChwYWdlID09IDEpIHsKICAgICAgICAgICAgbGV0IG1lbSA9IHN0b3JhZ2UwLmdldEl0ZW0oIuW/q+eMq+inhumikSIsIFtdKTsKICAgICAgICAgICAgaWYgKG1lbS5sZW5ndGggPiAwKSB7CiAgICAgICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgICAgIHRpdGxlOiBCKCfwn5OdIOaQnOe0ouWOhuWPsicpLAogICAgICAgICAgICAgICAgICAgIHVybDogJCgiI25vTG9hZGluZyMiKS5sYXp5UnVsZSgoZW1wdHkpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgY29uZmlybSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogIua4hemZpOiusOW9lSIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZW50OiAi56Gu5a6a5aW95LqG5ZCX77yf6K6w5b2V5bCG5Lya5LiN5aSN5a2Y5ZyofiIsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25maXJtOiAoKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xlYXJJdGVtKCLlv6vnjKvop4bpopEiKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvYXN0KCfmuIXpmaTmiJDlip9+Jyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2FuY2VsOiAidG9hc3QoJ+WVin7miJHlkI7mgpTkuoYnKSIKICAgICAgICAgICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGVtcHR5OwogICAgICAgICAgICAgICAgICAgIH0sIGVtcHR5KSwKICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfMScsCiAgICAgICAgICAgICAgICAgICAgZXh0cmE6IHsKICAgICAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgfQogICAgICAgICAgICBmb3IgKGxldCBpID0gbWVtLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSB7CiAgICAgICAgICAgICAgICBsZXQgaXQgPSBtZW1baV07CiAgICAgICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgICAgIHRpdGxlOiBpdCwKICAgICAgICAgICAgICAgICAgICB1cmw6ICQoIiNub0xvYWRpbmcjIikubGF6eVJ1bGUoKGl0LCBlbXB0eSkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcign5pCc57Si5YWz6ZSu6K+NJywgaXQpOwogICAgICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpOwogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZW1wdHk7CiAgICAgICAgICAgICAgICAgICAgfSwgaXQsIGVtcHR5KSwKICAgICAgICAgICAgICAgICAgICBjb2xfdHlwZTogImZsZXhfYnV0dG9uIgogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgfQogICAgICAgICAgICBkLnB1c2goewogICAgICAgICAgICAgICAgdGl0bGU6IEIoJ+KZqO+4jyDng63pl6jmkJzntKInKSwKICAgICAgICAgICAgICAgIHVybDogZW1wdHksCiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3RleHRfMScsCiAgICAgICAgICAgICAgICBleHRyYTogewogICAgICAgICAgICAgICAgICAgIGxpbmVWaXNpYmxlOiBmYWxzZQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KQogICAgICAgICAgICBwYXRoID0gJy9jb21tb24vZ2V0SG90S2V5TGlzdCcKICAgICAgICAgICAgYm9keSA9IHsKICAgICAgICAgICAgICAgICJjbGllbnRUeXBlIjogNSwKICAgICAgICAgICAgICAgICJsZW5ndGgiOiA4CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICAgICAgICAgIGRhdGEuZm9yRWFjaCgoaXRlbSwgaSkgPT4gewogICAgICAgICAgICAgICAga2V5ID0gaXRlbS5rZXkKICAgICAgICAgICAgICAgIGQucHVzaCh7CiAgICAgICAgICAgICAgICAgICAgdGl0bGU6IGtleSwKICAgICAgICAgICAgICAgICAgICBwaWNfdXJsOiAnaHR0cHM6Ly9zaW1nLnMud2VpYm8uY29tLzIwMTcwMzAzX2ltZ19zZWFyY2hfJyArIChpICsgMSkgKyAnLnBuZycsCiAgICAgICAgICAgICAgICAgICAgdXJsOiAkKCIjbm9Mb2FkaW5nIyIpLmxhenlSdWxlKChrZXksIGdldFNlYXJjaFVybCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICBwdXRNeVZhcigi5pCc57Si5YWz6ZSu6K+NIiwga2V5KTsKICAgICAgICAgICAgICAgICAgICAgICAgZ2V0U2VhcmNoVXJsKGtleSk7CiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCkKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICJoaWtlcjovL2VtcHR5IjsKICAgICAgICAgICAgICAgICAgICB9LCBrZXksIGdldFNlYXJjaFVybCksCiAgICAgICAgICAgICAgICAgICAgY29sX3R5cGU6ICdhdmF0YXInCiAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICB9KQogICAgICAgIH0KICAgIH0gZWxzZSB7CiAgICAgICAgcGF0aCA9ICcvdmlkZW8vZ2V0TGlzdCcKICAgICAgICBib2R5ID0gewogICAgICAgICAgICAiY2xpZW50VHlwZSI6IDUsCiAgICAgICAgICAgICJsZW5ndGgiOiAyMCwKICAgICAgICAgICAgInBhZ2UiOiBwYWdlLAogICAgICAgICAgICAic2VhcmNoVGV4dCI6IGdldE15VmFyKCfmkJzntKLlhbPplK7or40nKSwKICAgICAgICAgICAgInR5cGUiOiAxLAogICAgICAgICAgICAib3JkZXJUZXh0IjogW3sKICAgICAgICAgICAgICAgICJkaXIiOiAiZGVzYyIsCiAgICAgICAgICAgICAgICAiY29sdW1uIjogImFkZFRpbWVTdGFtcCIKICAgICAgICAgICAgfV0KICAgICAgICB9CiAgICAgICAgZGF0YSA9IGNvbmZpZ1BhcnNlKHBhdGgsIGJvZHkpLmxpc3Q7CiAgICAgICAgbGF5b3V0UGFyc2UoZCwgZGF0YSwgbGlzdFBpYykKICAgIH0KfQ==
Add Comment
Please, Sign In to add comment