Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:网页插件¥js_url¥global_含羞草@base64://Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQGxpY2Vuc2UgTUlUCi8vIEBuYW1lICAgICAgICAg5ZCr576e6I2J56CU56m25omA5YWN6LS555yLCi8vIEBuYW1lc3BhY2UgICAgaHR0cDovL3RhbXBlcm1vbmtleS5uZXQvCi8vIEB2ZXJzaW9uICAgICAgMC4zLjQKLy8gQGRlc2NyaXB0aW9uICDpkojlr7kg5ZCr576e6I2J56CU56m25omAIOeahOS8mOWMluiEmuacrO+8jOatpOiEmuacrOWPr+S7peiuqeeUqOaIt+ingueci1ZJUOinhumikQovLyBAYXV0aG9yICAgICAgIFlvdQovLyBAbWF0Y2ggICAgICAgIGh0dHBzOi8vd3d3Lmh4Y2JiMTAxLmNvbS8qCi8vIEBtYXRjaCAgICAgICAgaHR0cHM6Ly9oNS5oeGNiYjEwMS5jb20vKgovLyBAaW5jbHVkZSAgICAgICAgL15odHRwczovL3d3dy5oeGNiYlxkK1wuY29tLiskLwovLyBAaW5jbHVkZSAgICAgICAgL15odHRwczovL2g1Lmh4Y2JiXGQrXC5jb20uKyQvCi8vIEBpbmNsdWRlICAgICAgICAvXmh0dHA6Ly93d3cuaHhjYmJcZCtcLmNvbS4rJC8KLy8gQGluY2x1ZGUgICAgICAgIC9eaHR0cDovL2g1Lmh4Y2JiXGQrXC5jb20uKyQvCi8vIEBpbmNsdWRlICAgICAgICAvXmh0dHBzOi8vd3d3Lmh4Y3BwXGQrXC5jb20uKyQvCi8vIEBpbmNsdWRlICAgICAgICAvXmh0dHBzOi8vaDUuaHhjcHBcZCtcLmNvbS4rJC8KLy8gQGluY2x1ZGUgICAgICAgIC9eaHR0cDovL3d3dy5oeGNwcFxkK1wuY29tLiskLwovLyBAaW5jbHVkZSAgICAgICAgL15odHRwOi8vaDUuaHhjcHBcZCtcLmNvbS4rJC8KLy8gQGluY2x1ZGUgIC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KSB7CiAgICAgICAgd2luZG93LmRwLnBhdXNlKCkKICAgICAgICB3aW5kb3cuZHAuZGVzdHJveSgpCiAgICAgICAgd2luZG93LmRwID0gbnVsbDsKICAgIH0KICAgIGlmICh3aW5kb3cucmV0QnRuKSB7CiAgICAgICAgd2luZG93LnJldEJ0bi5yZW1vdmVFdmVudExpc3RlbmVyKCJjbGljayIsIGNsb3NlRHBsYXllcikKICAgIH0KICAgIGlmICh3aW5kb3cuaXRlbXMpIHsKICAgICAgICBpZiAod2luZG93Lml0ZW1zLmxlbmd0aCA+IDApIHsKICAgICAgICAgICAgd2luZG93Lml0ZW1zLmZvckVhY2goaXRlbSA9PiB7CiAgICAgICAgICAgICAgICBpdGVtLnJlbW92ZUV2ZW50TGlzdGVuZXIoImNsaWNrIiwgY2xvc2VEcGxheWVyKQogICAgICAgICAgICB9KQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIHdpbmRvdy5pdGVtcy5yZW1vdmVFdmVudExpc3RlbmVyKCJjbGljayIsIGluaXRNb2JpbGUpCiAgICAgICAgfQogICAgfQogICAgaWYgKHdpbmRvdy5pdGVtczIpIHsKICAgICAgICB3aW5kb3cuaXRlbXMyLmZvckVhY2goaXRlbSA9PiB7CiAgICAgICAgICAgIGl0ZW0ucmVtb3ZlRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBpbml0TW9iaWxlKQogICAgICAgIH0pCiAgICB9CiAgICBpZiAod2luZG93Lml0ZW1zMykgewogICAgICAgIHdpbmRvdy5pdGVtczMuZm9yRWFjaChpdGVtID0+IHsKICAgICAgICAgICAgaXRlbS5yZW1vdmVFdmVudExpc3RlbmVyKCJjbGljayIsIGluaXRNb2JpbGUpCiAgICAgICAgfSkKICAgIH0KICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgIHdpbmRvdy5pdGVtcyA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi52aWRlb0xpc3RCb3giKQogICAgICAgIGlmICh3aW5kb3cuaXRlbXMpIHsKICAgICAgICAgICAgd2luZG93Lml0ZW1zLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgaW5pdE1vYmlsZSkKICAgICAgICB9CgogICAgfSwgMzAwKQoKfQoKCmZ1bmN0aW9uIGg1cGxheShwbGF5ZXJVcmwsIHBpYykgewogICAgLy8gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnZpZGVvQ29udGVudENvbnRhaW5lciIpLnN0eWxlID0gIndpZHRoOiAxMjAwcHg7IGhlaWdodDogNTUwcHg7IgogICAgd2luZG93Lml0ZW1zID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnZpZGVvTGlzdEJveCIpCiAgICB3aW5kb3cuaXRlbXMuYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBpbml0TW9iaWxlKQoKICAgIHdpbmRvdy5yZXRCdG4gPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIudmFuLWljb24udmFuLWljb24tYXJyb3ctbGVmdCIpCiAgICBpZiAod2luZG93LnJldEJ0bikgewogICAgICAgIHdpbmRvdy5yZXRCdG4uYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBpbml0TW9iaWxlLCB0cnVlKQogICAgfQogICAgaWYgKHdpbmRvdy5kcCAhPSBudWxsKSB7CiAgICAgICAgZHAuc3dpdGNoVmlkZW8oCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHVybDogcGxheWVyVXJsLAogICAgICAgICAgICAgICAgcGljOiBwaWMsCiAgICAgICAgICAgICAgICB0eXBlOiAnaGxzJwogICAgICAgICAgICB9CiAgICAgICAgKTsKICAgIH0gZWxzZSB7CiAgICAgICAgbGV0IHZpZGVvQ29udGVudENvbnRhaW5lciA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5WaWRlb0F1dGhBZG1pbkJnIikKICAgICAgICBpZiAodmlkZW9Db250ZW50Q29udGFpbmVyKSB7CiAgICAgICAgICAgIHdpbmRvdy5kcCA9IG5ldyBEUGxheWVyKHsKICAgICAgICAgICAgICAgIGVsZW1lbnQ6IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5WaWRlb0F1dGhBZG1pbkJnIiksICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIxwbGF5ZXLlhYPntKAKICAgICAgICAgICAgICAgIGF1dG9wbGF5OiBmYWxzZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzoh6rliqjmkq3mlL7op4bpopHvvIzkuI3mlK/mjIHnp7vliqjmtY/op4jlmagKICAgICAgICAgICAgICAgIHRoZW1lOiAnI0ZBREZBMycsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzkuLvpopjpopzoibLvvIzpu5jorqQ6ICNiN2RhZmYKICAgICAgICAgICAgICAgIGxvb3A6IHRydWUsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzlvqrnjq/mkq3mlL7pn7PkuZDvvIzpu5jorqTvvJp0cnVlCiAgICAgICAgICAgICAgICBsYW5nOiAnemgnLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5Y+v6YCJ77yM6K+t6KiA77yMYHpoJ+eUqOS6juS4reaWh++8jGBlbifnlKjkuo7oi7Hor63vvIzpu5jorqTvvJpOYXZpZ2F0b3IgbGFuZ3VhZ2UKICAgICAgICAgICAgICAgIHNjcmVlbnNob3Q6IHRydWUsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzlkK/nlKjmiKrlm77lip/og73vvIzpu5jorqTlgLzvvJpmYWxzZe+8jOazqOaEj++8muWmguaenOiuvue9ruS4unRydWXvvIzop4bpopHlkozop4bpopHmiKrlm77lv4XpobvlkK/nlKjot6jln58KICAgICAgICAgICAgICAgIGhvdGtleTogdHJ1ZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIznu5Hlrprng63plK7vvIzljIXmi6zlt6blj7PplK7lkoznqbrmoLzvvIzpu5jorqTlgLzvvJp0cnVlCiAgICAgICAgICAgICAgICBwcmVsb2FkOiAnYXV0bycsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5Y+v6YCJ77yM6aKE5Yqg6L2955qE5pa55byP5Y+v5Lul5pivJ25vbmUnJ21ldGFkYXRhJydhdXRvJ++8jOm7mOiupOWAvO+8midhdXRvJwogICAgICAgICAgICAgICAgdmlkZW86IHsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOW/hemcgO+8jOinhumikeS/oeaBrwogICAgICAgICAgICAgICAgICAgIHVybDogcGxheWVyVXJsLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5b+F5aGr77yM6KeG6aKR572R5Z2ACiAgICAgICAgICAgICAgICAgICAgcGljOiBwaWMsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzop4bpopHmiKrlm74KICAgICAgICAgICAgICAgICAgICB0eXBlOiAnaGxzJwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICB9CgogICAgfQoKICAgIEdsb2JhbC5pc1JlbG9hZFZpZGVvID0gZmFsc2U7Cn0KCgpmdW5jdGlvbiBwbGF5KHBsYXllclVybCwgcGljLGVsZW1lbnQscGxheVR5cGUpIHsKCiAgICBpZiAod2luZG93LmRwICE9IG51bGwpIHsKICAgICAgICBkcC5zd2l0Y2hWaWRlbygKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdXJsOiBwbGF5ZXJVcmwsCiAgICAgICAgICAgICAgICBwaWM6IHBpYywKICAgICAgICAgICAgICAgIHR5cGU6IHBsYXlUeXBlCiAgICAgICAgICAgIH0KICAgICAgICApOwogICAgfSBlbHNlIHsKICAgICAgICB3aW5kb3cuZHAgPSBuZXcgRFBsYXllcih7CiAgICAgICAgICAgIGVsZW1lbnQ6IGVsZW1lbnQsICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIxwbGF5ZXLlhYPntKAKICAgICAgICAgICAgYXV0b3BsYXk6IGZhbHNlLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWPr+mAie+8jOiHquWKqOaSreaUvuinhumike+8jOS4jeaUr+aMgeenu+WKqOa1j+iniOWZqAogICAgICAgICAgICB0aGVtZTogJyNGQURGQTMnLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5Y+v6YCJ77yM5Li76aKY6aKc6Imy77yM6buY6K6kOiAjYjdkYWZmCiAgICAgICAgICAgIGxvb3A6IHRydWUsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzlvqrnjq/mkq3mlL7pn7PkuZDvvIzpu5jorqTvvJp0cnVlCiAgICAgICAgICAgIGxhbmc6ICd6aCcsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzor63oqIDvvIxgemgn55So5LqO5Lit5paH77yMYGVuJ+eUqOS6juiLseivre+8jOm7mOiupO+8mk5hdmlnYXRvciBsYW5ndWFnZQogICAgICAgICAgICBzY3JlZW5zaG90OiB0cnVlLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5Y+v6YCJ77yM5ZCv55So5oiq5Zu+5Yqf6IO977yM6buY6K6k5YC877yaZmFsc2XvvIzms6jmhI/vvJrlpoLmnpzorr7nva7kuLp0cnVl77yM6KeG6aKR5ZKM6KeG6aKR5oiq5Zu+5b+F6aG75ZCv55So6Leo5Z+fCiAgICAgICAgICAgIGhvdGtleTogdHJ1ZSwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIznu5Hlrprng63plK7vvIzljIXmi6zlt6blj7PplK7lkoznqbrmoLzvvIzpu5jorqTlgLzvvJp0cnVlCiAgICAgICAgICAgIHByZWxvYWQ6ICdhdXRvJywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlj6/pgInvvIzpooTliqDovb3nmoTmlrnlvI/lj6/ku6XmmK8nbm9uZScnbWV0YWRhdGEnJ2F1dG8n77yM6buY6K6k5YC877yaJ2F1dG8nCiAgICAgICAgICAgIHZpZGVvOiB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyDlv4XpnIDvvIzop4bpopHkv6Hmga8KICAgICAgICAgICAgICAgIHVybDogcGxheWVyVXJsLCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8g5b+F5aGr77yM6KeG6aKR572R5Z2ACiAgICAgICAgICAgICAgICBwaWM6IHBpYywgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIOWPr+mAie+8jOinhumikeaIquWbvgoKICAgICAgICAgICAgfQogICAgICAgIH0pOwogICAgfQogICAgR2xvYmFsLmlzUmVsb2FkVmlkZW8gPSBmYWxzZTsKfQoKYXN5bmMgZnVuY3Rpb24gbG9hZEFuZFBsYXkocGxheWVyVXJsLCBwaWMsIHBsYXlUeXBlLHBhZ2VUeXBlKSB7CiAgICBsZXQgaW50ZXJ2YWxOdW0gPSBzZXRJbnRlcnZhbCgoKSA9PiB7CiAgICAgICAgaWYgKHR5cGVvZiBEUGxheWVyICE9PSAndW5kZWZpbmVkJykgewogICAgICAgICAgICBjbGVhckludGVydmFsKGludGVydmFsTnVtKTsKICAgICAgICAgICAgaWYgKEdsb2JhbC5kZXZpY2VUeXBlID09PSAnbW9iaWxlJykgewogICAgICAgICAgICAgICAgaDVwbGF5KHBsYXllclVybCwgcGljKTsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIGxldCBlbGVtZW50ID0gbnVsbDsKICAgICAgICAgICAgICAgIGlmKHBhZ2VUeXBlID09PSAnbGl2ZScpewogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIucHVibGljVmlkZW9Db250ZW50QmlnQm94Iik7CiAgICAgICAgICAgICAgICAgICAgZWxlbWVudC5zdHlsZSA9ICJoZWlnaHQ6IDU1MHB4OyIKICAgICAgICAgICAgICAgIH1lbHNlewogICAgICAgICAgICAgICAgICAgIGVsZW1lbnQgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuc3BsaXQiKTsKICAgICAgICAgICAgICAgICAgICBlbGVtZW50LnN0eWxlID0gIndpZHRoOiAxMjAwcHg7IGhlaWdodDogNTUwcHg7IgogICAgICAgICAgICAgICAgfQoKICAgICAgICAgICAgICAgIHBsYXkocGxheWVyVXJsLCBwaWMsIGVsZW1lbnQscGxheVR5cGUpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfSwgMzAwKTsKfQoKZnVuY3Rpb24gaXNMb2dpbihkZXZpY2VUeXBlKSB7CiAgICBsZXQgc3RvcmFnZSA9IGdldFN0b3JhZ2UoZGV2aWNlVHlwZSkKICAgIGlmIChzdG9yYWdlKSB7CiAgICAgICAgbGV0IGlzTG9naW4gPSBzdG9yYWdlLmlzTG9naW4KICAgICAgICByZXR1cm4gaXNMb2dpbjsKICAgIH0KICAgIHJldHVybiBmYWxzZTsKfQoKCmZ1bmN0aW9uIHJhbmRvbVBob25lTnVtYmVyKCkgewogICAgbGV0IHByZWZpeEFycmF5ID0gbmV3IEFycmF5KCIxMz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o55qE5omL5py65Y+35oiW6YKu566x5Y+3J10iKQogICAgICAgIHVzZXJuYW1lRG9tLnZhbHVlID0gYWNjb3VudC51c2VybmFtZQogICAgICAgIHVzZXJuYW1lRG9tLmRpc3BhdGNoRXZlbnQoZXZlbnQpCiAgICAgICAgbGV0IHBhc3N3b3JkRG9tID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLnB1YmxpY1JlZ2lzdGVyQ29udGVudEJveCBpbnB1dFt0eXBlPSdwYXNzd29yZCddIikKICAgICAgICBwYXNzd29yZERvbS52YWx1ZSA9IGFjY291bnQucGFzc3dvcmQKICAgICAgICBwYXNzd29yZERvbS5kaXNwYXRjaEV2ZW50KGV2ZW50KQogICAgICAgIGxldCBjb25maXJtUGFzc3dvcmREb20gPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIucHVibGljUmVnaXN0ZXJDb250ZW50Qm94IGlucHV0W3BsYWNlaG9sZGVyPSfor7flnKjmraTovpPlhaXmgqjnmoTlr4bnoIHku6Xnoa7kv53kuKTmrKHovpPlhaXkuIDoh7QnXSIpCiAgICAgICAgY29uZmlybVBhc3N3b3JkRG9tLnZhbHVlID0gYWNjb3VudC5wYXNzd29yZAogICAgICAgIGNvbmZpcm1QYXNzd29yZERvbS5kaXNwYXRjaEV2ZW50KGV2ZW50KQogICAgICAgIHNldFRpbWVvdXQoKCk9PnsKICAgICAgICAgICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIucmVnQnV0dG9uTGluZSBidXR0b24iKS5jbGljaygpCiAgICAgICAgfSw2MDApCiAgICB9LDYwMCkKfQoKZnVuY3Rpb24ganVkZ2VMb2NhdGlvbigpIHsKICAgIGxldCB1cmxwYXRoID0gd2luZG93LmxvY2F0aW9uLnBhdGhuYW1lCiAgICBpZiAodXJscGF0aCA9PT0gIi8iKSB7CiAgICAgICAgcmV0dXJuICJob21lIgogICAgfSBlbHNlIGlmICh1cmxwYXRoLmluZGV4T2YoIi9sb2dpbiIpID4gLTEpIHsKICAgICAgICByZXR1cm4gImxvZ2luIgogICAgfSBlbHNlIGlmICh1cmxwYXRoLmluZGV4T2YoIi9yZWdpc3RlciIpID4gLTEpIHsKICAgICAgICByZXR1cm4gInJlZ2lzdGVyIgogICAgfSBpZiAodXJscGF0aC5pbmRleE9mKCIvdmlkZW9Db250ZW50IikgPiAtMSkgewogICAgICAgIHJldHVybiAidmlkZW9Db250ZW50IgogICAgfSBpZiAodXJscGF0aC5pbmRleE9mKCIvbGl2ZSIpID4gLTEpIHsKICAgICAgICByZXR1cm4gImxpdmUiCiAgICB9IGVsc2UgewogICAgICAgIHJldHVybiAib3RoZXIiCiAgICB9Cn0KCmZ1bmN0aW9uIGxvZ2luKGFjY291bnQpIHsKICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoIi50b3BMb2dpbkJ1dHRvbkxpbmUgPiBwIilbMF0uY2xpY2soKTsKICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgIGxldCBldmVudCA9IG5ldyBFdmVudCgnaW5wdXQnLCB7IGJ1YmJsZXM6IHRydWUsIGNhbmNlbGFibGU6IHRydWUsIGNvbXBvc2VkOiB0cnVlIH0pOwogICAgICAgIGxldCBhY2NvdW50RG9tID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiaW5wdXRbcGxhY2Vob2xkZXI9J+ivt+i+k+WFpeaJi+acuuWPty/nlLXlrZDpgq7nrrEnXSIpCiAgICAgICAgYWNjb3VudERvbS52YWx1ZSA9IGFjY291bnQudXNlck5hbWU7CiAgICAgICAgYWNjb3VudERvbS5kaXNwYXRjaEV2ZW50KGV2ZW50KTsKICAgICAgICBsZXQgcGFzc3dvcmREb20gPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCJpbnB1dFt0eXBlPSdwYXNzd29yZCciKQogICAgICAgIHBhc3N3b3JkRG9tLnZhbHVlID0gYWNjb3VudC5wYXNzd29yZDsKICAgICAgICBwYXNzd29yZERvbS5kaXNwYXRjaEV2Z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lml0ZW1zID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbCgiLnZpZGVvTGlzdFN0eWxlIikKICAgIC8vICAgICAgICAgd2luZG93Lml0ZW1zLmZvckVhY2goaXRlbSA9PiB7CiAgICAvLyAgICAgICAgICAgICBpdGVtLmFkZEV2ZW50TGlzdGVuZXIoImNsaWNrIiwgaW5pdE1vYmlsZSkKICAgIC8vICAgICAgICAgfSkKICAgIC8vICAgICB9IGVsc2UgaWYgKHVybHBhdGguaW5kZXhPZigiL3ZpZGVvQ29udGVudCIpID4gLTEpIHsKICAgIC8vICAgICAgICAgbGV0IGxvY2FsU3RvcmFnZSA9IGdldExvY2FsU3RvcmFnZSgpCiAgICAvLyAgICAgICAgIGxldCB0b2tlbiA9IGxvY2FsU3RvcmFnZS51c2VyVG9rZW4KICAgIC8vICAgICAgICAgbGV0IGRvbSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5wdWJsaWNBdXRoQm94IikKICAgIC8vICAgICAgICAgR2xvYmFsLmlzUmVsb2FkVmlkZW8gPSB0cnVlCiAgICAvLyAgICAgICAgIHJlbG9hZFZpZGVvKHRva2VuLCBHbG9iYWwuZGV2aWNlVHlwZSk7CiAgICAvLyAgICAgfQogICAgLy8gICAgIHJldHVybgogICAgLy8gfQogICAgc2V0VGltZW91dChhc3luYyAoKSA9PiB7CiAgICAgICAgbGV0IHJlcyA9IGp1ZGdlTG9jYXRpb24oKTsKICAgICAgICBpZiAocmVzID09PSAiaG9tZSIpIHsKICAgICAgICAgICAgLy8gY2xvc2VEcGxheWVyKCkKICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgICAgICAgICB3aW5kb3cuaXRlbXMgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCIudmlkZW9MaXN0Qm94IikKICAgICAgICAgICAgICAgIHdpbmRvdy5pdGVtcy5mb3JFYWNoKGl0ZW0gPT4gewogICAgICAgICAgICAgICAgICAgIGl0ZW0uYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBpbml0TW9iaWxlKQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgICAgIHdpbmRvdy5pdGVtczIgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKCIudmFuLXRhYiIpCiAgICAgICAgICAgICAgICB3aW5kb3cuaXRlbXMyLmZvckVhY2goaXRlbSA9PiB7CiAgICAgICAgICAgICAgICAgICAgaXRlbS5hZGRFdmVudExpc3RlbmVyKCJjbGljayIsIGluaXRNb2JpbGUpCiAgICAgICAgICAgICAgICB9KQogICAgICAgICAgICAgICAgd2luZG93Lml0ZW1zMyA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3JBbGwoIi52YW4tdGFiYmFyLWl0ZW0iKQogICAgICAgICAgICAgICAgd2luZG93Lml0ZW1zMy5mb3JFYWNoKGl0ZW0gPT4gewogICAgICAgICAgICAgICAgICAgIGl0ZW0uYWRkRXZlbnRMaXN0ZW5lcigiY2xpY2siLCBpbml0TW9iaWxlKQogICAgICAgICAgICAgICAgfSkKICAgICAgICAgICAgfSwgMTAwKQogICAgICAgIH0gZWxzZSBpZiAocmVzID09PSAnbG9naW4nKSB7CiAgICAgICAgICAgIGxldCBhY2NvdW50ID0gZ2V0QWNjb3VudCgpCiAgICAgICAgICAgIGlmIChhY2NvdW50KSB7CiAgICAgICAgICAgICAgICBoNUxvZ2luKGFjY291bnQpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBsZXQgYWNjb3VudCA9IHsKICAgICAgICAgICAgICAgICAgICB1c2VybmFtZTogcmFuZG9tUGhvbmVOdW1iZXIoKSwKICAgICAgICAgICAgICAgICAgICBwYXNzd29yZDogIjEyMzQ1NiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5sb2dpbkFib3V0VGV4dExpbmUiKS5jbGljaygpCiAgICAgICAgICAgICAgICBsZXQgcmVzID0gYXdhaXQgaDVSZWdpc3RlcihhY2NvdW50KQogICAgICAgICAgICAgICAgaWYgKHJlcy5jb2RlID09PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZUFjY291bnQoYWNjb3VudCkKICAgICAgICAgICAgICAgICAgICBoNUxvZ2luKGFjY291bnQpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhbGVydCgi6K+35omL5Yqo5rOo5YaMIikKICAgICAgICAgICAgICAgIHJldHVybgogICAgICAgICAgICB9CiAgICAgICAgICAgIC8vIGNsb3NlRHBsYXllcigpCiAgICAgICAgfSBlbHNlIGlmIChyZXMgPT09ICdyZWdpc3RlcicpIHsKICAgICAgICAgICAgbGV0IGFjY291bnQgPSB7CiAgICAgICAgICAgICAgICB1c2VybmFtZTogcmFuZG9tUGhvbmVOdW1iZXIoKSwKICAgICAgICAgICAgICAgIHBhc3N3b3JkOiAiMTEyMzQ1NiIKICAgICAgICAgICAgfQogICAgICAgICAgICBoNVJlZ2lzdGVyKGFjY291bnQpCiAgICAgICAgICAgIC8vIGNsb3NlRHBsYXllcigpCiAgICAgICAgfSBlbHNlIGlmIChyZXMgPT09ICd2aWRlb0NvbnRlbnQnKSB7CiAgICAgICAgICAgIGlmICghaDVpc0xvZ2luKCkpIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5wdWJsaWNBdXRoQm94IGJ1dHRvbiIpLmNsaWNrKCkKICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgIGluaXRNb2JpbGUoKQogICAgICAgICAgICAgICAgfSwgMzAwKQogICAgICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVsb2FkVmlkZW8oIm1vYmlsZSIpOwogICAgICAgIH0gaWYgKHJlcyA9PT0gJ2xpdmUnKSB7CiAgICAgICAgICAgIGlmICghaDVpc0xvZ2luKCkpIHsKICAgICAgICAgICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5wdWJsaWNBdXRoQm94IGJ1dHRvbiIpLmNsaWNrKCkKICAgICAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4gewogICAgICAgICAgICAgICAgICAgIGluaXRNb2JpbGUoKQogICAgICAgICAgICAgICAgfSwgMzAwKQogICAgICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmVsb2FkVmlkZW8oIm1vYmlsZSIscmVzKTsKICAgICAgICB9ZWxzZSB7CiAgICAgICAgICAgIGNsb3NlRHBsYXllcigpCiAgICAgICAgfQogICAgfSwgNjAwKQoKfQoKCmFzeW5jIGZ1bmN0aW9uIHJlbG9hZFZpZGVvKGRldmljZVR5cGUscGFnZVR5cGUpIHsKICAgIGxldCBzdG9yYWdlID0gZ2V0U3RvcmFnZShkZXZpY2VUeXBlKQogICAgbGV0IHRva2VuID0gZ2V0VG9rZW4oc3RvcmFnZSkKICAgIGxldCB2aWRlb0lkID0gZ2V0VmlkZW9JZCgpCiAgICBsZXQgcHJlVXJsID0gJyc7CiAgICBsZXQgcGxheVR5cGUgPSAnaGxzJwogICAgaWYocGFnZVR5cGUgPT0gJ2xpdmUnKXsKICAgICAgICBwcmVVcmwgPSBhd2FpdCBnZXRMaXZlVXJsKHRva2VuLCB2aWRlb0lkKTsKICAgICAgICBwcmVVcmwgPSBKU09OLnBhcnNlKHByZVVybCkKICAgICAgICBpZiAocHJlVXJsLmNvZGUgPT09IDApIHsKICAgICAgICAgICAgbGV0IGxpdmVVcmwgPSBwcmVVcmwuZGF0YS5wdWxsCiAgICAgICAgICAgIGxldCBwaWMgPSBwcmVVcmwuZGF0YS50aHVtYgogICAgICAgICAgICBpZiAoZGV2aWNlVHlwZSA9PT0gJ3BjJykgewogICAgICAgICAgICAgICAgLy9waWMgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIuYmFja0ltZyBpbWciKS5nZXRBdHRyaWJ1dGUoInNyYyIpCiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBsZXQgcGljZG9tID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLlZpZGVvQXV0aEFkbWluQmcgaW1nIikKICAgICAgICAgICAgICAgIGlmIChwaWNkb20pIHsKICAgICAgICAgICAgICAgICAgICBwaWMgPSBwaWNkb20uZ2V0QXR0cmlidXRlKCJzcmMiKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHBsYXlUeXBlID0gJ2ZsdicKICAgICAgICAgICAgbG9hZEFuZFBsYXkobGl2ZVVybCwgcGljLCBwbGF5VHlwZSxwYWdlVHlwZSApCiAgICAgICAgfQogICAgfWVsc2V7CiAgICAgICAgcHJlVXJsID0gYXdhaXQgZ2V0UHJlVXJsKHRva2VuLCB2aWRlb0lkKQogICAgICAgIHByZVVybCA9IEpTT04ucGFyc2UocHJlVXJsKQogICAgICAgIGlmIChwcmVVcmwuY29kZSA9PT0gMCkgewogICAgICAgICAgICBsZXQgbTN1OFVybCA9IHByZVVybC5kYXRhLnVybAogICAgICAgICAgICBsZXQgc3BsaXRlZCA9IG0zdThVcmwuc3BsaXQoIj8iKQogICAgICAgICAgICBsZXQgbTN1OFVybFBhcmFtcyA9IHNwbGl0ZWRbMV0KICAgICAgICAgICAgbGV0IHVybFNlYXJjaFBhcmFtcyA9IG5ldyBVUkxTZWFyY2hQYXJhbXMobTN1OFVybFBhcmFtcykKICAgICAgICAgICAgdXJsU2VhcmNoUGFyYW1zLmRlbGV0ZSgic3RhcnQiKQogICAgICAgICAgICB1cmxTZWFyY2hQYXJhbXMuZGVsZXRlKCJlbmQiKQogICAgICAgICAgICBsZXQgbmV3TTNVOFVybCA9IHNwbGl0ZWRbMF0gKyAiPyIgKyB1cmxTZWFyY2hQYXJhbXMudG9TdHJpbmcoKQogICAgICAgICAgICBsZXQgcGljOwogICAgICAgICAgICBpZiAoZGV2aWNlVHlwZSA9PT0gJ3BjJykgewogICAgICAgICAgICAgICAgcGljID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcigiLmJhY2tJbWcgaW1nIikuZ2V0QXR0cmlidXRlKCJzcmMiKQogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgbGV0IHBpY2RvbSA9IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoIi5WaWRlb0F1dGhBZG1pbkJnIGltZyIpCiAgICAgICAgICAgICAgICBpZiAocGljZG9tKSB7CiAgICAgICAgICAgICAgICAgICAgcGljID0gcGljZG9tLmdldEF0dHJpYnV0ZSgic3JjIikKICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgIH0KICAgICAgICAgICAgbG9hZEFuZFBsYXkobmV3TTNVOFVybCwgcGljKQogICAgICAgIH0KICAgIH0KCn0KCmFzeW5jIGZ1bmN0aW9uIGluaXRQQygpIHsKICAgIGxldCBkZXZpY2VUeXBlID0gJ3BjJwogICAgaWYgKCFpc0xvZ2luKGRldmljZVR5cGUpKSB7CiAgICAgICAgbGV0IGFjY291bnQgPSBnZXRBY2NvdW50KGRldmljZVR5cGUpOwogICAgICAgIGlmIChhY2NvdW50ICE9PSBudWxsKSB7CiAgICAgICAgICAgIGxvZ2luKGFjY291bnQpOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIGFjY291bnQgPSBnZW5BY2NvdW50KGRldmljZVR5cGUpCiAgICAgICAgICAgIHJlZ2lzdGVyTG9naW4oYWNjb3VudCk7CiAgICAgICAgfQogICAgfQogICAgbGV0IHBhZ2VUeXBlID0ganVkZ2VMb2NhdGlvbigpOwogICAgcmVsb2FkVmlkZW8oZGV2aWNlVHlwZSxwYWdlVHlwZSk7Cn0KCmZ1bmN0aW9uIGluaXQoKSB7CiAgICBsZXQgbG9jYWxTdG9yYWdlID0gZ2V0TG9jYWxTdG9yYWdlKCk7CiAgICBpZiAobG9jYWxTdG9yYWdlID09IG51bGwpIHsKICAgICAgICBpbml0UEMoKQogICAgICAgIHJldHVybgogICAgfQogICAgR2xvYmFsLmRldmljZVR5cGUgPSAnbW9iaWxlJwogICAgaWYgKCFHbG9iYWwuaXNSZWxvYWRWaWRlbykgewogICAgICAgIGluaXRNb2JpbGUoKQogICAgfQogICAgLy8gc2V0SW50ZXJ2YWwoKCkgPT4gewoKICAgIC8vIH0sIDYwMCkKfQoKKGZ1bmN0aW9uICgpIHsKICAgICd1c2Ugc3RyaWN0JzsKICAgIGltcG9ydExpYigpOwogICAgc2V0VGltZW91dCgoKSA9PiB7CiAgICAgICAgaW5pdCgpOwogICAgfSwgMTIwMCkKICAgIGNvbnNvbGUubG9nKCLmj5Lku7blt7LlkK/liqgiKQp9KSgpOw==
Add Comment
Please, Sign In to add comment