xiaomianao666

插件名:global_AC-baidu-重定向优化百度搜狗谷歌必应搜索-favicon

Oct 31st, 2024
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_AC-baidu-重定向优化百度搜狗谷歌必应搜索-favicon@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgQUMtYmFpZHUt6YeN5a6a5ZCR5LyY5YyW55m+5bqm5pCc54uX6LC35q2M5b+F5bqU5pCc57SiX2Zhdmljb25f5Y+M5YiXCi8vIEBuYW1lOmVuICAgIEFDLWJhaWR1LWdvb2dsZV9zb2dvdV9iaW5nX1JlZGlyZWN0UmVtb3ZlX2Zhdmljb25fYWRhd2F5X1R3b0xpbmUKLy8gQG5hbWU6emggICAgQUMtYmFpZHUt6YeN5a6a5ZCR5LyY5YyW55m+5bqm5pCc54uX6LC35q2M5b+F5bqU5pCc57SiX2Zhdmljb25f5Y+M5YiXCi8vIEBuYW1lOmphICAgIEFDLWJhaWR1LemHjeWumuWQkeacgOmBqeWMlkJhaWR144Gu5pCc54uX44GuR29vZ2xl44GuQmluZ+aknOe0oue1kOaenOOBruODquODgOOCpOODrOOCr+ODiOmZpOWOuytmYXZpY29uCi8vIEBkZXNjcmlwdGlvbiAgMS7nuZ7pgY7nmb7luqbjgIHmkJzni5fjgIHosLfmrYzjgIHlpb3mkJzmkJzntKLntZDmnpzkuK3nmoToh6rlt7HnmoTot7PovYnpj4jmjqXvvIznm7TmjqXoqKrllY/ljp/lp4vntrLpoIEt5Y+N5q2j6YO96IO955yL5oeCIDIu5paw5aKe6Ieq5a6a5LmJ572R56uZ5oum5oiq5Yqf6IO9IDPmt7vliqBGYXZpY29u5pi+56S6IDQu6aG16Z2iQ1NTIDUu5re75Yqg6K6h5pWwIDYu5byA5YWz6YCJ5oup5Lul5LiK5Yqf6IO9IDcu6Ieq5Yqo57+76aG15Yqf6IO9Ci8vIEBkZXNjcmlwdGlvbjplb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VFOCVCMCVCNyVFNiVBRCU4QyVFNSVCRiU4NSVFNSVCQSU5NCVFNiU5MCU5QyVFNyVCNCVBMl9mYXZpY29uXyVFNSU4RiU4QyVFNSU4OCU5Ny5tZXRhLmpzCi8vID09L1VzZXJTY3JpcHQ9PQp+KGFzeW5jICgpID0+IHsKICBPYmplY3QuZGVmaW5lUHJvcGVydHkoY29uc29sZSwgJ215bG9nJywgewogICAgdmFsdWU6IGZ1bmN0aW9uKCkgewogICAgICBpZihDT05TVCAmJiBDT05TVC5jdXJDb25maWcpIHsKICAgICAgICBpZihDT05TVC5jdXJDb25maWcuaXNEZXZNb2RlKSB7CiAgICAgICAgICBjb25zdCBlcnJvciA9IG5ldyBFcnJvcigpOwogICAgICAgICAgY29uc3Qgc3RhY2tUcmFjZSA9IGVycm9yLnN0YWNrLnNwbGl0KCdcbicpWzJdLnRyaW0oKTsgLy8g6I635Y+W6LCD55So5qCI5L+h5oGvCiAgICAgICAgICB0cnl7CiAgICAgICAgICAgIGNvbnN0IFt0YXJnZXRMaW5rXSA9IC9jaHJvbWUtZXh0ZW5zaW9uOlwvXC8oLiopLy5leGVjKHN0YWNrVHJhY2UpIC8vIOaPkOWPluaWh+S7tuWQjeWSjOihjOWPtwogICAgICAgICAgICBjb25zdCBkYXRhID0gWy4uLmFyZ3VtZW50c10uam9pbignICcpLnBhZEVuZCg2MCwgJyAnKQogICAgICAgICAgICBjb25zb2xlLmxvZyhkYXRhLCBgXHRcdCAke3RhcmdldExpbmt9YCk7IC8vIOe7k+WQiOiHquWumuS5iei+k+WHuuWSjOiwg+eUqOagiOS/oeaBrwogICAgICAgICAgfWNhdGNoIChlKXsKICAgICAgICAgICAgLy8gY29uc29sZS5lcnJvcihlcnJvci5zdGFjaykKICAgICAgICAgICAgY29uc29sZS5sb2coJ1tsb2ddIC0nLCAuLi5hcmd1bWVudHMpOyAvLyDlpoLmnpzmsqHmnInljLnphY3liLDmlofku7blkI3lkozooYzlj7fvvIzliJnlj6rovpPlh7roh6rlrprkuYnkv6Hmga8KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgY29uc29sZS5sb2cuYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgfQogICAgfSwKICB9KQoKICBjb25zdCB7IHJlYWN0aXZlLCB3YXRjaCB9ID0gVnVlOwogIGNvbnN0IE15QXBpID0gKCgpID0+IHsKICAgIC8qKgogICAgICogQHBhcmFtIGNzc1RleHQgQ1NT55qE5YaF5a6577yM5aaC5p6c5pivbGVzc+eahOivne+8jOmcgOimgee8luivkeWQjueahAogICAgICogQHBhcmFtIGNsYXNzTmFtZSDmlrDlop7nmoTnsbvlkI3vvIzmiJbogIXmmK/kuIDloIbnsbvlkI3vvIjnqbrmoLzpmpTlvIDvvIkKICAgICAqLwogICAgZnVuY3Rpb24gYWRkU3R5bGUoY3NzVGV4dCwgY2xhc3NOYW1lID0gJycpeyAvLyDmt7vliqBDU1Pku6PnoIHvvIzkuI3ogIPomZHmlofmnKzovb3lhaXml7bpl7TvvIzluKbmnIljbGFzc05hbWUKICAgICAgaWYoY2xhc3NOYW1lKSB7CiAgICAgICAgY29uc3Qgc2VsZWN0b3JOYW1lID0gKCcgJyArIGNsYXNzTmFtZSkuc3BsaXQoJyAnKS5qb2luKCcuJykKICAgICAgICAKICAgICAgICBsZXQgb2xkTm9kZSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3Ioc2VsZWN0b3JOYW1lKQogICAgICAgIGlmKCFvbGROb2RlKSB7CiAgICAgICAgICBvbGROb2RlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic3R5bGUiKTsKICAgICAgICAgIG9sZE5vZGUuY2xhc3NOYW1lID0gY2xhc3NOYW1lOwogICAgICAgICAgTXlBcGkuc2FmZUZ1bmMoKCkgPT4gewogICAgICAgICAgICBkb2N1bWVudC5jaGlsZHJlblswXS5hcHBlbmRDaGlsZChvbGROb2RlKTsKICAgICAgICAgIH0pCiAgICAgICA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gICAgfQoKICAgICAgYXN5bmMgZnVuY3Rpb24gbWFpblJ1bkZ1bmMoKSB7CiAgICAgICAgaWYgKGNvdW50LS0gPCAwKSB7CiAgICAgICAgICBjbGVhcklkKCkKICAgICAgICAgIGVyckNhbGxiYWNrICYmIGVyckNhbGxiYWNrKCkKICAgICAgICB9CgogICAgICAgIGlmICgodHlwZW9mIChzZWxlY3RvcikgPT0gInN0cmluZyIpKSB7CiAgICAgICAgICByZXR1cm4gYXdhaXQgc3RyUnVuKCkKICAgICAgICB9IGVsc2UgaWYgKHR5cGVvZiAoc2VsZWN0b3IpID09PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgICByZXR1cm4gYXdhaXQgZnVuY1J1bigpCiAgICAgICAgfQogICAgICB9CgogICAgICBmdW5jdGlvbiBjbGVhcklkKCkgewogICAgICAgIGlmICh0X2lkKSBjbGVhckludGVydmFsKHRfaWQpCiAgICAgIH0KICAgIH0KCiAgICAvKioKICAgICAqIOaPkOWPllVSTOWPguaVsOaVsOaNrgogICAgICogQHBhcmFtIGF0dHJpYnV0ZSDlj4LmlbBLZXkKICAgICAqIEBwYXJhbSBuZWVkRGVjb2RlIOaYr+WQpumcgOimgeino+egge+8jOm7mOiupOino+eggQogICAgICogQHBhcmFtIGJhc2VVcmwg6buY6K6k572R5Z2A5p2l5rqQCiAgICAgKiBAcmV0dXJucyB7c3RyaW5nfSDlj5jph4/nu5PmnpxWYWx1ZQogICAgICovCiAgICBmdW5jdGlvbiBnZXRVcmxBdHRyaWJ1dGUoYmFzZVVybCA9IGxvY2F0aW9uLmhyZWYsIGF0dHJpYnV0ZSwgbmVlZERlY29kZSA9IHRydWUpewogICAgICBjb25zdCBbLCBzZWFyY2ggPSAnJ10gPSBiYXNlVXJsLnNwbGl0KCI/Iik7CiAgICAgIHZhciBzZWFyY2hWYWx1ZSA9IHNlYXJjaC5zcGxpdCgiJiIpOwogICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHNlYXJjaFZhbHVlLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgdmFyIGtleV92YWx1ZSA9IHNlYXJjaFZhbHVlW2ldLnNwbGl0KCI9Iik7CiAgICAgICAgdmFyIHJlZyA9IG5ldyBSZWdFeHAoIl4iK2F0dHJpYnV0ZSsiJCIpOwogICAgICAgIGlmIChyZWcudGVzdChrZXlfdmFsdWVbMF0pKSB7CiAgICAgICAgICB2YXIgc2VhcmNoV29yZHMgPSBrZXlfdmFsdWVbMV07CiAgICAgICAgICByZXR1cm4gbmVlZERlY29kZT9kZWNvZGVVUklDb21wb25lbnQoc2VhcmNoV29yZHMpOnNlYXJjaFdvcmRzOwogICAgICAgIH0KICAgICAgfQogICAgfQoKICAgIGNvbnN0IGh0dHAgPSB7CiAgICAgIGFzeW5jIGdldCh1cmwpIHsKICAgICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4gewogICAgICAgICAgY29uc3QgdGltZW91dCA9IDEwMDAwCiAgICAgICAgICBHTV94bWxodHRwUmVxdWVzdCh7CiAgICAgICAgICAgIHVybCwKICAgICAgICAgICAgZmV0Y2g6IHRydWUsCiAgICAgICAgICAgIG1ldGhvZDogJ0dFVCcsCiAgICAgICAgICAgIHRpbWVvdXQ6IHRpbWVvdXQsCiAgICAgICAgICAgIG9ubG9hZDogcmVzcCA9PiB7CiAgICAgICAgICAgICAgcmVzb2x2ZShbbnVsbCwgcmVzcC5yZXNwb25zZVRleHQsIHJlc3AucmVzcG9uc2VIZWFkZXJzXSkKICAgICAgICAgICAgfSwKICAgICAgICAgICAgb25lcnJvcjogcmVzcCA9PiB7CiAgICAgICAgICAgICAgcmVqZWN0KFtyZXNwLCAnJywge31dKQogICAgICAgICAgICB9CiAgICAgICAgICB9KQogICAgICAgIH0pCiAgICAgIH0sCiAgICAgIGFzeW5jIHBvc3QodXJsLCBkYXRhKSB7CiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKChyZXNvbHZlLCByZWplY3QpID0+IHsKICAgICAgICAgIEdNX3htbGh0dHBSZXF1ZXN0KHsKICAgICAgICAgICAgdXJsLAogICAgICAgICAgICBkYXRhLAogICAgICAgICAgICBtZXRob2Q6ICdQT1NUJywKICAgICAgICAgICAgdGltZW91dDogMTAwMDAsCiAgICAgICAgICAgIG9ubG9hZDogcmVzcCA9PiByZXNvbHZlKFtudWxsLCByZXNwLnJlc3BvbnNlVGV4dCwgcmVzcC5yZXNwb25zZUhlYWRlcnNdKSwKICAgICAgICAgICAgb25lcnJvcjogcmVzcCA9PiByZWplY3QoW3Jlc3AsIHt9XSkKICAgICAgICAgIH0pCiAgICAgICAgfSkKICAgICAgfQogICAgfQoKICAgIC8qKgogICAgICog562J5b6F5aSa5LmF5ZCO77yM6YeN5paw5Yqg6L29572R6aG1CiAgICAgKiBAcGFyYW0gdGltZW91dAogICAgICovCiAgICBjb25zdCByZWZyZXNoQWZ0ZXIgPSAoKSA9PiB7CiAgICAgIGxldCBpZCA9IG51bGwKICAgICAgcmV0dXJuICh0aW1lb3V0KSA9PiB7CiAgICAgICAgY2xlYXJUaW1lb3V0KGlkKQogICAgICAgIGlkID0gc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgICBsb2NhdGlvbi5yZWxvYWQoKQogICAgICAgIH0sIHRpbWVvdXQpCiAgICAgIH0KICAgIH0KCiAgICAvKioKICAgICAqIOetieW+heWkmuWwkW1z5ZCO5omn6KGMCiAgICAgKiBAcGFyYW0gbXMg5q+r56eSCiAgICAgKiBAcmV0dXJucyB7UHJvbWlzZTx1bmtub3duPn0KICAgICAqLwogICAgY29uc3Qgd2FpdFRpbWUgPSAobXMpID0+IHsKICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKHJlc29sdmUgPT4gewogICAgICAgIHNldFRpbWVvdXQocmVzb2x2ZSwgbXMpOwogICAgICB9KTsKICAgIH0KCiAgICBjb25zdCBkZWJvdW5jZSA9IChmbiwgZGVsYXkpID0+IHsKICAgICAgbGV0IHRpbWVyID0gbnVsbDsKCiAgICAgIHJldHVybiBmdW5jdGlvbiAoKSB7CiAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVyKTsKICAgICAgICB0aW1lciA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgZm4uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICB9LCBkZWxheSk7CiAgICAgIH07CiAgICB9CgogICAgY29uc3QgdGhyb3R0bGUgPSAoZm4sIGRlbGF5KSA9PiB7CiAgICAgIGxldCB0aW1lciA9IG51bGw7CiAgICAgIGxldCBzdGFydFRpbWUgPSBEYXRlLm5vdygpOwoKICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHsKICAgICAgICBjb25zdCBjdXJUaW1lID0gRGF0ZS5ub3coKTsKICAgICAgICBjb25zdCByZW1haW5pbmcgPSBkZWxheSAtIChjdXJUaW1lIC0gc3RhcnRUaW1lKTsKCiAgICAgICAgY2xlYXJUaW1lb3V0KHRpbWVyKTsKCiAgICAgICAgaWYgKHJlbWFpbmluZyA8PSAwKSB7CiAgICAgICAgICBmbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpOwogICAgICAgICAgc3RhcnRUaW1lID0gRGF0ZS5ub3coKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgdGltZXIgPSBzZXRUaW1lb3V0KCgpID0+IHsKICAgICAgICAgICAgZm4uYXBwbHkodGhpcywgYXJndW1lbnRzKTsKICAgICAgICAgICAgc3RhcnRUaW1lID0gRGF0ZS5ub3coKTsKICAgICAgICAgIH0sIHJlbWFpbmluZyk7CiAgICAgICAgfQogICAgICB9OwogICAgfQoKICAgIC8qKgogICAgICoKICAgICAqIEBwYXJhbSBjYWxsYmFjayDlm57osIPlh73mlbAKICAgICAqIEBwYXJhbSB0aW1lb3V0IOWumuaXtuWRqOacnwogICAgICogQHBhcmFtIG11c3RXYWl0RW5kIOW/hemhu+etieW+heS4iuasoeaJp+ihjOe7k+adn++8n3RydWUgPSDnrYnlvoXvvJtmYWxzZT3moIflh4ZJ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VlbmQKICAgICAgICAgIHJlcGxhY2VFOiAnLy9kaXZbQGlkPSJuYXZjbnQiXSB8IC8vZGl2W0BpZD0icmNudCJdLy9kaXZbQHJvbGU9Im5hdmlnYXRpb24iXScsCiAgICAgICAgfQogICAgICB9CiAgICB9CgogICAgX3NfaGFvc291KCkgewogICAgICBpZiAodGhpcy51c2VJdGVtLlNpdGVUeXBlSUQgPT09IDMpIHt9CiAgICAgIHJldHVybiB7CiAgICAgICAgU2l0ZVR5cGVJRDogMywKICAgICAgICBNYWluVHlwZTogIi5yZXMtbGlzdCIsCiAgICAgICAgU3R5cGVfTm9ybWFsOiAiaDM+YSIsCiAgICAgICAgRmF2aWNvblR5cGU6ICJjaXRlIiwKICAgICAgICBGYXZpY29uQWRkVG86ICJoMyIsCiAgICAgICAgQ291bnRlclR5cGU6ICIucmVzdWx0cz5kaXYiLAogICAgICAgIEJsb2NrVHlwZTogImgzIGEiLAogICAgICAgIC8vIFRPRE8g5aKe5Yqg6L+Z5LiqCiAgICAgICAgTXVsdGlQYWdlVHlwZTogIj8/Pz8/Pz8/IiwgLy8g5aSa5YiX5qih5byP5LiL77yM5b6F6YCJ5oup55qE5YWD57Sg77yM5pyq5p2l5YaN6K+0CiAgICAgICAgcGFnZXI6IHsKICAgICAgICAgIG5leHRMaW5rOiAiLy9kaXZbQGlkPSdwYWdlJ10vL2FbdGV4dCgpPSfkuIvkuIDpobU+J10gfCBpZCgnc25leHQnKSIsCiAgICAgICAgICBwYWdlRWxlbWVudDogIi8vZGl2W0BpZD0nY29udGFpbmVyJ10vZGl2IiwKICAgICAgICAgIEhUX2luc2VydDogWyIvL2RpdltAaWQ9J2NvbnRhaW5lciddIiwgMl0sIC8vIDEgPSBiZWZvcmViZWdpbjsgMiA9IGJlZm9yZWVuZAogICAgICAgICAgcmVwbGFjZUU6ICJpZCgncGFnZScpIgogICAgICAgIH0KICAgICAgfQogICAgfQoKICAgIF9zX2R1Y2tkdWNrZ28oKSB7CiAgICAgIGlmICh0aGlzLnVzZUl0ZW0uU2l0ZVR5cGVJRCA9PT0gMTApe30KICAgICAgcmV0dXJuIHsKICAgICAgICBTaXRlVHlwZUlEOiAxMCwKICAgICAgICBNYWluVHlwZTogIiNyZWFjdC1sYXlvdXQgbGkiLAogICAgICAgIEZhdmljb25UeXBlOiAiLm5ybi1yZWFjdC1kaXYgLnJlc3VsdF9fdXJsX19kb21haW4iLAogICAgICAgIEZhdmljb25BZGRUbzogImgyIiwKICAgICAgICBDb3VudGVyVHlwZTogIiNyZWFjdC1sYXlvdXQgbGkgaDIgYSIsCiAgICAgICAgQmxvY2tUeXBlOiAiaDIgYSIsCiAgICAgICAgTXVsdGlQYWdlVHlwZTogIiNyZWFjdC1sYXlvdXQgLnJlYWN0LXJlc3VsdHMtLW1haW4iLAogICAgICAgIHBhZ2VyOiB7CiAgICAgICAgICBuZXh0TGluazogIi8vYVtjb250YWlucyhAY2xhc3MsXCJzYl9wYWdOXCIpXSIsCiAgICAgICAgICBwYWdlRWxlbWVudDogImlkKFwiYl9yZXN1bHRzXCIpL2xpW25vdChjb250YWlucyhAY2xhc3MsXCJiX3BhZ1wiKSBvciBjb250YWlucyhAY2xhc3MsXCJiX2FucyBiX3RvcFwiKSldIiwKICAgICAgICAgIEhUX2luc2VydDogWyJpZChcImJfcmVzdWx0c1wiKS9saVtAY2xhc3M9XCJiX3BhZ1wiXSIsIDFdLCAvLyAxID0gYmVmb3JlYmVnaW47IDIgPSBiZWZvcmVlbmQKICAgICAgICAgIHJlcGxhY2VFOiAiaWQoXCJiX3Jlc3VsdHNcIikvL25hdltAcm9sZT1cIm5hdmlnYXRpb25cIl0iLAogICAgICAgIH0KICAgICAgfQogICAgfQoKICAgIF9zX2JhaWR1X3h1ZXNodSgpIHsKICAgICAgaWYgKHRoaXMudXNlSXRlbS5TaXRlVHlwZUlEID09PSA4KSB7CiAgICAgICAgY29uc29sZS53YXJuKCflkK/liqjnmb7luqblrabmnK/nibnmrororr7nva4nKQogICAgICAgIHRoaXM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S4gOaooeS4gOagt++8jOmCo+S5iOi3s+i/hwogICAgICBpZiAodGhpcy5jc3NJbnNlcnRTZXRbdW5pcXVlTmFtZV0gJiYgdGhpcy5jc3NJbnNlcnRTZXRbdW5pcXVlTmFtZV0gPT09IGNzc1RleHQpIHsKICAgICAgICByZXR1cm4KICAgICAgfQogICAgICBjb25zb2xlLm15bG9nKCctLS0+5o+S5YWl5qC35byP6KGoOicgKyB1bmlxdWVOYW1lKQogICAgICB0aGlzLmNzc0luc2VydFNldFt1bmlxdWVOYW1lXSA9IGBcbi8qKioqKioqKioqKioke3VuaXF1ZU5hbWV9KioqKioqKioqL1xuYCArIGNzc1RleHQKICAgICAgdGhpcy5oYXNDaGFuZ2VkID0gdHJ1ZQogICAgfQoKICAgIGNsZWFyKCkgewogICAgICB0aGlzLmNzc0luc2VydFNldCA9IHt9CiAgICAgIHRoaXMuaGFzQ2hhbmdlZCA9IHRydWUKICAgIH0KCiAgICBkb0luc2VydCgpIHsKICAgICAgY29uc3QgY3NzVGV4dCA9IE9iamVjdC52YWx1ZXModGhpcy5jc3NJbnNlcnRTZXQpLmpvaW4oJ1xuJykKICAgICAgTXlBcGkuYWRkU3R5bGUoY3NzVGV4dCwgT2JqZWN0LmtleXModGhpcy5jc3NJbnNlcnRTZXQpLmpvaW4oJyAnKSkgLy8g5pa55L6/5o6S5p+lY3Nz5o+S5YWlCiAgICAgIGNvbnNvbGUubXlsb2coJ+aPkuWFpUNTU+WujOaIkCcpCiAgICB9CiAgfQogIGNsYXNzIEFDR00gewogICAgY29uc3RydWN0b3IoKSB7CiAgICAgIHRoaXMuaW5pdEdNKCkKICAgICAgdGhpcy5iaW5kR00oKQogICAgfQoKICAgIGFzeW5jIGluaXRBQ0dNKCkgewogICAgICBsZXQgQUNDb25maWcgPSB7fQogICAgICB0aGlzLmJsb2NrUnVsZUxpc3QgPSBbXQogICAgICBjb25zdCBEZWZhdWx0Q29uZmlnID0gewogICAgICAgIGNvbW1vbjogewogICAgICAgICAga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ICAgICAgaXNBTGluZURpc2FibGU6IGZhbHNlLCAvLyDmmK/lkKbnpoHmraLkuIvliJLnur8KICAgICAgICAgIGlzRGFya01vZGVFbmFibGU6IGZhbHNlLCAvLyDmmK/lkKbliqDovb3mmpfpu5HmqKHlvI8KCiAgICAgICAgICAuLi5uZXcgQmFzZUNvbmZpZyhmYWxzZSkKICAgICAgICB9LAogICAgICAgIGJhaWR1OiB7CiAgICAgICAgICBkb1JlbW92ZVN1ZzogdHJ1ZSwgLy8g5Yig6Zmk56e75Yqo6aKE5rWLCiAgICAgICAgICBkb1JlbW92ZUFJR2VuOiBmYWxzZSwgLy8g56e76Zmk55m+5bqmQUnmkJzntKLnu5PmnpwKICAgICAgICAgIGJhaWR1TGl0ZUVuYWJsZTogZmFsc2UsIC8vIOWQr+eUqOeZvuW6pkxpdGXmoLflvI/ooagKICAgICAgICAgIC4uLm5ldyBCYXNlQ29uZmlnKCkKICAgICAgICB9LAogICAgICAgIGdvb2dsZTogewogICAgICAgICAgdXNlQmFpZHVMb2dvOiBmYWxzZSwgLy8g6buY6K6k5LiN5L2/55So55m+5bqmbG9nbwogICAgICAgICAgLi4ubmV3IEJhc2VDb25maWcoKQogICAgICAgIH0sCiAgICAgICAgYmluZzogewogICAgICAgICAgb3B0aW1pemVCaW5nOiB0cnVlLAogICAgICAgICAgLi4ubmV3IEJhc2VDb25maWcoKQogICAgICAgIH0sCiAgICAgICAgZHVja2R1Y2tnbzogewogICAgICAgICAgb3B0aW1pemVEdWNrRHVja0dvOiB0cnVlLCAvLyDmmK/lkKblvIDlkK/kvJjljJYKICAgICAgICAgIC4uLm5ldyBCYXNlQ29uZmlnKCkKICAgICAgICB9CiAgICAgIH07CiAgICAgIHRyeSB7CiAgICAgICAgbGV0IHJlcyA9IGF3YWl0IEdNLmdldFZhbHVlKCJBQ0NvbmZpZyIsICJ7fSIpCiAgICAgICAgQUNDb25maWcgPSBKU09OLnBhcnNlKHJlcyk7CgogICAgICAgIHJlcyA9IGF3YWl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KGFSZXNvdXJjZU5hbWUsIHJlcyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gc2F2ZVJlczsKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiByZXM7CiAgICAgICAgfQogICAgICB9CiAgICB9CgogICAgYmluZEdNKCkgewogICAgICBHTV9yZWdpc3Rlck1lbnVDb21tYW5kKCdBQy3ph43lrprlkJHohJrmnKzorr7nva4nLCBmdW5jdGlvbigpIHsKICAgICAgICB3aW5kb3cub3BlbihDT05TVC5vcGVuU2VldGluZ3NVcmwpCiAgICAgIH0pOwogICAgICBHTV9yZWdpc3Rlck1lbnVDb21tYW5kKCfohJrmnKzph43nva4gLSDkv67lpI3ohJrmnKwnLCBmdW5jdGlvbigpIHsKICAgICAgICBHTS5zZXRWYWx1ZSgnQUNDb25maWcnLCAne30nKTsKICAgICAgICBsb2NhdGlvbi5yZWxvYWQoKTsKICAgICAgfSk7CiAgICB9CgogICAgY2hlY2s5MGRhb0Nvbm4oKSB7CiAgICAgIGNvbnN0IHN0b3JlVmFsdWUgPSBzZXNzaW9uU3RvcmFnZS5nZXRJdGVtKCdhY2Nlc3NfOTBkYW8nKQogICAgICB0aGlzLm9wZW5TZWV0aW5nc1VybCA9IHN0b3JlVmFsdWUgfHwgJ2h0dHBzOi8vYWMtYmFpZHUudHVqaWR1LmNvbS9wYWdlcy9jdXN0b20vIycgKyBDT05TVC5vcHRpb25zLnNpdGVOYW1lCiAgICAgIAogICAgICBpZiAoIXN0b3JlVmFsdWUpIHsKICAgICAgICBjb25zb2xlLmxvZygn55uu5YmN5LiN5a2Y5ZyoJykKICAgICAgICBHTV94bWxodHRwUmVxdWVzdCh7CiAgICAgICAgICBtZXRob2Q6ICJIRUFEIiwKICAgICAgICAgIHRpbWVvdXQ6IDMwMDAsCiAgICAgICAgICB1cmw6ICJodHRwczovL2FjLWJhaWR1LjkwZGFvLmNvbS8iLAogICAgICAgICAgb25sb2FkOiAoKT0+IHsKICAgICAgICA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c29sZS5teWxvZygnYWRkSW50ZXJ2YWxUcmlnZ2VyJywgc2l0ZSwgIi0tLS0tLS0tLS0tLSIsIHRoaXMub3B0aW9ucy5zaXRlTmFtZSkKICAgICAgaWYoc2l0ZSAhPT0gJ2FsbCcgJiYgdGhpcy5vcHRpb25zLnNpdGVOYW1lICE9PSBzaXRlKSByZXR1cm4KCiAgICAgIGxldCBjb3VudCA9IHJ1blRpbWVzCiAgICAgIGNvbnN0IGludElkID0gTXlBcGkuc2V0SW50ZXJ2YWxSdW4oYXN5bmMgKCkgPT4gewogICAgICAgIGNvdW50LS0KICAgICAgICBpZigKICAgICAgICAgICEoKHdhaXRBdCA9PT0gJ25vdycpIHx8CiAgICAgICAgICAgICh3YWl0QXQgPT09ICdib2R5JyAmJiAhdGhpcy5sb2NrLmJvZHlMb2NrZWQpIHx8CiAgICAgICAgICAgICh3YWl0QXQgPT09ICdoZWFkJyAmJiAhdGhpcy5sb2NrLmhlYWRMb2NrZWQpKQogICAgICAgICkgewogICAgICAgICAgcmV0dXJuCiAgICAgICAgfQogICAgICAgIGlmKGNvdW50ID49IDApIHsKICAgICAgICAgIGF3YWl0IGNhbGxiYWNrKGNvdW50KQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICBjbGVhckludGVydmFsKGludElkKQogICAgICAgIH0KICAgICAgfSwgaW50ZXJ2YWxfdGltZSkKICAgIH0KCiAgICBhY3B1c2hfYWNyZW1vdmVJbml0KCkgewogICAgICBmdW5jdGlvbiBhY3B1c2goZGF0YSA9ICIiKSB7CiAgICAgICAgdGhpcy5oYXNFZGl0ID0gdHJ1ZQogICAgICAgIGRhdGEgPSBkYXRhLnRyaW0oKQogICAgICAgIC8vIOWmguaenOaYr+Weg+WcvuaVsOaNru+8jOmCo+S5iOWPr+S7peS4ouW8g+eahAogICAgICAgIGlmICghZGF0YSkgcmV0dXJuICfml6DmlYjlhoXlrrknOwogICAgICAgIC8vIOWmguaenOaVsOaNruS4reacieWbnui9pu+8jOmCo+aVs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ICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG5vZGVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICBsZXQgY3VyTm9kZSA9IG5vZGVzW2ldOwogICAgICAgICAgTXlBcGkuc2FmZUZ1bmMoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgIGxldCBjdXJEYXRhID0gSlNPTi5wYXJzZShjdXJOb2RlLmRhdGFzZXQubG9nLnJlcGxhY2UoLycvZ20sICJcIiIpKTsKICAgICAgICAgICAgbGV0IHRydWVMaW5rID0gY3VyRGF0YS5tdTsKICAgICAgICAgICAgY3VyTm9kZS5xdWVyeVNlbGVjdG9yKCJhcnRpY2xlIikuc2V0QXR0cmlidXRlKCJybC1saW5rLWhyZWYiLCB0cnVlTGluayk7CiAgICAgICAgICAgIGN1ck5vZGUucXVlcnlTZWxlY3RvckFsbCgiYSIpLmZvckVhY2goZnVuY3Rpb24ocGVyKSB7CiAgICAgICAgICAgICAgcGVyLnNldEF0dHJpYnV0ZSgiaHJlZiIsIHRydWVMaW5rKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgICB9KTsKICAgICAgICAgIGN1ck5vZGUuc2V0QXR0cmlidXRlKCJhY19yZWRpcmVjdFN0YXR1cyIsICIxIik7CiAgICAgICAgfQogICAgICB9CgogICAgICBmdW5jdGlvbiByZW1vdmVPbk1vdXNlRG93bkZ1bmMoKSB7CiAgICAgICAgTXlBcGkuc2FmZUZ1bmMoKCkgPT4gewogICAgICAgICAgbGV0IHJlc3VsdE5vZGVzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiLmcgLnJjIGEsICNycywgI3JzbyAuZyBhIik7CiAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHJlc3VsdE5vZGVzLmxlbmd0aDsgaSsrKSB7CiAgICAgICAgICAgIGxldCBvbmUgPSByZXN1bHROb2Rlc1tpXTsKICAgICAgICAgICAgb25lLnNldEF0dHJpYnV0ZSgib25tb3VzZWRvd24iLCAiIik7IC8vIOiwt+atjOWOu+mHjeWumuWQkeW5suaJsAogICAgICAgICAgICBvbmUuc2V0QXR0cmlidXRlKCJ0YXJnZXQiLCAiX2JsYW5rIik7IC8vIOiwt+atjOmTvuaOpeaWsOagh+etvuaJk+W8gAogICAgICAgICAgICBvbmUuc2V0QXR0cmlidXRlKCJkYXRhLWpzYXJ3dCIsICIwIik7IC8vIEZpcmVmb3josLfmrYzljrvph43lrprlkJHlubLmibAKICAgICAgICAgIH0KICAgICAgICB9KQogICAgICB9CgogICAgICBmdW5jdGlvbiByZW1vdmVfeHVlc2h1QmFpZHUoKSB7CiAgICAgICAgaWYgKENPTlNULm9wdGlvbnMudXNlSXRlbS5TaXRlVHlwZUlEID09PSBDT05TVC5vcHRpb25zLmJhaWR1X3h1ZXNodS5TaXRlVHlwZUlEKSB7CiAgICAgICAgICBsZXQgeG5vZGVzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiYVtocmVmKj0nc2NfdnVybD1odHRwJ10iKTsKICAgICAgICAgIGZvciAobGV0IGogPSAwOyBqIDwgeG5vZGVzLmxlbmd0aDsgaisrKSB7CiAgICAgICAgICAgIGxldCB4dXJsID0gTXlBcGkuZ2V0VXJsQXR0cmlidXRlKHhub2Rlc1tqXS5ocmVmLCAic2NfdnVybCIsIHRydWUpOwogICAgICAgICAgICB4bm9kZXNbal0uaHJlZiA9IHh1cmw7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CgogICAgICBmdW5jdGlvbiBEZWFsUmVkaXJlY3QgKHJlcXVlc3QsIGN1ck5vZGVIcmVmLCByZXNwVGV4dCwgUmVnVGV4dCwgaHJlZlR5cGUpIHsKICAgICAgICBpZiAocmVzcFRleHQgPT09IG51bGwgfHwgdHlwZW9mIChyZXNwVGV4dCkgPT09ICJ1bmRlZmluZWQiKSByZXR1cm47CiAgICAgICAgbGV0IHJlc3VsdFJlc3BvbnNlVXJsID0gIiI7CiAgICAgICAgaWYgKFJlZ1RleHQgIT0gbn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oYXNEZWFsSHJlZlNldC5zaXplOwogICAgICAgICAgICBpZiAobGVuMSA9PT0gbGVuMikgY29udGludWU7IC8vIOivtOaYjuaVsOaNruW3sue7j+WkhOeQhui/h++8jOWtmOWcqOebuOWQjOeahOiusOW9lQogICAgICAgICAgICBjb25zdCBpc0xpbmtOZWVkRGVhbCA9ICgpID0+IHsKICAgICAgICAgICAgICAvLyDlpoLmnpzlvZPliY3oioLngrnlrZjlnKhtdeWPguaVsO+8jOaIluiAhWxpbmvoioLngrnlrZjlnKhkYXRhLW1kdXJs77yM6YKj5LmI5bCx566X55u05o6l5oiQ5Yqf77yM5LiN55So6YeN5paw6K+35rGC5LiA6YGN5LqGCiAgICAgICAgICAgICAgbGV0IHRydWVMaW5rID0gY3VyTm9kZS5nZXRBdHRyaWJ1dGUoJ211JykgfHwgbGlua05vZGUuZ2V0QXR0cmlidXRlKCdkYXRhLW1kdXJsJykKICAgICAgICAgICAgICBpZih0cnVlTGluayAmJiAhdHJ1ZUxpbmsuaW5jbHVkZXMoJ25vdXJsJykpIHsKICAgICAgICAgICAgICAgIHRydWVMaW5rID0gZ2V0QmFpZHVFbmNvZGluZ0hhbmRsZSh0cnVlTGluaykKICAgICAgICAgICAgICAgIERlYWxSZWRpcmVjdChudWxsLCBsaW5rSHJlZiwgdHJ1ZUxpbmspOwogICAgICAgICAgICAgICAgcmV0dXJuIHRydWUKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgY29uc3QgZ2V0QmFpZHVFbmNvZGluZ0hhbmRsZSA9IChsaW5rVXJsKSA9PiB7CiAgICAgICAgICAgICAgbGV0IHJlc0xpbmsgPSBsaW5rVXJsCiAgICAgICAgICAgICAgaWYoQ09OU1Qub3B0aW9ucy51c2VJdGVtLlNpdGVUeXBlSUQgPT09IENPTlNULm9wdGlvbnMuYmFpZHUuU2l0ZVR5cGVJRCAmJiBsaW5rVXJsLmluY2x1ZGVzKCdiYWlkdS5jb20nKSkgewogICAgICAgICAgICAgICAgY29uc3QgWywgZmlyc3QgPSAnJ10gPSAvKGllPVteJl0rKS8uZXhlYyhsb2NhdGlvbi5zZWFyY2gpIHx8IFtdCiAgICAgICAgICAgICAgICByZXNMaW5rID0gbGlua1VybC5yZXBsYWNlKC8oaWU9W14mXSspLywgZmlyc3QpCiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHJldHVybiByZXNMaW5rCiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYoIWlzTGlua05lZWREZWFsKCkpIHsKICAgICAgICAgICAgICBjb250aW51ZQogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vIOi1sOaOpeWPo+mHjeWumuWQkeWkhOeQhgogICAgICAgICAgICBpZiAobGlua0hyZWYuaW5jbHVkZXMoInd3dy5iYWlkdS5jb20vbGluayIpIHx8CiAgICAgICAgICAgICAgbGlua0hyZWYuaW5jbHVkZXMoIm0uYmFpZHUuY29tL2Zyb20iKSB8fAogICAgICAgICAgICAgIGxpbmtIcmVmLmluY2x1ZGVzKCJ3d3cuc29nb3UuY29tL2xpbmsiKSB8fAogICAgICAgICAgICAgIGxpbmtIcmVmLmluY2x1ZGVzKCJzby5jb20vbGluayIpIHx8CiAgICAgICAgICAgICAgbGlua0hyZWYuc2VhcmNoKCJiaW5nLmNvbS8oY2t8YXxhY2xpY2spIikgPiAwIHx8CiAgICAgICAgICAgICAgbGlua0hyZWYuc2VhcmNoKCJlLnNvLmNvbS8oc2VhcmNofGVjbGspIikgPiAwCiAgICAgICAgICAgICkgewogICAgICAgICAgICAgIChhc3luYyBmdW5jdGlvbihjX2N1cm5vZGUsIGNfY3VyaHJlZikgewogICAgICAgICAgICAgICAgbGV0IHVybCA9IGNfY3VyaHJlZi5yZXBsYWNlKC9eaHR0cDovLCAiaHR0cHM6Iik7CiAgICAgICAgICAgICAgICBpZiAoQ09OU1Qub3B0aW9ucy51c2VJdGVtLlNpdGVUeXBlSUQgPT09IENPTlNULm9wdGlvbnMuYmFpZHUuU2l0ZVR5cGVJRCAmJiAhdXJsLmluY2x1ZGVzKCJlcWlkIikpIHsKICAgICAgICAgICAgICAgICAgLy8g5aaC5p6c5piv55m+5bqm77yM5bm25LiU5rKh5pyJ5bim5pyJ6Kej5p6Q5Y+C5pWw77yM6YKj5LmI5omL5Yqo5bim5LiKCiAgICAgICAgICAgICAgICAgIHVybCA9IHVybCArICImd2Q9JmVxaWQ9IjsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBsZXQgZ21SZXF1ZXN0Tm9kZSA9IEdNX3htbGh0dHBSZXF1ZXN0KHsKICAgICAgICAgICAgICAgICAgdXJsOiB1cmwsCiAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHsgIkFjY2VwdCI6ICIqLyoiLCAiUmVmZXJlciI6IGNfY3VyaHJlZi5yZXBsYWNlKC9eaHR0cDovLCAiaHR0cHM6IikgfSwKICAgICAgICAgICAgICAgICAgbWV0aG9kOiAiR0VUIiwKICAgICAgICAgICAgICAgICAgdGltZW91dDogODAwMCwKICAgICAgICAgICAgICAgICAgb25sb2FkOiBmdW5jdGlvbihyZXNwb25zZSkgeyAvLyBNQVJLIOacieaXtuWAmei/meS4quWHveaVsOagueacrOS4jei/m+adpSAtIOiwg+ivleeahOmXrumimCAtIHRpbWVvdXQKICAgICAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2UucmVzcG9uc2VUZXh0IHx8IHJlc3BvbnNlLnJlc3BvbnNlSGVhZGVycykgewogICAgICAgICAgICAgICAgICAgICAgLy8g55Sx5LqO5piv54m55q6K6L+U5ZueLeW5tuS4lOWlveaQnC3mkJzni5ct55m+5bqm6YO95piv6L+Z5Liq5qC85byP77yM5pWF5o+Q5Ye6CiAgICAgICAgICAgICAgICAgICAgICBEZWFsUmVkaXJlY3QoZ21SZXF1ZXN0Tm9kZSwgY19jdXJocmVmLCByZXNwb25zZS5yZXNwb25zZVRleHQsICJVUkw9JyhbXiddKyknIikKICAgICAgICAgICAgICAgICAgICAgIC8vIOi/meS4quaYr+WcqOS4iumdouaXoOazleWkhOeQhueahOaDheWGteS4i++8jOWkh+eUqOeahCB0bS1maW5hbHVybGRoZGcgIHRtLWZpbmFsdXJsbWZkaAoKICAgICAgICAgICAgICAgICAgICAgIGlmIChyZXNwb25zZS5yZXNwb25zZUhlYWRlcnMuaW5jbHVkZXMoInRtLWZpbmFsdXJsIikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlbFVSTCA9IFJlZ19HZXQocmVzcG9uc2UucmVzcG9uc2VIZWFkZXJzLCAidG0tZmluYWx1cmxcXHcrOiAoW15cXHNdKykiKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHJlbFVSTCA9PT0gbnVsbCB8fCByZWxVUkwgPT09ICIiIHx8IHJlbFVSTC5pbmNsdWRlcygid3d3LmJhaWR1LmNvbS9zZWFyY2gvZXJyb3IiKSkgcmV0dXJuOwogICAgICAgICAgICAgICAgICAgICAgICBEZWFsUmVkaXJlY3QoZ21SZXF1ZXN0Tm9kZSwgY19jdXJocmVmLCByZWxVUkwpOwogICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgfSkoY3VyTm9kZSwgbGlua0hyZWYpOyAvL+S8oOmAkuaXp+eahOe9keWdgOi/h+WOu++8jOivu+S9nGNfY3VyaHJlZgogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChoYXNEZWFsSHJlZlNldC5zaXplID4gMCAmJiBtYWluTGlzdC5sZW5ndGggLSBoYXNEZWFsSHJlZlNldC5zaXplID4gMCkgY29uc29sZS5teWxvZygi5Lii5byD5o6JIiwgbWFpbkxpc3QubGVuZ3RoIC0gaGFzRGVhbEhyZWZTZXQuc2l6ZSwgIuS4qumHjeWkjemTvuaOpSIpOwogICAgICB9CiAgICB9CiAgICBnZXRUZXh0SG9zdChzYmVmb3JlKSB7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9ID0gUGFnZUZ1bmMuZ2V0Tm9kZUhvc3QodGFyZ2V0Tm9kZSk7CiAgICAgICAgICAgIGlmICghY3VySG9zdCkgeyAvLyDot7Pov4fop6PkuI3lh7rmnaXnmoTlnLDlnYAKICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgfQogICAgICAgICAgICBsZXQgZmF2aWNvblVybCA9IGN1ckhvc3Q7CiAgICAgICAgICAgIGxldCBJSSA9IDA7CiAgICAgICAgICAgIGZvciAoOyBJSSA8PSA1OyBJSSsrKSB7CiAgICAgICAgICAgICAgdGFyZ2V0Tm9kZSA9IHRhcmdldE5vZGUucGFyZW50Tm9kZTsKICAgICAgICAgICAgICBpZiAodGFyZ2V0Tm9kZSAhPSBudWxsICYmIHRhcmdldE5vZGUucXVlcnlTZWxlY3RvcihDT05TVC5vcHRpb25zLnVzZUl0ZW0uRmF2aWNvbkFkZFRvKSAhPSBudWxsKSB7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYgKHRhcmdldE5vZGUucGFyZW50Tm9kZS5oYXNBdHRyaWJ1dGUoJ3RwbCcpICYmIHRhcmdldE5vZGUucGFyZW50Tm9kZS5nZXRBdHRyaWJ1dGUoJ3RwbCcpLmluY2x1ZGVzKCdzdG9jaycpKSB7CiAgICAgICAgICAgICAgY3VyTm9kZS5zZXRBdHRyaWJ1dGUoImFjX2Zhdmljb25TdGF0dXMiLCAiLTMiKTsKICAgICAgICAgICAgICBjb250aW51ZQogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vY29uc29sZS5teWxvZyhpbmRleCsiLiIrZmF2aWNvblVybCsiLS0iK0lJKTsKICAgICAgICAgICAgaWYgKElJIDw9IDUpIHsKICAgICAgICAgICAgICAvLyDlhYjnlKjniLboioLngrnliKTmlq3kuIDkuIvmmK/lkKblrZjlnKhpbWcKICAgICAgICAgICAgICBsZXQgdG1wSFRNTCA9IHRhcmdldE5vZGUuaW5uZXJIVE1MOwogICAgICAgICAgICAgIGxldCBwb3MgPSB0bXBIVE1MLmluZGV4T2YoImZhdi11cmwiKQogICAgICAgICAgICAgICAgJiB0bXBIVE1MLmluZGV4T2YoIndyX2ZhdiIpCiAgICAgICAgICAgICAgICAmIHRtcEhUTUwuaW5kZXhPZigiZmF2dXJsIikKICAgICAgICAgICAgICAgICYgdG1wSFRNTC5pbmRleE9mKCJ0aXQtaWNvIikKICAgICAgICAgICAgICAgICYgdG1wSFRNTC5pbmRleE9mKCJpbWdfZmF2IHJtc19pbWciKQogICAgICAgICAgICAgICAgJiB0bXBIVE1MLmluZGV4T2YoImMtdG9vbC0iKQogICAgICAgICAgICAgICAgJiB0bXBIVE1MLmluZGV4T2YoInNwYW4gY2xhc3M9XCJjLWljb24gYy1pY29uLSIpCiAgICAgICAgICAgICAgICAmIHRtcEhUTUwuaW5kZXhPZigiaW1nIGNsYXNzPVwieEEzM0djIikKICAgICAgICAgICAgICAgICYgdG1wSFRNTC5pbmRleE9mKCJpbWcgY2xhc3M9XCJYTm81QWJcIiIpOyAvLyDosLfmrYzlm77moIcKICAgICAgICAgICAgICAvL+S7luiHquW3seW3sue7j+WBmuS6hmZhdmljb27kuoYKICAgICAgICAgICAgICBpZiAocG9zID4gLTEpIHsKICAgICAgICAgICAgICAgIGN1ck5vZGUuc2V0QXR0cmlidXRlKCJhY19mYXZpY29uU3RhdHVzIiwgIi0yIik7CiAgICAgICAgICAgICAgICBjb250aW51ZTsKICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgdGFyZ2V0Tm9kZSA9IHRhcmdldE5vZGUucXVlcnlTZWxlY3RvcihDT05TVC5vcHRpb25zLnVzZUl0ZW0uRmF2aWNvbkFkZFRvKTsKICAgICAgICAgICAgICBsZXQgaG9zdCA9IGZhdmljb25VcmwucmVwbGFjZSgvW14uXStcLihbXi5dKylcLihbXi5dKykvLCAiJDEuJDIiKTsKCiAgICAgICAgICAgICAgaWYgKCF0YXJnZXROb2RlLmhhc0F0dHJpYnV0ZSgiZGF0YS1mYXZpY29uLXQiKSAmJiBob3N0Lmxlbmd0aCA+PSAzKSB7CiAgICAgICAgICAgICAgICBsZXQgZmF2aWNvblVybCA9IGN1ck5vZGUuaHJlZiB8fCBob3N0CiAgICAgICAgICAgICAgICBpZiAoQ09OU1Qub3B0aW9ucy51c2VJdGVtLlNpdGVUeXBlSUQgPT09IENPTlNULm9wdGlvbnMuYmFpZHUuU2l0ZVR5cGVJRCAmJiBmYXZpY29uVXJsLmluY2x1ZGVzKCJiYWlkdS5jb20vbGluayIpKSB7CiAgICAgICAgICAgICAgICAgIGZhdmljb25VcmwgPSBob3N0CiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgdGFyZ2V0Tm9kZS5zZXRBdHRyaWJ1dGUoJ2RhdGEtZmF2aWNvbi10JywgZmF2aWNvblVybCkKICAgICAgICAgICAgICAgIGluc2VydExpc3QucHVzaCh7CiAgICAgICAgICAgICAgICAgIHRhZ05hbWU6IHRhcmdldE5vZGUudGFnTmFtZS50b0xvd2VyQ2FzZSgpLAogICAgICAgICAgICAgICAgICB1cmw6IGZhdmljb25VcmwKICAgICAgICAgICAgICAgIH0pCiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICAgIGluc2VydExpc3QubWFwKG9uZSA9PiBDT05TVC5jc3NGYXZpb25MaXN0Lmxpc3QucHVzaChvbmUpKQogICAgfQogICAgYWRkQ291bnRlcihjaXRlTGlzdCkgewogICAgICBjb25zdCBjc3NUZXh0ID0gImZvbnQtc3R5bGU6bm9ybWFsO3Bvc2l0aW9uOnJlbGF0aXZlO3otaW5kZXg6MTttYXJnaW4tcmlnaHQ6NHB4O2Rpc3BsYXk6aW5saW5lLWJsb2NrO2NvbG9yOndoaXRlO2ZvbnQtZmFtaWx5Oiflvq7ova/pm4Xpu5EnO2ZvbnQtc2l6ZTo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ys7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGNvbnN0IGN1ckNvdW50ZXIgPSBjdXIucXVlcnlTZWxlY3RvcigiLkFDLUNvdW50ZXJUIikKICAgICAgICAgIGlmICghY3VyQ291bnRlcikgY29udGludWUKICAgICAgICAgIGNvbnN0IG9yaUluZGV4ID0gY3VyQ291bnRlci5pbm5lclRleHQKICAgICAgICAgIGNvbnN0IGNoZWNrVmFsdWUgPSAoaSArIDEpICUgMTAwOwogICAgICAgICAgLy8g5pWw5o2u5YC85LiN5ZCMCiAgICAgICAgICAvLyDmlbDmja7msqHmnInooqvnv7vor5EKICAgICAgICAgIGlmICgraW5kZXggIT09IGNoZWNrVmFsdWUgJiYgIS9eXGQrJC8udGVzdChvcmlJbmRleCkpIHsgLy8g5oyJ6ZyA5pu05pawCiAgICAgICAgICAgIGN1ckNvdW50ZXIuaW5uZXJUZXh0ID0gY2hlY2tWYWx1ZTsKICAgICAgICAgICAgY3VyLnNldEF0dHJpYnV0ZSgnU29ydEluZGV4JywgY2hlY2tWYWx1ZSk7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICBhY1NldENvb2tpZShjbmFtZSwgY3ZhbHVlLCBkb21haW4sIGV4ZGF5cykgewogICAgICBNeUFwaS5zYWZlRnVuYygoKSA9PiB7CiAgICAgICAgZXhkYXlzID0gZXhkYXlzIHx8IDMwOwogICAgICAgIGxldCBkID0gbmV3IERhdGUoKTsKICAgICAgICBkb21haW4gPSAoZG9tYWluID8gImRvbWFpbj0iICsgZG9tYWluIDogIiIpICsgIjsiOwogICAgICAgIGQuc2V0VGltZShkLmdldFRpbWUoKSArIChleGRheXMgKiAyNCAqIDYwICogNjAgKiAxMDAwKSk7CiAgICAgICAgbGV0IGV4cGlyZXMgPSAiZXhwaXJlcz0iICsgZC50b1VUQ1N0cmluZygpOwogICAgICAgIGRvY3VtZW50LmNvb2tpZSA9IGNuYW1lICsgIj0iICsgY3ZhbHVlICsgIjsgIiArIGRvbWFpbiArIGV4cGlyZXMgKyAiO3BhdGg9LztTYW1lU2l0ZT1Ob25lO1NlY3VyZSI7CiAgICAgIH0pCiAgICB9CiAgICBkYXRhQ2hhbmdlRmlyZUNhbGxiYWNrKCkgewogICAgICAvLyDmlbDmja7mnInlj5jmm7TvvIzpgqPkuYjlsJ3or5Xph43mlrDmuLLmn5PnirbmgIEKICAgICAgQ09OU1QuY3NzQXV0b0luc2VydC5jbGVhcigpCgogICAgICBpZighQ09OU1QuY3VyQ29uZmlnLmVuYWJsZUNTUykgewogICAgICAgIE15QXBpLnNhZmVHZXROb2RlRnVuYygnI215dXNlcicsIG5vZGUgPT4gbm9kZS5yZW1vdmUoKSkKICAgICAgICByZXR1cm4KICAgICAgfQogICAgICBjb25zb2xlLm15bG9nKCfljbPlsIbmj5LlhaVDU1MxJykKICAgICAgaWYgKENPTlNULmN1ckNvbmZpZy5hZHNTdHlsZUVuYWJsZSkgewogICAgICAgIGNvbnNvbGUubXlsb2coJ+WNs+WwhuaPkuWFpUNTUzInKQogICAgICAgIGlmKCtDT05TVC5jdXJDb25maWcuYWRzU3R5bGVNb2RlID09PSAxKSB7CiAgICAgICAgICBjb25zb2xlLm15bG9nKCfpnaDlt6bkvJjljJbmqKHlvI8nKQogICAgICAgICAgQ09OU1QuY3NzQXV0b0luc2VydC5hZGQoImV4cGFuZFBhZ2VTdHlsZSIsIENPTlNULmFkc0NTU0xpc3QuZXhwYW5kUGFnZVN0eWxlKQogICAgICAgICAgQ09OU1QuY3NzQXV0b0luc2VydC5hZGQoImxlZnRDb21tb25TdHlsZSIsIENPTlNULmFkc0NTU0xpc3QubGVmdENvbW1vblN0eWxlKQogICAgICAgIH0gZWxzZSBpZiAoK0NPTlNULmN1ckNvbmZpZy5hZHNTdHlsZU1vZGUgPT09IDIpIHsKICAgICAgICAgIGNvbnNvbGUubXlsb2coJ+WNleWIl+WxheS4rScpCiAgICAgICAgICBDT05TVC5jc3NBdXRvSW5zZXJ0LmFkZCgiZX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lNULmFkc0NTU0xpc3QuY29tbW9uU3R5bGUpIC8vIOWFrOWFseiHquWumuS5ieagt+W8jwogICAgICB9CiAgICAgIGlmIChDT05TVC5jdXJDb25maWcuY3VzdG9tU3R5bGVFbmFibGUpIHsKICAgICAgICBDT05TVC5jc3NBdXRvSW5zZXJ0LmFkZCgiY3VzdG9tU3R5bGUiLCBDT05TVC5hZHNDU1NMaXN0LmN1c3RvbVN0eWxlKSAvLyDnq5nngrnoh6rlrprkuYnmoLflvI8KICAgICAgfQogICAgfQogICAgcGFnZXJCaW5kKCkgewogICAgICBjb25zdCBTaG93UGFnZXIgPSB7CiAgICAgICAgZ2V0RnVsbEhyZWY6IGZ1bmN0aW9uKGUpIHsKICAgICAgICAgIGlmIChlID09PSBudWxsKSByZXR1cm4gJyc7CiAgICAgICAgICAic3RyaW5nIiAhPSB0eXBlb2YgZSAmJiAoZSA9IGUuZ2V0QXR0cmlidXRlKCJocmVmIikpOwogICAgICAgICAgdmFyIHQgPSB0aGlzLmdldEZ1bGxIcmVmLmE7CiAgICAgICAgICByZXR1cm4gdCB8fCAodGhpcy5nZXRGdWxsSHJlZi5hID0gdCA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImEiKSksIHQuaHJlZiA9IGUsIHQuaHJlZjsKICAgICAgICB9LAogICAgICAgIGNyZWF0ZURvY3VtZW50QnlTdHJpbmc6IGZ1bmN0aW9uKHN0cikgewogICAgICAgICAgLy8gc3RyaW5n6L2s5Li6RE9NCiAgICAgICAgICBpZiAoIXN0cikgewogICAgICAgICAgICBjb25zb2xlLmVycm9yKCJbQUMtU2NyaXB0XSIsICdObyBzdHJpbmcgZm91bmQgdG8gYmUgY29udmVydGVkIHRvIERPTScpOwogICAgICAgICAgICByZXR1cm47CiAgICAgICAgICB9CgogICAgICAgICAgaWYgKGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5ub2RlTmFtZSAhPT0gJ0hUTUwnKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgRE9NUGFyc2VyKCkucGFyc2VGcm9tU3RyaW5nKHN0ciwgJ2FwcGxpY2F0aW9uL3hodG1sK3htbCcpOwogICAgICAgICAgfQogICAgICAgICAgdmFyIGRvYzsKCiAgICAgICAgICBNeUFwaS5zYWZlRnVuYygoKSA9PiB7CiAgICAgICAgICAgIC8vIGZpcmVmb3ggYW5kIGNocm9tZSAzMCvvvIxPcGVyYSAxMiDkvJrmiqXplJkKICAgICAgICAgICAgZG9jID0gbmV3IERPTVBhcnNlcigpLnBhcnNlRnJvbVN0cmluZyhzdHIsICd0ZXh0L2h0bWwnKTsKICAgICAgICAgICAgaWYgKGRvYykgewogICAgICAgICAgICAgIHJldHVybiBkb2M7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0pCgogICAgICAgICAgaWYgKGRvY3VtZW50LmltcGxlbWVudGF0aW9uLmNyZWF0ZUhUTUxEb2N1bWVudCkgewogICAgICAgICAgICBkb2MgPSBkb2N1bWVudC5pbXBsZW1lbnRhdGlvbi5jcmVhdGVIVE1MRG9jdW1lbnQoJ3N1cGVyUHJlbG9hZGVyJyk7CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBNeUFwaS5zYWZlRnVuYygoKSA9PiB7CiAgICAgICAgICAgICAgZG9jID0gZG9jdW1lbnQuY2xvbmVOb2RlKGZhbHNlKTsKICAgICAgICAgICAgICBkb2MuYXBwZW5kQ2hpbGQoZG9jLmltcG9ydE5vZGUoZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LCBmYWxzZSkpOwogICAgICAgICAgICAgIGRvYy5kb2N1bWVudEVsZW1lbnQuYXBwZW5kQ2hpbGQoZG9jLmNyZWF0ZUVsZW1lbnQoJ2hlYWQnKSk7CiAgICAgICAgICAgICAgZG9jLmRvY3VtZW50RWxlbWVudC5hcHBlbmRDaGlsZChkb2MuY3JlYXRlRWxlbWVudCgnYm9keScpKTsKICAgICAgICAgICAgfSkKICAgICAgICAgIH0KCiAgICAgICAgICBpZiAoIWRvYykgcmV0dXJuOwogICAgICAgICAgdmFyIHJhbmdlID0gZG9jdW1lbnQuY3JlYXRlUmFuZ2UoKTsKICAgICAgICAgIHJhbmdlLnNlbGVjdE5vZGVDb250ZW50cyhkb2N1bWVudC5ib2R5KTsKICAgICAgICAgIHZhciBmcmFnbWVudCA9IHJhbmdlLmNyZWF0ZUNvbnRleHR1YWxGcmFnbWVudChzdHIpOwogICAgICAgICAgZG9jLmJvZHkuYXBwZW5kQ2hpbGQoZnJhZ21lbnQpOwogICAgICAgICAgdmFyIGhlYWRDaGlsZE5hbWVzID0gewogICAgICAgICAgICBUSVRMRTogdHJ1ZSwKICAgICAgICAgICAgTUVUQTogdHJ1ZSwKICAgICAgICAgICAgTElOSzogdHJ1ZSwKICAgICAgICAgICAgU1RZTEU6IHRydWUsCiAgICAgICAgICAgIEJBU0U6IHRydWUKICAgICAgICAgIH07CiAgICAgICAgICB2YXIgY2hpbGQ7CiAgICAgICAgICB2YXIgYm9keSA9IGRvYy5ib2R5OwogICAgICAgICAgdmFyIGJjaGlsZHMgPSBib2R5LmNoaWxkTm9kZXM7CgogICAgICAgICAgZm9yIChsZXQgaSA9IGJjaGlsZHMubGVuZ3RoIC0gMTsgaSA+PSAwOyBpLS0pIHsKICAgICAgICAgICAgLy8g56e76ZmkaGVhZOeahOWtkOWFg+e0oAogICAgICAgICAgICBjaGlsZCA9IGJjaGlsZHNbaV07CiAgICAgICAgICAgIGlmIChoZWFkQ2hpbGROYW1lc1tjaGlsZC5ub2RlTmFtZV0pIGJvZHkucmVtb3ZlQ2hpbGQoY2hpbGQpOwogICAgICAgICAgfQoKICAgICAgICAgIHJldHVybiBkb2M7CiAgICAgICAgfSwKICAgICAgICBsb2FkTW9yZVBhZ2U6IGFzeW5jIGZ1bmN0aW9uKCkgewogICAgICAgICAgaWYgKENPTlNULm9wdGlvbnMudXNlSXRlbS5wYWdlcikgewogICAgICAgICAgICBsZXQgY3VyUGFnZUVsZSA9IE15QXBpLmdldEVsZW1lbnRCeVhwYXRoKENPTlNULm9wdGlvbnMudXNlSXRlbS5wYWdlci5uZXh0TGluayk7CiAgICAgICAgICAgIHZhciB1cmwgPSB0aGlzLmdldEZ1bGxIcmVmKGN1clBhZ2VFbGUpOwogICAgICAgICAgICBpZiAoQ09OU1Qub3B0aW9ucy51c2VJdGVtLlNpdGVUeXBlSUQgPT09IENPTlNULm9wdGlvbnMuZ29vZ2xlLlNpdGVUeXBlSUQpIHsKICAgICAgICAgICAgICBpZiAobmF2aWdhdG9yLnVzZXJBZ2VudC50b0xvd2VyQ2FzZSgpLmluY2x1ZGVzKCdtYWNpbnRvc2gnKSkgewogICAgICAgICAgICAgICAgLy8gTUFSSyDkuLrkuoblhbzlrrnnmb7luqblnKhzYWZhcmnkuIvnmoQKICAgICAgICAgICAgICAgIHVybCA9IHVybC5yZXBsYWNlKCdodHRwczovLycsICdodHRwOi8vJyk7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmICh1cmwgPT09ICcnKSByZXR1cm47CiAgICAgICAgICAgIGlmIChDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZVVybCA9PT0gdXJsKSB7CiAgICAgICAgICAgICAgY29uc29sZS5lcnJvcigiW0FDLVNjcmlwdF0iLCAi57+76aG15Yiw6L6+5bqV6YOo5LqGIC0g5oiW6ICF5byC5bi4IC0g5Ye6546w5byC5bi46K+355u05o6l5Y+N6aaI5L2c6ICF5L+u5pS5Iik7CiAgICAgICAgICAgICAgcmV0dXJuOwogICAgICAgICAgICB9Ly8g5LiN5Lya6YeN5aSN5Yqg6L2955u45ZCM55qE6aG16Z2iCiAgICAgICAgICAgIGNvbnNvbGUubG9nKCLliqDovb3nv7vpobXlnLDlnYDvvJoiICsgdXJsKQogICAgICAgICAgICBDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZVVybCA9IHVybDsKICAgICAgICAgICAgLy8g5a+5dXJs55qE5pWw5o2u6L+b6KGM6K+75Y+WCiAgICAgICAgICAgIEN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N1bWVudCwgZG9jdW1lbnQpCiAgICAgICAgICAgICAgICAgICAgY29uc3QgcEVMYXN0ID0gY3VyUGFnZUVsZW1zW2N1clBhZ2VFbGVtcy5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICAgICAgICB0b0VsZW1lbnQgPSBwRUxhc3QubmV4dFNpYmxpbmcgPyBwRUxhc3QubmV4dFNpYmxpbmcgOiBwRUxhc3QucGFyZW50Tm9kZS5hcHBlbmRDaGlsZChkb2N1bWVudC5jcmVhdGVUZXh0Tm9kZSgnICcpKTsKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBpZiAoUnVsZV9pbnNlcnRUbykgewogICAgICAgICAgICAgICAgICAgIHRvRWxlbWVudCA9IE15QXBpLmdldEFsbEVsZW1lbnRzKFJ1bGVfaW5zZXJ0VG8pWzBdOwogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGlmIChwYWdlRWxlbXMubGVuZ3RoID49IDApIHsKICAgICAgICAgICAgICAgICAgICAvLyDlpITnkIbmnIDlkI7kuIDkuKrnv7vpobXmjInpkq4KICAgICAgICAgICAgICAgICAgICBsZXQgbmV4dEVzID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiI3NwLXNwLWdvbmV4dCIpOwogICAgICAgICAgICAgICAgICAgIGlmIChuZXh0RXMubGVuZ3RoID4gMCkgewogICAgICAgICAgICAgICAgICAgICAgbGV0IGxhc3RFID0gbmV4dEVzW25leHRFcy5sZW5ndGggLSAxXTsKICAgICAgICAgICAgICAgICAgICAgIGxhc3RFLmNsYXNzTGlzdC5yZXBsYWNlKCJhY19zcF9uZXh0X2dyYXkiLCAiYWNfc3BfbmV4dCIpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAvLyDmj5LlhaXnv7vpobXmjInpkq7lhYPntKAKICAgICAgICAgICAgICAgICAgICBDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZU51bSsrOwogICAgICAgICAgICAgICAgICAgIGxldCBhZGRUbyA9ICJiZWZvcmVlbmQiOwogICAgICAgICAgICAgICAgICAgIGlmIChSdWxlX2luc2VydE1vZGUgPT09IDEpIGFkZFRvID0gImJlZm9yZWJlZ2luIjsKCiAgICAgICAgICAgICAgICAgICAgY29uc3QgaW5zZXJ0UGFnZXIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdkaXYnKQogICAgICAgICAgICAgICAgICAgIGluc2VydFBhZ2VyLmlkID0gInNwLXNlcGFyYXRvci1BQ1giLnJlcGxhY2UoL0FDWC9nbSwgQ09OU1Qub3B0aW9ucy51c2VJdGVtLnBhZ2VOdW0pCiAgICAgICAgICAgICAgICAgICAgaW5zZXJ0UGFnZXIuY2xhc3NOYW1lID0gInNwLXNlcGFyYXRvciBBQyIKICAgICAgICAgICAgICAgICAgICBpbnNlcnRQYWdlci5pbm5lckhUTUwgPSBgCiAgICAgICAgICAgICAgICAgICAgICAgICAgPGEgY2xhc3M9J3NwLXNwLW5leHRsaW5rJyB0YXJnZXQ9J19ibGFuayc+PGI+56ysIDxzcGFuIHN0eWxlPSdjb2xvcjojNTk1OTU5IWltcG9ydGFudDsnPkFDWDwvc3Bhbj4g6aG1PC9iPjwvYT4KICAgICAgICAgICAgICAgICAgICAgICAgICA8c3BhbiBpZD0ic3Atc3AtZ290b3AiIGNsYXNzPSdhY19zcF90b3AnIHRpdGxlPSfljrvliLDpobbpg6gnPjwvc3Bhbj4KICAgICAgICAgICAgICAgICAgICAgICAgICA8c3BhbiBpZD0ic3Atc3AtZ29wcmUiIGNsYXNzPSckeyBDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZU51bSA8PSAyID8gImFjX3NwX3ByZV9ncmF5IiA6ICJhY19zcF9wcmUiIH0nIHRpdGxlPSfkuIrmu5rkuIDpobUnID48L3NwYW4+CiAgICAgICAgICAgICAgICAgICAgICAgICAgPHNwYW4gaWQ9InNwLXNwLWdvbmV4dCIgY2xhc3M9J2FjX3NwX25leHRfZ3JheScgdGl0bGU9J+S4i+a7muS4gOmhtSc+PC9zcGFuPgogICAgICAgICAgICAgICAgICAgICAgICAgIDxzcGFuIGlkPSJzcC1zcC1nb2JvdHRvbSIgY2xhc3M9J2FjX3NwX2JvdHRvbScgdGl0bGU9J+WOu+WIsOW6lemDqCcgPjwvc3Bhbj5gCiAgICAgICAgICAgICAgICAgICAgICAucmVwbGFjZSgvQUNYL2dtLCBDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZU51bSk7CgogICAgICAgICAgICAgICAgICAgIGlmKFJ1bGVfaW5zZXJ0TW9kZSA9PT0gMSkgewogICAgICAgICAgICAgICAgICAgICAgdG9FbGVtZW50LnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGluc2VydFBhZ2VyLCB0b0VsZW1lbnQpCiAgICAgICAgICAgICAgICAgICAgICAvLyDmj5LlhaXmlrDpobXpnaLlhYPntKAKICAgICAgICAgICAgICAgICAgICAgIHBhZ2VFbGVtcy5mb3JFYWNoKGZ1bmN0aW9uKG9uZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0b0VsZW1lbnQucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUob25lLCB0b0VsZW1lbnQpCiAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgdG9FbGVtZW50LmFwcGVuZENoaWxkKGluc2VydFBhZ2VyKQoKICAgICAgICAgICAgICAgICAgICAgIHBhZ2VFbGVtcy5mb3JFYWNoKGZ1bmN0aW9uKG9uZSkgewogICAgICAgICAgICAgICAgICAgICAgICB0b0VsZW1lbnQuYXBwZW5kQ2hpbGQob25lKQogICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCIuc3Atc2VwYXJhdG9yLkFDOm5vdChbYmluZF0pIikuZm9yRWFjaChmdW5jdGlvbihwZXIpIHsKICAgICAgICAgICAgICAgICAgICAgIHBlci5zZXRBdHRyaWJ1dGUoImJpbmQiLCAxKTsKICAgICAgICAgICAgICAgICAgICAgIHBlci5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIFBhZ2VGdW5jLmFjX3NwZnVuYyk7CiAgICAgICAgICAgICAgICAgICAgfSk7CgogICAgICAgICAgICAgICAgICAgIC8vIOaPkuWFpXNjcmlwdHMgJiBzdHlsZSAtIOS/neivgWpz5Yqg6L29CiAgICAgICAgICAgICAgICAgICAgaWYgKENPTlNULm9wdGlvbnMudXNlSXRlbS5TaXRlVHlwZUlEID09PSBDT05TVC5vcHRpb25zLmdvb2dsZS5TaXRlVHlwZUlEKSB7CiAgICAgICAgICAgICAgICAgICAgICBzY3JpcHRFbGVtcy5mb3JFYWNoKChvbmUpID0+IHsKICAgICAgICAgICAgICAgICAgICAgICAgdG9FbGVtZW50LmFwcGVuZENoaWxkKG9uZSkKICAgICAgICAgICAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgICAgIC8vIOabv+aNouW+heabv+aNouWFg+e0oCAtIOS4gOiIrOaYr+abv+aNoue/u+mhteeahOaMiemSrgogICAgICAgICAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICAgICAgICBpZiAoQ09OU1Qub3B0aW9ucy51c2VJdGVtLnBhZ2VyLnJlcGxhY2VFKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBvcmlFID0gTXlBcGkuZ2V0QWxsRWxlbWVudHMoQ09OU1Qub3B0aW9ucy51c2VJdGVtLnBhZ2VyLnJlcGxhY2VFKTsKICAgICAgICAgICAgICAgICAgICAgICAgbGV0IHJlcEUgPSBNeUFwaS5nZXRBbGxFbGVtZW50cyhDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZXIucmVwbGFjZUUsIG5ld0JvZHksIG5ld0JvZHkpOwogICAgICAgICAgICAgICAgICAgICAgICBpZiAob3JpRS5sZW5ndGggPT09IHJlcEUubGVuZ3RoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKG9yaUUubGVuZ3RoID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aHJvdyAi57+76aG1Leabv+aNoue/u+mhteWFg+e0oCDml6AgJ3JlcGxhY2VFJyDlvoXmm7/mjaLnmoQiOwogICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG9yaUUubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yaUVbaV0ub3V0ZXJIVE1MID0gcmVwRVtpXS5vdXRlckhUTUw7CiAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkgewogICAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZSk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGUpOwogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIENPTlNULmxvY2sucGFnZUxvYWRpbmdMb2NrZWQgPSBmYWxzZTsKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgIG9uZXJyb3I6IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgQ09OU1QubG9jay5wYWdlTG9hZGluZ0xvY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgfTsKICAgICAgY29uc29sZS5teWxvZygncGFnZXLlt7Lnu5HlrprmiJDlip8nKQogICAgICB0aGlzLndpbm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05TVC5vcHRpb25zLmR1Y2tkdWNrZ28uU2l0ZVR5cGVJRCkgeyAvLyDlj6/ku6XnlKjlt7LmnInnmoTmlrnms5XmnaXlrp7njrDkuoYKICAgICAgICAgICAgICAgIGlmICghQ09OU1QuY3VyQ29uZmlnLm9wdGltaXplRHVja0R1Y2tHbyB8fCArQ09OU1QuY3VyQ29uZmlnLmFkc1N0eWxlTW9kZSA+PSAzKSB7IC8vIOWmguaenOayoeacieW8gOWQr++8jOmCo+S5iOaJi+WKqOe/u+mhtSB8fCDlpoLmnpzmmK/lj4zliJfnmoTml7blgJnvvIzkvLzkuY7lubbkuI3kvJroh6rliqjop6blj5Hnv7vpobXmlYjmnpwKICAgICAgICAgICAgICAgICAgY29uc3Qgbm9kZSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIiNsaW5rcyAucmVzdWx0LS1tb3JlIGEiKQogICAgICAgICAgICAgICAgICBub2RlICYmIG5vZGUuY2xpY2soKTsKICAgICAgICAgICAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgICAgICBDT05TVC5sb2NrLnBhZ2VMb2FkaW5nTG9ja2VkID0gZmFsc2U7CiAgICAgICAgICAgICAgICAgIH0sIDUwMDApOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBhd2FpdCBTaG93UGFnZXIubG9hZE1vcmVQYWdlKCk7CiAgICAgICAgICAgICAgICBpZiAoQ09OU1Qub3B0aW9ucy51c2VJdGVtLnBhZ2VyICYmIENPTlNULm9wdGlvbnMudXNlSXRlbS5wYWdlci5zdHlsaXNoKSB7CiAgICAgICAgICAgICAgICAgIENPTlNULmNzc0F1dG9JbnNlcnQuYWRkKCdhdXRvUGFnZXInLCBDT05TVC5vcHRpb25zLnVzZUl0ZW0ucGFnZXIuc3R5bGlzaCkKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICAgICAgQ09OU1QubG9jay5wYWdlTG9hZGluZ0xvY2tlZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgICB9LCA1MDAwKTsKICAgICAgICAgICAgICAgICAgY29uc29sZS5teWxvZygn5b2T5YmN56uZ54K55rKh5pyJ6YWN572ucGFnZXInKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfSk7CiAgICB9CiAgICB3aW5kb3dzY3JvbGwoZm4gPSAoKSA9PiB7fSkgewogICAgICBsZXQgYmVmb3JlU2Nyb2xsVG9wID0gZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnNjcm9sbFRvcAogICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigic2Nyb2xsIiwgZnVuY3Rpb24oZSkgewogICAgICAgIHZhciBhZnRlclNjcm9sbFRvcCA9IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5zY3JvbGxUb3AsCiAgICAgICAgICBkZWx0YSA9IGFmdGVyU2Nyb2xsVG9wIC0gYmVmb3JlU2Nyb2xsVG9wOwogICAgICAgIGlmIChkZWx0YSA9PT0gMCkgcmV0dXJuIGZhbHNlOwogICAgICAgIGZuKGRlbHRhID4gMCA/ICJkb3duIiA6ICJ1cCIsIGUpOwogICAgICAgIGJlZm9yZVNjcm9sbFRvcCA9IGFmdGVyU2Nyb2xsVG9wOwogICAgICB9LCBmYWxzZSk7CiAgICB9CiAgICBhY19zcGZ1bmMoZSkgewogICAgICBjb25zb2xlLmVycm9yKCLov5nph4zmnInpl67popgiKQogICAgICBlLnN0b3BQcm9wYWdhdGlvbigpOwogICAgICB2YXIgdCwgciA9IGUuY3VycmVudFRhcmdldDsKICAgICAgY29uc3QgVHdlZW4gPSB7CiAgICAgICAgTGluZWFyOiBmdW5jdGlvbiBMaW5lYXIoZSwgdCwgciwgbikgewogICAgICAgICAgcmV0dXJuIHIgKiBlIC8gbiArIHQ7CiAgICAgICAgfSwKICAgICAgICBRdWFkOiB7CiAgICAgICAgICBlYXNlSW46IGZ1bmN0aW9uIGVhc2VJbihlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiByICogKGUgLz0gbikgKiBlICsgdDsKICAgICAgICAgIH0sCiAgICAgICAgICBlYXNlT3V0OiBmdW5jdGlvbiBlYXNlT3V0KGUsIHQsIHIsIG4pIHsKICAgICAgICAgICAgcmV0dXJuIC1yICogKGUgLz0gbikgKiAoZSAtIDIpICsgdDsKICAgICAgICAgIH0sCiAgICAgICAgICBlYXNlSW5PdXQ6IGZ1bmN0aW9uIGVhc2VJbk91dChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiAoZSAvPSBuIC8gMikgPCAxID8gciAvIDIgKiBlICogZSArIHQgOiAtciAvIDIgKiAoLS1lICogKGUgLSAyKSAtIDEpICsgdDsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIEN1YmljOiB7CiAgICAgICAgICBlYXNlSW46IGZ1bmN0aW9uIGVhc2VJbihlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiByICogKGUgLz0gbikgKiBlICogZSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZU91dDogZnVuY3Rpb24gZWFzZU91dChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiByICogKChlID0gZSAvIG4gLSAxKSAqIGUgKiBlICsgMSkgKyB0OwogICAgICAgICAgfSwKICAgICAgICAgIGVhc2VJbk91dDogZnVuY3Rpb24gZWFzZUluT3V0KGUsIHQsIHIsIG4pIHsKICAgICAgICAgICAgcmV0dXJuIChlIC89IG4gLyAyKSA8IDEgPyByIC8gMiAqIGUgKiBlICogZSArIHQgOiByIC8gMiAqICgoZSAtPSAyKSAqIGUgKiBlICsgMikgKyB0OwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgUXVhcnQ6IHsKICAgICAgICAgIGVhc2VJbjogZnVuY3Rpb24gZWFzZUluKGUsIHQsIHIsIG4pIHsKICAgICAgICAgICAgcmV0dXJuIHIgKiAoZSAvPSBuKSAqIGUgKiBlICogZSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZU91dDogZnVuY3Rpb24gZWFzZU91dChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiAtciAqICgoZSA9IGUgLyBuIC0gMSkgKiBlICogZSAqIGUgLSAxKSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZUluT3V0OiBmdW5jdGlvbiBlYXNlSW5PdXQoZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gKGUgLz0gbiAvIDIpIDwgMSA/IHIgLyAyICogZSAqIGUgKiBlICogZSArIHQgOiAtciAvIDIgKiAoKGUgLT0gMikgKiBlICogZSAqIGUgLSAyKSArIHQ7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBRdWludDogewogICAgICAgICAgZWFzZUluOiBmdW5jdGlvbiBlYXNlSW4oZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gciAqIChlIC89IG4pICogZSAqIGUgKiBlICogZSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZU91dDogZnVuY3Rpb24gZWFzZU91dChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiByICogKChlID0gZSAvIG4gLSAxKSAqIGUgKiBlICogZSAqIGUgKyAxKSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZUluT3V0OiBmdW5jdGlvbiBlYXNlSW5PdXQoZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gKGUgLz0gbiAvIDIpIDwgMSA/IHIgLyAyICogZSAqIGUgKiBlICogZSAqIGUgKyB0IDogciAvIDIgKiAoKGUgLT0gMikgKiBlICogZSAqIGUgKiBlICsgMikgKyB0OwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgU2luZTogewogICAgICAgICAgZWFzZUluOiBmdW5jdGlvbiBlYXNlSW4oZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gLXIgKiBNYXRoLmNvcyhlIC8gbiAqIChNYXRoLlBJIC8gMikpICsgciArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZU91dDogZnVuY3Rpb24gZWFzZU91dChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiByICogTWF0aC5zaW4oZSAvIG4gKiAoTWF0aC5QSSAvIDIpKSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZUluT3V0OiBmdW5jdGlvbiBlYXNlSW5PdXQoZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gLXIgLyAyICogKE1hdGguY29zKE1hdGguUEkgKiBlIC8gbikgLSAxKSArIHQ7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBFeHBvOiB7CiAgICAgICAgICBlYXNlSW46IGZ1bmN0aW9uIGVhc2VJbihlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiAwID09IGUgPyB0IDogciAqIE1hdGgucG93KDIsIDEwICogKGUgLyBuIC0gMSkpICsgdDsKICAgICAgICAgIH0sCiAgICAgICAgICBlYXNlT3V0OiBmdW5jdGlvbiBlYXNlT3V0KGUsIHQsIHIsIG4pIHsKICAgICAgICAgICAgcmV0dXJuIGUgPT0gbiA/IHQgKyByIDogciAqICgxIC0gTWF0aC5wb3coMiwgLTEwICogZSAvIG4pKSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZUluT3V0OiBmdW5jdGlvbiBlYXNlSW5PdXQoZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gMCA9PSBlID8gdCA6IGUgPT0gbiA/IHQgKyByIDogKGUgLz0gbiAvIDIpIDwgMSA/IHIgLyAyICogTWF0aC5wb3coMiwgMTAgKiAoZSAtIDEpKSArIHQgOiByIC8gMiAqICgyIC0gTWF0aC5wb3coMiwgLTEwICogLS1lKSkgKyB0OwogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgQ2lyYzogewogICAgICAgICAgZWFzZUluOiBmdW5jdGlvbiBlYXNlSW4oZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gLXIgKiAoTWF0aC5zcXJ0KDEgLSAoZSAvPSBuKSAqIGUpIC0gMSkgKyB0OwogICAgICAgICAgfSwKICAgICAgICAgIGVhc2VPdXQ6IGZ1bmN0aW9uIGVhc2VPdXQoZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gciAqIE1hdGguc3FydCgxIC0gKGUgPSBlIC8gbiAtIDEpICogZSkgKyB0OwogICAgICAgICAgfSwKICAgICAgICAgIGVhc2VJbk91dDogZnVuY3Rpb24gZWFzZUluT3V0KGUsIHQsIHIsIG4pIHsKICAgICAgICAgICAgcmV0dXJuIChlIC89IG4gLyAyKSA8IDEgPyAtciAvIDIgKiAoTWF0aC5zcXJ0KDEgLSBlICogZSkgLSAxKSArIHQgOiByIC8gMiAqIChNYXRoLnNxcnQoMSAtIChlIC09IDIpICogZSkgKyAxKSArIHQ7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBFbGFzdGljOiB7CiAgICAgICAgICBlYXNlSW46IGZ1bmN0aW9uIGVhc2VJbihlLCB0LCByLCBuLCBhLCBvKSB7CiAgICAgICAgICAgIHJldHVybiAwID09IGUgPyB0IDogMSA9PSAoZSAvPSBuKSA/IHQgKyByIDogKG8gfHwgKG8gPSAuMyAqIG4pLCAhYSB8fCBhIDwgTWF0aC5hYnMocikgPyAoYSA9IHIsCiAgICAgICAgICAgICAgaSA9IG8gLyA0KSA6IGkgPSBvIC8gKDIgKiBNYXRoLlBJKSAqIE1hdGguYXNpbihyIC8gYSksIC1hICogTWF0aC5wb3coMiwgMTAgKiAoZSAtPSAxKSkgKiBNYXRoLnNpbigoZSAqIG4gLSBpKSAqICgyICogTWF0aC5QSSkgLyBvKSArIHQpOwogICAgICAgICAgICB2YXIgaTsKICAgICAgICAgIH0sCiAgICAgICAgICBlYXNlT3V0OiBmdW5jdGlvbiBlYXNlT3V0KGUsIHQsIHIsIG4sIGEsIG8pIHsKICAgICAgICAgICAgcmV0dXJuIDAgPT0gZSA/IHQgOiAxID09IChlIC89IG4pID8gdCArIHIgOiAobyB8fCAobyA9IC4zICogbiksICFhIHx8IGEgPCBNYXRoLmFicyhyKSA/IChhID0gciwKICAgICAgICAgICAgICBpID0gbyAvIDQpIDogaSA9IG8gLyAoMiAqIE1hdGguUEkpICogTWF0aC5hc2luKHIgLyBhKSwgYSAqIE1hdGgucG93KDIsIC0xMCAqIGUpICogTWF0aC5zaW4oKGUgKiBuIC0gaSkgKiAoMiAqIE1hdGguUEkpIC8gbykgKyByICsgdCk7CiAgICAgICAgICAgIHZhciBpOwogICAgICAgICAgfSwKICAgICAgICAgIGVhc2VJbk91dDogZnVuY3Rpb24gZWFzZUluT3V0KGUsIHQsIHIsIG4sIGEsIG8pIHsKICAgICAgICAgICAgcmV0dXJuIDAgPT0gZSA/IHQgOiAyID09IChlIC89IG4gLyAyKSA/IHQgKyByIDogKG8gfHwgKG8gPSBuICogKC4zICogMS41KSksICFhIHx8IGEgPCBNYXRoLmFicyhyKSA/IChhID0gciwKICAgICAgICAgICAgICBpID0gbyAvIDQpIDogaSA9IG8gLyAoMiAqIE1hdGguUEkpICogTWF0aC5hc2luKHIgLyBhKSwgZSA8IDEgPyBhICogTWF0aC5wb3coMiwgMTAgKiAoZSAtPSAxKSkgKiBNYXRoLnNpbigoZSAqIG4gLSBpKSAqICgyICogTWF0aC5QSSkgLyBvKSAqIC0uNSArIHQgOiBhICogTWF0aC5wb3coMiwgLTEwICogKGUgLT0gMSkpICogTWF0aC5zaW4oKGUgKiBuIC0gaSkgKiAoMiAqIE1hdGguUEkpIC8gbykgKiAuNSArIHIgKyB0KTsKICAgICAgICAgICAgdmFyIGk7CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICBCYWNrOiB7CiAgICAgICAgICBlYXNlSW46IGZ1bmN0aW9uIGVhc2VJbihlLCB0LCByLCBuLCBhKSB7CiAgICAgICAgICAgIHJldHVybiBudWxsID09IGEgJiYgKGEgPSAxLjcwMTU4KSwgciAqIChlIC89IG4pICogZSAqICgoYSArIDEpICogZSAtIGEpICsgdDsKICAgICAgICAgIH0sCiAgICAgICAgICBlYXNlT3V0OiBmdW5jdGlvbiBlYXNlT3V0KGUsIHQsIHIsIG4sIGEpIHsKICAgICAgICAgICAgcmV0dXJuIG51bGwgPT0gYSAmJiAoYSA9IDEuNzAxNTgpLCByICogKChlID0gZSAvIG4gLSAxKSAqIGUgKiAoKGEgKyAxKSAqIGUgKyBhKSArIDEpICsgdDsKICAgICAgICAgIH0sCiAgICAgICAgICBlYXNlSW5PdXQ6IGZ1bmN0aW9uIGVhc2VJbk91dChlLCB0LCByLCBuLCBhKSB7CiAgICAgICAgICAgIHJldHVybiBudWxsID09IGEgJiYgKGEgPSAxLjcwMTU4KSwgKGUgLz0gbiAvIDIpIDwgMSA/IHIgLyAyICogKGUgKiBlICogKCgxICsgKGEgKj0gMS41MjUpKSAqIGUgLSBhKSkgKyB0IDogciAvIDIgKiAoKGUgLT0gMikgKiBlICogKCgxICsgKGEgKj0gMS41MjUpKSAqIGUgKyBhKSArIDIpICsgdDsKICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIEJvdW5jZTogewogICAgICAgICAgZWFzZUluOiBmdW5jdGlvbiBlYXNlSW4oZSwgdCwgciwgbikgewogICAgICAgICAgICByZXR1cm4gciAtIFR3ZWVuLkJvdW5jZS5lYXNlT3V0KG4gLSBlLCAwLCByLCBuKSArIHQ7CiAgICAgICAgICB9LAogICAgICAgICAgZWFzZU91dDogZnVuY3Rpb24gZWFzZU91dChlLCB0LCByLCBuKSB7CiAgICAgICAgICAgIHJldHVybiAoZSAvPSBuKSA8IDEgLyAyLjc1ID8gciAqICg3LjU2MjUgKiBlICogZSkgKyB0IDogZSA8IDIgLyAyLjc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AgICAgICAgIH0gY2F0Y2ggKGUpIHsKICAgICAgICAgICAgICByZXR1cm4gb25lID09PSBjdXJIb3N0OwogICAgICAgICAgICB9CiAgICAgICAgICB9KSA+PSAwKSB7CiAgICAgICAgICAgIAogICAgICAgICAgICAKICAgICAgICAgICAgLy8g5Y+q5qOA5p+l5Zyo5bGP6JS96KGo5Lit55qE5pWw5o2uCiAgICAgICAgICAgIGlmICghY3VyTm9kZS5oYXNBdHRyaWJ1dGUoZmxhZykpIHsKICAgICAgICAgICAgICBjdXJOb2RlLnNldEF0dHJpYnV0ZShmbGFnLCAiMSIpOwogICAgICAgICAgICAgIGlmIChDT05TVC5jdXJDb25maWcuaXNCbG9ja1Jlc3VsdERpc3BsYXkpIHsgLy8g5a+55LqO5LiN5pi+56S655qE5pWw5o2u5Y+v5Lul6L+b6KGM56e76Zmk5pON5L2cCiAgICAgICAgICAgICAgICBjdXJOb2RlLnJlbW92ZSgpOwogICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIGxldCBjdXJUaXRsZSA9IGN1ck5vZGUucXVlcnlTZWxlY3Rvcih0aGlzLmN1clNpdGUuQmxvY2tUeXBlKTsKICAgICAgICAgICAgICBjdXJUaXRsZSA9IGN1clRpdGxlLmlubmVyVGV4dCB8fCBjdXJUaXRsZS50ZXh0Q29udGVudDsKCiAgICAgICAgICAgICAgKGZ1bmN0aW9uKHhjdXIpIHsKICAgICAgICAgICAgICAgIGNvbnN0IGJsb2NrU2hvdyA9IHhjdXIucXVlcnlTZWxlY3RvcigiLmJsb2NrU2hvdyIpOwogICAgICAgICAgICAgICAgaWYoIWJsb2NrU2hvdykgewogICAgICAgICAgICAgICAgICBjdXJOb2RlLmluc2VydEFkamFjZW50SFRNTCgiYWZ0ZXJCZWdpbiIsIGA8c3BhbiBjbGFzcz0iYmxvY2tTaG93IiB0aXRsZT0i5aaC5p6c6ZyA6KaB5LiA55u05pi+56S677yM6K+35Zyo6Ieq5a6a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gfSkoY3VyTm9kZSk7CiAgICAgICAgICAgIH0KICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGN1ck5vZGUucmVtb3ZlQXR0cmlidXRlKGZsYWcpOwogICAgICAgICAgfQogICAgICAgICAgY3VyTm9kZS5kYXRhc2V0LmNoZWNrZWQgPSAnMScKICAgICAgICB9IGNhdGNoIChlKSB7fQogICAgICB9CiAgICAgIENPTlNULmxvY2suaXNCbG9ja0NoZWNraW5nID0gZmFsc2UKICAgICAgQ09OU1QubG9jay5hZnRlckJsb2NrQ2hhbmdlQ2hlY2tlZCA9IHRydWUKICAgIH0KICAgIGFzeW5jIF91cGRhdGVSZWdMaXN0UnVsZSgpIHsKICAgICAgdGhpcy5yZWdMaXN0UnVsZSA9IENPTlNULmJsb2NrUnVsZUxpc3QuZmlsdGVyKG9uZSA9PiBvbmUpLm1hcChvbmUgPT4gewogICAgICAgIHRyeXsKICAgICAgICAgIHJldHVybiBuZXcgUmVnRXhwKG9uZS5yZXBsYWNlKCIqIiwgIi4qIikpCiAgICAgICAgfWNhdGNoIChlKXsKICAgICAgICAgIHJldHVybiBvbmUKICAgICAgICB9CiAgICAgIH0pCiAgICB9CiAgICBfaW5pdExpc3RlbmVyKCkgewogICAgICBsZXQgY2hlY2tOb2RlcyA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoImJ1dHRvbi5naGhpZGVyOm5vdChbYWNFbnZdKSIpOwoKICAgICAgY2hlY2tOb2Rlcy5mb3JFYWNoKG9uZSA9PiB7CiAgICAgICAgb25lLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgdGhpcy5fZG9IaWRlRW52KTsKICAgICAgICBvbmUuc2V0QXR0cmlidXRlKCJhY0VudiIsICIwIik7CiAgICAgIH0pCiAgICB9CiAgICBfZG9IaWRlRW52KGVudikgewogICAgICAvLyDlhYjmj5LlhaXmlbDmja4tLS3orrDlvpfov5jopoHlhpnlhaXlrZjlgqgKICAgICAgbGV0IG5vZG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gICAgICAgICAgICBtYXJrRmF0aGVyQ2hpbGQoY3VyTm9kZSwgZmF0aGVyTm9kZSkKICAgICAgICAgICAgICByZXR1cm4gZmF0aGVyTm9kZQogICAgICAgICAgICB9CiAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICByZXR1cm4gbnVsbAogICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgZnVuY3Rpb24gTWFya01pbmUoY3VySXRlbSkgewogICAgICAgICAgbGV0IG1heEhlaWdodCA9IDYsIGN1ckhlaWdodCA9IDEKICAgICAgICAgIGxldCBwcmVOb2RlID0gY3VySXRlbQogICAgICAgICAgd2hpbGUgKGN1ckhlaWdodCA8IG1heEhlaWdodCkgewogICAgICAgICAgICBjb25zdCBwYXJlbnROb2RlID0gY3VySXRlbS5wYXJlbnROb2RlCiAgICAgICAgICAgIGlmICghY3VySXRlbS5oYXNBdHRyaWJ1dGUoJ3R3by1jaGVja2VkJykpIHsKICAgICAgICAgICAgICBjb25zdCBub2RlID0gZ2V0VHJ1ZUZhdGhlckNoaWxkKHByZU5vZGUsIGN1ckl0ZW0sIHBhcmVudE5vZGUpCiAgICAgICAgICAgICAgaWYgKG5vZGUpIHJldHVybiBub2RlCiAgICAgICAgICAgIH0KICAgICAgICAgICAgY3VySXRlbS5zZXRBdHRyaWJ1dGUoJ3R3by1jaGVja2VkJywgMSkKICAgICAgICAgICAgcHJlTm9kZSA9IGN1ckl0ZW0KICAgICAgICAgICAgY3VySXRlbSA9IHBhcmVudE5vZGUKICAgICAgICAgICAgY3VySGVpZ2h0KysKICAgICAgICAgIH0KICAgICAgICAgIHJldHVybiBudWxsCiAgICAgICAgfQoKICAgICAgICBjb25zdCBnTGlzdCA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoIi5nOm5vdCh0d28tY2hlY2tlZCkiKQoKICAgICAgICByZXR1cm4gWy4uLmdMaXN0XS5maWx0ZXIob25lID0+IE1hcmtNaW5lKG9uZSkpCiAgICAgIH0KCiAgICAgIGNvbnN0IHZhbGlkID0gbG9jYXRpb24uaHJlZi5zZWFyY2goLygmfFw/KShxfGt3KT0vKSA+PSAwIHx8CiAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLmcsIGRpdlt0d28tZmF0aGVyXSIpCiAgICAgIGlmICghdmFsaWQpIHsKICAgICAgICBDT05TVC5jdXJDb25maWcuZW5hYmxlQ1NTID0gZmFsc2UKICAgICAgICByZXR1cm4KICAgICAgfQogICAgICBmaW5kQW5kTWFya1AyTGluZSgpCiAgICAgIGlmKGNvdW50ZXIgJSA0ID09PSAwKSB7CiAgICAgICAgaWYgKENPTlNULmN1ckNvbmZpZy51c2VCYWlkdUxvZ28pIHsKICAgICAgICAgIFBhZ2VGdW5jLkdvb2dsZUluQmFpZHVNb2RlKCkKICAgICAgICB9CiAgICAgICAgaWYgKENPTlNULmN1ckNvbmZpZy5pc0Fkc0VuYWJsZSkgewogICAgICAgICAgUGFnZUZ1bmMucmVtb3ZlQWRzLnJlbW92ZUdvb2dsZUFkKCkKICAgICAgICB9CiAgICAgIH0KICAgIH0sIDUwLCBJbmZpbml0eSkKICAgIC8qKipCYWlkdSoqKi8KICAgIENPTlNULmFkZEludGVydmFsVHJpZ2dlcignYmFpZHUnLCAnYm9keScsICgpID0+IHsKICAgICAgLy8g5rKh5pyJKOeZvuW6puaQnOe0oue7k+aenOeahOagh+W/ly1b5a2Y5ZyoXeeZvuW6pueahOWGheWuuSkgcmV0dXJuOwogICAgICAKICAgICAgY29uc3QgdmFsaWQgPSBsb2NhdGlvbi5ocmVmLnNlYXJjaCgvKCZ8XD8pKHdkfHdvcmQpPS8pID49IDAgfHwKICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIjY29udGVudF9sZWZ0IikgfHwgZG9jdW1lbnQucXVlcnlTZWxlY3RvcignLnNfZm9ybScpLm9mZnNldEhlaWdodCA8IDEwMAogICAgICBpZiAoIXZhbGlkKSB7CiAgICAgICAgY29uc29sZS5teWxv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fQogICAgfSwgMjAwLCBJbmZpbml0eSkKICAgIC8qKipCaW5nKioqLwogICAgQ09OU1QuYWRkSW50ZXJ2YWxUcmlnZ2VyKCdiaW5nJywgJ2JvZHknLCAoKSA9PiB7CiAgICAgIGlmIChDT05TVC5jdXJDb25maWcuaXNBZHNFbmFibGUpIHsKICAgICAgICBQYWdlRnVuYy5yZW1vdmVBZHMucmVtb3ZlQmluZ0FkKCkKICAgICAgfQogICAgICBQYWdlRnVuYy5iaW5nQXV0b1Njcm9sbEZpeCgpCiAgICAgIFBhZ2VGdW5jLmJpbmdGYXZpY29uUGFnZXJGaXgoKQogICAgfSwgMjAwLCBJbmZpbml0eSkKICAgIC8qKipEdWNrRHVja2dvKioqLwogICAgQ09OU1QuYWRkSW50ZXJ2YWxUcmlnZ2VyKCdkdWNrZHVja2dvJywgJ2JvZHknLCAoKSA9PiB7CiAgICAgIGlmIChDT05TVC5jdXJDb25maWcub3B0aW1pemVEdWNrRHVja0dvKSB7CiAgICAgICAgc2V0VGltZW91dChmdW5jdGlvbigpIHsKICAgICAgICAgIE15QXBpLnNhZmVGdW5jKCgpID0+IHsKICAgICAgICAgICAgRERHLnNldHRpbmdzLnNldCgia24iLCAxLCB7IC8vIOaWsOeql+WPo+aJk+W8gOmhtemdogogICAgICAgICAgICAgIHNhdmVUb0Nsb3VkOiB0cnVlLAogICAgICAgICAgICAgIGZvcmNlVGhlbWU6IHRydWUKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIERERy5zZXR0aW5ncy5zZXQoImthdiIsIDEsIHsgLy8g6L+e57ut5pi+56S65pCc57Si57uT5p6cCiAgICAgICAgICAgICAgc2F2ZVRvQ2xvdWQ6IHRydWUsCiAgICAgICAgICAgICAgZm9yY2VUaGVtZTogdHJ1ZQogICAgICAgICAgICB9KTsKICAgICAgICAgIH0pCiAgICAgICAgfSwgMzAwMCk7CiAgICAgIH0KICAgIH0sIDIwMCwgSW5maW5pdHkpCiAgICAvKioqQWxsKioqLwogICAgQ09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hbWUgKyAnX25vY3NzJykKICAgICAgaWYgKCFkb2N1bWVudC5ib2R5Lmhhc0F0dHJpYnV0ZShpbnNlcnROYW1lKSkgewogICAgICAgIGRvY3VtZW50LmJvZHkuc2V0QXR0cmlidXRlKGluc2VydE5hbWUsICcxJykKICAgICAgICBkb2N1bWVudC5ib2R5LmNsYXNzTGlzdC5hZGQoaW5zZXJ0TmFtZSkKICAgICAgfQogICAgICBQYWdlRnVuYy5JbnNlcnRTZXR0aW5nTWVudSgpCiAgICAgIGlmIChDT05TVC5jdXJDb25maWcuaXNBdXRvcGFnZSkgewogICAgICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgUGFnZUZ1bmMucGFnZXJCaW5kKCkKICAgICAgICB9LCAyMDAwKQogICAgICB9CiAgICB9LCAyMCwgdHJ1ZSkKICB9KSgpCn0pKCkK
Add Comment
Please, Sign In to add comment