xiaomianao666

插件名:global_m3u8视频侦测下载器【自动嗅探】

May 2nd, 2023
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_m3u8视频侦测下载器【自动嗅探】@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICBtM3U46KeG6aKR5L6m5rWL5LiL6L295Zmo44CQ6Ieq5Yqo5ZeF5o6i44CRCi8vIEBuYW1lOnpoLUNOICAgbTN1OOinhumikeS+pua1i+S4i+i9veWZqOOAkOiHquWKqOWXheaOouOAkQovLyBAbmFtZTp6aC1UVyAgIG0zdTjoppbpoLvlgbXmuKzkuIvovInlmajjgJDoh6rli5Xll4XmjqLjgJEKLy8gQG5hbWU6ZW4gICAgICBNM1U4IFZpZGVvIERldGVjdG9yIGFuZCBEb3dubG9hZGVyCi8vIEB2ZXJzaW9uICAgICAgMS40LjEKLy8gQGRlc2NyaXB0aW9uICDoh6rliqjmo4DmtYvpobXpnaJtM3U46KeG6aKR5bm26L+b6KGM5a6M5pW05LiL6L2944CC5qOA5rWL5YiwbTN1OOmTvuaOpeWQjuS8muiHquWKqOWHuueOsOWcqOmhtemdouWPs+S4iuinkuS9jee9ru+8jOeCueWHu+S4i+i9veWNs+WPr+i3s+i9rOWIsG0zdTjkuIvovb3lmajjgIIKLy8gQGRlc2NyaXB0aW9uOnpoLUNOICDoh6rliqjmo4DmtYvpobXpnaJtM3U46KeG6aKR5bm26L+b6KGM5a6M5pW05LiL6L2944CC5qOA5rWL5YiwbTN1OOmTvuaOpeWQjuS8muiHquWKqOWHuueOsOWcqOmhtemdouWPs+S4iuinkuS9jee9ru+8jOeCueWHu+S4i+i9veWNs+WPr+i3s+i9rOWIsG0zdTjkuIvovb3lmajjgIIKLy8gQGRlc2NyaXB0aW9uOnpoLVRXICDoh6rli5XmqqLmuKzpoIHpnaJtM3U46KaW6aC75Lim6YCy6KGM5a6M5pW05LiL6LyJ44CC5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KICAgICAgICAgICAgICAgIHRoaXMub3BlbkluVGFiKGRldGFpbHMudXJsKTsKICAgICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgY29weVRleHQodGV4dCkgewogICAgICAgICAgICBjb3B5VGV4dFRvQ2xpcGJvYXJkKHRleHQpOwogICAgICAgICAgICBmdW5jdGlvbiBjb3B5VGV4dFRvQ2xpcGJvYXJkKHRleHQpIHsKICAgICAgICAgICAgICAgIC8vIOWkjeWItuaWh+acrAogICAgICAgICAgICAgICAgdmFyIGNvcHlGcm9tID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgidGV4dGFyZWEiKTsKICAgICAgICAgICAgICAgIGNvcHlGcm9tLnRleHRDb250ZW50ID0gdGV4dDsKICAgICAgICAgICAgICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoY29weUZyb20pOwogICAgICAgICAgICAgICAgY29weUZyb20uc2VsZWN0KCk7CiAgICAgICAgICAgICAgICBkb2N1bWVudC5leGVjQ29tbWFuZCgnY29weScpOwogICAgICAgICAgICAgICAgY29weUZyb20uYmx1cigpOwogICAgICAgICAgICAgICAgZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChjb3B5RnJvbSk7CiAgICAgICAgICAgIH0KICAgICAgICB9LAogICAgICAgIG1lc3NhZ2UodGV4dCwgZGlzYXBwZWFyVGltZSA9IDUwMDApIHsKICAgICAgICAgICAgY29uc3QgaWQgPSAiZjgyNDNyZDIzOC1nbS1tZXNzYWdlLXBhbmVsIjsKICAgICAgICAgICAgbGV0IHAgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGAjJHtpZH1gKTsKICAgICAgICAgICAgaWYgKCFwKSB7CiAgICAgICAgICAgICAgICBwID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICAgICAgICAgICAgICBwLmlkID0gaWQ7CiAgICAgICAgICAgICAgICBwLnN0eWxlID0gYAogICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOiBmaXhlZDsKICAgICAgICAgICAgICAgICAgICBib3R0b206IDIwcHg7CiAgICAgICAgICAgICAgICAgICAgcmlnaHQ6IDIwcHg7CiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogZmxleDsKICAgICAgICAgICAgICAgICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uOwogICAgICAgICAgICAgICAgICAgIGFsaWduLWl0ZW1zOiBlbmQ7CiAgICAgICAgICAgICAgICAgICAgei1pbmRleDogOTk5OTk5OTk5OTk5OTk5OwogICAgICAgICAgICAgICAgYDsKICAgICAgICAgICAgICAgIChkb2N1bWVudC5ib2R5IHx8IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudCkuYXBwZW5kQ2hpbGQocCk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbGV0IG1kaXYgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJkaXYiKTsKICAgICAgICAgICAgbWRpdi5pbm5lclRleHQgPSB0ZXh0OwogICAgICAgICAgICBtZGl2LnN0eWxlID0gYAogICAgICAgICAgICAgICAgcGFkZGluZzogM3B4IDhweDsKICAgICAgICAgICAgICAgIGJvcmRlci1yYWRpdXM6IDVweDsKICAgICAgICAgICAgICAgIGJhY2tncm91bmQ6IGJsYWNrOwogICAgICAgICAgICAgICAgYm94LXNoYWRvdzogIzAwMCAxcHggMnB4IDVweDsKICAgICAgICAgICAgICAgIG1hcmdpbi10b3A6IDEwcHg7CiAgICAgICAgICAgICAgICBmb250LXNpemU6IHNtYWxsOwogICAgICAgICAgICAgICAgY29sb3I6ICNmZmY7CiAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOiByaWdodDsKICAgICAgICAgICAgYDsKICAgICAgICAgICAgcC5hcHBlbmRDaGlsZChtZGl2KTsKICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgICAgICAgICBwLnJlbW92ZUNoaWxkKG1kaXYpOwogICAgICAgICAgICB9LCBkaXNhcHBlYXJUaW1lKTsKICAgICAgICB9CiAgICB9OwoKCiAgICBpZiAobG9jYXRpb24uaG9zdCA9PT0gInRvb2xzLnRoYXR3aW5kLmNvbSIgfHwgbG9jYXRpb24uaG9zdCA9PT0gImxvY2FsaG9zdDozMDAwIikgewogICAgICAgIG1nbWFwaS5hZGRTdHlsZSgiI3VzZXJzY3JpcHQtdGlwe2Rpc3BsYXk6bm9uZSAhaW1wb3J0YW50O30iKTsKCiAgICAgICAgLy8g5a+56K+35rGC5YGa5Luj55CGCiAgICAgICAgY29uc3QgX2ZldGNoID0gdW5zYWZlV2luZG93LmZldGNoOwogICAgICAgIHVuc2FmZVdpbmRvdy5mZXRjaCA9IGFzeW5jIGZ1bmN0aW9uICguLi5hcmdzKSB7CiAgICAgICAgICAgIHRyeSB7CiAgICAgICAgICAgICAgICBsZXQgcmVzcG9uc2UgPSBhd2FpdCBfZmV0Y2goLi4uYXJncyk7CiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2Uuc3RhdHVzICE9PSAyMDApIHRocm93IG5ldyBFcnJvcihyZXNwb25zZS5zdGF0dXMpOwogICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlOwogICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAgICAgICAvLyDlpLHotKXor7fmsYLkvb/nlKjku6PnkIYKICAgICAgICAgICAgICAgIGlmIChhcmdzLmxlbmd0aCA9PSAxKSB7CiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coYOivt+axguS7o+eQhu+8miR7YXJnc1swXX1gKTsKICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXdhaXQgbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4gewogICAgICAgICAgICAgICAgICAgICAgICBsZXQgcmVmZXJlciA9IG5ldyBVUkxTZWFyY2hQYXJhbXMobG9jYXRpb24uaGFzaC5zbGljZSgxKSkuZ2V0KCJyZWZlcmVyIik7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBoZWFkZXJzID0ge307CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChyZWZlcmVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWZlcmVyID0gbmV3IFVSTChyZWZlcmVyKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIm9yaWdpbiI6IHJlZmVyZXIub3JpZ2luLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJyZWZlcmVyIjogcmVmZXJlci5ocmVmCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIG1nbWFwaS54bWxIdHRwUmVxdWVzdCh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtZXRob2Q6ICJHRVQiLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgdXJsOiBhcmdzWzBdLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2VUeXBlOiAnYXJyYXlidWZmZXInLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVycywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9ubG9hZChyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVzb2x2ZSh7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN0YXR1czogci5zdGF0dXMsCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IG5ldyBIZWFkZXJzKHIucmVzcG9uc2VIZWFkZXJzLnNwbGl0KCJcbiIpLmZpbHRlcihuID0+IG4pLm1hcChzID0+IHMuc3BsaXQoLzpccyovKSkucmVkdWNlKChhbGwsIFthLCBiXSkgPT4geyBhbGxbYV0gPSBiOyByZXR1cm4gYWxsOyB9LCB7fSkpLAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc3luYyB0ZXh0KCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHIucmVzcG9uc2VUZXh0OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhc3luYyBhcnJheUJ1ZmZlcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByLnJlc3BvbnNlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25lcnJvcigpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWplY3QobmV3IEVycm9yKCkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgdGhyb3cgZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgcmV0dXJuOwogICAgfQoKCiAgICAvLyBpZnJhbWUg5L+h5oGv5Lqk5rWBCiAgICAvLyDnm67liY3lj6rnlKjkuo7ojrflj5bpobbpg6jmoIfpopgKICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIiwgYXN5bmMgKGUpID0+IHsKICAgICAgICBpZiAoZS5kYXRhID09PSAiM2o0dDl1ajM0OS1nbS1nZXQtdGl0bGUiKSB7CiAgICAgICAgICAgIGxldCBuYW1lID0gYHRvcC10aXRsZS0ke0RhdGUubm93KCl9YDsKICAgICAgICAgICAgYXdhaXQgbWdtYXBpLnNldFZhbHVlKG5hbWUsIGRvY3VtZW50LnRpdGxlKTsKICAgICAgICAgICAgZS5zb3VyY2UucG9zdE1lc3NhZ2UoYDNqNHQ5dWozNDktZ20tdG9wLXRpdGxlLW5hbWU6JHtuYW1lfWAsICIqIik7CiAgICAgICAgfQogICAgfSk7CgogICAgZnVuY3Rpb24gZ2V0VG9wVGl0bGUoKSB7CiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKHJlc29sdmUgPT4gewogICAgICAgICAgICB3aW5kb3cuYWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIGFzeW5jIGZ1bmN0aW9uIGwoZSkgewogICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBlLmRhdGEgPT09ICJzdHJpbmciKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGUuZGF0YS5zdGFydHNXaXRoKCIzajR0OXVqMzQ5LWdtLXRvcC10aXRsZS1uYW1lOiIpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGxldCBuYW1lID0gZS5kYXRhLnNsaWNlKCIzajR0OXVqMzQ5LWdtLXRvcC10aXRsZS1uYW1lOiIubGVuZ3RoKTsKICAgICAgICAgICAgICAgICAgICAgICAgYXdhaXQgbmV3IFByb21pc2UociA9PiBzZXRUaW1lb3V0KHIsIDUpKTsgLy8g562JNeavq+enkiDnoa7lrpogc2V0VmFsdWUg5bey57uP5YaZ5YWlCiAgICAgICAgICAgICAgICAgICAgICAgIHJlc29sdmUoYXdhaXQgbWdtYXBpLmdldFZhbHVlKG5hbWUpKTsKICAgICAgICAgICAgICAgICAgICAgICAgbWdtYXBpLmRlbGV0ZVZhbHVlKG5hbWUpOwogICAgICAgICAgICAgICAgICAgICAgICB3aW5kb3cucmVtb3ZlRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsIGwpOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIHdpbmRvdy50b3AucG9zdE1lc3NhZ2UoIjNqNHQ5dWozNDktZ20tZ2V0LXRpdGxlIiwgIioiKTsKICAgICAgICB9KTsKICAgIH0KCgogICAgewogICAgICAgIC8vIOivt+axguajgOa1iwogICAgICAgIC8vIGNvbnN0IF9mZXRjaCA9IHVuc2FmZVdpbmRvdy5mZXRjaDsKICAgICAgICAvLyB1bnNhZmVXaW5kb3cuZmV0Y2ggPSBmdW5jdGlvbiAoLi4uYXJncykgewogICAgICAgIC8vICAgICBpZiAoY2hlY2tVcmwoYXJnc1swXSkpIGRvTTNVKHsgdXJsOiBhcmdzWzBdIH0pOwogICAgICAgIC8vICAgICByZXR1cm4gX2ZldGNoKC4uLmFyZ3MpOwogICAgICAgIC8vIH0KCiAgICAgICAgY29uc3QgX3JfdGV4dCA9IHVuc2FmZVdpbmRvdy5SZXNwb25zZS5wcm90b3R5cGUudGV4dDsKICAgICAgICB1bnNhZmVXaW5kb3cuUmVzcG9uc2UucHJvdG90eXBlLnRleHQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzb2x2ZSwgcmVqZWN0KSA9PiB7CiAgICAgICAgICAgICAgICBfcl90ZXh0LmNhbGwodGhpcykudGhlbigodGV4dCkgPT4gewogICAgICAgICAgICAgICAgICAgIHJlc29sdmUodGV4dCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKGNoZWNrQ29udGVudCh0ZXh0KSkgZG9NM1UoeyB1cmw6IHRoaXMudXJsLCBjb250ZW50OiB0ZXh0IH0pOwogICAgICAgICAgICAgICAgfSkuY2F0Y2gocmVqZWN0KTsKICAgICAgICAgICAgfSk7CiAgICAgICAgfQoKICAgICAgICBjb25zdCBfb3BlbiA9IHVuc2FmZVdpbmRvdy5YTUxIdHRwUmVxdWVzdC5wcm90b3R5cGUub3BlbjsKICAgICAgICB1bnNhZmVXaW5kb3cuWE1MSHR0cFJlcXVlc3QucHJvdG90eXBlLm9wZW4gPSBmdW5jdGlvbiAoLi4uYXJncykgewogICAgICAgICAgICB0aGlzLmFkZEV2ZW50TGlzdGVuZXIoImxvYWQiLCAoKSA9PiB7CiAgICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgICAgIGxldCBjb250ZW50ID0gdGhpcy5yZXNwb25zZVRleHQ7CiAgICAgICAgICAgICAgICAgICAgaWYgKGNoZWNrQ29udGVudChjb250ZW50KSkgZG9NM1UoeyB1cmw6IGFyZ3NbMV0sIGNvbnRlbnQgfSk7CiAgICAgICAgICAgICAgICB9IGNhdGNoIHsgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgLy8gY2hlY2tVcmwoYXJnc1sxXSk7CiAgICAgICAgICAgIHJldHVybiBfb3Blbi5hcHBseSh0aGlzLCBhcmdzKTsKICAgICAgICB9CgoKICAgICAgICBmdW5jdGlvbiBjaGVja1VybCh1cmwpIHsKICAgICAgICAgICAgdXJsID0gbmV3IFVSTCh1cmwsIGxvY2F0aW9uLmhyZWYpOwogICAgICAgICAgICBpZiAodXJsLnBhdGhuYW1lLmVuZHNXaXRoKCIubTN1OCIpIHx8IHVybC5wYXRobmFtZS5lbmRzV2l0aCgiLm0zdSIpKSB7CiAgICAgICAgICAgICAgICAvLyDlj5HnjrAKICAgICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgICB9CiAgICAgICAgfQoKICAgICAgICBmdW5jdGlvbiBjaGVja0NvbnRlbnQoY29udGVudCkgewogICAgICAgICAgICBpZiAoY29udGVudC50cmltKCkuc3RhcnRzV2l0aCgiI0VYVE0zVSIpKSB7CiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgfQogICAgICAgIH0KCgogICAgICAgIC8vIOajgOafpee6r+inhumikQogICAgICAgIHNldEludGVydmFsKGRvVmlkZW9zLCAxMDAwKTsKCiAgICB9CgogICAgY29uc3Qgcm9vdERpdiA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImRpdiIpOwogICAgcm9vdERpdi5zdHlsZSA9IGAKICAgICAgICBwb3NpdGlvbjogZml4ZWQ7CiAgICAgICAgei1pbmRleDogOTk5OTk5OTk5OTk5OTk5OTsKICAgICAgICBvcGFjaXR5OiAwLjk7CiAgICBgOwogICAgcm9vdERpdi5zdHlsZS5kaXNwbGF5ID0gIm5vbmUiOwogICAgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LmFwcGVuZENoaWxkKHJvb3REaXYpOwoKICAgIGNvbnN0IHNoYWRvd0RPTSA9IHJvb3REaXYuYXR0YWNoU2hhZG93KHsgbW9kZTogJ29wZW4nIH0pOwogICAgY29uc3Qgd3JhcHBlciA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImRpdiIpOwogICAgc2hhZG93RE9NLmFwcGVuZENoaWxkKHdyYXBwZXIpOwoKCiAgICAvLyDmjIfnpLrlmagKICAgIGNvbnN0IGJhciA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImRpdiIpOwogICAgYmFyLnN0eWxlID0gYAogICAgICAgIHRleHQtYWxpZ246IHJpZ2h0OwogICAgYDsKICAgIGJhci5pbm5lckhUTUwgPSBgCiAgICAgICAgPHNwYW4KICAgICAgICAgICAgY2xhc3M9Im51bWJlci1pbmRpY2F0b3IiCiAgICAgICAgICAgIGRhdGEtbnVtYmVyPSIwIgogICAgICAgICAgICBzdHlsZT0iCiAgICAgICAgICAgICAgICBkaXNwbGF5OiBpbmxpbmUtZmxleDsKICAgICAgICAgICAgICAgIHdpZHRoOiAyNXB4OwogICAgICAgICAgICAgICAgaGVpZ2h0OiAyNXB4OwogICAgICAgICAgICAgICAgYmFja2dyb3VuZDogYmxhY2s7CiAgICAgICAgICAgICAgICBwYWRkaW5nOiAxMHB4OwogICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogMTAwcHg7CiAgICAgICAgICAgICAgICBtYXJnaW4tYm90dG9tOiA1cHg7CiAgICAgICAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7CiAgICAgICAgICAgICAgICBib3JkZXI6IDNweCBzb2xpZCAjODM4MzgzODI7CiAgICAgICAgICAgICIKICAgICAgICA+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AgICAgICAgICBDMzU4LjE1OSw3MC41OTksMzU4LjkyNiw3MC40NzYsMzU5LjcyMyw3MC40NzZ6IE0zOTAuODczLDM2NC41MTlWMjQ1LjI0MWMwLTEuMDcsMC42MTUtMi4wNzEsMS41ODYtMi41MjEKICAgICAgICAgICAgICAgICAgICBjMC45ODEtMC40ODMsMi4xMy0wLjM2NSwyLjk4MSwwLjMwN2w5My4zOTMsNTkuNjIzYzAuNjY2LDAuNTU2LDEuMDY1LDEuMzc2LDEuMDY1LDIuMjE1YzAsMC44NDEtMC4zOTksMS42Ny0xLjA2NSwyLjIxNQogICAgICAgICAgICAgICAgICAgIGwtOTMuMzk3LDU5LjYyOGMtMC41MDksMC40LTEuMTE0LDAuNjEtMS43NDMsMC42MWwtMS4yMzMtMC4yODlDMzkxLjQ4OCwzNjYuNTg4LDM5MC44NzMsMzY1LjU4NSwzOTAuODczLDM2NC41MTl6IiAvPgogICAgICAgICAgICAgICAgPC9nPgogICAgICAgICAgICA8L3N2Zz4KICAgICAgICA8L3NwYW4+CiAgICBgOwoKICAgIHdyYXBwZXIuYXBwZW5kQ2hpbGQoYmFyKTsKCiAgICAvLyDmoLflvI8KICAgIGNvbnN0IHN0eWxlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic3R5bGUiKTsKCiAgICBzdHlsZS5pbm5lckhUTUwgPSBgCiAgICAgICAgLm51bWJlci1pbmRpY2F0b3J7CiAgICAgICAgICAgIHBvc2l0aW9uOnJlbGF0aXZlOwogICAgICAgIH0KCiAgICAgICAgLm51bWJlci1pbmRpY2F0b3I6OmFmdGVyewogICAgICAgICAgICBjb250ZW50OiBhdHRyKGRhdGEtbnVtYmVyKTsKICAgICAgICAgICAgcG9zaXRpb246IGFic29sdXRlOwogICAgICAgICAgICBib3R0b206IDA7CiAgICAgICAgICAgIHJpZ2h0OiAwOwogICAgICAgICAgICBjb2xvcjogIzQwYTlmZjsKICAgICAgICAgICAgZm9udC1zaXplOiAxNHB4OwogICAgICAgICAgICBmb250LXdlaWdodDogYm9sZDsKICAgICAgICAgICAgYmFja2dyb3VuZDogIzAwMDsKICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogMTBweDsKICAgICAgICAgICAgcGFkZGluZzogM3B4IDVweDsKICAgICAgICB9CgogICAgICAgIC5jb3B5LWxpbms6YWN0aXZlewogICAgICAgICAgICBjb2xvcjogI2NjYzsKICAgICAgICB9CgogICAgICAgIC5kb3dubG9hZC1idG46aG92ZXJ7CiAgICAgICAgICAgIHRleHQtZGVjb3JhdGlvbjogdW5kZXJsaW5lOwogICAgICAgIH0KICAgICAgICAuZG93bmxvYWQtYnRuOmFjdGl2ZXsKICAgICAgICAgICAgb3BhY2l0eTogMC45OwogICAgICAgIH0KCiAgICAgICAgLm0zdTgtaXRlbXsKICAgICAgICAgICAgY29sb3I6IHdoaXRlOwogICAgICAgICAgICBtYXJnaW4tYm90dG9tOiA1cHg7CiAgICAgICAgICAgIGRpc3BsYXk6IGZsZXg7CiAgICAgICAgICAgIGZsZXgtZGlyZWN0aW9uOiByb3c7CiAgICAgICAgICAgIGJhY2tncm91bmQ6IGJsYWNrOwogICAgICAgICAgICBwYWRkaW5nOiAzcHggMTBweDsKICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogM3B4OwogICAgICAgICAgICBmb250LXNpemU6IDE0cHg7CiAgICAgICAgICAgIHVzZXItc2VsZWN0OiBub25lOwogICAgICAgIH0KCiAgICAgICAgW2RhdGEtc2hvd249ImZhbHNlIl0gewogICAgICAgICAgICBvcGFjaXR5OiAwLjg7CiAgICAgICAgICAgIHpvb206IDAuODsKICAgICAgICB9CgogICAgICAgIFtkYXRhLXNob3duPSJmYWxzZSJdOmhvdmVyewogICAgICAgICAgICBvcGFjaXR5OiAxOwogICAgICAgIH0KCiAgICAgICAgW2RhdGEtc2hvd249ImZhbHNlIl0gLm0zdTgtaXRlbXsKICAgICAgICAgICAgZGlzcGxheTogbm9uZTsKICAgICAgICB9CgogICAgYDsKCiAgICB3cmFwc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gICAgICAgICAgICAgaWYgKG1vdmVkIHx8IChNYXRoLmFicyhvZmZzZXRYKSArIE1hdGguYWJzKG9mZnNldFkpKSA+IDUpIHsKICAgICAgICAgICAgICAgICAgICBtb3ZlZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgcm9vdERpdi5zdHlsZS50b3AgPSBgJHt5ICsgb2Zmc2V0WX1weGA7CiAgICAgICAgICAgICAgICAgICAgcm9vdERpdi5zdHlsZS5yaWdodCA9IGAke3ggLSBvZmZzZXRYfXB4YDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfTsKICAgICAgICAgICAgbGV0IG1vdXNldXAgPSBlID0+IHsKCiAgICAgICAgICAgICAgICBsZXQgb2Zmc2V0WCA9IGUucGFnZVggLSBzdGFydFg7CiAgICAgICAgICAgICAgICBsZXQgb2Zmc2V0WSA9IGUucGFnZVkgLSBzdGFydFk7CgogICAgICAgICAgICAgICAgaWYgKG1vdmVkKSB7CiAgICAgICAgICAgICAgICAgICAgeCAtPSBvZmZzZXRYOwogICAgICAgICAgICAgICAgICAgIHkgKz0gb2Zmc2V0WTsKICAgICAgICAgICAgICAgICAgICBtZ21hcGkuc2V0VmFsdWUoIngiLCB4KTsKICAgICAgICAgICAgICAgICAgICBtZ21hcGkuc2V0VmFsdWUoInkiLCB5KTsKICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgc2hvd24gPSAhc2hvd247CiAgICAgICAgICAgICAgICAgICAgbWdtYXBpLnNldFZhbHVlKCJzaG93biIsIHNob3duKTsKICAgICAgICAgICAgICAgICAgICB3cmFwcGVyLnNldEF0dHJpYnV0ZSgiZGF0YS1zaG93biIsIHNob3duKTsKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICByZW1vdmVFdmVudExpc3RlbmVyKCJtb3VzZW1vdmUiLCBtb3VzZW1vdmUpOwogICAgICAgICAgICAgICAgcmVtb3ZlRXZlbnRMaXN0ZW5lcigibW91c2V1cCIsIG1vdXNldXApOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGFkZEV2ZW50TGlzdGVuZXIoIm1vdXNlbW92ZSIsIG1vdXNlbW92ZSk7CiAgICAgICAgICAgIGFkZEV2ZW50TGlzdGVuZXIoIm1vdXNldXAiLCBtb3VzZXVwKTsKICAgICAgICB9KTsKICAgIH0pKCk7CgoKCgoKCiAgICBsZXQgY291bnQgPSAwOwogICAgbGV0IHNob3duVXJscyA9IFtdOwoKCiAgICBmdW5jdGlvbiBkb1ZpZGVvcygpIHsKICAgICAgICBmb3IgKGxldCB2IG9mIEFycmF5LmZyb20oZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgidmlkZW8iKSkpIHsKICAgICAgICAgICAgaWYgKHYuZHVyYXRpb24gJiYgdi5zcmMgJiYgdi5zcmMuc3RhcnRzV2l0aCgiaHR0cCIpICYmICghc2hvd25VcmxzLmluY2x1ZGVzKHYuc3JjKSkpIHsKICAgICAgICAgICAgICAgIGNvbnN0IHNyYyA9IHYuc3JjOwoKICAgICAgICAgICAgICAgIHNob3duVXJscy5wdXNoKHNyYyk7CiAgICAgICAgICAgICAgICBzaG93VmlkZW8oewogICAgICAgICAgICAgICAgICAgIHR5cGU6ICJ2aWRlbyIsCiAgICAgICAgICAgICAgICAgICAgdXJsOiBuZXcgVVJMKHNyYyksCiAgICAgICAgICAgICAgICAgICAgZHVyYXRpb246IGAke01hdGguY2VpbCh2LmR1cmF0aW9uICogMTAgLyA2MCkgLyAxMH0gbWluc2AsCiAgICAgICAgICAgICAgICAgICAgZG93bmxvYWQoKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGRldGFpbHMgPSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB1cmw6IHNyYywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5hbWU6ICgoKSA9PiB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGV0IG5hbWUgPSBuZXcgVVJMKHNyYykucGF0aG5hbWUuc3BsaXQoIi8iKS5zbGljZSgtMSlbMF07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEvXC5cdyskLy50ZXN0KG5hbWUpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuYW1lLm1hdGNoKC9eXHMqJC8pKSBuYW1lID0gRGF0ZS5ub3coKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZSA9IG5hbWUgKyAiLm1wNCI7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuYW1lOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkoKSwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZWZlcmVyOiBsb2NhdGlvbi5vcmlnaW4sIC8vIOS4jeWFgeiuuOivpeWktAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG9yaWdpbjogbG9jYXRpb24ub3JpZ2luCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICAgICAgICAgb25lcnJvcihlKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWdtYXBpLm9wZW5JblRhYihzcmMpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICBtZ21hcGkuZG93bmxvYWQoZGV0YWlscyk7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KCiAgICBhc3luYyBmdW5jdGlvbiBkb00zVSh7IHVybCwgY29udGVudCB9KSB7CgogICAgICAgIHVybCA9IG5ldyBVUkwodXJsKTsKCiAgICAgICAgaWYgKHNob3duVXJscy5pbmNsdWRlcyh1cmwuaHJlZikpIHJldHVybjsKCiAgICAgICAgLy8g6Kej5p6QIG0zdQogICAgICAgIGNvbnRlbnQgPSBjb250ZW50IHx8IGF3YWl0IChhd2FpdCBmZXRjaCh1cmwpKS50ZXh0KCk7CgogICAgICAgIGNvbnN0IHBhcnNlciA9IG5ldyBtM3U4UGFyc2VyLlBhcnNlcigpOwogICAgICAgIHBhcnNlci5wdXNoKGNvbnRlbnQpOwogICAgICAgIHBhcnNlci5lbmQoKTsKICAgICAgICBjb25zdCBtYW5pZmVzdCA9IHBhcnNlci5tYW5pZmVzdDsKCiAgICAgICAgaWYgKG1hbmlmZXN0LnNlZ21lbnRzKSB7CiAgICAgICAgICAgIGxldCBkdXJhdGlvbiA9IDA7CiAgICAgICAgICAgIG1hbmlmZXN0LnNlZ21lbnRzLmZvckVhY2goKHNlZ21lbnQpID0+IHsKICAgICAgICAgICAgICAgIGR1cmF0aW9uICs9IHNlZ21lbnQuZHVyYXRpb247CiAgICAgICAgICAgIH0pOwogICAgICAgICAgICBtYW5pZmVzdC5kdXJhdGlvbiA9IGR1cmF0aW9uOwogICAgICAgIH0KCiAgICAgICAgc2hvd1ZpZGVvKHsKICAgICAgICAgICAgdHlwZTogIm0zdTgiLAogICAgICAgICAgICB1cmwsCiAgICAgICAgICAgIGR1cmF0aW9uOiBtYW5pZmVzdC5kdXJhdGlvbiA/IGAke01hdGguY2VpbChtYW5pZmVzdC5kdXJhdGlvbiAqIDEwIC8gNjApIC8gMTB9IG1pbnNgIDogbWFuaWZlc3QucGxheWxpc3RzID8gYOWkmihNdWx0aSkoJHttYW5pZmVzdC5wbGF5bGlzdHMubGVuZ3RofSlgIDogIuacquefpSh1bmtub3duKSIsCiAgICAgICAgICAgIGFzeW5jIGRvd25sb2FkKCkgewogICAgICAgICAgICAgICAgbWdtYXBpLm9wZW5JblRhYigKICAgICAgICAgICAgICAgICAgICBgaHR0cHM6Ly90b29scy50aGF0d2luZC5jb20vdG9vbC9tM3U4ZG93bmxvYWRlciMke25ldyBVUkxTZWFyY2hQYXJhbXMoewogICAgICAgICAgICAgICAgICAgICAgICBtM3U4OiB1cmwuaHJlZiwKICAgICAgICAgICAgICAgICAgICAgICAgcmVmZXJlcjogbG9jYXRpb24uaHJlZiwKICAgICAgICAgICAgICAgICAgICAgICAgZmlsZW5hbWU6IChhd2FpdCBnZXRUb3BUaXRsZSgpKSB8fCAiIgogICAgICAgICAgICAgICAgICAgIH0pfWAKICAgICAgICAgICAgICAgICk7CiAgICAgICAgICAgIH0KICAgICAgICB9KQoKICAgIH0KCgoKICAgIGFzeW5jIGZ1bmN0aW9uIHNob3dWaWRlbyh7CiAgICAgICAgdHlwZSwKICAgICAgICB1cmwsCiAgICAgICAgZHVyYXRpb24sCiAgICAgICAgZG93bmxvYWQKICAgIH0pIHsKICAgICAgICBsZXQgZGl2ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7CiAgICAgICAgZGl2LmNsYXNzTmFtZSA9ICJtM3U4LWl0ZW0iOwogICAgICAgIGRpdi5pbm5lckhUTUwgPSBgCiAgICAgICAgICAgIDxzcGFuPiR7dHlwZX08L3NwYW4+CiAgICAgICAgICAgIDxzcGFuCiAgICAgICAgICAgICAgICBjbGFzcz0iY29weS1saW5rIgogICAgICAgICAgICAgICAgdGl0bGU9IiR7dXJsfSIKICAgICAgICAgICAgICAgIHN0eWxlPSIKICAgICAgICAgICAgICAgICAgICBtYXgtd2lkdGg6IDIwMHB4OwogICAgICAgICAgICAgICAgICAgIHRleHQtb3ZlcmZsb3c6IGVsbGlwc2lzOwogICAgICAgICAgICAgICAgICAgIHdoaXRlLXNwYWNlOiBub3dyYXA7CiAgICAgICAgICAgICAgICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgICAgICAgICAgICAgICAgICBtYXJnaW4tbGVmdDogMTBweDsKICAgICAgICAgICAgICAgICIKICAgICAgICAgICAgPiR7dXJsLnBhdGhuYW1lfTwvc3Bhbj4KICAgICAgICAgICAgPHNwYW4gCiAgICAgICAgICAgICAgICBzdHlsZT0iCiAgICAgICAgICAgICAgICAgICAgbWFyZ2luLWxlZnQ6IDEwcHg7CiAgICAgICAgICAgICAgICAgICAgZmxleC1ncm93OiAxOwogICAgICAgICAgICAgICAgIgogICAgICAgICAgICA+JHtkdXJhdGlvbn08L3NwYW4+CiAgICAgICAgICAgIDxzcGFuCiAgICAgICAgICAgICAgICBjbGFzcz0iZG93bmxvYWQtYnRuIgogICAgICAgICAgICAgICAgc3R5bGU9IgogICAgICAgICAgICAgICAgICAgIG1hcmdpbi1sZWZ0OiAxMHB4OwogICAgICAgICAgICAgICAgICAgIGN1cnNvcjogcG9pbnRlcjsKICAgICAgICAgICAgIj7kuIvovb0oRG93bmxvYWQpPC9zcGFuPgogICAgICAgIGA7CgogICAgICAgIGRpdi5xdWVyeVNlbGVjdG9yKCIuY29weS1saW5rIikuYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCAoKSA9PiB7CiAgICAgICAgICAgIC8vIOWkjeWItumTvuaOpQogICAgICAgICAgICBtZ21hcGkuY29weVRleHQodXJsLmhyZWYpOwogICAgICAgICAgICBtZ21hcGkubWVzc2FnZSgi5bey5aSN5Yi26ZO+5o6lIChsaW5rIGNvcGllZCkiLCAyMDAwKTsKICAgICAgICB9KTsKCiAgICAgICAgZGl2LnF1ZXJ5U2VsZWN0b3IoIi5kb3dubG9hZC1idG4iKS5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGRvd25sb2FkKTsKCiAgICAgICAgcm9vdERpdi5zdHlsZS5kaXNwbGF5ID0gImJsb2NrIjsKCiAgICAgICAgY291bnQrKzsKCiAgICAgICAgc2hvd25VcmxzLnB1c2godXJsLmhyZWYpOwoKICAgICAgICBiYXIucXVlcnlTZWxlY3RvcigiLm51bWJlci1pbmRpY2F0b3IiKS5zZXRBdHRyaWJ1dGUoImRhdGEtbnVtYmVyIiwgY291bnQpOwoKICAgICAgICB3cmFwcGVyLmFwcGVuZENoaWxkKGRpdik7CiAgICB9Cgp9KSgpOwoKKGZ1bmN0aW9uICgpIHsKICAgICd1c2Ugc3RyaWN0JzsKCiAgICBjb25zdCByZWcgPSAvbWFnbmV0Olw/eHQ9dXJuOmJ0aWg6XHd7MTAsfShbLWEtekEtWjAtOSgpQDolX1wrLn4jPyYvLz1dKikvOwoKICAgIGxldCBsID0gbmF2aWdhdG9yLmxhbmd1YWdlIHx8ICJlbiI7CiAgICBpZiAobC5zdGFydHNXaXRoKCJlbi0iKSkgbCA9ICJlbiI7CiAgICBlbHNlIGlmIChsLnN0YXJ0c1dpdGgoInpoLSIpKSBsID0gInpoLUNOIjsKICAgIGVsc2UgbCA9ICJlbiI7CgogICAgY29uc3QgVCA9IHsKICAgICAgICAiZW4iOiB7CiAgICAgICAgICAgIHBsYXk6ICJQbGF5IgogICAgICAgIH0sCiAgICAgICAgInpoLUNOIjogewogICAgICAgICAgICBwbGF5OiAn5pKt5pS+JwogICAgICAgIH0KICAgIH1bbF07CgogICAgd2hlbkRPTVJlYWR5KCgpID0+IHsKICAgICAgICBhZGRTdHlsZShgCiAgICAgICAgICAgIGJ1dHRvbltkYXRhLXd0bXpqay1tYWctdXJsXXsKICAgICAgICAgICAgICAgIGFsbDogaW5pdGlhbDsKICAgICAgICAgICAgICAgIGJvcmRlcjogbm9uZTsKICAgICAgICAgICAgICAgIG91dGxpbmU6IG5vbmU7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kOiBub25lOwogICAgICAgICAgICAgICAgYmFja2dyb3VuZDogI2Y3ZDMwODsKICAgICAgICAgICAgICAgIGJhY2tncm91bmQ6ICMwOGE2Zjc7CiAgICAgICAgICAgICAgICBtYXJnaW46IDJweCA4cHg7CiAgICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiAzcHg7CiAgICAgICAgICAgICAgICBjb2xvcjogd2hpdGU7CiAgICAgICAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7CiAgICAgICAgICAgICAgICBkaXNwbGF5OiBpbmxpbmUtZmxleDsKICAgICAgICAgICAgICAgIGhlaWdodDogMS42ZW07CiAgICAgICAgICAgICAgICBwYWRkaW5nOiAwIC44ZW07CiAgICAgICAgICAgICAgICBhbGlnbi1pdGVtczogY2VudGVyOwogICAgICAgICAgICAgICAganVzdGlmeS1jb250ZW50OiBjZW50ZXI7CiAgICAgICAgICAgICAgICB0cmFuc2l0aW9uOiBiYWNrZ3JvdW5kIC4xNXM7CiAgICAgICAgICAgICAgICB0ZXh0LWRlY29yYXRpb246IG5vbmU7CiAgICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiAwLjhlbTsKICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogc21hbGw7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnV0dG9uW2RhdGEtd3RtemprLW1hZy11cmxdPnN2Z3sKICAgICAgICAgICAgICAgIGhlaWdodDogNjAlOwogICAgICAgICAgICAgICAgZmlsbDogd2hpdGU7CiAgICAgICAgICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTsKICAgICAgICAgICAgfQogICAgICAgICAgICBidXR0b25bZGF0YS13dG16amstbWFnLXVybF06aG92ZXJ7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kOiAjZmFlMTU3OwogICAgICAgICAgICAgICAgYmFja2dyb3VuZDogIzM5YjlmOTsKICAgICAgICAgICAgfQogICAgICAgICAgICBidXR0b25bZGF0YS13dG16amstbWFnLXVybF06YWN0aXZlewogICAgICAgICAgICAgICAgYmFja2dyb3VuZDogI2RmYmUwNzsKICAgICAgICAgICAgICAgIGJhY2tncm91bmQ6ICMwNzk3ZGY7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYnV0dG9uW2RhdGEtd3RtemprLW1hZy11cmxdPnNwYW57CiAgICAgICAgICAgICAgICBwb2ludGVyLWV2ZW50czogbm9uZTsKICAgICAgICAgICAgICAgIGZvbnQtc2l6ZTogc21hbGw7bWFyZ2luLXJpZ2h0OiAuNWVtO2ZvbnQtd2VpZ2h0OmJ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5sZW5ndGggIT0gKG0gPyBtLmxlbmd0aCA6IDApOwogICAgfQoKICAgIGZ1bmN0aW9uIHdvcmsoKSB7CiAgICAgICAgaWYgKCFkb2N1bWVudC5ib2R5KSByZXR1cm47CiAgICAgICAgaWYgKGhhc1BsYWluTWFnVXJsVGhhdE5vdEhhbmRsZWQoKSkgewogICAgICAgICAgICBmb3IgKGxldCBub2RlIG9mIGdldEFsbFRleHROb2Rlcyhkb2N1bWVudC5ib2R5KSkgewogICAgICAgICAgICAgICAgaWYgKG5vZGUubmV4dFNpYmxpbmcgJiYgbm9kZS5uZXh0U2libGluZy5oYXNBdHRyaWJ1dGUgJiYgbm9kZS5uZXh0U2libGluZy5oYXNBdHRyaWJ1dGUoJ2RhdGEtd3RtemprLW1hZy11cmwnKSkgY29udGludWU7CiAgICAgICAgICAgICAgICBsZXQgdGV4dCA9IG5vZGUubm9kZVZhbHVlOwogICAgICAgICAgICAgICAgaWYgKCFyZWcudGVzdCh0ZXh0KSkgY29udGludWU7CiAgICAgICAgICAgICAgICBsZXQgbWF0Y2ggPSB0ZXh0Lm1hdGNoKHJlZyk7CiAgICAgICAgICAgICAgICBpZiAobWF0Y2gpIHsKICAgICAgICAgICAgICAgICAgICBsZXQgdXJsID0gbWF0Y2hbMF07CiAgICAgICAgICAgICAgICAgICAgbGV0IHAgPSBub2RlLnBhcmVudE5vZGU7CiAgICAgICAgICAgICAgICAgICAgcC5pbnNlcnRCZWZvcmUoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodGV4dC5zbGljZSgwLCBtYXRjaC5pbmRleCArIHVybC5sZW5ndGgpKSwgbm9kZSk7CiAgICAgICAgICAgICAgICAgICAgcC5pbnNlcnRCZWZvcmUoY3JlYXRlV2F0Y2hCdXR0b24odXJsLCB0cnVlKSwgbm9kZSk7CiAgICAgICAgICAgICAgICAgICAgcC5pbnNlcnRCZWZvcmUoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodGV4dC5zbGljZShtYXRjaC5pbmRleCArIHVybC5sZW5ndGgpKSwgbm9kZSk7CiAgICAgICAgICAgICAgICAgICAgcC5yZW1vdmVDaGlsZChub2RlKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBmb3IgKGxldCBhIG9mIEFycmF5LmZyb20oZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgKICAgICAgICAgICAgWydocmVmJywgJ3ZhbHVlJywgJ2RhdGEtY2xpcGJvYXJkLXRleHQnLCAnZGF0YS12YWx1ZScsICd0aXRsZScsICdhbHQnLCAnZGF0YS11cmwnLCAnZGF0YS1tYWduZXQnLCAnZGF0YS1jb3B5J10ubWFwKG4gPT4gYFske259Kj0ibWFnbmV0Oj94dD11cm46YnRpaDoiXWApLmpvaW4oJywnKQogICAgICAgICkpKSB7CiAgICAgICAgICAgIGlmIChhLm5leHRTaWJsaW5nICYmIGEubmV4dFNpYmxpbmcuaGFzQXR0cmlidXRlICYmIGEubmV4dFNpYmxpbmcuaGFzQXR0cmlidXRlKCdkYXRhLXd0bXpqay1tYWctdXJsJykpIGNvbnRpbnVlOyAvLyDlt7Lnu4/mt7vliqAKICAgICAgICAgICAgaWYgKHJlZy50ZXN0KGEudGV4dENvbnRlbnQpKSBjb250aW51ZTsKICAgICAgICAgICAgZm9yIChsZXQgYXR0ciBvZiBhLmdldEF0dHJpYnV0ZU5hbWVzKCkpIHsKICAgICAgICAgICAgICAgIGxldCB2YWwgPSBhLmdldEF0dHJpYnV0ZShhdHRyKTsKICAgICAgICAgICAgICAgIGlmICghcmVnLnRlc3QodmFsKSkgY29udGludWU7CiAgICAgICAgICAgICAgICBsZXQgdXJsID0gdmFsLm1hdGNoKHJlZylbMF07CiAgICAgICAgICAgICAgICBhLnBhcmVudE5vZGUuaW5zZXJ0QmVmb3JlKGNyZWF0ZVdhdGNoQnV0dG9uKHVybCksIGEubmV4dFNpYmxpbmcpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKCiAgICBmdW5jdGlvbiB3YXRjaEJvZHlDaGFuZ2Uob25jaGFuZ2UpIHsKICAgICAgICBsZXQgdGltZW91dDsKICAgICAgICBsZXQgb2JzZXJ2ZXIgPSBuZXcgTXV0YXRpb25PYnNlcnZlcigoKSA9PiB7CiAgICAgICAgICAgIGlmICghdGltZW91dCkgewogICAgICAgICAgICAgICAgdGltZW91dCA9IHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgIHRpbWVvdXQgPSBudWxsOwogICAgICAgICAgICAgICAgICAgIG9uY2hhbmdlKCk7CiAgICAgICAgICAgICAgICB9LCAyMDApOwogICAgICAgICAgICB9CiAgICAgICAgfSk7CiAgICAgICAgb2JzZXJ2ZXIub2JzZXJ2ZShkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQsIHsKICAgICAgICAgICAgY2hpbGRMaXN0OiB0cnVlLAogICAgICAgICAgICBzdWJ0cmVlOiB0cnVlLAogICAgICAgICAgICBhdHRyaWJ1dGVzOiB0cnVlLAogICAgICAgICAgICBjaGFyYWN0ZXJEYXRhOiB0cnVlCiAgICAgICAgfSk7CgogICAgfQoKICAgIGZ1bmN0aW9uIGdldEFsbFRleHROb2RlcyhwYXJlbnQpIHsKICAgICAgICB2YXIgcmUgPSBbXTsKICAgICAgICBpZiAoWyJTVFlMRSIsICJTQ1JJUFQiLCAiQkFTRSIsICJDT01NQU5EIiwgIkxJTksiLCAiTUVUQSIsICJUSVRMRSIsICJYVFJBTlMtVFhUIiwgIlhUUkFOUy1UWFQtR1JPVVAiLCAiWFRSQU5TLVBPUFVQIl0uaW5jbHVkZXMocGFyZW50LnRhZ05hbWUpKSByZXR1cm4gcmU7CiAgICAgICAgZm9yIChsZXQgbm9kZSBvZiBwYXJlbnQuY2hpbGROb2RlcykgewogICAgICAgICAgICBpZiAobm9kZS5jaGlsZE5vZGVzLmxlbmd0aCkgcmUgPSByZS5jb25jYXQoZ2V0QWxsVGV4dE5vZGVzKG5vZGUpKTsKICAgICAgICAgICAgZWxzZSBpZiAoVGV4dC5wcm90b3R5cGUuaXNQcm90b3R5cGVPZihub2RlKSAmJiAoIW5vZGUubm9kZVZhbHVlLm1hdGNoKC9eXHMqJC8pKSkgcmUucHVzaChub2RlKTsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIHJlOwogICAgfQoKICAgIGZ1bmN0aW9uIHdoZW5ET01SZWFkeShmKSB7CiAgICAgICAgaWYgKGRvY3VtZW50LmJvZHkpIGYoKTsKICAgICAgICBlbHNlIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJET01Db250ZW50TG9hZGVkIiwgZik7CiAgICB9CgogICAgZnVuY3Rpb24gYWRkU3R5bGUocykgewogICAgICAgIGxldCBzdHlsZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoInN0eWxlIik7CiAgICAgICAgc3R5bGUuaW5uZXJIVE1MID0gczsKICAgICAgICBkb2N1bWVudC5kb2N1bWVudEVsZW1lbnQuYXBwZW5kQ2hpbGQoc3R5bGUpOwogICAgfQoKfSkoKTs=
Add Comment
Please, Sign In to add comment